Pail/background.js

36 lines
700 B
JavaScript
Raw Normal View History

const oldReddit = "https://old.reddit.com";
2018-04-25 10:43:21 -04:00
chrome.webRequest.onBeforeRequest.addListener(
function(details) {
2018-11-20 01:59:07 -05:00
// Exclude poll pages
if (details.url.match(/^https?:\/\/(www\.)*reddit.com\/poll/)) {
return;
2018-11-20 01:59:07 -05:00
}
return {
redirectUrl:
oldReddit + details.url.match(/^https?:\/\/[^\/]+([\S\s]*)/)[1]
};
2018-04-25 10:43:21 -04:00
},
{
urls: [
"*://reddit.com/*",
"*://www.reddit.com/*",
2018-05-03 09:10:45 -04:00
"*://np.reddit.com/*",
2018-06-12 05:21:54 -04:00
"*://new.reddit.com/*",
"*://amp.reddit.com/*",
2018-04-25 10:43:21 -04:00
],
types: [
"main_frame",
"sub_frame",
"stylesheet",
"script",
"image",
"object",
"xmlhttprequest",
"other"
]
2018-04-25 10:43:21 -04:00
},
["blocking"]
);