Last active
September 3, 2015 10:02
-
-
Save addisaden/9f1bcb969fa8707517ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// window.location.toString() => "http://localhost:7777/?search=bla+bli+blubb+%40+%22wababab+%26%2B13%22" | |
var b = {}; | |
window.location.search.replace(/^\?/, "") | |
.split("&") | |
.map(function(e) { | |
var r = e.match(/([^=]+)=(.+)/); | |
return r ? [decodeURIComponent(r[1]), decodeURIComponent(r[2].replace(/\+/g, " "))] : [null, null]; | |
}) | |
.map(function(x) { b[x[0]] = x[1]; }); | |
b // = { search: "bla bli blubb @ "wababab &+13"" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment