Skip to content

Instantly share code, notes, and snippets.

@p3c-bot
Last active April 7, 2020 04:14
Show Gist options
  • Save p3c-bot/232711822ed198260be9c2c4d0171b72 to your computer and use it in GitHub Desktop.
Save p3c-bot/232711822ed198260be9c2c4d0171b72 to your computer and use it in GitHub Desktop.
Implementation of URL
// FOR ALL PURCHASED TO GO THROUGH SINGLE MASTERNODE - REPLACE THIS
// var masternode = "0x0000000000000000000000000000000000000000"
///////////// and comment this out otherwise leave it
var masternode = getURL(window.location.search.substring(1)).ref;
///////////////////////////////////////////////////
function getURL(query) {
var vars = query.split("&");
var query_string = {};
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
// If first entry with this name
if (typeof query_string[pair[0]] === "undefined") {
query_string[pair[0]] = decodeURIComponent(pair[1]);
// If second entry with this name
} else if (typeof query_string[pair[0]] === "string") {
var arr = [query_string[pair[0]], decodeURIComponent(pair[1])];
query_string[pair[0]] = arr;
// If third or later entry with this name
} else {
query_string[pair[0]].push(decodeURIComponent(pair[1]));
}
}
return query_string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment