diff options
Diffstat (limited to 'phpBB/assets/javascript/core.js')
-rw-r--r-- | phpBB/assets/javascript/core.js | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index 40da09377e..8bbea8b8c9 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -57,7 +57,7 @@ phpbb.clearLoadingTimeout = function() { * @param string title Title of the message, eg "Information" (HTML). * @param string msg Message to display (HTML). * @param bool fadedark Remove the dark background when done? Defaults - * to yes. + * to yes. * * @returns object Returns the div created. */ @@ -121,9 +121,9 @@ phpbb.alert = function(title, msg, fadedark) { * * @param string msg Message to display (HTML). * @param function callback Callback. Bool param, whether the user pressed - * yes or no (or whatever their language is). + * yes or no (or whatever their language is). * @param bool fadedark Remove the dark background when done? Defaults - * to yes. + * to yes. * * @returns object Returns the div created. */ @@ -232,10 +232,10 @@ phpbb.parseQuerystring = function(string) { * * @param object options Options. * @param bool/function refresh If we are sent back a refresh, should it be - * acted upon? This can either be true / false / a function. + * acted upon? This can either be true / false / a function. * @param function callback Callback to call on completion of event. Has - * three parameters: the element that the event was evoked from, the JSON - * that was returned and (if it is a form) the form action. + * three parameters: the element that the event was evoked from, the JSON + * that was returned and (if it is a form) the form action. */ phpbb.ajaxify = function(options) { var elements = $(options.selector), @@ -252,6 +252,11 @@ phpbb.ajaxify = function(options) { return; } + function errorHandler() { + phpbb.clearLoadingTimeout(); + phpbb.alert(dark.attr('data-ajax-error-title'), dark.attr('data-ajax-error-text')); + } + /** * This is a private function used to handle the callbacks, refreshes * and alert. It calls the callback, refreshes the page if necessary, and @@ -320,13 +325,6 @@ phpbb.ajaxify = function(options) { } } - function errorHandler() { - var alert; - - phpbb.clearLoadingTimeout(); - alert = phpbb.alert(dark.attr('data-ajax-error-title'), dark.attr('data-ajax-error-text')); - } - // If the element is a form, POST must be used and some extra data must // be taken from the form. var runFilter = (typeof options.filter === 'function'); @@ -355,8 +353,7 @@ phpbb.ajaxify = function(options) { return; } - if (overlay && (typeof $this.attr('data-overlay') === 'undefined' || $this.attr('data-overlay') == 'true')) - { + if (overlay && (typeof $this.attr('data-overlay') === 'undefined' || $this.attr('data-overlay') === 'true')) { phpbb.loadingAlert(); } @@ -389,7 +386,7 @@ phpbb.ajaxify = function(options) { * @param bool keepSelection Shall we keep the value selected, or shall the user be forced to repick one. */ phpbb.timezoneSwitchDate = function(keepSelection) { - if ($('#timezone_copy').length == 0) { + if ($('#timezone_copy').length === 0) { // We make a backup of the original dropdown, so we can remove optgroups // instead of setting display to none, because IE and chrome will not // hide options inside of optgroups and selects via css @@ -399,17 +396,17 @@ phpbb.timezoneSwitchDate = function(keepSelection) { $('#timezone').replaceWith($('#timezone_copy').clone().attr('id', 'timezone').css('display', 'block').attr('name', 'tz')); } - if ($('#tz_date').val() != '') { + if ($('#tz_date').val() !== '') { $('#timezone > optgroup').remove(":not([label='" + $('#tz_date').val() + "'])"); } - if ($('#tz_date').val() == $('#tz_select_date_suggest').attr('data-suggested-tz')) { + if ($('#tz_date').val() === $('#tz_select_date_suggest').attr('data-suggested-tz')) { $('#tz_select_date_suggest').css('display', 'none'); } else { $('#tz_select_date_suggest').css('display', 'inline'); } - if ($("#timezone > optgroup[label='" + $('#tz_date').val() + "'] > option").size() == 1) { + if ($("#timezone > optgroup[label='" + $('#tz_date').val() + "'] > option").size() === 1) { // If there is only one timezone for the selected date, we just select that automatically. $("#timezone > optgroup[label='" + $('#tz_date').val() + "'] > option:first").attr('selected', true); keepSelection = true; @@ -440,12 +437,11 @@ phpbb.timezonePreselectSelect = function(forceSelector) { // The offset returned here is in minutes and negated. // http://www.w3schools.com/jsref/jsref_getTimezoneOffset.asp var offset = (new Date()).getTimezoneOffset(); + var sign = '-'; if (offset < 0) { - var sign = '+'; + sign = '+'; offset = -offset; - } else { - var sign = '-'; } var minutes = offset % 60; @@ -466,12 +462,13 @@ phpbb.timezonePreselectSelect = function(forceSelector) { var prefix = 'GMT' + sign + hours + ':' + minutes; var prefixLength = prefix.length; var selectorOptions = $('#tz_date > option'); + var i; - for (var i = 0; i < selectorOptions.length; ++i) { + for (i = 0; i < selectorOptions.length; ++i) { var option = selectorOptions[i]; - if (option.value.substring(0, prefixLength) == prefix) { - if ($('#tz_date').val() != option.value && !forceSelector) { + if (option.value.substring(0, prefixLength) === prefix) { + if ($('#tz_date').val() !== option.value && !forceSelector) { // We do not select the option for the user, but notify him, // that we would suggest a different setting. phpbb.timezoneSwitchDate(true); |