From 265907b1150303ca141be0f09de4093cbfb6d9f5 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Wed, 8 Feb 2012 18:40:08 +0100 Subject: [PATCH] [feature/ajax] Replace keyboard vars with a keymap PHPBB3-10270 --- phpBB/assets/javascript/core.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index d32bb2d1c2..7b6bc4304a 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -4,9 +4,10 @@ phpbb.alert_time = 100; (function($) { // Avoid conflicts with other libraries // define a couple constants for keydown functions. -var ENTER = 13; -var ESC = 27; - +var keymap = { + ENTER: 13, + ESC: 27 +}; var dark = $('#darkenwrapper'); var loading_alert = $('#loadingalert'); @@ -70,7 +71,7 @@ phpbb.alert = function(title, msg, fadedark) { }); $(document).bind('keydown', function(e) { - if (e.keyCode === ENTER || e.keyCode === ESC) { + if (e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) { dark.trigger('click'); return false; } @@ -147,10 +148,10 @@ phpbb.confirm = function(msg, callback, fadedark) { }); $(document).bind('keydown', function(e) { - if (e.keyCode === ENTER) { + if (e.keyCode === keymap.ENTER) { $('input[type="button"].button1').trigger('click'); return false; - } else if (e.keyCode === ESC) { + } else if (e.keyCode === keymap.ESC) { $('input[type="button"].button2').trigger('click'); return false; }