X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-core.js;h=9668cd19bda4c58fcfd12a53687d609a7d9a0656;hb=a442ae54ee85ce806e8b9c33b6e4845f7c7fde92;hp=e63d32e5149eed409d9e70c805720cc51bc5f4c5;hpb=dbed25b95eeec3ff3f8961a560394beadfa759f5;p=mkws-moved-to-github.git diff --git a/src/mkws-core.js b/src/mkws-core.js index e63d32e..9668cd1 100644 --- a/src/mkws-core.js +++ b/src/mkws-core.js @@ -96,14 +96,14 @@ mkws.log = function(string) { }; -mkws.objectWithParent = function(parent) { - function thing() {} // Must be function so `prototype' works - - thing.prototype = parent; - var res = new thing(); - thing.prototype = null; - return res; -}; +// This function is taken from a StackOverflow answer +// http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript/901144#901144 +mkws.getParameterByName = function(name) { + name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); + var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), + results = regex.exec(location.search); + return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); +} mkws.registerWidgetType = function(name, fn) {