Escaped period in www. - also used prettier to format document and fix minor issues (eg missing semi-colons)

This commit is contained in:
Terry Agapitos 2019-01-09 16:29:22 +11:00
parent 9e9102c45d
commit 8a2c656379
1 changed files with 18 additions and 6 deletions

View File

@ -1,13 +1,16 @@
const oldReddit = "https://old.reddit.com" const oldReddit = "https://old.reddit.com";
chrome.webRequest.onBeforeRequest.addListener( chrome.webRequest.onBeforeRequest.addListener(
function(details) { function(details) {
// Exclude poll pages // Exclude poll pages
if (details.url.match(/^https?:\/\/(www.)*reddit.com\/poll/)) { if (details.url.match(/^https?:\/\/(www\.)*reddit.com\/poll/)) {
return return;
} }
return {redirectUrl: oldReddit + details.url.match(/^https?:\/\/[^\/]+([\S\s]*)/)[1]} return {
redirectUrl:
oldReddit + details.url.match(/^https?:\/\/[^\/]+([\S\s]*)/)[1]
};
}, },
{ {
urls: [ urls: [
@ -17,7 +20,16 @@ chrome.webRequest.onBeforeRequest.addListener(
"*://new.reddit.com/*", "*://new.reddit.com/*",
"*://pay.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"] ["blocking"]
) );