mirror of
https://codeberg.org/LibRedirect/libredirect.git
synced 2025-02-07 23:58:42 +01:00
Added libremdb #230
This commit is contained in:
parent
f108cdbcbd
commit
cc8b5e4e5f
57
src/assets/images/imdb.svg
Normal file
57
src/assets/images/imdb.svg
Normal file
@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
width="946.47894"
|
||||
height="946.47894"
|
||||
viewBox="0 0 250.42255 250.42256"
|
||||
version="1.1"
|
||||
id="svg14"
|
||||
sodipodi:docname="imdb.svg"
|
||||
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs18" />
|
||||
<sodipodi:namedview
|
||||
id="namedview16"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.6035"
|
||||
inkscape:cx="400.9942"
|
||||
inkscape:cy="501.24275"
|
||||
inkscape:window-width="1888"
|
||||
inkscape:window-height="1060"
|
||||
inkscape:window-x="32"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg14" />
|
||||
<circle
|
||||
style="fill:#f5c518;fill-opacity:1;stroke-width:0.529167"
|
||||
id="path857"
|
||||
cx="125.21127"
|
||||
cy="125.21127"
|
||||
r="125.21127" />
|
||||
<g
|
||||
id="g12"
|
||||
transform="translate(-7.0803833,59.065437)">
|
||||
<polygon
|
||||
points="5,18 5,0 0,0 0,18 "
|
||||
transform="matrix(4.1341143,0,0,4.1341143,33.07292,28.938814)"
|
||||
id="polygon4" />
|
||||
<path
|
||||
d="M 97.8649,28.938814 93.238682,63.70039 90.364307,44.793235 C 89.53087,38.737048 88.731526,33.452235 87.966151,28.938814 H 62.011715 V 103.35287 H 79.54712 l 0.06875,-49.138886 7.381547,49.138886 h 12.483968 l 7.007355,-50.222105 0.0516,50.222105 h 17.48438 V 28.938814 Z"
|
||||
id="path6" />
|
||||
<path
|
||||
d="M 132.29167,103.35287 V 28.938814 h 32.26493 c 7.29586,0 13.21033,5.870218 13.21033,13.132452 v 48.149153 c 0,7.252863 -5.90492,13.132451 -13.21033,13.132451 z m 24.11118,-61.021495 c -0.81984,-0.443125 -2.38842,-0.656562 -4.66989,-0.656562 v 48.827044 c 3.01225,0 4.86595,-0.541563 5.56108,-1.674062 0.69516,-1.116094 1.05156,-4.135938 1.05156,-9.0925 V 50.882203 c 0,-3.364562 -0.125,-5.514593 -0.35656,-6.466515 -0.23172,-0.951875 -0.74859,-1.641234 -1.58633,-2.084375 z"
|
||||
id="path8" />
|
||||
<path
|
||||
d="m 216.75124,47.570688 h 1.32125 c 7.42153,0 13.43787,5.811796 13.43787,12.972889 v 29.836405 c 0,7.16473 -6.01439,12.972888 -13.43787,12.972888 h -1.32125 c -4.54109,0 -8.55609,-2.17594 -10.98864,-5.505518 l -1.19047,4.549608 H 186.03519 V 28.938814 h 19.77896 v 23.897389 c 2.55559,-3.184828 6.49396,-5.265515 10.93714,-5.265515 z m -4.23473,36.286591 V 66.224718 c 0,-2.913469 -0.18704,-4.825437 -0.57672,-5.705547 -0.38969,-0.880156 -1.94505,-1.445156 -3.03607,-1.445156 -1.09109,0 -2.77353,0.459219 -3.10082,1.233125 v 5.917609 18.197155 5.73275 c 0.37406,0.849687 1.97864,1.322658 3.10082,1.322658 1.12219,0 2.75552,-0.457658 3.09841,-1.322658 0.34281,-0.865 0.51438,-2.974172 0.51438,-6.297344 z"
|
||||
id="path10" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.9 KiB |
@ -64,6 +64,7 @@ const allPopupFrontends = [
|
||||
"wikipedia",
|
||||
"medium",
|
||||
"quora",
|
||||
"imdb",
|
||||
"reuters",
|
||||
"peertube",
|
||||
"lbry",
|
||||
|
159
src/assets/javascripts/imdb.js
Normal file
159
src/assets/javascripts/imdb.js
Normal file
@ -0,0 +1,159 @@
|
||||
window.browser = window.browser || window.chrome;
|
||||
|
||||
import utils from './utils.js'
|
||||
|
||||
const targets = [
|
||||
/^https?:\/{2}(www\.|)imdb\.com.*/
|
||||
];
|
||||
|
||||
let redirects = {
|
||||
"libremdb": {
|
||||
"normal": [],
|
||||
"tor": []
|
||||
}
|
||||
}
|
||||
function setRedirects(val) {
|
||||
browser.storage.local.get('cloudflareBlackList', r => {
|
||||
redirects.libremdb = val;
|
||||
libremdbNormalRedirectsChecks = [...redirects.libremdb.normal];
|
||||
for (const instance of r.cloudflareBlackList) {
|
||||
const a = libremdbNormalRedirectsChecks.indexOf(instance);
|
||||
if (a > -1) libremdbNormalRedirectsChecks.splice(a, 1);
|
||||
}
|
||||
browser.storage.local.set({
|
||||
imdbRedirects: redirects,
|
||||
libremdbNormalRedirectsChecks
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
let
|
||||
disableImdb,
|
||||
imdbProtocol,
|
||||
imdbRedirects,
|
||||
libremdbNormalRedirectsChecks,
|
||||
libremdbNormalCustomRedirects,
|
||||
libremdbTorRedirectsChecks,
|
||||
libremdbTorCustomRedirects;
|
||||
|
||||
function init() {
|
||||
return new Promise(async resolve => {
|
||||
browser.storage.local.get(
|
||||
[
|
||||
"disableImdb",
|
||||
"imdbProtocol",
|
||||
"imdbRedirects",
|
||||
"libremdbNormalRedirectsChecks",
|
||||
"libremdbNormalCustomRedirects",
|
||||
"libremdbTorRedirectsChecks",
|
||||
"libremdbTorCustomRedirects",
|
||||
],
|
||||
r => {
|
||||
disableImdb = r.disableImdb;
|
||||
imdbProtocol = r.imdbProtocol;
|
||||
imdbRedirects = r.imdbRedirects;
|
||||
libremdbNormalRedirectsChecks = r.libremdbNormalRedirectsChecks;
|
||||
libremdbNormalCustomRedirects = r.libremdbNormalCustomRedirects;
|
||||
libremdbTorRedirectsChecks = r.libremdbTorRedirectsChecks;
|
||||
libremdbTorCustomRedirects = r.libremdbTorCustomRedirects;
|
||||
resolve();
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
init();
|
||||
browser.storage.onChanged.addListener(init)
|
||||
|
||||
function redirect(url, type, initiator) {
|
||||
if (disableImdb) return;
|
||||
if (url.pathname == "/") return;
|
||||
if (type != "main_frame") return;
|
||||
const all = [
|
||||
...imdbRedirects.libremdb.normal,
|
||||
...libremdbNormalCustomRedirects
|
||||
];
|
||||
if (initiator && (all.includes(initiator.origin) || targets.includes(initiator.host))) return;
|
||||
if (!targets.some(rx => rx.test(url.href))) return;
|
||||
|
||||
let instancesList;
|
||||
if (imdbProtocol == 'normal') instancesList = [...libremdbNormalRedirectsChecks, ...libremdbNormalCustomRedirects];
|
||||
if (imdbProtocol == 'tor') instancesList = [...libremdbTorRedirectsChecks, ...libremdbTorCustomRedirects];
|
||||
if (instancesList.length === 0) return;
|
||||
|
||||
const randomInstance = utils.getRandomInstance(instancesList);
|
||||
return `${randomInstance}${url.pathname}`;
|
||||
}
|
||||
|
||||
function reverse(url) {
|
||||
return new Promise(async resolve => {
|
||||
await init();
|
||||
let protocolHost = utils.protocolHost(url);
|
||||
const all = [
|
||||
...imdbRedirects.libremdb.normal,
|
||||
...imdbRedirects.libremdb.tor,
|
||||
...libremdbNormalCustomRedirects,
|
||||
...libremdbTorCustomRedirects
|
||||
];
|
||||
if (!all.includes(protocolHost)) { resolve(); return; }
|
||||
|
||||
resolve(`https://imdb.com${url.pathname}${url.search}`);
|
||||
})
|
||||
}
|
||||
|
||||
function switchInstance(url) {
|
||||
return new Promise(async resolve => {
|
||||
await init();
|
||||
let protocolHost = utils.protocolHost(url);
|
||||
const all = [
|
||||
...imdbRedirects.libremdb.tor,
|
||||
...imdbRedirects.libremdb.normal,
|
||||
|
||||
...libremdbNormalCustomRedirects,
|
||||
...libremdbTorCustomRedirects,
|
||||
];
|
||||
if (!all.includes(protocolHost)) { resolve(); return; }
|
||||
|
||||
let instancesList;
|
||||
if (imdbProtocol == 'normal') instancesList = [...libremdbNormalCustomRedirects, ...libremdbNormalRedirectsChecks];
|
||||
else if (imdbProtocol == 'tor') instancesList = [...libremdbTorCustomRedirects, ...libremdbTorRedirectsChecks];
|
||||
|
||||
const i = instancesList.indexOf(protocolHost);
|
||||
if (i > -1) instancesList.splice(i, 1);
|
||||
if (instancesList.length === 0) { resolve(); return; }
|
||||
|
||||
const randomInstance = utils.getRandomInstance(instancesList);
|
||||
resolve(`${randomInstance}${url.pathname}${url.search}`);
|
||||
})
|
||||
}
|
||||
|
||||
function initDefaults() {
|
||||
return new Promise(async resolve => {
|
||||
fetch('/instances/data.json').then(response => response.text()).then(async data => {
|
||||
let dataJson = JSON.parse(data);
|
||||
redirects.libremdb = dataJson.libremdb;
|
||||
browser.storage.local.set({
|
||||
disableImdb: false,
|
||||
imdbProtocol: "normal",
|
||||
|
||||
imdbRedirects: redirects,
|
||||
|
||||
libremdbNormalRedirectsChecks: [...redirects.libremdb.normal],
|
||||
libremdbNormalCustomRedirects: [],
|
||||
|
||||
libremdbTorRedirectsChecks: [...redirects.libremdb.tor],
|
||||
libremdbTorCustomRedirects: [],
|
||||
}, () => resolve());
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
setRedirects,
|
||||
|
||||
redirect,
|
||||
reverse,
|
||||
switchInstance,
|
||||
|
||||
initDefaults
|
||||
};
|
@ -12,6 +12,7 @@ import lbryHelper from "./lbry.js";
|
||||
import sendTargetsHelper from "./sendTargets.js";
|
||||
import tiktokHelper from "./tiktok.js";
|
||||
import quoraHelper from "./quora.js"
|
||||
import libremdbHelper from "./imdb.js";
|
||||
import imgurHelper from "./imgur.js";
|
||||
import localise from './localise.js'
|
||||
|
||||
@ -49,6 +50,7 @@ function updateInstances() {
|
||||
wikipediaHelper.setRedirects(instances.wikiless);
|
||||
mediumHelper.setRedirects(instances.scribe);
|
||||
quoraHelper.setRedirects(instances.query);
|
||||
libremdbHelper.setRedirects(instances.libremdb);
|
||||
sendTargetsHelper.setRedirects(instances.send);
|
||||
tiktokHelper.setRedirects(instances.proxiTok);
|
||||
|
||||
@ -366,6 +368,7 @@ function copyRaw(test, copyRawElement) {
|
||||
if (!newUrl) newUrl = await instagramHelper.reverse(url);
|
||||
if (!newUrl) newUrl = await tiktokHelper.reverse(url);
|
||||
if (!newUrl) newUrl = await quoraHelper.reverse(url);
|
||||
if (!newUrl) newUrl = await libremdbHelper.reverse(url);
|
||||
if (!newUrl) newUrl = await imgurHelper.reverse(url);
|
||||
|
||||
if (newUrl) {
|
||||
@ -439,6 +442,7 @@ function switchInstance(test) {
|
||||
if (!newUrl) newUrl = await translateHelper.switchInstance(url);
|
||||
if (!newUrl) newUrl = await mediumHelper.switchInstance(url);
|
||||
if (!newUrl) newUrl = await quoraHelper.switchInstance(url);
|
||||
if (!newUrl) newUrl = await libremdbHelper.switchInstance(url);
|
||||
if (!newUrl) newUrl = await tiktokHelper.switchInstance(url);
|
||||
if (!newUrl) newUrl = await sendTargetsHelper.switchInstance(url);
|
||||
if (!newUrl) newUrl = await peertubeHelper.switchInstance(url);
|
||||
|
@ -10,14 +10,14 @@
|
||||
"https://tube.cthd.icu",
|
||||
"https://yt.artemislena.eu",
|
||||
"https://invidious.flokinet.to",
|
||||
"https://invidious.lunar.icu",
|
||||
"https://invidious.tiekoetter.com",
|
||||
"https://invidious.lunar.icu",
|
||||
"https://invidious.sethforprivacy.com",
|
||||
"https://inv.bp.projectsegfau.lt",
|
||||
"https://invidious.projectsegfau.lt",
|
||||
"https://invidious.weblibre.org",
|
||||
"https://youtube.076.ne.jp",
|
||||
"https://invidious.esmailelbob.xyz",
|
||||
"https://youtube.076.ne.jp",
|
||||
"https://invidious.namazso.eu",
|
||||
"https://invidious.kavin.rocks"
|
||||
],
|
||||
@ -233,7 +233,9 @@
|
||||
"https://reddit.beparanoid.de",
|
||||
"https://libreddit.dcs0.hu",
|
||||
"https://reddit.dr460nf1r3.org",
|
||||
"https://rd.jae.su"
|
||||
"https://rd.jae.su",
|
||||
"https://libreddit.mha.fi",
|
||||
"https://libreddit.foss.wtf"
|
||||
],
|
||||
"tor": [
|
||||
"http://spjmllawtheisznfs7uryhxumin26ssv2draj7oope3ok3wuhy43eoyd.onion",
|
||||
@ -250,7 +252,8 @@
|
||||
"http://lbrdtjaj7567ptdd4rv74lv27qhxfkraabnyphgcvptl64ijx2tijwid.onion",
|
||||
"http://libreddit.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion",
|
||||
"http://reddit.prnoid54e44a4bduq5due64jkk7wcnkxcp5kv3juncm7veptjcqudgyd.onion",
|
||||
"http://inz6tbezfwzexva6dize4cqraj2tjdhygxabmcgysccesvw2pybzhbyd.onion"
|
||||
"http://inz6tbezfwzexva6dize4cqraj2tjdhygxabmcgysccesvw2pybzhbyd.onion",
|
||||
"http://libreddit.micohauwkjbyw5meacrb4ipicwvwg4xtzl7y7viv53kig2mdcsvwkyyd.onion"
|
||||
]
|
||||
},
|
||||
"teddit": {
|
||||
@ -324,6 +327,13 @@
|
||||
],
|
||||
"tor": []
|
||||
},
|
||||
"libremdb": {
|
||||
"normal": [
|
||||
"https://libremdb.herokuapp.com",
|
||||
"https://libremdb.pussthecat.org"
|
||||
],
|
||||
"tor": []
|
||||
},
|
||||
"simplyTranslate": {
|
||||
"normal": [
|
||||
"https://simplytranslate.org",
|
||||
@ -388,6 +398,7 @@
|
||||
"https://search.snopyta.org",
|
||||
"https://search.stinpriza.org",
|
||||
"https://search.trom.tf",
|
||||
"https://search.zzls.xyz",
|
||||
"https://searx.bissisoft.com",
|
||||
"https://searx.divided-by-zero.eu",
|
||||
"https://searx.dresden.network",
|
||||
@ -408,7 +419,6 @@
|
||||
"https://searx.run",
|
||||
"https://searx.semipvt.com",
|
||||
"https://searx.sethforprivacy.com",
|
||||
"https://searx.sev.monster",
|
||||
"https://searx.solusar.de",
|
||||
"https://searx.sp-codes.de",
|
||||
"https://searx.stuehieyr.com",
|
||||
@ -459,9 +469,9 @@
|
||||
"https://search.roombob.cat",
|
||||
"https://search.sapti.me",
|
||||
"https://search.vojkovic.xyz",
|
||||
"https://search.zzls.xyz",
|
||||
"https://searx.albony.xyz",
|
||||
"https://searx.be",
|
||||
"https://searx.becomesovran.com",
|
||||
"https://searx.ebnar.xyz",
|
||||
"https://searx.esmailelbob.xyz",
|
||||
"https://searx.fmac.xyz",
|
||||
@ -473,6 +483,7 @@
|
||||
"https://searx.ppeb.me",
|
||||
"https://searx.priv.pw",
|
||||
"https://searx.prvcy.eu",
|
||||
"https://searx.sev.monster",
|
||||
"https://searx.tiekoetter.com",
|
||||
"https://searxng.ir",
|
||||
"https://searxng.zackptg5.com",
|
||||
@ -525,6 +536,8 @@
|
||||
]
|
||||
},
|
||||
"peertube": [
|
||||
"https://socpeertube.ru",
|
||||
"https://seka.pona.la",
|
||||
"https://syop.tv",
|
||||
"https://watch.thelema.social",
|
||||
"https://tube.miegl.cz",
|
||||
@ -639,7 +652,6 @@
|
||||
"https://video.pthreat.co",
|
||||
"https://peertube.egroc.de",
|
||||
"https://pt.k2s.sk",
|
||||
"https://gameplay.wtf",
|
||||
"https://video.cats-home.net",
|
||||
"https://peertube.narrativerry.xyz",
|
||||
"https://tube.9minuti.it",
|
||||
@ -797,7 +809,6 @@
|
||||
"https://film.node9.org",
|
||||
"https://peertube.mi-site.net",
|
||||
"https://tube.nowtech.io",
|
||||
"https://videos.mattwilson.org",
|
||||
"https://raptube.antipub.org",
|
||||
"https://video.cm-en-transition.fr",
|
||||
"https://tube.koweb.fr",
|
||||
@ -906,7 +917,6 @@
|
||||
"https://video.interru.io",
|
||||
"https://tube.cnr.it",
|
||||
"https://peertube.dtmf.ca",
|
||||
"https://peertube.dk",
|
||||
"https://tube.ponsonaille.fr",
|
||||
"https://peertube.ares.bioxis-server.fr",
|
||||
"https://tube.int5.net",
|
||||
@ -1301,7 +1311,6 @@
|
||||
"https://p.lu",
|
||||
"https://serv3.wiki-tube.de",
|
||||
"https://serv1.wiki-tube.de",
|
||||
"https://tube.traydent.info",
|
||||
"https://video.lavolte.net",
|
||||
"https://peertube.public.cat",
|
||||
"https://peertube.anduin.net",
|
||||
@ -1569,6 +1578,8 @@
|
||||
"https://peertube.fr",
|
||||
"https://peertube.amicale.net",
|
||||
"https://aperi.tube",
|
||||
"https://tube.ac-lyon.fr"
|
||||
"https://tube.ac-lyon.fr",
|
||||
"https://video.lw1.at",
|
||||
"https://www.yiny.org"
|
||||
]
|
||||
}
|
@ -260,6 +260,29 @@ def quetre():
|
||||
print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Quetre')
|
||||
|
||||
|
||||
def libremdb():
|
||||
r = requests.get(
|
||||
'https://raw.githubusercontent.com/zyachel/libremdb/main/README.md')
|
||||
_list = {}
|
||||
_list['normal'] = []
|
||||
_list['tor'] = []
|
||||
|
||||
tmp = re.findall(
|
||||
r"\| ([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)*\|*[A-Z]{0,}.*\|.*\|", r.text)
|
||||
|
||||
tmp = filterLastSlash(tmp)
|
||||
|
||||
for item in tmp:
|
||||
if item.strip() == "":
|
||||
continue
|
||||
if item.endswith('.onion'):
|
||||
_list['tor'].append(item)
|
||||
else:
|
||||
_list['normal'].append(item)
|
||||
mightyList['libremdb'] = _list
|
||||
print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Libremdb')
|
||||
|
||||
|
||||
def simplytranslate():
|
||||
r = requests.get('https://simple-web.org/instances/simplytranslate')
|
||||
simplyTranslateList = {}
|
||||
@ -392,6 +415,7 @@ teddit()
|
||||
wikiless()
|
||||
scribe()
|
||||
quetre()
|
||||
libremdb()
|
||||
simplytranslate()
|
||||
linvgatranslate()
|
||||
searx_searxng()
|
||||
|
@ -14,6 +14,7 @@ import mapsHelper from "../../assets/javascripts/maps.js";
|
||||
import wikipediaHelper from "../../assets/javascripts/wikipedia.js";
|
||||
import mediumHelper from "../../assets/javascripts/medium.js";
|
||||
import quoraHelper from "../../assets/javascripts/quora.js";
|
||||
import libremdbHelper from "../../assets/javascripts/imdb.js";
|
||||
import reutersHelper from "../../assets/javascripts/reuters.js";
|
||||
import imgurHelper from "../../assets/javascripts/imgur.js";
|
||||
import tiktokHelper from "../../assets/javascripts/tiktok.js";
|
||||
@ -45,6 +46,7 @@ browser.runtime.onInstalled.addListener(
|
||||
translateHelper.initDefaults();
|
||||
mediumHelper.initDefaults();
|
||||
quoraHelper.initDefaults();
|
||||
libremdbHelper.initDefaults();
|
||||
reutersHelper.initDefaults();
|
||||
redditHelper.initDefaults();
|
||||
wikipediaHelper.initDefaults();
|
||||
@ -104,6 +106,7 @@ browser.webRequest.onBeforeRequest.addListener(
|
||||
if (!newUrl) newUrl = redditHelper.redirect(url, details.type, initiator);
|
||||
if (!newUrl) newUrl = mediumHelper.redirect(url, details.type, initiator);
|
||||
if (!newUrl) newUrl = quoraHelper.redirect(url, details.type, initiator);
|
||||
if (!newUrl) newUrl = libremdbHelper.redirect(url, details.type, initiator);
|
||||
if (!newUrl) newUrl = reutersHelper.redirect(url, details.type, initiator);
|
||||
if (!newUrl) newUrl = imgurHelper.redirect(url, details.type, initiator);
|
||||
if (!newUrl) newUrl = tiktokHelper.redirect(url, details.type, initiator);
|
||||
@ -182,6 +185,7 @@ async function redirectOfflineInstance(url, tabId) {
|
||||
if (!newUrl) newUrl = await translateHelper.switchInstance(url);
|
||||
if (!newUrl) newUrl = await mediumHelper.switchInstance(url);
|
||||
if (!newUrl) newUrl = await quoraHelper.switchInstance(url);
|
||||
if (!newUrl) newUrl = await libremdbHelper.switchInstance(url);
|
||||
if (!newUrl) newUrl = await tiktokHelper.switchInstance(url);
|
||||
if (!newUrl) newUrl = await imgurHelper.switchInstance(url);
|
||||
if (!newUrl) newUrl = await wikipediaHelper.switchInstance(url);
|
||||
|
@ -31,6 +31,7 @@
|
||||
</svg><a href="#medium" data-localise="__MSG_medium__">Medium</a>
|
||||
</div>
|
||||
<div class="title"><img src="../../../assets/images/quora.png"><a href="#quora" data-localise="__MSG_quora__">Quora</a></div>
|
||||
<div class="title"><img src="../../../assets/images/imdb.svg"><a href="#imdb" data-localise="__MSG_imdb__">IMDb</a></div>
|
||||
<div class="title"><img src="../../../assets/images/reuters.svg"><a href="#reuters" data-localise="__MSG_reuters__">Reuters</a></div>
|
||||
<div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a href="#peertube" data-localise="__MSG_peertube__">PeerTube</a></div>
|
||||
<div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="#lbry" data-localise="__MSG_lbry__">LBRY/Odysee</a></div>
|
||||
@ -217,6 +218,12 @@
|
||||
</div>
|
||||
<input id="quora" type="checkbox">
|
||||
</div>
|
||||
<div>
|
||||
<div> <img src="../../../assets/images/imdb.svg">
|
||||
<x data-localise="__MSG_imdb__">IMDb</x>
|
||||
</div>
|
||||
<input id="imdb" type="checkbox">
|
||||
</div>
|
||||
<div>
|
||||
<div> <img src="../../../assets/images/reuters.svg">
|
||||
<x data-localise="__MSG_reuters__">Reuters</x>
|
||||
@ -1183,6 +1190,78 @@
|
||||
</div>
|
||||
<script type="module" src="./widgets/quora.js"></script>
|
||||
</section>
|
||||
<section class="option-block" id="imdb_page">
|
||||
<div class="some-block option-block">
|
||||
<h1 data-localise="__MSG_imdb__">IMDb</h1>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="some-block option-block">
|
||||
<h4 data-localise="__MSG_enable__">Enable</h4>
|
||||
<input id="imdb-enable" type="checkbox">
|
||||
</div>
|
||||
<div class="some-block option-block">
|
||||
<h4 data-localise="__MSG_protocol__">Protocol</h4>
|
||||
<select id="imdb-protocol">
|
||||
<option value="normal" data-localise="__MSG_normal__">Normal</option>
|
||||
<option value="tor" data-localise="__MSG_tor__">Tor</option>
|
||||
</select>
|
||||
</div>
|
||||
<div id="libremdb">
|
||||
<hr>
|
||||
<div class="normal">
|
||||
<div class="some-block option-block">
|
||||
<h4 data-localise="__MSG_defaultInstances__">Default Instances</h4>
|
||||
</div>
|
||||
<div class="checklist"></div>
|
||||
<hr>
|
||||
<div class="some-block option-block">
|
||||
<h4 data-localise="__MSG_customInstances__">Custom Instances</h4>
|
||||
</div>
|
||||
<form class="custom-instance-form">
|
||||
<div class="some-block option-block">
|
||||
<input class="custom-instance" placeholder="https://libremdb.com" type="url">
|
||||
<button class="add add-instance" type="submit">
|
||||
<svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
|
||||
<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="checklist custom-checklist"></div>
|
||||
<div class="buttons buttons-inline">
|
||||
<label class="button button-inline" id="latency-libremdb-label" for="latency-libremdb">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
|
||||
<path d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"></path>
|
||||
</svg>
|
||||
<x data-localise="__MSG_testInstancesLatency__">Test Instances Latency</x>
|
||||
</label>
|
||||
<input class="button button-inline" id="latency-libremdb" style="display:none;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="tor">
|
||||
<div class="some-block option-block">
|
||||
<h4 data-localise="__MSG_defaultInstances__">Default Instances</h4>
|
||||
</div>
|
||||
<div class="checklist"></div>
|
||||
<hr>
|
||||
<div class="some-block option-block">
|
||||
<h4 data-localise="__MSG_customInstances__">Custom Instances</h4>
|
||||
</div>
|
||||
<form class="custom-instance-form">
|
||||
<div class="some-block option-block">
|
||||
<input class="custom-instance" placeholder="https://libremdb.onion" type="url">
|
||||
<button class="add add-instance" type="submit">
|
||||
<svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
|
||||
<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="checklist custom-checklist"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="module" src="./widgets/imdb.js"></script>
|
||||
</section>
|
||||
<section class="option-block" id="reuters_page">
|
||||
<div class="some-block option-block">
|
||||
<h1 data-localise="__MSG_reuters__">Reuters</h1>
|
||||
|
@ -23,6 +23,7 @@ html#elementToShowWithJavaScript(lang="en")
|
||||
include ./widgets/wikipedia.pug
|
||||
include ./widgets/medium.pug
|
||||
include ./widgets/quora.pug
|
||||
include ./widgets/imdb.pug
|
||||
include ./widgets/reuters.pug
|
||||
include ./widgets/peertube.pug
|
||||
include ./widgets/lbry.pug
|
||||
|
@ -15,6 +15,7 @@ import mapsHelper from "../../../assets/javascripts/maps.js";
|
||||
import wikipediaHelper from "../../../assets/javascripts/wikipedia.js";
|
||||
import mediumHelper from "../../../assets/javascripts/medium.js";
|
||||
import quoraHelper from "../../../assets/javascripts/quora.js";
|
||||
import libremdbHelper from "../../../assets/javascripts/imdb.js";
|
||||
import imgurHelper from "../../../assets/javascripts/imgur.js";
|
||||
import tiktokHelper from "../../../assets/javascripts/tiktok.js";
|
||||
import sendTargetsHelper from "../../../assets/javascripts/sendTargets.js";
|
||||
@ -132,6 +133,7 @@ resetSettings.addEventListener("click",
|
||||
await translateHelper.initDefaults();
|
||||
await mediumHelper.initDefaults();
|
||||
await quoraHelper.initDefaults();
|
||||
await libremdbHelper.initDefaults();
|
||||
await reutersHelper.initDefaults();
|
||||
await redditHelper.initDefaults();
|
||||
await wikipediaHelper.initDefaults();
|
||||
|
@ -156,6 +156,12 @@ section#general_page.option-block
|
||||
x(data-localise="__MSG_quora__") Quora
|
||||
input#quora(type="checkbox")
|
||||
|
||||
div
|
||||
div
|
||||
img(src="../../../assets/images/imdb.svg")
|
||||
x(data-localise="__MSG_imdb__") IMDb
|
||||
input#imdb(type="checkbox")
|
||||
|
||||
div
|
||||
div
|
||||
img(src="../../../assets/images/reuters.svg")
|
||||
|
42
src/pages/options/widgets/imdb.js
Normal file
42
src/pages/options/widgets/imdb.js
Normal file
@ -0,0 +1,42 @@
|
||||
import utils from "../../../assets/javascripts/utils.js";
|
||||
|
||||
const enable = document.getElementById("imdb-enable");
|
||||
const protocol = document.getElementById("imdb-protocol")
|
||||
const imdb = document.getElementById('imdb_page');
|
||||
|
||||
function changeProtocolSettings() {
|
||||
const normalDiv = imdb.getElementsByClassName("normal")[0];
|
||||
const torDiv = imdb.getElementsByClassName("tor")[0];
|
||||
if (protocol.value == 'normal') {
|
||||
normalDiv.style.display = 'block';
|
||||
torDiv.style.display = 'none';
|
||||
}
|
||||
else if (protocol.value == 'tor') {
|
||||
normalDiv.style.display = 'none';
|
||||
torDiv.style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
imdb.addEventListener("change", () => {
|
||||
changeProtocolSettings();
|
||||
browser.storage.local.set({
|
||||
disableImdb: !enable.checked,
|
||||
imdbProtocol: protocol.value,
|
||||
})
|
||||
})
|
||||
|
||||
browser.storage.local.get(
|
||||
[
|
||||
"disableImdb",
|
||||
"imdbProtocol"
|
||||
],
|
||||
r => {
|
||||
enable.checked = !r.disableImdb;
|
||||
protocol.value = r.imdbProtocol;
|
||||
changeProtocolSettings();
|
||||
}
|
||||
)
|
||||
|
||||
utils.processDefaultCustomInstances('imdb', 'libremdb', 'normal', document);
|
||||
utils.processDefaultCustomInstances('imdb', 'libremdb', 'tor', document);
|
||||
utils.latency('imdb', 'libremdb', document, location)
|
26
src/pages/options/widgets/imdb.pug
Normal file
26
src/pages/options/widgets/imdb.pug
Normal file
@ -0,0 +1,26 @@
|
||||
section#imdb_page.option-block
|
||||
.some-block.option-block
|
||||
h1(data-localise="__MSG_imdb__") IMDb
|
||||
hr
|
||||
.some-block.option-block
|
||||
h4(data-localise="__MSG_enable__") Enable
|
||||
input#imdb-enable(type="checkbox")
|
||||
|
||||
.some-block.option-block
|
||||
h4(data-localise="__MSG_protocol__") Protocol
|
||||
select#imdb-protocol
|
||||
option(value="normal" data-localise="__MSG_normal__") Normal
|
||||
option(value="tor" data-localise="__MSG_tor__") Tor
|
||||
|
||||
#libremdb
|
||||
hr
|
||||
.normal
|
||||
include ../../widgets/instances.pug
|
||||
+instances('https://libremdb.com')
|
||||
include ../../widgets/latency.pug
|
||||
+latency('libremdb')
|
||||
.tor
|
||||
include ../../widgets/instances.pug
|
||||
+instances('https://libremdb.onion')
|
||||
|
||||
script(type="module" src="./widgets/imdb.js")
|
@ -52,6 +52,10 @@
|
||||
<h4 data-localise="__MSG_quora__">Quora</h4></a>
|
||||
<input id="disable-quora" type="checkbox">
|
||||
</div>
|
||||
<div class="some-block" id="imdb"><a class="title" href="https://imdb.com"><img src="../../assets/images/imdb.svg">
|
||||
<h4 data-localise="__MSG_imdb__">IMDb</h4></a>
|
||||
<input id="disable-imdb" type="checkbox">
|
||||
</div>
|
||||
<div class="some-block" id="reuters"><a class="title" href="https://reuters.com"><img src="../../assets/images/reuters.svg">
|
||||
<h4 data-localise="__MSG_reuters__">Reuters</h4></a>
|
||||
<input id="disable-reuters" type="checkbox">
|
||||
|
@ -67,6 +67,12 @@ html(lang="en")
|
||||
img(src="../../assets/images/quora.png")
|
||||
h4(data-localise="__MSG_quora__") Quora
|
||||
input#disable-quora(type="checkbox")
|
||||
|
||||
#imdb.some-block
|
||||
a.title(href="https://imdb.com")
|
||||
img(src="../../assets/images/imdb.svg")
|
||||
h4(data-localise="__MSG_imdb__") IMDb
|
||||
input#disable-imdb(type="checkbox")
|
||||
|
||||
#reuters.some-block
|
||||
a.title(href="https://reuters.com")
|
||||
|
@ -46,6 +46,10 @@ mixin links(service)
|
||||
img(src="../../../assets/images/quora.png")
|
||||
a(href="#quora" data-localise="__MSG_quora__") Quora
|
||||
|
||||
.title
|
||||
img(src="../../../assets/images/imdb.svg")
|
||||
a(href="#imdb" data-localise="__MSG_imdb__") IMDb
|
||||
|
||||
.title
|
||||
img(src="../../../assets/images/reuters.svg")
|
||||
a(href="#reuters" data-localise="__MSG_reuters__") Reuters
|
||||
|
Loading…
x
Reference in New Issue
Block a user