Add SimplyTranslate support
This commit is contained in:
parent
a76ea4f66e
commit
2bb90f8f41
|
@ -31,6 +31,10 @@
|
||||||
"message": "Search Engine Instance",
|
"message": "Search Engine Instance",
|
||||||
"description": "Label for Search Engine instance field option (options)."
|
"description": "Label for Search Engine instance field option (options)."
|
||||||
},
|
},
|
||||||
|
"simplyTranslateInstance": {
|
||||||
|
"message": "SimplyTranslate Instance",
|
||||||
|
"description": "Label for SimplyTranslate 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)."
|
||||||
|
@ -55,6 +59,10 @@
|
||||||
"message": "Search Engine Redirects",
|
"message": "Search Engine Redirects",
|
||||||
"description": "Label for enable/disable Search Engine redirects option (options & pop-up)."
|
"description": "Label for enable/disable Search Engine redirects option (options & pop-up)."
|
||||||
},
|
},
|
||||||
|
"disableSimplyTranslate": {
|
||||||
|
"message": "SimplyTranslate Redirects",
|
||||||
|
"description": "Label for enable/disable SimplyTranslate 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,12 @@
|
||||||
|
const targets = [
|
||||||
|
"translate.google.com"
|
||||||
|
];
|
||||||
|
|
||||||
|
const redirects = [
|
||||||
|
"https://translate.metalune.xyz"
|
||||||
|
];
|
||||||
|
|
||||||
|
export default {
|
||||||
|
targets,
|
||||||
|
redirects,
|
||||||
|
}
|
|
@ -7,6 +7,7 @@ import instagramHelper from "../../assets/javascripts/helpers/instagram.js";
|
||||||
import mapsHelper from "../../assets/javascripts/helpers/google-maps.js";
|
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";
|
||||||
|
|
||||||
const nitterInstances = twitterHelper.redirects;
|
const nitterInstances = twitterHelper.redirects;
|
||||||
const twitterDomains = twitterHelper.targets;
|
const twitterDomains = twitterHelper.targets;
|
||||||
|
@ -29,6 +30,9 @@ const redditBypassPaths = redditHelper.bypassPaths;
|
||||||
const redditDefault = redditHelper.redirects[0];
|
const redditDefault = redditHelper.redirects[0];
|
||||||
const googleSearchRegex = searchHelper.targets;
|
const googleSearchRegex = searchHelper.targets;
|
||||||
const searchEngineInstances = searchHelper.redirects;
|
const searchEngineInstances = searchHelper.redirects;
|
||||||
|
const simplyTranslateInstances = googleTranslateHelper.redirects;
|
||||||
|
const simplyTranslateDefault = simplyTranslateInstances[0];
|
||||||
|
const googleTranslateDomains = googleTranslateHelper.targets;
|
||||||
|
|
||||||
let disableNitter;
|
let disableNitter;
|
||||||
let disableInvidious;
|
let disableInvidious;
|
||||||
|
@ -36,12 +40,14 @@ let disableBibliogram;
|
||||||
let disableOsm;
|
let disableOsm;
|
||||||
let disableReddit;
|
let disableReddit;
|
||||||
let disableSearchEngine;
|
let disableSearchEngine;
|
||||||
|
let disableSimplyTranslate;
|
||||||
let nitterInstance;
|
let nitterInstance;
|
||||||
let invidiousInstance;
|
let invidiousInstance;
|
||||||
let bibliogramInstance;
|
let bibliogramInstance;
|
||||||
let osmInstance;
|
let osmInstance;
|
||||||
let redditInstance;
|
let redditInstance;
|
||||||
let searchEngineInstance;
|
let searchEngineInstance;
|
||||||
|
let simplyTranslateInstance;
|
||||||
let alwaysProxy;
|
let alwaysProxy;
|
||||||
let onlyEmbeddedVideo;
|
let onlyEmbeddedVideo;
|
||||||
let videoQuality;
|
let videoQuality;
|
||||||
|
@ -66,12 +72,14 @@ browser.storage.sync.get(
|
||||||
"osmInstance",
|
"osmInstance",
|
||||||
"redditInstance",
|
"redditInstance",
|
||||||
"searchEngineInstance",
|
"searchEngineInstance",
|
||||||
|
"simplyTranslateInstance",
|
||||||
"disableNitter",
|
"disableNitter",
|
||||||
"disableInvidious",
|
"disableInvidious",
|
||||||
"disableBibliogram",
|
"disableBibliogram",
|
||||||
"disableOsm",
|
"disableOsm",
|
||||||
"disableReddit",
|
"disableReddit",
|
||||||
"disableSearchEngine",
|
"disableSearchEngine",
|
||||||
|
"disableSimplyTranslate",
|
||||||
"alwaysProxy",
|
"alwaysProxy",
|
||||||
"onlyEmbeddedVideo",
|
"onlyEmbeddedVideo",
|
||||||
"videoQuality",
|
"videoQuality",
|
||||||
|
@ -93,12 +101,14 @@ browser.storage.sync.get(
|
||||||
osmInstance = result.osmInstance || osmDefault;
|
osmInstance = result.osmInstance || osmDefault;
|
||||||
redditInstance = result.redditInstance || redditDefault;
|
redditInstance = result.redditInstance || redditDefault;
|
||||||
searchEngineInstance = result.searchEngineInstance;
|
searchEngineInstance = result.searchEngineInstance;
|
||||||
|
simplyTranslateInstance = result.simplyTranslateInstance || simplyTranslateDefault;
|
||||||
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;
|
||||||
|
disableSimplyTranslate = result.disableSimplyTranslate;
|
||||||
alwaysProxy = result.alwaysProxy;
|
alwaysProxy = result.alwaysProxy;
|
||||||
onlyEmbeddedVideo = result.onlyEmbeddedVideo;
|
onlyEmbeddedVideo = result.onlyEmbeddedVideo;
|
||||||
videoQuality = result.videoQuality;
|
videoQuality = result.videoQuality;
|
||||||
|
@ -138,6 +148,9 @@ browser.storage.onChanged.addListener((changes) => {
|
||||||
if ("osmInstance" in changes) {
|
if ("osmInstance" in changes) {
|
||||||
osmInstance = changes.osmInstance.newValue || osmDefault;
|
osmInstance = changes.osmInstance.newValue || osmDefault;
|
||||||
}
|
}
|
||||||
|
if ("simplyTranslateInstance" in changes) {
|
||||||
|
simplyTranslateInstance = changes.simplyTranslateInstance.newValue || simplyTranslateDefault;
|
||||||
|
}
|
||||||
if ("redditInstance" in changes) {
|
if ("redditInstance" in changes) {
|
||||||
redditInstance = changes.redditInstance.newValue || redditDefault;
|
redditInstance = changes.redditInstance.newValue || redditDefault;
|
||||||
}
|
}
|
||||||
|
@ -162,6 +175,9 @@ browser.storage.onChanged.addListener((changes) => {
|
||||||
if ("disableSearchEngine" in changes) {
|
if ("disableSearchEngine" in changes) {
|
||||||
disableSearchEngine = changes.disableSearchEngine.newValue;
|
disableSearchEngine = changes.disableSearchEngine.newValue;
|
||||||
}
|
}
|
||||||
|
if ("disableSimplyTranslate" in changes) {
|
||||||
|
disableSimplyTranslate = changes.disableSimplyTranslate.newValue;
|
||||||
|
}
|
||||||
if ("alwaysProxy" in changes) {
|
if ("alwaysProxy" in changes) {
|
||||||
alwaysProxy = changes.alwaysProxy.newValue;
|
alwaysProxy = changes.alwaysProxy.newValue;
|
||||||
}
|
}
|
||||||
|
@ -469,6 +485,14 @@ function redirectSearchEngine(url, initiator) {
|
||||||
return `${searchEngine.link}${searchEngine.q}?${search}`;
|
return `${searchEngine.link}${searchEngine.q}?${search}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function redirectGoogleTranslate(url, initiator) {
|
||||||
|
if (disableSimplyTranslate || isException(url, initiator)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${simplyTranslateInstance}/${url.search}`;
|
||||||
|
}
|
||||||
|
|
||||||
browser.webRequest.onBeforeRequest.addListener(
|
browser.webRequest.onBeforeRequest.addListener(
|
||||||
(details) => {
|
(details) => {
|
||||||
const url = new URL(details.url);
|
const url = new URL(details.url);
|
||||||
|
@ -506,6 +530,10 @@ browser.webRequest.onBeforeRequest.addListener(
|
||||||
redirect = {
|
redirect = {
|
||||||
redirectUrl: redirectSearchEngine(url, initiator),
|
redirectUrl: redirectSearchEngine(url, initiator),
|
||||||
};
|
};
|
||||||
|
} else if (googleTranslateDomains.includes(url.host)) {
|
||||||
|
redirect = {
|
||||||
|
redirectUrl: redirectGoogleTranslate(url, initiator),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (redirect && redirect.redirectUrl) {
|
if (redirect && redirect.redirectUrl) {
|
||||||
console.info(
|
console.info(
|
||||||
|
|
|
@ -164,6 +164,26 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</section>
|
</section>
|
||||||
|
<section class="settings-block">
|
||||||
|
<table class="option" aria-label="Toggle SimplyTranslate redirects">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<h1 data-localise="__MSG_disableSimplyTranslate__" class="new-badge" data-new-badge>SimplyTranslate Redirects</h1>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input
|
||||||
|
aria-hidden="true"
|
||||||
|
id="disable-simply-translate"
|
||||||
|
type="checkbox"
|
||||||
|
checked
|
||||||
|
/>
|
||||||
|
<label for="disable-simply-translate" 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">
|
||||||
|
@ -229,6 +249,16 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
<section class="settings-block">
|
||||||
|
<h1 data-localise="__MSG_simplyTranslateInstance__">SimplyTranslate Instance</h1>
|
||||||
|
<div class="autocomplete">
|
||||||
|
<input
|
||||||
|
id="simply-translate-instance"
|
||||||
|
type="url"
|
||||||
|
placeholder="https://translate.metalune.xyz"
|
||||||
|
/>
|
||||||
|
</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">
|
||||||
|
|
|
@ -7,6 +7,7 @@ import instagramHelper from "../../assets/javascripts/helpers/instagram.js";
|
||||||
import mapsHelper from "../../assets/javascripts/helpers/google-maps.js";
|
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";
|
||||||
|
|
||||||
const nitterInstances = twitterHelper.redirects;
|
const nitterInstances = twitterHelper.redirects;
|
||||||
const invidiousInstances = youtubeHelper.redirects;
|
const invidiousInstances = youtubeHelper.redirects;
|
||||||
|
@ -14,6 +15,7 @@ const bibliogramInstances = instagramHelper.redirects;
|
||||||
const osmInstances = mapsHelper.redirects;
|
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 autocompletes = [
|
const autocompletes = [
|
||||||
{ id: "nitter-instance", instances: nitterInstances },
|
{ id: "nitter-instance", instances: nitterInstances },
|
||||||
{ id: "invidious-instance", instances: invidiousInstances },
|
{ id: "invidious-instance", instances: invidiousInstances },
|
||||||
|
@ -24,6 +26,7 @@ const autocompletes = [
|
||||||
id: "search-engine-instance",
|
id: "search-engine-instance",
|
||||||
instances: searchEngineInstances.map((instance) => instance.link),
|
instances: searchEngineInstances.map((instance) => instance.link),
|
||||||
},
|
},
|
||||||
|
{ id: "simply-translate-instance", instances: simplyTranslateInstances },
|
||||||
];
|
];
|
||||||
const domparser = new DOMParser();
|
const domparser = new DOMParser();
|
||||||
|
|
||||||
|
@ -33,12 +36,14 @@ let bibliogramInstance = document.getElementById("bibliogram-instance");
|
||||||
let osmInstance = document.getElementById("osm-instance");
|
let osmInstance = document.getElementById("osm-instance");
|
||||||
let redditInstance = document.getElementById("reddit-instance");
|
let redditInstance = document.getElementById("reddit-instance");
|
||||||
let searchEngineInstance = document.getElementById("search-engine-instance");
|
let searchEngineInstance = document.getElementById("search-engine-instance");
|
||||||
|
let simplyTranslateInstance = document.getElementById("simply-translate-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");
|
||||||
let disableOsm = document.getElementById("disable-osm");
|
let disableOsm = document.getElementById("disable-osm");
|
||||||
let disableReddit = document.getElementById("disable-reddit");
|
let disableReddit = document.getElementById("disable-reddit");
|
||||||
let disableSearchEngine = document.getElementById("disable-search-engine");
|
let disableSearchEngine = document.getElementById("disable-search-engine");
|
||||||
|
let disableSimplyTranslate = document.getElementById("disable-simply-translate");
|
||||||
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");
|
||||||
|
@ -90,12 +95,14 @@ browser.storage.sync.get(
|
||||||
"osmInstance",
|
"osmInstance",
|
||||||
"redditInstance",
|
"redditInstance",
|
||||||
"searchEngineInstance",
|
"searchEngineInstance",
|
||||||
|
"simplyTranslateInstance",
|
||||||
"disableNitter",
|
"disableNitter",
|
||||||
"disableInvidious",
|
"disableInvidious",
|
||||||
"disableBibliogram",
|
"disableBibliogram",
|
||||||
"disableOsm",
|
"disableOsm",
|
||||||
"disableReddit",
|
"disableReddit",
|
||||||
"disableSearchEngine",
|
"disableSearchEngine",
|
||||||
|
"disableSimplyTranslate",
|
||||||
"alwaysProxy",
|
"alwaysProxy",
|
||||||
"onlyEmbeddedVideo",
|
"onlyEmbeddedVideo",
|
||||||
"videoQuality",
|
"videoQuality",
|
||||||
|
@ -123,12 +130,14 @@ browser.storage.sync.get(
|
||||||
redditInstance.value = result.redditInstance || "";
|
redditInstance.value = result.redditInstance || "";
|
||||||
searchEngineInstance.value =
|
searchEngineInstance.value =
|
||||||
(result.searchEngineInstance && result.searchEngineInstance.link) || "";
|
(result.searchEngineInstance && result.searchEngineInstance.link) || "";
|
||||||
|
simplyTranslateInstance.value = result.simplyTranslateInstance || "";
|
||||||
disableNitter.checked = !result.disableNitter;
|
disableNitter.checked = !result.disableNitter;
|
||||||
disableInvidious.checked = !result.disableInvidious;
|
disableInvidious.checked = !result.disableInvidious;
|
||||||
disableBibliogram.checked = !result.disableBibliogram;
|
disableBibliogram.checked = !result.disableBibliogram;
|
||||||
disableOsm.checked = !result.disableOsm;
|
disableOsm.checked = !result.disableOsm;
|
||||||
disableReddit.checked = !result.disableReddit;
|
disableReddit.checked = !result.disableReddit;
|
||||||
disableSearchEngine.checked = !result.disableSearchEngine;
|
disableSearchEngine.checked = !result.disableSearchEngine;
|
||||||
|
disableSimplyTranslate.checked = !result.disableSimplyTranslate;
|
||||||
alwaysProxy.checked = result.alwaysProxy;
|
alwaysProxy.checked = result.alwaysProxy;
|
||||||
onlyEmbeddedVideo.checked = result.onlyEmbeddedVideo;
|
onlyEmbeddedVideo.checked = result.onlyEmbeddedVideo;
|
||||||
videoQuality.value = result.videoQuality || "";
|
videoQuality.value = result.videoQuality || "";
|
||||||
|
@ -303,6 +312,15 @@ const searchEngineInstanceChange = debounce(() => {
|
||||||
}, 500);
|
}, 500);
|
||||||
searchEngineInstance.addEventListener("input", searchEngineInstanceChange);
|
searchEngineInstance.addEventListener("input", searchEngineInstanceChange);
|
||||||
|
|
||||||
|
const simplyTranslateInstanceChange = debounce(() => {
|
||||||
|
if (simplyTranslateInstance.checkValidity()) {
|
||||||
|
browser.storage.sync.set({
|
||||||
|
simplyTranslateInstance: parseURL(simplyTranslateInstance.value),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
simplyTranslateInstance.addEventListener("input", simplyTranslateInstanceChange);
|
||||||
|
|
||||||
disableNitter.addEventListener("change", (event) => {
|
disableNitter.addEventListener("change", (event) => {
|
||||||
browser.storage.sync.set({ disableNitter: !event.target.checked });
|
browser.storage.sync.set({ disableNitter: !event.target.checked });
|
||||||
});
|
});
|
||||||
|
@ -327,6 +345,10 @@ disableSearchEngine.addEventListener("change", (event) => {
|
||||||
browser.storage.sync.set({ disableSearchEngine: !event.target.checked });
|
browser.storage.sync.set({ disableSearchEngine: !event.target.checked });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
disableSimplyTranslate.addEventListener("change", (event) => {
|
||||||
|
browser.storage.sync.set({ disableSimplyTranslate: !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 });
|
||||||
});
|
});
|
||||||
|
|
|
@ -164,6 +164,33 @@
|
||||||
</table>
|
</table>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section class="settings-block">
|
||||||
|
<table class="option" aria-label="Toggle SimplyTranslate redirects">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<h1
|
||||||
|
data-localise="__MSG_disableSimplyTranslate__"
|
||||||
|
class="new-badge"
|
||||||
|
data-new-badge
|
||||||
|
>
|
||||||
|
SimplyTranslate Redirects
|
||||||
|
</h1>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input
|
||||||
|
aria-hidden="true"
|
||||||
|
id="disable-simplyTranslate"
|
||||||
|
type="checkbox"
|
||||||
|
checked
|
||||||
|
/>
|
||||||
|
<label for="disable-simplyTranslate" class="checkbox-label"></label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section class="settings-block"></section>
|
<section class="settings-block"></section>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
|
|
|
@ -6,6 +6,7 @@ let disableBibliogram = document.querySelector("#disable-bibliogram");
|
||||||
let disableOsm = document.querySelector("#disable-osm");
|
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 version = document.querySelector("#version");
|
let version = document.querySelector("#version");
|
||||||
|
|
||||||
window.browser = window.browser || window.chrome;
|
window.browser = window.browser || window.chrome;
|
||||||
|
@ -18,6 +19,7 @@ browser.storage.sync.get(
|
||||||
"disableOsm",
|
"disableOsm",
|
||||||
"disableReddit",
|
"disableReddit",
|
||||||
"disableSearchEngine",
|
"disableSearchEngine",
|
||||||
|
"disableSimplyTranslate",
|
||||||
"theme",
|
"theme",
|
||||||
],
|
],
|
||||||
(result) => {
|
(result) => {
|
||||||
|
@ -28,6 +30,7 @@ browser.storage.sync.get(
|
||||||
disableOsm.checked = !result.disableOsm;
|
disableOsm.checked = !result.disableOsm;
|
||||||
disableReddit.checked = !result.disableReddit;
|
disableReddit.checked = !result.disableReddit;
|
||||||
disableSearchEngine.checked = !result.disableSearchEngine;
|
disableSearchEngine.checked = !result.disableSearchEngine;
|
||||||
|
disableSimplyTranslate.checked = !result.disableSimplyTranslate;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -57,6 +60,10 @@ disableSearchEngine.addEventListener("change", (event) => {
|
||||||
browser.storage.sync.set({ disableSearchEngine: !event.target.checked });
|
browser.storage.sync.set({ disableSearchEngine: !event.target.checked });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
disableSimplyTranslate.addEventListener("change", (event) => {
|
||||||
|
browser.storage.sync.set({ disableSimplyTranslate: !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