From ac2e2707976a72a45b645f4d4db2576dd911e5be Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Wed, 28 Sep 2011 18:34:25 +0100 Subject: [PATCH] [ticket/10270] Replaced keydown numbers with named constants. PHPBB3-10270 --- phpBB/assets/javascript/core.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index 5ad9258d8a..5a43c0b3cb 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -2,6 +2,8 @@ var phpbb = {}; (function($) { // Avoid conflicts with other libraries +// define a couple constants for keydown functions. +var ENTER = 13, ESC = 27; var dark = $('#darkenwrapper'), @@ -62,7 +64,7 @@ phpbb.alert = function(title, msg, fadedark) { }); $(document).bind('keydown', function(e) { - if (e.keyCode === 13 || e.keyCode === 27) { + if (e.keyCode === ENTER || e.keyCode === ESC) { dark.trigger('click'); return false; } @@ -135,10 +137,10 @@ phpbb.confirm = function(msg, callback, fadedark) { }); $(document).bind('keydown', function(e) { - if (e.keyCode === 13) { + if (e.keyCode === ENTER) { $('input[type="button"].button1').trigger('click'); return false; - } else if (e.keyCode === 27) { + } else if (e.keyCode === ESC) { $('input[type="button"].button2').trigger('click'); return false; }