diff options
author | ManeraKai <manerakai@protonmail.com> | 2022-07-24 11:34:39 +0300 |
---|---|---|
committer | ManeraKai <manerakai@protonmail.com> | 2022-07-24 11:34:39 +0300 |
commit | ccfcccd53ed6a7a5cc56adc0d7f027e475f0665a (patch) | |
tree | be58876ebca99733cf54a297d22e2117a176f001 /src/pages | |
parent | Merge pull request 'No more trailing slashes' (#9) from BobIsMyManager/libred... (diff) | |
parent | fix some typos (diff) | |
download | libredirect-ccfcccd53ed6a7a5cc56adc0d7f027e475f0665a.zip |
Merge branch 'BobIsMyManager-librex'
Diffstat (limited to 'src/pages')
42 files changed, 2099 insertions, 856 deletions
diff --git a/src/pages/background/background.js b/src/pages/background/background.js index 832d6533..293a2c84 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -81,6 +81,7 @@ twitterHelper.pasteNitterCookies(); wikipediaHelper.pasteWikilessCookies(); searchHelper.pasteSearxCookies(); searchHelper.pasteSearxngCookies(); +searchHelper.pasteLibrexCookies(); redditHelper.pasteLibredditCookies(); redditHelper.pasteTedditCookies(); tiktokHelper.pasteProxiTokCookies(); @@ -257,4 +258,6 @@ browser.contextMenus.onClicked.addListener( browser.runtime.onMessage.addListener((message, sender, sendResponse) => { if (message.function === 'unify') utils.unify(false).then(r => sendResponse({ response: r })) return true; -}); \ No newline at end of file +}); + +browser.storage.local.set({"version": browser.runtime.getManifest().version}) diff --git a/src/pages/background/incognito.js b/src/pages/background/incognito.js index 872a83c8..f42eadcf 100644 --- a/src/pages/background/incognito.js +++ b/src/pages/background/incognito.js @@ -14,8 +14,9 @@ await twitterHelper.pasteNitterCookies(); await wikipediaHelper.pasteWikilessCookies(); await searchHelper.pasteSearxCookies(); await searchHelper.pasteSearxngCookies(); +await searchHelper.pasteLibrexCookies(); await redditHelper.pasteLibredditCookies(); await redditHelper.pasteTedditCookies(); await tiktokHelper.pasteProxiTokCookies(); -window.close() \ No newline at end of file +window.close() diff --git a/src/pages/options/index.html b/src/pages/options/index.html index 241a20e7..29e454bf 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -76,6 +76,21 @@ </select> </div> <div class="some-block option-block"> + <h4 data-localise="__MSG_protocol__"></h4> + <select id="protocol"> + <option value="normal" data-localise="__MSG_normal__">Normal</option> + <option value="tor">Tor</option> + <option value="i2p">I2P</option> + <option value="loki">Lokinet</option> + </select> + </div> + <div id="protocol-fallback"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_protocolFallback__">Fallback to normal if no instances are available for the current protocol</h4> + <input id="protocol-fallback-checkbox" type="checkbox"> + </div> + </div> + <div class="some-block option-block"> <h4 data-localise="__MSG_autoRedirect__"></h4> <input id="auto-redirect" type="checkbox"> </div> @@ -274,33 +289,23 @@ <option value="yatte">Yattee</option> </select> </div> - <div id="freetube-yatte"> + <div id="youtube-embedded_frontend"> <div class="some-block option-block"> <h4 data-localise="__MSG_embeddedVids__">Embedded Videos Frontend</h4> <select id="youtube-embed_frontend"> <option value="invidious">Invidious</option> <option value="piped">Piped</option> <option value="pipedMaterial">Piped-Material</option> - <option value="youtube">Youtube</option> </select> </div> </div> - <div id="invidious-piped-pipedMaterial"> - <div class="some-block option-block"> - <h4 data-localise="__MSG_protocol__">Protocol</h4> - <select id="youtube-protocol"> - <option value="normal" data-localise="__MSG_normal__">Normal</option> - <option value="tor" data-localise="__MSG_tor__">Tor</option> - </select> - </div> - <div class="some-block option-block"> - <h4 data-localise="__MSG_redirectType__">Redirect Type</h4> - <select id="youtube-redirect_type"> - <option value="both" data-localise="__MSG_both__">both</option> - <option value="onlyEmbedded" data-localise="__MSG_onlyEmbedded__">Only Embedded</option> - <option value="onlyNotEmbedded" data-localise="__MSG_onlyNotEmbedded__">Only Not Embedded</option> - </select> - </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_redirectType__">Redirect Type</h4> + <select id="youtube-redirect_type"> + <option value="both" data-localise="__MSG_both__">both</option> + <option value="onlyEmbedded" data-localise="__MSG_onlyEmbedded__">Only Embedded</option> + <option value="onlyNotEmbedded" data-localise="__MSG_onlyNotEmbedded__">Only Not Embedded</option> + </select> </div> <div id="invidious"> <hr> @@ -315,7 +320,7 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://invidious.com" type="url"> + <input class="custom-instance" placeholder="http://invidious.com" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -345,7 +350,49 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://invidious.onion" type="url"> + <input class="custom-instance" placeholder="http://invidious.onion" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </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"></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="http://invidious.i2p" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://invidious.loki" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -399,7 +446,49 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://piped.onion" type="url"> + <input class="custom-instance" placeholder="http://piped.onion" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </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"></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="http://piped.i2p" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://piped.loki" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -453,7 +542,49 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://piped-material.onion" type="url"> + <input class="custom-instance" placeholder="http://piped-material.onion" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </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"></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="http://piped-material.i2p" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://piped-material.loki" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -507,6 +638,69 @@ <input class="button button-inline" id="latency-beatbump" style="display:none;"> </div> </div> + <div class="tor"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://beatbump.onion" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </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"></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="http://beatbump.i2p" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://beatbump.loki" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> </div> <script type="module" src="./widgets/youtubeMusic.js"></script> </section> @@ -520,13 +714,6 @@ <input id="twitter-enable" type="checkbox"> </div> <div class="some-block option-block"> - <h4 data-localise="__MSG_protocol__">Protocol</h4> - <select id="twitter-protocol"> - <option value="normal" data-localise="__MSG_normal__">Normal</option> - <option value="tor" data-localise="__MSG_tor__">Tor</option> - </select> - </div> - <div class="some-block option-block"> <h4 data-localise="__MSG_redirectType__">Redirect Type</h4> <select id="twitter-redirect_type"> <option value="both" data-localise="__MSG_both__">both</option> @@ -577,7 +764,49 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://nitter.onion" type="url"> + <input class="custom-instance" placeholder="http://nitter.onion" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </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"></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="http://nitter.i2p" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://nitter.loki" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -599,13 +828,6 @@ <h4 data-localise="__MSG_enable__">Enable</h4> <input id="instagram-enable" type="checkbox"> </div> - <div class="some-block option-block"> - <h4 data-localise="__MSG_protocol__">Protocol</h4> - <select id="instagram-protocol"> - <option value="normal" data-localise="__MSG_normal__">Normal</option> - <option value="tor" data-localise="__MSG_tor__">Tor</option> - </select> - </div> <div id="bibliogram"> <hr> <div class="normal"> @@ -659,6 +881,48 @@ </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"></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="http://bibliogram.onion" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://bibliogram.loki" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> </div> <script type="module" src="./widgets/instagram.js"></script> </section> @@ -671,13 +935,6 @@ <h4 data-localise="__MSG_enable__">Enable</h4> <input id="tiktok-enable" type="checkbox"> </div> - <div class="some-block option-block"> - <h4 data-localise="__MSG_protocol__">Protocol</h4> - <select id="tiktok-protocol"> - <option value="normal" data-localise="__MSG_normal__">Normal</option> - <option value="tor" data-localise="__MSG_tor__">Tor</option> - </select> - </div> <div id="proxiTok"> <hr> <div class="normal"> @@ -721,7 +978,49 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://proxitok.onion" type="url"> + <input class="custom-instance" placeholder="http://proxitok.onion" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </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"></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="http://proxitok.i2p" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://proxitok.loki" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -750,13 +1049,6 @@ <option value="teddit">Teddit</option> </select> </div> - <div class="some-block option-block"> - <h4 data-localise="__MSG_protocol__">Protocol</h4> - <select id="reddit-protocol"> - <option value="normal" data-localise="__MSG_normal__">Normal</option> - <option value="tor" data-localise="__MSG_tor__">Tor</option> - </select> - </div> <div id="libreddit"> <hr> <div class="normal"> @@ -800,7 +1092,49 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://libreddit.onion" type="url"> + <input class="custom-instance" placeholder="http://libreddit.onion" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </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"></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="http://libreddit.i2p" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://libreddit.loki" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -854,7 +1188,49 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://teddit.onion" type="url"> + <input class="custom-instance" placeholder="http://teddit.onion" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </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"></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="http://teddit.i2p" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://teddit.loki" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -876,14 +1252,6 @@ <h4 data-localise="__MSG_enable__">Enable</h4> <input id="imgur-enable" type="checkbox"> </div> - <div class="some-block option-block"> - <h4 data-localise="__MSG_protocol__">Protocol</h4> - <select id="imgur-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 id="rimgo"> <hr> <div class="normal"> @@ -927,7 +1295,7 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://rimgo.onion" type="url"> + <input class="custom-instance" placeholder="http://rimgo.onion" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -948,7 +1316,28 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://rimgo.onion" type="url"> + <input class="custom-instance" placeholder="http://rimgo.onion" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://rimgo.loki" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -970,14 +1359,6 @@ <h4 data-localise="__MSG_enable__">Enable</h4> <input id="wikipedia-enable" type="checkbox"> </div> - <div class="some-block option-block"> - <h4 data-localise="__MSG_protocol__">Protocol</h4> - <select id="wikipedia-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 id="wikiless"> <hr> <div class="normal"> @@ -1021,7 +1402,7 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://wikiless.onion" type="url"> + <input class="custom-instance" placeholder="http://wikiless.onion" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -1052,6 +1433,27 @@ </form> <div class="checklist custom-checklist"></div> </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://wikiless.loki" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> </div> <script type="module" src="./widgets/wikipedia.js"></script> </section> @@ -1064,13 +1466,6 @@ <h4 data-localise="__MSG_enable__">Enable</h4> <input id="medium-enable" type="checkbox"> </div> - <div class="some-block option-block"> - <h4 data-localise="__MSG_protocol__">Protocol</h4> - <select id="medium-protocol"> - <option value="normal" data-localise="__MSG_normal__">Normal</option> - <option value="tor" data-localise="__MSG_tor__">Tor</option> - </select> - </div> <div id="scribe"> <hr> <div class="normal"> @@ -1114,7 +1509,49 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://scribe.onion" type="url"> + <input class="custom-instance" placeholder="http://scribe.onion" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </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"></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="http://scribe.i2p" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://scribe.loki" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -1136,13 +1573,6 @@ <h4 data-localise="__MSG_enable__">Enable</h4> <input id="quora-enable" type="checkbox"> </div> - <div class="some-block option-block"> - <h4 data-localise="__MSG_protocol__">Protocol</h4> - <select id="quora-protocol"> - <option value="normal" data-localise="__MSG_normal__">Normal</option> - <option value="tor" data-localise="__MSG_tor__">Tor</option> - </select> - </div> <div id="quetre"> <hr> <div class="normal"> @@ -1186,7 +1616,49 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://quetre.onion" type="url"> + <input class="custom-instance" placeholder="http://quetre.onion" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </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"></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="http://quetre.i2p" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://quetre.loki" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -1208,13 +1680,6 @@ <h4 data-localise="__MSG_enable__">Enable</h4> <input id="imdb-enable" type="checkbox"> </div> - <div class="some-block option-block"> - <h4 data-localise="__MSG_protocol__">Protocol</h4> - <select id="imdb-protocol"> - <option value="normal" data-localise="__MSG_normal__">Normal</option> - <option value="tor" data-localise="__MSG_tor__">Tor</option> - </select> - </div> <div id="libremdb"> <hr> <div class="normal"> @@ -1258,7 +1723,49 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://libremdb.onion" type="url"> + <input class="custom-instance" placeholder="http://libremdb.onion" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </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"></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="http://libremdb.i2p" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://libremdb.loki" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -1280,13 +1787,6 @@ <h4 data-localise="__MSG_enable__">Enable</h4> <input id="reuters-enable" type="checkbox"> </div> - <div class="some-block option-block"> - <h4 data-localise="__MSG_protocol__">Protocol</h4> - <select id="reuters-protocol"> - <option value="normal" data-localise="__MSG_normal__">Normal</option> - <option value="tor" data-localise="__MSG_tor__">Tor</option> - </select> - </div> <div id="neuters"> <hr> <div class="normal"> @@ -1330,7 +1830,49 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://neuters.onion" type="url"> + <input class="custom-instance" placeholder="http://neuters.onion" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </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"></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="http://neuters.i2p" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://neuters.loki" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -1352,13 +1894,6 @@ <h4 data-localise="__MSG_enable__">Enable</h4> <input id="peertube-enable" type="checkbox"> </div> - <div class="some-block option-block"> - <h4 data-localise="__MSG_protocol__">Protocol</h4> - <select id="peertube-protocol"> - <option value="normal" data-localise="__MSG_normal__">Normal</option> - <option value="tor" data-localise="__MSG_tor__">Tor</option> - </select> - </div> <div id="simpleertube"> <hr> <div class="normal"> @@ -1402,7 +1937,49 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://simpleertube.onion" type="url"> + <input class="custom-instance" placeholder="http://simpleertube.onion" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </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"></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="http://simpleertube.i2p" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://simpleertube.loki" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -1424,13 +2001,6 @@ <h4 data-localise="__MSG_enable__">Enable</h4> <input id="lbry-enable" type="checkbox"> </div> - <div class="some-block option-block"> - <h4 data-localise="__MSG_protocol__">Protocol</h4> - <select id="lbry-protocol"> - <option value="normal" data-localise="__MSG_normal__">Normal</option> - <option value="tor" data-localise="__MSG_tor__">Tor</option> - </select> - </div> <div id="librarian"> <hr> <div class="normal"> @@ -1484,6 +2054,48 @@ </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"></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="http://librarian.onion" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://librarian.loki" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> </div> <script type="module" src="./widgets/lbry.js"></script> </section> @@ -1502,20 +2114,11 @@ <option value="searxng">SearXNG</option> <option value="searx">SearX</option> <option value="whoogle">Whoogle</option> + <option value="librex">LibreX</option> </select> </div> - <div id="searx-whoogle"> - <div class="some-block option-block"> - <h4 data-localise="__MSG_protocol__">Protocol</h4> - <select id="search-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> <div class="some-block"> - <h4 data-localise="__MSG_searchNote__">Note: To use Search to its full potential, make LibRedirect as the Default Search Engine</h4> + <h4 data-localise="__MSG_searchNote__">Note: To use Search, make LibRedirect the Default Search Engine</h4> </div> <div id="searx"> <hr> @@ -1560,7 +2163,7 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://searx.onion" type="url"> + <input class="custom-instance" placeholder="http://searx.onion" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -1581,7 +2184,28 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://searx.i2p" type="url"> + <input class="custom-instance" placeholder="http://searx.i2p" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://searx.loki" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -1635,7 +2259,7 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://searxng.onion" type="url"> + <input class="custom-instance" placeholder="http://searxng.onion" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -1656,7 +2280,28 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://searxng.i2p" type="url"> + <input class="custom-instance" placeholder="http://searxng.i2p" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://searxng.loki" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -1710,7 +2355,7 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://whoogle.onion" type="url"> + <input class="custom-instance" placeholder="http://whoogle.onion" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -1731,7 +2376,124 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://whoogle.i2p" type="url"> + <input class="custom-instance" placeholder="http://whoogle.i2p" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://whoogle.loki" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + <div id="librex"> + <hr> + <div class="normal"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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://librex.com" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + <div class="buttons buttons-inline"> + <label class="button button-inline" id="latency-librex-label" for="latency-librex"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"></path> + </svg> + <x data-localise="__MSG_testInstancesLatency__">Test Instances Latency</x> + </label> + <input class="button button-inline" id="latency-librex" style="display:none;"> + </div> + </div> + <div class="tor"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://librex.onion" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </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"></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="http://librex.i2p" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://librex.loki" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -1760,15 +2522,6 @@ <option value="lingva">Lingva</option> </select> </div> - <div class="some-block option-block"> - <h4 data-localise="__MSG_protocol__">Protocol</h4> - <select id="translate-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> - <option value="loki" data-localise="__MSG_loki__">Lokinet</option> - </select> - </div> <hr> <div id="simplyTranslate"> <div class="normal"> @@ -1907,7 +2660,49 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="http://tyzxppdeoojdnaux.onion" type="url"> + <input class="custom-instance" placeholder="http://lingvatranslate.onion" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </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"></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="http://lingvatranslate.i2p" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://lingvatranslate.loki" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> @@ -1959,14 +2754,77 @@ </form> <div class="checklist custom-checklist"></div> <div class="buttons buttons-inline"> - <label class="button button-inline" id="latency-facilmap-label" for="latency-facilmap"> + <label class="button button-inline" id="latency-facil-label" for="latency-facil"> <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> <path d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"></path> </svg> <x data-localise="__MSG_testInstancesLatency__">Test Instances Latency</x> </label> - <input class="button button-inline" id="latency-facilmap" style="display:none;"> + <input class="button button-inline" id="latency-facil" style="display:none;"> + </div> + </div> + <div class="tor"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://facilmap.onion" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </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"></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="http://facilmap.i2p" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://facilmap.loki" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> </div> </div> <script type="module" src="./widgets/maps.js"></script> @@ -1980,13 +2838,6 @@ <h4 data-localise="__MSG_enable__">Enable</h4> <input id="sendTargets-enable" type="checkbox"> </div> - <div class="some-block option-block"> - <h4 data-localise="__MSG_protocol__">Protocol</h4> - <select id="sendTargets-protocol"> - <option value="normal" data-localise="__MSG_normal__">Normal</option> - <option value="tor" data-localise="__MSG_tor__">Tor</option> - </select> - </div> <div id="send"> <hr> <div class="normal"> @@ -2030,7 +2881,49 @@ </div> <form class="custom-instance-form"> <div class="some-block option-block"> - <input class="custom-instance" placeholder="https://send.onion" type="url"> + <input class="custom-instance" placeholder="http://send.onion" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </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"></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="http://send.i2p" type="url"> + <button class="add add-instance" type="submit"> + <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> + <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> + </svg> + </button> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <div class="loki"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> + </div> + <div class="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="http://send.loki" type="url"> <button class="add add-instance" type="submit"> <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor"> <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path> diff --git a/src/pages/options/widgets/general.js b/src/pages/options/widgets/general.js index 721ad2b0..352e4b76 100644 --- a/src/pages/options/widgets/general.js +++ b/src/pages/options/widgets/general.js @@ -42,7 +42,7 @@ function exportSettings() { null, result => { let resultString = JSON.stringify(result, null, ' '); - exportSettingsElement.href = 'data:application/json;base64,' + btoa(resultString); + exportSettingsElement.href = 'data:application/json;base64,' + btoa(encodeURI(resultString)); exportSettingsElement.download = 'libredirect-settings.json'; } ); @@ -83,6 +83,7 @@ importSettingsElement.addEventListener("change", await searchHelper.pasteSearxCookies(); await searchHelper.pasteSearxngCookies(); + await searchHelper.pasteLibrexCookies(); await redditHelper.pasteLibredditCookies(); await redditHelper.pasteTedditCookies(); @@ -150,9 +151,9 @@ resetSettings.addEventListener("click", ); let autoRedirectElement = document.getElementById("auto-redirect") -autoRedirectElement.addEventListener("change", - event => browser.storage.local.set({ autoRedirect: event.target.checked }) -); +autoRedirectElement.addEventListener("change", event => { + browser.storage.local.set({ autoRedirect: event.target.checked }) +}); let themeElement = document.getElementById("theme"); themeElement.addEventListener("change", event => { @@ -161,6 +162,18 @@ themeElement.addEventListener("change", event => { location.reload(); }) +let protocolElement = document.getElementById("protocol"); +protocolElement.addEventListener("change", event => { + const value = event.target.options[protocol.selectedIndex].value; + browser.storage.local.set({ protocol: value }); + location.reload(); +}) + +let protocolFallbackCheckbox = document.getElementById("protocol-fallback-checkbox") +protocolFallbackCheckbox.addEventListener("change", event => { + browser.storage.local.set({ protocolFallback: event.target.checked }); +}) + let nameCustomInstanceInput = document.getElementById("exceptions-custom-instance"); let instanceTypeElement = document.getElementById("exceptions-custom-instance-type"); let instanceType = "url" @@ -187,13 +200,25 @@ browser.storage.local.get( 'theme', 'autoRedirect', 'exceptions', + 'protocol', + 'protocolFallback' // 'firstPartyIsolate' ], r => { autoRedirectElement.checked = r.autoRedirect; themeElement.value = r.theme; + protocolElement.value = r.protocol; + protocolFallbackCheckbox.checked = r.protocolFallback; // firstPartyIsolate.checked = r.firstPartyIsolate; + let protocolFallbackElement = document.getElementById('protocol-fallback') + if (protocolElement.value == "normal") { + protocolFallbackElement.style.display = 'none'; + } else { + protocolFallbackElement.style.display = 'block'; + } + + instanceTypeElement.addEventListener("change", event => { instanceType = event.target.options[instanceTypeElement.selectedIndex].value diff --git a/src/pages/options/widgets/general.pug b/src/pages/options/widgets/general.pug index 920d2b54..e04e9e2a 100644 --- a/src/pages/options/widgets/general.pug +++ b/src/pages/options/widgets/general.pug @@ -15,6 +15,19 @@ section#general_page.option-block input#firstPartyIsolate(type="checkbox") .some-block.option-block + h4(data-localise="__MSG_protocol__") + select#protocol + option(value="normal" data-localise="__MSG_normal__") Normal + option(value="tor") Tor + option(value="i2p") I2P + option(value="loki") Lokinet + + #protocol-fallback + .some-block.option-block + h4(data-localise="__MSG_protocolFallback__") Fallback to normal if no instances are available for the current protocol + input#protocol-fallback-checkbox(type="checkbox") + + .some-block.option-block h4(data-localise="__MSG_autoRedirect__") input#auto-redirect(type="checkbox") @@ -188,4 +201,4 @@ section#general_page.option-block input#sendTargets(type="checkbox") - script(type="module" src="./widgets/general.js") \ No newline at end of file + script(type="module" src="./widgets/general.js") diff --git a/src/pages/options/widgets/imdb.js b/src/pages/options/widgets/imdb.js index f2c6cba5..ad115e93 100644 --- a/src/pages/options/widgets/imdb.js +++ b/src/pages/options/widgets/imdb.js @@ -1,42 +1,61 @@ import utils from "../../../assets/javascripts/utils.js"; +// UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST + +const frontends = new Array("libremdb") +const protocols = new Array("normal", "tor", "i2p", "loki") + const enable = document.getElementById("imdb-enable"); -const protocol = document.getElementById("imdb-protocol") const imdb = document.getElementById('imdb_page'); +//const frontend = document.getElementById("imdb-frontend"); +let protocol -function changeProtocolSettings() { - const normalDiv = imdb.getElementsByClassName("normal")[0]; - const torDiv = imdb.getElementsByClassName("tor")[0]; - if (protocol.value == 'normal') { - normalDiv.style.display = 'block'; - torDiv.style.display = 'none'; - } - else if (protocol.value == 'tor') { - normalDiv.style.display = 'none'; - torDiv.style.display = 'block'; +/* +function changeFrontendsSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + if (frontends[i] == frontend.value) { + frontendDiv.style.display = 'block' + } else { + frontendDiv.style.display = 'none' + } } } +*/ -imdb.addEventListener("change", () => { - changeProtocolSettings(); - browser.storage.local.set({ - disableImdb: !enable.checked, - imdbProtocol: protocol.value, - }) -}) +function changeProtocolSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + for (let x = 0; x < protocols.length; x++) { + const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0] + if (protocols[x] == protocol) { + protocolDiv.style.display = 'block' + } else { + protocolDiv.style.display = 'none' + } + } + } +} browser.storage.local.get( [ "disableImdb", - "imdbProtocol" + "protocol" ], r => { enable.checked = !r.disableImdb; - protocol.value = r.imdbProtocol; + protocol = r.protocol; changeProtocolSettings(); } ) -utils.processDefaultCustomInstances('imdb', 'libremdb', 'normal', document); -utils.processDefaultCustomInstances('imdb', 'libremdb', 'tor', document); -utils.latency('imdb', 'libremdb', document, location) \ No newline at end of file +imdb.addEventListener("change", () => { + browser.storage.local.set({ disableImdb: !enable.checked }) +}) + +for (let i = 0; i < frontends.length; i++) { + for (let x = 0; x < protocols.length; x++){ + utils.processDefaultCustomInstances('imdb', frontends[i], protocols[x], document) + } + utils.latency('imdb', frontends[i], document, location) +} diff --git a/src/pages/options/widgets/imdb.pug b/src/pages/options/widgets/imdb.pug index 07749144..008e1c00 100644 --- a/src/pages/options/widgets/imdb.pug +++ b/src/pages/options/widgets/imdb.pug @@ -6,12 +6,6 @@ section#imdb_page.option-block h4(data-localise="__MSG_enable__") Enable input#imdb-enable(type="checkbox") - .some-block.option-block - h4(data-localise="__MSG_protocol__") Protocol - select#imdb-protocol - option(value="normal" data-localise="__MSG_normal__") Normal - option(value="tor" data-localise="__MSG_tor__") Tor - #libremdb hr .normal @@ -21,6 +15,12 @@ section#imdb_page.option-block +latency('libremdb') .tor include ../../widgets/instances.pug - +instances('https://libremdb.onion') + +instances('http://libremdb.onion') + .i2p + include ../../widgets/instances.pug + +instances('http://libremdb.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://libremdb.loki') - script(type="module" src="./widgets/imdb.js") \ No newline at end of file + script(type="module" src="./widgets/imdb.js") diff --git a/src/pages/options/widgets/imgur.js b/src/pages/options/widgets/imgur.js index ffb28405..475bf472 100644 --- a/src/pages/options/widgets/imgur.js +++ b/src/pages/options/widgets/imgur.js @@ -1,53 +1,61 @@ import utils from "../../../assets/javascripts/utils.js"; +// UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST + +const frontends = new Array("rimgo") +const protocols = new Array("normal", "tor", "i2p", "loki") + const enable = document.getElementById("imgur-enable"); -const protocol = document.getElementById("imgur-protocol") const imgur = document.getElementById('imgur_page'); +//const frontend = document.getElementById("imgur-frontend"); +let protocol -const normalDiv = imgur.getElementsByClassName("normal")[0]; -const torDiv = imgur.getElementsByClassName("tor")[0]; -const i2pDiv = imgur.getElementsByClassName("i2p")[0]; +/* +function changeFrontendsSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + if (frontends[i] == frontend.value) { + frontendDiv.style.display = 'block' + } else { + frontendDiv.style.display = 'none' + } + } +} +*/ function changeProtocolSettings() { - if (protocol.value == 'normal') { - normalDiv.style.display = 'block'; - torDiv.style.display = 'none'; - i2pDiv.style.display = 'none'; - } - else if (protocol.value == 'tor') { - normalDiv.style.display = 'none'; - torDiv.style.display = 'block'; - i2pDiv.style.display = 'none'; - } - else if (protocol.value == 'i2p') { - normalDiv.style.display = 'none'; - torDiv.style.display = 'none'; - i2pDiv.style.display = 'block'; + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + for (let x = 0; x < protocols.length; x++) { + const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0] + if (protocols[x] == protocol) { + protocolDiv.style.display = 'block' + } else { + protocolDiv.style.display = 'none' + } + } } } browser.storage.local.get( [ "disableImgur", - "imgurProtocol", + "protocol" ], r => { enable.checked = !r.disableImgur; - protocol.value = r.imgurProtocol; + protocol = r.protocol; changeProtocolSettings(); } ); imgur.addEventListener("change", () => { - changeProtocolSettings(); - browser.storage.local.set({ - disableImgur: !enable.checked, - imgurProtocol: protocol.value, - }); + browser.storage.local.set({ disableImgur: !enable.checked }); }) -utils.processDefaultCustomInstances('imgur', 'rimgo', 'normal', document); -utils.processDefaultCustomInstances('imgur', 'rimgo', 'tor', document); -utils.processDefaultCustomInstances('imgur', 'rimgo', 'i2p', document); - -utils.latency('imgur', 'rimgo', document, location) \ No newline at end of file +for (let i = 0; i < frontends.length; i++) { + for (let x = 0; x < protocols.length; x++){ + utils.processDefaultCustomInstances('imgur', frontends[i], protocols[x], document) + } + utils.latency('imgur', frontends[i], document, location) +} diff --git a/src/pages/options/widgets/imgur.pug b/src/pages/options/widgets/imgur.pug index 5e514341..eacd066e 100644 --- a/src/pages/options/widgets/imgur.pug +++ b/src/pages/options/widgets/imgur.pug @@ -7,13 +7,6 @@ section#imgur_page.option-block h4(data-localise="__MSG_enable__") Enable input#imgur-enable(type="checkbox") - .some-block.option-block - h4(data-localise="__MSG_protocol__") Protocol - select#imgur-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 - #rimgo hr .normal @@ -23,10 +16,12 @@ section#imgur_page.option-block +latency('rimgo') .tor include ../../widgets/instances.pug - +instances('https://rimgo.onion') - + +instances('http://rimgo.onion') .i2p include ../../widgets/instances.pug - +instances('https://rimgo.onion') + +instances('http://rimgo.onion') + .loki + include ../../widgets/instances.pug + +instances('http://rimgo.loki') - script(type="module" src="./widgets/imgur.js") \ No newline at end of file + script(type="module" src="./widgets/imgur.js") diff --git a/src/pages/options/widgets/instagram.js b/src/pages/options/widgets/instagram.js index 8bd1a101..84456845 100644 --- a/src/pages/options/widgets/instagram.js +++ b/src/pages/options/widgets/instagram.js @@ -1,45 +1,61 @@ import utils from "../../../assets/javascripts/utils.js"; -const enable = document.getElementById("instagram-enable"); -const protocol = document.getElementById("instagram-protocol"); +// UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST + +const frontends = new Array("bibliogram") +const protocols = new Array("normal", "tor", "i2p", "loki") +const enable = document.getElementById("instagram-enable"); const instagram = document.getElementById('instagram_page') -const normalDiv = instagram.getElementsByClassName("normal")[0]; -const torDiv = instagram.getElementsByClassName("tor")[0]; +//const frontend = document.getElementById("instagram-frontend"); +let protocol + +/* +function changeFrontendsSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + if (frontends[i] == frontend.value) { + frontendDiv.style.display = 'block' + } else { + frontendDiv.style.display = 'none' + } + } +} +*/ function changeProtocolSettings() { - if (protocol.value == 'normal') { - normalDiv.style.display = 'block'; - torDiv.style.display = 'none'; - } - else if (protocol.value == 'tor') { - normalDiv.style.display = 'none'; - torDiv.style.display = 'block'; + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + for (let x = 0; x < protocols.length; x++) { + const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0] + if (protocols[x] == protocol) { + protocolDiv.style.display = 'block' + } else { + protocolDiv.style.display = 'none' + } + } } } browser.storage.local.get( [ "disableInstagram", - "instagramProtocol" + "protocol" ], r => { enable.checked = !r.disableInstagram; - protocol.value = r.instagramProtocol; + protocol = r.protocol; changeProtocolSettings(); } ) instagram.addEventListener("change", () => { - changeProtocolSettings(); - browser.storage.local.set({ - disableInstagram: !enable.checked, - instagramProtocol: protocol.value, - }) + browser.storage.local.set({ disableInstagram: !enable.checked }) }) - -utils.processDefaultCustomInstances('instagram', 'bibliogram', 'normal', document); -utils.processDefaultCustomInstances('instagram', 'bibliogram', 'tor', document); - -utils.latency('instagram', 'bibliogram', document, location) \ No newline at end of file +for (let i = 0; i < frontends.length; i++) { + for (let x = 0; x < protocols.length; x++){ + utils.processDefaultCustomInstances('instagram', frontends[i], protocols[x], document) + } + utils.latency('instagram', frontends[i], document, location) +} diff --git a/src/pages/options/widgets/instagram.pug b/src/pages/options/widgets/instagram.pug index 47cfcdbc..cc72f787 100644 --- a/src/pages/options/widgets/instagram.pug +++ b/src/pages/options/widgets/instagram.pug @@ -7,12 +7,6 @@ section#instagram_page.option-block h4(data-localise="__MSG_enable__") Enable input#instagram-enable(type="checkbox") - .some-block.option-block - h4(data-localise="__MSG_protocol__") Protocol - select#instagram-protocol - option(value="normal" data-localise="__MSG_normal__") Normal - option(value="tor" data-localise="__MSG_tor__") Tor - #bibliogram hr .normal @@ -21,6 +15,13 @@ section#instagram_page.option-block include ../../widgets/latency.pug +latency('bibliogram') .tor + include ../../widgets/instances.pug +instances('https://bibliogram.onion') + .i2p + include ../../widgets/instances.pug + +instances('http://bibliogram.onion') + .loki + include ../../widgets/instances.pug + +instances('http://bibliogram.loki') - script(type="module" src="./widgets/instagram.js") \ No newline at end of file + script(type="module" src="./widgets/instagram.js") diff --git a/src/pages/options/widgets/lbry.js b/src/pages/options/widgets/lbry.js index 131aa566..645017ff 100644 --- a/src/pages/options/widgets/lbry.js +++ b/src/pages/options/widgets/lbry.js @@ -1,44 +1,61 @@ import utils from "../../../assets/javascripts/utils.js"; -const enable = document.getElementById("lbry-enable"); -const protocol = document.getElementById("lbry-protocol") +// UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST + +const frontends = new Array("librarian") +const protocols = new Array("normal", "tor", "i2p", "loki") +const enable = document.getElementById("lbry-enable"); const lbry = document.getElementById('lbry_page'); -const normalDiv = lbry.getElementsByClassName("normal")[0]; -const torDiv = lbry.getElementsByClassName("tor")[0]; +//const frontend = document.getElementById("lbry-frontend"); +let protocol -function changeProtocolSettings() { - if (protocol.value == 'normal') { - normalDiv.style.display = 'block'; - torDiv.style.display = 'none'; +/* +function changeFrontendsSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + if (frontends[i] == frontend.value) { + frontendDiv.style.display = 'block' + } else { + frontendDiv.style.display = 'none' + } } - else if (protocol.value == 'tor') { - normalDiv.style.display = 'none'; - torDiv.style.display = 'block'; +} +*/ + +function changeProtocolSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + for (let x = 0; x < protocols.length; x++) { + const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0] + if (protocols[x] == protocol) { + protocolDiv.style.display = 'block' + } else { + protocolDiv.style.display = 'none' + } + } } } browser.storage.local.get( [ "disableLbryTargets", - "lbryTargetsProtocol" + "protocol" ], r => { enable.checked = !r.disableLbryTargets; - protocol.value = r.lbryTargetsProtocol; + protocol = r.protocol; changeProtocolSettings(); } ) lbry.addEventListener("change", () => { - changeProtocolSettings() - browser.storage.local.set({ - disableLbryTargets: !enable.checked, - lbryTargetsProtocol: protocol.value, - }); + browser.storage.local.set({ disableLbryTargets: !enable.checked }); }) -utils.processDefaultCustomInstances('lbryTargets', 'librarian', 'normal', document); -utils.processDefaultCustomInstances('lbryTargets', 'librarian', 'tor', document); - -utils.latency('lbryTargets', 'librarian', document, location) \ No newline at end of file +for (let i = 0; i < frontends.length; i++) { + for (let x = 0; x < protocols.length; x++){ + utils.processDefaultCustomInstances('lbryTargets', frontends[i], protocols[x], document) + } + utils.latency('lbryTargets', frontends[i], document, location) +} diff --git a/src/pages/options/widgets/lbry.pug b/src/pages/options/widgets/lbry.pug index 4e88d2bf..2bdccb5a 100644 --- a/src/pages/options/widgets/lbry.pug +++ b/src/pages/options/widgets/lbry.pug @@ -6,12 +6,6 @@ section#lbry_page.option-block h4(data-localise="__MSG_enable__") Enable input#lbry-enable(type="checkbox") - .some-block.option-block - h4(data-localise="__MSG_protocol__") Protocol - select#lbry-protocol - option(value="normal" data-localise="__MSG_normal__") Normal - option(value="tor" data-localise="__MSG_tor__") Tor - #librarian hr .normal @@ -22,5 +16,11 @@ section#lbry_page.option-block .tor include ../../widgets/instances.pug +instances('https://librarian.onion') + .i2p + include ../../widgets/instances.pug + +instances('http://librarian.onion') + .loki + include ../../widgets/instances.pug + +instances('http://librarian.loki') - script(type="module" src="./widgets/lbry.js") \ No newline at end of file + script(type="module" src="./widgets/lbry.js") diff --git a/src/pages/options/widgets/maps.js b/src/pages/options/widgets/maps.js index b9825fb0..9e4be6d3 100644 --- a/src/pages/options/widgets/maps.js +++ b/src/pages/options/widgets/maps.js @@ -1,34 +1,64 @@ import utils from "../../../assets/javascripts/utils.js"; +const frontends = new Array("facil") +const protocols = new Array("normal", "tor", "i2p", "loki") + const enable = document.getElementById("maps-enable"); +const maps = document.getElementById('maps_page'); const frontend = document.getElementById("maps-frontend"); +let protocol -const maps = document.getElementById('maps_page'); -const facilDiv = document.getElementById("facil") +function changeProtocolSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + for (let x = 0; x < protocols.length; x++) { + const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0] + if (protocols[x] == protocol) { + protocolDiv.style.display = 'block' + } else { + protocolDiv.style.display = 'none' + } + } + } +} function changeFrontendsSettings() { - if (frontend.value == 'facil') facilDiv.style.display = 'block'; - else if (frontend.value == 'osm') facilDiv.style.display = 'none'; + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + if (frontends[i] == frontend.value) { + frontendDiv.style.display = 'block' + } else { + frontendDiv.style.display = 'none' + } + } } browser.storage.local.get( [ "disableMaps", - "mapsFrontend", + "protocol", + "mapsFrontend" ], r => { enable.checked = !r.disableMaps; + protocol = r.protocol; frontend.value = r.mapsFrontend; changeFrontendsSettings(); + changeProtocolSettings(); } ) maps.addEventListener("change", () => { - changeFrontendsSettings(); browser.storage.local.set({ disableMaps: !enable.checked, - mapsFrontend: frontend.value, - }) + mapsFrontend: frontend.value + }); + changeFrontendsSettings(); }) -utils.processDefaultCustomInstances('maps', 'facil', 'normal', document); \ No newline at end of file +for (let i = 0; i < frontends.length; i++) { + for (let x = 0; x < protocols.length; x++) { + utils.processDefaultCustomInstances('maps', frontends[i], protocols[x], document) + } + utils.latency('maps', frontends[i], document, location) +} diff --git a/src/pages/options/widgets/maps.pug b/src/pages/options/widgets/maps.pug index 42c81d8e..166e6494 100644 --- a/src/pages/options/widgets/maps.pug +++ b/src/pages/options/widgets/maps.pug @@ -18,6 +18,15 @@ section#maps_page.option-block include ../../widgets/instances.pug +instances('https://facilmap.com') include ../../widgets/latency.pug - +latency('facilmap') + +latency('facil') + .tor + +instances('http://facilmap.onion') + include ../../widgets/instances.pug + .i2p + include ../../widgets/instances.pug + +instances('http://facilmap.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://facilmap.loki') - script(type="module" src="./widgets/maps.js") \ No newline at end of file + script(type="module" src="./widgets/maps.js") diff --git a/src/pages/options/widgets/medium.js b/src/pages/options/widgets/medium.js index ef5965be..765a956c 100644 --- a/src/pages/options/widgets/medium.js +++ b/src/pages/options/widgets/medium.js @@ -1,42 +1,61 @@ import utils from "../../../assets/javascripts/utils.js"; +// UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST + +const frontends = new Array("scribe") +const protocols = new Array("normal", "tor", "i2p", "loki") + const enable = document.getElementById("medium-enable"); -const protocol = document.getElementById("medium-protocol") const medium = document.getElementById('medium_page'); +//const frontend = document.getElementById("medium-frontend"); +let protocol -function changeProtocolSettings() { - const normalDiv = medium.getElementsByClassName("normal")[0]; - const torDiv = medium.getElementsByClassName("tor")[0]; - if (protocol.value == 'normal') { - normalDiv.style.display = 'block'; - torDiv.style.display = 'none'; - } - else if (protocol.value == 'tor') { - normalDiv.style.display = 'none'; - torDiv.style.display = 'block'; +/* +function changeFrontendsSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + if (frontends[i] == frontend.value) { + frontendDiv.style.display = 'block' + } else { + frontendDiv.style.display = 'none' + } } } +*/ -medium.addEventListener("change", () => { - changeProtocolSettings(); - browser.storage.local.set({ - disableMedium: !enable.checked, - mediumProtocol: protocol.value, - }) -}) +function changeProtocolSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + for (let x = 0; x < protocols.length; x++) { + const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0] + if (protocols[x] == protocol) { + protocolDiv.style.display = 'block' + } else { + protocolDiv.style.display = 'none' + } + } + } +} browser.storage.local.get( [ "disableMedium", - "mediumProtocol" + "protocol" ], r => { enable.checked = !r.disableMedium; - protocol.value = r.mediumProtocol; + protocol = r.protocol; changeProtocolSettings(); } ) -utils.processDefaultCustomInstances('medium', 'scribe', 'normal', document); -utils.processDefaultCustomInstances('medium', 'scribe', 'tor', document); -utils.latency('medium', 'scribe', document, location) \ No newline at end of file +medium.addEventListener("change", () => { + browser.storage.local.set({ disableMedium: !enable.checked }) +}) + +for (let i = 0; i < frontends.length; i++) { + for (let x = 0; x < protocols.length; x++){ + utils.processDefaultCustomInstances('medium', frontends[i], protocols[x], document) + } + utils.latency('medium', frontends[i], document, location) +} diff --git a/src/pages/options/widgets/medium.pug b/src/pages/options/widgets/medium.pug index f0a1ad55..4eef0511 100644 --- a/src/pages/options/widgets/medium.pug +++ b/src/pages/options/widgets/medium.pug @@ -6,12 +6,6 @@ section#medium_page.option-block h4(data-localise="__MSG_enable__") Enable input#medium-enable(type="checkbox") - .some-block.option-block - h4(data-localise="__MSG_protocol__") Protocol - select#medium-protocol - option(value="normal" data-localise="__MSG_normal__") Normal - option(value="tor" data-localise="__MSG_tor__") Tor - #scribe hr .normal @@ -21,6 +15,12 @@ section#medium_page.option-block +latency('scribe') .tor include ../../widgets/instances.pug - +instances('https://scribe.onion') + +instances('http://scribe.onion') + .i2p + include ../../widgets/instances.pug + +instances('http://scribe.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://scribe.loki') - script(type="module" src="./widgets/medium.js") \ No newline at end of file + script(type="module" src="./widgets/medium.js") diff --git a/src/pages/options/widgets/peertube.js b/src/pages/options/widgets/peertube.js index 01b4f6b5..9e994119 100644 --- a/src/pages/options/widgets/peertube.js +++ b/src/pages/options/widgets/peertube.js @@ -1,42 +1,61 @@ import utils from "../../../assets/javascripts/utils.js"; +// UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST + +const frontends = new Array("simpleertube") +const protocols = new Array("normal", "tor", "i2p", "loki") + const enable = document.getElementById("peertube-enable"); -const protocol = document.getElementById("peertube-protocol"); const peertube = document.getElementById('peertube_page'); +//const frontend = document.getElementById("peertube-frontend"); +let protocol -function changeProtocolSettings() { - const normalDiv = peertube.getElementsByClassName("normal")[0]; - const torDiv = peertube.getElementsByClassName("tor")[0]; - if (protocol.value == 'normal') { - normalDiv.style.display = 'block'; - torDiv.style.display = 'none'; +/* +function changeFrontendsSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + if (frontends[i] == frontend.value) { + frontendDiv.style.display = 'block' + } else { + frontendDiv.style.display = 'none' + } } - else if (protocol.value == 'tor') { - normalDiv.style.display = 'none'; - torDiv.style.display = 'block'; +} +*/ + +function changeProtocolSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + for (let x = 0; x < protocols.length; x++) { + const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0] + if (protocols[x] == protocol) { + protocolDiv.style.display = 'block' + } else { + protocolDiv.style.display = 'none' + } + } } } browser.storage.local.get( [ "disablePeertubeTargets", - "peertubeTargetsProtocol" + "protocol" ], r => { enable.checked = !r.disablePeertubeTargets; - protocol.value = r.peertubeTargetsProtocol; + protocol = r.protocol; changeProtocolSettings(); } ) peertube.addEventListener("change", () => { - changeProtocolSettings(); - browser.storage.local.set({ - disablePeertubeTargets: !enable.checked, - peertubeTargetsProtocol: protocol.value - }) + browser.storage.local.set({ disablePeertubeTargets: !enable.checked }) }) -utils.processDefaultCustomInstances('peertube', 'simpleertube', 'normal', document); -utils.processDefaultCustomInstances('peertube', 'simpleertube', 'tor', document); -utils.latency('peertube', 'simpleertube', document, location) \ No newline at end of file +for (let i = 0; i < frontends.length; i++) { + for (let x = 0; x < protocols.length; x++){ + utils.processDefaultCustomInstances('peertube', frontends[i], protocols[x], document) + } + utils.latency('peertube', frontends[i], document, location) +} diff --git a/src/pages/options/widgets/peertube.pug b/src/pages/options/widgets/peertube.pug index 0beec59c..38690d04 100644 --- a/src/pages/options/widgets/peertube.pug +++ b/src/pages/options/widgets/peertube.pug @@ -6,12 +6,6 @@ section#peertube_page.option-block h4(data-localise="__MSG_enable__") Enable input#peertube-enable(type="checkbox") - .some-block.option-block - h4(data-localise="__MSG_protocol__") Protocol - select#peertube-protocol - option(value="normal" data-localise="__MSG_normal__") Normal - option(value="tor" data-localise="__MSG_tor__") Tor - #simpleertube hr .normal @@ -21,6 +15,12 @@ section#peertube_page.option-block +latency('simpleertube') .tor include ../../widgets/instances.pug - +instances('https://simpleertube.onion') + +instances('http://simpleertube.onion') + .i2p + include ../../widgets/instances.pug + +instances('http://simpleertube.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://simpleertube.loki') - script(type="module" src="./widgets/peertube.js") \ No newline at end of file + script(type="module" src="./widgets/peertube.js") diff --git a/src/pages/options/widgets/quora.js b/src/pages/options/widgets/quora.js index dfa1b6aa..ded21e57 100644 --- a/src/pages/options/widgets/quora.js +++ b/src/pages/options/widgets/quora.js @@ -1,42 +1,61 @@ import utils from "../../../assets/javascripts/utils.js"; +// UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST + +const frontends = new Array("quetre") +const protocols = new Array("normal", "tor", "i2p", "loki") + const enable = document.getElementById("quora-enable"); -const protocol = document.getElementById("quora-protocol") const quora = document.getElementById('quora_page'); +//const frontend = document.getElementById("quora-frontend"); +let protocol -function changeProtocolSettings() { - const normalDiv = quora.getElementsByClassName("normal")[0]; - const torDiv = quora.getElementsByClassName("tor")[0]; - if (protocol.value == 'normal') { - normalDiv.style.display = 'block'; - torDiv.style.display = 'none'; - } - else if (protocol.value == 'tor') { - normalDiv.style.display = 'none'; - torDiv.style.display = 'block'; +/* +function changeFrontendsSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + if (frontends[i] == frontend.value) { + frontendDiv.style.display = 'block' + } else { + frontendDiv.style.display = 'none' + } } } +*/ -quora.addEventListener("change", () => { - changeProtocolSettings(); - browser.storage.local.set({ - disableQuora: !enable.checked, - quoraProtocol: protocol.value, - }) -}) +function changeProtocolSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + for (let x = 0; x < protocols.length; x++) { + const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0] + if (protocols[x] == protocol) { + protocolDiv.style.display = 'block' + } else { + protocolDiv.style.display = 'none' + } + } + } +} browser.storage.local.get( [ "disableQuora", - "quoraProtocol" + "protocol" ], r => { enable.checked = !r.disableQuora; - protocol.value = r.quoraProtocol; + protocol = r.protocol; changeProtocolSettings(); } ) -utils.processDefaultCustomInstances('quora', 'quetre', 'normal', document); -utils.processDefaultCustomInstances('quora', 'quetre', 'tor', document); -utils.latency('quora', 'quetre', document, location) \ No newline at end of file +quora.addEventListener("change", () => { + browser.storage.local.set({ disableQuora: !enable.checked }) +}) + +for (let i = 0; i < frontends.length; i++) { + for (let x = 0; x < protocols.length; x++){ + utils.processDefaultCustomInstances('quora', frontends[i], protocols[x], document) + } + utils.latency('quora', frontends[i], document, location) +} diff --git a/src/pages/options/widgets/quora.pug b/src/pages/options/widgets/quora.pug index 8f5fe639..9e45abc9 100644 --- a/src/pages/options/widgets/quora.pug +++ b/src/pages/options/widgets/quora.pug @@ -6,12 +6,6 @@ section#quora_page.option-block h4(data-localise="__MSG_enable__") Enable input#quora-enable(type="checkbox") - .some-block.option-block - h4(data-localise="__MSG_protocol__") Protocol - select#quora-protocol - option(value="normal" data-localise="__MSG_normal__") Normal - option(value="tor" data-localise="__MSG_tor__") Tor - #quetre hr .normal @@ -21,6 +15,12 @@ section#quora_page.option-block +latency('quetre') .tor include ../../widgets/instances.pug - +instances('https://quetre.onion') + +instances('http://quetre.onion') + .i2p + include ../../widgets/instances.pug + +instances('http://quetre.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://quetre.loki') - script(type="module" src="./widgets/quora.js") \ No newline at end of file + script(type="module" src="./widgets/quora.js") diff --git a/src/pages/options/widgets/reddit.js b/src/pages/options/widgets/reddit.js index 9e4dfedd..a32632d2 100644 --- a/src/pages/options/widgets/reddit.js +++ b/src/pages/options/widgets/reddit.js @@ -1,52 +1,47 @@ import utils from "../../../assets/javascripts/utils.js"; -const libredditDivElement = document.getElementById("libreddit") -const tedditDivElement = document.getElementById("teddit") +const frontends = new Array("libreddit", "teddit") +const protocols = new Array("normal", "tor", "i2p", "loki") const enable = document.getElementById("reddit-enable"); -const frontend = document.getElementById("reddit-frontend"); -const protocol = document.getElementById("reddit-protocol"); const reddit = document.getElementById('reddit_page'); +const frontend = document.getElementById("reddit-frontend"); +let protocol -function changeProtocolSettings() { - const normalLibredditDiv = libredditDivElement.getElementsByClassName("normal")[0]; - const torLibredditDiv = libredditDivElement.getElementsByClassName("tor")[0]; - const normalTedditDiv = tedditDivElement.getElementsByClassName("normal")[0]; - const torTedditDiv = tedditDivElement.getElementsByClassName("tor")[0]; - if (protocol.value == 'normal') { - normalLibredditDiv.style.display = 'block'; - normalTedditDiv.style.display = 'block'; - torTedditDiv.style.display = 'none'; - torLibredditDiv.style.display = 'none'; - } - else if (protocol.value == 'tor') { - normalLibredditDiv.style.display = 'none'; - normalTedditDiv.style.display = 'none'; - torTedditDiv.style.display = 'block'; - torLibredditDiv.style.display = 'block'; +function changeFrontendsSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + if (frontends[i] == frontend.value) { + frontendDiv.style.display = 'block' + } else { + frontendDiv.style.display = 'none' + } } } -function changeFrontendsSettings() { - if (frontend.value == 'libreddit') { - libredditDivElement.style.display = 'block'; - tedditDivElement.style.display = 'none'; - } - else if (frontend.value == 'teddit') { - libredditDivElement.style.display = 'none'; - tedditDivElement.style.display = 'block'; +function changeProtocolSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + for (let x = 0; x < protocols.length; x++) { + const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0] + if (protocols[x] == protocol) { + protocolDiv.style.display = 'block' + } else { + protocolDiv.style.display = 'none' + } + } } } browser.storage.local.get( [ "disableReddit", - "redditProtocol", + "protocol", "redditFrontend", ], r => { enable.checked = !r.disableReddit - protocol.value = r.redditProtocol + protocol = r.protocol frontend.value = r.redditFrontend changeFrontendsSettings(); changeProtocolSettings(); @@ -56,17 +51,14 @@ browser.storage.local.get( reddit.addEventListener("change", () => { browser.storage.local.set({ disableReddit: !enable.checked, - redditProtocol: protocol.value, - redditFrontend: frontend.value, + redditFrontend: frontend.value }); changeFrontendsSettings(); - changeProtocolSettings(); }) -utils.processDefaultCustomInstances('reddit', 'libreddit', 'normal', document); -utils.processDefaultCustomInstances('reddit', 'libreddit', 'tor', document); -utils.processDefaultCustomInstances('reddit', 'teddit', 'normal', document); -utils.processDefaultCustomInstances('reddit', 'teddit', 'tor', document); - -utils.latency('reddit', 'libreddit', document, location, true) -utils.latency('reddit', 'teddit', document, location, true) \ No newline at end of file +for (let i = 0; i < frontends.length; i++) { + for (let x = 0; x < protocols.length; x++){ + utils.processDefaultCustomInstances('reddit', frontends[i], protocols[x], document) + } + utils.latency('reddit', frontends[i], document, location) +} diff --git a/src/pages/options/widgets/reddit.pug b/src/pages/options/widgets/reddit.pug index 74b8d82e..1726f9ce 100644 --- a/src/pages/options/widgets/reddit.pug +++ b/src/pages/options/widgets/reddit.pug @@ -12,12 +12,6 @@ section#reddit_page.option-block option(value="libreddit") Libreddit option(value="teddit") Teddit - .some-block.option-block - h4(data-localise="__MSG_protocol__") Protocol - select#reddit-protocol - option(value="normal" data-localise="__MSG_normal__") Normal - option(value="tor" data-localise="__MSG_tor__") Tor - #libreddit hr .normal @@ -27,7 +21,13 @@ section#reddit_page.option-block +latency('libreddit') .tor include ../../widgets/instances.pug - +instances('https://libreddit.onion') + +instances('http://libreddit.onion') + .i2p + include ../../widgets/instances.pug + +instances('http://libreddit.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://libreddit.loki') #teddit hr @@ -37,6 +37,12 @@ section#reddit_page.option-block +latency('teddit') .tor include ../../widgets/instances.pug - +instances('https://teddit.onion') + +instances('http://teddit.onion') + .i2p + include ../../widgets/instances.pug + +instances('http://teddit.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://teddit.loki') - script(type="module" src="./widgets/reddit.js") \ No newline at end of file + script(type="module" src="./widgets/reddit.js") diff --git a/src/pages/options/widgets/reuters.js b/src/pages/options/widgets/reuters.js index 08e8f988..297e3e70 100644 --- a/src/pages/options/widgets/reuters.js +++ b/src/pages/options/widgets/reuters.js @@ -1,43 +1,61 @@ import utils from "../../../assets/javascripts/utils.js"; +// UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST + +const frontends = new Array("neuters") +const protocols = new Array("normal", "tor", "i2p", "loki") + const enable = document.getElementById("reuters-enable"); -const protocol = document.getElementById("reuters-protocol") const reuters = document.getElementById('reuters_page'); +//const frontend = document.getElementById("reuters-frontend"); +let protocol -function changeProtocolSettings() { - const normalDiv = reuters.getElementsByClassName("normal")[0]; - const torDiv = reuters.getElementsByClassName("tor")[0]; - if (protocol.value == 'normal') { - - normalDiv.style.display = 'block'; - torDiv.style.display = 'none'; - } - else if (protocol.value == 'tor') { - normalDiv.style.display = 'none'; - torDiv.style.display = 'block'; +/* +function changeFrontendsSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + if (frontends[i] == frontend.value) { + frontendDiv.style.display = 'block' + } else { + frontendDiv.style.display = 'none' + } } } +*/ -reuters.addEventListener("change", () => { - changeProtocolSettings(); - browser.storage.local.set({ - disableReuters: !enable.checked, - reutersProtocol: protocol.value, - }) -}) +function changeProtocolSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + for (let x = 0; x < protocols.length; x++) { + const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0] + if (protocols[x] == protocol) { + protocolDiv.style.display = 'block' + } else { + protocolDiv.style.display = 'none' + } + } + } +} browser.storage.local.get( [ "disableReuters", - "reutersProtocol" + "protocol" ], r => { enable.checked = !r.disableReuters; - protocol.value = r.reutersProtocol; + protocol = r.protocol; changeProtocolSettings(); } ) -utils.processDefaultCustomInstances('reuters', 'neuters', 'normal', document); -utils.processDefaultCustomInstances('reuters', 'neuters', 'tor', document); -utils.latency('reuters', 'neuters', document, location) \ No newline at end of file +reuters.addEventListener("change", () => { + browser.storage.local.set({ disableReuters: !enable.checked }) +}) + +for (let i = 0; i < frontends.length; i++) { + for (let x = 0; x < protocols.length; x++){ + utils.processDefaultCustomInstances('reuters', frontends[i], protocols[x], document) + } + utils.latency('reuters', frontends[i], document, location) +} diff --git a/src/pages/options/widgets/reuters.pug b/src/pages/options/widgets/reuters.pug index c1a1ee43..08a37d50 100644 --- a/src/pages/options/widgets/reuters.pug +++ b/src/pages/options/widgets/reuters.pug @@ -6,12 +6,6 @@ section#reuters_page.option-block h4(data-localise="__MSG_enable__") Enable input#reuters-enable(type="checkbox") - .some-block.option-block - h4(data-localise="__MSG_protocol__") Protocol - select#reuters-protocol - option(value="normal" data-localise="__MSG_normal__") Normal - option(value="tor" data-localise="__MSG_tor__") Tor - #neuters hr .normal @@ -21,6 +15,12 @@ section#reuters_page.option-block +latency('neuters') .tor include ../../widgets/instances.pug - +instances('https://neuters.onion') + +instances('http://neuters.onion') + .i2p + include ../../widgets/instances.pug + +instances('http://neuters.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://neuters.loki') - script(type="module" src="./widgets/reuters.js") \ No newline at end of file + script(type="module" src="./widgets/reuters.js") diff --git a/src/pages/options/widgets/search.js b/src/pages/options/widgets/search.js index 62b8bd78..7cadf143 100644 --- a/src/pages/options/widgets/search.js +++ b/src/pages/options/widgets/search.js @@ -1,39 +1,111 @@ import utils from "../../../assets/javascripts/utils.js"; +// GOAL: to never mention frontends/protocls outside these two arrays, so that adding a new frontend/protocol is as easy as adding it here. +// This may be expanded across the whole project, where almost everything becomes a template, and the frontend/protocol parts just become a JSON file. + +// ONCE FINISHED: add librex and see if it works +const frontends = new Array("searx", "searxng", "whoogle", "librex") // Add librex once /javascripts/search.js is made agnostic +const protocols = new Array("normal", "tor", "i2p", "loki") +//let frontendProtocols = (frontends.length) + +// I will leave comments of my privious attemps so that people can learn from my mistakes. :) + +/* +for (let i = 0; i < frontends.length; i++) { + this.frontends[i] = frontends[i].getElementsByClassName(protocol) +} +*/ + // There was a class here, but I deleted a bit of it + /* + this.searxDiv = searxDiv.getElementsByClassName(protocol)[0]; + this.searxngDiv = searxngDiv.getElementsByClassName(protocol)[0]; + this.librexDiv = librexDiv.getElementsByClassName(protocol)[0]; + */ + +/* + * Here I was trying to solve the issue by making a 2D array, but I later realised I was overcomplicating things +for (var i = 0; i < frontends.length; i++) { + frontendProtocols[i] = new Array(protocols.length) +} +*/ + +/* const searxDiv = document.getElementById("searx"); const searxngDiv = document.getElementById("searxng"); const whoogleDiv = document.getElementById("whoogle"); +*/ const enable = document.getElementById("search-enable"); +const search = document.getElementById('search_page'); const frontend = document.getElementById("search-frontend"); -const protocol = document.getElementById("search-protocol"); +let protocol -const search = document.getElementById('search_page'); +function changeFrontendsSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + if (frontends[i] == frontend.value) { + frontendDiv.style.display = 'block' + } else { + frontendDiv.style.display = 'none' + } + } -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'; + librexDiv.style.display = 'none'; } else if (frontend.value == 'searxng') { searxDiv.style.display = 'none'; searxngDiv.style.display = 'block'; whoogleDiv.style.display = 'none'; - SearxWhoogleElement.style.display = 'block'; + librexDiv.style.display = 'none'; } else if (frontend.value == 'whoogle') { searxDiv.style.display = 'none'; searxngDiv.style.display = 'none'; whoogleDiv.style.display = 'block'; - SearxWhoogleElement.style.display = 'block'; + librexDiv.style.display = 'none'; + } + else if (frontend.value == 'librex') { + searxDiv.style.display = 'none'; + searxDiv.style.display = 'none'; + searxngDiv.style.display = 'none'; + librexDiv.style.display = 'block'; } + */ } + + function changeProtocolSettings() { + + + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + //if (frontends[i] == frontend.value) { // Here we are checking if the frontend matches the current one. This skips the protocol checking for that frontend, speeding things up. I no longer do this as protocol setting is only set once in the ui so every frontend needs to get their protocols setup immidiately. + for (let x = 0; x < protocols.length; x++) { + const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0] + if (protocols[x] == protocol) { //if the frontend value equals the selected one, it will show. Otherwise, it will be hidden + protocolDiv.style.display = 'block' + } else { + protocolDiv.style.display = 'none' + } + } + /* + } else { + continue + } + */ + } + + + +/* + * "Legacy" code const normalsearxDiv = searxDiv.getElementsByClassName("normal")[0]; const torsearxDiv = searxDiv.getElementsByClassName("tor")[0]; const i2psearxDiv = searxDiv.getElementsByClassName("i2p")[0]; @@ -42,10 +114,18 @@ function changeProtocolSettings() { const torsearxngDiv = searxngDiv.getElementsByClassName("tor")[0]; const i2psearxngDiv = searxngDiv.getElementsByClassName("i2p")[0]; - const normalwhoogleDiv = whoogleDiv.getElementsByClassName("normal")[0]; const torwhoogleDiv = whoogleDiv.getElementsByClassName("tor")[0]; const i2pwhoogleDiv = whoogleDiv.getElementsByClassName("i2p")[0]; + const normalwhoogleDiv = whoogleDiv.getElementsByClassName("normal")[0]; + + + function protocolDisplay(proto) { + proto.searxngDiv = 'block' + } + protocolDisplay(protocol.value) + + if (protocol.value == 'normal') { normalsearxDiv.style.display = 'block'; normalsearxngDiv.style.display = 'block'; @@ -85,34 +165,42 @@ function changeProtocolSettings() { i2psearxngDiv.style.display = 'block'; i2pwhoogleDiv.style.display = 'block'; } + */ } browser.storage.local.get( [ "disableSearch", "searchFrontend", - "searchProtocol", + "protocol", ], r => { enable.checked = !r.disableSearch; frontend.value = r.searchFrontend; - protocol.value = r.searchProtocol; + protocol = r.protocol; changeFrontendsSettings(); changeProtocolSettings(); } ); +for (let i = 0; i < frontends.length; i++) { + for (let x = 0; x < protocols.length; x++){ + utils.processDefaultCustomInstances('search', frontends[i], protocols[x], document) + } + utils.latency('search', frontends[i], document, location) +} + search.addEventListener("change", () => { browser.storage.local.set({ disableSearch: !enable.checked, searchFrontend: frontend.value, - searchProtocol: protocol.value, }); - changeFrontendsSettings(frontend.value); - changeProtocolSettings(protocol.value); + changeFrontendsSettings(); }) +/* + * more "legacy" code utils.processDefaultCustomInstances('search', 'searx', 'normal', document); utils.processDefaultCustomInstances('search', 'searx', 'tor', document); utils.processDefaultCustomInstances('search', 'searx', 'i2p', document); @@ -126,3 +214,4 @@ 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/widgets/search.pug b/src/pages/options/widgets/search.pug index 7e16e74f..8f23350e 100644 --- a/src/pages/options/widgets/search.pug +++ b/src/pages/options/widgets/search.pug @@ -1,4 +1,3 @@ - section#search_page.option-block .some-block.option-block h1(data-localise="__MSG_search__") Search @@ -13,17 +12,10 @@ section#search_page.option-block 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#search-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 + option(value="librex") LibreX .some-block - h4(data-localise="__MSG_searchNote__") Note: To use Search to its full potential, make LibRedirect as the Default Search Engine + h4(data-localise="__MSG_searchNote__") Note: To use Search, make LibRedirect the Default Search Engine #searx hr @@ -34,10 +26,13 @@ section#search_page.option-block +latency('searx') .tor include ../../widgets/instances.pug - +instances('https://searx.onion') + +instances('http://searx.onion') .i2p include ../../widgets/instances.pug - +instances('https://searx.i2p') + +instances('http://searx.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://searx.loki') #searxng hr @@ -47,10 +42,13 @@ section#search_page.option-block +latency('searxng') .tor include ../../widgets/instances.pug - +instances('https://searxng.onion') + +instances('http://searxng.onion') .i2p include ../../widgets/instances.pug - +instances('https://searxng.i2p') + +instances('http://searxng.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://searxng.loki') #whoogle hr @@ -60,9 +58,28 @@ section#search_page.option-block +latency('whoogle') .tor include ../../widgets/instances.pug - +instances('https://whoogle.onion') + +instances('http://whoogle.onion') + .i2p + include ../../widgets/instances.pug + +instances('http://whoogle.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://whoogle.loki') + + #librex + hr + .normal + include ../../widgets/instances.pug + +instances('https://librex.com') + +latency('librex') + .tor + include ../../widgets/instances.pug + +instances('http://librex.onion') .i2p include ../../widgets/instances.pug - +instances('https://whoogle.i2p') + +instances('http://librex.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://librex.loki') - script(type="module" src="./widgets/search.js") \ No newline at end of file + script(type="module" src="./widgets/search.js") diff --git a/src/pages/options/widgets/sendTargets.js b/src/pages/options/widgets/sendTargets.js index 1cb1e74e..27c90d4e 100644 --- a/src/pages/options/widgets/sendTargets.js +++ b/src/pages/options/widgets/sendTargets.js @@ -1,43 +1,61 @@ import utils from "../../../assets/javascripts/utils.js"; +// UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST + +const frontends = new Array("send") +const protocols = new Array("normal", "tor", "i2p", "loki") + const enable = document.getElementById("sendTargets-enable"); -const protocol = document.getElementById("sendTargets-protocol") const sendTargets = document.getElementById('sendTargets_page'); +//const frontend = document.getElementById("sendTargets-frontend"); +let protocol -function changeProtocolSettings() { - let normalDiv = sendTargets.getElementsByClassName("normal")[0]; - let torDiv = sendTargets.getElementsByClassName("tor")[0]; - if (protocol.value == 'normal') { - normalDiv.style.display = 'block'; - torDiv.style.display = 'none'; +/* +function changeFrontendsSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + if (frontends[i] == frontend.value) { + frontendDiv.style.display = 'block' + } else { + frontendDiv.style.display = 'none' + } } - else if (protocol.value == 'tor') { - normalDiv.style.display = 'none'; - torDiv.style.display = 'block'; +} +*/ + +function changeProtocolSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + for (let x = 0; x < protocols.length; x++) { + const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0] + if (protocols[x] == protocol) { + protocolDiv.style.display = 'block' + } else { + protocolDiv.style.display = 'none' + } + } } } browser.storage.local.get( [ "disableSendTarget", - "sendTargetsProtocol", + "protocol" ], r => { enable.checked = !r.disableSendTarget; - protocol.value = r.sendTargetsProtocol; + protocol = r.protocol; changeProtocolSettings(); } ) sendTargets.addEventListener("change", () => { - changeProtocolSettings(); - browser.storage.local.set({ - disableSendTarget: !enable.checked, - sendTargetsProtocol: protocol.value, - }) + browser.storage.local.set({ disableSendTarget: !enable.checked }) }) -utils.processDefaultCustomInstances('sendTargets', 'send', 'normal', document); -utils.processDefaultCustomInstances('sendTargets', 'send', 'tor', document); - -utils.latency('sendTargets', 'send', document, location) \ No newline at end of file +for (let i = 0; i < frontends.length; i++) { + for (let x = 0; x < protocols.length; x++){ + utils.processDefaultCustomInstances('sendTargets', frontends[i], protocols[x], document) + } + utils.latency('sendTargets', frontends[i], document, location) +} diff --git a/src/pages/options/widgets/sendTargets.pug b/src/pages/options/widgets/sendTargets.pug index 5b776b0a..fc2e9e73 100644 --- a/src/pages/options/widgets/sendTargets.pug +++ b/src/pages/options/widgets/sendTargets.pug @@ -6,12 +6,6 @@ section#sendTargets_page.option-block h4(data-localise="__MSG_enable__") Enable input#sendTargets-enable(type="checkbox") - .some-block.option-block - h4(data-localise="__MSG_protocol__") Protocol - select#sendTargets-protocol - option(value="normal" data-localise="__MSG_normal__") Normal - option(value="tor" data-localise="__MSG_tor__") Tor - #send hr .normal @@ -21,6 +15,12 @@ section#sendTargets_page.option-block +latency('send') .tor include ../../widgets/instances.pug - +instances('https://send.onion') + +instances('http://send.onion') + .i2p + include ../../widgets/instances.pug + +instances('http://send.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://send.loki') - script(type="module" src="./widgets/sendTargets.js") \ No newline at end of file + script(type="module" src="./widgets/sendTargets.js") diff --git a/src/pages/options/widgets/tiktok.js b/src/pages/options/widgets/tiktok.js index f4c31832..37c36366 100644 --- a/src/pages/options/widgets/tiktok.js +++ b/src/pages/options/widgets/tiktok.js @@ -1,53 +1,61 @@ import utils from "../../../assets/javascripts/utils.js"; +// UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST + +const frontends = new Array("proxiTok") +const protocols = new Array("normal", "tor", "i2p", "loki") + const enable = document.getElementById("tiktok-enable"); -const protocol = document.getElementById("tiktok-protocol") const tiktok = document.getElementById('tiktok_page'); +//const frontend = document.getElementById("tiktok-frontend"); +let protocol -function changeProtocolSettings() { - let normalDiv = tiktok.getElementsByClassName("normal")[0]; - let torDiv = tiktok.getElementsByClassName("tor")[0]; - if (protocol.value == 'normal') { - normalDiv.style.display = 'block'; - torDiv.style.display = 'none'; - } - else if (protocol.value == 'tor') { - normalDiv.style.display = 'none'; - torDiv.style.display = 'block'; +/* +function changeFrontendsSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + if (frontends[i] == frontend.value) { + frontendDiv.style.display = 'block' + } else { + frontendDiv.style.display = 'none' + } } } +*/ -tiktok.addEventListener("change", () => { - browser.storage.local.set({ - disableTiktok: !enable.checked, - tiktokProtocol: protocol.value, - }); - changeProtocolSettings(); -}) +function changeProtocolSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + for (let x = 0; x < protocols.length; x++) { + const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0] + if (protocols[x] == protocol) { + protocolDiv.style.display = 'block' + } else { + protocolDiv.style.display = 'none' + } + } + } +} browser.storage.local.get( [ "disableTiktok", - "tiktokProtocol", + "protocol" ], r => { enable.checked = !r.disableTiktok; - protocol.value = r.tiktokProtocol; + protocol = r.protocol; changeProtocolSettings(); - let normalDiv = document.getElementsByClassName("normal")[0]; - let torDiv = document.getElementsByClassName("tor")[0]; - if (r.tiktokProtocol == 'normal') { - normalDiv.style.display = 'block'; - torDiv.style.display = 'none'; - } - else if (r.tiktokProtocol == 'tor') { - normalDiv.style.display = 'none'; - torDiv.style.display = 'block'; - } - } + } ) -utils.processDefaultCustomInstances('tiktok', 'proxiTok', 'normal', document); -utils.processDefaultCustomInstances('tiktok', 'proxiTok', 'tor', document); +tiktok.addEventListener("change", () => { + browser.storage.local.set({ disableTiktok: !enable.checked }); +}) -utils.latency('tiktok', 'proxiTok', document, location) \ No newline at end of file +for (let i = 0; i < frontends.length; i++) { + for (let x = 0; x < protocols.length; x++){ + utils.processDefaultCustomInstances('tiktok', frontends[i], protocols[x], document) + } + utils.latency('tiktok', frontends[i], document, location) +} diff --git a/src/pages/options/widgets/tiktok.pug b/src/pages/options/widgets/tiktok.pug index f0cc39c6..29ab5e2a 100644 --- a/src/pages/options/widgets/tiktok.pug +++ b/src/pages/options/widgets/tiktok.pug @@ -6,12 +6,6 @@ section#tiktok_page.option-block h4(data-localise="__MSG_enable__") Enable input#tiktok-enable(type="checkbox") - .some-block.option-block - h4(data-localise="__MSG_protocol__") Protocol - select#tiktok-protocol - option(value="normal" data-localise="__MSG_normal__") Normal - option(value="tor" data-localise="__MSG_tor__") Tor - #proxiTok hr .normal @@ -21,6 +15,12 @@ section#tiktok_page.option-block +latency('proxiTok') .tor include ../../widgets/instances.pug - +instances('https://proxitok.onion') + +instances('http://proxitok.onion') + .i2p + include ../../widgets/instances.pug + +instances('http://proxitok.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://proxitok.loki') script(type="module" src="./widgets/tiktok.js") diff --git a/src/pages/options/widgets/translate.js b/src/pages/options/widgets/translate.js index 04869b63..87b8bb8d 100644 --- a/src/pages/options/widgets/translate.js +++ b/src/pages/options/widgets/translate.js @@ -1,64 +1,35 @@ import utils from "../../../assets/javascripts/utils.js"; -const enable = document.getElementById("translate-enable"); -const frontend = document.getElementById("translate-frontend"); -const protocol = document.getElementById("translate-protocol"); -const simplyTranslateDiv = document.getElementById("simplyTranslate"); -const lingvaDiv = document.getElementById("lingva"); +const frontends = new Array("simplyTranslate", "lingva") +const protocols = new Array("normal", "tor", "i2p", "loki") +const enable = document.getElementById("translate-enable"); const translate = document.getElementById('translate_page'); +const frontend = document.getElementById("translate-frontend"); +let protocol function changeFrontendsSettings() { - if (frontend.value == 'simplyTranslate') { - simplyTranslateDiv.style.display = 'block'; - lingvaDiv.style.display = 'none'; - } - else if (frontend.value == 'lingva') { - simplyTranslateDiv.style.display = 'none'; - lingvaDiv.style.display = 'block'; + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + if (frontends[i] == frontend.value) { + frontendDiv.style.display = 'block' + } else { + frontendDiv.style.display = 'none' + } } } function changeProtocolSettings() { - const normalSimplyTranslateDiv = document.getElementById("simplyTranslate").getElementsByClassName("normal")[0]; - const torSimplyTranslateDiv = document.getElementById("simplyTranslate").getElementsByClassName("tor")[0]; - const i2pSimplyTranslateDiv = document.getElementById("simplyTranslate").getElementsByClassName("i2p")[0]; - const lokiSimplyTranslateDiv = document.getElementById("simplyTranslate").getElementsByClassName("loki")[0]; - - const normalLingvaDiv = document.getElementById("lingva").getElementsByClassName("normal")[0]; - const torLingvaDiv = document.getElementById("lingva").getElementsByClassName("tor")[0]; - - if (protocol.value == 'normal') { - normalSimplyTranslateDiv.style.display = 'block'; - normalLingvaDiv.style.display = 'block'; - torSimplyTranslateDiv.style.display = 'none'; - torLingvaDiv.style.display = 'none'; - i2pSimplyTranslateDiv.style.display = 'none'; - lokiSimplyTranslateDiv.style.display = 'none'; - } - else if (protocol.value == 'tor') { - normalSimplyTranslateDiv.style.display = 'none'; - normalLingvaDiv.style.display = 'none'; - torSimplyTranslateDiv.style.display = 'block'; - torLingvaDiv.style.display = 'block'; - i2pSimplyTranslateDiv.style.display = 'none'; - lokiSimplyTranslateDiv.style.display = 'none'; - } - else if (protocol.value == 'i2p') { - normalSimplyTranslateDiv.style.display = 'none'; - normalLingvaDiv.style.display = 'none'; - torSimplyTranslateDiv.style.display = 'none'; - torLingvaDiv.style.display = 'none'; - i2pSimplyTranslateDiv.style.display = 'block'; - lokiSimplyTranslateDiv.style.display = 'none'; - } - else if (protocol.value == 'loki') { - normalSimplyTranslateDiv.style.display = 'none'; - normalLingvaDiv.style.display = 'none'; - torSimplyTranslateDiv.style.display = 'none'; - torLingvaDiv.style.display = 'none'; - i2pSimplyTranslateDiv.style.display = 'none'; - lokiSimplyTranslateDiv.style.display = 'block'; + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + for (let x = 0; x < protocols.length; x++) { + const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0] + if (protocols[x] == protocol) { + protocolDiv.style.display = 'block' + } else { + protocolDiv.style.display = 'none' + } + } } } @@ -66,12 +37,12 @@ browser.storage.local.get( [ "translateDisable", "translateFrontend", - "translateProtocol", + "protocol" ], r => { enable.checked = !r.translateDisable; frontend.value = r.translateFrontend; - protocol.value = r.translateProtocol; + protocol = r.protocol; changeFrontendsSettings(); changeProtocolSettings(); } @@ -81,19 +52,13 @@ translate.addEventListener("change", () => { browser.storage.local.set({ translateDisable: !enable.checked, translateFrontend: frontend.value, - translateProtocol: protocol.value, }) - changeProtocolSettings(); changeFrontendsSettings(); }) - -utils.processDefaultCustomInstances('translate', 'simplyTranslate', 'normal', document); -utils.processDefaultCustomInstances('translate', 'simplyTranslate', 'tor', document); -utils.processDefaultCustomInstances('translate', 'simplyTranslate', 'i2p', document); -utils.processDefaultCustomInstances('translate', 'simplyTranslate', 'loki', document); -utils.processDefaultCustomInstances('translate', 'lingva', 'normal', document); -utils.processDefaultCustomInstances('translate', 'lingva', 'tor', document); - -utils.latency('translate', 'simplyTranslate', document, location, true) -utils.latency('translate', 'lingva', document, location, true) +for (let i = 0; i < frontends.length; i++) { + for (let x = 0; x < protocols.length; x++){ + utils.processDefaultCustomInstances('translate', frontends[i], protocols[x], document) + } + utils.latency('translate', frontends[i], document, location) +} diff --git a/src/pages/options/widgets/translate.pug b/src/pages/options/widgets/translate.pug index c29d75e1..4836c0f3 100644 --- a/src/pages/options/widgets/translate.pug +++ b/src/pages/options/widgets/translate.pug @@ -12,14 +12,6 @@ section#translate_page.option-block option(value="simplyTranslate") SimplyTranslate option(value="lingva") Lingva - .some-block.option-block - h4(data-localise="__MSG_protocol__") Protocol - select#translate-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 - option(value="loki" data-localise="__MSG_loki__") Lokinet - hr #simplyTranslate .normal @@ -44,6 +36,13 @@ section#translate_page.option-block +latency('lingva') .tor include ../../widgets/instances.pug - +instances('http://tyzxppdeoojdnaux.onion') + +instances('http://lingvatranslate.onion') + .i2p + include ../../widgets/instances.pug + +instances('http://lingvatranslate.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://lingvatranslate.loki') + script(type="module" src="./widgets/translate.js") diff --git a/src/pages/options/widgets/twitter.js b/src/pages/options/widgets/twitter.js index aff108c8..d54fc928 100644 --- a/src/pages/options/widgets/twitter.js +++ b/src/pages/options/widgets/twitter.js @@ -1,32 +1,52 @@ import utils from "../../../assets/javascripts/utils.js"; +// UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST + +const frontends = new Array("nitter") +const protocols = new Array("normal", "tor", "i2p", "loki") + const enable = document.getElementById("twitter-enable"); -const protocol = document.getElementById("twitter-protocol"); -const redirectType = document.getElementById("twitter-redirect_type"); const twitter = document.getElementById('twitter_page'); +const redirectType = document.getElementById("twitter-redirect_type"); +//const frontend = document.getElementById("twitter-frontend"); +let protocol -function changeProtocolSettings() { - let normalDiv = twitter.getElementsByClassName("normal")[0]; - let torDiv = twitter.getElementsByClassName("tor")[0]; - if (protocol.value == 'normal') { - normalDiv.style.display = 'block'; - torDiv.style.display = 'none'; +/* +function changeFrontendsSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + if (frontends[i] == frontend.value) { + frontendDiv.style.display = 'block' + } else { + frontendDiv.style.display = 'none' + } } - else if (protocol.value == 'tor') { - normalDiv.style.display = 'none'; - torDiv.style.display = 'block'; +} +*/ + +function changeProtocolSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + for (let x = 0; x < protocols.length; x++) { + const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0] + if (protocols[x] == protocol) { + protocolDiv.style.display = 'block' + } else { + protocolDiv.style.display = 'none' + } + } } } browser.storage.local.get( [ "disableTwitter", - "twitterProtocol", - "twitterRedirectType", + "protocol", + "twitterRedirectType" ], r => { enable.checked = !r.disableTwitter; - protocol.value = r.twitterProtocol; + protocol = r.protocol; redirectType.value = r.twitterRedirectType; changeProtocolSettings(); } @@ -35,13 +55,13 @@ browser.storage.local.get( twitter.addEventListener("change", () => { browser.storage.local.set({ disableTwitter: !enable.checked, - twitterProtocol: protocol.value, twitterRedirectType: redirectType.value, }); - changeProtocolSettings(); }) -utils.processDefaultCustomInstances('twitter', 'nitter', 'normal', document); -utils.processDefaultCustomInstances('twitter', 'nitter', 'tor', document) - -utils.latency('twitter', 'nitter', document, location, true) \ No newline at end of file +for (let i = 0; i < frontends.length; i++) { + for (let x = 0; x < protocols.length; x++){ + utils.processDefaultCustomInstances('twitter', frontends[i], protocols[x], document) + } + utils.latency('twitter', frontends[i], document, location) +} diff --git a/src/pages/options/widgets/twitter.pug b/src/pages/options/widgets/twitter.pug index c2e949ca..6e610545 100644 --- a/src/pages/options/widgets/twitter.pug +++ b/src/pages/options/widgets/twitter.pug @@ -7,12 +7,6 @@ section#twitter_page.option-block input#twitter-enable(type="checkbox") .some-block.option-block - h4(data-localise="__MSG_protocol__") Protocol - select#twitter-protocol - option(value="normal" data-localise="__MSG_normal__") Normal - option(value="tor" data-localise="__MSG_tor__") Tor - - .some-block.option-block h4(data-localise="__MSG_redirectType__") Redirect Type select#twitter-redirect_type option(value="both" data-localise="__MSG_both__") both @@ -27,6 +21,13 @@ section#twitter_page.option-block include ../../widgets/latency.pug +latency('nitter') .tor - +instances('https://nitter.onion') + include ../../widgets/instances.pug + +instances('http://nitter.onion') + .i2p + include ../../widgets/instances.pug + +instances('http://nitter.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://nitter.loki') script(type="module" src="./widgets/twitter.js") diff --git a/src/pages/options/widgets/wikipedia.js b/src/pages/options/widgets/wikipedia.js index c9e582be..09b21d02 100644 --- a/src/pages/options/widgets/wikipedia.js +++ b/src/pages/options/widgets/wikipedia.js @@ -1,52 +1,61 @@ import utils from "../../../assets/javascripts/utils.js"; +// UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST + +const frontends = new Array("wikiless") +const protocols = new Array("normal", "tor", "i2p", "loki") + const enable = document.getElementById("wikipedia-enable"); -const protocolElement = document.getElementById("wikipedia-protocol"); const wikipedia = document.getElementById('wikipedia_page'); +//const frontend = document.getElementById("wikipedia-frontend"); +let protocol -function changeProtocolSettings(protocol) { - const normalDiv = wikipedia.getElementsByClassName("normal")[0]; - const torDiv = wikipedia.getElementsByClassName("tor")[0]; - const i2pDiv = wikipedia.getElementsByClassName("i2p")[0]; - if (protocol == 'normal') { - normalDiv.style.display = 'block'; - torDiv.style.display = 'none'; - i2pDiv.style.display = 'none'; +/* +function changeFrontendsSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + if (frontends[i] == frontend.value) { + frontendDiv.style.display = 'block' + } else { + frontendDiv.style.display = 'none' + } } - else if (protocol == 'tor') { - normalDiv.style.display = 'none'; - torDiv.style.display = 'block'; - i2pDiv.style.display = 'none'; - } - else if (protocol == 'i2p') { - normalDiv.style.display = 'none'; - torDiv.style.display = 'none'; - i2pDiv.style.display = 'block'; +} +*/ + +function changeProtocolSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + for (let x = 0; x < protocols.length; x++) { + const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0] + if (protocols[x] == protocol) { + protocolDiv.style.display = 'block' + } else { + protocolDiv.style.display = 'none' + } + } } } browser.storage.local.get( [ "disableWikipedia", - "wikipediaProtocol", + "protocol" ], r => { enable.checked = !r.disableWikipedia; - protocolElement.value = r.wikipediaProtocol; - changeProtocolSettings(r.wikipediaProtocol); + protocol = r.protocol; + changeProtocolSettings(); } ) wikipedia.addEventListener("change", () => { - browser.storage.local.set({ - disableWikipedia: !enable.checked, - wikipediaProtocol: protocolElement.value, - }) - changeProtocolSettings(protocolElement.value) + browser.storage.local.set({ disableWikipedia: !enable.checked }) }) -utils.processDefaultCustomInstances('wikipedia', 'wikiless', 'normal', document); -utils.processDefaultCustomInstances('wikipedia', 'wikiless', 'tor', document); -utils.processDefaultCustomInstances('wikipedia', 'wikiless', 'i2p', document); - -utils.latency('wikipedia', 'wikiless', document, location) \ No newline at end of file +for (let i = 0; i < frontends.length; i++) { + for (let x = 0; x < protocols.length; x++) { + utils.processDefaultCustomInstances('wikipedia', frontends[i], protocols[x], document) + } + utils.latency('wikipedia', frontends[i], document, location) +} diff --git a/src/pages/options/widgets/wikipedia.pug b/src/pages/options/widgets/wikipedia.pug index a0315739..c9aee64c 100644 --- a/src/pages/options/widgets/wikipedia.pug +++ b/src/pages/options/widgets/wikipedia.pug @@ -6,13 +6,6 @@ section#wikipedia_page.option-block h4(data-localise="__MSG_enable__") Enable input#wikipedia-enable(type="checkbox") - .some-block.option-block - h4(data-localise="__MSG_protocol__") Protocol - select#wikipedia-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 - #wikiless hr .normal @@ -22,10 +15,12 @@ section#wikipedia_page.option-block +latency('wikiless') .tor include ../../widgets/instances.pug - +instances('https://wikiless.onion') - + +instances('http://wikiless.onion') .i2p include ../../widgets/instances.pug +instances('https://wikiless.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://wikiless.loki') script(type="module" src="./widgets/wikipedia.js") diff --git a/src/pages/options/widgets/youtube.js b/src/pages/options/widgets/youtube.js index 26867643..76b673bd 100644 --- a/src/pages/options/widgets/youtube.js +++ b/src/pages/options/widgets/youtube.js @@ -1,114 +1,66 @@ -import youtubeHelper from "../../../assets/javascripts/youtube/youtube.js"; import utils from "../../../assets/javascripts/utils.js"; +const frontends = new Array("invidious", "piped", "pipedMaterial") +const protocols = new Array("normal", "tor", "i2p", "loki") +const singleInstanceFrontends = new Array("freetube", "yatte") + const enable = document.getElementById("youtube-enable"); -const frontend = document.getElementById("youtube-frontend"); +const youtube = document.getElementById('youtube_page'); const youtubeEmbedFrontend = document.getElementById("youtube-embed_frontend"); const onlyEmbeddedVideo = document.getElementById("youtube-redirect_type"); -const protocol = document.getElementById("youtube-protocol"); -const youtube = document.getElementById('youtube_page'); - -const invidiousDiv = document.getElementById("invidious"); -const pipedDiv = document.getElementById("piped"); -const pipedMaterialDiv = document.getElementById("pipedMaterial"); -const freetubeYatteeDiv = document.getElementById("freetube-yatte"); +const embeddedFrontendDiv = document.getElementById("youtube-embedded_frontend"); +const frontend = document.getElementById("youtube-frontend"); +let protocol -function changeFrontendsSettings() { - if (frontend.value == 'invidious') { - invidiousDiv.style.display = 'block'; - pipedDiv.style.display = 'none'; - pipedMaterialDiv.style.display = 'none'; - freetubeYatteeDiv.style.display = 'none'; - } - else if (frontend.value == 'piped') { - invidiousDiv.style.display = 'none'; - pipedDiv.style.display = 'block'; - pipedMaterialDiv.style.display = 'none'; - freetubeYatteeDiv.style.display = 'none'; - } - else if (frontend.value == 'pipedMaterial') { - invidiousDiv.style.display = 'none'; - pipedDiv.style.display = 'none'; - pipedMaterialDiv.style.display = 'block'; - freetubeYatteeDiv.style.display = 'none'; - } - else if (frontend.value == 'freetube' || frontend.value == 'yatte') { - invidiousDiv.style.display = 'none'; - pipedDiv.style.display = 'none'; - pipedMaterialDiv.style.display = 'none'; - freetubeYatteeDiv.style.display = 'block'; - changeYoutubeEmbedFrontendsSettings(); +function changeProtocolSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + for (let x = 0; x < protocols.length; x++) { + const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0] + if (protocols[x] == protocol) { + protocolDiv.style.display = 'block' + } else { + protocolDiv.style.display = 'none' + } + } } } -function changeYoutubeEmbedFrontendsSettings() { - if (youtubeEmbedFrontend.value == 'invidious') { - pipedDiv.style.display = 'none'; - pipedMaterialDiv.style.display = 'none'; - invidiousDiv.style.display = 'block'; - } - if (youtubeEmbedFrontend.value == 'piped') { - pipedDiv.style.display = 'block'; - pipedMaterialDiv.style.display = 'none'; - invidiousDiv.style.display = 'none'; - } - if (youtubeEmbedFrontend.value == 'pipedMaterial') { - pipedDiv.style.display = 'none'; - pipedMaterialDiv.style.display = 'block'; - invidiousDiv.style.display = 'none'; - } - else if (youtubeEmbedFrontend.value == 'youtube') { - pipedDiv.style.display = 'none'; - pipedMaterialDiv.style.display = 'none'; - invidiousDiv.style.display = 'none'; +function changeEmbedFrontendsSettings() { + if (embeddedFrontendDiv.style.display == 'block') { + for (let i = 0; i < frontends.length; i++) { + const embeddedFrontendDiv = document.getElementById(frontends[i]) + if (frontends[i] == youtubeEmbedFrontend.value) { + embeddedFrontendDiv.style.display = 'block' + } else { + embeddedFrontendDiv.style.display = 'none' + } + } } } -function changeProtocolSettings() { - const normalPipedDiv = document.getElementById('piped').getElementsByClassName("normal")[0]; - const torPipedDiv = document.getElementById('piped').getElementsByClassName("tor")[0]; - - const normalPipedMaterialDiv = document.getElementById('pipedMaterial').getElementsByClassName("normal")[0]; - const torPipedMaterialDiv = document.getElementById('pipedMaterial').getElementsByClassName("tor")[0]; - - const normalInvidiousDiv = document.getElementById('invidious').getElementsByClassName("normal")[0]; - const torInvidiousDiv = document.getElementById('invidious').getElementsByClassName("tor")[0]; - - if (protocol.value == 'normal') { - normalInvidiousDiv.style.display = 'block'; - torInvidiousDiv.style.display = 'none'; - - normalPipedDiv.style.display = 'block'; - torPipedDiv.style.display = 'none'; - - normalPipedMaterialDiv.style.display = 'block'; - torPipedMaterialDiv.style.display = 'none'; +function changeFrontendsSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + if (frontends[i] == frontend.value) { + frontendDiv.style.display = 'block' + } else { + frontendDiv.style.display = 'none' + } } - else if (protocol.value == 'tor') { - normalInvidiousDiv.style.display = 'none'; - torInvidiousDiv.style.display = 'block'; - - normalPipedDiv.style.display = 'none'; - torPipedDiv.style.display = 'block'; - - normalPipedMaterialDiv.style.display = 'none'; - torPipedMaterialDiv.style.display = 'block'; + let singleInstanceFrontend = false + for (let i = 0; i < singleInstanceFrontends.length; i++) { + if (singleInstanceFrontends[i] == frontend.value) { + singleInstanceFrontend = true + } + } + if (singleInstanceFrontend == true) { + embeddedFrontendDiv.style.display = 'block' + } else { + embeddedFrontendDiv.style.display = 'none' } } -youtube.addEventListener("change", () => { - browser.storage.local.set({ - disableYoutube: !enable.checked, - youtubeFrontend: frontend.value, - youtubeEmbedFrontend: youtubeEmbedFrontend.value, - onlyEmbeddedVideo: onlyEmbeddedVideo.value, - youtubeProtocol: protocol.value, - }) - changeProtocolSettings(); - changeYoutubeEmbedFrontendsSettings(); - changeFrontendsSettings(); -}) - browser.storage.local.get( [ "disableYoutube", @@ -117,29 +69,33 @@ browser.storage.local.get( "youtubeFrontend", "youtubeEmbedFrontend", - "youtubeProtocol", + "protocol" ], r => { enable.checked = !r.disableYoutube; onlyEmbeddedVideo.value = r.onlyEmbeddedVideo; frontend.value = r.youtubeFrontend; - protocol.value = r.youtubeProtocol; + protocol = r.protocol; changeFrontendsSettings(); changeProtocolSettings(); - - youtubeEmbedFrontend.value = youtubeEmbedFrontend.value - if (r.frontend == "freetube" || r.frontend == "yatte") changeYoutubeEmbedFrontendsSettings() + changeEmbedFrontendsSettings(); } ); -utils.processDefaultCustomInstances('youtube', 'invidious', 'normal', document); -utils.processDefaultCustomInstances('youtube', 'invidious', 'tor', document); -utils.processDefaultCustomInstances('youtube', 'pipedMaterial', 'normal', document); -utils.processDefaultCustomInstances('youtube', 'pipedMaterial', 'tor', document); -utils.processDefaultCustomInstances('youtube', 'piped', 'normal', document); -utils.processDefaultCustomInstances('youtube', 'piped', 'tor', document); +youtube.addEventListener("change", () => { + browser.storage.local.set({ + disableYoutube: !enable.checked, + youtubeEmbedFrontend: youtubeEmbedFrontend.value, + onlyEmbeddedVideo: onlyEmbeddedVideo.value + }) + changeFrontendsSettings(); + changeEmbedFrontendsSettings(); +}) -utils.latency('youtube', 'invidious', document, location, true) -utils.latency('youtube', 'piped', document, location, true) -utils.latency('youtube', 'pipedMaterial', document, location, true) +for (let i = 0; i < frontends.length; i++) { + for (let x = 0; x < protocols.length; x++) { + utils.processDefaultCustomInstances('youtube', frontends[i], protocols[x], document) + } + utils.latency('youtube', frontends[i], document, location) +} diff --git a/src/pages/options/widgets/youtube.pug b/src/pages/options/widgets/youtube.pug index 7985244f..a7832d4c 100644 --- a/src/pages/options/widgets/youtube.pug +++ b/src/pages/options/widgets/youtube.pug @@ -15,54 +15,70 @@ section#youtube_page.option-block option(value="freetube") FreeTube option(value="yatte") Yattee - #freetube-yatte + #youtube-embedded_frontend .some-block.option-block h4(data-localise="__MSG_embeddedVids__") Embedded Videos Frontend select#youtube-embed_frontend option(value="invidious") Invidious option(value="piped") Piped option(value="pipedMaterial") Piped-Material - option(value="youtube") Youtube - #invidious-piped-pipedMaterial - .some-block.option-block - h4(data-localise="__MSG_protocol__") Protocol - select#youtube-protocol - option(value="normal" data-localise="__MSG_normal__") Normal - option(value="tor" data-localise="__MSG_tor__") Tor - - .some-block.option-block - h4(data-localise="__MSG_redirectType__") Redirect Type - select#youtube-redirect_type - option(value="both" data-localise="__MSG_both__") both - option(value="onlyEmbedded" data-localise="__MSG_onlyEmbedded__") Only Embedded - option(value="onlyNotEmbedded" data-localise="__MSG_onlyNotEmbedded__") Only Not Embedded + .some-block.option-block + h4(data-localise="__MSG_redirectType__") Redirect Type + select#youtube-redirect_type + option(value="both" data-localise="__MSG_both__") both + option(value="onlyEmbedded" data-localise="__MSG_onlyEmbedded__") Only Embedded + option(value="onlyNotEmbedded" data-localise="__MSG_onlyNotEmbedded__") Only Not Embedded #invidious hr .normal include ../../widgets/instances.pug - +instances('https://invidious.com') + +instances('http://invidious.com') include ../../widgets/latency.pug +latency('invidious') .tor - +instances('https://invidious.onion') + include ../../widgets/instances.pug + +instances('http://invidious.onion') + .i2p + include ../../widgets/instances.pug + +instances('http://invidious.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://invidious.loki') #piped hr .normal + include ../../widgets/instances.pug +instances('https://piped.com') + include ../../widgets/latency.pug +latency('piped') .tor - +instances('https://piped.onion') + +instances('http://piped.onion') + include ../../widgets/instances.pug + .i2p + include ../../widgets/instances.pug + +instances('http://piped.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://piped.loki') #pipedMaterial hr .normal + include ../../widgets/instances.pug +instances('https://piped-material.com') + include ../../widgets/latency.pug +latency('pipedMaterial') .tor - +instances('https://piped-material.onion') - + +instances('http://piped-material.onion') + include ../../widgets/instances.pug + .i2p + include ../../widgets/instances.pug + +instances('http://piped-material.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://piped-material.loki') script(type="module" src="./widgets/youtube.js") diff --git a/src/pages/options/widgets/youtubeMusic.js b/src/pages/options/widgets/youtubeMusic.js index cb5ab1d7..4d33c1fa 100644 --- a/src/pages/options/widgets/youtubeMusic.js +++ b/src/pages/options/widgets/youtubeMusic.js @@ -1,23 +1,61 @@ import utils from "../../../assets/javascripts/utils.js"; +// UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST + +const frontends = new Array("beatbump") +const protocols = new Array("normal", "tor", "i2p", "loki") + let enable = document.getElementById("youtubeMusic-enable"); const youtubeMusic = document.getElementById('youtubeMusic_page'); +//const frontend = document.getElementById("youtubeMusic-frontend"); +let protocol + +/* +function changeFrontendsSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + if (frontends[i] == frontend.value) { + frontendDiv.style.display = 'block' + } else { + frontendDiv.style.display = 'none' + } + } +} +*/ + +function changeProtocolSettings() { + for (let i = 0; i < frontends.length; i++) { + const frontendDiv = document.getElementById(frontends[i]) + for (let x = 0; x < protocols.length; x++) { + const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0] + if (protocols[x] == protocol) { + protocolDiv.style.display = 'block' + } else { + protocolDiv.style.display = 'none' + } + } + } +} browser.storage.local.get( [ "disableYoutubeMusic", + "protocol" ], r => { - enable.checked = !r.disableYoutubeMusic; + enable.checked = !r.disableYoutubeMusic + protocol = r.protocol + changeProtocolSettings() } ); youtubeMusic.addEventListener("change", () => { - browser.storage.local.set({ - disableYoutubeMusic: !enable.checked, - }) + browser.storage.local.set({ disableYoutubeMusic: !enable.checked }) }) -utils.processDefaultCustomInstances('youtubeMusic', 'beatbump', 'normal', document); - -utils.latency('youtubeMusic', 'beatbump', document, location, true) \ No newline at end of file +for (let i = 0; i < frontends.length; i++) { + for (let x = 0; x < protocols.length; x++) { + utils.processDefaultCustomInstances('youtubeMusic', frontends[i], protocols[x], document) + } + utils.latency('youtubeMusic', frontends[i], document, location) +} diff --git a/src/pages/options/widgets/youtubeMusic.pug b/src/pages/options/widgets/youtubeMusic.pug index ac4d6403..f307ae9a 100644 --- a/src/pages/options/widgets/youtubeMusic.pug +++ b/src/pages/options/widgets/youtubeMusic.pug @@ -13,5 +13,14 @@ section#youtubeMusic_page.option-block +instances('https://beatbump.wewe') include ../../widgets/latency.pug +latency('beatbump') + .tor + +instances('http://beatbump.onion') + include ../../widgets/instances.pug + .i2p + include ../../widgets/instances.pug + +instances('http://beatbump.i2p') + .loki + include ../../widgets/instances.pug + +instances('http://beatbump.loki') script(type="module" src="./widgets/youtubeMusic.js") diff --git a/src/pages/popup/popup.js b/src/pages/popup/popup.js index e12e61e9..5e7b2336 100644 --- a/src/pages/popup/popup.js +++ b/src/pages/popup/popup.js @@ -130,7 +130,7 @@ browser.storage.local.get( "disablePeertubeTargets", "disableLbryTargets", "disableSendTarget", - 'popupFrontends', + "popupFrontends", ], r => { disableTwitterCurrentSite.checked = !r.disableTwitter; disableTwitterAllSites.checked = !r.disableTwitter; @@ -327,4 +327,4 @@ for (const a of document.getElementsByTagName('a')) { e.preventDefault(); } }) -} \ No newline at end of file +} |