1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 20:13:22 +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) { div.bind('click', function(e) {
e.stopPropagation(); e.stopPropagation();
return true;
}); });
dark.one('click', function(e) { dark.one('click', function(e) {
div.find('.alert_close').unbind('click'); div.find('.alert_close').unbind('click');
@ -67,15 +66,18 @@ phpbb.alert = function(title, msg, fadedark) {
fade.fadeOut(phpbb.alert_time, function() { fade.fadeOut(phpbb.alert_time, function() {
div.hide(); div.hide();
}); });
return false;
e.preventDefault();
e.stopPropagation();
}); });
$(document).bind('keydown', function(e) { $(document).bind('keydown', function(e) {
if (e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) { if (e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) {
dark.trigger('click'); dark.trigger('click');
return false;
e.preventDefault();
e.stopPropagation();
} }
return true;
}); });
div.find('.alert_close').one('click', function() { div.find('.alert_close').one('click', function() {
@ -123,10 +125,9 @@ phpbb.confirm = function(msg, callback, fadedark) {
div.bind('click', function(e) { div.bind('click', function(e) {
e.stopPropagation(); e.stopPropagation();
return true;
}); });
var click_handler = function() { var click_handler = function(e) {
var res = this.className === 'button1'; var res = this.className === 'button1';
var fade = (typeof fadedark !== 'undefined' && !fadedark && res) ? div : dark; var fade = (typeof fadedark !== 'undefined' && !fadedark && res) ? div : dark;
fade.fadeOut(phpbb.alert_time, function() { 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); div.find('input[type="button"]').unbind('click', click_handler);
callback(res); callback(res);
return false;
if (e) {
e.preventDefault();
e.stopPropagation();
}
}; };
div.find('input[type="button"]').one('click', click_handler); div.find('input[type="button"]').one('click', click_handler);
@ -144,18 +149,21 @@ phpbb.confirm = function(msg, callback, fadedark) {
div.hide(); div.hide();
}); });
callback(false); callback(false);
return false;
e.preventDefault();
e.stopPropagation();
}); });
$(document).bind('keydown', function(e) { $(document).bind('keydown', function(e) {
if (e.keyCode === keymap.ENTER) { if (e.keyCode === keymap.ENTER) {
$('input[type="button"].button1').trigger('click'); $('input[type="button"].button1').trigger('click');
return false; e.preventDefault();
e.stopPropagation();
} else if (e.keyCode === keymap.ESC) { } else if (e.keyCode === keymap.ESC) {
$('input[type="button"].button2').trigger('click'); $('input[type="button"].button2').trigger('click');
return false; e.preventDefault();
e.stopPropagation();
} }
return true;
}); });
div.find('.alert_close').one('click', function() { div.find('.alert_close').one('click', function() {
@ -238,7 +246,7 @@ phpbb.ajaxify = function(options, refresh, callback) {
if ($this.attr('data-ajax') == false) if ($this.attr('data-ajax') == false)
{ {
return true; return;
} }
/** /**