Last active
March 10, 2019 17:25
-
-
Save sergiosusa/588a457787509e6bd1207309a9b5f8c9 to your computer and use it in GitHub Desktop.
This file contains 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
/**** Url ****/ | |
function getCurrentUrl() { | |
return window.location.href; | |
} | |
function getParameterByName(name, url) { | |
if (!url) url = window.location.href; | |
name = name.replace(/[\[\]]/g, "\\$&"); | |
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), | |
results = regex.exec(url); | |
if (!results) return null; | |
if (!results[2]) return ''; | |
return decodeURIComponent(results[2].replace(/\+/g, " ")); | |
} | |
/**** Page Options ****/ | |
function realoadPage(miliseconds) { | |
return setInterval(function () { | |
window.location.reload(); | |
}, miliseconds); | |
} | |
function closePage(miliseconds) { | |
return setInterval(function () { | |
window.close(); | |
}, miliseconds); | |
} | |
/**** DOM Manipulation ****/ | |
function insertAfter(newNode, referenceNode) { | |
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); | |
} | |
function insertBefore(newNode, referenceNode) { | |
referenceNode.parentNode.insertBefore(newNode, referenceNode); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment