Added reddit tor support #32
このコミットが含まれているのは:
コミット
0caf899239
@ -52,7 +52,7 @@ Medium => [Scribe](https://sr.ht/~edwardloveall/scribe/)
|
||||
- open `about:config`
|
||||
- set `xpinstall.signatures.required` to `false`
|
||||
- open `about:addons`
|
||||
- click on the settings button below the addon search bar and select install add-on from file
|
||||
- click on the gear shaped `settings` button and select `Install Add-on From File...`
|
||||
- select `libredirect-VERSION.zip` from `web-ext-artifacts` folder
|
||||
|
||||
### Install in Chromium, Brave and Chrome
|
||||
|
@ -7,9 +7,6 @@ import redditHelper from "./reddit.js";
|
||||
import searchHelper from "./search.js";
|
||||
import translateHelper from "./translate.js";
|
||||
import wikipediaHelper from "./wikipedia.js";
|
||||
import mapsHelper from "./maps.js";
|
||||
import medium from "./medium.js";
|
||||
|
||||
|
||||
function getRandomInstance(instances) {
|
||||
return instances[~~(instances.length * Math.random())];
|
||||
|
@ -17,44 +17,29 @@ let redirects = {
|
||||
"normal": [
|
||||
"https://libredd.it",
|
||||
"https://libreddit.spike.codes",
|
||||
"https://libreddit.kavin.rocks",
|
||||
"https://libreddit.insanity.wtf",
|
||||
"https://libreddit.dothq.co",
|
||||
"https://libreddit.kavin.rocks",
|
||||
"https://libreddit.bcow.xyz",
|
||||
"https://libreddit.40two.app",
|
||||
"https://reddit.invak.id",
|
||||
"https://reddit.phii.me",
|
||||
"https://lr.riverside.rocks",
|
||||
"https://libreddit.silkky.cloud",
|
||||
"https://reddit.artemislena.eu",
|
||||
"https://reddit.git-bruh.duckdns.org",
|
||||
"https://libreddit.database.red",
|
||||
"https://libreddit.exonip.de",
|
||||
"https://libreddit.domain.glass",
|
||||
],
|
||||
"tor": [
|
||||
"http://spjmllawtheisznfs7uryhxumin26ssv2draj7oope3ok3wuhy43eoyd.onion",
|
||||
"http://fwhhsbrbltmrct5hshrnqlqygqvcgmnek3cnka55zj4y7nuus5muwyyd.onion",
|
||||
"http://dflv6yjt7il3n3tggf4qhcmkzbti2ppytqx3o7pjrzwgntutpewscyid.onion",
|
||||
"http://kphht2jcflojtqte4b4kyx7p2ahagv4debjj32nre67dxz7y57seqwyd.onion",
|
||||
]
|
||||
},
|
||||
// old UI
|
||||
"teddit": {
|
||||
"normal": [
|
||||
"https://teddit.net",
|
||||
"https://teddit.ggc-project.de",
|
||||
"https://teddit.kavin.rocks",
|
||||
"https://teddit.zaggy.nl",
|
||||
"https://teddit.namazso.eu",
|
||||
"https://teddit.nautolan.racing",
|
||||
"https://teddit.tinfoil-hat.net",
|
||||
"https://teddit.domain.glass",
|
||||
"https://snoo.ioens.is",
|
||||
"https://teddit.httpjames.space",
|
||||
"https://teddit.alefvanoon.xyz",
|
||||
"https://incogsnoo.com",
|
||||
"https://teddit.pussthecat.org",
|
||||
"https://reddit.lol",
|
||||
"https://teddit.sethforprivacy.com",
|
||||
"https://teddit.totaldarkness.net",
|
||||
"https://teddit.adminforge.de",
|
||||
"https://teddit.bus-hit.me"
|
||||
],
|
||||
"tor": [
|
||||
"http://teddit4w6cmzmj5kimhfcavs7yo5s7alszvsi2khqutqtlaanpcftfyd.onion",
|
||||
"http://snoo.ioensistjs7wd746zluwixvojbbkxhr37lepdvwtdfeav673o64iflqd.onion",
|
||||
"http://ibarajztopxnuhabfu7fg6gbudynxofbnmvis3ltj6lfx47b6fhrd5qd.onion",
|
||||
"http://tedditfyn6idalzso5wam5qd3kdtxoljjhbrbbx34q2xkcisvshuytad.onion",
|
||||
"http://dawtyi5e2cfyfmoht4izmczi42aa2zwh6wi34zwvc6rzf2acpxhrcrad.onion",
|
||||
"http://qtpvyiaqhmwccxwzsqubd23xhmmrt75tdyw35kp43w4hvamsgl3x27ad.onion"
|
||||
]
|
||||
"normal": [],
|
||||
"tor": []
|
||||
},
|
||||
"desktop": "https://old.reddit.com", // desktop
|
||||
"mobile": "https://i.reddit.com", // mobile
|
||||
@ -63,10 +48,12 @@ const getRedirects = () => redirects;
|
||||
const getCustomRedirects = function () {
|
||||
return {
|
||||
"libreddit": {
|
||||
"normal": [...libredditNormalRedirectsChecks, ...libredditNormalCustomRedirects]
|
||||
"normal": [...libredditNormalRedirectsChecks, ...libredditNormalCustomRedirects],
|
||||
"tor": [...libredditTorRedirectsChecks, ...libredditTorCustomRedirects]
|
||||
},
|
||||
"teddit": {
|
||||
"normal": [...tedditNormalRedirectsChecks, ...tedditNormalCustomRedirects]
|
||||
"normal": [...tedditNormalRedirectsChecks, ...tedditNormalCustomRedirects],
|
||||
"tor": [...tedditTorRedirectsChecks, ...tedditTorCustomRedirects]
|
||||
}
|
||||
};
|
||||
};
|
||||
@ -81,6 +68,13 @@ function setLibredditRedirects(val) {
|
||||
if (index !== -1) libredditNormalRedirectsChecks.splice(index, 1);
|
||||
}
|
||||
setLibredditNormalRedirectsChecks(libredditNormalRedirectsChecks);
|
||||
|
||||
for (const item of libredditTorRedirectsChecks)
|
||||
if (!redirects.libreddit.normal.includes(item)) {
|
||||
var index = libredditTorRedirectsChecks.indexOf(item);
|
||||
if (index !== -1) libredditTorRedirectsChecks.splice(index, 1);
|
||||
}
|
||||
setLibredditTorRedirectsChecks(libredditTorRedirectsChecks);
|
||||
}
|
||||
|
||||
function setTedditRedirects(val) {
|
||||
@ -93,8 +87,14 @@ function setTedditRedirects(val) {
|
||||
if (index !== -1) tedditNormalRedirectsChecks.splice(index, 1);
|
||||
}
|
||||
setTedditNormalRedirectsChecks(tedditNormalRedirectsChecks);
|
||||
}
|
||||
|
||||
for (const item of tedditTorRedirectsChecks)
|
||||
if (!redirects.teddit.normal.includes(item)) {
|
||||
var index = tedditTorRedirectsChecks.indexOf(item);
|
||||
if (index !== -1) tedditTorRedirectsChecks.splice(index, 1);
|
||||
}
|
||||
setTedditTorRedirectsChecks(tedditTorRedirectsChecks);
|
||||
}
|
||||
|
||||
let libredditNormalRedirectsChecks;
|
||||
const getLibredditNormalRedirectsChecks = () => libredditNormalRedirectsChecks;
|
||||
@ -104,6 +104,14 @@ function setLibredditNormalRedirectsChecks(val) {
|
||||
console.log("libredditNormalRedirectsChecks: ", val)
|
||||
}
|
||||
|
||||
let libredditTorRedirectsChecks;
|
||||
const getLibredditTorRedirectsChecks = () => libredditTorRedirectsChecks;
|
||||
function setLibredditTorRedirectsChecks(val) {
|
||||
libredditTorRedirectsChecks = val;
|
||||
browser.storage.local.set({ libredditTorRedirectsChecks })
|
||||
console.log("libredditTorRedirectsChecks: ", val)
|
||||
}
|
||||
|
||||
let libredditNormalCustomRedirects = [];
|
||||
const getLibredditNormalCustomRedirects = () => libredditNormalCustomRedirects;
|
||||
function setLibredditNormalCustomRedirects(val) {
|
||||
@ -112,6 +120,14 @@ function setLibredditNormalCustomRedirects(val) {
|
||||
console.log("libredditNormalCustomRedirects: ", val)
|
||||
}
|
||||
|
||||
let libredditTorCustomRedirects = [];
|
||||
const getLibredditTorCustomRedirects = () => libredditTorCustomRedirects;
|
||||
function setLibredditTorCustomRedirects(val) {
|
||||
libredditTorCustomRedirects = val;
|
||||
browser.storage.local.set({ libredditTorCustomRedirects })
|
||||
console.log("libredditTorCustomRedirects: ", val)
|
||||
}
|
||||
|
||||
let tedditNormalRedirectsChecks;
|
||||
const getTedditNormalRedirectsChecks = () => tedditNormalRedirectsChecks;
|
||||
function setTedditNormalRedirectsChecks(val) {
|
||||
@ -120,6 +136,14 @@ function setTedditNormalRedirectsChecks(val) {
|
||||
console.log("tedditNormalRedirectsChecks: ", val)
|
||||
}
|
||||
|
||||
let tedditTorRedirectsChecks;
|
||||
const getTedditTorRedirectsChecks = () => tedditTorRedirectsChecks;
|
||||
function setTedditTorRedirectsChecks(val) {
|
||||
tedditTorRedirectsChecks = val;
|
||||
browser.storage.local.set({ tedditTorRedirectsChecks })
|
||||
console.log("tedditTorRedirectsChecks: ", val)
|
||||
}
|
||||
|
||||
let tedditNormalCustomRedirects = [];
|
||||
const getTedditNormalCustomRedirects = () => tedditNormalCustomRedirects;
|
||||
function setTedditNormalCustomRedirects(val) {
|
||||
@ -128,6 +152,14 @@ function setTedditNormalCustomRedirects(val) {
|
||||
console.log("tedditNormalCustomRedirects: ", val)
|
||||
}
|
||||
|
||||
let tedditTorCustomRedirects = [];
|
||||
const getTedditTorCustomRedirects = () => tedditTorCustomRedirects;
|
||||
function setTedditTorCustomRedirects(val) {
|
||||
tedditTorCustomRedirects = val;
|
||||
browser.storage.local.set({ tedditTorCustomRedirects })
|
||||
console.log("tedditTorCustomRedirects: ", val)
|
||||
}
|
||||
|
||||
const bypassPaths = /\/(gallery\/poll\/rpan\/settings\/topics)/;
|
||||
|
||||
let disableReddit;
|
||||
@ -144,6 +176,15 @@ function setRedditFrontend(val) {
|
||||
browser.storage.local.set({ redditFrontend })
|
||||
};
|
||||
|
||||
let protocol;
|
||||
const getprotocol = () => protocol;
|
||||
function setProtocol(val) {
|
||||
protocol = val;
|
||||
browser.storage.local.set({ redditProtocol: val })
|
||||
console.log("redditProtocol: ", val)
|
||||
}
|
||||
|
||||
|
||||
function isReddit(url, initiator) {
|
||||
if (
|
||||
initiator &&
|
||||
@ -161,8 +202,15 @@ function redirect(url, type) {
|
||||
|
||||
if (type !== "main_frame" || url.pathname.match(bypassPaths)) return null;
|
||||
|
||||
let libredditInstancesList = [...libredditNormalRedirectsChecks, ...libredditNormalCustomRedirects];
|
||||
let tedditInstancesList = [...tedditNormalRedirectsChecks, ...tedditNormalCustomRedirects];
|
||||
let libredditInstancesList;
|
||||
let tedditInstancesList;
|
||||
if (protocol == 'normal') {
|
||||
libredditInstancesList = [...libredditNormalRedirectsChecks, ...libredditNormalCustomRedirects];
|
||||
tedditInstancesList = [...tedditNormalRedirectsChecks, ...tedditNormalCustomRedirects];
|
||||
} else if (protocol == 'tor') {
|
||||
libredditInstancesList = [...libredditTorRedirectsChecks, ...libredditTorCustomRedirects];
|
||||
tedditInstancesList = [...tedditTorRedirectsChecks, ...tedditTorCustomRedirects];
|
||||
}
|
||||
|
||||
if (url.host === "i.redd.it") {
|
||||
if (libredditInstancesList.length === 0) return null;
|
||||
@ -207,31 +255,52 @@ function redirect(url, type) {
|
||||
|
||||
async function init() {
|
||||
return new Promise((resolve) => {
|
||||
browser.storage.local.get(
|
||||
[
|
||||
"disableReddit",
|
||||
"redditFrontend",
|
||||
"redditRedirects",
|
||||
"libredditNormalRedirectsChecks",
|
||||
"libredditNormalCustomRedirects",
|
||||
"tedditNormalRedirectsChecks",
|
||||
"tedditNormalCustomRedirects",
|
||||
], (result) => {
|
||||
disableReddit = result.disableReddit ?? false;
|
||||
redditFrontend = result.redditFrontend ?? 'libreddit';
|
||||
if (result.redditRedirects)
|
||||
redirects = result.redditRedirects;
|
||||
fetch('/instances/data.json').then(response => response.text()).then(data => {
|
||||
let dataJson = JSON.parse(data);
|
||||
browser.storage.local.get(
|
||||
[
|
||||
"disableReddit",
|
||||
"redditFrontend",
|
||||
"redditRedirects",
|
||||
|
||||
libredditNormalRedirectsChecks = result.libredditNormalRedirectsChecks ?? [...redirects.libreddit.normal];
|
||||
libredditNormalCustomRedirects = result.libredditNormalCustomRedirects ?? [];
|
||||
"libredditNormalRedirectsChecks",
|
||||
"libredditNormalCustomRedirects",
|
||||
"libredditTorRedirectsChecks",
|
||||
"libredditTorCustomRedirects",
|
||||
|
||||
tedditNormalRedirectsChecks = result.tedditNormalRedirectsChecks ?? [...redirects.teddit.normal];
|
||||
tedditNormalCustomRedirects = result.tedditNormalCustomRedirects ?? [];
|
||||
"tedditNormalRedirectsChecks",
|
||||
"tedditNormalCustomRedirects",
|
||||
"tedditTorRedirectsChecks",
|
||||
"tedditTorCustomRedirects",
|
||||
|
||||
resolve();
|
||||
}
|
||||
)
|
||||
})
|
||||
"redditProtocol",
|
||||
], (result) => {
|
||||
disableReddit = result.disableReddit ?? false;
|
||||
protocol = result.redditProtocol ?? 'normal';
|
||||
redditFrontend = result.redditFrontend ?? 'libreddit';
|
||||
|
||||
redirects.teddit = dataJson.teddit;
|
||||
if (result.redditRedirects) redirects = result.redditRedirects;
|
||||
|
||||
if (result.redditRedirects) redirects = result.redditRedirects;
|
||||
|
||||
libredditNormalRedirectsChecks = result.libredditNormalRedirectsChecks ?? [...redirects.libreddit.normal];
|
||||
libredditNormalCustomRedirects = result.libredditNormalCustomRedirects ?? [];
|
||||
|
||||
libredditTorRedirectsChecks = result.libredditTorRedirectsChecks ?? [...redirects.libreddit.tor];
|
||||
libredditTorCustomRedirects = result.libredditTorCustomRedirects ?? [];
|
||||
|
||||
tedditNormalRedirectsChecks = result.tedditNormalRedirectsChecks ?? [...redirects.teddit.normal];
|
||||
tedditNormalCustomRedirects = result.tedditNormalCustomRedirects ?? [];
|
||||
|
||||
tedditTorRedirectsChecks = result.tedditTorRedirectsChecks ?? [...redirects.teddit.tor];
|
||||
tedditTorCustomRedirects = result.tedditTorCustomRedirects ?? [];
|
||||
|
||||
resolve();
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export default {
|
||||
@ -247,17 +316,28 @@ export default {
|
||||
getRedditFrontend,
|
||||
setRedditFrontend,
|
||||
|
||||
getprotocol,
|
||||
setProtocol,
|
||||
|
||||
getLibredditNormalRedirectsChecks,
|
||||
setLibredditNormalRedirectsChecks,
|
||||
getLibredditTorRedirectsChecks,
|
||||
setLibredditTorRedirectsChecks,
|
||||
|
||||
getLibredditNormalCustomRedirects,
|
||||
setLibredditNormalCustomRedirects,
|
||||
getLibredditTorCustomRedirects,
|
||||
setLibredditTorCustomRedirects,
|
||||
|
||||
getTedditNormalRedirectsChecks,
|
||||
setTedditNormalRedirectsChecks,
|
||||
getTedditTorRedirectsChecks,
|
||||
setTedditTorRedirectsChecks,
|
||||
|
||||
getTedditNormalCustomRedirects,
|
||||
setTedditNormalCustomRedirects,
|
||||
getTedditTorCustomRedirects,
|
||||
setTedditTorCustomRedirects,
|
||||
|
||||
redirect,
|
||||
isReddit,
|
||||
|
@ -153,7 +153,7 @@ function setProtocol(val) {
|
||||
console.log("searchProtocol: ", val)
|
||||
}
|
||||
|
||||
function isSearch(url, initiator) {
|
||||
function isSearch(url) {
|
||||
if (disable) return false;
|
||||
return targets.some((rx) => rx.test(url.href));
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ browser.webRequest.onBeforeRequest.addListener(
|
||||
|
||||
else if (translateHelper.isTranslate(url, initiator)) newUrl = translateHelper.redirect(url);
|
||||
|
||||
else if (searchHelper.isSearch(url, initiator)) newUrl = searchHelper.redirect(url)
|
||||
else if (searchHelper.isSearch(url)) newUrl = searchHelper.redirect(url)
|
||||
|
||||
else if (wikipediaHelper.isWikipedia(url, initiator)) newUrl = wikipediaHelper.redirect(url);
|
||||
|
||||
|
@ -2,190 +2,247 @@
|
||||
<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: Reddit</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: Reddit</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">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" class="selected">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">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" class="selected">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-reddit" type="checkbox" checked />
|
||||
</div>
|
||||
|
||||
<div class="some-block option-block">
|
||||
<h4>Frontend</h4>
|
||||
<select id="reddit-frontend">
|
||||
<option value="libreddit">Libreddit</option>
|
||||
<option value="teddit">Teddit</option>
|
||||
</select>
|
||||
</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="libreddit">
|
||||
|
||||
<div id="libreddit-normal">
|
||||
<div class="some-block option-block">
|
||||
<h4>Enable</h4>
|
||||
<input id="disable-reddit" type="checkbox" checked />
|
||||
<h4>Default Instances</h4>
|
||||
</div>
|
||||
|
||||
<!-- <div class="some-block option-block">
|
||||
<h4>Instance</h4>
|
||||
<div class="autocomplete">
|
||||
<input id="reddit-instance" type="url" placeholder="https://libredd.it" />
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="some-block option-block">
|
||||
<h4>Frontend</h4>
|
||||
<select id="reddit-frontend">
|
||||
<option value="libreddit">Libreddit</option>
|
||||
<option value="teddit">Teddit</option>
|
||||
</select>
|
||||
<div class="checklist" id="libreddit-normal-checklist">
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div id="libreddit">
|
||||
<div class="some-block option-block">
|
||||
<h4>Default Instances</h4>
|
||||
</div>
|
||||
<div class="checklist" id="libreddit-normal-checklist">
|
||||
</div>
|
||||
<hr>
|
||||
<div class="some-block option-block">
|
||||
<h4>Custom Instances</h4>
|
||||
</div>
|
||||
<form id="custom-libreddit-normal-instance-form">
|
||||
<div class="some-block option-block">
|
||||
<input id="libreddit-normal-custom-instance" placeholder="https://libreddit.com" type="url" />
|
||||
<button type="submit" class="add" id="libreddit-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="libreddit-normal-custom-checklist"></div>
|
||||
<div class="some-block option-block">
|
||||
<h4>Custom Instances</h4>
|
||||
</div>
|
||||
<form id="custom-libreddit-normal-instance-form">
|
||||
<div class="some-block option-block">
|
||||
<input id="libreddit-normal-custom-instance" placeholder="https://libreddit.com" type="url" />
|
||||
<button type="submit" class="add" id="libreddit-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="libreddit-normal-custom-checklist"></div>
|
||||
</div>
|
||||
|
||||
<div id="teddit">
|
||||
<div class="some-block option-block">
|
||||
<h4>Default Instances</h4>
|
||||
</div>
|
||||
<div class="checklist" id="teddit-normal-checklist">
|
||||
</div>
|
||||
<hr>
|
||||
<div class="some-block option-block">
|
||||
<h4>Custom Instances</h4>
|
||||
</div>
|
||||
<form id="custom-teddit-normal-instance-form">
|
||||
<div class="some-block option-block">
|
||||
<input id="teddit-normal-custom-instance" placeholder="https://teddit.com" type="url" />
|
||||
<button type="submit" class="add" id="teddit-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="teddit-normal-custom-checklist"></div>
|
||||
<div id="libreddit-tor">
|
||||
<div class="some-block option-block">
|
||||
<h4>Default Instances</h4>
|
||||
</div>
|
||||
</section>
|
||||
<div class="checklist" id="libreddit-tor-checklist">
|
||||
</div>
|
||||
<hr>
|
||||
<div class="some-block option-block">
|
||||
<h4>Custom Instances</h4>
|
||||
</div>
|
||||
<form id="custom-libreddit-tor-instance-form">
|
||||
<div class="some-block option-block">
|
||||
<input id="libreddit-tor-custom-instance" placeholder="https://libreddit.com" type="url" />
|
||||
<button type="submit" class="add" id="libreddit-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="libreddit-tor-custom-checklist"></div>
|
||||
</div>
|
||||
|
||||
<script type="module" src="../init.js"></script>
|
||||
<script type="module" src="./reddit.js"></script>
|
||||
<!-- <script src="../../assets/javascripts/localise.js"></script> -->
|
||||
</div>
|
||||
|
||||
<div id="teddit">
|
||||
|
||||
<div id="teddit-normal">
|
||||
<div class="some-block option-block">
|
||||
<h4>Default Instances</h4>
|
||||
</div>
|
||||
<div class="checklist" id="teddit-normal-checklist">
|
||||
</div>
|
||||
<hr>
|
||||
<div class="some-block option-block">
|
||||
<h4>Custom Instances</h4>
|
||||
</div>
|
||||
<form id="custom-teddit-normal-instance-form">
|
||||
<div class="some-block option-block">
|
||||
<input id="teddit-normal-custom-instance" placeholder="https://teddit.com" type="url" />
|
||||
<button type="submit" class="add" id="teddit-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="teddit-normal-custom-checklist"></div>
|
||||
</div>
|
||||
<div id="teddit-tor">
|
||||
<div class="some-block option-block">
|
||||
<h4>Default Instances</h4>
|
||||
</div>
|
||||
<div class="checklist" id="teddit-tor-checklist">
|
||||
</div>
|
||||
<hr>
|
||||
<div class="some-block option-block">
|
||||
<h4>Custom Instances</h4>
|
||||
</div>
|
||||
<form id="custom-teddit-tor-instance-form">
|
||||
<div class="some-block option-block">
|
||||
<input id="teddit-tor-custom-instance" placeholder="https://teddit.com" type="url" />
|
||||
<button type="submit" class="add" id="teddit-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="teddit-tor-custom-checklist"></div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script type="module" src="../init.js"></script>
|
||||
<script type="module" src="./reddit.js"></script>
|
||||
<!-- <script src="../../assets/javascripts/localise.js"></script> -->
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
@ -28,6 +28,36 @@ redditFrontendElement.addEventListener("change",
|
||||
}
|
||||
);
|
||||
|
||||
let protocolElement = document.getElementById("protocol")
|
||||
protocolElement.addEventListener("change",
|
||||
(event) => {
|
||||
let protocol = event.target.options[protocolElement.selectedIndex].value
|
||||
redditHelper.setProtocol(protocol);
|
||||
changeProtocolSettings(protocol);
|
||||
}
|
||||
);
|
||||
|
||||
function changeProtocolSettings(protocol) {
|
||||
let normalLibredditDiv = document.getElementById("libreddit-normal");
|
||||
let torLibredditDiv = document.getElementById("libreddit-tor");
|
||||
|
||||
let normalTedditDiv = document.getElementById("teddit-normal");
|
||||
let torTedditDiv = document.getElementById("teddit-tor");
|
||||
if (protocol == 'normal') {
|
||||
normalLibredditDiv.style.display = 'block';
|
||||
normalTedditDiv.style.display = 'block';
|
||||
torTedditDiv.style.display = 'none';
|
||||
torLibredditDiv.style.display = 'none';
|
||||
}
|
||||
else if (protocol == 'tor') {
|
||||
normalLibredditDiv.style.display = 'none';
|
||||
normalTedditDiv.style.display = 'none';
|
||||
torTedditDiv.style.display = 'block';
|
||||
torLibredditDiv.style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
redditHelper.init().then(() => {
|
||||
disableRedditElement.checked = !redditHelper.getDisableReddit();
|
||||
|
||||
@ -35,6 +65,10 @@ redditHelper.init().then(() => {
|
||||
redditFrontendElement.value = frontend;
|
||||
changeFrontendsSettings(frontend);
|
||||
|
||||
let protocol = redditHelper.getprotocol();
|
||||
protocolElement.value = protocol;
|
||||
changeProtocolSettings(protocol);
|
||||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'libreddit',
|
||||
'normal',
|
||||
@ -46,6 +80,17 @@ redditHelper.init().then(() => {
|
||||
redditHelper.setLibredditNormalCustomRedirects
|
||||
)
|
||||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'libreddit',
|
||||
'tor',
|
||||
redditHelper,
|
||||
document,
|
||||
redditHelper.getLibredditTorRedirectsChecks,
|
||||
redditHelper.setLibredditTorRedirectsChecks,
|
||||
redditHelper.getLibredditTorCustomRedirects,
|
||||
redditHelper.setLibredditTorCustomRedirects
|
||||
)
|
||||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'teddit',
|
||||
'normal',
|
||||
@ -57,4 +102,15 @@ redditHelper.init().then(() => {
|
||||
redditHelper.setTedditNormalCustomRedirects
|
||||
);
|
||||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'teddit',
|
||||
'tor',
|
||||
redditHelper,
|
||||
document,
|
||||
redditHelper.getTedditTorRedirectsChecks,
|
||||
redditHelper.setTedditTorRedirectsChecks,
|
||||
redditHelper.getTedditTorCustomRedirects,
|
||||
redditHelper.setTedditTorCustomRedirects
|
||||
);
|
||||
|
||||
})
|
読み込み中…
新しいイシューから参照
ユーザーをブロックする