Pail/background.js

32 lines
650 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) {
2020-07-16 07:15:38 -04:00
let urlParser = document.createElement("a");
urlParser.href = details.url;
if (urlParser.hostname == "old.reddit.com") return;
return {redirectUrl: oldReddit + urlParser.pathname};
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/*",
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"]
);