commit
20aafaaa17
|
@ -35,6 +35,10 @@
|
||||||
"message": "SimplyTranslate Instance",
|
"message": "SimplyTranslate Instance",
|
||||||
"description": "Label for SimplyTranslate instance field option (options)."
|
"description": "Label for SimplyTranslate instance field option (options)."
|
||||||
},
|
},
|
||||||
|
"wikipediaInstance": {
|
||||||
|
"message": "Wikipedia Instance",
|
||||||
|
"description": "Label for Wikipedia instance field option (options)."
|
||||||
|
},
|
||||||
"disableNitter": {
|
"disableNitter": {
|
||||||
"message": "Nitter Redirects",
|
"message": "Nitter Redirects",
|
||||||
"description": "Label for enable/disable Nitter redirects option (options & pop-up)."
|
"description": "Label for enable/disable Nitter redirects option (options & pop-up)."
|
||||||
|
@ -63,6 +67,10 @@
|
||||||
"message": "SimplyTranslate Redirects",
|
"message": "SimplyTranslate Redirects",
|
||||||
"description": "Label for enable/disable SimplyTranslate redirects option (options & pop-up)."
|
"description": "Label for enable/disable SimplyTranslate redirects option (options & pop-up)."
|
||||||
},
|
},
|
||||||
|
"disableWikipedia": {
|
||||||
|
"message": "Wikipedia Redirects",
|
||||||
|
"description": "Label for enable/disable Wikipedia redirects option (options & pop-up)."
|
||||||
|
},
|
||||||
"alwaysProxy": {
|
"alwaysProxy": {
|
||||||
"message": "Always proxy videos through Invidious",
|
"message": "Always proxy videos through Invidious",
|
||||||
"description": "Label for 'Always proxy videos through Invidious' option (options)."
|
"description": "Label for 'Always proxy videos through Invidious' option (options)."
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
const targets = /wikipedia.org/;
|
||||||
|
|
||||||
|
const redirects = ["https://wikiless.org"];
|
||||||
|
|
||||||
|
export default {
|
||||||
|
targets,
|
||||||
|
redirects,
|
||||||
|
};
|
|
@ -8,6 +8,7 @@ import mapsHelper from "../../assets/javascripts/helpers/google-maps.js";
|
||||||
import redditHelper from "../../assets/javascripts/helpers/reddit.js";
|
import redditHelper from "../../assets/javascripts/helpers/reddit.js";
|
||||||
import searchHelper from "../../assets/javascripts/helpers/google-search.js";
|
import searchHelper from "../../assets/javascripts/helpers/google-search.js";
|
||||||
import googleTranslateHelper from "../../assets/javascripts/helpers/google-translate.js";
|
import googleTranslateHelper from "../../assets/javascripts/helpers/google-translate.js";
|
||||||
|
import wikipediaHelper from "../../assets/javascripts/helpers/wikipedia.js";
|
||||||
|
|
||||||
const nitterInstances = twitterHelper.redirects;
|
const nitterInstances = twitterHelper.redirects;
|
||||||
const twitterDomains = twitterHelper.targets;
|
const twitterDomains = twitterHelper.targets;
|
||||||
|
@ -33,6 +34,9 @@ const searchEngineInstances = searchHelper.redirects;
|
||||||
const simplyTranslateInstances = googleTranslateHelper.redirects;
|
const simplyTranslateInstances = googleTranslateHelper.redirects;
|
||||||
const simplyTranslateDefault = simplyTranslateInstances[0];
|
const simplyTranslateDefault = simplyTranslateInstances[0];
|
||||||
const googleTranslateDomains = googleTranslateHelper.targets;
|
const googleTranslateDomains = googleTranslateHelper.targets;
|
||||||
|
const wikipediaInstances = wikipediaHelper.redirects;
|
||||||
|
const wikipediaDefault = wikipediaInstances[0];
|
||||||
|
const wikipediaRegex = wikipediaHelper.targets;
|
||||||
|
|
||||||
let disableNitter;
|
let disableNitter;
|
||||||
let disableInvidious;
|
let disableInvidious;
|
||||||
|
@ -41,6 +45,7 @@ let disableOsm;
|
||||||
let disableReddit;
|
let disableReddit;
|
||||||
let disableSearchEngine;
|
let disableSearchEngine;
|
||||||
let disableSimplyTranslate;
|
let disableSimplyTranslate;
|
||||||
|
let disableWikipedia;
|
||||||
let nitterInstance;
|
let nitterInstance;
|
||||||
let invidiousInstance;
|
let invidiousInstance;
|
||||||
let bibliogramInstance;
|
let bibliogramInstance;
|
||||||
|
@ -48,6 +53,7 @@ let osmInstance;
|
||||||
let redditInstance;
|
let redditInstance;
|
||||||
let searchEngineInstance;
|
let searchEngineInstance;
|
||||||
let simplyTranslateInstance;
|
let simplyTranslateInstance;
|
||||||
|
let wikipediaInstance;
|
||||||
let alwaysProxy;
|
let alwaysProxy;
|
||||||
let onlyEmbeddedVideo;
|
let onlyEmbeddedVideo;
|
||||||
let videoQuality;
|
let videoQuality;
|
||||||
|
@ -73,6 +79,7 @@ browser.storage.sync.get(
|
||||||
"redditInstance",
|
"redditInstance",
|
||||||
"searchEngineInstance",
|
"searchEngineInstance",
|
||||||
"simplyTranslateInstance",
|
"simplyTranslateInstance",
|
||||||
|
"wikipediaInstance",
|
||||||
"disableNitter",
|
"disableNitter",
|
||||||
"disableInvidious",
|
"disableInvidious",
|
||||||
"disableBibliogram",
|
"disableBibliogram",
|
||||||
|
@ -80,6 +87,7 @@ browser.storage.sync.get(
|
||||||
"disableReddit",
|
"disableReddit",
|
||||||
"disableSearchEngine",
|
"disableSearchEngine",
|
||||||
"disableSimplyTranslate",
|
"disableSimplyTranslate",
|
||||||
|
"disableWikipedia",
|
||||||
"alwaysProxy",
|
"alwaysProxy",
|
||||||
"onlyEmbeddedVideo",
|
"onlyEmbeddedVideo",
|
||||||
"videoQuality",
|
"videoQuality",
|
||||||
|
@ -103,12 +111,14 @@ browser.storage.sync.get(
|
||||||
searchEngineInstance = result.searchEngineInstance;
|
searchEngineInstance = result.searchEngineInstance;
|
||||||
simplyTranslateInstance =
|
simplyTranslateInstance =
|
||||||
result.simplyTranslateInstance || simplyTranslateDefault;
|
result.simplyTranslateInstance || simplyTranslateDefault;
|
||||||
|
wikipediaInstance = result.wikipediaInstance || wikipediaDefault;
|
||||||
disableNitter = result.disableNitter;
|
disableNitter = result.disableNitter;
|
||||||
disableInvidious = result.disableInvidious;
|
disableInvidious = result.disableInvidious;
|
||||||
disableBibliogram = result.disableBibliogram;
|
disableBibliogram = result.disableBibliogram;
|
||||||
disableOsm = result.disableOsm;
|
disableOsm = result.disableOsm;
|
||||||
disableReddit = result.disableReddit;
|
disableReddit = result.disableReddit;
|
||||||
disableSearchEngine = result.disableSearchEngine;
|
disableSearchEngine = result.disableSearchEngine;
|
||||||
|
disableWikipedia = result.disableWikipedia;
|
||||||
disableSimplyTranslate = result.disableSimplyTranslate;
|
disableSimplyTranslate = result.disableSimplyTranslate;
|
||||||
alwaysProxy = result.alwaysProxy;
|
alwaysProxy = result.alwaysProxy;
|
||||||
onlyEmbeddedVideo = result.onlyEmbeddedVideo;
|
onlyEmbeddedVideo = result.onlyEmbeddedVideo;
|
||||||
|
@ -153,6 +163,10 @@ browser.storage.onChanged.addListener((changes) => {
|
||||||
simplyTranslateInstance =
|
simplyTranslateInstance =
|
||||||
changes.simplyTranslateInstance.newValue || simplyTranslateDefault;
|
changes.simplyTranslateInstance.newValue || simplyTranslateDefault;
|
||||||
}
|
}
|
||||||
|
if ("wikipediaInstance" in changes) {
|
||||||
|
wikipediaInstance =
|
||||||
|
changes.wikipediaInstance.newValue || wikipediaDefault;
|
||||||
|
}
|
||||||
if ("redditInstance" in changes) {
|
if ("redditInstance" in changes) {
|
||||||
redditInstance = changes.redditInstance.newValue || redditDefault;
|
redditInstance = changes.redditInstance.newValue || redditDefault;
|
||||||
}
|
}
|
||||||
|
@ -180,6 +194,9 @@ browser.storage.onChanged.addListener((changes) => {
|
||||||
if ("disableSimplyTranslate" in changes) {
|
if ("disableSimplyTranslate" in changes) {
|
||||||
disableSimplyTranslate = changes.disableSimplyTranslate.newValue;
|
disableSimplyTranslate = changes.disableSimplyTranslate.newValue;
|
||||||
}
|
}
|
||||||
|
if ("disableWikipedia" in changes) {
|
||||||
|
disableWikipedia = changes.disableWikipedia.newValue;
|
||||||
|
}
|
||||||
if ("alwaysProxy" in changes) {
|
if ("alwaysProxy" in changes) {
|
||||||
alwaysProxy = changes.alwaysProxy.newValue;
|
alwaysProxy = changes.alwaysProxy.newValue;
|
||||||
}
|
}
|
||||||
|
@ -525,6 +542,42 @@ function redirectGoogleTranslate(url, initiator) {
|
||||||
return `${simplyTranslateInstance}/${url.search}`;
|
return `${simplyTranslateInstance}/${url.search}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function redirectWikipedia(url, initiator) {
|
||||||
|
if (disableWikipedia || isException(url, initiator)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
let GETArguments = [];
|
||||||
|
if (url.search.length > 0) {
|
||||||
|
let search = url.search.substring(1); //get rid of '?'
|
||||||
|
let argstrings = search.split('&');
|
||||||
|
for (let i = 0; i < argstrings.length;i++) {
|
||||||
|
let args = argstrings[i].split('=');
|
||||||
|
GETArguments.push([args[0],args[1]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let link = `${wikipediaInstance}${url.pathname}`;
|
||||||
|
let urlSplit = url.host.split('.');
|
||||||
|
if (urlSplit[0] != "wikipedia" && urlSplit[0] != "www") {
|
||||||
|
if (urlSplit[0] == 'm')
|
||||||
|
GETArguments.push(["mobileaction","toggle_view_mobile"]);
|
||||||
|
else
|
||||||
|
GETArguments.push(["lang",urlSplit[0]]);
|
||||||
|
if (urlSplit[1] == 'm')
|
||||||
|
GETArguments.push(["mobileaction","toggle_view_mobile"]);
|
||||||
|
//wikiless doesn't have mobile view support yet
|
||||||
|
}
|
||||||
|
for (let i = 0; i < GETArguments.length; i++) {
|
||||||
|
link += (i == 0 ? '?' : '&') + GETArguments[i][0] +
|
||||||
|
'=' + GETArguments[i][1];
|
||||||
|
}
|
||||||
|
if (urlSplit[urlSplit.length - 1] == "org" &&
|
||||||
|
urlSplit[urlSplit.length - 2] == "wikipedia")
|
||||||
|
//just in case someone wanted to visit wikipedia.org.foo.bar.net
|
||||||
|
return link;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
browser.webRequest.onBeforeRequest.addListener(
|
browser.webRequest.onBeforeRequest.addListener(
|
||||||
(details) => {
|
(details) => {
|
||||||
const url = new URL(details.url);
|
const url = new URL(details.url);
|
||||||
|
@ -563,6 +616,10 @@ browser.webRequest.onBeforeRequest.addListener(
|
||||||
redirect = {
|
redirect = {
|
||||||
redirectUrl: redirectGoogleTranslate(url, initiator),
|
redirectUrl: redirectGoogleTranslate(url, initiator),
|
||||||
};
|
};
|
||||||
|
} else if (url.host.match(wikipediaRegex)) {
|
||||||
|
redirect = {
|
||||||
|
redirectUrl: redirectWikipedia(url, initiator),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
if (redirect && redirect.redirectUrl) {
|
if (redirect && redirect.redirectUrl) {
|
||||||
console.info(
|
console.info(
|
||||||
|
|
|
@ -183,6 +183,25 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</section>
|
</section>
|
||||||
|
<section class="settings-block">
|
||||||
|
<table class="option" aria-label="Toggle Wikipedia redirects">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<h1 data-localise="__MSG_disableWikipedia__">Wikipedia Redirects</h1>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input
|
||||||
|
aria-hidden="true"
|
||||||
|
id="disable-wikipedia"
|
||||||
|
type="checkbox"
|
||||||
|
/>
|
||||||
|
<label for="disable-wikipedia" class="checkbox-label"></label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
<section class="settings-block">
|
<section class="settings-block">
|
||||||
<h1 data-localise="__MSG_nitterInstance__">Nitter Instance</h1>
|
<h1 data-localise="__MSG_nitterInstance__">Nitter Instance</h1>
|
||||||
<div class="autocomplete">
|
<div class="autocomplete">
|
||||||
|
@ -258,6 +277,16 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
<section class="settings-block">
|
||||||
|
<h1 data-localise="__MSG_wikipediaInstance__">Wikipedia Instance</h1>
|
||||||
|
<div class="autocomplete">
|
||||||
|
<input
|
||||||
|
id="wikipedia-instance"
|
||||||
|
type="url"
|
||||||
|
placeholder="https://wikiless.org"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
<section class="settings-block">
|
<section class="settings-block">
|
||||||
<h1 data-localise="__MSG_theme__">Theme</h1>
|
<h1 data-localise="__MSG_theme__">Theme</h1>
|
||||||
<select id="theme">
|
<select id="theme">
|
||||||
|
|
|
@ -8,6 +8,7 @@ import mapsHelper from "../../assets/javascripts/helpers/google-maps.js";
|
||||||
import redditHelper from "../../assets/javascripts/helpers/reddit.js";
|
import redditHelper from "../../assets/javascripts/helpers/reddit.js";
|
||||||
import searchHelper from "../../assets/javascripts/helpers/google-search.js";
|
import searchHelper from "../../assets/javascripts/helpers/google-search.js";
|
||||||
import googleTranslateHelper from "../../assets/javascripts/helpers/google-translate.js";
|
import googleTranslateHelper from "../../assets/javascripts/helpers/google-translate.js";
|
||||||
|
import wikipediaHelper from "../../assets/javascripts/helpers/wikipedia.js";
|
||||||
|
|
||||||
const nitterInstances = twitterHelper.redirects;
|
const nitterInstances = twitterHelper.redirects;
|
||||||
const invidiousInstances = youtubeHelper.redirects;
|
const invidiousInstances = youtubeHelper.redirects;
|
||||||
|
@ -16,6 +17,7 @@ const osmInstances = mapsHelper.redirects;
|
||||||
const redditInstances = redditHelper.redirects;
|
const redditInstances = redditHelper.redirects;
|
||||||
const searchEngineInstances = searchHelper.redirects;
|
const searchEngineInstances = searchHelper.redirects;
|
||||||
const simplyTranslateInstances = googleTranslateHelper.redirects;
|
const simplyTranslateInstances = googleTranslateHelper.redirects;
|
||||||
|
const wikipediaInstances = wikipediaHelper.redirects;
|
||||||
const autocompletes = [
|
const autocompletes = [
|
||||||
{ id: "nitter-instance", instances: nitterInstances },
|
{ id: "nitter-instance", instances: nitterInstances },
|
||||||
{ id: "invidious-instance", instances: invidiousInstances },
|
{ id: "invidious-instance", instances: invidiousInstances },
|
||||||
|
@ -27,6 +29,7 @@ const autocompletes = [
|
||||||
instances: searchEngineInstances.map((instance) => instance.link),
|
instances: searchEngineInstances.map((instance) => instance.link),
|
||||||
},
|
},
|
||||||
{ id: "simply-translate-instance", instances: simplyTranslateInstances },
|
{ id: "simply-translate-instance", instances: simplyTranslateInstances },
|
||||||
|
{ id: "wikipedia-instance", instances: wikipediaInstances },
|
||||||
];
|
];
|
||||||
const domparser = new DOMParser();
|
const domparser = new DOMParser();
|
||||||
|
|
||||||
|
@ -39,6 +42,7 @@ let searchEngineInstance = document.getElementById("search-engine-instance");
|
||||||
let simplyTranslateInstance = document.getElementById(
|
let simplyTranslateInstance = document.getElementById(
|
||||||
"simply-translate-instance"
|
"simply-translate-instance"
|
||||||
);
|
);
|
||||||
|
let wikipediaInstance = document.getElementById("wikipedia-instance");
|
||||||
let disableNitter = document.getElementById("disable-nitter");
|
let disableNitter = document.getElementById("disable-nitter");
|
||||||
let disableInvidious = document.getElementById("disable-invidious");
|
let disableInvidious = document.getElementById("disable-invidious");
|
||||||
let disableBibliogram = document.getElementById("disable-bibliogram");
|
let disableBibliogram = document.getElementById("disable-bibliogram");
|
||||||
|
@ -48,6 +52,7 @@ let disableSearchEngine = document.getElementById("disable-search-engine");
|
||||||
let disableSimplyTranslate = document.getElementById(
|
let disableSimplyTranslate = document.getElementById(
|
||||||
"disable-simply-translate"
|
"disable-simply-translate"
|
||||||
);
|
);
|
||||||
|
let disableWikipedia = document.getElementById("disable-wikipedia");
|
||||||
let alwaysProxy = document.getElementById("always-proxy");
|
let alwaysProxy = document.getElementById("always-proxy");
|
||||||
let onlyEmbeddedVideo = document.getElementById("only-embed");
|
let onlyEmbeddedVideo = document.getElementById("only-embed");
|
||||||
let videoQuality = document.getElementById("video-quality");
|
let videoQuality = document.getElementById("video-quality");
|
||||||
|
@ -100,6 +105,7 @@ browser.storage.sync.get(
|
||||||
"redditInstance",
|
"redditInstance",
|
||||||
"searchEngineInstance",
|
"searchEngineInstance",
|
||||||
"simplyTranslateInstance",
|
"simplyTranslateInstance",
|
||||||
|
"wikipediaInstance",
|
||||||
"disableNitter",
|
"disableNitter",
|
||||||
"disableInvidious",
|
"disableInvidious",
|
||||||
"disableBibliogram",
|
"disableBibliogram",
|
||||||
|
@ -107,6 +113,7 @@ browser.storage.sync.get(
|
||||||
"disableReddit",
|
"disableReddit",
|
||||||
"disableSearchEngine",
|
"disableSearchEngine",
|
||||||
"disableSimplyTranslate",
|
"disableSimplyTranslate",
|
||||||
|
"disableWikipedia",
|
||||||
"alwaysProxy",
|
"alwaysProxy",
|
||||||
"onlyEmbeddedVideo",
|
"onlyEmbeddedVideo",
|
||||||
"videoQuality",
|
"videoQuality",
|
||||||
|
@ -135,6 +142,7 @@ browser.storage.sync.get(
|
||||||
searchEngineInstance.value =
|
searchEngineInstance.value =
|
||||||
(result.searchEngineInstance && result.searchEngineInstance.link) || "";
|
(result.searchEngineInstance && result.searchEngineInstance.link) || "";
|
||||||
simplyTranslateInstance.value = result.simplyTranslateInstance || "";
|
simplyTranslateInstance.value = result.simplyTranslateInstance || "";
|
||||||
|
wikipediaInstance.value = result.wikipediaInstance || "";
|
||||||
disableNitter.checked = !result.disableNitter;
|
disableNitter.checked = !result.disableNitter;
|
||||||
disableInvidious.checked = !result.disableInvidious;
|
disableInvidious.checked = !result.disableInvidious;
|
||||||
disableBibliogram.checked = !result.disableBibliogram;
|
disableBibliogram.checked = !result.disableBibliogram;
|
||||||
|
@ -142,6 +150,7 @@ browser.storage.sync.get(
|
||||||
disableReddit.checked = !result.disableReddit;
|
disableReddit.checked = !result.disableReddit;
|
||||||
disableSearchEngine.checked = !result.disableSearchEngine;
|
disableSearchEngine.checked = !result.disableSearchEngine;
|
||||||
disableSimplyTranslate.checked = !result.disableSimplyTranslate;
|
disableSimplyTranslate.checked = !result.disableSimplyTranslate;
|
||||||
|
disableWikipedia.checked = !result.disableWikipedia;
|
||||||
alwaysProxy.checked = result.alwaysProxy;
|
alwaysProxy.checked = result.alwaysProxy;
|
||||||
onlyEmbeddedVideo.checked = result.onlyEmbeddedVideo;
|
onlyEmbeddedVideo.checked = result.onlyEmbeddedVideo;
|
||||||
videoQuality.value = result.videoQuality || "";
|
videoQuality.value = result.videoQuality || "";
|
||||||
|
@ -328,6 +337,18 @@ simplyTranslateInstance.addEventListener(
|
||||||
simplyTranslateInstanceChange
|
simplyTranslateInstanceChange
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const wikipediaInstanceChange = debounce(() => {
|
||||||
|
if (wikipediaInstance.checkValidity()) {
|
||||||
|
browser.storage.sync.set({
|
||||||
|
wikipediaInstance: parseURL(wikipediaInstance.value),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
wikipediaInstance.addEventListener(
|
||||||
|
"input",
|
||||||
|
wikipediaInstanceChange
|
||||||
|
);
|
||||||
|
|
||||||
disableNitter.addEventListener("change", (event) => {
|
disableNitter.addEventListener("change", (event) => {
|
||||||
browser.storage.sync.set({ disableNitter: !event.target.checked });
|
browser.storage.sync.set({ disableNitter: !event.target.checked });
|
||||||
});
|
});
|
||||||
|
@ -356,6 +377,10 @@ disableSimplyTranslate.addEventListener("change", (event) => {
|
||||||
browser.storage.sync.set({ disableSimplyTranslate: !event.target.checked });
|
browser.storage.sync.set({ disableSimplyTranslate: !event.target.checked });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
disableWikipedia.addEventListener("change", (event) => {
|
||||||
|
browser.storage.sync.set({ disableWikipedia: !event.target.checked });
|
||||||
|
});
|
||||||
|
|
||||||
alwaysProxy.addEventListener("change", (event) => {
|
alwaysProxy.addEventListener("change", (event) => {
|
||||||
browser.storage.sync.set({ alwaysProxy: event.target.checked });
|
browser.storage.sync.set({ alwaysProxy: event.target.checked });
|
||||||
});
|
});
|
||||||
|
|
|
@ -185,6 +185,31 @@
|
||||||
</table>
|
</table>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section class="settings-block">
|
||||||
|
<table class="option" aria-label="Toggle Wikiepdia redirects">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<h1 data-localise="__MSG_disableWikipedia__">
|
||||||
|
Wikipedia Redirects
|
||||||
|
</h1>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input
|
||||||
|
aria-hidden="true"
|
||||||
|
id="disable-wikipedia"
|
||||||
|
type="checkbox"
|
||||||
|
/>
|
||||||
|
<label
|
||||||
|
for="disable-wikipedia"
|
||||||
|
class="checkbox-label"
|
||||||
|
></label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section class="settings-block"></section>
|
<section class="settings-block"></section>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
|
|
|
@ -7,6 +7,7 @@ let disableOsm = document.querySelector("#disable-osm");
|
||||||
let disableReddit = document.querySelector("#disable-reddit");
|
let disableReddit = document.querySelector("#disable-reddit");
|
||||||
let disableSearchEngine = document.querySelector("#disable-searchEngine");
|
let disableSearchEngine = document.querySelector("#disable-searchEngine");
|
||||||
let disableSimplyTranslate = document.querySelector("#disable-simplyTranslate");
|
let disableSimplyTranslate = document.querySelector("#disable-simplyTranslate");
|
||||||
|
let disableWikipedia = document.querySelector("#disable-wikipedia");
|
||||||
let version = document.querySelector("#version");
|
let version = document.querySelector("#version");
|
||||||
|
|
||||||
window.browser = window.browser || window.chrome;
|
window.browser = window.browser || window.chrome;
|
||||||
|
@ -20,6 +21,7 @@ browser.storage.sync.get(
|
||||||
"disableReddit",
|
"disableReddit",
|
||||||
"disableSearchEngine",
|
"disableSearchEngine",
|
||||||
"disableSimplyTranslate",
|
"disableSimplyTranslate",
|
||||||
|
"disableWikipedia",
|
||||||
"theme",
|
"theme",
|
||||||
],
|
],
|
||||||
(result) => {
|
(result) => {
|
||||||
|
@ -31,6 +33,7 @@ browser.storage.sync.get(
|
||||||
disableReddit.checked = !result.disableReddit;
|
disableReddit.checked = !result.disableReddit;
|
||||||
disableSearchEngine.checked = !result.disableSearchEngine;
|
disableSearchEngine.checked = !result.disableSearchEngine;
|
||||||
disableSimplyTranslate.checked = !result.disableSimplyTranslate;
|
disableSimplyTranslate.checked = !result.disableSimplyTranslate;
|
||||||
|
disableWikipedia.checked = !result.disableWikipedia;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -64,6 +67,10 @@ disableSimplyTranslate.addEventListener("change", (event) => {
|
||||||
browser.storage.sync.set({ disableSimplyTranslate: !event.target.checked });
|
browser.storage.sync.set({ disableSimplyTranslate: !event.target.checked });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
disableWikipedia.addEventListener("change", (event) => {
|
||||||
|
browser.storage.sync.set({ disableWikipedia: !event.target.checked });
|
||||||
|
});
|
||||||
|
|
||||||
document.querySelector("#more-options").addEventListener("click", () => {
|
document.querySelector("#more-options").addEventListener("click", () => {
|
||||||
browser.runtime.openOptionsPage();
|
browser.runtime.openOptionsPage();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue