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 oldReddit = "https://old.reddit.com";
|
||||||
|
const excludedPaths = [
|
||||||
|
"/gallery",
|
||||||
|
"/poll",
|
||||||
|
"/rpan",
|
||||||
|
"/settings",
|
||||||
|
"/topics"];
|
||||||
|
|
||||||
chrome.webRequest.onBeforeRequest.addListener(
|
chrome.webRequest.onBeforeRequest.addListener(
|
||||||
function(details) {
|
function(details) {
|
||||||
// Exclude poll pages
|
const url = new URL(details.url);
|
||||||
if (details.url.match(/^https?:\/\/(www\.)*reddit.com\/poll/)) {
|
|
||||||
return;
|
if (url.hostname === "old.reddit.com") return;
|
||||||
|
|
||||||
|
for (const path of excludedPaths) {
|
||||||
|
if (url.pathname.indexOf(path) === 0) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {redirectUrl: oldReddit + url.pathname + url.search + url.hash};
|
||||||
redirectUrl:
|
|
||||||
oldReddit + details.url.match(/^https?:\/\/[^\/]+([\S\s]*)/)[1]
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
urls: [
|
urls: [
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "Old Reddit Redirect",
|
"name": "Old Reddit Redirect",
|
||||||
"description": "Ensure Reddit always loads the old design",
|
"description": "Ensure Reddit always loads the old design",
|
||||||
"version": "1.1.4",
|
"version": "1.2.0",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"background": {"scripts":["background.js"]},
|
"background": {"scripts":["background.js"]},
|
||||||
"icons": {
|
"icons": {
|
||||||
|
|
Loading…
Reference in New Issue