diff --git a/background.js b/background.js index 9c28008..cefa8c1 100644 --- a/background.js +++ b/background.js @@ -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}; }, {