Commit 76fd2f78 authored by Tomas Pettersson's avatar Tomas Pettersson 🏸

updated getURLParams

parent 9a0b2dde
......@@ -59,6 +59,24 @@ var STWkit = {
}
return '?' + query.join('&');
},
// getURLParams: function(param) {
// var match,
// pl = /\+/g, // Regex for replacing addition symbol with a space
// search = /([^&=]+)=?([^&]*)/g,
// decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
// query = window.location.search.substring(1);
// var urlParams = [];
// while (match = search.exec(query)) {
// if (param == decode(match[1])) {
// urlParams.push();
// urlParams[urlParams.length] = decode(match[2]);
// } else {
// urlParams.push();
// urlParams[urlParams.length] = [decode(match[1]), decode(match[2])];
// }
// }
// return urlParams;
// },
getURLParams: function(param) {
var match,
pl = /\+/g, // Regex for replacing addition symbol with a space
......@@ -67,9 +85,11 @@ var STWkit = {
query = window.location.search.substring(1);
var urlParams = [];
while (match = search.exec(query)) {
if (param == decode(match[1])) {
urlParams.push();
urlParams[urlParams.length] = decode(match[2]);
if (param) {
if (param == decode(match[1])) {
urlParams.push();
urlParams[urlParams.length] = decode(match[2]);
}
} else {
urlParams.push();
urlParams[urlParams.length] = [decode(match[1]), decode(match[2])];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment