Merge pull request #13 from TerryAg/master

Escaped period in www.
This commit is contained in:
Tom Watson 2019-01-09 09:54:51 +01:00 committed by GitHub
commit 77fed12f15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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"]
) );