From: Mike Taylor Date: Tue, 4 Mar 2014 13:05:12 +0000 (+0000) Subject: Last (for now!) re-ordering. X-Git-Tag: 1.0.0~1341 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=5d67f02b01d5d376478471eda5393958507e3587;p=mkws-moved-to-github.git Last (for now!) re-ordering. The whole sequence makes a lot more sense now. --- diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index ae26ff1..9cbd283 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -855,21 +855,46 @@ function team($, teamName) { } - function mkwsHtmlSwitch() { - debug("HTML switch for team " + m_teamName); + /* create locale language menu */ + function mkwsHtmlLang() { + var lang_default = "en"; + var lang = mkws_config.lang || lang_default; + var list = []; - var node = findnode(".mkwsSwitch"); - node.append($('' + M('Records') + '')); - node.append($("", { text: " | " })); - node.append($('' + M('Targets') + '')); + /* display a list of configured languages, or all */ + var lang_options = mkws_config.lang_options || []; + var toBeIncluded = {}; + for (var i = 0; i < lang_options.length; i++) { + toBeIncluded[lang_options[i]] = true; + } - debug("HTML targets"); - var node = findnode(".mkwsTargets"); - node.html('\ -
\ - No information available yet.\ -
'); - node.css("display", "none"); + for (var k in mkws.locale_lang) { + if (toBeIncluded[k] || lang_options.length == 0) + list.push(k); + } + + // add english link + if (lang_options.length == 0 || toBeIncluded[lang_default]) + list.push(lang_default); + + debug("Language menu for: " + list.join(", ")); + + /* the HTML part */ + var data = ""; + for(var i = 0; i < list.length; i++) { + var l = list[i]; + + if (data) + data += ' | '; + + if (lang == l) { + data += ' ' + l + ' '; + } else { + data += ' ' + l + ' ' + } + } + + findnode(".mkwsLang").html(data); } @@ -913,46 +938,21 @@ function team($, teamName) { } - /* create locale language menu */ - function mkwsHtmlLang() { - var lang_default = "en"; - var lang = mkws_config.lang || lang_default; - var list = []; - - /* display a list of configured languages, or all */ - var lang_options = mkws_config.lang_options || []; - var toBeIncluded = {}; - for (var i = 0; i < lang_options.length; i++) { - toBeIncluded[lang_options[i]] = true; - } - - for (var k in mkws.locale_lang) { - if (toBeIncluded[k] || lang_options.length == 0) - list.push(k); - } - - // add english link - if (lang_options.length == 0 || toBeIncluded[lang_default]) - list.push(lang_default); - - debug("Language menu for: " + list.join(", ")); - - /* the HTML part */ - var data = ""; - for(var i = 0; i < list.length; i++) { - var l = list[i]; - - if (data) - data += ' | '; + function mkwsHtmlSwitch() { + debug("HTML switch for team " + m_teamName); - if (lang == l) { - data += ' ' + l + ' '; - } else { - data += ' ' + l + ' ' - } - } + var node = findnode(".mkwsSwitch"); + node.append($('' + M('Records') + '')); + node.append($("", { text: " | " })); + node.append($('' + M('Targets') + '')); - findnode(".mkwsLang").html(data); + debug("HTML targets"); + var node = findnode(".mkwsTargets"); + node.html('\ +
\ + No information available yet.\ +
'); + node.css("display", "none"); }