From: Mike Taylor Date: Tue, 18 Feb 2014 16:25:41 +0000 (-0500) Subject: Move utility function getParameterByName() into the scope where it's needed. X-Git-Tag: 1.0.0~1420 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=5defa893fdac809e2378d18bcf5c650722149a89;p=mkws-moved-to-github.git Move utility function getParameterByName() into the scope where it's needed. --- diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index 539f2bf..d41cba3 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -1131,6 +1131,16 @@ function team($, teamName) { } + // This function is taken from a StackOverflow answer + // http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript/901144#901144 + function getParameterByName(name) { + name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); + var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), + results = regex.exec(location.search); + return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); + } + + /* locale */ function M(word) { var lang = mkws_config.lang; @@ -1355,16 +1365,6 @@ function team($, teamName) { } - // This function is taken from a StackOverflow answer - // http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript/901144#901144 - function getParameterByName(name) { - name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); - var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), - results = regex.exec(location.search); - return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); - } - - $(document).ready(function() { debug("on load ready"); default_mkws_config();