diff options
Diffstat (limited to 'phpBB/assets/javascript')
-rw-r--r-- | phpBB/assets/javascript/core.js | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index ca62a5f649..4920a1167f 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -26,6 +26,7 @@ phpbb.loadingIndicator = function() { if (!loadingIndicator.is(':visible')) { loadingIndicator.fadeIn(phpbb.alertTime); // Wait fifteen seconds and display an error if nothing has been returned by then. + phpbb.clearLoadingTimeout(); phpbbAlertTimer = setTimeout(function() { if (loadingIndicator.is(':visible')) { phpbb.alert($('#phpbb_alert').attr('data-l-err'), $('#phpbb_alert').attr('data-l-timeout-processing-req')); @@ -315,7 +316,7 @@ phpbb.ajaxify = function(options) { refresh = false; } - setTimeout(function() { + phpbbAlertTimer = setTimeout(function() { if (refresh) { window.location = res.REFRESH_DATA.url; } @@ -1082,6 +1083,27 @@ phpbb.registerPalette = function(el) { } /** +* Set display of page element +* +* @param string id The ID of the element to change +* @param int action Set to 0 if element display should be toggled, -1 for +* hiding the element, and 1 for showing it. +* @param string type Display type that should be used, e.g. inline, block or +* other CSS "display" types +*/ +phpbb.toggleDisplay = function(id, action, type) { + if (!type) { + type = 'block'; + } + + var display = $('#' + id).css('display'); + if (!action) { + action = (display === '' || display === type) ? -1 : 1; + } + $('#' + id).css('display', ((action === 1) ? type : 'none')); +} + +/** * Apply code editor to all textarea elements with data-bbcode attribute */ $(document).ready(function() { |