From c5a6623e0f320b2a789e0d2667ccfe2e1bd4335f Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Mon, 30 May 2022 01:02:59 +0300 Subject: Fixed settings theme and translation flashing #286 --- src/pages/options/search/search.html | 309 ----------------------------------- src/pages/options/search/search.js | 142 ---------------- src/pages/options/search/search.pug | 78 --------- 3 files changed, 529 deletions(-) delete mode 100644 src/pages/options/search/search.html delete mode 100644 src/pages/options/search/search.js delete mode 100644 src/pages/options/search/search.pug (limited to 'src/pages/options/search') diff --git a/src/pages/options/search/search.html b/src/pages/options/search/search.html deleted file mode 100644 index e7107d7b..00000000 --- a/src/pages/options/search/search.html +++ /dev/null @@ -1,309 +0,0 @@ - - - - - - - - Search - - - - - -
-
-

Search

-
-
-
-

Enable

- -
-
-

Frontend

- -
-
-
-

Protocol

- -
-
-
-

Note: To use Search to its full potential, make LibRedirect as the Default Search Engine

-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
- - -
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
- - -
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
- - -
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
- - - \ No newline at end of file diff --git a/src/pages/options/search/search.js b/src/pages/options/search/search.js deleted file mode 100644 index fb928055..00000000 --- a/src/pages/options/search/search.js +++ /dev/null @@ -1,142 +0,0 @@ -import searchHelper from "../../../assets/javascripts/helpers/search.js"; -import utils from "../../../assets/javascripts/helpers/utils.js"; - -let searxDiv = document.getElementById("searx"); -let searxngDiv = document.getElementById("searxng"); -let whoogleDiv = document.getElementById("whoogle"); - -let disable = document.getElementById("disable-search"); -let frontend = document.getElementById("search-frontend"); -let protocol = document.getElementById("protocol") - -const searxngForm = searxngDiv.getElementsByTagName('form')[0]; -const searxngCookies = searxngForm.getElementsByTagName('input')[0]; -searxngForm.addEventListener('submit', async event => { - event.preventDefault(); - const url = new URL(searxngCookies.value); - searchHelper.initSearxngCookies(url); -}); - -const searxForm = searxDiv.getElementsByTagName('form')[0]; -const searxCookies = searxForm.getElementsByTagName('input')[0]; -searxForm.addEventListener('submit', async event => { - event.preventDefault(); - const url = new URL(searxCookies.value); - searchHelper.initSearxCookies(url); -}); - -browser.storage.local.get( - [ - "disableSearch", - "searchFrontend", - "searchProtocol", - ], - r => { - disable.checked = !r.disableSearch; - frontend.value = r.searchFrontend; - protocol.value = r.searchProtocol; - - changeFrontendsSettings(); - changeProtocolSettings(); - } -); - -document.addEventListener("change", async () => { - await browser.storage.local.set({ - disableSearch: !disable.checked, - searchFrontend: frontend.value, - searchProtocol: protocol.value, - }); - changeFrontendsSettings(frontend.value); - changeProtocolSettings(protocol.value); -}) - -function changeFrontendsSettings() { - let SearxWhoogleElement = document.getElementById("searx-whoogle"); - if (frontend.value == 'searx') { - searxDiv.style.display = 'block'; - searxngDiv.style.display = 'none'; - whoogleDiv.style.display = 'none'; - SearxWhoogleElement.style.display = 'block'; - } - else if (frontend.value == 'searxng') { - searxDiv.style.display = 'none'; - searxngDiv.style.display = 'block'; - whoogleDiv.style.display = 'none'; - SearxWhoogleElement.style.display = 'block'; - } - else if (frontend.value == 'whoogle') { - searxDiv.style.display = 'none'; - searxngDiv.style.display = 'none'; - whoogleDiv.style.display = 'block'; - SearxWhoogleElement.style.display = 'block'; - } -} - -function changeProtocolSettings() { - let normalsearxDiv = searxDiv.getElementsByClassName("normal")[0]; - let torsearxDiv = searxDiv.getElementsByClassName("tor")[0]; - let i2psearxDiv = searxDiv.getElementsByClassName("i2p")[0]; - - let normalsearxngDiv = searxngDiv.getElementsByClassName("normal")[0]; - let torsearxngDiv = searxngDiv.getElementsByClassName("tor")[0]; - let i2psearxngDiv = searxngDiv.getElementsByClassName("i2p")[0]; - - let normalwhoogleDiv = whoogleDiv.getElementsByClassName("normal")[0]; - let torwhoogleDiv = whoogleDiv.getElementsByClassName("tor")[0]; - let i2pwhoogleDiv = whoogleDiv.getElementsByClassName("i2p")[0]; - - if (protocol.value == 'normal') { - normalsearxDiv.style.display = 'block'; - normalsearxngDiv.style.display = 'block'; - normalwhoogleDiv.style.display = 'block'; - - torsearxDiv.style.display = 'none'; - torsearxngDiv.style.display = 'none'; - torwhoogleDiv.style.display = 'none'; - - i2psearxDiv.style.display = 'none'; - i2psearxngDiv.style.display = 'none'; - i2pwhoogleDiv.style.display = 'none'; - } - else if (protocol.value == 'tor') { - normalsearxDiv.style.display = 'none'; - normalsearxngDiv.style.display = 'none'; - normalwhoogleDiv.style.display = 'none'; - - torsearxDiv.style.display = 'block'; - torsearxngDiv.style.display = 'block'; - torwhoogleDiv.style.display = 'block'; - - i2psearxDiv.style.display = 'none'; - i2psearxngDiv.style.display = 'none'; - i2pwhoogleDiv.style.display = 'none'; - } - else if (protocol.value == 'i2p') { - normalsearxDiv.style.display = 'none'; - normalsearxngDiv.style.display = 'none'; - normalwhoogleDiv.style.display = 'none'; - - torsearxDiv.style.display = 'none'; - torsearxngDiv.style.display = 'none'; - torwhoogleDiv.style.display = 'none'; - - i2psearxDiv.style.display = 'block'; - i2psearxngDiv.style.display = 'block'; - i2pwhoogleDiv.style.display = 'block'; - } -} - -utils.processDefaultCustomInstances('search', 'searx', 'normal', document); -utils.processDefaultCustomInstances('search', 'searx', 'tor', document); -utils.processDefaultCustomInstances('search', 'searx', 'i2p', document); -utils.processDefaultCustomInstances('search', 'searxng', 'normal', document); -utils.processDefaultCustomInstances('search', 'searxng', 'tor', document); -utils.processDefaultCustomInstances('search', 'searxng', 'i2p', document); -utils.processDefaultCustomInstances('search', 'whoogle', 'normal', document); -utils.processDefaultCustomInstances('search', 'whoogle', 'tor', document); -utils.processDefaultCustomInstances('search', 'whoogle', 'i2p', document); - -utils.latency('search', 'searx', document, location, true) -utils.latency('search', 'searxng', document, location, true) -utils.latency('search', 'whoogle', document, location, true) diff --git a/src/pages/options/search/search.pug b/src/pages/options/search/search.pug deleted file mode 100644 index a9001243..00000000 --- a/src/pages/options/search/search.pug +++ /dev/null @@ -1,78 +0,0 @@ -doctype html -html(lang="en") - include ../../widgets/head.pug - title Search -script(type="module" src="../../../assets/javascripts/localise.js") -body.option(dir="auto") - include ../../widgets/links.pug - +links('search') - - section.option-block - .some-block.option-block - h1 Search - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#disable-search(type="checkbox") - - .some-block.option-block - h4(data-localise="__MSG_frontend__") Frontend - select#search-frontend - option(value="searxng") SearXNG - option(value="searx") SearX - option(value="whoogle") Whoogle - - - #searx-whoogle - .some-block.option-block - h4(data-localise="__MSG_protocol__") Protocol - select#protocol - option(value="normal" data-localise="__MSG_normal__") Normal - option(value="tor" data-localise="__MSG_tor__") Tor - option(value="i2p" data-localise="__MSG_i2p__") I2P - - .some-block - h4(data-localise="__MSG_searchNote__") Note: To use Search to its full potential, make LibRedirect as the Default Search Engine - - #searx - hr - .normal - include ../../widgets/instances.pug - +instances('https://searx.com') - include ../../widgets/latency.pug - +latency('searx') - .tor - include ../../widgets/instances.pug - +instances('https://searx.onion') - .i2p - include ../../widgets/instances.pug - +instances('https://searx.i2p') - - #searxng - hr - .normal - include ../../widgets/instances.pug - +instances('https://searxng.com') - +latency('searxng') - .tor - include ../../widgets/instances.pug - +instances('https://searxng.onion') - .i2p - include ../../widgets/instances.pug - +instances('https://searxng.i2p') - - #whoogle - hr - .normal - include ../../widgets/instances.pug - +instances('https://whoogle.com') - +latency('whoogle') - .tor - include ../../widgets/instances.pug - +instances('https://whoogle.onion') - .i2p - include ../../widgets/instances.pug - +instances('https://whoogle.i2p') - - script(type="module" src="../init.js") - script(type="module" src="./search.js") \ No newline at end of file -- cgit 1.4.1