From: Mike Taylor Date: Mon, 3 Mar 2014 17:22:28 +0000 (+0000) Subject: Move related utility functions together. X-Git-Tag: 1.0.0~1352 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=9eea29aeca3e286e6a9754dd0f4a7afee56c8a8e;p=mkws-moved-to-github.git Move related utility functions together. --- diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index abee7d2..e7d36be 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -978,19 +978,6 @@ function team($, teamName) { } - // implement $.parseQuerystring() for parsing URL parameters - function parseQuerystring() { - var nvpair = {}; - var qs = window.location.search.replace('?', ''); - var pairs = qs.split('&'); - $.each(pairs, function(i, v){ - var pair = v.split('='); - nvpair[pair[0]] = pair[1]; - }); - return nvpair; - } - - function mkwsSetLang() { var lang = parseQuerystring().lang || mkws_config.lang; if (!lang || !mkws.locale_lang[lang]) { @@ -1142,6 +1129,19 @@ function team($, teamName) { } + // implement $.parseQuerystring() for parsing URL parameters + function parseQuerystring() { + var nvpair = {}; + var qs = window.location.search.replace('?', ''); + var pairs = qs.split('&'); + $.each(pairs, function(i, v){ + var pair = v.split('='); + nvpair[pair[0]] = pair[1]; + }); + return nvpair; + } + + // This function is taken from a StackOverflow answer // http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript/901144#901144 // ### should we unify this and parseQuerystring()?