Cleaning code
This commit is contained in:
parent
9f90a84d30
commit
b157cc8f27
|
@ -61,39 +61,39 @@ function setRimgoCustomRedirects(val) {
|
|||
console.log("rimgoCustomRedirects: ", val)
|
||||
}
|
||||
|
||||
let disableImgur;
|
||||
const getDisableImgur = () => disableImgur;
|
||||
function setDisableImgur(val) {
|
||||
disableImgur = val;
|
||||
browser.storage.sync.set({ disableImgur })
|
||||
let disable;
|
||||
const getDisable = () => disable;
|
||||
function setDisable(val) {
|
||||
disable = val;
|
||||
browser.storage.sync.set({ disableImgur: disable })
|
||||
}
|
||||
|
||||
function redirect(url, initiator, type) {
|
||||
function isImgur(url, initiator) {
|
||||
if (disable) return false;
|
||||
if (url.pathname == "/") return false;
|
||||
if (
|
||||
initiator &&
|
||||
([...redirects.rimgo.normal, ...rimgoCustomRedirects].includes(initiator.origin) || targets.includes(initiator.host))
|
||||
) return false;
|
||||
return targets.some((rx) => rx.test(url.href));
|
||||
}
|
||||
|
||||
function redirect(url, type) {
|
||||
// https://imgur.com/gallery/s4WXQmn
|
||||
// https://imgur.com/a/H8M4rcp
|
||||
// https://imgur.com/gallery/gYiQLWy
|
||||
// https://imgur.com/gallery/cTRwaJU
|
||||
// https://i.imgur.com/CFSQArP.jpeg
|
||||
|
||||
if (disableImgur) return null;
|
||||
|
||||
if (url.pathname == "/") return null;
|
||||
|
||||
if (type != "main_frame" && "sub_frame" && "xmlhttprequest" && "other") return null;
|
||||
|
||||
let instancesList = [...rimgoRedirectsChecks, ...rimgoCustomRedirects];
|
||||
if (instancesList.length === 0) return null;
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList)
|
||||
|
||||
if (initiator && (instancesList.includes(initiator.origin) || targets.includes(initiator.host))) return null;
|
||||
|
||||
return `${randomInstance}${url.pathname}${url.search}`;
|
||||
}
|
||||
|
||||
function isImgur(url) {
|
||||
return targets.some((rx) => rx.test(url.href));
|
||||
}
|
||||
|
||||
async function init() {
|
||||
return new Promise((resolve) => {
|
||||
browser.storage.sync.get(
|
||||
|
@ -104,9 +104,9 @@ async function init() {
|
|||
"rimgoCustomRedirects",
|
||||
],
|
||||
(result) => {
|
||||
disableImgur = result.disableImgur ?? false;
|
||||
if (result.imgurRedirects)
|
||||
redirects = result.imgurRedirects;
|
||||
disable = result.disableImgur ?? false;
|
||||
|
||||
if (result.imgurRedirects) redirects = result.imgurRedirects;
|
||||
|
||||
rimgoRedirectsChecks = result.rimgoRedirectsChecks ?? [...redirects.rimgo.normal];
|
||||
rimgoCustomRedirects = result.rimgoCustomRedirects ?? [];
|
||||
|
@ -118,14 +118,12 @@ async function init() {
|
|||
}
|
||||
|
||||
export default {
|
||||
targets,
|
||||
|
||||
getRedirects,
|
||||
getCustomRedirects,
|
||||
setRedirects,
|
||||
|
||||
getDisableImgur,
|
||||
setDisableImgur,
|
||||
getDisable,
|
||||
setDisable,
|
||||
|
||||
getRimgoRedirectsChecks,
|
||||
setRimgoRedirectsChecks,
|
||||
|
|
|
@ -42,7 +42,6 @@ function setRedirects(val) {
|
|||
setBibliogramRedirectsChecks(bibliogramRedirectsChecks);
|
||||
}
|
||||
|
||||
|
||||
let bibliogramRedirectsChecks;
|
||||
const getBibliogramRedirectsChecks = () => bibliogramRedirectsChecks;
|
||||
function setBibliogramRedirectsChecks(val) {
|
||||
|
@ -84,45 +83,40 @@ const reservedPaths = [
|
|||
"tv",
|
||||
"reel",
|
||||
];
|
||||
|
||||
const bypassPaths = /\/(accounts\/|embeds?.js)/;
|
||||
|
||||
let disableInstagram;
|
||||
const getDisableInstagram = () => disableInstagram;
|
||||
function setDisableInstagram(val) {
|
||||
disableInstagram = val;
|
||||
browser.storage.sync.set({ disableInstagram })
|
||||
let disable;
|
||||
const getDisable = () => disable;
|
||||
function setDisable(val) {
|
||||
disable = val;
|
||||
browser.storage.sync.set({ disableInstagram: disable })
|
||||
}
|
||||
|
||||
function redirect(url, initiator, type) {
|
||||
if (disableInstagram) return null;
|
||||
function isInstagram(url, initiator) {
|
||||
if (disable) return false;
|
||||
if (
|
||||
initiator &&
|
||||
([...redirects.bibliogram.normal, ...bibliogramCustomRedirects].includes(initiator.origin) || targets.includes(initiator.host))
|
||||
)
|
||||
return false; // Do not redirect Bibliogram view on Instagram links
|
||||
return targets.includes(url.host)
|
||||
}
|
||||
|
||||
function redirect(url, type) {
|
||||
if (type !== "main_frame" || url.pathname.match(bypassPaths))
|
||||
return 'CANCEL'; // Do not redirect /accounts, /embeds.js, or anything other than main_frame
|
||||
|
||||
let instancesList = [...bibliogramRedirectsChecks, ...bibliogramCustomRedirects];
|
||||
if (instancesList.length === 0) return null;
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList)
|
||||
|
||||
// Do not redirect Bibliogram view on Instagram links
|
||||
if (initiator && (instancesList.includes(initiator.origin) || targets.includes(initiator.host)))
|
||||
return null;
|
||||
|
||||
// Do not redirect /accounts, /embeds.js, or anything other than main_frame
|
||||
if (type !== "main_frame" || url.pathname.match(bypassPaths))
|
||||
return 'CANCEL';
|
||||
|
||||
console.log("Hello", url.href)
|
||||
|
||||
if (url.pathname === "/" || reservedPaths.includes(url.pathname.split("/")[1])) {
|
||||
console.log("wewe")
|
||||
if (url.pathname === "/" || reservedPaths.includes(url.pathname.split("/")[1]))
|
||||
return `${randomInstance}${url.pathname}${url.search}`;
|
||||
}
|
||||
else {
|
||||
console.log("A user profile")
|
||||
return `${randomInstance}/u${url.pathname}${url.search}`;
|
||||
} // Likely a user profile, redirect to '/u/...'
|
||||
else
|
||||
return `${randomInstance}/u${url.pathname}${url.search}`; // Likely a user profile, redirect to '/u/...'
|
||||
}
|
||||
|
||||
function isInstagram(url) {
|
||||
return targets.includes(url.host)
|
||||
}
|
||||
|
||||
async function init() {
|
||||
return new Promise((resolve) => {
|
||||
|
@ -134,19 +128,17 @@ async function init() {
|
|||
"bibliogramCustomRedirects",
|
||||
],
|
||||
(result) => {
|
||||
disableInstagram = result.disableInstagram ?? false;
|
||||
disable = result.disableInstagram ?? false;
|
||||
|
||||
if (result.instagramRedirects) redirects = result.instagramRedirects
|
||||
|
||||
bibliogramRedirectsChecks = result.bibliogramRedirectsChecks ?? [...redirects.bibliogram.normal];
|
||||
|
||||
bibliogramCustomRedirects = result.bibliogramCustomRedirects ?? [];
|
||||
|
||||
resolve();
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
export default {
|
||||
|
@ -154,8 +146,8 @@ export default {
|
|||
getCustomRedirects,
|
||||
setRedirects,
|
||||
|
||||
getDisableInstagram,
|
||||
setDisableInstagram,
|
||||
getDisable,
|
||||
setDisable,
|
||||
|
||||
getBibliogramRedirectsChecks,
|
||||
setBibliogramRedirectsChecks,
|
||||
|
|
|
@ -29,16 +29,13 @@ function addressToLatLng(address, callback) {
|
|||
if (xmlhttp.readyState === XMLHttpRequest.DONE) {
|
||||
if (xmlhttp.status === 200) {
|
||||
const json = JSON.parse(xmlhttp.responseText)[0];
|
||||
if (json) {
|
||||
callback(
|
||||
if (json) callback(
|
||||
`${json.lat}%2C${json.lon}`,
|
||||
`${json.boundingbox[2]},${json.boundingbox[1]},${json.boundingbox[3]},${json.boundingbox[0]}`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
console.info("Error: Status is " + xmlhttp.status);
|
||||
}
|
||||
}
|
||||
};
|
||||
xmlhttp.open(
|
||||
"GET",
|
||||
|
@ -48,18 +45,20 @@ function addressToLatLng(address, callback) {
|
|||
xmlhttp.send();
|
||||
}
|
||||
|
||||
let disableMaps;
|
||||
const getDisableMaps = () => disableMaps;
|
||||
function setDisableMaps(val) {
|
||||
disableMaps = val;
|
||||
browser.storage.sync.set({ disableMaps })
|
||||
let disable;
|
||||
const getDisable = () => disable;
|
||||
function setDisable(val) {
|
||||
disable = val;
|
||||
browser.storage.sync.set({ disableMaps: disable })
|
||||
}
|
||||
|
||||
function redirect(url, initiator) {
|
||||
if (disableMaps) return null;
|
||||
|
||||
if (initiator && initiator.host === "earth.google.com") return null;
|
||||
function isMaps(url, initiator) {
|
||||
if (disable) return false;
|
||||
if (initiator && initiator.host === "earth.google.com") return false;
|
||||
return url.href.match(targets);
|
||||
}
|
||||
|
||||
function redirect(url) {
|
||||
let redirect;
|
||||
let link = commonHelper.getRandomInstance(redirects.normal);
|
||||
let mapCentre = "";
|
||||
|
@ -104,10 +103,7 @@ function redirect(url, initiator) {
|
|||
addressToLatLng(url.searchParams.get("destination"), (coords) => destination = coords);
|
||||
redirect = `${link}/directions?engine=${travelMode}&route=${origin}%3B${destination}${mapCentre}${params}`;
|
||||
// Get marker from data attribute
|
||||
} else if (
|
||||
url.pathname.includes("data=") &&
|
||||
url.pathname.match(dataLatLngRegex)
|
||||
) {
|
||||
} else if (url.pathname.includes("data=") && url.pathname.match(dataLatLngRegex)) {
|
||||
const [mlat, mlon] = url.pathname.match(dataLatLngRegex);
|
||||
redirect = `${link}/?mlat=${mlat.replace("!3d", "")}&mlon=${mlon.replace("!4d", "")}${mapCentre}${params}`;
|
||||
// Get marker from ll param
|
||||
|
@ -130,16 +126,12 @@ function redirect(url, initiator) {
|
|||
return redirect;
|
||||
}
|
||||
|
||||
function isMaps(url) {
|
||||
return url.href.match(targets)
|
||||
}
|
||||
|
||||
async function init() {
|
||||
return new Promise((resolve) => {
|
||||
browser.storage.sync.get(
|
||||
"disableMaps",
|
||||
(result) => {
|
||||
disableMaps = result.disableMaps ?? false
|
||||
disable = result.disableMaps ?? false
|
||||
resolve();
|
||||
}
|
||||
);
|
||||
|
@ -147,9 +139,8 @@ async function init() {
|
|||
}
|
||||
|
||||
export default {
|
||||
addressToLatLng,
|
||||
getDisableMaps,
|
||||
setDisableMaps,
|
||||
getDisable,
|
||||
setDisable,
|
||||
redirect,
|
||||
isMaps,
|
||||
init,
|
||||
|
|
|
@ -64,42 +64,35 @@ function setScribeCustomRedirects(val) {
|
|||
console.log("scribeCustomRedirects: ", val)
|
||||
}
|
||||
|
||||
let disableMedium;
|
||||
const getDisableMedium = () => disableMedium;
|
||||
function setDisableMedium(val) {
|
||||
disableMedium = val;
|
||||
browser.storage.sync.set({ disableMedium })
|
||||
let disable;
|
||||
const getDisable = () => disable;
|
||||
function setDisable(val) {
|
||||
disable = val;
|
||||
browser.storage.sync.set({ disableMedium: disable })
|
||||
}
|
||||
|
||||
function isMedium(url, initiator) {
|
||||
if (disable) return false;
|
||||
if (url.pathname == "/") return false;
|
||||
|
||||
if (
|
||||
commonHelper.isFirefox() &&
|
||||
initiator && ([...redirects.scribe.normal, ...scribeCustomRedirects].includes(initiator.origin) || targets.includes(initiator.host))
|
||||
) return false;
|
||||
|
||||
function redirect(url, initiator, type) {
|
||||
|
||||
if (disableMedium) return null;
|
||||
|
||||
if (url.pathname == "/") return null;
|
||||
return targets.some((rx) => rx.test(url.host));
|
||||
}
|
||||
function redirect(url, type) {
|
||||
|
||||
if (type != "main_frame" && "sub_frame" && "xmlhttprequest" && "other") return null;
|
||||
|
||||
|
||||
let instancesList = [...scribeRedirectsChecks, ...scribeCustomRedirects];
|
||||
if (instancesList.length === 0) return null;
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList)
|
||||
|
||||
if (
|
||||
commonHelper.isFirefox() && initiator &&
|
||||
(instancesList.includes(initiator.origin) || targets.includes(initiator.host))
|
||||
) {
|
||||
browser.storage.sync.set({ redirectBypassFlag: true });
|
||||
return null;
|
||||
}
|
||||
return `${randomInstance}${url.pathname}${url.search}`;
|
||||
}
|
||||
|
||||
function isMedium(url) {
|
||||
return targets.some((rx) => rx.test(url.host));
|
||||
}
|
||||
|
||||
async function init() {
|
||||
return new Promise((resolve) => {
|
||||
browser.storage.sync.get(
|
||||
|
@ -110,12 +103,13 @@ async function init() {
|
|||
"scribeCustomRedirects",
|
||||
],
|
||||
(result) => {
|
||||
disableMedium = result.disableMedium ?? false;
|
||||
if (result.mediumRedirects)
|
||||
redirects = result.mediumRedirects;
|
||||
disable = result.disableMedium ?? false;
|
||||
|
||||
if (result.mediumRedirects) redirects = result.mediumRedirects;
|
||||
|
||||
scribeRedirectsChecks = result.scribeRedirectsChecks ?? [...redirects.scribe.normal];
|
||||
scribeCustomRedirects = result.scribeCustomRedirects ?? [];
|
||||
|
||||
resolve();
|
||||
}
|
||||
)
|
||||
|
@ -130,8 +124,8 @@ export default {
|
|||
getCustomRedirects,
|
||||
setRedirects,
|
||||
|
||||
getDisableMedium,
|
||||
setDisableMedium,
|
||||
getDisable,
|
||||
setDisable,
|
||||
|
||||
getScribeRedirectsChecks,
|
||||
setScribeRedirectsChecks,
|
||||
|
|
|
@ -145,24 +145,26 @@ function setRedditFrontend(val) {
|
|||
browser.storage.sync.set({ redditFrontend })
|
||||
};
|
||||
|
||||
function isReddit(url, initiator) {
|
||||
if (
|
||||
initiator &&
|
||||
(
|
||||
[...redirects.libreddit.normal, ...libredditCustomRedirects].includes(initiator.origin) ||
|
||||
[...redirects.teddit.normal, ...tedditCustomRedirects].includes(initiator.origin) ||
|
||||
targets.includes(initiator.host)
|
||||
)
|
||||
) return false;
|
||||
return targets.includes(url.host)
|
||||
}
|
||||
|
||||
function redirect(url, initiator, type) {
|
||||
function redirect(url, type) {
|
||||
if (disableReddit) return null;
|
||||
|
||||
// Do not redirect when already on the selected view
|
||||
// if ((initiator && initiator.origin === redditInstance) || url.origin === redditInstance)
|
||||
// return null;
|
||||
|
||||
|
||||
// Do not redirect exclusions nor anything other than main_frame
|
||||
if (type !== "main_frame" || url.pathname.match(bypassPaths))
|
||||
return null;
|
||||
if (type !== "main_frame" || url.pathname.match(bypassPaths)) return null;
|
||||
|
||||
let libredditInstancesList = [...libredditRedirectsChecks, ...libredditCustomRedirects];
|
||||
|
||||
let tedditInstancesList = [...tedditRedirectsChecks, ...tedditCustomRedirects];
|
||||
|
||||
|
||||
if (url.host === "i.redd.it") {
|
||||
if (libredditInstancesList.length === 0) return null;
|
||||
let libredditRandomInstance = commonHelper.getRandomInstance(libredditInstancesList);
|
||||
|
@ -195,21 +197,15 @@ function redirect(url, initiator, type) {
|
|||
if (redditFrontend == 'libreddit') {
|
||||
if (libredditInstancesList.length === 0) return null;
|
||||
let libredditRandomInstance = commonHelper.getRandomInstance(libredditInstancesList);
|
||||
|
||||
return `${libredditRandomInstance}${url.pathname}${url.search}`;
|
||||
}
|
||||
if (redditFrontend == 'teddit') {
|
||||
if (tedditInstancesList.length === 0) return null;
|
||||
let tedditRandomInstance = commonHelper.getRandomInstance(tedditInstancesList);
|
||||
|
||||
return `${tedditRandomInstance}${url.pathname}${url.search}`;
|
||||
}
|
||||
}
|
||||
|
||||
function isReddit(url) {
|
||||
return targets.includes(url.host)
|
||||
}
|
||||
|
||||
async function init() {
|
||||
return new Promise((resolve) => {
|
||||
browser.storage.sync.get(
|
||||
|
|
|
@ -161,6 +161,13 @@ function setSearxRedirects(val) {
|
|||
}
|
||||
setSearxRedirectsChecks(searxRedirectsChecks);
|
||||
}
|
||||
|
||||
function setWhoogleRedirects(val) {
|
||||
redirects.whoogle = val;
|
||||
browser.storage.sync.set({ searchRedirects: redirects })
|
||||
console.log("whoogleRedirects:", val)
|
||||
}
|
||||
|
||||
let whoogleRedirectsChecks;
|
||||
const getWhoogleRedirectsChecks = () => whoogleRedirectsChecks;
|
||||
function setWhoogleRedirectsChecks(val) {
|
||||
|
@ -199,57 +206,51 @@ function setSearxCustomRedirects(val) {
|
|||
console.log("searxCustomRedirects: ", val)
|
||||
}
|
||||
|
||||
function setWhoogleRedirects(val) {
|
||||
redirects.whoogle = val;
|
||||
browser.storage.sync.set({ searchRedirects: redirects })
|
||||
console.log("whoogleRedirects:", val)
|
||||
let disable;
|
||||
const getDisable = () => disable;
|
||||
function setDisable(val) {
|
||||
disable = val;
|
||||
browser.storage.sync.set({ disableSearch: disable })
|
||||
console.log("disableSearch: ", disable)
|
||||
}
|
||||
|
||||
let disableSearch;
|
||||
const getDisableSearch = () => disableSearch;
|
||||
function setDisableSearch(val) {
|
||||
disableSearch = val;
|
||||
browser.storage.sync.set({ disableSearch })
|
||||
console.log("disableSearch: ", disableSearch)
|
||||
}
|
||||
|
||||
let searchFrontend;
|
||||
const getSearchFrontend = () => searchFrontend;
|
||||
function setSearchFrontend(val) {
|
||||
searchFrontend = val;
|
||||
browser.storage.sync.set({ searchFrontend })
|
||||
console.log("searchFrontend: ", searchFrontend)
|
||||
let frontend;
|
||||
const getFrontend = () => frontend;
|
||||
function setFrontend(val) {
|
||||
frontend = val;
|
||||
browser.storage.sync.set({ searchFrontend: frontend })
|
||||
console.log("searchFrontend: ", frontend)
|
||||
};
|
||||
|
||||
function redirect(url, initiator) {
|
||||
if (disableSearch)
|
||||
return null;
|
||||
function isSearch(url, initiator) {
|
||||
if (disable) return false;
|
||||
return targets.some((rx) => rx.test(url.href));
|
||||
}
|
||||
|
||||
function redirect(url) {
|
||||
let randomInstance;
|
||||
let path;
|
||||
if (searchFrontend == 'searx') {
|
||||
if (frontend == 'searx') {
|
||||
let instancesList = [...searxRedirectsChecks, ...searxCustomRedirects];
|
||||
if (instancesList.length === 0) return null;
|
||||
randomInstance = commonHelper.getRandomInstance(instancesList)
|
||||
path = "/"
|
||||
path = "/";
|
||||
}
|
||||
if (searchFrontend == 'whoogle') {
|
||||
if (frontend == 'whoogle') {
|
||||
let instancesList = [...whoogleRedirectsChecks, ...whoogleCustomRedirects];
|
||||
if (instancesList.length === 0) return null;
|
||||
randomInstance = commonHelper.getRandomInstance(instancesList)
|
||||
path = "/search"
|
||||
path = "/search";
|
||||
}
|
||||
|
||||
let searchQuery = "";
|
||||
url.search.slice(1).split("&").forEach((input) => {
|
||||
if (input.startsWith("q=")) searchQuery = input;
|
||||
});
|
||||
|
||||
return `${randomInstance}${path}?${searchQuery}`;
|
||||
}
|
||||
|
||||
function isSearch(url) {
|
||||
return targets.some((rx) => rx.test(url.href));
|
||||
}
|
||||
|
||||
async function init() {
|
||||
return new Promise((resolve) => {
|
||||
|
@ -264,15 +265,16 @@ async function init() {
|
|||
"searxCustomRedirects",
|
||||
],
|
||||
(result) => {
|
||||
disableSearch = result.disableSearch ?? false;
|
||||
searchFrontend = result.searchFrontend ?? 'searx';
|
||||
disable = result.disableSearch ?? false;
|
||||
|
||||
frontend = result.searchFrontend ?? 'searx';
|
||||
|
||||
if (result.searchRedirects) redirects = result.searchRedirects;
|
||||
|
||||
whoogleRedirectsChecks = result.whoogleRedirectsChecks ?? [...redirects.whoogle.normal];
|
||||
whoogleCustomRedirects = result.whoogleCustomRedirects ?? [];
|
||||
|
||||
searxRedirectsChecks = result.searxRedirectsChecks ?? [...redirects.searx.normal];
|
||||
|
||||
searxCustomRedirects = result.searxCustomRedirects ?? [];
|
||||
|
||||
resolve();
|
||||
|
@ -282,19 +284,18 @@ async function init() {
|
|||
}
|
||||
|
||||
export default {
|
||||
targets,
|
||||
isSearch,
|
||||
|
||||
getDisable,
|
||||
setDisable,
|
||||
|
||||
getRedirects,
|
||||
getCustomRedirects,
|
||||
setSearxRedirects,
|
||||
setWhoogleRedirects,
|
||||
|
||||
getDisableSearch,
|
||||
setDisableSearch,
|
||||
|
||||
getSearchFrontend,
|
||||
setSearchFrontend,
|
||||
getFrontend,
|
||||
setFrontend,
|
||||
|
||||
getWhoogleRedirectsChecks,
|
||||
setWhoogleRedirectsChecks,
|
||||
|
|
|
@ -51,36 +51,34 @@ function setProxiTokCustomRedirects(val) {
|
|||
console.log("proxiTokCustomRedirects: ", val)
|
||||
}
|
||||
|
||||
let disableTiktok;
|
||||
const getDisableTiktok = () => disableTiktok;
|
||||
function setDisableTiktok(val) {
|
||||
disableTiktok = val;
|
||||
browser.storage.sync.set({ disableTiktok })
|
||||
let disable;
|
||||
const getDisable = () => disable;
|
||||
function setDisable(val) {
|
||||
disable = val;
|
||||
browser.storage.sync.set({ disableTiktok: disable })
|
||||
}
|
||||
|
||||
function redirect(url, initiator, type) {
|
||||
function isTiktok(url, initiator) {
|
||||
if (disable) return false;
|
||||
if (initiator && ([...redirects.proxiTok.normal, ...proxiTokCustomRedirects].includes(initiator.origin) || targets.includes(initiator.host))) return false;
|
||||
return targets.some((rx) => rx.test(url.href));
|
||||
}
|
||||
|
||||
function redirect(url, type) {
|
||||
// https://www.tiktok.com/@keysikaspol/video/7061265241887345946
|
||||
// https://www.tiktok.com/@keysikaspol
|
||||
|
||||
if (disableTiktok) return null;
|
||||
|
||||
if (type != "main_frame" && "sub_frame" && "xmlhttprequest") return null;
|
||||
|
||||
let instancesList = [...proxiTokRedirectsChecks, ...proxiTokCustomRedirects];
|
||||
if (instancesList.length === 0) return null;
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList)
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList);
|
||||
|
||||
if (initiator && (instancesList.includes(initiator.origin) || targets.includes(initiator.host))) return null;
|
||||
|
||||
let pathName = url.pathname.replace(new RegExp(/@.*\/(?=video)/), "")
|
||||
let pathName = url.pathname.replace(new RegExp(/@.*\/(?=video)/), "");
|
||||
|
||||
return `${randomInstance}${pathName}`;
|
||||
}
|
||||
|
||||
function isTiktok(url) {
|
||||
return targets.some((rx) => rx.test(url.href));
|
||||
}
|
||||
|
||||
async function init() {
|
||||
return new Promise((resolve) => {
|
||||
browser.storage.sync.get(
|
||||
|
@ -91,7 +89,8 @@ async function init() {
|
|||
"proxiTokCustomRedirects",
|
||||
],
|
||||
(result) => {
|
||||
disableTiktok = result.disableTiktok ?? false;
|
||||
disable = result.disableTiktok ?? false;
|
||||
|
||||
if (result.tiktokRedirects) redirects = result.tiktokRedirects;
|
||||
|
||||
proxiTokRedirectsChecks = result.proxiTokRedirectsChecks ?? [...redirects.proxiTok.normal];
|
||||
|
@ -104,14 +103,13 @@ async function init() {
|
|||
}
|
||||
|
||||
export default {
|
||||
targets,
|
||||
|
||||
getRedirects,
|
||||
getCustomRedirects,
|
||||
setRedirects,
|
||||
|
||||
getDisableTiktok,
|
||||
setDisableTiktok,
|
||||
getDisable,
|
||||
setDisable,
|
||||
|
||||
getProxiTokRedirectsChecks,
|
||||
setProxiTokRedirectsChecks,
|
||||
|
|
|
@ -138,12 +138,12 @@ function setTo(val) {
|
|||
console.log("to: ", to)
|
||||
}
|
||||
|
||||
function isTranslate(url) {
|
||||
if (disable) return null;
|
||||
function isTranslate(url, initiator) {
|
||||
if (disable) return false;
|
||||
return targets.includes(url.host)
|
||||
}
|
||||
|
||||
function redirect(url, initiator) {
|
||||
function redirect(url) {
|
||||
let params_arr = url.search.split('&');
|
||||
params_arr[0] = params_arr[0].substring(1);
|
||||
let myMap = {};
|
||||
|
@ -171,7 +171,6 @@ function redirect(url, initiator) {
|
|||
else
|
||||
return randomInstance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async function init() {
|
||||
|
|
|
@ -118,43 +118,37 @@ function setNitterCustomRedirects(val) {
|
|||
console.log("nitterCustomRedirects: ", val)
|
||||
}
|
||||
|
||||
let disableTwitter;
|
||||
const getDisableTwitter = () => disableTwitter;
|
||||
function setDisableTwitter(val) {
|
||||
disableTwitter = val;
|
||||
browser.storage.sync.set({ disableTwitter })
|
||||
let disable;
|
||||
const getDisable = () => disable;
|
||||
function setDisable(val) {
|
||||
disable = val;
|
||||
browser.storage.sync.set({ disableTwitter: disable })
|
||||
}
|
||||
|
||||
|
||||
function redirect(url, initiator) {
|
||||
if (disableTwitter) return null;
|
||||
|
||||
function isTwitter(url, initiator) {
|
||||
if (disable) return false;
|
||||
if (url.pathname.split("/").includes("home")) return null;
|
||||
if (
|
||||
commonHelper.isFirefox() &&
|
||||
initiator && ([...redirects.nitter.normal, ...nitterCustomRedirects].includes(initiator.origin) || targets.includes(initiator.host))
|
||||
) return false;
|
||||
|
||||
return targets.includes(url.host)
|
||||
}
|
||||
|
||||
function redirect(url) {
|
||||
let instancesList = [...nitterRedirectsChecks, ...nitterCustomRedirects];
|
||||
if (instancesList.length === 0) return null;
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList)
|
||||
|
||||
if (
|
||||
commonHelper.isFirefox() &&
|
||||
initiator &&
|
||||
(instancesList.includes(initiator.origin) || targets.includes(initiator.host))
|
||||
) {
|
||||
browser.storage.sync.set({ redirectBypassFlag: true });
|
||||
return null;
|
||||
}
|
||||
if (url.host.split(".")[0] === "pbs" || url.host.split(".")[0] === "video")
|
||||
return `${randomInstance}/pic/${encodeURIComponent(url.href)}`;
|
||||
|
||||
else if (url.pathname.split("/").includes("tweets"))
|
||||
return `${randomInstance}${url.pathname.replace("/tweets", "")}${url.search}`;
|
||||
|
||||
else
|
||||
return `${randomInstance}${url.pathname}${url.search}`;
|
||||
|
||||
}
|
||||
|
||||
function isTwitter(url) {
|
||||
return targets.includes(url.host)
|
||||
}
|
||||
|
||||
async function init() {
|
||||
|
@ -167,12 +161,13 @@ async function init() {
|
|||
"nitterCustomRedirects",
|
||||
],
|
||||
(result) => {
|
||||
disableTwitter = result.disableTwitter ?? false;
|
||||
if (result.twitterRedirects)
|
||||
redirects = result.twitterRedirects;
|
||||
disable = result.disableTwitter ?? false;
|
||||
|
||||
if (result.twitterRedirects) redirects = result.twitterRedirects;
|
||||
|
||||
nitterRedirectsChecks = result.nitterRedirectsChecks ?? [...redirects.nitter.normal];
|
||||
nitterCustomRedirects = result.nitterCustomRedirects ?? [];
|
||||
|
||||
resolve();
|
||||
}
|
||||
);
|
||||
|
@ -184,8 +179,8 @@ export default {
|
|||
getCustomRedirects,
|
||||
setRedirects,
|
||||
|
||||
getDisableTwitter,
|
||||
setDisableTwitter,
|
||||
getDisable,
|
||||
setDisable,
|
||||
|
||||
getNitterRedirectsChecks,
|
||||
setNitterRedirectsChecks,
|
||||
|
|
|
@ -2,7 +2,7 @@ window.browser = window.browser || window.chrome;
|
|||
|
||||
import commonHelper from './common.js'
|
||||
|
||||
const targets = /wikipedia.org/;
|
||||
const targets = /https:\/\/(www\.|)wikipedia\.org/
|
||||
|
||||
let redirects = {
|
||||
"wikiless": {
|
||||
|
@ -37,14 +37,13 @@ function setRedirects(val) {
|
|||
setWikilessRedirectsChecks(wikilessRedirectsChecks);
|
||||
}
|
||||
|
||||
let disableWikipedia;
|
||||
const getDisableWikipedia = () => disableWikipedia;
|
||||
function setDisableWikipedia(val) {
|
||||
disableWikipedia = val;
|
||||
browser.storage.sync.set({ disableWikipedia })
|
||||
let disable;
|
||||
const getDisable = () => disable;
|
||||
function setDisable(val) {
|
||||
disable = val;
|
||||
browser.storage.sync.set({ disableWikipedia: disable })
|
||||
}
|
||||
|
||||
|
||||
let wikilessRedirectsChecks;
|
||||
const getWikilessRedirectsChecks = () => wikilessRedirectsChecks;
|
||||
function setWikilessRedirectsChecks(val) {
|
||||
|
@ -61,9 +60,12 @@ function setWikilessCustomRedirects(val) {
|
|||
console.log("wikilessCustomRedirects: ", val)
|
||||
}
|
||||
|
||||
function redirect(url, initiator) {
|
||||
if (disableWikipedia) return null;
|
||||
function isWikipedia(url, initiator) {
|
||||
if (disable) return false;
|
||||
return url.host.match(targets);
|
||||
}
|
||||
|
||||
function redirect(url) {
|
||||
let GETArguments = [];
|
||||
if (url.search.length > 0) {
|
||||
let search = url.search.substring(1); //get rid of '?'
|
||||
|
@ -75,10 +77,7 @@ function redirect(url, initiator) {
|
|||
}
|
||||
|
||||
let instancesList = [...wikilessRedirectsChecks, ...wikilessCustomRedirects];
|
||||
|
||||
if (instancesList.length === 0)
|
||||
return null;
|
||||
|
||||
if (instancesList.length === 0) return null;
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList)
|
||||
|
||||
let link = `${randomInstance}${url.pathname}`;
|
||||
|
@ -86,7 +85,8 @@ function redirect(url, initiator) {
|
|||
if (urlSplit[0] != "wikipedia" && urlSplit[0] != "www") {
|
||||
if (urlSplit[0] == "m")
|
||||
GETArguments.push(["mobileaction", "toggle_view_mobile"]);
|
||||
else GETArguments.push(["lang", urlSplit[0]]);
|
||||
else
|
||||
GETArguments.push(["lang", urlSplit[0]]);
|
||||
if (urlSplit[1] == "m")
|
||||
GETArguments.push(["mobileaction", "toggle_view_mobile"]);
|
||||
// wikiless doesn't have mobile view support yet
|
||||
|
@ -94,17 +94,8 @@ function redirect(url, initiator) {
|
|||
for (let i = 0; i < GETArguments.length; i++)
|
||||
link += (i == 0 ? "?" : "&") + GETArguments[i][0] + "=" + GETArguments[i][1];
|
||||
|
||||
if (
|
||||
urlSplit[urlSplit.length - 1] == "org" &&
|
||||
urlSplit[urlSplit.length - 2] == "wikipedia"
|
||||
)
|
||||
//just in case someone wanted to visit wikipedia.org.foo.bar.net
|
||||
return link;
|
||||
else return null;
|
||||
}
|
||||
|
||||
function isWikipedia(url) {
|
||||
return url.host.match(targets);
|
||||
}
|
||||
|
||||
async function init() {
|
||||
|
@ -116,7 +107,8 @@ async function init() {
|
|||
"wikilessRedirectsChecks",
|
||||
"wikilessCustomRedirects",
|
||||
], (result) => {
|
||||
disableWikipedia = result.disableWikipedia ?? false;
|
||||
disable = result.disableWikipedia ?? false;
|
||||
|
||||
if (result.wikipediaRedirects) redirects = result.wikipediaRedirects;
|
||||
|
||||
wikilessRedirectsChecks = result.wikilessRedirectsChecks ?? [...redirects.wikiless.normal];
|
||||
|
@ -133,8 +125,8 @@ export default {
|
|||
getCustomRedirects,
|
||||
setRedirects,
|
||||
|
||||
setDisableWikipedia,
|
||||
getDisableWikipedia,
|
||||
setDisable,
|
||||
getDisable,
|
||||
|
||||
getWikilessRedirectsChecks,
|
||||
setWikilessRedirectsChecks,
|
||||
|
|
|
@ -109,12 +109,12 @@ function setPipedRedirects(val) {
|
|||
console.log("pipedRedirects: ", val)
|
||||
}
|
||||
|
||||
let disableYoutube;
|
||||
const getDisableYoutube = () => disableYoutube;
|
||||
function setDisableYoutube(val) {
|
||||
disableYoutube = val;
|
||||
browser.storage.sync.set({ disableYoutube })
|
||||
console.log("disableYoutube: ", disableYoutube)
|
||||
let disable;
|
||||
const getDisable = () => disable;
|
||||
function setDisable(val) {
|
||||
disable = val;
|
||||
browser.storage.sync.set({ disableYoutube: disable })
|
||||
console.log("disableYoutube: ", disable)
|
||||
}
|
||||
|
||||
let invidiousAlwaysProxy;
|
||||
|
@ -197,7 +197,6 @@ function setPersistInvidiousPrefs(val) {
|
|||
console.log("persistInvidiousPrefs: ", persistInvidiousPrefs)
|
||||
}
|
||||
|
||||
|
||||
let alwaysusePreferred;
|
||||
const getAlwaysusePreferred = () => alwaysusePreferred;
|
||||
function setAlwaysusePreferred(val) {
|
||||
|
@ -206,24 +205,17 @@ function setAlwaysusePreferred(val) {
|
|||
console.log("alwaysusePreferred: ", alwaysusePreferred)
|
||||
}
|
||||
|
||||
let invidiousHostNames = () => redirects.invidious.normal.map(link => new URL(link).host);
|
||||
let pipedHostNames = () => redirects.piped.normal.map(link => new URL(link).host);
|
||||
|
||||
function isYoutube(url, initiator) {
|
||||
if (disableYoutube)
|
||||
return null;
|
||||
if (disable) return false;
|
||||
|
||||
if (
|
||||
initiator &&
|
||||
(
|
||||
redirects.invidious.normal.includes(initiator.origin) ||
|
||||
redirects.piped.normal.includes(initiator.origin) ||
|
||||
[...redirects.invidious.normal, ...invidiousCustomRedirects].includes(initiator.origin) ||
|
||||
[...redirects.piped.normal, ...pipedCustomRedirects].includes(initiator.origin) ||
|
||||
targets.includes(initiator.host)
|
||||
)
|
||||
)
|
||||
return null;
|
||||
|
||||
if (url.pathname.match(/iframe_api/) || url.pathname.match(/www-widgetapi/)) return null; // Don't redirect YouTube Player API.
|
||||
) return false;
|
||||
|
||||
let pipedInstancesList = [...pipedRedirectsChecks, ...pipedCustomRedirects];
|
||||
let invidiousInstancesList = [...invidiousRedirectsChecks, ...invidiousCustomRedirects];
|
||||
|
@ -231,14 +223,10 @@ function isYoutube(url, initiator) {
|
|||
let protocolHost = `${url.protocol}//${url.host}`;
|
||||
|
||||
let isInvidious = redirects.invidious.normal.includes(protocolHost);
|
||||
if (isInvidious)
|
||||
for (const iterator of invidiousInstancesList)
|
||||
if (iterator.indexOf(protocolHost) === 0) isInvidious = false;
|
||||
if (isInvidious) for (const iterator of invidiousInstancesList) if (iterator.indexOf(protocolHost) === 0) isInvidious = false;
|
||||
|
||||
let isPiped = redirects.piped.normal.includes(protocolHost);
|
||||
if (isPiped)
|
||||
for (const iterator of pipedInstancesList)
|
||||
if (iterator.indexOf(protocolHost) === 0) isPiped = false;
|
||||
if (isPiped) for (const iterator of pipedInstancesList) if (iterator.indexOf(protocolHost) === 0) isPiped = false;
|
||||
|
||||
if (frontend == 'invidious') {
|
||||
if (alwaysusePreferred)
|
||||
|
@ -256,6 +244,59 @@ function isYoutube(url, initiator) {
|
|||
return isTargets
|
||||
}
|
||||
|
||||
function redirect(url, type) {
|
||||
if (url.pathname.match(/iframe_api/) || url.pathname.match(/www-widgetapi/)) return null; // Don't redirect YouTube Player API.
|
||||
|
||||
if (frontend == 'freeTube' && type === "main_frame") {
|
||||
return `freetube://${url}`;
|
||||
} else if (frontend == 'invidious') {
|
||||
|
||||
if (OnlyEmbeddedVideo == 'onlyEmbedded' && type !== "sub_frame") return null;
|
||||
if (OnlyEmbeddedVideo == 'onlyNotEmbedded' && type !== "main_frame") return null;
|
||||
|
||||
let instancesList = [...invidiousRedirectsChecks, ...invidiousCustomRedirects];
|
||||
if (instancesList.length === 0) return null;
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList);
|
||||
|
||||
if (theme != "DEFAULT") url.searchParams.append("dark_mode", theme);
|
||||
if (volume != "--") url.searchParams.append("volume", volume);
|
||||
if (autoplay != "DEFAULT") url.searchParams.append("autoplay", autoplay);
|
||||
|
||||
if (invidiousAlwaysProxy != "DEFAULT") url.searchParams.append("local", invidiousAlwaysProxy);
|
||||
if (invidiousVideoQuality != "DEFAULT") url.searchParams.append("quality", invidiousVideoQuality);
|
||||
if (invidiousPlayerStyle != "DEFAULT") url.searchParams.append("player_style", invidiousPlayerStyle);
|
||||
if (invidiousSubtitles.trim() != '') url.searchParams.append("subtitles", invidiousSubtitles);
|
||||
|
||||
return `${randomInstance}${url.pathname.replace("/shorts/", "/watch?v=")}${url.search}`;
|
||||
|
||||
} else if (frontend == 'piped') {
|
||||
|
||||
if (OnlyEmbeddedVideo == 'onlyEmbedded' && type !== "sub_frame") return null;
|
||||
if (OnlyEmbeddedVideo == 'onlyNotEmbedded' && type !== "main_frame") return null;
|
||||
|
||||
let instancesList = [...pipedRedirectsChecks, ...pipedCustomRedirects];
|
||||
if (instancesList.length === 0) return null;
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList);
|
||||
|
||||
if (theme != "DEFAULT") url.searchParams.append("theme", theme);
|
||||
if (volume != "--") url.searchParams.append("volume", volume / 100);
|
||||
if (autoplay != "DEFAULT") url.searchParams.append("playerAutoPlay", autoplay);
|
||||
|
||||
return `${randomInstance}${url.pathname.replace("/shorts/", "/watch?v=")}${url.search}`;
|
||||
}
|
||||
return 'CANCEL';
|
||||
}
|
||||
|
||||
function invidiousInitCookies(tabId) {
|
||||
browser.tabs.executeScript(
|
||||
tabId,
|
||||
{
|
||||
file: "/assets/javascripts/helpers/youtube/invidious-cookies.js",
|
||||
runAt: "document_start"
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
async function init() {
|
||||
return new Promise((resolve) => {
|
||||
browser.storage.sync.get(
|
||||
|
@ -281,17 +322,18 @@ async function init() {
|
|||
(result) => {
|
||||
if (result.youtubeRedirects) redirects = result.youtubeRedirects;
|
||||
|
||||
disable = result.disableYoutube ?? false;
|
||||
frontend = result.youtubeFrontend ?? 'piped';
|
||||
disableYoutube = result.disableYoutube ?? false;
|
||||
|
||||
theme = result.youtubeTheme ?? 'DEFAULT';
|
||||
volume = result.youtubeVolume ?? '--';
|
||||
autoplay = result.youtubeAutoplay ?? 'DEFAULT';
|
||||
|
||||
invidiousAlwaysProxy = result.invidiousAlwaysProxy ?? 'DEFAULT';
|
||||
OnlyEmbeddedVideo = result.OnlyEmbeddedVideo ?? 'both';
|
||||
invidiousVideoQuality = result.invidiousVideoQuality ?? 'DEFAULT';
|
||||
theme = result.youtubeTheme ?? 'DEFAULT';
|
||||
volume = result.youtubeVolume ?? '--';
|
||||
invidiousPlayerStyle = result.invidiousPlayerStyle ?? 'DEFAULT';
|
||||
invidiousSubtitles = result.invidiousSubtitles || '';
|
||||
autoplay = result.youtubeAutoplay ?? 'DEFAULT';
|
||||
|
||||
invidiousRedirectsChecks = result.invidiousRedirectsChecks ?? [...redirects.invidious.normal];
|
||||
invidiousCustomRedirects = result.invidiousCustomRedirects ?? [];
|
||||
|
@ -309,55 +351,6 @@ async function init() {
|
|||
})
|
||||
}
|
||||
|
||||
function invidiousInitCookies(tabId) {
|
||||
browser.tabs.executeScript(
|
||||
tabId, {
|
||||
file: "/assets/javascripts/helpers/youtube/invidious-cookies.js",
|
||||
runAt: "document_start"
|
||||
});
|
||||
}
|
||||
|
||||
function redirect(url, type) {
|
||||
if (frontend == 'freeTube' && type === "main_frame")
|
||||
return `freetube://${url}`;
|
||||
|
||||
else if (frontend == 'invidious') {
|
||||
|
||||
let instancesList = [...invidiousRedirectsChecks, ...invidiousCustomRedirects];
|
||||
if (instancesList.length === 0) return null;
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList);
|
||||
|
||||
if (OnlyEmbeddedVideo == 'onlyEmbedded' && type !== "sub_frame") return null
|
||||
if (OnlyEmbeddedVideo == 'onlyNotEmbedded' && type !== "main_frame") return null;
|
||||
|
||||
if (invidiousAlwaysProxy != "DEFAULT") url.searchParams.append("local", invidiousAlwaysProxy);
|
||||
if (invidiousVideoQuality != "DEFAULT") url.searchParams.append("quality", invidiousVideoQuality);
|
||||
if (theme != "DEFAULT") url.searchParams.append("dark_mode", theme);
|
||||
if (volume != "--") url.searchParams.append("volume", volume);
|
||||
if (autoplay != "DEFAULT") url.searchParams.append("autoplay", autoplay);
|
||||
if (invidiousPlayerStyle != "DEFAULT") url.searchParams.append("player_style", invidiousPlayerStyle);
|
||||
if (invidiousSubtitles.trim() != '') url.searchParams.append("subtitles", invidiousSubtitles);
|
||||
|
||||
return `${randomInstance}${url.pathname.replace("/shorts/", "/watch?v=")}${url.search}`;
|
||||
|
||||
} else if (frontend == 'piped') {
|
||||
|
||||
let instancesList = [...pipedRedirectsChecks, ...pipedCustomRedirects];
|
||||
if (instancesList.length === 0) return null;
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList);
|
||||
|
||||
if (OnlyEmbeddedVideo == 'onlyEmbedded' && type !== "sub_frame") return null
|
||||
if (OnlyEmbeddedVideo == 'onlyNotEmbedded' && type !== "main_frame") return null;
|
||||
|
||||
if (theme != "DEFAULT") url.searchParams.append("theme", theme);
|
||||
if (volume != "--") url.searchParams.append("volume", volume / 100);
|
||||
if (autoplay != "DEFAULT") url.searchParams.append("playerAutoPlay", autoplay);
|
||||
|
||||
return `${randomInstance}${url.pathname.replace("/shorts/", "/watch?v=")}${url.search}`;
|
||||
}
|
||||
return 'CANCEL';
|
||||
}
|
||||
|
||||
export default {
|
||||
invidiousInitCookies,
|
||||
|
||||
|
@ -372,8 +365,8 @@ export default {
|
|||
redirect,
|
||||
isYoutube,
|
||||
|
||||
getDisableYoutube,
|
||||
setDisableYoutube,
|
||||
getDisable,
|
||||
setDisable,
|
||||
|
||||
setInvidiousAlwaysProxy,
|
||||
getInvidiousAlwaysProxy,
|
||||
|
|
|
@ -45,29 +45,29 @@ browser.webRequest.onBeforeRequest.addListener(
|
|||
|
||||
var newUrl;
|
||||
|
||||
if (exceptionsHelper.isException(url)) newUrl = null;
|
||||
if (exceptionsHelper.isException(url, initiator)) newUrl = null;
|
||||
|
||||
else if (youtubeHelper.isYoutube(url, initiator)) newUrl = youtubeHelper.redirect(url, details.type)
|
||||
|
||||
else if (twitterHelper.isTwitter(url)) newUrl = twitterHelper.redirect(url, initiator);
|
||||
else if (twitterHelper.isTwitter(url, initiator)) newUrl = twitterHelper.redirect(url);
|
||||
|
||||
else if (instagramHelper.isInstagram(url)) newUrl = instagramHelper.redirect(url, initiator, details.type);
|
||||
else if (instagramHelper.isInstagram(url, initiator)) newUrl = instagramHelper.redirect(url, details.type);
|
||||
|
||||
else if (mapsHelper.isMaps(url)) newUrl = mapsHelper.redirect(url, initiator);
|
||||
else if (mapsHelper.isMaps(url, initiator)) newUrl = mapsHelper.redirect(url);
|
||||
|
||||
else if (redditHelper.isReddit(url)) newUrl = redditHelper.redirect(url, initiator, details.type);
|
||||
else if (redditHelper.isReddit(url, initiator)) newUrl = redditHelper.redirect(url, details.type);
|
||||
|
||||
else if (mediumHelper.isMedium(url)) newUrl = mediumHelper.redirect(url, initiator, details.type);
|
||||
else if (mediumHelper.isMedium(url, initiator)) newUrl = mediumHelper.redirect(url, details.type);
|
||||
|
||||
else if (imgurHelper.isImgur(url)) newUrl = imgurHelper.redirect(url, initiator, details.type);
|
||||
else if (imgurHelper.isImgur(url, initiator)) newUrl = imgurHelper.redirect(url, details.type);
|
||||
|
||||
else if (tiktokHelper.isTiktok(url)) newUrl = tiktokHelper.redirect(url, initiator, details.type);
|
||||
else if (tiktokHelper.isTiktok(url, initiator)) newUrl = tiktokHelper.redirect(url, details.type);
|
||||
|
||||
else if (translateHelper.isTranslate(url)) newUrl = translateHelper.redirect(url, initiator);
|
||||
else if (translateHelper.isTranslate(url, initiator)) newUrl = translateHelper.redirect(url);
|
||||
|
||||
else if (searchHelper.isSearch(url)) newUrl = searchHelper.redirect(url, initiator)
|
||||
else if (searchHelper.isSearch(url, initiator)) newUrl = searchHelper.redirect(url)
|
||||
|
||||
else if (wikipediaHelper.isWikipedia(url)) newUrl = wikipediaHelper.redirect(url, initiator);
|
||||
else if (wikipediaHelper.isWikipedia(url, initiator)) newUrl = wikipediaHelper.redirect(url);
|
||||
|
||||
if (newUrl) {
|
||||
if (newUrl == 'CANCEL') {
|
||||
|
|
|
@ -3,11 +3,11 @@ import commonHelper from "../../../assets/javascripts/helpers/common.js";
|
|||
|
||||
let disableImgurElement = document.getElementById("disable-imgur");
|
||||
disableImgurElement.addEventListener("change",
|
||||
(event) => imgurHelper.setDisableImgur(!event.target.checked)
|
||||
(event) => imgurHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
imgurHelper.init().then(() => {
|
||||
disableImgurElement.checked = !imgurHelper.getDisableImgur();
|
||||
disableImgurElement.checked = !imgurHelper.getDisable();
|
||||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'rimgo',
|
||||
|
|
|
@ -3,11 +3,11 @@ import commonHelper from "../../../assets/javascripts/helpers/common.js";
|
|||
|
||||
let disableInstagramElement = document.getElementById("disable-bibliogram");
|
||||
disableInstagramElement.addEventListener("change",
|
||||
(event) => instagramHelper.setDisableInstagram(!event.target.checked)
|
||||
(event) => instagramHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
instagramHelper.init().then(() => {
|
||||
disableInstagramElement.checked = !instagramHelper.getDisableInstagram();
|
||||
disableInstagramElement.checked = !instagramHelper.getDisable();
|
||||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'bibliogram',
|
||||
|
|
|
@ -2,9 +2,9 @@ import mapsHelper from "../../../assets/javascripts/helpers/maps.js";
|
|||
|
||||
let disableMapsElement = document.getElementById("disable-osm");
|
||||
disableMapsElement.addEventListener("change",
|
||||
(event) => mapsHelper.setDisableMaps(!event.target.checked)
|
||||
(event) => mapsHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
mapsHelper.init().then(() => {
|
||||
disableMapsElement.checked = !mapsHelper.getDisableMaps();
|
||||
disableMapsElement.checked = !mapsHelper.getDisable();
|
||||
})
|
|
@ -3,11 +3,11 @@ import commonHelper from "../../../assets/javascripts/helpers/common.js";
|
|||
|
||||
let disableMediumElement = document.getElementById("disable-medium");
|
||||
disableMediumElement.addEventListener("change",
|
||||
(event) => mediumHelper.setDisableMedium(!event.target.checked)
|
||||
(event) => mediumHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
mediumHelper.init().then(() => {
|
||||
disableMediumElement.checked = !mediumHelper.getDisableMedium();
|
||||
disableMediumElement.checked = !mediumHelper.getDisable();
|
||||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'scribe',
|
||||
|
|
|
@ -3,7 +3,7 @@ import commonHelper from "../../../assets/javascripts/helpers/common.js";
|
|||
|
||||
let disableSearchElement = document.getElementById("disable-search");
|
||||
disableSearchElement.addEventListener("change",
|
||||
(event) => searchHelper.setDisableSearch(!event.target.checked)
|
||||
(event) => searchHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
|
||||
|
@ -25,14 +25,14 @@ let searchFrontendElement = document.getElementById("search-frontend");
|
|||
searchFrontendElement.addEventListener("change",
|
||||
(event) => {
|
||||
let frontend = event.target.options[searchFrontendElement.selectedIndex].value
|
||||
searchHelper.setSearchFrontend(frontend)
|
||||
searchHelper.setFrontend(frontend)
|
||||
changeFrontendsSettings(frontend);
|
||||
}
|
||||
);
|
||||
|
||||
searchHelper.init().then(() => {
|
||||
disableSearchElement.checked = !searchHelper.getDisableSearch();
|
||||
let frontend = searchHelper.getSearchFrontend();
|
||||
disableSearchElement.checked = !searchHelper.getDisable();
|
||||
let frontend = searchHelper.getFrontend();
|
||||
searchFrontendElement.value = frontend;
|
||||
changeFrontendsSettings(frontend);
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@ import commonHelper from "../../../assets/javascripts/helpers/common.js";
|
|||
|
||||
let disableTiktokElement = document.getElementById("disable-tiktok");
|
||||
disableTiktokElement.addEventListener("change",
|
||||
(event) => tiktokHelper.setDisableTiktok(!event.target.checked)
|
||||
(event) => tiktokHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
tiktokHelper.init().then(() => {
|
||||
disableTiktokElement.checked = !tiktokHelper.getDisableTiktok();
|
||||
disableTiktokElement.checked = !tiktokHelper.getDisable();
|
||||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'proxiTok',
|
||||
|
|
|
@ -3,11 +3,11 @@ import commonHelper from "../../../assets/javascripts/helpers/common.js";
|
|||
|
||||
let disableTwitterElement = document.getElementById("disable-nitter");
|
||||
disableTwitterElement.addEventListener("change",
|
||||
(event) => twitterHelper.setDisableTwitter(!event.target.checked)
|
||||
(event) => twitterHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
twitterHelper.init().then(() => {
|
||||
disableTwitterElement.checked = !twitterHelper.getDisableTwitter();
|
||||
disableTwitterElement.checked = !twitterHelper.getDisable();
|
||||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'nitter',
|
||||
|
|
|
@ -3,10 +3,10 @@ import commonHelper from "../../../assets/javascripts/helpers/common.js";
|
|||
|
||||
let disableWikipediaElement = document.getElementById("disable-wikipedia");
|
||||
disableWikipediaElement.addEventListener("change",
|
||||
(event) => wikipediaHelper.setDisableWikipedia(!event.target.checked)
|
||||
(event) => wikipediaHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
wikipediaHelper.init().then(() => {
|
||||
disableWikipediaElement.checked = !wikipediaHelper.getDisableWikipedia();
|
||||
disableWikipediaElement.checked = !wikipediaHelper.getDisable();
|
||||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'wikiless',
|
||||
|
|
|
@ -33,7 +33,7 @@ youtubeFrontendElement.addEventListener("change",
|
|||
);
|
||||
|
||||
disableYoutubeElement.addEventListener("change",
|
||||
(event) => youtubeHelper.setDisableYoutube(!event.target.checked)
|
||||
(event) => youtubeHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
let themeElement = document.getElementById("invidious-theme");
|
||||
|
@ -74,7 +74,7 @@ alwaysUsePreferredElement.addEventListener("change",
|
|||
);
|
||||
|
||||
youtubeHelper.init().then(() => {
|
||||
disableYoutubeElement.checked = !youtubeHelper.getDisableYoutube();
|
||||
disableYoutubeElement.checked = !youtubeHelper.getDisable();
|
||||
themeElement.checked = youtubeHelper.getTheme();
|
||||
volumeElement.value = youtubeHelper.getVolume();
|
||||
volumeValueElement.textContent = `${youtubeHelper.getVolume()}%`;
|
||||
|
|
|
@ -177,7 +177,7 @@
|
|||
|
||||
<script type="module" src="../options/init.js"></script>
|
||||
<script type="module" src="./popup.js"></script>
|
||||
<script src="../../assets/javascripts/localise.js"></script>
|
||||
<!-- <script src="../../assets/javascripts/localise.js"></script> -->
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -41,33 +41,33 @@ async function wholeInit() {
|
|||
};
|
||||
|
||||
wholeInit().then(() => {
|
||||
disableTwitterElement.checked = !twitterHelper.getDisableTwitter();
|
||||
disableYoutubeElement.checked = !youtubeHelper.getDisableYoutube();
|
||||
disableInstagramElement.checked = !instagramHelper.getDisableInstagram();
|
||||
disableMapsElement.checked = !mapsHelper.getDisableMaps();
|
||||
disableTwitterElement.checked = !twitterHelper.getDisable();
|
||||
disableYoutubeElement.checked = !youtubeHelper.getDisable();
|
||||
disableInstagramElement.checked = !instagramHelper.getDisable();
|
||||
disableMapsElement.checked = !mapsHelper.getDisable();
|
||||
disableRedditElement.checked = !redditHelper.getDisableReddit();
|
||||
disableSearchElement.checked = !searchHelper.getDisableSearch();
|
||||
disableSearchElement.checked = !searchHelper.getDisable();
|
||||
disableElement.checked = !translateHelper.getDisable();
|
||||
disableWikipediaElement.checked = !wikipediaHelper.getDisableWikipedia();
|
||||
disableImgurElement.checked = !imgurHelper.getDisableImgur();
|
||||
disableTiktokElement.checked = !tiktokHelper.getDisableTiktok();
|
||||
disableMediumElement.checked = !mediumHelper.getDisableMedium();
|
||||
disableWikipediaElement.checked = !wikipediaHelper.getDisable();
|
||||
disableImgurElement.checked = !imgurHelper.getDisable();
|
||||
disableTiktokElement.checked = !tiktokHelper.getDisable();
|
||||
disableMediumElement.checked = !mediumHelper.getDisable();
|
||||
})
|
||||
|
||||
disableTwitterElement.addEventListener("change",
|
||||
(event) => twitterHelper.setDisableTwitter(!event.target.checked)
|
||||
(event) => twitterHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
disableYoutubeElement.addEventListener("change",
|
||||
(event) => youtubeHelper.setDisableYoutube(!event.target.checked)
|
||||
(event) => youtubeHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
disableInstagramElement.addEventListener("change",
|
||||
(event) => instagramHelper.setDisableInstagram(!event.target.checked)
|
||||
(event) => instagramHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
disableMapsElement.addEventListener("change",
|
||||
(event) => mapsHelper.setDisableMaps(!event.target.checked)
|
||||
(event) => mapsHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
disableRedditElement.addEventListener("change",
|
||||
|
@ -75,7 +75,7 @@ disableRedditElement.addEventListener("change",
|
|||
);
|
||||
|
||||
disableSearchElement.addEventListener("change",
|
||||
(event) => searchHelper.setDisableSearch(!event.target.checked)
|
||||
(event) => searchHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
disableElement.addEventListener("change",
|
||||
|
@ -83,19 +83,19 @@ disableElement.addEventListener("change",
|
|||
);
|
||||
|
||||
disableWikipediaElement.addEventListener("change",
|
||||
(event) => wikipediaHelper.setDisableWikipedia(!event.target.checked)
|
||||
(event) => wikipediaHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
disableImgurElement.addEventListener("change",
|
||||
(event) => imgurHelper.setDisableImgur(!event.target.checked)
|
||||
(event) => imgurHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
disableTiktokElement.addEventListener("change",
|
||||
(event) => tiktokHelper.setDisableTiktok(!event.target.checked)
|
||||
(event) => tiktokHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
disableMediumElement.addEventListener("change",
|
||||
(event) => mediumHelper.setDisableMedium(!event.target.checked)
|
||||
(event) => mediumHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
document.querySelector("#more-options").addEventListener("click", () => {
|
||||
|
|
Loading…
Reference in New Issue