From 3d0c2dbb8da626cbe17d0d44b4c787a2fa84ac8f Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Fri, 28 Dec 2012 15:18:19 +0100 Subject: [PATCH] readability of array-functions activated set pieces are no longer undefined english in the language menu should now display its tooltips in kind --- power/aowowPower.js | 2 +- template/js/global.js | 39 +++++++++++++++++++++++---------------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/power/aowowPower.js b/power/aowowPower.js index 667a318b..e8e3821b 100644 --- a/power/aowowPower.js +++ b/power/aowowPower.js @@ -271,7 +271,7 @@ if (typeof $WowheadPower == "undefined") { locale = $WH.g_getLocaleFromDomain(domain); /* edit start */ - if (domain == "www") { + if (in_array(['fr', 'de', 'es', 'ru', 'en'], domain) == -1) { for (i in document.scripts) { if (!document.scripts[i].src) continue; diff --git a/template/js/global.js b/template/js/global.js index f1e95e86..f952a381 100644 --- a/template/js/global.js +++ b/template/js/global.js @@ -187,31 +187,38 @@ function number_format(a) { } return number_format(a.substr(0, a.length - 3)) + "," + a.substr(a.length - 3) + x } -function is_array(b) { - return !! (b && b.constructor == Array) + +function is_array(arr) { + return !!(arr && arr.constructor == Array); } -function in_array(c, g, h, e) { - if (c == null) { - return -1 + +function in_array(arr, val, func, idx) { + if (arr == null) { + return -1; } - if (h) { - return in_arrayf(c, g, h, e) + + if (func) { + return in_arrayf(arr, val, func, idx); } - for (var d = e || 0, b = c.length; d < b; ++d) { - if (c[d] == g) { - return d + + for (var i = idx || 0, len = arr.length; i < len; ++i) { + if (arr[i] == val) { + return i; } } - return -1 + + return -1; } -function in_arrayf(c, g, h, e) { - for (var d = e || 0, b = c.length; d < b; ++d) { - if (h(c[d]) == g) { - return d + +function in_arrayf(arr, val, func, idx) { + for (var i = idx || 0, len = arr.length; i < len; ++i) { + if (func(arr[i]) == val) { + return i; } } - return -1 + return -1; } + function rs() { var e = rs.random; var b = "";