aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/assets/javascripts/helpers/instagram.js94
-rw-r--r--src/assets/javascripts/helpers/twitter.js4
-rw-r--r--src/assets/javascripts/helpers/wikipedia.js90
-rw-r--r--src/instances/data.json6
-rw-r--r--src/instances/get_instances.py1
-rw-r--r--src/pages/options/instagram/instagram.html283
-rw-r--r--src/pages/options/instagram/instagram.js38
-rw-r--r--src/pages/options/wikipedia/wikipedia.html72
-rw-r--r--src/pages/options/wikipedia/wikipedia.js39
9 files changed, 435 insertions, 192 deletions
diff --git a/src/assets/javascripts/helpers/instagram.js b/src/assets/javascripts/helpers/instagram.js
index 46051970..fc004e09 100644
--- a/src/assets/javascripts/helpers/instagram.js
+++ b/src/assets/javascripts/helpers/instagram.js
@@ -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,
diff --git a/src/assets/javascripts/helpers/twitter.js b/src/assets/javascripts/helpers/twitter.js
index 4e0c4845..3edea7ac 100644
--- a/src/assets/javascripts/helpers/twitter.js
+++ b/src/assets/javascripts/helpers/twitter.js
@@ -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();
}
);
diff --git a/src/assets/javascripts/helpers/wikipedia.js b/src/assets/javascripts/helpers/wikipedia.js
index fc777bee..e27f80bc 100644
--- a/src/assets/javascripts/helpers/wikipedia.js
+++ b/src/assets/javascripts/helpers/wikipedia.js
@@ -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,
diff --git a/src/instances/data.json b/src/instances/data.json
index 113a6025..fe7c400b 100644
--- a/src/instances/data.json
+++ b/src/instances/data.json
@@ -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": [
diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py
index a3d5c325..3aee6cdb 100644
--- a/src/instances/get_instances.py
+++ b/src/instances/get_instances.py
@@ -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
diff --git a/src/pages/options/instagram/instagram.html b/src/pages/options/instagram/instagram.html
index 6a53fca3..0062a6ea 100644
--- a/src/pages/options/instagram/instagram.html
+++ b/src/pages/options/instagram/instagram.html
@@ -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" />
- <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" />
+ <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="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">
+ 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>
- <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" />
+ <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>
- </svg>
- <a href="../medium/medium.html">Medium</a>
- </div>
- </section>
+ </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>
- <section class="option-block">
- <div class="some-block option-block">
- <h4>Enable</h4>
- <input id="disable-bibliogram" type="checkbox" checked />
- </div>
+ <section class="option-block">
+ <div class="some-block option-block">
+ <h4>Enable</h4>
+ <input id="disable-bibliogram" type="checkbox" checked />
+ </div>
- <hr>
+ <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>Default Instances</h4>
+ <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>
- <div class="checklist" id="bibliogram-normal-checklist"></div>
- <hr>
+ </form>
+ <div class="checklist" id="bibliogram-normal-custom-checklist"></div>
+ </div>
+
+ <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>Custom 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>
- <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> \ No newline at end of file
diff --git a/src/pages/options/instagram/instagram.js b/src/pages/options/instagram/instagram.js
index 9cfb8491..c5ed8058 100644
--- a/src/pages/options/instagram/instagram.js
+++ b/src/pages/options/instagram/instagram.js
@@ -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
+ )
}) \ No newline at end of file
diff --git a/src/pages/options/wikipedia/wikipedia.html b/src/pages/options/wikipedia/wikipedia.html
index 5f844ebc..0e96259b 100644
--- a/src/pages/options/wikipedia/wikipedia.html
+++ b/src/pages/options/wikipedia/wikipedia.html
@@ -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 id="normal">
+ <div class="some-block option-block">
+ <h4>Default Instances</h4>
+ </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>
- <form id="custom-wikiless-normal-instance-form">
+
+ <div id="tor">
<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>
+ <div class="checklist" id="wikiless-tor-checklist">
</div>
- </form>
- <div class="checklist" id="wikiless-normal-custom-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> \ No newline at end of file
diff --git a/src/pages/options/wikipedia/wikipedia.js b/src/pages/options/wikipedia/wikipedia.js
index 29a75f72..92ab8dc5 100644
--- a/src/pages/options/wikipedia/wikipedia.js
+++ b/src/pages/options/wikipedia/wikipedia.js
@@ -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
+ )
}) \ No newline at end of file