Merge pull request #34 from Lachcim/galleries
Collective fix for new Reddit features as of July 2020
This commit is contained in:
commit
ea26a03353
|
@ -1,16 +1,22 @@
|
|||
const oldReddit = "https://old.reddit.com";
|
||||
const excludedPaths = [
|
||||
"/gallery",
|
||||
"/poll",
|
||||
"/rpan",
|
||||
"/settings",
|
||||
"/topics"];
|
||||
|
||||
chrome.webRequest.onBeforeRequest.addListener(
|
||||
function(details) {
|
||||
// Exclude poll pages
|
||||
if (details.url.match(/^https?:\/\/(www\.)*reddit.com\/poll/)) {
|
||||
return;
|
||||
const url = new URL(details.url);
|
||||
|
||||
if (url.hostname === "old.reddit.com") return;
|
||||
|
||||
for (const path of excludedPaths) {
|
||||
if (url.pathname.indexOf(path) === 0) return;
|
||||
}
|
||||
|
||||
return {
|
||||
redirectUrl:
|
||||
oldReddit + details.url.match(/^https?:\/\/[^\/]+([\S\s]*)/)[1]
|
||||
};
|
||||
return {redirectUrl: oldReddit + url.pathname + url.search + url.hash};
|
||||
},
|
||||
{
|
||||
urls: [
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "Old Reddit Redirect",
|
||||
"description": "Ensure Reddit always loads the old design",
|
||||
"version": "1.1.4",
|
||||
"version": "1.2.0",
|
||||
"manifest_version": 2,
|
||||
"background": {"scripts":["background.js"]},
|
||||
"icons": {
|
||||
|
|
Loading…
Reference in New Issue