mirror of
https://codeberg.org/LibRedirect/libredirect.git
synced 2025-02-09 08:38:40 +01:00
Made auto changing instances manual #59
This commit is contained in:
parent
6ca6689936
commit
41e145bf7a
@ -118,6 +118,32 @@ function redirect(url, type) {
|
||||
return `${randomInstance}${url.pathname}${url.search}`;
|
||||
}
|
||||
|
||||
function changeInstance(url) {
|
||||
let protocolHost = `${url.protocol}//${url.host}`;
|
||||
|
||||
let imgurList = [
|
||||
...redirects.rimgo.normal,
|
||||
...redirects.rimgo.tor,
|
||||
|
||||
...rimgoNormalCustomRedirects,
|
||||
...rimgoTorCustomRedirects,
|
||||
];
|
||||
if (!imgurList.includes(protocolHost)) return null;
|
||||
|
||||
let instancesList;
|
||||
if (protocol == 'normal') instancesList = [...rimgoNormalCustomRedirects, ...rimgoNormalRedirectsChecks];
|
||||
else if (protocol == 'tor') instancesList = [...rimgoTorCustomRedirects, ...rimgoTorRedirectsChecks];
|
||||
|
||||
console.log("instancesList", instancesList);
|
||||
let index = instancesList.indexOf(protocolHost);
|
||||
if (index > -1) instancesList.splice(index, 1);
|
||||
|
||||
if (instancesList.length === 0) return null;
|
||||
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList);
|
||||
return randomInstance;
|
||||
}
|
||||
|
||||
async function init() {
|
||||
return new Promise((resolve) => {
|
||||
fetch('/instances/data.json').then(response => response.text()).then(data => {
|
||||
@ -179,4 +205,5 @@ export default {
|
||||
redirect,
|
||||
isImgur,
|
||||
init,
|
||||
changeInstance,
|
||||
};
|
||||
|
@ -135,6 +135,32 @@ function redirect(url, type) {
|
||||
return `${randomInstance}/u${url.pathname}${url.search}`; // Likely a user profile, redirect to '/u/...'
|
||||
}
|
||||
|
||||
function changeInstance(url) {
|
||||
let protocolHost = `${url.protocol}//${url.host}`;
|
||||
|
||||
let instagramList = [
|
||||
...redirects.bibliogram.normal,
|
||||
...redirects.bibliogram.tor,
|
||||
...bibliogramNormalCustomRedirects,
|
||||
...bibliogramTorCustomRedirects,
|
||||
];
|
||||
|
||||
if (!instagramList.includes(protocolHost)) return null;
|
||||
|
||||
let instancesList;
|
||||
if (protocol == 'normal') instancesList = [...bibliogramNormalCustomRedirects, ...bibliogramNormalRedirectsChecks];
|
||||
else if (protocol == 'tor') instancesList = [...bibliogramTorCustomRedirects, ...bibliogramTorRedirectsChecks];
|
||||
|
||||
console.log("instancesList", instancesList);
|
||||
let index = instancesList.indexOf(protocolHost);
|
||||
if (index > -1) instancesList.splice(index, 1);
|
||||
|
||||
if (instancesList.length === 0) return null;
|
||||
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList);
|
||||
return randomInstance;
|
||||
}
|
||||
|
||||
|
||||
async function init() {
|
||||
return new Promise((resolve) => {
|
||||
@ -199,4 +225,5 @@ export default {
|
||||
|
||||
redirect,
|
||||
init,
|
||||
changeInstance,
|
||||
};
|
||||
|
@ -128,6 +128,33 @@ function redirect(url, type) {
|
||||
return `${randomInstance}${url.pathname}${url.search}`;
|
||||
}
|
||||
|
||||
function changeInstance(url) {
|
||||
let protocolHost = `${url.protocol}//${url.host}`;
|
||||
|
||||
let mediumList = [
|
||||
...redirects.scribe.tor,
|
||||
...redirects.scribe.normal,
|
||||
|
||||
...scribeNormalCustomRedirects,
|
||||
...scribeTorCustomRedirects,
|
||||
];
|
||||
|
||||
if (!mediumList.includes(protocolHost)) return null;
|
||||
|
||||
let instancesList;
|
||||
if (protocol == 'normal') instancesList = [...scribeNormalCustomRedirects, ...scribeNormalRedirectsChecks];
|
||||
else if (protocol == 'tor') instancesList = [...scribeTorCustomRedirects, ...scribeTorRedirectsChecks];
|
||||
|
||||
console.log("instancesList", instancesList);
|
||||
let index = instancesList.indexOf(protocolHost);
|
||||
if (index > -1) instancesList.splice(index, 1);
|
||||
|
||||
if (instancesList.length === 0) return null;
|
||||
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList);
|
||||
return randomInstance;
|
||||
}
|
||||
|
||||
async function init() {
|
||||
return new Promise((resolve) => {
|
||||
fetch('/instances/data.json').then(response => response.text()).then(data => {
|
||||
@ -189,4 +216,5 @@ export default {
|
||||
redirect,
|
||||
isMedium,
|
||||
init,
|
||||
changeInstance,
|
||||
};
|
||||
|
@ -169,11 +169,11 @@ function setDisableReddit(val) {
|
||||
browser.storage.local.set({ disableReddit })
|
||||
}
|
||||
|
||||
let redditFrontend;
|
||||
const getRedditFrontend = () => redditFrontend;
|
||||
function setRedditFrontend(val) {
|
||||
redditFrontend = val;
|
||||
browser.storage.local.set({ redditFrontend })
|
||||
let frontend;
|
||||
const getFrontend = () => frontend;
|
||||
function setFrontend(val) {
|
||||
frontend = val;
|
||||
browser.storage.local.set({ redditFrontend: frontend })
|
||||
};
|
||||
|
||||
let protocol;
|
||||
@ -184,7 +184,6 @@ function setProtocol(val) {
|
||||
console.log("redditProtocol: ", val)
|
||||
}
|
||||
|
||||
|
||||
function isReddit(url, initiator) {
|
||||
if (
|
||||
initiator &&
|
||||
@ -223,12 +222,12 @@ function redirect(url, type) {
|
||||
return `${libredditRandomInstance}/img${url.pathname}${url.search}`;
|
||||
}
|
||||
else if (url.host === "redd.it") {
|
||||
if (redditFrontend == 'libreddit') {
|
||||
if (frontend == 'libreddit') {
|
||||
if (libredditInstancesList.length === 0) return null;
|
||||
let libredditRandomInstance = commonHelper.getRandomInstance(libredditInstancesList);
|
||||
return `${libredditRandomInstance}${url.pathname}${url.search}`;
|
||||
}
|
||||
if (redditFrontend == 'teddit' && !url.pathname.match(/^\/+[^\/]+\/+[^\/]/)) {
|
||||
if (frontend == 'teddit' && !url.pathname.match(/^\/+[^\/]+\/+[^\/]/)) {
|
||||
if (tedditInstancesList.length === 0) return null;
|
||||
let tedditRandomInstance = commonHelper.getRandomInstance(tedditInstancesList);
|
||||
// As of 2021-04-22, redirects for teddit redd.it/foo links don't work.
|
||||
@ -241,18 +240,57 @@ function redirect(url, type) {
|
||||
return `${tedditRandomInstance}/comments${url.pathname}${url.search}`;
|
||||
}
|
||||
}
|
||||
if (redditFrontend == 'libreddit') {
|
||||
if (frontend == 'libreddit') {
|
||||
if (libredditInstancesList.length === 0) return null;
|
||||
let libredditRandomInstance = commonHelper.getRandomInstance(libredditInstancesList);
|
||||
return `${libredditRandomInstance}${url.pathname}${url.search}`;
|
||||
}
|
||||
if (redditFrontend == 'teddit') {
|
||||
if (frontend == 'teddit') {
|
||||
if (tedditInstancesList.length === 0) return null;
|
||||
let tedditRandomInstance = commonHelper.getRandomInstance(tedditInstancesList);
|
||||
return `${tedditRandomInstance}${url.pathname}${url.search}`;
|
||||
}
|
||||
}
|
||||
|
||||
function changeInstance(url) {
|
||||
let protocolHost = `${url.protocol}//${url.host}`;
|
||||
|
||||
let redditList = [
|
||||
...redirects.libreddit.normal,
|
||||
...redirects.libreddit.tor,
|
||||
|
||||
...libredditNormalCustomRedirects,
|
||||
...libredditTorCustomRedirects,
|
||||
|
||||
...redirects.teddit.normal,
|
||||
...redirects.teddit.tor,
|
||||
|
||||
...tedditNormalCustomRedirects,
|
||||
...tedditTorCustomRedirects,
|
||||
]
|
||||
|
||||
if (!redditList.includes(protocolHost)) return null;
|
||||
|
||||
let instancesList;
|
||||
if (frontend == 'libreddit') {
|
||||
if (protocol == 'normal') instancesList = [...libredditNormalRedirectsChecks, ...libredditNormalCustomRedirects];
|
||||
else if (protocol == 'tor') instancesList = [...libredditTorRedirectsChecks, ...libredditTorCustomRedirects];
|
||||
}
|
||||
else if (frontend == 'teddit') {
|
||||
if (protocol == 'normal') instancesList = [...tedditNormalRedirectsChecks, ...tedditNormalCustomRedirects];
|
||||
else if (protocol == 'tor') instancesList = [...tedditTorRedirectsChecks, ...tedditTorCustomRedirects];
|
||||
}
|
||||
|
||||
console.log("instancesList", instancesList);
|
||||
let index = instancesList.indexOf(protocolHost);
|
||||
if (index > -1) instancesList.splice(index, 1);
|
||||
|
||||
if (instancesList.length === 0) return null;
|
||||
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList);
|
||||
return randomInstance;
|
||||
}
|
||||
|
||||
async function init() {
|
||||
return new Promise((resolve) => {
|
||||
fetch('/instances/data.json').then(response => response.text()).then(data => {
|
||||
@ -277,7 +315,7 @@ async function init() {
|
||||
], (result) => {
|
||||
disableReddit = result.disableReddit ?? false;
|
||||
protocol = result.redditProtocol ?? 'normal';
|
||||
redditFrontend = result.redditFrontend ?? 'libreddit';
|
||||
frontend = result.redditFrontend ?? 'libreddit';
|
||||
|
||||
redirects.teddit = dataJson.teddit;
|
||||
if (result.redditRedirects) redirects = result.redditRedirects;
|
||||
@ -313,8 +351,8 @@ export default {
|
||||
getDisableReddit,
|
||||
setDisableReddit,
|
||||
|
||||
getRedditFrontend,
|
||||
setRedditFrontend,
|
||||
getFrontend,
|
||||
setFrontend,
|
||||
|
||||
getProtocol,
|
||||
setProtocol,
|
||||
@ -342,4 +380,5 @@ export default {
|
||||
redirect,
|
||||
isReddit,
|
||||
init,
|
||||
changeInstance,
|
||||
};
|
||||
|
@ -186,6 +186,45 @@ function redirect(url) {
|
||||
return `${randomInstance}${path}?${searchQuery}`;
|
||||
}
|
||||
|
||||
function changeInstance(url) {
|
||||
let protocolHost = `${url.protocol}//${url.host}`;
|
||||
|
||||
let searchList = [
|
||||
...redirects.searx.normal,
|
||||
...redirects.searx.tor,
|
||||
|
||||
...searxNormalCustomRedirects,
|
||||
...searxTorCustomRedirects,
|
||||
|
||||
...redirects.whoogle.normal,
|
||||
...redirects.whoogle.tor,
|
||||
|
||||
...whoogleNormalCustomRedirects,
|
||||
...whoogleTorCustomRedirects,
|
||||
]
|
||||
|
||||
if (!searchList.includes(protocolHost)) return null;
|
||||
|
||||
let instancesList;
|
||||
if (frontend == 'searx') {
|
||||
if (protocol == 'normal') instancesList = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects];
|
||||
else if (protocol == 'tor') instancesList = [...searxTorRedirectsChecks, ...searxTorCustomRedirects];
|
||||
}
|
||||
else if (frontend == 'whoogle') {
|
||||
if (protocol == 'normal') instancesList = [...whoogleNormalRedirectsChecks, ...whoogleNormalCustomRedirects];
|
||||
else if (protocol == 'tor') instancesList = [...whoogleTorRedirectsChecks, ...whoogleTorCustomRedirects];
|
||||
}
|
||||
|
||||
console.log("instancesList", instancesList);
|
||||
let index = instancesList.indexOf(protocolHost);
|
||||
if (index > -1) instancesList.splice(index, 1);
|
||||
|
||||
if (instancesList.length === 0) return null;
|
||||
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList);
|
||||
return randomInstance;
|
||||
}
|
||||
|
||||
async function init() {
|
||||
return new Promise((resolve) => {
|
||||
fetch('/instances/data.json').then(response => response.text()).then(data => {
|
||||
@ -198,13 +237,13 @@ async function init() {
|
||||
|
||||
"whoogleNormalRedirectsChecks",
|
||||
"whoogleNormalCustomRedirects",
|
||||
|
||||
|
||||
"whoogleTorRedirectsChecks",
|
||||
"whoogleTorCustomRedirects",
|
||||
|
||||
"searxNormalRedirectsChecks",
|
||||
"searxNormalCustomRedirects",
|
||||
|
||||
|
||||
"searxTorRedirectsChecks",
|
||||
"searxTorCustomRedirects",
|
||||
|
||||
@ -279,4 +318,5 @@ export default {
|
||||
|
||||
redirect,
|
||||
init,
|
||||
changeInstance,
|
||||
};
|
||||
|
@ -220,6 +220,46 @@ function redirect(url) {
|
||||
}
|
||||
}
|
||||
|
||||
function changeInstance(url) {
|
||||
let protocolHost = `${url.protocol}//${url.host}`;
|
||||
|
||||
let translateList = [
|
||||
...redirects.simplyTranslate.normal,
|
||||
...redirects.simplyTranslate.tor,
|
||||
|
||||
...simplyTranslateNormalCustomRedirects,
|
||||
...simplyTranslateTorCustomRedirects,
|
||||
|
||||
...redirects.lingva.normal,
|
||||
...redirects.lingva.tor,
|
||||
|
||||
...lingvaNormalCustomRedirects,
|
||||
...lingvaTorCustomRedirects,
|
||||
]
|
||||
|
||||
if (!translateList.includes(protocolHost)) return null;
|
||||
|
||||
let instancesList;
|
||||
if (frontend == 'simplyTranslate') {
|
||||
if (protocol == 'normal') instancesList = [...simplyTranslateNormalRedirectsChecks, ...simplyTranslateNormalCustomRedirects];
|
||||
else if (protocol == 'tor') instancesList = [...simplyTranslateTorRedirectsChecks, ...simplyTranslateTorCustomRedirects];
|
||||
}
|
||||
else if (frontend == 'lingva') {
|
||||
if (protocol == 'normal') instancesList = [...lingvaNormalRedirectsChecks, ...lingvaNormalCustomRedirects];
|
||||
else if (protocol == 'tor') instancesList = [...lingvaTorRedirectsChecks, ...lingvaTorCustomRedirects];
|
||||
}
|
||||
|
||||
console.log("instancesList", instancesList);
|
||||
let index = instancesList.indexOf(protocolHost);
|
||||
if (index > -1) instancesList.splice(index, 1);
|
||||
|
||||
if (instancesList.length === 0) return null;
|
||||
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList);
|
||||
return randomInstance;
|
||||
|
||||
}
|
||||
|
||||
async function init() {
|
||||
return new Promise((resolve) => {
|
||||
fetch('/instances/data.json').then(response => response.text()).then(data => {
|
||||
@ -318,4 +358,5 @@ export default {
|
||||
|
||||
redirect,
|
||||
init,
|
||||
changeInstance,
|
||||
};
|
||||
|
@ -132,6 +132,32 @@ function redirect(url) {
|
||||
return `${randomInstance}${url.pathname}${url.search}`;
|
||||
}
|
||||
|
||||
function changeInstance(url) {
|
||||
let protocolHost = `${url.protocol}//${url.host}`;
|
||||
|
||||
let twitterList = [
|
||||
...redirects.nitter.normal,
|
||||
...redirects.nitter.tor,
|
||||
...nitterNormalCustomRedirects,
|
||||
...nitterTorCustomRedirects,
|
||||
];
|
||||
|
||||
if (!twitterList.includes(protocolHost)) return null;
|
||||
|
||||
let instancesList;
|
||||
if (protocol == 'normal') instancesList = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects];
|
||||
else if (protocol == 'tor') instancesList = [...nitterTorRedirectsChecks, ...nitterTorCustomRedirects];
|
||||
|
||||
console.log("instancesList", instancesList);
|
||||
let index = instancesList.indexOf(protocolHost);
|
||||
if (index > -1) instancesList.splice(index, 1);
|
||||
|
||||
if (instancesList.length === 0) return null;
|
||||
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList);
|
||||
return randomInstance;
|
||||
}
|
||||
|
||||
async function init() {
|
||||
return new Promise((resolve) => {
|
||||
fetch('/instances/data.json').then(response => response.text()).then(data => {
|
||||
@ -193,4 +219,5 @@ export default {
|
||||
redirect,
|
||||
isTwitter,
|
||||
init,
|
||||
changeInstance,
|
||||
};
|
||||
|
@ -134,6 +134,32 @@ function redirect(url) {
|
||||
|
||||
}
|
||||
|
||||
function changeInstance(url) {
|
||||
let protocolHost = `${url.protocol}//${url.host}`;
|
||||
|
||||
let wikipediaList = [
|
||||
...redirects.wikiless.normal,
|
||||
...redirects.wikiless.tor,
|
||||
|
||||
...wikilessNormalCustomRedirects,
|
||||
...wikilessTorCustomRedirects,
|
||||
]
|
||||
if (!wikipediaList.includes(protocolHost)) return null;
|
||||
|
||||
let instancesList;
|
||||
if (protocol == 'normal') instancesList = [...wikilessNormalCustomRedirects, ...wikilessNormalRedirectsChecks];
|
||||
else if (protocol == 'tor') instancesList = [...wikilessTorCustomRedirects, ...wikilessTorRedirectsChecks];
|
||||
|
||||
console.log("instancesList", instancesList);
|
||||
let index = instancesList.indexOf(protocolHost);
|
||||
if (index > -1) instancesList.splice(index, 1);
|
||||
|
||||
if (instancesList.length === 0) return null;
|
||||
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList);
|
||||
return randomInstance;
|
||||
}
|
||||
|
||||
async function init() {
|
||||
return new Promise((resolve) => {
|
||||
fetch('/instances/data.json').then(response => response.text()).then(data => {
|
||||
@ -193,4 +219,5 @@ export default {
|
||||
redirect,
|
||||
isWikipedia,
|
||||
init,
|
||||
changeInstance,
|
||||
};
|
||||
|
@ -383,6 +383,23 @@ function redirect(url, type, details) {
|
||||
function changeInstance(url) {
|
||||
|
||||
let protocolHost = `${url.protocol}//${url.host}`;
|
||||
|
||||
if (
|
||||
protocol == 'normal' &&
|
||||
![
|
||||
...redirects.invidious.normal,
|
||||
...redirects.piped.normal,
|
||||
...invidiousNormalCustomRedirects,
|
||||
...pipedNormalCustomRedirects
|
||||
].includes(protocolHost)
|
||||
) return null;
|
||||
if (protocol == 'tor' && ![
|
||||
...redirects.invidious.tor,
|
||||
...redirects.piped.tor,
|
||||
...invidiousTorCustomRedirects,
|
||||
...pipedTorCustomRedirects
|
||||
].includes(protocolHost)) return null;
|
||||
|
||||
let instancesList;
|
||||
if (frontend == 'invidious') {
|
||||
if (protocol == 'normal') instancesList = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects];
|
||||
@ -399,7 +416,7 @@ function changeInstance(url) {
|
||||
|
||||
if (instancesList.length === 0) return null;
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList);
|
||||
return `${randomInstance}${url.pathname}${url.search}`;
|
||||
return randomInstance;
|
||||
}
|
||||
|
||||
function isPipedorInvidious(url, type) {
|
||||
@ -527,7 +544,6 @@ function invidiousInitCookies(tabId) {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
async function init() {
|
||||
return new Promise((resolve) => {
|
||||
fetch('/instances/data.json').then(response => response.text()).then(data => {
|
||||
|
@ -90,96 +90,8 @@ browser.webRequest.onBeforeRequest.addListener(
|
||||
["blocking"]
|
||||
);
|
||||
|
||||
browser.webRequest.onResponseStarted.addListener(
|
||||
(responseDetails) => {
|
||||
let url = new URL(responseDetails.url);
|
||||
let protocolHost = `${url.protocol}//${url.host}`;
|
||||
var mightyList = getMightyList();
|
||||
|
||||
if (mightyList.includes(protocolHost)); {
|
||||
if (responseDetails.statusCode >= 500 && responseDetails.type === "main_frame") {
|
||||
console.log("Instance is corrupted, redirecting", responseDetails.url);
|
||||
changeInstance(responseDetails.url);
|
||||
}
|
||||
}
|
||||
},
|
||||
{ urls: ["<all_urls>"] }
|
||||
);
|
||||
|
||||
browser.tabs.onUpdated.addListener(
|
||||
(tabId, changeInfo) => {
|
||||
if (changeInfo.url && youtubeHelper.isUrlPipedorInvidious(changeInfo.url))
|
||||
youtubeHelper.invidiousInitCookies(tabId);
|
||||
});
|
||||
|
||||
function changeInstance(url) {
|
||||
var tabUrl = new URL(url);
|
||||
var protocolHost = `${tabUrl.protocol}//${tabUrl.host}`;
|
||||
var newUrl;
|
||||
|
||||
console.log("wewe")
|
||||
newUrl = youtubeHelper.changeInstance(url);
|
||||
|
||||
let twitterList = [...twitterHelper.getRedirects().nitter.normal];
|
||||
if (twitterList.includes(protocolHost) && twitterList.length > 1) newUrl = 'https://twitter.com';
|
||||
|
||||
let instagramList = [...instagramHelper.getRedirects().bibliogram.normal];
|
||||
if (instagramList.includes(protocolHost) && instagramList.length > 1) newUrl = 'https://instagram.com';
|
||||
|
||||
let redditList = [...redditHelper.getRedirects().libreddit.normal, ...redditHelper.getRedirects().teddit.normal]
|
||||
if (redditList.includes(protocolHost) && redditList.length > 1) {
|
||||
if (tabUrl.pathname.startsWith('/img')) {
|
||||
newUrl = "https://i.redd.it"
|
||||
tabUrl.href = tabUrl.href.replace("/img", "")
|
||||
}
|
||||
else
|
||||
newUrl = 'https://reddit.com';
|
||||
}
|
||||
|
||||
let searchList = [...searchHelper.getRedirects().searx.normal, ...searchHelper.getRedirects().whoogle.normal]
|
||||
if (searchList.includes(protocolHost) && searchList.length > 1) newUrl = 'https://google.com';
|
||||
|
||||
let translateList = [...translateHelper.getRedirects().simplyTranslate.normal, ...translateHelper.getRedirects().lingva.normal]
|
||||
if (translateList.includes(protocolHost) && translateList.length > 1) newUrl = 'https://translate.google.com';
|
||||
|
||||
let mediumList = [...mediumHelper.getRedirects().scribe.normal]
|
||||
if (mediumList.includes(protocolHost) && mediumList.length > 1) newUrl = 'https://medium.com';
|
||||
|
||||
let imgurList = [...imgurHelper.getRedirects().rimgo.normal];
|
||||
if (imgurList.includes(protocolHost) && imgurList.length > 1) newUrl = 'https://imgur.com';
|
||||
|
||||
let wikipediaList = [...wikipediaHelper.getRedirects().wikiless.normal]
|
||||
if (wikipediaList.includes(protocolHost) && wikipediaList.length > 1) newUrl = 'https://wikipedia.com';
|
||||
|
||||
if (newUrl) browser.tabs.update({ url: tabUrl.href.replace(protocolHost, newUrl) });
|
||||
}
|
||||
|
||||
function getMightyList() {
|
||||
return [
|
||||
...youtubeHelper.getCustomRedirects().invidious.normal,
|
||||
...youtubeHelper.getCustomRedirects().piped.normal,
|
||||
|
||||
...twitterHelper.getCustomRedirects().nitter.normal,
|
||||
|
||||
...youtubeMusicHelper.getCustomRedirects().beatbump.normal,
|
||||
|
||||
...instagramHelper.getCustomRedirects().bibliogram.normal,
|
||||
|
||||
...redditHelper.getCustomRedirects().libreddit.normal,
|
||||
...redditHelper.getCustomRedirects().teddit.normal,
|
||||
redditHelper.getCustomRedirects().desktop,
|
||||
redditHelper.getCustomRedirects().mobile,
|
||||
|
||||
...searchHelper.getCustomRedirects().searx.normal,
|
||||
...searchHelper.getCustomRedirects().whoogle.normal,
|
||||
|
||||
...translateHelper.getCustomRedirects().simplyTranslate.normal,
|
||||
...translateHelper.getCustomRedirects().lingva.normal,
|
||||
|
||||
...mediumHelper.getCustomRedirects().scribe.normal,
|
||||
|
||||
...imgurHelper.getCustomRedirects().rimgo.normal,
|
||||
|
||||
...wikipediaHelper.getCustomRedirects().wikiless.normal
|
||||
];
|
||||
}
|
||||
});
|
@ -23,7 +23,7 @@
|
||||
<a href="../youtube/youtube.html">YouTube</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
<img src="../../../assets/images/youtube-icon.png" />
|
||||
<img src="../../../assets/images/youtube-music-icon.png" />
|
||||
<a href="../youtubeMusic/youtubeMusic.html">YT Music</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
@ -126,6 +126,12 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- <div class="buttons buttons-inline">
|
||||
<a class="button button-inline" id="export-settings">
|
||||
<span>Export Settings</span>
|
||||
</a>
|
||||
</div> -->
|
||||
|
||||
<div class="some-block option-block">
|
||||
<h4>Exceptions</h4>
|
||||
</div>
|
||||
|
@ -31,6 +31,11 @@ document.querySelector("#update-instances").addEventListener("click", () => {
|
||||
else
|
||||
document.querySelector("#update-instances").innerHTML = 'Failed Miserabely';
|
||||
});
|
||||
|
||||
document.querySelector("#export-settings").addEventListener("click", () => {
|
||||
browser.storage.local.get(null, result => console.log(result))
|
||||
});
|
||||
|
||||
let nameCustomInstanceInput = document.getElementById("exceptions-custom-instance");
|
||||
let instanceTypeElement = document.getElementById("exceptions-custom-instance-type");
|
||||
let instanceType = "url"
|
||||
|
@ -24,7 +24,7 @@
|
||||
<a href="../youtube/youtube.html">YouTube</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
<img src="../../../assets/images/youtube-icon.png" />
|
||||
<img src="../../../assets/images/youtube-music-icon.png" />
|
||||
<a href="../youtubeMusic/youtubeMusic.html">YT Music</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
|
@ -25,7 +25,7 @@
|
||||
<a href="../youtube/youtube.html">YouTube</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
<img src="../../../assets/images/youtube-icon.png" />
|
||||
<img src="../../../assets/images/youtube-music-icon.png" />
|
||||
<a href="../youtubeMusic/youtubeMusic.html">YT Music</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
|
@ -25,7 +25,7 @@
|
||||
<a href="../youtube/youtube.html">YouTube</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
<img src="../../../assets/images/youtube-icon.png" />
|
||||
<img src="../../../assets/images/youtube-music-icon.png" />
|
||||
<a href="../youtubeMusic/youtubeMusic.html">YT Music</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
|
@ -24,7 +24,7 @@
|
||||
<a href="../youtube/youtube.html">YouTube</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
<img src="../../../assets/images/youtube-icon.png" />
|
||||
<img src="../../../assets/images/youtube-music-icon.png" />
|
||||
<a href="../youtubeMusic/youtubeMusic.html">YT Music</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
|
@ -24,7 +24,7 @@
|
||||
<a href="../youtube/youtube.html">YouTube</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
<img src="../../../assets/images/youtube-icon.png" />
|
||||
<img src="../../../assets/images/youtube-music-icon.png" />
|
||||
<a href="../youtubeMusic/youtubeMusic.html">YT Music</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
|
@ -23,7 +23,7 @@ let redditFrontendElement = document.getElementById("reddit-frontend");
|
||||
redditFrontendElement.addEventListener("change",
|
||||
(event) => {
|
||||
let frontend = event.target.options[redditFrontendElement.selectedIndex].value
|
||||
redditHelper.setRedditFrontend(frontend)
|
||||
redditHelper.setFrontend(frontend)
|
||||
changeFrontendsSettings(frontend);
|
||||
}
|
||||
);
|
||||
@ -60,7 +60,7 @@ function changeProtocolSettings(protocol) {
|
||||
redditHelper.init().then(() => {
|
||||
disableRedditElement.checked = !redditHelper.getDisableReddit();
|
||||
|
||||
let frontend = redditHelper.getRedditFrontend();
|
||||
let frontend = redditHelper.getFrontend();
|
||||
redditFrontendElement.value = frontend;
|
||||
changeFrontendsSettings(frontend);
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
<a href="../youtube/youtube.html">YouTube</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
<img src="../../../assets/images/youtube-icon.png" />
|
||||
<img src="../../../assets/images/youtube-music-icon.png" />
|
||||
<a href="../youtubeMusic/youtubeMusic.html">YT Music</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
|
@ -24,7 +24,7 @@
|
||||
<a href="../youtube/youtube.html">YouTube</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
<img src="../../../assets/images/youtube-icon.png" />
|
||||
<img src="../../../assets/images/youtube-music-icon.png" />
|
||||
<a href="../youtubeMusic/youtubeMusic.html">YT Music</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
|
@ -19,12 +19,12 @@
|
||||
</svg>
|
||||
<a href="../general/general.html">General</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
<div class="title">
|
||||
<img src="../../../assets/images/youtube-icon.png" />
|
||||
<a href="../youtube/youtube.html">YouTube</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
<img src="../../../assets/images/youtube-icon.png" />
|
||||
<img src="../../../assets/images/youtube-music-icon.png" />
|
||||
<a href="../youtubeMusic/youtubeMusic.html">YT Music</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
|
@ -20,12 +20,12 @@
|
||||
</svg>
|
||||
<a href="../general/general.html">General</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
<div class="title">
|
||||
<img src="../../../assets/images/youtube-icon.png" />
|
||||
<a href="../youtube/youtube.html">YouTube</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
<img src="../../../assets/images/youtube-icon.png" />
|
||||
<img src="../../../assets/images/youtube-music-icon.png" />
|
||||
<a href="../youtubeMusic/youtubeMusic.html">YT Music</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
@ -186,4 +186,4 @@
|
||||
<!-- <script src="../../assets/javascripts/localise.js"></script> -->
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
@ -24,7 +24,7 @@
|
||||
<a href="../youtube/youtube.html">YouTube</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
<img src="../../../assets/images/youtube-icon.png" />
|
||||
<img src="../../../assets/images/youtube-music-icon.png" />
|
||||
<a href="../youtubeMusic/youtubeMusic.html">YT Music</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
|
@ -25,7 +25,7 @@
|
||||
<a href="../youtube/youtube.html" class="selected">YouTube</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
<img src="../../../assets/images/youtube-icon.png" />
|
||||
<img src="../../../assets/images/youtube-music-icon.png" />
|
||||
<a href="../youtubeMusic/youtubeMusic.html">YT Music</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
|
@ -25,7 +25,7 @@
|
||||
<a href="../youtube/youtube.html">YouTube</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
<img src="../../../assets/images/youtube-icon.png" />
|
||||
<img src="../../../assets/images/youtube-music-icon.png" />
|
||||
<a href="../youtubeMusic/youtubeMusic.html" class="selected">YT Music</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
|
@ -152,15 +152,22 @@
|
||||
<input id="disable-medium" type="checkbox" checked />
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="buttons">
|
||||
<a class="button" id="change-instance">
|
||||
Change Instance
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
|
||||
<path
|
||||
d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z" />
|
||||
</svg>
|
||||
</a>
|
||||
<a class="button" id="more-options">
|
||||
<span>Settings </span>
|
||||
Settings
|
||||
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24"
|
||||
width="24px" fill="currentColor">
|
||||
<g>
|
||||
<path
|
||||
d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z" />
|
||||
</g>
|
||||
<path
|
||||
d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z" />
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -109,3 +109,38 @@ disableMediumElement.addEventListener("change",
|
||||
document.getElementById("more-options").addEventListener("click",
|
||||
() => browser.runtime.openOptionsPage()
|
||||
);
|
||||
|
||||
document.getElementById("change-instance").addEventListener("click",
|
||||
() => browser.tabs.query({ active: true, currentWindow: true }, function (tabs) {
|
||||
let currTab = tabs[0];
|
||||
if (currTab) {
|
||||
changeInstance(currTab.url)
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
function changeInstance(url) {
|
||||
var tabUrl = new URL(url);
|
||||
var protocolHost = `${tabUrl.protocol}//${tabUrl.host}`;
|
||||
var newUrl;
|
||||
|
||||
newUrl = youtubeHelper.changeInstance(tabUrl);
|
||||
|
||||
if (!newUrl) newUrl = twitterHelper.changeInstance(tabUrl);
|
||||
|
||||
if (!newUrl) newUrl = instagramHelper.changeInstance(tabUrl);
|
||||
|
||||
if (!newUrl) newUrl = redditHelper.changeInstance(tabUrl);
|
||||
|
||||
if (!newUrl) newUrl = searchHelper.changeInstance(tabUrl);
|
||||
|
||||
if (!newUrl) newUrl = translateHelper.changeInstance(tabUrl);
|
||||
|
||||
if (!newUrl) newUrl = mediumHelper.changeInstance(tabUrl);
|
||||
|
||||
if (!newUrl) newUrl = imgurHelper.changeInstance(tabUrl);
|
||||
|
||||
if (!newUrl) newUrl = wikipediaHelper.changeInstance(tabUrl)
|
||||
|
||||
if (newUrl) browser.tabs.update({ url: tabUrl.href.replace(protocolHost, newUrl) });
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
body {
|
||||
width: 230px;
|
||||
width: 240px;
|
||||
min-height: auto;
|
||||
}
|
@ -17,6 +17,7 @@ body {
|
||||
font-family: Sans-Serif;
|
||||
background-color: var(--bg-main);
|
||||
color: var(--text);
|
||||
overflow-x:hidden
|
||||
}
|
||||
|
||||
div.some-block input[type="checkbox"] {
|
||||
@ -60,9 +61,9 @@ select {
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
a.button * {
|
||||
/* a.button * {
|
||||
vertical-align: middle;
|
||||
}
|
||||
} */
|
||||
|
||||
a.button:hover {
|
||||
background-color: var(--active);
|
||||
@ -209,19 +210,22 @@ div.some-block input[type="checkbox"]:checked::before {
|
||||
|
||||
div.buttons {
|
||||
margin-bottom: 15px;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
a.button {
|
||||
stroke: var(--text);
|
||||
display: block;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 5px;
|
||||
border: var(--active) solid 1px;
|
||||
color: var(--text);
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
margin: 7.5px 15px;
|
||||
/* width: 180px; */
|
||||
margin: 8px 20px;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
transition-duration: 0.1s;
|
||||
|
Loading…
x
Reference in New Issue
Block a user