Created
February 20, 2018 02:02
-
-
Save t-laird/57acb7c325d81b1532d5b31a9293333f 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
(function(l) { | |
const nonHomeUrls = ['/snap-ninja', '/Headcount', '/comp-3', '/Centipede', 'SWapiBox', 'Weathrly']; | |
for (let i = 0; i < nonHomeUrls.length; i++) { | |
const urlRegex = new RegExp(nonHomeUrls[i], 'i'); | |
const verifyUrl = urlRegex.test(l.pathname); | |
if (verifyUrl) { | |
return; | |
} | |
} | |
if (l.search) { | |
var q = {}; | |
l.search.slice(1).split('&').forEach(function(v) { | |
var a = v.split('='); | |
q[a[0]] = a.slice(1).join('=').replace(/~and~/g, '&'); | |
}); | |
if (q.p !== undefined) { | |
window.history.replaceState(null, null, | |
l.pathname.slice(0, -1) + (q.p || '') + | |
(q.q ? ('?' + q.q) : '') + | |
l.hash | |
); | |
} | |
} | |
}(window.location)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment