diff options
author | BobIsMyManager <ahoumatt@yahoo.com> | 2022-04-13 14:51:36 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-13 17:51:36 +0300 |
commit | f05e1b996a2b74c1d4e34038f4d2debb145ff841 (patch) | |
tree | 9981f15990efb6220ab7b8a38d062c4984f3bf1b /src/pages/options/search | |
parent | Merge branch 'master' of https://github.com/libredirect/libredirect (diff) | |
download | libredirect-f05e1b996a2b74c1d4e34038f4d2debb145ff841.zip |
I2P support for search, Imgur and Wikipedia (#189)
Diffstat (limited to 'src/pages/options/search')
-rw-r--r-- | src/pages/options/search/search.html | 76 | ||||
-rw-r--r-- | src/pages/options/search/search.js | 55 |
2 files changed, 129 insertions, 2 deletions
diff --git a/src/pages/options/search/search.html b/src/pages/options/search/search.html index a5f26ab3..a5d2a3ca 100644 --- a/src/pages/options/search/search.html +++ b/src/pages/options/search/search.html @@ -150,6 +150,7 @@ <select id="protocol"> <option value="normal" data-localise="__MSG_normal__">Normal</option> <option value="tor" data-localise="__MSG_tor__">Tor</option> + <option value="i2p" data-localise="__MSG_i2p__">I2P</option> </select> </div> </div> @@ -210,6 +211,30 @@ </form> <div class="checklist custom-checklist"></div> </div> + <div class="i2p"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="checklist checklist"> + </div> + <hr> + <div class="some-block option-block"> + <h4 data-localise="__MSG_customInstances__">Custom Instances</h4> + </div> + <form class="custom-instance-form"> + <div class="some-block option-block"> + <input class="custom-instance" placeholder="https://searx.com" type="url" /> + <button type="submit" class="add 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 custom-checklist"></div> + </div> </div> <div id="searxng"> @@ -262,6 +287,30 @@ </form> <div class="checklist custom-checklist"></div> </div> + <div class="i2p"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="checklist checklist"> + </div> + <hr> + <div class="some-block option-block"> + <h4 data-localise="__MSG_customInstances__">Custom Instances</h4> + </div> + <form class="custom-instance-form"> + <div class="some-block option-block"> + <input class="custom-instance" placeholder="https://searxng.com" type="url" /> + <button type="submit" class="add 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 custom-checklist"></div> + </div> </div> <div id="whoogle"> @@ -314,6 +363,30 @@ </form> <div class="checklist custom-checklist"></div> </div> + <div class="i2p"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="checklist checklist"> + </div> + <hr> + <div class="some-block option-block"> + <h4 data-localise="__MSG_customInstances__">Custom Instances</h4> + </div> + <form class="custom-instance-form"> + <div class="some-block option-block"> + <input class="custom-instance" placeholder="https://whoogle.com" type="url" /> + <button type="submit" class="add 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 custom-checklist"></div> + </div> </div> </section> @@ -324,4 +397,5 @@ <script type="module" src="../../../assets/javascripts/localise.js"></script> </body> -</html> \ No newline at end of file +</html> + diff --git a/src/pages/options/search/search.js b/src/pages/options/search/search.js index d96665e9..0eeac5ed 100644 --- a/src/pages/options/search/search.js +++ b/src/pages/options/search/search.js @@ -63,12 +63,15 @@ protocolElement.addEventListener("change", function changeProtocolSettings(protocol) { let normalsearxDiv = searxDivElement.getElementsByClassName("normal")[0]; let torsearxDiv = searxDivElement.getElementsByClassName("tor")[0]; + let i2psearxDiv = searxDivElement.getElementsByClassName("i2p")[0]; let normalsearxngDiv = searxngDivElement.getElementsByClassName("normal")[0]; let torsearxngDiv = searxngDivElement.getElementsByClassName("tor")[0]; + let i2psearxngDiv = searxngDivElement.getElementsByClassName("i2p")[0]; let normalwhoogleDiv = whoogleDivElement.getElementsByClassName("normal")[0]; let torwhoogleDiv = whoogleDivElement.getElementsByClassName("tor")[0]; + let i2pwhoogleDiv = whoogleDivElement.getElementsByClassName("i2p")[0]; if (protocol == 'normal') { normalsearxDiv.style.display = 'block'; @@ -77,6 +80,9 @@ function changeProtocolSettings(protocol) { 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 == 'tor') { normalsearxDiv.style.display = 'none'; @@ -85,6 +91,20 @@ function changeProtocolSettings(protocol) { 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 == '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'; } } @@ -121,6 +141,17 @@ searchHelper.init().then(() => { ); commonHelper.processDefaultCustomInstances( + 'searx', + 'i2p', + searchHelper, + document, + searchHelper.getSearxI2pRedirectsChecks, + searchHelper.setSearxI2pRedirectsChecks, + searchHelper.getSearxI2pCustomRedirects, + searchHelper.setSearxI2pCustomRedirects + ); + + commonHelper.processDefaultCustomInstances( 'searxng', 'normal', searchHelper, @@ -143,6 +174,17 @@ searchHelper.init().then(() => { ); commonHelper.processDefaultCustomInstances( + 'searxng', + 'i2p', + searchHelper, + document, + searchHelper.getSearxngI2pRedirectsChecks, + searchHelper.setSearxngI2pRedirectsChecks, + searchHelper.getSearxngI2pCustomRedirects, + searchHelper.setSearxngI2pCustomRedirects + ); + + commonHelper.processDefaultCustomInstances( 'whoogle', 'normal', searchHelper, @@ -163,4 +205,15 @@ searchHelper.init().then(() => { searchHelper.getWhoogleTorCustomRedirects, searchHelper.setWhoogleTorCustomRedirects ); -}); \ No newline at end of file + + commonHelper.processDefaultCustomInstances( + 'whoogle', + 'i2p', + searchHelper, + document, + searchHelper.getWhoogleI2pRedirectsChecks, + searchHelper.setWhoogleI2pRedirectsChecks, + searchHelper.getWhoogleI2pCustomRedirects, + searchHelper.setWhoogleI2pCustomRedirects + ); +}); |