From: Mike Taylor Date: Mon, 3 Mar 2014 13:44:30 +0000 (+0000) Subject: Move some global code down out of the team object. X-Git-Tag: 1.0.0~1369 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=23b60f99a77df0448ca337205716ea682b469611;p=mkws-moved-to-github.git Move some global code down out of the team object. --- diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index a1f6f70..2e0c5fd 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -228,24 +228,6 @@ function team($, teamName) { m_sort = mkws_config.sort_default; debug("copied mkws_config.sort_default '" + mkws_config.sort_default + "' to m_sort"); - // ### should be in global code - if (mkws_config.query_width < 5 || mkws_config.query_width > 150) { - debug("Reset query width: " + mkws_config.query_width); - mkws_config.query_width = 50; - } - - // ### should be in global code - for (var key in mkws_config) { - if (mkws_config.hasOwnProperty(key)) { - if (key.match(/^language_/)) { - var lang = key.replace(/^language_/, ""); - // Copy custom languages into list - mkws.locale_lang[lang] = mkws_config[key]; - debug("Added locally configured language '" + lang + "'"); - } - } - } - // protocol independent link for pazpar2: "//mkws/sp" -> "https://mkws/sp" if (mkws_config.pazpar2_url.match(/^\/\//)) { mkws_config.pazpar2_url = document.location.protocol + mkws_config.pazpar2_url; @@ -1442,6 +1424,22 @@ function team($, teamName) { debug("on load ready"); default_mkws_config(); + if (mkws_config.query_width < 5 || mkws_config.query_width > 150) { + debug("Reset query width: " + mkws_config.query_width); + mkws_config.query_width = 50; + } + + for (var key in mkws_config) { + if (mkws_config.hasOwnProperty(key)) { + if (key.match(/^language_/)) { + var lang = key.replace(/^language_/, ""); + // Copy custom languages into list + mkws.locale_lang[lang] = mkws_config[key]; + debug("Added locally configured language '" + lang + "'"); + } + } + } + // Backwards compatibility: set new magic class names on any // elements that have the old magic IDs. var ids = [ "Switch", "Lang", "Search", "Pager", "Navi",