Last active
November 4, 2016 19:16
-
-
Save wilcorrea/a2e85f78c5ab20546681c0ac2f68cfe0 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
<script> | |
function $_GET(name, url) { | |
if (!url) { | |
url = window.location.href; | |
} | |
name = name.replace(/[\[\]]/g, "\\$&"); | |
const regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"); | |
const results = regex.exec(url); | |
if (!results) { | |
return null; | |
} | |
if (!results[2]) { | |
return ''; | |
} | |
return decodeURIComponent(results[2].replace(/\+/g, " ")); | |
} | |
</script> | |
<script> | |
const code = $_GET('page'); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment