mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-04 15:57:45 +02:00
[ticket/10270] Replaced keydown numbers with named constants.
PHPBB3-10270
This commit is contained in:
committed by
Igor Wiedler
parent
7d2422f928
commit
ac2e270797
@@ -2,6 +2,8 @@ var phpbb = {};
|
|||||||
|
|
||||||
(function($) { // Avoid conflicts with other libraries
|
(function($) { // Avoid conflicts with other libraries
|
||||||
|
|
||||||
|
// define a couple constants for keydown functions.
|
||||||
|
var ENTER = 13, ESC = 27;
|
||||||
|
|
||||||
|
|
||||||
var dark = $('#darkenwrapper'),
|
var dark = $('#darkenwrapper'),
|
||||||
@@ -62,7 +64,7 @@ phpbb.alert = function(title, msg, fadedark) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$(document).bind('keydown', function(e) {
|
$(document).bind('keydown', function(e) {
|
||||||
if (e.keyCode === 13 || e.keyCode === 27) {
|
if (e.keyCode === ENTER || e.keyCode === ESC) {
|
||||||
dark.trigger('click');
|
dark.trigger('click');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -135,10 +137,10 @@ phpbb.confirm = function(msg, callback, fadedark) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$(document).bind('keydown', function(e) {
|
$(document).bind('keydown', function(e) {
|
||||||
if (e.keyCode === 13) {
|
if (e.keyCode === ENTER) {
|
||||||
$('input[type="button"].button1').trigger('click');
|
$('input[type="button"].button1').trigger('click');
|
||||||
return false;
|
return false;
|
||||||
} else if (e.keyCode === 27) {
|
} else if (e.keyCode === ESC) {
|
||||||
$('input[type="button"].button2').trigger('click');
|
$('input[type="button"].button2').trigger('click');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user