[ticket/10270] Fixed a bug where fadedark wouldn't go.

If the confirm box was submitted as yes, then the fadedark would stay until it
was clicked. This commit fixes that.

PHPBB3-10270
This commit is contained in:
Callum Macrae 2011-07-26 12:13:09 +01:00 committed by Igor Wiedler
parent 149daa0e4f
commit e4ea4d1c57

View file

@ -50,6 +50,8 @@ phpbb.loading_alert = function() {
* *
* @param string title Title of the message, eg "Information" * @param string title Title of the message, eg "Information"
* @param string msg Message to display. Can be HTML. * @param string msg Message to display. Can be HTML.
* @param bool fadedark Remove the dark background when done? Defaults
* to yes.
* *
* @return Returns the div created. * @return Returns the div created.
*/ */
@ -61,18 +63,10 @@ phpbb.alert = function(title, msg, fadedark) {
return true; return true;
}); });
$(dark).one('click', function(e) { $(dark).one('click', function(e) {
if (typeof fadedark === 'undefined' || fadedark) var fade = (typeof fadedark !== 'undefined' && !fadedark) ? div : dark;
{ fade.fadeOut(function() {
dark.fadeOut(function() { div.remove();
div.remove(); });
});
}
else
{
div.fadeOut(function() {
div.remove();
});
}
return false; return false;
}); });
@ -102,7 +96,10 @@ phpbb.alert = function(title, msg, fadedark) {
* Display a simple yes / no box to the user. * Display a simple yes / no box to the user.
* *
* @param string msg Message to display. Can be HTML. * @param string msg Message to display. Can be HTML.
* @param function callback Callback. * @param function callback Callback. Bool param, whether the user pressed
* yes or no (or whatever their language is).
* @param bool fadedark Remove the dark background when done? Defaults
* to yes.
* *
* @return Returns the div created. * @return Returns the div created.
*/ */
@ -112,19 +109,12 @@ phpbb.confirm = function(msg, callback, fadedark) {
<input type="button" class="jalertbut button2" value="No" /></div>'); <input type="button" class="jalertbut button2" value="No" /></div>');
div.find('.jalertbut').bind('click', function() { div.find('.jalertbut').bind('click', function() {
if (typeof fadedark === 'undefined' || fadedark) var res = this.value === 'Yes';
{ var fade = (typeof fadedark !== 'undefined' && !fadedark && res) ? div : dark;
dark.fadeOut(function() { fade.fadeOut(function() {
div.remove(); div.remove();
}); });
} callback(res);
else
{
div.fadeOut(function() {
div.remove();
});
}
callback(this.value === 'Yes');
return false; return false;
}); });