Add exception system
This commit is contained in:
parent
9f06826bed
commit
90181d4125
|
@ -1,4 +1,6 @@
|
|||
const oldReddit = "https://old.reddit.com";
|
||||
const excludedSubdomains = ["blog.reddit.com", "oauth.reddit.com", "out.reddit.com"];
|
||||
const excludedPaths = ["/poll", "/gallery", "/rpan", "/settings"];
|
||||
|
||||
chrome.webRequest.onBeforeRequest.addListener(
|
||||
function(details) {
|
||||
|
@ -7,6 +9,12 @@ chrome.webRequest.onBeforeRequest.addListener(
|
|||
|
||||
if (urlParser.hostname == "old.reddit.com") return;
|
||||
|
||||
if (excludedSubdomains.indexOf(urlParser.hostname) != -1) return;
|
||||
|
||||
for (const path of excludedPaths)
|
||||
if (urlParser.pathname.indexOf(path) == 0)
|
||||
return;
|
||||
|
||||
return {redirectUrl: oldReddit + urlParser.pathname};
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue