diff options
Diffstat (limited to 'phpBB/assets/javascript/core.js')
-rw-r--r-- | phpBB/assets/javascript/core.js | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index c18bec7035..30c0a199bf 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -13,6 +13,7 @@ var keymap = { var dark = $('#darkenwrapper'); var loading_alert = $('#loadingalert'); +var phpbbAlertTimer = null; /** @@ -30,7 +31,7 @@ phpbb.loading_alert = function() { loading_alert.show(); dark.fadeIn(phpbb.alert_time, function() { // Wait five seconds and display an error if nothing has been returned by then. - setTimeout(function() { + phpbbAlertTimer = setTimeout(function() { if (loading_alert.is(':visible')) { phpbb.alert($('#phpbb_alert').attr('data-l-err'), $('#phpbb_alert').attr('data-l-timeout-processing-req')); @@ -43,6 +44,16 @@ phpbb.loading_alert = function() { } /** + * Clear loading alert timeout +*/ +phpbb.clearLoadingTimeout = function() { + if (phpbbAlertTimer != null) { + clearTimeout(phpbbAlertTimer); + phpbbAlertTimer = null; + } +} + +/** * Display a simple alert similar to JSs native alert(). * * You can only call one alert or confirm box at any one time. @@ -271,6 +282,8 @@ phpbb.ajaxify = function(options) { { var alert; + phpbb.clearLoadingTimeout(); + // Is a confirmation required? if (typeof res.S_CONFIRM_ACTION === 'undefined') { @@ -341,6 +354,7 @@ phpbb.ajaxify = function(options) { { var alert; + phpbb.clearLoadingTimeout(); alert = phpbb.alert(dark.attr('data-ajax-error-title'), dark.attr('data-ajax-error-text')); } @@ -438,7 +452,10 @@ phpbb.timezone_switch_date = function(keep_selection) { } if (typeof keep_selection !== 'undefined' && !keep_selection) { - $('#timezone > option:first').attr('selected', true); + var timezoneOptions = $('#timezone > optgroup option'); + if (timezoneOptions.filter(':selected').length <= 0) { + timezoneOptions.filter(':first').attr('selected', true); + } } } |