From 8a2c656379cbb00d95d674131c052762247d2afa Mon Sep 17 00:00:00 2001 From: Terry Agapitos Date: Wed, 9 Jan 2019 16:29:22 +1100 Subject: [PATCH] Escaped period in www. - also used prettier to format document and fix minor issues (eg missing semi-colons) --- background.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/background.js b/background.js index 4b0b185..eb52170 100644 --- a/background.js +++ b/background.js @@ -1,13 +1,16 @@ -const oldReddit = "https://old.reddit.com" +const oldReddit = "https://old.reddit.com"; chrome.webRequest.onBeforeRequest.addListener( function(details) { // Exclude poll pages - if (details.url.match(/^https?:\/\/(www.)*reddit.com\/poll/)) { - return + if (details.url.match(/^https?:\/\/(www\.)*reddit.com\/poll/)) { + return; } - return {redirectUrl: oldReddit + details.url.match(/^https?:\/\/[^\/]+([\S\s]*)/)[1]} + return { + redirectUrl: + oldReddit + details.url.match(/^https?:\/\/[^\/]+([\S\s]*)/)[1] + }; }, { urls: [ @@ -17,7 +20,16 @@ chrome.webRequest.onBeforeRequest.addListener( "*://new.reddit.com/*", "*://pay.reddit.com/*" ], - types: ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"] + types: [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "object", + "xmlhttprequest", + "other" + ] }, ["blocking"] -) +);