diff options
| author | Callum Macrae <callum@lynxphp.com> | 2011-07-26 12:13:09 +0100 | 
|---|---|---|
| committer | Igor Wiedler <igor@wiedler.ch> | 2012-03-31 02:09:12 +0200 | 
| commit | e4ea4d1c579477389349a06190643391ea8740fc (patch) | |
| tree | 9163a8f86718b4ed5627674525c76da31bf98280 /phpBB/styles/script.js | |
| parent | 149daa0e4fbe5bf59a613caf850ecda083cc772a (diff) | |
| download | forums-e4ea4d1c579477389349a06190643391ea8740fc.tar forums-e4ea4d1c579477389349a06190643391ea8740fc.tar.gz forums-e4ea4d1c579477389349a06190643391ea8740fc.tar.bz2 forums-e4ea4d1c579477389349a06190643391ea8740fc.tar.xz forums-e4ea4d1c579477389349a06190643391ea8740fc.zip  | |
[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
Diffstat (limited to 'phpBB/styles/script.js')
| -rw-r--r-- | phpBB/styles/script.js | 42 | 
1 files changed, 16 insertions, 26 deletions
diff --git a/phpBB/styles/script.js b/phpBB/styles/script.js index 66e99a6a63..8c7324e39a 100644 --- a/phpBB/styles/script.js +++ b/phpBB/styles/script.js @@ -50,6 +50,8 @@ phpbb.loading_alert = function() {   *   * @param string title Title of the message, eg "Information"   * @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.   */ @@ -61,18 +63,10 @@ phpbb.alert = function(title, msg, fadedark) {  		return true;  	});  	$(dark).one('click', function(e) { -		if (typeof fadedark === 'undefined' || fadedark) -		{ -			dark.fadeOut(function() { -				div.remove(); -			}); -		} -		else -		{ -			div.fadeOut(function() { -				div.remove(); -			}); -		} +		var fade = (typeof fadedark !== 'undefined' && !fadedark) ? div : dark; +		fade.fadeOut(function() { +			div.remove(); +		});  		return false;  	}); @@ -102,7 +96,10 @@ phpbb.alert = function(title, msg, fadedark) {   * Display a simple yes / no box to the user.   *   * @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.   */ @@ -112,19 +109,12 @@ phpbb.confirm = function(msg, callback, fadedark) {  		<input type="button" class="jalertbut button2" value="No" /></div>');  	div.find('.jalertbut').bind('click', function() { -		if (typeof fadedark === 'undefined' || fadedark) -		{ -			dark.fadeOut(function() { -				div.remove(); -			}); -		} -		else -		{ -			div.fadeOut(function() { -				div.remove(); -			}); -		} -		callback(this.value === 'Yes'); +		var res = this.value === 'Yes'; +		var fade = (typeof fadedark !== 'undefined' && !fadedark && res) ? div : dark; +		fade.fadeOut(function() { +			div.remove(); +		}); +		callback(res);  		return false;  	});  | 
