1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 12:03:21 +01:00

[feature/ajax] Replace return false with explicit preventDefault()

PHPBB3-10270
This commit is contained in:
Igor Wiedler 2012-02-08 18:58:23 +01:00
parent 30888ff2a0
commit b100bb9a69

View File

@ -59,7 +59,6 @@ phpbb.alert = function(title, msg, fadedark) {
div.bind('click', function(e) {
e.stopPropagation();
return true;
});
dark.one('click', function(e) {
div.find('.alert_close').unbind('click');
@ -67,15 +66,18 @@ phpbb.alert = function(title, msg, fadedark) {
fade.fadeOut(phpbb.alert_time, function() {
div.hide();
});
return false;
e.preventDefault();
e.stopPropagation();
});
$(document).bind('keydown', function(e) {
if (e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) {
dark.trigger('click');
return false;
e.preventDefault();
e.stopPropagation();
}
return true;
});
div.find('.alert_close').one('click', function() {
@ -123,10 +125,9 @@ phpbb.confirm = function(msg, callback, fadedark) {
div.bind('click', function(e) {
e.stopPropagation();
return true;
});
var click_handler = function() {
var click_handler = function(e) {
var res = this.className === 'button1';
var fade = (typeof fadedark !== 'undefined' && !fadedark && res) ? div : dark;
fade.fadeOut(phpbb.alert_time, function() {
@ -134,7 +135,11 @@ phpbb.confirm = function(msg, callback, fadedark) {
});
div.find('input[type="button"]').unbind('click', click_handler);
callback(res);
return false;
if (e) {
e.preventDefault();
e.stopPropagation();
}
};
div.find('input[type="button"]').one('click', click_handler);
@ -144,18 +149,21 @@ phpbb.confirm = function(msg, callback, fadedark) {
div.hide();
});
callback(false);
return false;
e.preventDefault();
e.stopPropagation();
});
$(document).bind('keydown', function(e) {
if (e.keyCode === keymap.ENTER) {
$('input[type="button"].button1').trigger('click');
return false;
e.preventDefault();
e.stopPropagation();
} else if (e.keyCode === keymap.ESC) {
$('input[type="button"].button2').trigger('click');
return false;
e.preventDefault();
e.stopPropagation();
}
return true;
});
div.find('.alert_close').one('click', function() {
@ -238,7 +246,7 @@ phpbb.ajaxify = function(options, refresh, callback) {
if ($this.attr('data-ajax') == false)
{
return true;
return;
}
/**