diff --git a/background.js b/background.js index edb050a..c2888cb 100644 --- a/background.js +++ b/background.js @@ -1,22 +1,17 @@ const oldReddit = "https://old.reddit.com"; -const excludedPaths = [ - "/gallery", - "/poll", - "/rpan", - "/settings", - "/topics"]; +const excludedPaths = ["/gallery", "/poll", "/rpan", "/settings", "/topics"]; chrome.webRequest.onBeforeRequest.addListener( - function(details) { + function (details) { const url = new URL(details.url); - + if (url.hostname === "old.reddit.com") return; - + for (const path of excludedPaths) { if (url.pathname.indexOf(path) === 0) return; } - - return {redirectUrl: oldReddit + url.pathname + url.search + url.hash}; + + return { redirectUrl: oldReddit + url.pathname + url.search + url.hash }; }, { urls: [ @@ -34,8 +29,8 @@ chrome.webRequest.onBeforeRequest.addListener( "image", "object", "xmlhttprequest", - "other" - ] + "other", + ], }, ["blocking"] ); diff --git a/manifest.json b/manifest.json index 2c27b34..b7c09c0 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "description": "Ensure Reddit always loads the old design", "version": "1.2.0", "manifest_version": 2, - "background": {"scripts":["background.js"]}, + "background": { "scripts": ["background.js"] }, "icons": { "48": "img/icon48.png", "128": "img/icon128.png"