Pail/background.js

24 lines
620 B
JavaScript
Raw Normal View History

2018-04-25 11:06:59 -04:00
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
2018-12-06 09:58:41 -05:00
if (details.url.match(/^https?:\/\/(www.)*reddit.com\/poll/)) {
return
2018-11-20 01:59:07 -05:00
}
2018-04-25 10:43:21 -04:00
return {redirectUrl: oldReddit + details.url.match(/^https?:\/\/[^\/]+([\S\s]*)/)[1]}
},
{
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/*",
"*://pay.reddit.com/*"
2018-04-25 10:43:21 -04:00
],
types: ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"]
},
["blocking"]
)