1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-31 03:29:23 +02:00

[ticket/11314] Cleanup core.js coding

function errorHandler() was used in returnHandler() before it was defined.
The unused variable alert has been removed from errorHandler(). Overuse of
the var keyword for the variable sign has been removed and the if
statement has been simplified. The definition of the variable i has been
moved outside of the for loop definition. The var keyword shouldn't be
used inside the definition of the for loop.

PHPBB3-11314
This commit is contained in:
Marc Alexander 2013-01-10 10:59:20 +01:00
parent dc8d4dbf30
commit 9c4f0d51df

View File

@ -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');
@ -440,12 +438,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,8 +463,9 @@ 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) {