Added wikipedia tor support #32

This commit is contained in:
ManeraKai 2022-02-22 23:52:38 +03:00
parent 0caf899239
commit 2570cd8d32
No known key found for this signature in database
GPG Key ID: 5ABC31FFD562E337
9 changed files with 438 additions and 195 deletions

View File

@ -9,17 +9,8 @@ const targets = [
];
let redirects = {
"bibliogram": {
"normal": [
"https://bibliogram.art",
"https://bibliogram.snopyta.org",
"https://bibliogram.pussthecat.org",
"https://bibliogram.1d4.us",
"https://insta.trom.tf",
"https://bib.riverside.rocks",
"https://bibliogram.esmailelbob.xyz",
"https://bib.actionsack.com",
"https://biblio.alefvanoon.xyz"
]
"normal": [],
"tor": []
}
};
const getRedirects = () => redirects;
@ -50,6 +41,14 @@ function setBibliogramNormalRedirectsChecks(val) {
console.log("bibliogramNormalRedirectsChecks: ", val)
}
let bibliogramTorRedirectsChecks;
const getBibliogramTorRedirectsChecks = () => bibliogramTorRedirectsChecks;
function setBibliogramTorRedirectsChecks(val) {
bibliogramTorRedirectsChecks = val;
browser.storage.local.set({ bibliogramTorRedirectsChecks })
console.log("bibliogramTorRedirectsChecks: ", val)
}
let bibliogramNormalCustomRedirects = [];
const getBibliogramNormalCustomRedirects = () => bibliogramNormalCustomRedirects;
function setBibliogramNormalCustomRedirects(val) {
@ -58,6 +57,14 @@ function setBibliogramNormalCustomRedirects(val) {
console.log("bibliogramNormalCustomRedirects: ", val)
}
let bibliogramTorCustomRedirects = [];
const getBibliogramTorCustomRedirects = () => bibliogramTorCustomRedirects;
function setBibliogramTorCustomRedirects(val) {
bibliogramTorCustomRedirects = val;
browser.storage.local.set({ bibliogramTorCustomRedirects })
console.log("bibliogramTorCustomRedirects: ", val)
}
const reservedPaths = [
"about",
"explore",
@ -93,6 +100,14 @@ function setDisable(val) {
browser.storage.local.set({ disableInstagram: disable })
}
let protocol;
const getprotocol = () => protocol;
function setProtocol(val) {
protocol = val;
browser.storage.local.set({ nitterProtocol: val })
console.log("nitterProtocol: ", val)
}
function isInstagram(url, initiator) {
if (disable) return false;
if (
@ -107,7 +122,10 @@ 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 = [...bibliogramNormalRedirectsChecks, ...bibliogramNormalCustomRedirects];
let instancesList;
if (protocol == 'normal') instancesList = [...bibliogramNormalRedirectsChecks, ...bibliogramNormalCustomRedirects];
else if (protocol == 'tor') instancesList = [...bibliogramTorRedirectsChecks, ...bibliogramTorCustomRedirects];
if (instancesList.length === 0) return null;
let randomInstance = commonHelper.getRandomInstance(instancesList)
@ -120,24 +138,39 @@ function redirect(url, type) {
async function init() {
return new Promise((resolve) => {
browser.storage.local.get(
[
"disableInstagram",
"instagramRedirects",
"bibliogramNormalRedirectsChecks",
"bibliogramNormalCustomRedirects",
],
(result) => {
disable = result.disableInstagram ?? false;
fetch('/instances/data.json').then(response => response.text()).then(data => {
let dataJson = JSON.parse(data);
browser.storage.local.get(
[
"disableInstagram",
"instagramRedirects",
if (result.instagramRedirects) redirects = result.instagramRedirects
"bibliogramNormalRedirectsChecks",
"bibliogramTorRedirectsChecks",
bibliogramNormalRedirectsChecks = result.bibliogramNormalRedirectsChecks ?? [...redirects.bibliogram.normal];
bibliogramNormalCustomRedirects = result.bibliogramNormalCustomRedirects ?? [];
"bibliogramNormalCustomRedirects",
"bibliogramTorCustomRedirects",
"bibliogramProtocol"
],
(result) => {
disable = result.disableInstagram ?? false;
resolve();
}
)
redirects.bibliogram = dataJson.bibliogram;
if (result.instagramRedirects) redirects = result.instagramRedirects
bibliogramNormalRedirectsChecks = result.bibliogramNormalRedirectsChecks ?? [...redirects.bibliogram.normal];
bibliogramNormalCustomRedirects = result.bibliogramNormalCustomRedirects ?? [];
bibliogramTorRedirectsChecks = result.bibliogramTorRedirectsChecks ?? [...redirects.bibliogram.tor];
bibliogramTorCustomRedirects = result.bibliogramTorCustomRedirects ?? [];
protocol = result.bibliogramProtocol ?? "normal";
resolve();
}
)
})
})
}
@ -149,11 +182,18 @@ export default {
getDisable,
setDisable,
getprotocol,
setProtocol,
getBibliogramNormalRedirectsChecks,
setBibliogramNormalRedirectsChecks,
getBibliogramTorRedirectsChecks,
setBibliogramTorRedirectsChecks,
getBibliogramNormalCustomRedirects,
setBibliogramNormalCustomRedirects,
getBibliogramTorCustomRedirects,
setBibliogramTorCustomRedirects,
isInstagram,

View File

@ -149,6 +149,8 @@ async function init() {
(result) => {
disable = result.disableTwitter ?? false;
protocol = result.nitterProtocol ?? "normal";
redirects.nitter = dataJson.nitter;
if (result.twitterRedirects) redirects = result.twitterRedirects;
@ -158,8 +160,6 @@ async function init() {
nitterTorRedirectsChecks = result.nitterTorRedirectsChecks ?? [...redirects.nitter.tor];
nitterTorCustomRedirects = result.nitterTorCustomRedirects ?? [];
protocol = result.nitterProtocol ?? "normal";
resolve();
}
);

View File

@ -21,10 +21,12 @@ const getRedirects = () => redirects;
const getCustomRedirects = function () {
return {
"wikiless": {
"normal": [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects]
"normal": [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects],
"tor": [...wikilessTorRedirectsChecks, ...wikilessTorCustomRedirects]
},
};
};
function setRedirects(val) {
redirects.wikiless = val;
browser.storage.local.set({ wikipediaRedirects: redirects })
@ -35,6 +37,13 @@ function setRedirects(val) {
if (index !== -1) wikilessNormalRedirectsChecks.splice(index, 1);
}
setWikilessNormalRedirectsChecks(wikilessNormalRedirectsChecks);
for (const item of wikilessTorRedirectsChecks)
if (!redirects.wikiless.normal.includes(item)) {
var index = wikilessTorRedirectsChecks.indexOf(item);
if (index !== -1) wikilessTorRedirectsChecks.splice(index, 1);
}
setWikilessTorRedirectsChecks(wikilessTorRedirectsChecks);
}
let disable;
@ -44,6 +53,15 @@ function setDisable(val) {
browser.storage.local.set({ disableWikipedia: disable })
}
let protocol;
const getProtocol = () => protocol;
function setProtocol(val) {
protocol = val;
browser.storage.local.set({ wikilessProtocol: val })
console.log("wikilessProtocol: ", val)
}
let wikilessNormalRedirectsChecks;
const getWikilessNormalRedirectsChecks = () => wikilessNormalRedirectsChecks;
function setWikilessNormalRedirectsChecks(val) {
@ -52,6 +70,15 @@ function setWikilessNormalRedirectsChecks(val) {
console.log("wikilessNormalRedirectsChecks: ", val)
}
let wikilessTorRedirectsChecks;
const getWikilessTorRedirectsChecks = () => wikilessTorRedirectsChecks;
function setWikilessTorRedirectsChecks(val) {
wikilessTorRedirectsChecks = val;
browser.storage.local.set({ wikilessTorRedirectsChecks })
console.log("wikilessTorRedirectsChecks: ", val)
}
let wikilessNormalCustomRedirects = [];
const getWikilessNormalCustomRedirects = () => wikilessNormalCustomRedirects;
function setWikilessNormalCustomRedirects(val) {
@ -60,6 +87,14 @@ function setWikilessNormalCustomRedirects(val) {
console.log("wikilessNormalCustomRedirects: ", val)
}
let wikilessTorCustomRedirects = [];
const getWikilessTorCustomRedirects = () => wikilessTorCustomRedirects;
function setWikilessTorCustomRedirects(val) {
wikilessTorCustomRedirects = val;
browser.storage.local.set({ wikilessTorCustomRedirects })
console.log("wikilessTorCustomRedirects: ", val)
}
function isWikipedia(url, initiator) {
if (disable) return false;
return targets.test(url.href);
@ -75,8 +110,9 @@ function redirect(url) {
GETArguments.push([args[0], args[1]]);
}
}
let instancesList = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects];
let instancesList;
if (protocol == 'normal') instancesList = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects];
else if (protocol == 'tor') instancesList = [...wikilessTorRedirectsChecks, ...wikilessTorCustomRedirects];
if (instancesList.length === 0) return null;
let randomInstance = commonHelper.getRandomInstance(instancesList)
@ -100,23 +136,36 @@ function redirect(url) {
async function init() {
return new Promise((resolve) => {
browser.storage.local.get(
[
"disableWikipedia",
"wikipediaRedirects",
"wikilessNormalRedirectsChecks",
"wikilessNormalCustomRedirects",
], (result) => {
disable = result.disableWikipedia ?? false;
fetch('/instances/data.json').then(response => response.text()).then(data => {
let dataJson = JSON.parse(data);
browser.storage.local.get(
[
"disableWikipedia",
"wikipediaRedirects",
"wikilessNormalRedirectsChecks",
"wikilessTorRedirectsChecks",
"wikilessNormalCustomRedirects",
"wikilessTorCustomRedirects",
"wikilessProtocol"
if (result.wikipediaRedirects) redirects = result.wikipediaRedirects;
], (result) => {
disable = result.disableWikipedia ?? false;
wikilessNormalRedirectsChecks = result.wikilessNormalRedirectsChecks ?? [...redirects.wikiless.normal];
wikilessNormalCustomRedirects = result.wikilessNormalCustomRedirects ?? [];
protocol = result.wikilessProtocol ?? "normal";
resolve();
}
);
redirects.wikiless = dataJson.wikiless;
if (result.wikipediaRedirects) redirects = result.wikipediaRedirects;
wikilessNormalRedirectsChecks = result.wikilessNormalRedirectsChecks ?? [...redirects.wikiless.normal];
wikilessNormalCustomRedirects = result.wikilessNormalCustomRedirects ?? [];
wikilessTorRedirectsChecks = result.wikilessTorRedirectsChecks ?? [...redirects.wikiless.tor];
wikilessTorCustomRedirects = result.wikilessTorCustomRedirects ?? [];
resolve();
}
);
});
});
}
@ -128,11 +177,18 @@ export default {
setDisable,
getDisable,
getProtocol,
setProtocol,
getWikilessNormalRedirectsChecks,
setWikilessNormalRedirectsChecks,
getWikilessTorRedirectsChecks,
setWikilessTorRedirectsChecks,
getWikilessNormalCustomRedirects,
setWikilessNormalCustomRedirects,
getWikilessTorCustomRedirects,
setWikilessTorCustomRedirects,
redirect,
isWikipedia,

View File

@ -73,7 +73,8 @@
"https://tw.artemislena.eu",
"https://de.nttr.stream",
"https://nitter.winscloud.net",
"https://nitter.tiekoetter.com"
"https://nitter.tiekoetter.com",
"https://nitter.spaceint.fr"
],
"tor": [
"http://3nzoldnxplag42gqjs23xvghtzf6t6yzssrtytnntc6ppc7xxuoneoad.onion",
@ -105,7 +106,8 @@
"https://bibliogram.esmailelbob.xyz",
"https://bib.actionsack.com",
"https://biblio.alefvanoon.xyz"
]
],
"tor": []
},
"teddit": {
"normal": [

View File

@ -59,6 +59,7 @@ r = requests.get('https://bibliogram.art/api/instances')
rJson = json.loads(r.text)
bibliogramList = {}
bibliogramList['normal'] = []
bibliogramList['tor'] = []
for item in rJson['data']:
bibliogramList['normal'].append(item['address'])
mightyList['bibliogram'] = bibliogramList

View File

@ -2,146 +2,177 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg" />
<link href="../../stylesheets/styles.css" rel="stylesheet" />
<title>LibRedirect Options: Instagram</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg" />
<link href="../../stylesheets/styles.css" rel="stylesheet" />
<title>LibRedirect Options: Instagram</title>
</head>
<body class="option">
<section class="links">
<div class="title">
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
<path d="M0 0h24v24H0V0z" fill="none" />
<path d="M12 5.69l5 4.5V18h-2v-6H9v6H7v-7.81l5-4.5M12 3L2 12h3v8h6v-6h2v6h6v-8h3L12 3z" />
</svg>
<a href="../general/general.html">General</a>
</div>
<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/twitter-icon.png" />
<a href="../twitter/twitter.html">Twitter</a>
</div>
<div class="title">
<img src="../../../assets/images/instagram-icon.png" />
<a href="../instagram/instagram.html" class="selected">Instagram</a>
</div>
<div class="title">
<img src="../../../assets/images/tiktok-icon.png" />
<a href="../tiktok/tiktok.html">TikTok</a>
</div>
<div class="title">
<img src="../../../assets/images/reddit-icon.png" />
<a href="../reddit/reddit.html">Reddit</a>
</div>
<div class="title">
<img src="../../../assets/images/imgur-icon.png" />
<a href="../imgur/imgur.html">Imgur</a>
</div>
<div class="title">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
<path d="M0 0h24v24H0V0z" fill="none" />
<section class="links">
<div class="title">
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
<path d="M0 0h24v24H0V0z" fill="none" />
<path d="M12 5.69l5 4.5V18h-2v-6H9v6H7v-7.81l5-4.5M12 3L2 12h3v8h6v-6h2v6h6v-8h3L12 3z" />
</svg>
<a href="../general/general.html">General</a>
</div>
<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/twitter-icon.png" />
<a href="../twitter/twitter.html">Twitter</a>
</div>
<div class="title">
<img src="../../../assets/images/instagram-icon.png" />
<a href="../instagram/instagram.html" class="selected">Instagram</a>
</div>
<div class="title">
<img src="../../../assets/images/tiktok-icon.png" />
<a href="../tiktok/tiktok.html">TikTok</a>
</div>
<div class="title">
<img src="../../../assets/images/reddit-icon.png" />
<a href="../reddit/reddit.html">Reddit</a>
</div>
<div class="title">
<img src="../../../assets/images/imgur-icon.png" />
<a href="../imgur/imgur.html">Imgur</a>
</div>
<div class="title">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
<path d="M0 0h24v24H0V0z" fill="none" />
<path
d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" />
</svg>
<a href="../search/search.html">Search</a>
</div>
<div class="title">
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
<path d="M0 0h24v24H0V0z" fill="none" />
<path
d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z" />
</svg>
<a href="../translate/translate.html">Translate</a>
</div>
<div class="title">
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
<path d="M0 0h24v24H0V0z" fill="none" />
<path
d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM10 5.47l4 1.4v11.66l-4-1.4V5.47zm-5 .99l3-1.01v11.7l-3 1.16V6.46zm14 11.08l-3 1.01V6.86l3-1.16v11.84z" />
</svg>
<a href="../maps/maps.html">Maps</a>
</div>
<div class="title">
<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>
<rect fill="none" height="24" width="24" />
</g>
<g>
<g />
<g>
<path
d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" />
</svg>
<a href="../search/search.html">Search</a>
</div>
<div class="title">
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
<path d="M0 0h24v24H0V0z" fill="none" />
d="M21,5c-1.11-0.35-2.33-0.5-3.5-0.5c-1.95,0-4.05,0.4-5.5,1.5c-1.45-1.1-3.55-1.5-5.5-1.5S2.45,4.9,1,6v14.65 c0,0.25,0.25,0.5,0.5,0.5c0.1,0,0.15-0.05,0.25-0.05C3.1,20.45,5.05,20,6.5,20c1.95,0,4.05,0.4,5.5,1.5c1.35-0.85,3.8-1.5,5.5-1.5 c1.65,0,3.35,0.3,4.75,1.05c0.1,0.05,0.15,0.05,0.25,0.05c0.25,0,0.5-0.25,0.5-0.5V6C22.4,5.55,21.75,5.25,21,5z M21,18.5 c-1.1-0.35-2.3-0.5-3.5-0.5c-1.7,0-4.15,0.65-5.5,1.5V8c1.35-0.85,3.8-1.5,5.5-1.5c1.2,0,2.4,0.15,3.5,0.5V18.5z" />
<g>
<path
d="M17.5,10.5c0.88,0,1.73,0.09,2.5,0.26V9.24C19.21,9.09,18.36,9,17.5,9c-1.7,0-3.24,0.29-4.5,0.83v1.66 C14.13,10.85,15.7,10.5,17.5,10.5z" />
<path
d="M13,12.49v1.66c1.13-0.64,2.7-0.99,4.5-0.99c0.88,0,1.73,0.09,2.5,0.26V11.9c-0.79-0.15-1.64-0.24-2.5-0.24 C15.8,11.66,14.26,11.96,13,12.49z" />
<path
d="M17.5,14.33c-1.7,0-3.24,0.29-4.5,0.83v1.66c1.13-0.64,2.7-0.99,4.5-0.99c0.88,0,1.73,0.09,2.5,0.26v-1.52 C19.21,14.41,18.36,14.33,17.5,14.33z" />
</g>
</g>
</g>
</svg>
<a href="../wikipedia/wikipedia.html">Wikipedia</a>
</div>
<div class="title">
<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>
<rect fill="none" height="24" width="24" />
<g>
<path
d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z" />
</svg>
<a href="../translate/translate.html">Translate</a>
</div>
<div class="title">
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
<path d="M0 0h24v24H0V0z" fill="none" />
<path
d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM10 5.47l4 1.4v11.66l-4-1.4V5.47zm-5 .99l3-1.01v11.7l-3 1.16V6.46zm14 11.08l-3 1.01V6.86l3-1.16v11.84z" />
</svg>
<a href="../maps/maps.html">Maps</a>
</div>
<div class="title">
<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>
<rect fill="none" height="24" width="24" />
</g>
<g>
<g />
<g>
<path
d="M21,5c-1.11-0.35-2.33-0.5-3.5-0.5c-1.95,0-4.05,0.4-5.5,1.5c-1.45-1.1-3.55-1.5-5.5-1.5S2.45,4.9,1,6v14.65 c0,0.25,0.25,0.5,0.5,0.5c0.1,0,0.15-0.05,0.25-0.05C3.1,20.45,5.05,20,6.5,20c1.95,0,4.05,0.4,5.5,1.5c1.35-0.85,3.8-1.5,5.5-1.5 c1.65,0,3.35,0.3,4.75,1.05c0.1,0.05,0.15,0.05,0.25,0.05c0.25,0,0.5-0.25,0.5-0.5V6C22.4,5.55,21.75,5.25,21,5z M21,18.5 c-1.1-0.35-2.3-0.5-3.5-0.5c-1.7,0-4.15,0.65-5.5,1.5V8c1.35-0.85,3.8-1.5,5.5-1.5c1.2,0,2.4,0.15,3.5,0.5V18.5z" />
<g>
<path
d="M17.5,10.5c0.88,0,1.73,0.09,2.5,0.26V9.24C19.21,9.09,18.36,9,17.5,9c-1.7,0-3.24,0.29-4.5,0.83v1.66 C14.13,10.85,15.7,10.5,17.5,10.5z" />
<path
d="M13,12.49v1.66c1.13-0.64,2.7-0.99,4.5-0.99c0.88,0,1.73,0.09,2.5,0.26V11.9c-0.79-0.15-1.64-0.24-2.5-0.24 C15.8,11.66,14.26,11.96,13,12.49z" />
<path
d="M17.5,14.33c-1.7,0-3.24,0.29-4.5,0.83v1.66c1.13-0.64,2.7-0.99,4.5-0.99c0.88,0,1.73,0.09,2.5,0.26v-1.52 C19.21,14.41,18.36,14.33,17.5,14.33z" />
</g>
</g>
</g>
</svg>
<a href="../wikipedia/wikipedia.html">Wikipedia</a>
</div>
<div class="title">
<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>
<rect fill="none" height="24" width="24" />
<g>
<path
d="M19,5v14H5V5H19 M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3L19,3z" />
</g>
<path d="M14,17H7v-2h7V17z M17,13H7v-2h10V13z M17,9H7V7h10V9z" />
</g>
</svg>
<a href="../medium/medium.html">Medium</a>
</div>
</section>
d="M19,5v14H5V5H19 M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3L19,3z" />
</g>
<path d="M14,17H7v-2h7V17z M17,13H7v-2h10V13z M17,9H7V7h10V9z" />
</g>
</svg>
<a href="../medium/medium.html">Medium</a>
</div>
</section>
<section class="option-block">
<section class="option-block">
<div class="some-block option-block">
<h4>Enable</h4>
<input id="disable-bibliogram" type="checkbox" checked />
</div>
<div class="some-block option-block">
<h4>Protocol</h4>
<select id="protocol">
<option value="normal">Normal</option>
<option value="tor">Tor</option>
</select>
</div>
<hr>
<div id="normal">
<div class="some-block option-block">
<h4>Default Instances</h4>
</div>
<div class="checklist" id="bibliogram-normal-checklist"></div>
<hr>
<div class="some-block option-block">
<h4>Custom Instances</h4>
</div>
<form id="custom-bibliogram-normal-instance-form">
<div class="some-block option-block">
<h4>Enable</h4>
<input id="disable-bibliogram" type="checkbox" checked />
<input id="bibliogram-normal-custom-instance" placeholder="https://bibliogram.com" type="url" />
<button type="submit" class="add" id="bibliogram-normal-add-instance">
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
<path d="M0 0h24v24H0V0z" fill="none" />
<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
</svg>
</button>
</div>
</form>
<div class="checklist" id="bibliogram-normal-custom-checklist"></div>
</div>
<hr>
<div id="tor">
<div class="some-block option-block">
<h4>Default Instances</h4>
</div>
<div class="checklist" id="bibliogram-tor-checklist"></div>
<hr>
<div class="some-block option-block">
<h4>Custom Instances</h4>
</div>
<form id="custom-bibliogram-tor-instance-form">
<div class="some-block option-block">
<h4>Default Instances</h4>
<input id="bibliogram-tor-custom-instance" placeholder="https://bibliogram.com" type="url" />
<button type="submit" class="add" id="bibliogram-tor-add-instance">
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
<path d="M0 0h24v24H0V0z" fill="none" />
<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
</svg>
</button>
</div>
<div class="checklist" id="bibliogram-normal-checklist"></div>
<hr>
<div class="some-block option-block">
<h4>Custom Instances</h4>
</div>
<form id="custom-bibliogram-normal-instance-form">
<div class="some-block option-block">
<input id="bibliogram-normal-custom-instance" placeholder="https://bibliogram.com" type="url" />
<button type="submit" class="add" id="bibliogram-normal-add-instance">
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px"
fill="currentColor">
<path d="M0 0h24v24H0V0z" fill="none" />
<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
</svg>
</button>
</div>
</form>
<div class="checklist" id="bibliogram-normal-custom-checklist"></div>
</form>
<div class="checklist" id="bibliogram-tor-custom-checklist"></div>
</div>
</section>
<script type="module" src="../init.js"></script>
<script type="module" src="./instagram.js"></script>
<!-- <script src="../../assets/javascripts/localise.js"></script> -->
</section>
<script type="module" src="../init.js"></script>
<script type="module" src="./instagram.js"></script>
<!-- <script src="../../assets/javascripts/localise.js"></script> -->
</body>
</html>
</html>

View File

@ -6,9 +6,36 @@ disableInstagramElement.addEventListener("change",
(event) => instagramHelper.setDisable(!event.target.checked)
);
let protocolElement = document.getElementById("protocol")
protocolElement.addEventListener("change",
(event) => {
let protocol = event.target.options[protocolElement.selectedIndex].value
instagramHelper.setProtocol(protocol);
changeProtocolSettings(protocol);
}
);
function changeProtocolSettings(protocol) {
let normalDiv = document.getElementById("normal");
let torDiv = document.getElementById("tor");
if (protocol == 'normal') {
normalDiv.style.display = 'block';
torDiv.style.display = 'none';
}
else if (protocol == 'tor') {
normalDiv.style.display = 'none';
torDiv.style.display = 'block';
}
}
instagramHelper.init().then(() => {
disableInstagramElement.checked = !instagramHelper.getDisable();
let protocol = instagramHelper.getprotocol();
protocolElement.value = protocol;
changeProtocolSettings(protocol);
commonHelper.processDefaultCustomInstances(
'bibliogram',
'normal',
@ -19,4 +46,15 @@ instagramHelper.init().then(() => {
instagramHelper.getBibliogramNormalCustomRedirects,
instagramHelper.setBibliogramNormalCustomRedirects
)
commonHelper.processDefaultCustomInstances(
'bibliogram',
'tor',
instagramHelper,
document,
instagramHelper.getBibliogramTorRedirectsChecks,
instagramHelper.setBibliogramTorRedirectsChecks,
instagramHelper.getBibliogramTorCustomRedirects,
instagramHelper.setBibliogramTorCustomRedirects
)
})

View File

@ -112,31 +112,67 @@
<input id="disable-wikipedia" type="checkbox" checked />
</div>
<hr>
<div class="some-block option-block">
<h4>Default Instances</h4>
</div>
<div class="checklist" id="wikiless-normal-checklist">
<h4>Protocol</h4>
<select id="protocol">
<option value="normal">Normal</option>
<option value="tor">Tor</option>
</select>
</div>
<hr>
<div class="some-block option-block">
<h4>Custom Instances</h4>
</div>
<form id="custom-wikiless-normal-instance-form">
<div id="normal">
<div class="some-block option-block">
<input id="wikiless-normal-custom-instance" placeholder="https://wikiless.com" type="url" />
<button type="submit" class="add" id="wikiless-normal-add-instance">
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px"
fill="currentColor">
<path d="M0 0h24v24H0V0z" fill="none" />
<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
</svg>
</button>
<h4>Default Instances</h4>
</div>
</form>
<div class="checklist" id="wikiless-normal-custom-checklist"></div>
<div class="checklist" id="wikiless-normal-checklist">
</div>
<hr>
<div class="some-block option-block">
<h4>Custom Instances</h4>
</div>
<form id="custom-wikiless-normal-instance-form">
<div class="some-block option-block">
<input id="wikiless-normal-custom-instance" placeholder="https://wikiless.com" type="url" />
<button type="submit" class="add" id="wikiless-normal-add-instance">
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px"
fill="currentColor">
<path d="M0 0h24v24H0V0z" fill="none" />
<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
</svg>
</button>
</div>
</form>
<div class="checklist" id="wikiless-normal-custom-checklist"></div>
</div>
<div id="tor">
<div class="some-block option-block">
<h4>Default Instances</h4>
</div>
<div class="checklist" id="wikiless-tor-checklist">
</div>
<hr>
<div class="some-block option-block">
<h4>Custom Instances</h4>
</div>
<form id="custom-wikiless-tor-instance-form">
<div class="some-block option-block">
<input id="wikiless-tor-custom-instance" placeholder="https://wikiless.com" type="url" />
<button type="submit" class="add" id="wikiless-tor-add-instance">
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px"
fill="currentColor">
<path d="M0 0h24v24H0V0z" fill="none" />
<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
</svg>
</button>
</div>
</form>
<div class="checklist" id="wikiless-tor-custom-checklist"></div>
</div>
</section>
<script type="module" src="../init.js"></script>
@ -144,4 +180,4 @@
<!-- <script src="../../assets/javascripts/localise.js"></script> -->
</body>
</html>
</html>

View File

@ -5,9 +5,37 @@ let disableWikipediaElement = document.getElementById("disable-wikipedia");
disableWikipediaElement.addEventListener("change",
(event) => wikipediaHelper.setDisable(!event.target.checked)
);
let protocolElement = document.getElementById("protocol")
protocolElement.addEventListener("change",
(event) => {
let protocol = event.target.options[protocolElement.selectedIndex].value
wikipediaHelper.setProtocol(protocol);
changeProtocolSettings(protocol);
}
);
function changeProtocolSettings(protocol) {
let normalDiv = document.getElementById("normal");
let torDiv = document.getElementById("tor");
if (protocol == 'normal') {
normalDiv.style.display = 'block';
torDiv.style.display = 'none';
}
else if (protocol == 'tor') {
normalDiv.style.display = 'none';
torDiv.style.display = 'block';
}
}
wikipediaHelper.init().then(() => {
disableWikipediaElement.checked = !wikipediaHelper.getDisable();
let protocol = wikipediaHelper.getProtocol();
protocolElement.value = protocol;
changeProtocolSettings(protocol);
commonHelper.processDefaultCustomInstances(
'wikiless',
'normal',
@ -18,4 +46,15 @@ wikipediaHelper.init().then(() => {
wikipediaHelper.getWikilessNormalCustomRedirects,
wikipediaHelper.setWikilessNormalCustomRedirects
)
commonHelper.processDefaultCustomInstances(
'wikiless',
'tor',
wikipediaHelper,
document,
wikipediaHelper.getWikilessTorRedirectsChecks,
wikipediaHelper.setWikilessTorRedirectsChecks,
wikipediaHelper.getWikilessTorCustomRedirects,
wikipediaHelper.setWikilessTorCustomRedirects
)
})