Skip to content

Instantly share code, notes, and snippets.

@t-laird
Created February 20, 2018 02:02
Show Gist options
  • Save t-laird/57acb7c325d81b1532d5b31a9293333f to your computer and use it in GitHub Desktop.
Save t-laird/57acb7c325d81b1532d5b31a9293333f to your computer and use it in GitHub Desktop.
(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