1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-10 16:35:35 +02:00

[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) {
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);
return $alert;
@ -129,6 +116,14 @@ phpbb.alert.open = function($alert) {
$alert.on('click', function(e) {
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) {
var confirmed = this.name === 'confirm',
fadedark = fadedark || !confirmed;
closeBox(fadedark, confirmed, e, true);
});
$dark.one('click', function(e) {
closeBox(true, false, e, true);
});
$confirmDiv.find('.alert_close').one('click', function(e) {
closeBox(true, false, e, false);
});
var closeBox = function(fadedark, confirmed, event, stopPropagation) {
if (confirmed) {
callback(true);
}
$confirmDiv.find('input[type="button"]').off('click.phpbb.confirmbox');
callback(confirmed);
phpbb.alert.close($confirmDiv, fadedark, event, stopPropagation);
};
phpbb.alert.close($confirmDiv, fadedark, e, true);
});
phpbb.alert.open($confirmDiv);