[ticket/13018] Reduce the delta further.

The callback does not actually do anything when cancelling the confirmation
box so we can avoid calling it altogether when cancel is clicked.

PHPBB3-13018
This commit is contained in:
Cesar G 2014-09-14 15:49:18 -07:00
parent 6d80770ba4
commit 5034b3ad7d

View file

@ -81,22 +81,9 @@ phpbb.alert = function(title, msg, fadedark) {
$(document).on('keydown.phpbb.alert', function(e) { $(document).on('keydown.phpbb.alert', function(e) {
if (e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) { if (e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) {
closeBox(true, e, true); phpbb.alert.close($alert, true, e, true);
} }
}); });
$dark.one('click', function(e) {
closeBox(true, e, true);
});
$alert.find('.alert_close').one('click', function(e) {
closeBox(true, e, false);
});
var closeBox = function(fadedark, event, stopPropagation) {
phpbb.alert.close($alert, fadedark, event, stopPropagation);
};
phpbb.alert.open($alert); phpbb.alert.open($alert);
return $alert; return $alert;
@ -129,6 +116,14 @@ phpbb.alert.open = function($alert) {
$alert.on('click', function(e) { $alert.on('click', function(e) {
e.stopPropagation(); e.stopPropagation();
}); });
$dark.one('click', function(e) {
phpbb.alert.close($alert, true, e, true);
});
$alert.find('.alert_close').one('click', function(e) {
phpbb.alert.close($alert, true, e, false);
});
}; };
/** /**
@ -188,22 +183,13 @@ phpbb.confirm = function(msg, callback, fadedark) {
$confirmDiv.find('input[type="button"]').one('click.phpbb.confirmbox', function(e) { $confirmDiv.find('input[type="button"]').one('click.phpbb.confirmbox', function(e) {
var confirmed = this.name === 'confirm', var confirmed = this.name === 'confirm',
fadedark = fadedark || !confirmed; fadedark = fadedark || !confirmed;
closeBox(fadedark, confirmed, e, true);
});
$dark.one('click', function(e) { if (confirmed) {
closeBox(true, false, e, true); callback(true);
}); }
$confirmDiv.find('.alert_close').one('click', function(e) {
closeBox(true, false, e, false);
});
var closeBox = function(fadedark, confirmed, event, stopPropagation) {
$confirmDiv.find('input[type="button"]').off('click.phpbb.confirmbox'); $confirmDiv.find('input[type="button"]').off('click.phpbb.confirmbox');
callback(confirmed); phpbb.alert.close($confirmDiv, fadedark, e, true);
phpbb.alert.close($confirmDiv, fadedark, event, stopPropagation); });
};
phpbb.alert.open($confirmDiv); phpbb.alert.open($confirmDiv);