diff options
author | ManeraKai <manerakai@protonmail.com> | 2022-04-17 15:27:21 +0300 |
---|---|---|
committer | ManeraKai <manerakai@protonmail.com> | 2022-04-17 15:27:21 +0300 |
commit | f17463a9ea15a479376597f94f5d920bb8f4cc79 (patch) | |
tree | 55a0a00803262d0bbadc8f5f8985b8a679d47fa5 /src | |
parent | Fix medium regex #137 (diff) | |
download | libredirect-f17463a9ea15a479376597f94f5d920bb8f4cc79.zip |
Added latency test #134
Diffstat (limited to 'src')
41 files changed, 5390 insertions, 288 deletions
diff --git a/src/assets/javascripts/helpers/common.js b/src/assets/javascripts/helpers/common.js index 287604d2..4b2d9637 100644 --- a/src/assets/javascripts/helpers/common.js +++ b/src/assets/javascripts/helpers/common.js @@ -19,7 +19,6 @@ let cloudflareList = []; async function initCloudflareList() { return new Promise(resolve => { fetch('/instances/cloudflare.json').then(response => response.text()).then(data => { - console.log(data); cloudflareList = data; resolve(); }) @@ -90,8 +89,6 @@ function protocolHost(url) { return `${url.protocol}//${url.host}`; } - - async function processDefaultCustomInstances( name, protocol, @@ -100,8 +97,10 @@ async function processDefaultCustomInstances( getNameRedirectsChecks, setNameRedirectsChecks, getNameCustomRedirects, - setNameCustomRedirects + setNameCustomRedirects, + instancesLatency, ) { + instancesLatency = instancesLatency ?? []; let nameProtocolElement = document.getElementById(name).getElementsByClassName(protocol)[0]; let nameCustomInstances = []; @@ -123,12 +122,10 @@ async function processDefaultCustomInstances( } nameDefaultRedirects = getNameRedirectsChecks(); - - console.log('cloudflareList', cloudflareList) nameCheckListElement.innerHTML = [ `<div><x data-localise="__MSG_toggleAll__">Toggle All</x><input type="checkbox" class="toogle-all" /></div>`, - ...nameHelper.getRedirects()[name][protocol].map(x => `<div><x>${x}${cloudflareList.includes(x) ? ' <span style="color:red;">cloudflare</span>' : ''}</x><input type="checkbox" class="${x}" /></div>`), + ...nameHelper.getRedirects()[name][protocol].map(x => `<div><x>${x}${cloudflareList.includes(x) ? ' <span style="color:red;">cloudflare</span>' : ''} ${x in instancesLatency ? '<span style="color:' + (instancesLatency[x] <= 1000 ? "green" : instancesLatency[x] <= 2000 ? "orange" : "red") + ';">' + (instancesLatency[x] == 5000 ? '5000ms+' : instancesLatency[x] + 'ms') + '</span>' : ''}</x > <input type="checkbox" class="${x}" /></div > `), ].join('\n<hr>\n'); localise.localisePage(); @@ -161,15 +158,15 @@ async function processDefaultCustomInstances( function calcNameCustomInstances() { nameProtocolElement.getElementsByClassName('custom-checklist')[0].innerHTML = nameCustomInstances.map( - x => `<div>${x}<button class="add clear-${x}"> - <svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" - fill="currentColor"> - <path d="M0 0h24v24H0V0z" fill="none" /> - <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" /> - </svg> - </button> - </div> - <hr>` + x => `<div> ${x} <button class="add clear-${x}"> + <svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" + fill="currentColor"> + <path d="M0 0h24v24H0V0z" fill="none" /> + <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" /> + </svg> +</button> + </div > + <hr>` ).join('\n'); for (const item of nameCustomInstances) { @@ -201,6 +198,46 @@ function isRtl() { return ["ar", "iw", "ku", "fa", "ur"].includes(browser.i18n.getUILanguage()) } +async function ping(href) { + return new Promise(resolve => { + let http = new XMLHttpRequest(); + http.open("GET", href + '?_=' + new Date().getTime(), /*async*/true); + http.timeout = 5000; + let started = new Date().getTime(); + http.onreadystatechange = function () { + if (http.readyState == 2) { + if (http.status == 200) { + let ended = new Date().getTime(); + let ms = ended - started; + http.abort(); + resolve(ms); + } + else resolve() + } + }; + http.ontimeout = () => resolve(5000) + http.onerror = () => resolve() + try { + http.send(null); + } catch (exception) { + resolve() + } + }); +} + +async function testLatency(element, instances) { + return new Promise(async resolve => { + let myList = {}; + for (const href of instances) await ping(href).then(m => { + if (m) { + myList[href] = m; + element.innerHTML = `${href}: ${'<span style="color:' + (m <= 1000 ? "green" : m <= 2000 ? "orange" : "red") + ';">' + (m == 5000 ? '5000ms+' : m + 'ms') + '</span>'}`; + console.log(`${href}: ${m}ms`) + } + }) + resolve(myList); + }) +} export default { getRandomInstance, updateInstances, @@ -208,4 +245,5 @@ export default { isFirefox, processDefaultCustomInstances, isRtl, -}; + testLatency, +} diff --git a/src/pages/options/general/general.html b/src/pages/options/general/general.html new file mode 100644 index 00000000..e27ff9d4 --- /dev/null +++ b/src/pages/options/general/general.html @@ -0,0 +1,223 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg"> + <link href="../../stylesheets/styles.css" rel="stylesheet"> + <title>General</title> + </head> +</html> +<body class="option" dir="auto"> + <section class="links"> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor"> + <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path> + </svg><a class="selected" href="../general/general.html" data-localise="__MSG_general__">General</a> + </div> + <div class="title"> <img src="../../../assets/images/youtube-icon.png"><a href="../youtube/youtube.html" data-localise="__MSG_youtube__">YouTube </a></div> + <div class="title"> <img src="../../../assets/images/youtube-music-icon.png"><a href="../youtubeMusic/youtubeMusic.html" data-localise="__MSG_ytmusic__">YT Music</a></div> + <div class="title"> <img src="../../../assets/images/twitter-icon.png"><a href="../twitter/twitter.html" data-localise="__MSG_twitter__">Twitter</a></div> + <div class="title"> <img src="../../../assets/images/instagram-icon.png"><a href="../instagram/instagram.html" data-localise="__MSG_instagram__">Instagram</a></div> + <div class="title"> <img src="../../../assets/images/tiktok-icon.png"><a href="../tiktok/tiktok.html" data-localise="__MSG_tiktok__">TikTok</a></div> + <div class="title"> <img src="../../../assets/images/reddit-icon.png"><a href="../reddit/reddit.html" data-localise="__MSG_reddit__">Reddit</a></div> + <div class="title"> <img src="../../../assets/images/imgur-icon.png"><a href="../imgur/imgur.html" data-localise="__MSG_imgur__">Imgur</a></div> + <div class="title"> <img src="../../../assets/images/pixiv-icon.svg"><a href="../pixiv/pixiv.html" data-localise="__MSG_pixiv__">Pixiv</a></div> + <div class="title"> <img src="../../../assets/images/librespeed-icon.svg"><a href="../speedtest/speedtest.html" data-localise="__MSG_speedtest__">Speedtest</a></div> + <div class="title"> <img src="../../../assets/images/spotify-icon.png"><a href="../spotify/spotify.html" data-localise="__MSG_spotify__">Spotify</a></div> + <div class="title"> <img src="../../../assets/images/wikipedia-icon.svg"><a href="../wikipedia/wikipedia.html" data-localise="__MSG_wikipedia__">Wikipedia</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> + <circle cx="500" cy="500" r="500"></circle> + <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> + <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> + </svg><a href="../medium/medium.html" data-localise="__MSG_medium__">Medium</a> + </div> + <div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a href="../peertube/peertube.html" data-localise="__MSG_peertube__">Peertube</a></div> + <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="../lbry/lbry.html" data-localise="__MSG_lbry__">LBRY/Odysee</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg><a href="../search/search.html" data-localise="__MSG_search__">Search</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> + </svg><a href="../translate/translate.html" data-localise="__MSG_translate__">Translate</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path> + </svg><a href="../maps/maps.html" data-localise="__MSG_maps__">Maps</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> + </svg><a href="../sendTargets/sendTargets.html" data-localise="__MSG_sendFiles__">Send Files</a> + </div> + </section> + <section class="option-block"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_theme__">Theme</h4> + <select id="theme"> + <option value="DEFAULT" data-localise="__MSG_system__">System</option> + <option value="light" data-localise="__MSG_light__">Light</option> + <option value="dark" data-localise="__MSG_dark__">Dark</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_applyTheme__">Apply Theme to sites</h4> + <input id="apply-theme-to-sites" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_alwaysPref__">Always use Preferred Instances</h4> + <input id="always-use-preferred" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_autoRedirect__">Auto Redirect of offline instances</h4> + <input id="auto-redirect" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_exceptions__">Exceptions</h4> + </div> + <form id="custom-exceptions-instance-form"> + <div class="some-block option-block"> + <div class="some-block" style="padding:0;"> + <input id="exceptions-custom-instance" placeholder="https://www.google.com" type="url"> + <select id="exceptions-custom-instance-type"> + <option value="url">URL</option> + <option value="regex">Regex</option> + </select> + </div> + <button class="add" id="exceptions-add-instance" type="submit"> + <svg xmlns="http://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" id="exceptions-custom-checklist"></div> + <div class="buttons buttons-inline"><a class="button button-inline" id="update-instances"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"></path> + </svg> + <x data-localise="__MSG_updateInstances__">Update Instances</x></a> + <label class="button button-inline" for="import-settings"> + <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_importSettings__">Import Settings</x> + </label> + <input class="button button-inline" id="import-settings" type="file" style="display:none;"> <a class="button button-inline" id="export-settings"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M10.09 15.59L11.5 17l5-5-5-5-1.41 1.41L12.67 11H3v2h9.67l-2.58 2.59zM19 3H5c-1.11 0-2 .9-2 2v4h2V5h14v14H5v-4H3v4c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"></path> + </svg> + <x data-localise="__MSG_exportSettings__">Export Settings</x></a> <a class="button button-inline" id="reset-settings"> + <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12,5V2L8,6l4,4V7c3.31,0,6,2.69,6,6c0,2.97-2.17,5.43-5,5.91v2.02c3.95-0.49,7-3.85,7-7.93C20,8.58,16.42,5,12,5z"></path> + <path d="M6,13c0-1.65,0.67-3.15,1.76-4.24L6.34,7.34C4.9,8.79,4,10.79,4,13c0,4.08,3.05,7.44,7,7.93v-2.02 C8.17,18.43,6,15.97,6,13z"></path> + </svg> + <x data-localise="__MSG_resetSettings__">Reset Settings</x></a> + </div> + <hr> + <div class="some-block option-block"> + <h4 data-localise="__MSG_customPopup__">Customize Popup</h4> + </div> + <div class="checklist-popup" id="popup-frontends-checklist"> + <div> + <div><img src="../../../assets/images/youtube-icon.png">YouTube</div> + <input id="youtube" type="checkbox"> + </div> + <div> + <div><img src="../../../assets/images/youtube-music-icon.png">YoutubeMusic</div> + <input id="youtubeMusic" type="checkbox"> + </div> + <div> + <div><img src="../../../assets/images/twitter-icon.png">Twitter</div> + <input id="twitter" type="checkbox"> + </div> + <div> + <div> <img src="../../../assets/images/instagram-icon.png">Instagram</div> + <input id="instagram" type="checkbox"> + </div> + <div> + <div> <img src="../../../assets/images/tiktok-icon.png">TikTok</div> + <input id="tikTok" type="checkbox"> + </div> + <div> + <div> <img src="../../../assets/images/imgur-icon.png">Imgur</div> + <input id="imgur" type="checkbox"> + </div> + <div> + <div> <img src="../../../assets/images/reddit-icon.png">Reddit</div> + <input id="reddit" type="checkbox"> + </div> + <div> + <div> <img src="../../../assets/images/pixiv-icon.svg">Pixiv</div> + <input id="pixiv" type="checkbox"> + </div> + <div> + <div> <img src="../../../assets/images/spotify-icon.png">Spotify</div> + <input id="spotify" type="checkbox"> + </div> + <div> + <div> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg>Search + </div> + <input id="search" type="checkbox"> + </div> + <div> + <div> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> + </svg>Translate + </div> + <input id="translate" type="checkbox"> + </div> + <div> + <div> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM10 5.47l4 1.4v11.66l-4-1.4V5.47zm-5 .99l3-1.01v11.7l-3 1.16V6.46zm14 11.08l-3 1.01V6.86l3-1.16v11.84z"></path> + </svg>Maps + </div> + <input id="maps" type="checkbox"> + </div> + <div> + <div> <img src="../../../assets/images/wikipedia-icon.svg">Wikipedia</div> + <input id="wikipedia" type="checkbox"> + </div> + <div> + <div> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> + <circle cx="500" cy="500" r="500"></circle> + <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> + <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> + </svg>Medium + </div> + <input id="medium" type="checkbox"> + </div> + <div> + <div> <img src="../../../assets/images/peertube-icon.svg">Peertube</div> + <input id="peertube" type="checkbox"> + </div> + <div> + <div> <img src="../../../assets/images/lbry-icon.png">LBRY/Odysee</div> + <input id="lbry" type="checkbox"> + </div> + <div> + <div> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> + </svg>Send Files + </div> + <input id="sendTargets" type="checkbox"> + </div> + <hr> + </div> + <script type="module" src="../init.js"></script> + <script type="module" src="./general.js"></script> + <script type="module" src="../../../assets/javascripts/localise.js"></script> + </section> +</body> \ No newline at end of file diff --git a/src/pages/options/general/general.js b/src/pages/options/general/general.js index 3b939477..2fab94fb 100644 --- a/src/pages/options/general/general.js +++ b/src/pages/options/general/general.js @@ -170,6 +170,6 @@ generalHelper.init().then(() => { }) popupFrontends = generalHelper.getPopupFrontends(); - for (const frontend of generalHelper.allPopupFrontends) + for (const frontend of generalHelper.allPopupFrontends) document.getElementById(frontend).checked = popupFrontends.includes(frontend); }) \ No newline at end of file diff --git a/src/pages/options/imgur/imgur.html b/src/pages/options/imgur/imgur.html new file mode 100644 index 00000000..c9d48622 --- /dev/null +++ b/src/pages/options/imgur/imgur.html @@ -0,0 +1,146 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg"> + <link href="../../stylesheets/styles.css" rel="stylesheet"> + <title>General</title> + </head> +</html> +<script type="module" src="../../../assets/javascripts/localise.js"></script> +<body class="option" dir="auto"> + <section class="links"> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor"> + <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path> + </svg><a href="../general/general.html" data-localise="__MSG_general__">General</a> + </div> + <div class="title"> <img src="../../../assets/images/youtube-icon.png"><a href="../youtube/youtube.html" data-localise="__MSG_youtube__">YouTube </a></div> + <div class="title"> <img src="../../../assets/images/youtube-music-icon.png"><a href="../youtubeMusic/youtubeMusic.html" data-localise="__MSG_ytmusic__">YT Music</a></div> + <div class="title"> <img src="../../../assets/images/twitter-icon.png"><a href="../twitter/twitter.html" data-localise="__MSG_twitter__">Twitter</a></div> + <div class="title"> <img src="../../../assets/images/instagram-icon.png"><a href="../instagram/instagram.html" data-localise="__MSG_instagram__">Instagram</a></div> + <div class="title"> <img src="../../../assets/images/tiktok-icon.png"><a href="../tiktok/tiktok.html" data-localise="__MSG_tiktok__">TikTok</a></div> + <div class="title"> <img src="../../../assets/images/reddit-icon.png"><a href="../reddit/reddit.html" data-localise="__MSG_reddit__">Reddit</a></div> + <div class="title"> <img src="../../../assets/images/imgur-icon.png"><a class="selected" href="../imgur/imgur.html" data-localise="__MSG_imgur__">Imgur</a></div> + <div class="title"> <img src="../../../assets/images/pixiv-icon.svg"><a href="../pixiv/pixiv.html" data-localise="__MSG_pixiv__">Pixiv</a></div> + <div class="title"> <img src="../../../assets/images/librespeed-icon.svg"><a href="../speedtest/speedtest.html" data-localise="__MSG_speedtest__">Speedtest</a></div> + <div class="title"> <img src="../../../assets/images/spotify-icon.png"><a href="../spotify/spotify.html" data-localise="__MSG_spotify__">Spotify</a></div> + <div class="title"> <img src="../../../assets/images/wikipedia-icon.svg"><a href="../wikipedia/wikipedia.html" data-localise="__MSG_wikipedia__">Wikipedia</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> + <circle cx="500" cy="500" r="500"></circle> + <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> + <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> + </svg><a href="../medium/medium.html" data-localise="__MSG_medium__">Medium</a> + </div> + <div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a href="../peertube/peertube.html" data-localise="__MSG_peertube__">Peertube</a></div> + <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="../lbry/lbry.html" data-localise="__MSG_lbry__">LBRY/Odysee</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg><a href="../search/search.html" data-localise="__MSG_search__">Search</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> + </svg><a href="../translate/translate.html" data-localise="__MSG_translate__">Translate</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path> + </svg><a href="../maps/maps.html" data-localise="__MSG_maps__">Maps</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> + </svg><a href="../sendTargets/sendTargets.html" data-localise="__MSG_sendFiles__">Send Files</a> + </div> + </section> + <section class="option-block"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enable__">Enable</h4> + <input id="disable-imgur" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_protocol__">Protocol</h4> + <select id="protocol"> + <option value="normal" data-localise="__MSG_normal__">Normal</option> + <option value="tor" data-localise="__MSG_tor__">Tor</option> + <option value="i2p" data-localise="__MSG_i2p__">I2P</option> + </select> + </div> + <div id="rimgo"> + <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://rimgo.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-label" for="latency"> + <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" style="display:none;"> + </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="https://rimgo.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </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="https://rimgo.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + </section> + <script type="module" src="../init.js"></script> + <script type="module" src="./imgur.js"></script> +</body> \ No newline at end of file diff --git a/src/pages/options/imgur/imgur.js b/src/pages/options/imgur/imgur.js index 26a7d417..11ebcebc 100644 --- a/src/pages/options/imgur/imgur.js +++ b/src/pages/options/imgur/imgur.js @@ -8,7 +8,7 @@ disableImgurElement.addEventListener("change", let protocolElement = document.getElementById("protocol") protocolElement.addEventListener("change", - (event) => { + event => { let protocol = event.target.options[protocolElement.selectedIndex].value imgurHelper.setProtocol(protocol); changeProtocolSettings(protocol); @@ -20,19 +20,19 @@ function changeProtocolSettings(protocol) { let torDiv = document.getElementsByClassName("tor")[0]; let i2pDiv = document.getElementsByClassName("i2p")[0]; if (protocol == 'normal') { - normalDiv.style.display = 'block'; - torDiv.style.display = 'none'; - i2pDiv.style.display = 'none'; + normalDiv.style.display = 'block'; + torDiv.style.display = 'none'; + i2pDiv.style.display = 'none'; } else if (protocol == 'tor') { - normalDiv.style.display = 'none'; - torDiv.style.display = 'block'; - i2pDiv.style.display = 'none'; + 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'; + normalDiv.style.display = 'none'; + torDiv.style.display = 'none'; + i2pDiv.style.display = 'block'; } } @@ -44,16 +44,19 @@ imgurHelper.init().then(() => { protocolElement.value = protocol; changeProtocolSettings(protocol); - commonHelper.processDefaultCustomInstances( - 'rimgo', - 'normal', - imgurHelper, - document, - imgurHelper.getRimgoNormalRedirectsChecks, - imgurHelper.setRimgoNormalRedirectsChecks, - imgurHelper.getRimgoNormalCustomRedirects, - imgurHelper.setRimgoNormalCustomRedirects - ); + browser.storage.local.get("rimgoLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'rimgo', + 'normal', + imgurHelper, + document, + imgurHelper.getRimgoNormalRedirectsChecks, + imgurHelper.setRimgoNormalRedirectsChecks, + imgurHelper.getRimgoNormalCustomRedirects, + imgurHelper.setRimgoNormalCustomRedirects, + r.rimgoLatency + ); + }); commonHelper.processDefaultCustomInstances( 'rimgo', @@ -67,13 +70,42 @@ imgurHelper.init().then(() => { ); commonHelper.processDefaultCustomInstances( - 'rimgo', - 'i2p', - imgurHelper, - document, - imgurHelper.getRimgoI2pRedirectsChecks, - imgurHelper.setRimgoI2pRedirectsChecks, - imgurHelper.getRimgoI2pCustomRedirects, - imgurHelper.setRimgoI2pCustomRedirects + 'rimgo', + 'i2p', + imgurHelper, + document, + imgurHelper.getRimgoI2pRedirectsChecks, + imgurHelper.setRimgoI2pRedirectsChecks, + imgurHelper.getRimgoI2pCustomRedirects, + imgurHelper.setRimgoI2pCustomRedirects ); }); + +let latencyElement = document.getElementById("latency"); +let latencyLabel = document.getElementById("latency-label"); +latencyElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyElement.addEventListener("click", reloadWindow); + await imgurHelper.init(); + let redirects = imgurHelper.getRedirects(); + const oldHtml = latencyLabel.innerHTML; + latencyLabel.innerHTML = '...'; + commonHelper.testLatency(latencyLabel, redirects.rimgo.normal).then(r => { + browser.storage.local.set({ rimgoLatency: r }); + latencyLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'rimgo', + 'normal', + imgurHelper, + document, + imgurHelper.getRimgoNormalRedirectsChecks, + imgurHelper.setRimgoNormalRedirectsChecks, + imgurHelper.getRimgoNormalCustomRedirects, + imgurHelper.setRimgoNormalCustomRedirects, + r + ); + latencyElement.removeEventListener("click", reloadWindow) + }); + } +); diff --git a/src/pages/options/instagram/instagram.html b/src/pages/options/instagram/instagram.html new file mode 100644 index 00000000..01556fd8 --- /dev/null +++ b/src/pages/options/instagram/instagram.html @@ -0,0 +1,125 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg"> + <link href="../../stylesheets/styles.css" rel="stylesheet"> + <title>General</title> + </head> +</html> +<script type="module" src="../../../assets/javascripts/localise.js"></script> +<body class="option" dir="auto"> + <section class="links"> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor"> + <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path> + </svg><a href="../general/general.html" data-localise="__MSG_general__">General</a> + </div> + <div class="title"> <img src="../../../assets/images/youtube-icon.png"><a href="../youtube/youtube.html" data-localise="__MSG_youtube__">YouTube </a></div> + <div class="title"> <img src="../../../assets/images/youtube-music-icon.png"><a href="../youtubeMusic/youtubeMusic.html" data-localise="__MSG_ytmusic__">YT Music</a></div> + <div class="title"> <img src="../../../assets/images/twitter-icon.png"><a href="../twitter/twitter.html" data-localise="__MSG_twitter__">Twitter</a></div> + <div class="title"> <img src="../../../assets/images/instagram-icon.png"><a class="selected" href="../instagram/instagram.html" data-localise="__MSG_instagram__">Instagram</a></div> + <div class="title"> <img src="../../../assets/images/tiktok-icon.png"><a href="../tiktok/tiktok.html" data-localise="__MSG_tiktok__">TikTok</a></div> + <div class="title"> <img src="../../../assets/images/reddit-icon.png"><a href="../reddit/reddit.html" data-localise="__MSG_reddit__">Reddit</a></div> + <div class="title"> <img src="../../../assets/images/imgur-icon.png"><a href="../imgur/imgur.html" data-localise="__MSG_imgur__">Imgur</a></div> + <div class="title"> <img src="../../../assets/images/pixiv-icon.svg"><a href="../pixiv/pixiv.html" data-localise="__MSG_pixiv__">Pixiv</a></div> + <div class="title"> <img src="../../../assets/images/librespeed-icon.svg"><a href="../speedtest/speedtest.html" data-localise="__MSG_speedtest__">Speedtest</a></div> + <div class="title"> <img src="../../../assets/images/spotify-icon.png"><a href="../spotify/spotify.html" data-localise="__MSG_spotify__">Spotify</a></div> + <div class="title"> <img src="../../../assets/images/wikipedia-icon.svg"><a href="../wikipedia/wikipedia.html" data-localise="__MSG_wikipedia__">Wikipedia</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> + <circle cx="500" cy="500" r="500"></circle> + <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> + <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> + </svg><a href="../medium/medium.html" data-localise="__MSG_medium__">Medium</a> + </div> + <div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a href="../peertube/peertube.html" data-localise="__MSG_peertube__">Peertube</a></div> + <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="../lbry/lbry.html" data-localise="__MSG_lbry__">LBRY/Odysee</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg><a href="../search/search.html" data-localise="__MSG_search__">Search</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> + </svg><a href="../translate/translate.html" data-localise="__MSG_translate__">Translate</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path> + </svg><a href="../maps/maps.html" data-localise="__MSG_maps__">Maps</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> + </svg><a href="../sendTargets/sendTargets.html" data-localise="__MSG_sendFiles__">Send Files</a> + </div> + </section> + <section class="option-block"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enable__">Enable</h4> + <input id="disable-bibliogram" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_protocol__">Protocol</h4> + <select id="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"> + <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://bibliogram.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-label" for="latency"> + <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" style="display:none;"> + </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="https://bibliogram.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + </section> + <script type="module" src="../init.js"></script> + <script type="module" src="./instagram.js"></script> +</body> \ No newline at end of file diff --git a/src/pages/options/instagram/instagram.js b/src/pages/options/instagram/instagram.js index a7788a6b..867a5ddc 100644 --- a/src/pages/options/instagram/instagram.js +++ b/src/pages/options/instagram/instagram.js @@ -36,16 +36,19 @@ instagramHelper.init().then(() => { changeProtocolSettings(protocol); - commonHelper.processDefaultCustomInstances( - 'bibliogram', - 'normal', - instagramHelper, - document, - instagramHelper.getBibliogramNormalRedirectsChecks, - instagramHelper.setBibliogramNormalRedirectsChecks, - instagramHelper.getBibliogramNormalCustomRedirects, - instagramHelper.setBibliogramNormalCustomRedirects - ) + browser.storage.local.get("bibliogramLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'bibliogram', + 'normal', + instagramHelper, + document, + instagramHelper.getBibliogramNormalRedirectsChecks, + instagramHelper.setBibliogramNormalRedirectsChecks, + instagramHelper.getBibliogramNormalCustomRedirects, + instagramHelper.setBibliogramNormalCustomRedirects, + r.bibliogramLatency, + ) + }) commonHelper.processDefaultCustomInstances( 'bibliogram', @@ -57,4 +60,34 @@ instagramHelper.init().then(() => { instagramHelper.getBibliogramTorCustomRedirects, instagramHelper.setBibliogramTorCustomRedirects ) -}) \ No newline at end of file +}) + + +let latencyElement = document.getElementById("latency"); +let latencyLabel = document.getElementById("latency-label"); +latencyElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyElement.addEventListener("click", reloadWindow); + await instagramHelper.init(); + let redirects = instagramHelper.getRedirects(); + const oldHtml = latencyLabel.innerHTML; + latencyLabel.innerHTML = '...'; + commonHelper.testLatency(latencyLabel, redirects.bibliogram.normal).then(r => { + browser.storage.local.set({ bibliogramLatency: r }); + latencyLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'bibliogram', + 'normal', + instagramHelper, + document, + instagramHelper.getBibliogramNormalRedirectsChecks, + instagramHelper.setBibliogramNormalRedirectsChecks, + instagramHelper.getBibliogramNormalCustomRedirects, + instagramHelper.setBibliogramNormalCustomRedirects, + r, + ); + latencyElement.removeEventListener("click", reloadWindow); + }); + } +); \ No newline at end of file diff --git a/src/pages/options/lbry/lbry.html b/src/pages/options/lbry/lbry.html new file mode 100644 index 00000000..074ae4b3 --- /dev/null +++ b/src/pages/options/lbry/lbry.html @@ -0,0 +1,125 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg"> + <link href="../../stylesheets/styles.css" rel="stylesheet"> + <title>General</title> + </head> +</html> +<script type="module" src="../../../assets/javascripts/localise.js"></script> +<body class="option" dir="auto"> + <section class="links"> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor"> + <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path> + </svg><a href="../general/general.html" data-localise="__MSG_general__">General</a> + </div> + <div class="title"> <img src="../../../assets/images/youtube-icon.png"><a href="../youtube/youtube.html" data-localise="__MSG_youtube__">YouTube </a></div> + <div class="title"> <img src="../../../assets/images/youtube-music-icon.png"><a href="../youtubeMusic/youtubeMusic.html" data-localise="__MSG_ytmusic__">YT Music</a></div> + <div class="title"> <img src="../../../assets/images/twitter-icon.png"><a href="../twitter/twitter.html" data-localise="__MSG_twitter__">Twitter</a></div> + <div class="title"> <img src="../../../assets/images/instagram-icon.png"><a href="../instagram/instagram.html" data-localise="__MSG_instagram__">Instagram</a></div> + <div class="title"> <img src="../../../assets/images/tiktok-icon.png"><a href="../tiktok/tiktok.html" data-localise="__MSG_tiktok__">TikTok</a></div> + <div class="title"> <img src="../../../assets/images/reddit-icon.png"><a href="../reddit/reddit.html" data-localise="__MSG_reddit__">Reddit</a></div> + <div class="title"> <img src="../../../assets/images/imgur-icon.png"><a href="../imgur/imgur.html" data-localise="__MSG_imgur__">Imgur</a></div> + <div class="title"> <img src="../../../assets/images/pixiv-icon.svg"><a href="../pixiv/pixiv.html" data-localise="__MSG_pixiv__">Pixiv</a></div> + <div class="title"> <img src="../../../assets/images/librespeed-icon.svg"><a href="../speedtest/speedtest.html" data-localise="__MSG_speedtest__">Speedtest</a></div> + <div class="title"> <img src="../../../assets/images/spotify-icon.png"><a href="../spotify/spotify.html" data-localise="__MSG_spotify__">Spotify</a></div> + <div class="title"> <img src="../../../assets/images/wikipedia-icon.svg"><a href="../wikipedia/wikipedia.html" data-localise="__MSG_wikipedia__">Wikipedia</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> + <circle cx="500" cy="500" r="500"></circle> + <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> + <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> + </svg><a href="../medium/medium.html" data-localise="__MSG_medium__">Medium</a> + </div> + <div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a href="../peertube/peertube.html" data-localise="__MSG_peertube__">Peertube</a></div> + <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a class="selected" href="../lbry/lbry.html" data-localise="__MSG_lbry__">LBRY/Odysee</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg><a href="../search/search.html" data-localise="__MSG_search__">Search</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> + </svg><a href="../translate/translate.html" data-localise="__MSG_translate__">Translate</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path> + </svg><a href="../maps/maps.html" data-localise="__MSG_maps__">Maps</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> + </svg><a href="../sendTargets/sendTargets.html" data-localise="__MSG_sendFiles__">Send Files</a> + </div> + </section> + <section class="option-block"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enable__">Enable</h4> + <input id="disable-lbry" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_protocol__">Protocol</h4> + <select id="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"> + <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://librarian.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-label" for="latency"> + <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" style="display:none;"> + </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="https://librarian.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + </section> + <script type="module" src="../init.js"></script> + <script type="module" src="./lbry.js"></script> +</body> \ No newline at end of file diff --git a/src/pages/options/lbry/lbry.js b/src/pages/options/lbry/lbry.js index 75995213..4511373c 100644 --- a/src/pages/options/lbry/lbry.js +++ b/src/pages/options/lbry/lbry.js @@ -35,16 +35,19 @@ lbryHelper.init().then(() => { protocolElement.value = protocol; changeProtocolSettings(protocol); - commonHelper.processDefaultCustomInstances( - 'librarian', - 'normal', - lbryHelper, - document, - lbryHelper.getLibrarianNormalRedirectsChecks, - lbryHelper.setLibrarianNormalRedirectsChecks, - lbryHelper.getLibrarianNormalCustomRedirects, - lbryHelper.setLibrarianNormalCustomRedirects - ); + browser.storage.local.get("librarianLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'librarian', + 'normal', + lbryHelper, + document, + lbryHelper.getLibrarianNormalRedirectsChecks, + lbryHelper.setLibrarianNormalRedirectsChecks, + lbryHelper.getLibrarianNormalCustomRedirects, + lbryHelper.setLibrarianNormalCustomRedirects, + r.librarianLatency, + ); + }) commonHelper.processDefaultCustomInstances( 'librarian', @@ -56,4 +59,34 @@ lbryHelper.init().then(() => { lbryHelper.getLibrarianTorCustomRedirects, lbryHelper.setLibrarianTorCustomRedirects ) -}) \ No newline at end of file +}) + + +let latencyElement = document.getElementById("latency"); +let latencyLabel = document.getElementById("latency-label"); +latencyElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyElement.addEventListener("click", reloadWindow); + await lbryHelper.init(); + let redirects = lbryHelper.getRedirects(); + const oldHtml = latencyLabel.innerHTML; + latencyLabel.innerHTML = '...'; + commonHelper.testLatency(latencyLabel, redirects.librarian.normal).then(r => { + browser.storage.local.set({ librarianLatency: r }); + latencyLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'librarian', + 'normal', + lbryHelper, + document, + lbryHelper.getLibrarianNormalRedirectsChecks, + lbryHelper.setLibrarianNormalRedirectsChecks, + lbryHelper.getLibrarianNormalCustomRedirects, + lbryHelper.setLibrarianNormalCustomRedirects, + r, + ); + latencyElement.removeEventListener("click", reloadWindow); + }); + } +); \ No newline at end of file diff --git a/src/pages/options/maps/maps.html b/src/pages/options/maps/maps.html new file mode 100644 index 00000000..d7c551b6 --- /dev/null +++ b/src/pages/options/maps/maps.html @@ -0,0 +1,105 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg"> + <link href="../../stylesheets/styles.css" rel="stylesheet"> + <title>General</title> + </head> +</html> +<script type="module" src="../../../assets/javascripts/localise.js"></script> +<body class="option" dir="auto"> + <section class="links"> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor"> + <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path> + </svg><a href="../general/general.html" data-localise="__MSG_general__">General</a> + </div> + <div class="title"> <img src="../../../assets/images/youtube-icon.png"><a href="../youtube/youtube.html" data-localise="__MSG_youtube__">YouTube </a></div> + <div class="title"> <img src="../../../assets/images/youtube-music-icon.png"><a href="../youtubeMusic/youtubeMusic.html" data-localise="__MSG_ytmusic__">YT Music</a></div> + <div class="title"> <img src="../../../assets/images/twitter-icon.png"><a href="../twitter/twitter.html" data-localise="__MSG_twitter__">Twitter</a></div> + <div class="title"> <img src="../../../assets/images/instagram-icon.png"><a href="../instagram/instagram.html" data-localise="__MSG_instagram__">Instagram</a></div> + <div class="title"> <img src="../../../assets/images/tiktok-icon.png"><a href="../tiktok/tiktok.html" data-localise="__MSG_tiktok__">TikTok</a></div> + <div class="title"> <img src="../../../assets/images/reddit-icon.png"><a href="../reddit/reddit.html" data-localise="__MSG_reddit__">Reddit</a></div> + <div class="title"> <img src="../../../assets/images/imgur-icon.png"><a href="../imgur/imgur.html" data-localise="__MSG_imgur__">Imgur</a></div> + <div class="title"> <img src="../../../assets/images/pixiv-icon.svg"><a href="../pixiv/pixiv.html" data-localise="__MSG_pixiv__">Pixiv</a></div> + <div class="title"> <img src="../../../assets/images/librespeed-icon.svg"><a href="../speedtest/speedtest.html" data-localise="__MSG_speedtest__">Speedtest</a></div> + <div class="title"> <img src="../../../assets/images/spotify-icon.png"><a href="../spotify/spotify.html" data-localise="__MSG_spotify__">Spotify</a></div> + <div class="title"> <img src="../../../assets/images/wikipedia-icon.svg"><a href="../wikipedia/wikipedia.html" data-localise="__MSG_wikipedia__">Wikipedia</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> + <circle cx="500" cy="500" r="500"></circle> + <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> + <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> + </svg><a href="../medium/medium.html" data-localise="__MSG_medium__">Medium</a> + </div> + <div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a href="../peertube/peertube.html" data-localise="__MSG_peertube__">Peertube</a></div> + <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="../lbry/lbry.html" data-localise="__MSG_lbry__">LBRY/Odysee</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg><a href="../search/search.html" data-localise="__MSG_search__">Search</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> + </svg><a href="../translate/translate.html" data-localise="__MSG_translate__">Translate</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path> + </svg><a class="selected" href="../maps/maps.html" data-localise="__MSG_maps__">Maps</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> + </svg><a href="../sendTargets/sendTargets.html" data-localise="__MSG_sendFiles__">Send Files</a> + </div> + </section> + <section class="option-block"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enable__">Enable</h4> + <input id="disable-osm" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_frontend__">Frontend</h4> + <select id="maps-frontend"> + <option value="osm">OpenStreetMap</option> + <option value="facil">Facil Map</option> + </select> + </div> + <div id="facil"> + <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://facilmap.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-label" for="latency"> + <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" style="display:none;"> + </div> + </div> + </section> + <script type="module" src="../init.js"></script> + <script type="module" src="./maps.js"></script> +</body> \ No newline at end of file diff --git a/src/pages/options/maps/maps.js b/src/pages/options/maps/maps.js index 88a99ab6..17c628dd 100644 --- a/src/pages/options/maps/maps.js +++ b/src/pages/options/maps/maps.js @@ -32,14 +32,46 @@ mapsHelper.init().then(() => { mapsFrontendElement.value = frontend; changeFrontendsSettings(frontend); - commonHelper.processDefaultCustomInstances( - 'facil', - 'normal', - mapsHelper, - document, - mapsHelper.getFacilNormalRedirectsChecks, - mapsHelper.setFacilNormalRedirectsChecks, - mapsHelper.getFacilNormalCustomRedirects, - mapsHelper.setFacilNormalCustomRedirects - ) -}) \ No newline at end of file + browser.storage.local.get("facilLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'facil', + 'normal', + mapsHelper, + document, + mapsHelper.getFacilNormalRedirectsChecks, + mapsHelper.setFacilNormalRedirectsChecks, + mapsHelper.getFacilNormalCustomRedirects, + mapsHelper.setFacilNormalCustomRedirects, + r.facilLatency, + ) + }) +}) + +let latencyElement = document.getElementById("latency"); +let latencyLabel = document.getElementById("latency-label"); +latencyElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyElement.addEventListener("click", reloadWindow); + await mapsHelper.init(); + let redirects = mapsHelper.getRedirects(); + const oldHtml = latencyLabel.innerHTML; + latencyLabel.innerHTML = '...'; + commonHelper.testLatency(latencyLabel, redirects.facil.normal).then(r => { + browser.storage.local.set({ facilLatency: r }); + latencyLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'facil', + 'normal', + mapsHelper, + document, + mapsHelper.getFacilNormalRedirectsChecks, + mapsHelper.setFacilNormalRedirectsChecks, + mapsHelper.getFacilNormalCustomRedirects, + mapsHelper.setFacilNormalCustomRedirects, + r, + ); + latencyElement.removeEventListener("click", reloadWindow); + }); + } +); \ No newline at end of file diff --git a/src/pages/options/medium/medium.html b/src/pages/options/medium/medium.html new file mode 100644 index 00000000..193dbbb8 --- /dev/null +++ b/src/pages/options/medium/medium.html @@ -0,0 +1,125 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg"> + <link href="../../stylesheets/styles.css" rel="stylesheet"> + <title>General</title> + </head> +</html> +<script type="module" src="../../../assets/javascripts/localise.js"></script> +<body class="option" dir="auto"> + <section class="links"> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor"> + <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path> + </svg><a href="../general/general.html" data-localise="__MSG_general__">General</a> + </div> + <div class="title"> <img src="../../../assets/images/youtube-icon.png"><a href="../youtube/youtube.html" data-localise="__MSG_youtube__">YouTube </a></div> + <div class="title"> <img src="../../../assets/images/youtube-music-icon.png"><a href="../youtubeMusic/youtubeMusic.html" data-localise="__MSG_ytmusic__">YT Music</a></div> + <div class="title"> <img src="../../../assets/images/twitter-icon.png"><a href="../twitter/twitter.html" data-localise="__MSG_twitter__">Twitter</a></div> + <div class="title"> <img src="../../../assets/images/instagram-icon.png"><a href="../instagram/instagram.html" data-localise="__MSG_instagram__">Instagram</a></div> + <div class="title"> <img src="../../../assets/images/tiktok-icon.png"><a href="../tiktok/tiktok.html" data-localise="__MSG_tiktok__">TikTok</a></div> + <div class="title"> <img src="../../../assets/images/reddit-icon.png"><a href="../reddit/reddit.html" data-localise="__MSG_reddit__">Reddit</a></div> + <div class="title"> <img src="../../../assets/images/imgur-icon.png"><a href="../imgur/imgur.html" data-localise="__MSG_imgur__">Imgur</a></div> + <div class="title"> <img src="../../../assets/images/pixiv-icon.svg"><a href="../pixiv/pixiv.html" data-localise="__MSG_pixiv__">Pixiv</a></div> + <div class="title"> <img src="../../../assets/images/librespeed-icon.svg"><a href="../speedtest/speedtest.html" data-localise="__MSG_speedtest__">Speedtest</a></div> + <div class="title"> <img src="../../../assets/images/spotify-icon.png"><a href="../spotify/spotify.html" data-localise="__MSG_spotify__">Spotify</a></div> + <div class="title"> <img src="../../../assets/images/wikipedia-icon.svg"><a href="../wikipedia/wikipedia.html" data-localise="__MSG_wikipedia__">Wikipedia</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> + <circle cx="500" cy="500" r="500"></circle> + <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> + <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> + </svg><a class="selected" href="../medium/medium.html" data-localise="__MSG_medium__">Medium</a> + </div> + <div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a href="../peertube/peertube.html" data-localise="__MSG_peertube__">Peertube</a></div> + <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="../lbry/lbry.html" data-localise="__MSG_lbry__">LBRY/Odysee</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg><a href="../search/search.html" data-localise="__MSG_search__">Search</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> + </svg><a href="../translate/translate.html" data-localise="__MSG_translate__">Translate</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path> + </svg><a href="../maps/maps.html" data-localise="__MSG_maps__">Maps</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> + </svg><a href="../sendTargets/sendTargets.html" data-localise="__MSG_sendFiles__">Send Files</a> + </div> + </section> + <section class="option-block"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enable__">Enable</h4> + <input id="disable-medium" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_protocol__">Protocol</h4> + <select id="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"> + <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://scribe.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-label" for="latency"> + <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" style="display:none;"> + </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="https://scribe.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + </section> + <script type="module" src="../init.js"></script> + <script type="module" src="./medium.js"></script> +</body> \ No newline at end of file diff --git a/src/pages/options/medium/medium.js b/src/pages/options/medium/medium.js index 5337e413..d79c1de5 100644 --- a/src/pages/options/medium/medium.js +++ b/src/pages/options/medium/medium.js @@ -36,16 +36,20 @@ mediumHelper.init().then(() => { protocolElement.value = protocol; changeProtocolSettings(protocol); - commonHelper.processDefaultCustomInstances( - 'scribe', - 'normal', - mediumHelper, - document, - mediumHelper.getScribeNormalRedirectsChecks, - mediumHelper.setScribeNormalRedirectsChecks, - mediumHelper.getScribeNormalCustomRedirects, - mediumHelper.setScribeNormalCustomRedirects - ) + + browser.storage.local.get("scribeLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'scribe', + 'normal', + mediumHelper, + document, + mediumHelper.getScribeNormalRedirectsChecks, + mediumHelper.setScribeNormalRedirectsChecks, + mediumHelper.getScribeNormalCustomRedirects, + mediumHelper.setScribeNormalCustomRedirects, + r.scribeLatency, + ) + }) commonHelper.processDefaultCustomInstances( 'scribe', @@ -57,4 +61,33 @@ mediumHelper.init().then(() => { mediumHelper.getScribeTorCustomRedirects, mediumHelper.setScribeTorCustomRedirects ) -}) \ No newline at end of file +}) + +let latencyElement = document.getElementById("latency"); +let latencyLabel = document.getElementById("latency-label"); +latencyElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyElement.addEventListener("click", reloadWindow); + await mediumHelper.init(); + let redirects = mediumHelper.getRedirects(); + const oldHtml = latencyLabel.innerHTML; + latencyLabel.innerHTML = '...'; + commonHelper.testLatency(latencyLabel, redirects.scribe.normal).then(r => { + browser.storage.local.set({ scribeLatency: r }); + latencyLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'scribe', + 'normal', + mediumHelper, + document, + mediumHelper.getScribeNormalRedirectsChecks, + mediumHelper.setScribeNormalRedirectsChecks, + mediumHelper.getScribeNormalCustomRedirects, + mediumHelper.setScribeNormalCustomRedirects, + r, + ); + latencyElement.removeEventListener("click", reloadWindow); + }); + } +); \ No newline at end of file diff --git a/src/pages/options/peertube/peertube.html b/src/pages/options/peertube/peertube.html new file mode 100644 index 00000000..5ebff097 --- /dev/null +++ b/src/pages/options/peertube/peertube.html @@ -0,0 +1,125 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg"> + <link href="../../stylesheets/styles.css" rel="stylesheet"> + <title>General</title> + </head> +</html> +<script type="module" src="../../../assets/javascripts/localise.js"></script> +<body class="option" dir="auto"> + <section class="links"> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor"> + <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path> + </svg><a href="../general/general.html" data-localise="__MSG_general__">General</a> + </div> + <div class="title"> <img src="../../../assets/images/youtube-icon.png"><a href="../youtube/youtube.html" data-localise="__MSG_youtube__">YouTube </a></div> + <div class="title"> <img src="../../../assets/images/youtube-music-icon.png"><a href="../youtubeMusic/youtubeMusic.html" data-localise="__MSG_ytmusic__">YT Music</a></div> + <div class="title"> <img src="../../../assets/images/twitter-icon.png"><a href="../twitter/twitter.html" data-localise="__MSG_twitter__">Twitter</a></div> + <div class="title"> <img src="../../../assets/images/instagram-icon.png"><a href="../instagram/instagram.html" data-localise="__MSG_instagram__">Instagram</a></div> + <div class="title"> <img src="../../../assets/images/tiktok-icon.png"><a href="../tiktok/tiktok.html" data-localise="__MSG_tiktok__">TikTok</a></div> + <div class="title"> <img src="../../../assets/images/reddit-icon.png"><a href="../reddit/reddit.html" data-localise="__MSG_reddit__">Reddit</a></div> + <div class="title"> <img src="../../../assets/images/imgur-icon.png"><a href="../imgur/imgur.html" data-localise="__MSG_imgur__">Imgur</a></div> + <div class="title"> <img src="../../../assets/images/pixiv-icon.svg"><a href="../pixiv/pixiv.html" data-localise="__MSG_pixiv__">Pixiv</a></div> + <div class="title"> <img src="../../../assets/images/librespeed-icon.svg"><a href="../speedtest/speedtest.html" data-localise="__MSG_speedtest__">Speedtest</a></div> + <div class="title"> <img src="../../../assets/images/spotify-icon.png"><a href="../spotify/spotify.html" data-localise="__MSG_spotify__">Spotify</a></div> + <div class="title"> <img src="../../../assets/images/wikipedia-icon.svg"><a href="../wikipedia/wikipedia.html" data-localise="__MSG_wikipedia__">Wikipedia</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> + <circle cx="500" cy="500" r="500"></circle> + <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> + <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> + </svg><a href="../medium/medium.html" data-localise="__MSG_medium__">Medium</a> + </div> + <div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a class="selected" href="../peertube/peertube.html" data-localise="__MSG_peertube__">Peertube</a></div> + <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="../lbry/lbry.html" data-localise="__MSG_lbry__">LBRY/Odysee</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg><a href="../search/search.html" data-localise="__MSG_search__">Search</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> + </svg><a href="../translate/translate.html" data-localise="__MSG_translate__">Translate</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path> + </svg><a href="../maps/maps.html" data-localise="__MSG_maps__">Maps</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> + </svg><a href="../sendTargets/sendTargets.html" data-localise="__MSG_sendFiles__">Send Files</a> + </div> + </section> + <section class="option-block"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enable__">Enable</h4> + <input id="disable-peertube" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_protocol__">Protocol</h4> + <select id="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"> + <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://simpleertube.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-label" for="latency"> + <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" style="display:none;"> + </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="https://simpleertube.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + </section> + <script type="module" src="../init.js"></script> + <script type="module" src="./peertube.js"></script> +</body> \ No newline at end of file diff --git a/src/pages/options/peertube/peertube.js b/src/pages/options/peertube/peertube.js index d01a6e08..0b7a09e6 100644 --- a/src/pages/options/peertube/peertube.js +++ b/src/pages/options/peertube/peertube.js @@ -35,16 +35,18 @@ peertubeHelper.init().then(() => { protocolElement.value = protocol; changeProtocolSettings(protocol); - commonHelper.processDefaultCustomInstances( - 'simpleertube', - 'normal', - peertubeHelper, - document, - peertubeHelper.getSimpleertubeNormalRedirectsChecks, - peertubeHelper.setSimpleertubeNormalRedirectsChecks, - peertubeHelper.getSimpleertubeNormalCustomRedirects, - peertubeHelper.setSimpleertubeNormalCustomRedirects - ); + browser.storage.local.get("simpleertubeLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'simpleertube', + 'normal', + peertubeHelper, + document, + peertubeHelper.getSimpleertubeNormalRedirectsChecks, + peertubeHelper.setSimpleertubeNormalRedirectsChecks, + peertubeHelper.getSimpleertubeNormalCustomRedirects, + peertubeHelper.setSimpleertubeNormalCustomRedirects + ); + }) commonHelper.processDefaultCustomInstances( 'simpleertube', @@ -56,4 +58,34 @@ peertubeHelper.init().then(() => { peertubeHelper.getSimpleertubeTorCustomRedirects, peertubeHelper.setSimpleertubeTorCustomRedirects ) -}) \ No newline at end of file +}) + + +let latencyElement = document.getElementById("latency"); +let latencyLabel = document.getElementById("latency-label"); +latencyElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyElement.addEventListener("click", reloadWindow); + await peertubeHelper.init(); + let redirects = peertubeHelper.getRedirects(); + const oldHtml = latencyLabel.innerHTML; + latencyLabel.innerHTML = '...'; + commonHelper.testLatency(latencyLabel, redirects.simpleertube.normal).then(r => { + browser.storage.local.set({ simpleertubeLatency: r }); + latencyLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'simpleertube', + 'normal', + peertubeHelper, + document, + peertubeHelper.getSimpleertubeNormalRedirectsChecks, + peertubeHelper.setSimpleertubeNormalRedirectsChecks, + peertubeHelper.getSimpleertubeNormalCustomRedirects, + peertubeHelper.setSimpleertubeNormalCustomRedirects, + r, + ); + latencyElement.removeEventListener("click", reloadWindow); + }); + } +); \ No newline at end of file diff --git a/src/pages/options/pixiv/pixiv.html b/src/pages/options/pixiv/pixiv.html new file mode 100644 index 00000000..36825094 --- /dev/null +++ b/src/pages/options/pixiv/pixiv.html @@ -0,0 +1,133 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg"> + <link href="../../stylesheets/styles.css" rel="stylesheet"> + <title>General</title> + </head> +</html> +<script type="module" src="../../../assets/javascripts/localise.js"></script> +<body class="option" dir="auto"> + <section class="links"> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor"> + <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path> + </svg><a href="../general/general.html" data-localise="__MSG_general__">General</a> + </div> + <div class="title"> <img src="../../../assets/images/youtube-icon.png"><a href="../youtube/youtube.html" data-localise="__MSG_youtube__">YouTube </a></div> + <div class="title"> <img src="../../../assets/images/youtube-music-icon.png"><a href="../youtubeMusic/youtubeMusic.html" data-localise="__MSG_ytmusic__">YT Music</a></div> + <div class="title"> <img src="../../../assets/images/twitter-icon.png"><a href="../twitter/twitter.html" data-localise="__MSG_twitter__">Twitter</a></div> + <div class="title"> <img src="../../../assets/images/instagram-icon.png"><a href="../instagram/instagram.html" data-localise="__MSG_instagram__">Instagram</a></div> + <div class="title"> <img src="../../../assets/images/tiktok-icon.png"><a href="../tiktok/tiktok.html" data-localise="__MSG_tiktok__">TikTok</a></div> + <div class="title"> <img src="../../../assets/images/reddit-icon.png"><a href="../reddit/reddit.html" data-localise="__MSG_reddit__">Reddit</a></div> + <div class="title"> <img src="../../../assets/images/imgur-icon.png"><a href="../imgur/imgur.html" data-localise="__MSG_imgur__">Imgur</a></div> + <div class="title"> <img src="../../../assets/images/pixiv-icon.svg"><a class="selected" href="../pixiv/pixiv.html" data-localise="__MSG_pixiv__">Pixiv</a></div> + <div class="title"> <img src="../../../assets/images/librespeed-icon.svg"><a href="../speedtest/speedtest.html" data-localise="__MSG_speedtest__">Speedtest</a></div> + <div class="title"> <img src="../../../assets/images/spotify-icon.png"><a href="../spotify/spotify.html" data-localise="__MSG_spotify__">Spotify</a></div> + <div class="title"> <img src="../../../assets/images/wikipedia-icon.svg"><a href="../wikipedia/wikipedia.html" data-localise="__MSG_wikipedia__">Wikipedia</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> + <circle cx="500" cy="500" r="500"></circle> + <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> + <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> + </svg><a href="../medium/medium.html" data-localise="__MSG_medium__">Medium</a> + </div> + <div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a href="../peertube/peertube.html" data-localise="__MSG_peertube__">Peertube</a></div> + <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="../lbry/lbry.html" data-localise="__MSG_lbry__">LBRY/Odysee</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg><a href="../search/search.html" data-localise="__MSG_search__">Search</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> + </svg><a href="../translate/translate.html" data-localise="__MSG_translate__">Translate</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path> + </svg><a href="../maps/maps.html" data-localise="__MSG_maps__">Maps</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> + </svg><a href="../sendTargets/sendTargets.html" data-localise="__MSG_sendFiles__">Send Files</a> + </div> + </section> + <section class="option-block"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enable__">Enable</h4> + <input id="disable-pixiv" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4> + <x data-localise="__MSG_frontend__">Frontend</x>:<span style="color:red;" data-localise="__MSG_notFullyPrivate__">This isn't a fully private frontend</span> + </h4> + <select id="maps-frontend"> + <option value="pixivMoe" data-localise="__MSG_pixivMoe__">pixiv萌え</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_protocol__">Protocol</h4> + <select id="protocol"> + <option value="normal" data-localise="__MSG_normal__">Normal</option> + <option value="tor" data-localise="__MSG_tor__">Tor </option> + </select> + </div> + <div id="pixivMoe"> + <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://pixivMoe.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-label" for="latency"> + <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" style="display:none;"> + </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="https://pixivMoe.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + </section> + <script type="module" src="../init.js"></script> + <script type="module" src="./pixiv.js"></script> +</body> \ No newline at end of file diff --git a/src/pages/options/pixiv/pixiv.js b/src/pages/options/pixiv/pixiv.js index a9a11e18..fe60734b 100644 --- a/src/pages/options/pixiv/pixiv.js +++ b/src/pages/options/pixiv/pixiv.js @@ -35,16 +35,19 @@ pixivHelper.init().then(() => { protocolElement.value = protocol; changeProtocolSettings(protocol); - commonHelper.processDefaultCustomInstances( - 'pixivMoe', - 'normal', - pixivHelper, - document, - pixivHelper.getPixivMoeNormalRedirectsChecks, - pixivHelper.setPixivMoeNormalRedirectsChecks, - pixivHelper.getPixivMoeNormalCustomRedirects, - pixivHelper.setPixivMoeNormalCustomRedirects - ); + + browser.storage.local.get("pixivMoeLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'pixivMoe', + 'normal', + pixivHelper, + document, + pixivHelper.getPixivMoeNormalRedirectsChecks, + pixivHelper.setPixivMoeNormalRedirectsChecks, + pixivHelper.getPixivMoeNormalCustomRedirects, + pixivHelper.setPixivMoeNormalCustomRedirects + ); + }) commonHelper.processDefaultCustomInstances( 'pixivMoe', @@ -56,4 +59,35 @@ pixivHelper.init().then(() => { pixivHelper.getPixivMoeTorCustomRedirects, pixivHelper.setPixivMoeTorCustomRedirects ) -}) \ No newline at end of file +}) + + +let latencyElement = document.getElementById("latency"); +let latencyLabel = document.getElementById("latency-label"); +latencyElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyElement.addEventListener("click", reloadWindow); + await pixivHelper.init(); + let redirects = pixivHelper.getRedirects(); + const oldHtml = latencyLabel.innerHTML; + latencyLabel.innerHTML = '...'; + commonHelper.testLatency(latencyLabel, redirects.pixivMoe.normal).then(r => { + browser.storage.local.set({ pixivMoeLatency: r }); + latencyLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'pixivMoe', + 'normal', + pixivHelper, + document, + pixivHelper.getPixivMoeNormalRedirectsChecks, + pixivHelper.setPixivMoeNormalRedirectsChecks, + pixivHelper.getPixivMoeNormalCustomRedirects, + pixivHelper.setPixivMoeNormalCustomRedirects, + r, + ); + latencyElement.removeEventListener("click", reloadWindow); + }); + + } +); \ No newline at end of file diff --git a/src/pages/options/reddit/reddit.html b/src/pages/options/reddit/reddit.html new file mode 100644 index 00000000..2ded8094 --- /dev/null +++ b/src/pages/options/reddit/reddit.html @@ -0,0 +1,188 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg"> + <link href="../../stylesheets/styles.css" rel="stylesheet"> + <title>General</title> + </head> +</html> +<script type="module" src="../../../assets/javascripts/localise.js"></script> +<body class="option" dir="auto"> + <section class="links"> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor"> + <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path> + </svg><a href="../general/general.html" data-localise="__MSG_general__">General</a> + </div> + <div class="title"> <img src="../../../assets/images/youtube-icon.png"><a href="../youtube/youtube.html" data-localise="__MSG_youtube__">YouTube </a></div> + <div class="title"> <img src="../../../assets/images/youtube-music-icon.png"><a href="../youtubeMusic/youtubeMusic.html" data-localise="__MSG_ytmusic__">YT Music</a></div> + <div class="title"> <img src="../../../assets/images/twitter-icon.png"><a href="../twitter/twitter.html" data-localise="__MSG_twitter__">Twitter</a></div> + <div class="title"> <img src="../../../assets/images/instagram-icon.png"><a href="../instagram/instagram.html" data-localise="__MSG_instagram__">Instagram</a></div> + <div class="title"> <img src="../../../assets/images/tiktok-icon.png"><a href="../tiktok/tiktok.html" data-localise="__MSG_tiktok__">TikTok</a></div> + <div class="title"> <img src="../../../assets/images/reddit-icon.png"><a class="selected" href="../reddit/reddit.html" data-localise="__MSG_reddit__">Reddit</a></div> + <div class="title"> <img src="../../../assets/images/imgur-icon.png"><a href="../imgur/imgur.html" data-localise="__MSG_imgur__">Imgur</a></div> + <div class="title"> <img src="../../../assets/images/pixiv-icon.svg"><a href="../pixiv/pixiv.html" data-localise="__MSG_pixiv__">Pixiv</a></div> + <div class="title"> <img src="../../../assets/images/librespeed-icon.svg"><a href="../speedtest/speedtest.html" data-localise="__MSG_speedtest__">Speedtest</a></div> + <div class="title"> <img src="../../../assets/images/spotify-icon.png"><a href="../spotify/spotify.html" data-localise="__MSG_spotify__">Spotify</a></div> + <div class="title"> <img src="../../../assets/images/wikipedia-icon.svg"><a href="../wikipedia/wikipedia.html" data-localise="__MSG_wikipedia__">Wikipedia</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> + <circle cx="500" cy="500" r="500"></circle> + <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> + <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> + </svg><a href="../medium/medium.html" data-localise="__MSG_medium__">Medium</a> + </div> + <div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a href="../peertube/peertube.html" data-localise="__MSG_peertube__">Peertube</a></div> + <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="../lbry/lbry.html" data-localise="__MSG_lbry__">LBRY/Odysee</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg><a href="../search/search.html" data-localise="__MSG_search__">Search</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> + </svg><a href="../translate/translate.html" data-localise="__MSG_translate__">Translate</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path> + </svg><a href="../maps/maps.html" data-localise="__MSG_maps__">Maps</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> + </svg><a href="../sendTargets/sendTargets.html" data-localise="__MSG_sendFiles__">Send Files</a> + </div> + </section> + <section class="option-block"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enable__">Enable</h4> + <input id="disable-reddit" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 id="frontend" data-localise="__MSG_frontend__">Frontend</h4> + <select id="reddit-frontend"> + <option value="libreddit">Libreddit</option> + <option value="teddit">Teddit</option> + <option value="old">old.reddit.com</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_protocol__">Protocol</h4> + <select id="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_bypassReddit__">Bypass "Open in Reddit"</h4> + <input id="bypass-watch-on-reddit" type="checkbox"> + </div> + <hr> + <div id="libreddit"> + <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://libreddit.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-libreddit-label" for="latency-libreddit"> + <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-libreddit" style="display:none;"> + </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="https://libreddit.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + <div id="teddit"> + <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://teddit.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-teddit-label" for="latency-teddit"> + <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-teddit" style="display:none;"> + </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="https://teddit.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + </section> + <script type="module" src="../init.js"></script> + <script type="module" src="./reddit.js"></script> +</body> \ No newline at end of file diff --git a/src/pages/options/reddit/reddit.js b/src/pages/options/reddit/reddit.js index 1c577a94..36bb8a5f 100644 --- a/src/pages/options/reddit/reddit.js +++ b/src/pages/options/reddit/reddit.js @@ -81,16 +81,19 @@ redditHelper.init().then(() => { protocolElement.value = protocol; changeProtocolSettings(protocol); - commonHelper.processDefaultCustomInstances( - 'libreddit', - 'normal', - redditHelper, - document, - redditHelper.getLibredditNormalRedirectsChecks, - redditHelper.setLibredditNormalRedirectsChecks, - redditHelper.getLibredditNormalCustomRedirects, - redditHelper.setLibredditNormalCustomRedirects - ) + browser.storage.local.get("libredditLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'libreddit', + 'normal', + redditHelper, + document, + redditHelper.getLibredditNormalRedirectsChecks, + redditHelper.setLibredditNormalRedirectsChecks, + redditHelper.getLibredditNormalCustomRedirects, + redditHelper.setLibredditNormalCustomRedirects, + r.libredditLatency, + ) + }) commonHelper.processDefaultCustomInstances( 'libreddit', @@ -103,16 +106,19 @@ redditHelper.init().then(() => { redditHelper.setLibredditTorCustomRedirects ) - commonHelper.processDefaultCustomInstances( - 'teddit', - 'normal', - redditHelper, - document, - redditHelper.getTedditNormalRedirectsChecks, - redditHelper.setTedditNormalRedirectsChecks, - redditHelper.getTedditNormalCustomRedirects, - redditHelper.setTedditNormalCustomRedirects - ); + browser.storage.local.get("tedditLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'teddit', + 'normal', + redditHelper, + document, + redditHelper.getTedditNormalRedirectsChecks, + redditHelper.setTedditNormalRedirectsChecks, + redditHelper.getTedditNormalCustomRedirects, + redditHelper.setTedditNormalCustomRedirects, + r.tedditLatency, + ); + }) commonHelper.processDefaultCustomInstances( 'teddit', @@ -126,3 +132,62 @@ redditHelper.init().then(() => { ); }) + + +let latencyLibredditElement = document.getElementById("latency-libreddit"); +let latencyLibredditLabel = document.getElementById("latency-libreddit-label"); +latencyLibredditElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyLibredditElement.addEventListener("click", reloadWindow); + await redditHelper.init(); + let redirects = redditHelper.getRedirects(); + const oldHtml = latencyLibredditLabel.innerHTML; + latencyLibredditLabel.innerHTML = '...'; + commonHelper.testLatency(latencyLibredditLabel, redirects.libreddit.normal).then(r => { + browser.storage.local.set({ libredditLatency: r }); + latencyLibredditLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'libreddit', + 'normal', + redditHelper, + document, + redditHelper.getLibredditNormalRedirectsChecks, + redditHelper.setLibredditNormalRedirectsChecks, + redditHelper.getLibredditNormalCustomRedirects, + redditHelper.setLibredditNormalCustomRedirects, + r, + ); + latencyLibredditElement.removeEventListener("click", reloadWindow); + }); + } +); + +let latencyTedditElement = document.getElementById("latency-teddit"); +let latencyTedditLabel = document.getElementById("latency-teddit-label"); +latencyTedditElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyTedditElement.addEventListener("click", reloadWindow); + await redditHelper.init(); + let redirects = redditHelper.getRedirects(); + const oldHtml = latencyTedditLabel.innerHTML; + latencyTedditLabel.innerHTML = '...'; + commonHelper.testLatency(latencyTedditLabel, redirects.teddit.normal).then(r => { + browser.storage.local.set({ tedditLatency: r }); + latencyTedditLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'teddit', + 'normal', + redditHelper, + document, + redditHelper.getTedditNormalRedirectsChecks, + redditHelper.setTedditNormalRedirectsChecks, + redditHelper.getTedditNormalCustomRedirects, + redditHelper.setTedditNormalCustomRedirects, + r, + ); + latencyTedditElement.removeEventListener("click", reloadWindow); + }); + } +); \ No newline at end of file diff --git a/src/pages/options/search/search.html b/src/pages/options/search/search.html new file mode 100644 index 00000000..622c0799 --- /dev/null +++ b/src/pages/options/search/search.html @@ -0,0 +1,300 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg"> + <link href="../../stylesheets/styles.css" rel="stylesheet"> + <title>General</title> + </head> +</html> +<script type="module" src="../../../assets/javascripts/localise.js"></script> +<body class="option" dir="auto"> + <section class="links"> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor"> + <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path> + </svg><a href="../general/general.html" data-localise="__MSG_general__">General</a> + </div> + <div class="title"> <img src="../../../assets/images/youtube-icon.png"><a href="../youtube/youtube.html" data-localise="__MSG_youtube__">YouTube </a></div> + <div class="title"> <img src="../../../assets/images/youtube-music-icon.png"><a href="../youtubeMusic/youtubeMusic.html" data-localise="__MSG_ytmusic__">YT Music</a></div> + <div class="title"> <img src="../../../assets/images/twitter-icon.png"><a href="../twitter/twitter.html" data-localise="__MSG_twitter__">Twitter</a></div> + <div class="title"> <img src="../../../assets/images/instagram-icon.png"><a href="../instagram/instagram.html" data-localise="__MSG_instagram__">Instagram</a></div> + <div class="title"> <img src="../../../assets/images/tiktok-icon.png"><a href="../tiktok/tiktok.html" data-localise="__MSG_tiktok__">TikTok</a></div> + <div class="title"> <img src="../../../assets/images/reddit-icon.png"><a href="../reddit/reddit.html" data-localise="__MSG_reddit__">Reddit</a></div> + <div class="title"> <img src="../../../assets/images/imgur-icon.png"><a href="../imgur/imgur.html" data-localise="__MSG_imgur__">Imgur</a></div> + <div class="title"> <img src="../../../assets/images/pixiv-icon.svg"><a href="../pixiv/pixiv.html" data-localise="__MSG_pixiv__">Pixiv</a></div> + <div class="title"> <img src="../../../assets/images/librespeed-icon.svg"><a href="../speedtest/speedtest.html" data-localise="__MSG_speedtest__">Speedtest</a></div> + <div class="title"> <img src="../../../assets/images/spotify-icon.png"><a href="../spotify/spotify.html" data-localise="__MSG_spotify__">Spotify</a></div> + <div class="title"> <img src="../../../assets/images/wikipedia-icon.svg"><a href="../wikipedia/wikipedia.html" data-localise="__MSG_wikipedia__">Wikipedia</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> + <circle cx="500" cy="500" r="500"></circle> + <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> + <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> + </svg><a href="../medium/medium.html" data-localise="__MSG_medium__">Medium</a> + </div> + <div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a href="../peertube/peertube.html" data-localise="__MSG_peertube__">Peertube</a></div> + <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="../lbry/lbry.html" data-localise="__MSG_lbry__">LBRY/Odysee</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg><a class="selected" href="../search/search.html" data-localise="__MSG_search__">Search</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> + </svg><a href="../translate/translate.html" data-localise="__MSG_translate__">Translate</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path> + </svg><a href="../maps/maps.html" data-localise="__MSG_maps__">Maps</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> + </svg><a href="../sendTargets/sendTargets.html" data-localise="__MSG_sendFiles__">Send Files</a> + </div> + </section> + <section class="option-block"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enable__">Enable</h4> + <input id="disable-search" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 id="frontend" data-localise="__MSG_frontend__">Frontend</h4> + <select id="search-frontend"> + <option value="searx">SearX</option> + <option value="searxng">SearXNG</option> + <option value="whoogle">Whoogle</option> + <option value="startpage">Startpage</option> + </select> + </div> + <div id="searx-whoogle"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_protocol__">Protocol</h4> + <select id="protocol"> + <option value="normal" data-localise="__MSG_normal__">Normal</option> + <option value="tor" data-localise="__MSG_tor__">Tor</option> + <option value="i2p" data-localise="__MSG_i2p__">I2P</option> + </select> + </div> + </div> + <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> + </div> + <div id="searx"> + <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://searx.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-searx-label" for="latency-searx"> + <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-searx" style="display:none;"> + </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="https://searx.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </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="https://searx.i2p" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + <div id="searxng"> + <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://searxng.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-searxng-label" for="latency-searxng"> + <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-searxng" style="display:none;"> + </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="https://searxng.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </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="https://searxng.i2p" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + <div id="whoogle"> + <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://whoogle.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-whoogle-label" for="latency-whoogle"> + <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-whoogle" style="display:none;"> + </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="https://whoogle.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </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="https://whoogle.i2p" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + </section> + <script type="module" src="../init.js"></script> + <script type="module" src="./search.js"></script> +</body> \ No newline at end of file diff --git a/src/pages/options/search/search.js b/src/pages/options/search/search.js index 0eeac5ed..14834309 100644 --- a/src/pages/options/search/search.js +++ b/src/pages/options/search/search.js @@ -118,16 +118,19 @@ searchHelper.init().then(() => { protocolElement.value = protocol; changeProtocolSettings(protocol); - commonHelper.processDefaultCustomInstances( - 'searx', - 'normal', - searchHelper, - document, - searchHelper.getSearxNormalRedirectsChecks, - searchHelper.setSearxNormalRedirectsChecks, - searchHelper.getSearxNormalCustomRedirects, - searchHelper.setSearxNormalCustomRedirects - ); + browser.storage.local.get("searxLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'searx', + 'normal', + searchHelper, + document, + searchHelper.getSearxNormalRedirectsChecks, + searchHelper.setSearxNormalRedirectsChecks, + searchHelper.getSearxNormalCustomRedirects, + searchHelper.setSearxNormalCustomRedirects, + r.searxLatency + ); + }) commonHelper.processDefaultCustomInstances( 'searx', @@ -151,16 +154,19 @@ searchHelper.init().then(() => { searchHelper.setSearxI2pCustomRedirects ); - commonHelper.processDefaultCustomInstances( - 'searxng', - 'normal', - searchHelper, - document, - searchHelper.getSearxngNormalRedirectsChecks, - searchHelper.setSearxngNormalRedirectsChecks, - searchHelper.getSearxngNormalCustomRedirects, - searchHelper.setSearxngNormalCustomRedirects - ); + browser.storage.local.get("searxngLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'searxng', + 'normal', + searchHelper, + document, + searchHelper.getSearxngNormalRedirectsChecks, + searchHelper.setSearxngNormalRedirectsChecks, + searchHelper.getSearxngNormalCustomRedirects, + searchHelper.setSearxngNormalCustomRedirects, + r.searxngLatency, + ); + }) commonHelper.processDefaultCustomInstances( 'searxng', @@ -184,16 +190,19 @@ searchHelper.init().then(() => { searchHelper.setSearxngI2pCustomRedirects ); - commonHelper.processDefaultCustomInstances( - 'whoogle', - 'normal', - searchHelper, - document, - searchHelper.getWhoogleNormalRedirectsChecks, - searchHelper.setWhoogleNormalRedirectsChecks, - searchHelper.getWhoogleNormalCustomRedirects, - searchHelper.setWhoogleNormalCustomRedirects - ); + browser.storage.local.get("whoogleLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'whoogle', + 'normal', + searchHelper, + document, + searchHelper.getWhoogleNormalRedirectsChecks, + searchHelper.setWhoogleNormalRedirectsChecks, + searchHelper.getWhoogleNormalCustomRedirects, + searchHelper.setWhoogleNormalCustomRedirects, + r.whoogleLatency, + ); + }) commonHelper.processDefaultCustomInstances( 'whoogle', @@ -217,3 +226,91 @@ searchHelper.init().then(() => { searchHelper.setWhoogleI2pCustomRedirects ); }); + + +let latencySearxElement = document.getElementById("latency-searx"); +let latencySearxLabel = document.getElementById("latency-searx-label"); +latencySearxElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencySearxElement.addEventListener("click", reloadWindow); + await searchHelper.init(); + let redirects = searchHelper.getRedirects(); + const oldHtml = latencySearxLabel.innerHTML; + latencySearxLabel.innerHTML = '...'; + commonHelper.testLatency(latencySearxLabel, redirects.searx.normal).then(r => { + browser.storage.local.set({ searxLatency: r }); + latencySearxLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'searx', + 'normal', + searchHelper, + document, + searchHelper.getSearxNormalRedirectsChecks, + searchHelper.setSearxNormalRedirectsChecks, + searchHelper.getSearxNormalCustomRedirects, + searchHelper.setSearxNormalCustomRedirects, + r, + ); + latencySearxElement.removeEventListener("click", reloadWindow); + }); + } +); + +let latencySearxngElement = document.getElementById("latency-searxng"); +let latencySearxngLabel = document.getElementById("latency-searxng-label"); +latencySearxngElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencySearxngElement.addEventListener("click", reloadWindow); + await searchHelper.init(); + let redirects = searchHelper.getRedirects(); + const oldHtml = latencySearxngLabel.innerHTML; + latencySearxngLabel.innerHTML = '...'; + commonHelper.testLatency(latencySearxngLabel, redirects.searxng.normal).then(r => { + browser.storage.local.set({ searxngLatency: r }); + latencySearxngLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'searxng', + 'normal', + searchHelper, + document, + searchHelper.getSearxngNormalRedirectsChecks, + searchHelper.setSearxngNormalRedirectsChecks, + searchHelper.getSearxngNormalCustomRedirects, + searchHelper.setSearxngNormalCustomRedirects, + r, + ); + latencySearxngElement.removeEventListener("click", reloadWindow); + }); + } +); + +let latencyWhoogleElement = document.getElementById("latency-whoogle"); +let latencyWhoogleLabel = document.getElementById("latency-whoogle-label"); +latencyWhoogleElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyWhoogleElement.addEventListener("click", reloadWindow); + await searchHelper.init(); + let redirects = searchHelper.getRedirects(); + const oldHtml = latencyWhoogleLabel.innerHTML; + latencyWhoogleLabel.innerHTML = '...'; + commonHelper.testLatency(latencyWhoogleLabel, redirects.whoogle.normal).then(r => { + browser.storage.local.set({ whoogleLatency: r }); + latencyWhoogleLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'whoogle', + 'normal', + searchHelper, + document, + searchHelper.getWhoogleNormalRedirectsChecks, + searchHelper.setWhoogleNormalRedirectsChecks, + searchHelper.getWhoogleNormalCustomRedirects, + searchHelper.setWhoogleNormalCustomRedirects, + r, + ); + latencyWhoogleElement.removeEventListener("click", reloadWindow); + }); + } +); \ No newline at end of file diff --git a/src/pages/options/sendTargets/sendTargets.html b/src/pages/options/sendTargets/sendTargets.html new file mode 100644 index 00000000..d514b8f0 --- /dev/null +++ b/src/pages/options/sendTargets/sendTargets.html @@ -0,0 +1,125 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg"> + <link href="../../stylesheets/styles.css" rel="stylesheet"> + <title>General</title> + </head> +</html> +<script type="module" src="../../../assets/javascripts/localise.js"></script> +<body class="option" dir="auto"> + <section class="links"> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor"> + <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path> + </svg><a href="../general/general.html" data-localise="__MSG_general__">General</a> + </div> + <div class="title"> <img src="../../../assets/images/youtube-icon.png"><a href="../youtube/youtube.html" data-localise="__MSG_youtube__">YouTube </a></div> + <div class="title"> <img src="../../../assets/images/youtube-music-icon.png"><a href="../youtubeMusic/youtubeMusic.html" data-localise="__MSG_ytmusic__">YT Music</a></div> + <div class="title"> <img src="../../../assets/images/twitter-icon.png"><a href="../twitter/twitter.html" data-localise="__MSG_twitter__">Twitter</a></div> + <div class="title"> <img src="../../../assets/images/instagram-icon.png"><a href="../instagram/instagram.html" data-localise="__MSG_instagram__">Instagram</a></div> + <div class="title"> <img src="../../../assets/images/tiktok-icon.png"><a href="../tiktok/tiktok.html" data-localise="__MSG_tiktok__">TikTok</a></div> + <div class="title"> <img src="../../../assets/images/reddit-icon.png"><a href="../reddit/reddit.html" data-localise="__MSG_reddit__">Reddit</a></div> + <div class="title"> <img src="../../../assets/images/imgur-icon.png"><a href="../imgur/imgur.html" data-localise="__MSG_imgur__">Imgur</a></div> + <div class="title"> <img src="../../../assets/images/pixiv-icon.svg"><a href="../pixiv/pixiv.html" data-localise="__MSG_pixiv__">Pixiv</a></div> + <div class="title"> <img src="../../../assets/images/librespeed-icon.svg"><a href="../speedtest/speedtest.html" data-localise="__MSG_speedtest__">Speedtest</a></div> + <div class="title"> <img src="../../../assets/images/spotify-icon.png"><a href="../spotify/spotify.html" data-localise="__MSG_spotify__">Spotify</a></div> + <div class="title"> <img src="../../../assets/images/wikipedia-icon.svg"><a href="../wikipedia/wikipedia.html" data-localise="__MSG_wikipedia__">Wikipedia</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> + <circle cx="500" cy="500" r="500"></circle> + <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> + <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> + </svg><a href="../medium/medium.html" data-localise="__MSG_medium__">Medium</a> + </div> + <div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a href="../peertube/peertube.html" data-localise="__MSG_peertube__">Peertube</a></div> + <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="../lbry/lbry.html" data-localise="__MSG_lbry__">LBRY/Odysee</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg><a href="../search/search.html" data-localise="__MSG_search__">Search</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> + </svg><a href="../translate/translate.html" data-localise="__MSG_translate__">Translate</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path> + </svg><a href="../maps/maps.html" data-localise="__MSG_maps__">Maps</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> + </svg><a class="selected" href="../sendTargets/sendTargets.html" data-localise="__MSG_sendFiles__">Send Files</a> + </div> + </section> + <section class="option-block"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enable__">Enable</h4> + <input id="disable-sendTargets" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_protocol__">Protocol</h4> + <select id="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"> + <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://send.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-label" for="latency"> + <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" style="display:none;"> + </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="https://send.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + </section> + <script type="module" src="../init.js"></script> + <script type="module" src="./sendTargets.js"></script> +</body> \ No newline at end of file diff --git a/src/pages/options/sendTargets/sendTargets.js b/src/pages/options/sendTargets/sendTargets.js index 1e39e246..ae6f9e77 100644 --- a/src/pages/options/sendTargets/sendTargets.js +++ b/src/pages/options/sendTargets/sendTargets.js @@ -35,16 +35,19 @@ sendTargetsHelper.init().then(() => { protocolElement.value = protocol; changeProtocolSettings(protocol); - commonHelper.processDefaultCustomInstances( - 'send', - 'normal', - sendTargetsHelper, - document, - sendTargetsHelper.getSendNormalRedirectsChecks, - sendTargetsHelper.setSendNormalRedirectsChecks, - sendTargetsHelper.getSendNormalCustomRedirects, - sendTargetsHelper.setSendNormalCustomRedirects - ); + browser.storage.local.get("sendLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'send', + 'normal', + sendTargetsHelper, + document, + sendTargetsHelper.getSendNormalRedirectsChecks, + sendTargetsHelper.setSendNormalRedirectsChecks, + sendTargetsHelper.getSendNormalCustomRedirects, + sendTargetsHelper.setSendNormalCustomRedirects, + r.sendLatency, + ); + }) commonHelper.processDefaultCustomInstances( 'send', @@ -56,4 +59,33 @@ sendTargetsHelper.init().then(() => { sendTargetsHelper.getSendTorCustomRedirects, sendTargetsHelper.setSendTorCustomRedirects ) -}) \ No newline at end of file +}) + +let latencyElement = document.getElementById("latency"); +let latencyLabel = document.getElementById("latency-label"); +latencyElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyElement.addEventListener("click", reloadWindow); + await sendTargetsHelper.init(); + let redirects = sendTargetsHelper.getRedirects(); + const oldHtml = latencyLabel.innerHTML; + latencyLabel.innerHTML = '...'; + commonHelper.testLatency(latencyLabel, redirects.send.normal).then(r => { + browser.storage.local.set({ sendLatency: r }); + latencyLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'send', + 'normal', + sendTargetsHelper, + document, + sendTargetsHelper.getSendNormalRedirectsChecks, + sendTargetsHelper.setSendNormalRedirectsChecks, + sendTargetsHelper.getSendNormalCustomRedirects, + sendTargetsHelper.setSendNormalCustomRedirects, + r, + ) + latencyElement.removeEventListener("click", reloadWindow) + }); + } +); \ No newline at end of file diff --git a/src/pages/options/speedtest/speedtest.html b/src/pages/options/speedtest/speedtest.html new file mode 100644 index 00000000..50a195e2 --- /dev/null +++ b/src/pages/options/speedtest/speedtest.html @@ -0,0 +1,125 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg"> + <link href="../../stylesheets/styles.css" rel="stylesheet"> + <title>General</title> + </head> +</html> +<script type="module" src="../../../assets/javascripts/localise.js"></script> +<body class="option" dir="auto"> + <section class="links"> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor"> + <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path> + </svg><a href="../general/general.html" data-localise="__MSG_general__">General</a> + </div> + <div class="title"> <img src="../../../assets/images/youtube-icon.png"><a href="../youtube/youtube.html" data-localise="__MSG_youtube__">YouTube </a></div> + <div class="title"> <img src="../../../assets/images/youtube-music-icon.png"><a href="../youtubeMusic/youtubeMusic.html" data-localise="__MSG_ytmusic__">YT Music</a></div> + <div class="title"> <img src="../../../assets/images/twitter-icon.png"><a href="../twitter/twitter.html" data-localise="__MSG_twitter__">Twitter</a></div> + <div class="title"> <img src="../../../assets/images/instagram-icon.png"><a href="../instagram/instagram.html" data-localise="__MSG_instagram__">Instagram</a></div> + <div class="title"> <img src="../../../assets/images/tiktok-icon.png"><a href="../tiktok/tiktok.html" data-localise="__MSG_tiktok__">TikTok</a></div> + <div class="title"> <img src="../../../assets/images/reddit-icon.png"><a href="../reddit/reddit.html" data-localise="__MSG_reddit__">Reddit</a></div> + <div class="title"> <img src="../../../assets/images/imgur-icon.png"><a href="../imgur/imgur.html" data-localise="__MSG_imgur__">Imgur</a></div> + <div class="title"> <img src="../../../assets/images/pixiv-icon.svg"><a href="../pixiv/pixiv.html" data-localise="__MSG_pixiv__">Pixiv</a></div> + <div class="title"> <img src="../../../assets/images/librespeed-icon.svg"><a class="selected" href="../speedtest/speedtest.html" data-localise="__MSG_speedtest__">Speedtest</a></div> + <div class="title"> <img src="../../../assets/images/spotify-icon.png"><a href="../spotify/spotify.html" data-localise="__MSG_spotify__">Spotify</a></div> + <div class="title"> <img src="../../../assets/images/wikipedia-icon.svg"><a href="../wikipedia/wikipedia.html" data-localise="__MSG_wikipedia__">Wikipedia</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> + <circle cx="500" cy="500" r="500"></circle> + <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> + <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> + </svg><a href="../medium/medium.html" data-localise="__MSG_medium__">Medium</a> + </div> + <div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a href="../peertube/peertube.html" data-localise="__MSG_peertube__">Peertube</a></div> + <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="../lbry/lbry.html" data-localise="__MSG_lbry__">LBRY/Odysee</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg><a href="../search/search.html" data-localise="__MSG_search__">Search</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> + </svg><a href="../translate/translate.html" data-localise="__MSG_translate__">Translate</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path> + </svg><a href="../maps/maps.html" data-localise="__MSG_maps__">Maps</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> + </svg><a href="../sendTargets/sendTargets.html" data-localise="__MSG_sendFiles__">Send Files</a> + </div> + </section> + <section class="option-block"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enable__">Enable</h4> + <input id="disable-speedtest" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_protocol__">Protocol</h4> + <select id="protocol"> + <option value="normal" data-localise="__MSG_normal__">Normal</option> + <option value="tor" data-localise="__MSG_tor__">Tor</option> + </select> + </div> + <div id="librespeed"> + <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://librespeed.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-label" for="latency"> + <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" style="display:none;"> + </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="https://librespeed.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + </section> + <script type="module" src="../init.js"></script> + <script type="module" src="./speedtest.js"></script> +</body> \ No newline at end of file diff --git a/src/pages/options/speedtest/speedtest.js b/src/pages/options/speedtest/speedtest.js index bcef4de3..077d6440 100644 --- a/src/pages/options/speedtest/speedtest.js +++ b/src/pages/options/speedtest/speedtest.js @@ -35,6 +35,7 @@ speedtestHelper.init().then(() => { protocolElement.value = protocol; changeProtocolSettings(protocol); + browser.storage.local.get("librespeedLatency").then(r => { commonHelper.processDefaultCustomInstances( 'librespeed', 'normal', @@ -43,8 +44,10 @@ speedtestHelper.init().then(() => { speedtestHelper.getLibrespeedNormalRedirectsChecks, speedtestHelper.setLibrespeedNormalRedirectsChecks, speedtestHelper.getLibrespeedNormalCustomRedirects, - speedtestHelper.setLibrespeedNormalCustomRedirects + speedtestHelper.setLibrespeedNormalCustomRedirects, + r.librespeedLatency, ); + }) commonHelper.processDefaultCustomInstances( 'librespeed', @@ -56,4 +59,33 @@ speedtestHelper.init().then(() => { speedtestHelper.getLibrespeedTorCustomRedirects, speedtestHelper.setLibrespeedTorCustomRedirects ) -}) \ No newline at end of file +}) + +let latencyElement = document.getElementById("latency"); +let latencyLabel = document.getElementById("latency-label"); +latencyElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyElement.addEventListener("click", reloadWindow); + await speedtestHelper.init(); + let redirects = speedtestHelper.getRedirects(); + const oldHtml = latencyLabel.innerHTML; + latencyLabel.innerHTML = '...'; + commonHelper.testLatency(latencyLabel, redirects.librespeed.normal).then(r => { + browser.storage.local.set({ librespeedLatency: r }); + latencyLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'librespeed', + 'normal', + speedtestHelper, + document, + speedtestHelper.getLibrespeedNormalRedirectsChecks, + speedtestHelper.setLibrespeedNormalRedirectsChecks, + speedtestHelper.getLibrespeedNormalCustomRedirects, + speedtestHelper.setLibrespeedNormalCustomRedirects, + r, + ) + latencyElement.removeEventListener("click", reloadWindow) + }); + } +); \ No newline at end of file diff --git a/src/pages/options/spotify/spotify.html b/src/pages/options/spotify/spotify.html new file mode 100644 index 00000000..cfcf34b3 --- /dev/null +++ b/src/pages/options/spotify/spotify.html @@ -0,0 +1,125 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg"> + <link href="../../stylesheets/styles.css" rel="stylesheet"> + <title>General</title> + </head> +</html> +<script type="module" src="../../../assets/javascripts/localise.js"></script> +<body class="option" dir="auto"> + <section class="links"> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor"> + <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path> + </svg><a href="../general/general.html" data-localise="__MSG_general__">General</a> + </div> + <div class="title"> <img src="../../../assets/images/youtube-icon.png"><a href="../youtube/youtube.html" data-localise="__MSG_youtube__">YouTube </a></div> + <div class="title"> <img src="../../../assets/images/youtube-music-icon.png"><a href="../youtubeMusic/youtubeMusic.html" data-localise="__MSG_ytmusic__">YT Music</a></div> + <div class="title"> <img src="../../../assets/images/twitter-icon.png"><a href="../twitter/twitter.html" data-localise="__MSG_twitter__">Twitter</a></div> + <div class="title"> <img src="../../../assets/images/instagram-icon.png"><a href="../instagram/instagram.html" data-localise="__MSG_instagram__">Instagram</a></div> + <div class="title"> <img src="../../../assets/images/tiktok-icon.png"><a href="../tiktok/tiktok.html" data-localise="__MSG_tiktok__">TikTok</a></div> + <div class="title"> <img src="../../../assets/images/reddit-icon.png"><a href="../reddit/reddit.html" data-localise="__MSG_reddit__">Reddit</a></div> + <div class="title"> <img src="../../../assets/images/imgur-icon.png"><a href="../imgur/imgur.html" data-localise="__MSG_imgur__">Imgur</a></div> + <div class="title"> <img src="../../../assets/images/pixiv-icon.svg"><a href="../pixiv/pixiv.html" data-localise="__MSG_pixiv__">Pixiv</a></div> + <div class="title"> <img src="../../../assets/images/librespeed-icon.svg"><a href="../speedtest/speedtest.html" data-localise="__MSG_speedtest__">Speedtest</a></div> + <div class="title"> <img src="../../../assets/images/spotify-icon.png"><a class="selected" href="../spotify/spotify.html" data-localise="__MSG_spotify__">Spotify</a></div> + <div class="title"> <img src="../../../assets/images/wikipedia-icon.svg"><a href="../wikipedia/wikipedia.html" data-localise="__MSG_wikipedia__">Wikipedia</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> + <circle cx="500" cy="500" r="500"></circle> + <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> + <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> + </svg><a href="../medium/medium.html" data-localise="__MSG_medium__">Medium</a> + </div> + <div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a href="../peertube/peertube.html" data-localise="__MSG_peertube__">Peertube</a></div> + <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="../lbry/lbry.html" data-localise="__MSG_lbry__">LBRY/Odysee</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg><a href="../search/search.html" data-localise="__MSG_search__">Search</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> + </svg><a href="../translate/translate.html" data-localise="__MSG_translate__">Translate</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path> + </svg><a href="../maps/maps.html" data-localise="__MSG_maps__">Maps</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> + </svg><a href="../sendTargets/sendTargets.html" data-localise="__MSG_sendFiles__">Send Files</a> + </div> + </section> + <section class="option-block"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enable__">Enable</h4> + <input id="disable-spotify" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_protocol__">Protocol</h4> + <select id="protocol"> + <option value="normal" data-localise="__MSG_normal__">Normal</option> + <option value="tor" data-localise="__MSG_tor__">Tor</option> + </select> + </div> + <div id="soju"> + <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://soju.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-label" for="latency"> + <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" style="display:none;"> + </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="https://soju.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + <script type="module" src="../init.js"></script> + <script type="module" src="./spotify.js"></script> + </div> + </section> +</body> \ No newline at end of file diff --git a/src/pages/options/spotify/spotify.js b/src/pages/options/spotify/spotify.js index 8dbc6bc6..d158412d 100644 --- a/src/pages/options/spotify/spotify.js +++ b/src/pages/options/spotify/spotify.js @@ -35,16 +35,19 @@ spotifyHelper.init().then(() => { protocolElement.value = protocol; changeProtocolSettings(protocol); - commonHelper.processDefaultCustomInstances( - 'soju', - 'normal', - spotifyHelper, - document, - spotifyHelper.getSojuNormalRedirectsChecks, - spotifyHelper.setSojuNormalRedirectsChecks, - spotifyHelper.getSojuNormalCustomRedirects, - spotifyHelper.setSojuNormalCustomRedirects - ); + browser.storage.local.get("sojuLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'soju', + 'normal', + spotifyHelper, + document, + spotifyHelper.getSojuNormalRedirectsChecks, + spotifyHelper.setSojuNormalRedirectsChecks, + spotifyHelper.getSojuNormalCustomRedirects, + spotifyHelper.setSojuNormalCustomRedirects, + r.sojuLatency, + ); + }) commonHelper.processDefaultCustomInstances( 'soju', @@ -56,4 +59,33 @@ spotifyHelper.init().then(() => { spotifyHelper.getSojuTorCustomRedirects, spotifyHelper.setSojuTorCustomRedirects ) -}) \ No newline at end of file +}) + +let latencyElement = document.getElementById("latency"); +let latencyLabel = document.getElementById("latency-label"); +latencyElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyElement.addEventListener("click", reloadWindow); + await spotifyHelper.init(); + let redirects = spotifyHelper.getRedirects(); + const oldHtml = latencyLabel.innerHTML; + latencyLabel.innerHTML = '...'; + commonHelper.testLatency(latencyLabel, redirects.soju.normal).then(r => { + browser.storage.local.set({ sojuLatency: r }); + latencyLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'soju', + 'normal', + spotifyHelper, + document, + spotifyHelper.getSojuNormalRedirectsChecks, + spotifyHelper.setSojuNormalRedirectsChecks, + spotifyHelper.getSojuNormalCustomRedirects, + spotifyHelper.setSojuNormalCustomRedirects, + r, + ) + latencyElement.removeEventListener("click", reloadWindow) + }); + } +); \ No newline at end of file diff --git a/src/pages/options/tiktok/tiktok.html b/src/pages/options/tiktok/tiktok.html new file mode 100644 index 00000000..52b09bbb --- /dev/null +++ b/src/pages/options/tiktok/tiktok.html @@ -0,0 +1,125 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg"> + <link href="../../stylesheets/styles.css" rel="stylesheet"> + <title>General</title> + </head> +</html> +<script type="module" src="../../../assets/javascripts/localise.js"></script> +<body class="option" dir="auto"> + <section class="links"> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor"> + <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path> + </svg><a href="../general/general.html" data-localise="__MSG_general__">General</a> + </div> + <div class="title"> <img src="../../../assets/images/youtube-icon.png"><a href="../youtube/youtube.html" data-localise="__MSG_youtube__">YouTube </a></div> + <div class="title"> <img src="../../../assets/images/youtube-music-icon.png"><a href="../youtubeMusic/youtubeMusic.html" data-localise="__MSG_ytmusic__">YT Music</a></div> + <div class="title"> <img src="../../../assets/images/twitter-icon.png"><a href="../twitter/twitter.html" data-localise="__MSG_twitter__">Twitter</a></div> + <div class="title"> <img src="../../../assets/images/instagram-icon.png"><a href="../instagram/instagram.html" data-localise="__MSG_instagram__">Instagram</a></div> + <div class="title"> <img src="../../../assets/images/tiktok-icon.png"><a class="selected" href="../tiktok/tiktok.html" data-localise="__MSG_tiktok__">TikTok</a></div> + <div class="title"> <img src="../../../assets/images/reddit-icon.png"><a href="../reddit/reddit.html" data-localise="__MSG_reddit__">Reddit</a></div> + <div class="title"> <img src="../../../assets/images/imgur-icon.png"><a href="../imgur/imgur.html" data-localise="__MSG_imgur__">Imgur</a></div> + <div class="title"> <img src="../../../assets/images/pixiv-icon.svg"><a href="../pixiv/pixiv.html" data-localise="__MSG_pixiv__">Pixiv</a></div> + <div class="title"> <img src="../../../assets/images/librespeed-icon.svg"><a href="../speedtest/speedtest.html" data-localise="__MSG_speedtest__">Speedtest</a></div> + <div class="title"> <img src="../../../assets/images/spotify-icon.png"><a href="../spotify/spotify.html" data-localise="__MSG_spotify__">Spotify</a></div> + <div class="title"> <img src="../../../assets/images/wikipedia-icon.svg"><a href="../wikipedia/wikipedia.html" data-localise="__MSG_wikipedia__">Wikipedia</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> + <circle cx="500" cy="500" r="500"></circle> + <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> + <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> + </svg><a href="../medium/medium.html" data-localise="__MSG_medium__">Medium</a> + </div> + <div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a href="../peertube/peertube.html" data-localise="__MSG_peertube__">Peertube</a></div> + <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="../lbry/lbry.html" data-localise="__MSG_lbry__">LBRY/Odysee</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg><a href="../search/search.html" data-localise="__MSG_search__">Search</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> + </svg><a href="../translate/translate.html" data-localise="__MSG_translate__">Translate</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path> + </svg><a href="../maps/maps.html" data-localise="__MSG_maps__">Maps</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> + </svg><a href="../sendTargets/sendTargets.html" data-localise="__MSG_sendFiles__">Send Files</a> + </div> + </section> + <section class="option-block"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enable__">Enable</h4> + <input id="disable-tiktok" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_protocol__">Protocol</h4> + <select id="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"> + <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://proxitok.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-label" for="latency"> + <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" style="display:none;"> + </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="https://proxitok.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + </section> + <script type="module" src="../init.js"></script> + <script type="module" src="./tiktok.js"></script> +</body> \ No newline at end of file diff --git a/src/pages/options/tiktok/tiktok.js b/src/pages/options/tiktok/tiktok.js index 1f5351aa..35cc6685 100644 --- a/src/pages/options/tiktok/tiktok.js +++ b/src/pages/options/tiktok/tiktok.js @@ -35,17 +35,19 @@ tiktokHelper.init().then(() => { protocolElement.value = protocol; changeProtocolSettings(protocol); - commonHelper.processDefaultCustomInstances( - 'proxiTok', - 'normal', - tiktokHelper, - document, - tiktokHelper.getProxiTokNormalRedirectsChecks, - tiktokHelper.setProxiTokNormalRedirectsChecks, - tiktokHelper.getProxiTokNormalCustomRedirects, - tiktokHelper.setProxiTokNormalCustomRedirects - ); - + browser.storage.local.get("proxiTokLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'proxiTok', + 'normal', + tiktokHelper, + document, + tiktokHelper.getProxiTokNormalRedirectsChecks, + tiktokHelper.setProxiTokNormalRedirectsChecks, + tiktokHelper.getProxiTokNormalCustomRedirects, + tiktokHelper.setProxiTokNormalCustomRedirects, + r.proxiTokLatency, + ); + }) commonHelper.processDefaultCustomInstances( 'proxiTok', 'tor', @@ -56,4 +58,33 @@ tiktokHelper.init().then(() => { tiktokHelper.getProxiTokTorCustomRedirects, tiktokHelper.setProxiTokTorCustomRedirects ) -}) \ No newline at end of file +}) + +let latencyElement = document.getElementById("latency"); +let latencyLabel = document.getElementById("latency-label"); +latencyElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyElement.addEventListener("click", reloadWindow); + await tiktokHelper.init(); + let redirects = tiktokHelper.getRedirects(); + const oldHtml = latencyLabel.innerHTML; + latencyLabel.innerHTML = '...'; + commonHelper.testLatency(latencyLabel, redirects.proxiTok.normal).then(r => { + browser.storage.local.set({ proxiTokLatency: r }); + latencyLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'proxiTok', + 'normal', + tiktokHelper, + document, + tiktokHelper.getProxiTokNormalRedirectsChecks, + tiktokHelper.setProxiTokNormalRedirectsChecks, + tiktokHelper.getProxiTokNormalCustomRedirects, + tiktokHelper.setProxiTokNormalCustomRedirects, + r, + ) + latencyElement.removeEventListener("click", reloadWindow) + }); + } +); \ No newline at end of file diff --git a/src/pages/options/translate/translate.html b/src/pages/options/translate/translate.html new file mode 100644 index 00000000..53436c91 --- /dev/null +++ b/src/pages/options/translate/translate.html @@ -0,0 +1,418 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg"> + <link href="../../stylesheets/styles.css" rel="stylesheet"> + <title>General</title> + </head> +</html> +<script type="module" src="../../../assets/javascripts/localise.js"></script> +<body class="option" dir="auto"> + <section class="links"> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor"> + <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path> + </svg><a href="../general/general.html" data-localise="__MSG_general__">General</a> + </div> + <div class="title"> <img src="../../../assets/images/youtube-icon.png"><a href="../youtube/youtube.html" data-localise="__MSG_youtube__">YouTube </a></div> + <div class="title"> <img src="../../../assets/images/youtube-music-icon.png"><a href="../youtubeMusic/youtubeMusic.html" data-localise="__MSG_ytmusic__">YT Music</a></div> + <div class="title"> <img src="../../../assets/images/twitter-icon.png"><a href="../twitter/twitter.html" data-localise="__MSG_twitter__">Twitter</a></div> + <div class="title"> <img src="../../../assets/images/instagram-icon.png"><a href="../instagram/instagram.html" data-localise="__MSG_instagram__">Instagram</a></div> + <div class="title"> <img src="../../../assets/images/tiktok-icon.png"><a href="../tiktok/tiktok.html" data-localise="__MSG_tiktok__">TikTok</a></div> + <div class="title"> <img src="../../../assets/images/reddit-icon.png"><a href="../reddit/reddit.html" data-localise="__MSG_reddit__">Reddit</a></div> + <div class="title"> <img src="../../../assets/images/imgur-icon.png"><a href="../imgur/imgur.html" data-localise="__MSG_imgur__">Imgur</a></div> + <div class="title"> <img src="../../../assets/images/pixiv-icon.svg"><a href="../pixiv/pixiv.html" data-localise="__MSG_pixiv__">Pixiv</a></div> + <div class="title"> <img src="../../../assets/images/librespeed-icon.svg"><a href="../speedtest/speedtest.html" data-localise="__MSG_speedtest__">Speedtest</a></div> + <div class="title"> <img src="../../../assets/images/spotify-icon.png"><a href="../spotify/spotify.html" data-localise="__MSG_spotify__">Spotify</a></div> + <div class="title"> <img src="../../../assets/images/wikipedia-icon.svg"><a href="../wikipedia/wikipedia.html" data-localise="__MSG_wikipedia__">Wikipedia</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> + <circle cx="500" cy="500" r="500"></circle> + <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> + <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> + </svg><a href="../medium/medium.html" data-localise="__MSG_medium__">Medium</a> + </div> + <div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a href="../peertube/peertube.html" data-localise="__MSG_peertube__">Peertube</a></div> + <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="../lbry/lbry.html" data-localise="__MSG_lbry__">LBRY/Odysee</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg><a href="../search/search.html" data-localise="__MSG_search__">Search</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> + </svg><a class="selected" href="../translate/translate.html" data-localise="__MSG_translate__">Translate</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path> + </svg><a href="../maps/maps.html" data-localise="__MSG_maps__">Maps</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> + </svg><a href="../sendTargets/sendTargets.html" data-localise="__MSG_sendFiles__">Send Files</a> + </div> + </section> + <section class="option-block"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enable__">Enable</h4> + <input id="disable-simplyTranslate" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_frontend__">Frontend</h4> + <select id="translate-frontend"> + <option value="simplyTranslate">SimplyTranslate</option> + <option value="lingva">Lingva</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_protocol__">Protocol</h4> + <select id="protocol"> + <option value="normal" data-localise="__MSG_normal__">Normal</option> + <option value="tor" data-localise="__MSG_tor__">Tor</option> + </select> + </div> + <hr> + <div id="simplyTranslate"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_from__">From</h4> + <select class="from"> + <option value="auto">Auto</option> + <option value="af">Afrikaans</option> + <option value="sq">Albanian</option> + <option value="am">Amharic</option> + <option value="ar">Arabic</option> + <option value="hy">Armenian</option> + <option value="az">Azerbaijani</option> + <option value="eu">Basque</option> + <option value="be">Belarusian</option> + <option value="bn">Bengali</option> + <option value="bs">Bosnian</option> + <option value="bg">Bulgarian</option> + <option value="ca">Catalan</option> + <option value="ceb">Cebuano</option> + <option value="ny">Chichewa</option> + <option value="zh-CN">Chinese</option> + <option value="co">Corsican</option> + <option value="hr">Croatian</option> + <option value="cs">Czech</option> + <option value="da">Danish</option> + <option value="nl">Dutch</option> + <option value="en">English</option> + <option value="eo">Esperanto</option> + <option value="et">Estonian</option> + <option value="tl">Filipino</option> + <option value="fi">Finnish</option> + <option value="fr">French</option> + <option value="fy">Frisian</option> + <option value="gl">Galician</option> + <option value="ka">Georgian</option> + <option value="de">German</option> + <option value="el">Greek</option> + <option value="gu">Gujarati</option> + <option value="ht">Haitian Creole</option> + <option value="ha">Hausa</option> + <option value="haw">Hawaiian</option> + <option value="iw">Hebrew</option> + <option value="hi">Hindi</option> + <option value="hmn">Hmong</option> + <option value="hu">Hungarian</option> + <option value="is">Icelandic</option> + <option value="ig">Igbo</option> + <option value="id">Indonesian</option> + <option value="ga">Irish</option> + <option value="it">Italian</option> + <option value="ja">Japanese</option> + <option value="jw">Javanese</option> + <option value="kn">Kannada</option> + <option value="kk">Kazakh</option> + <option value="km">Khmer</option> + <option value="rw">Kinyarwanda</option> + <option value="ko">Korean</option> + <option value="ku">Kurdish (Kurmanji)</option> + <option value="ky">Kyrgyz</option> + <option value="lo">Lao</option> + <option value="la">Latin</option> + <option value="lv">Latvian</option> + <option value="lt">Lithuanian</option> + <option value="lb">Luxembourgish</option> + <option value="mk">Macedonian</option> + <option value="mg">Malagasy</option> + <option value="ms">Malay</option> + <option value="ml">Malayalam</option> + <option value="mt">Maltese</option> + <option value="mi">Maori</option> + <option value="mr">Marathi</option> + <option value="mn">Mongolian</option> + <option value="my">Myanmar (Burmese)</option> + <option value="ne">Nepali</option> + <option value="no">Norwegian</option> + <option value="or">Odia (Oriya)</option> + <option value="ps">Pashto</option> + <option value="fa">Persian</option> + <option value="pl">Polish</option> + <option value="pt">Portuguese</option> + <option value="pa">Punjabi</option> + <option value="ro">Romanian</option> + <option value="ru">Russian</option> + <option value="sm">Samoan</option> + <option value="gd">Scots Gaelic</option> + <option value="sr">Serbian</option> + <option value="st">Sesotho</option> + <option value="sn">Shona</option> + <option value="sd">Sindhi</option> + <option value="si">Sinhala</option> + <option value="sk">Slovak</option> + <option value="sl">Slovenian</option> + <option value="so">Somali</option> + <option value="es">Spanish</option> + <option value="su">Sundanese</option> + <option value="sw">Swahili</option> + <option value="sv">Swedish</option> + <option value="tg">Tajik</option> + <option value="ta">Tamil</option> + <option value="tt">Tatar</option> + <option value="te">Telugu</option> + <option value="th">Thai</option> + <option value="tr">Turkish</option> + <option value="tk">Turkmen</option> + <option value="uk">Ukrainian</option> + <option value="ur">Urdu</option> + <option value="ug">Uyghur</option> + <option value="uz">Uzbek</option> + <option value="vi">Vietnamese</option> + <option value="cy">Welsh</option> + <option value="xh">Xhosa</option> + <option value="yi">Yiddish</option> + <option value="yo">Yoruba</option> + <option value="zu">Zulu</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_to__">To</h4> + <select class="to"> + <option value="af">Afrikaans</option> + <option value="sq">Albanian</option> + <option value="am">Amharic</option> + <option value="ar">Arabic</option> + <option value="hy">Armenian</option> + <option value="az">Azerbaijani</option> + <option value="eu">Basque</option> + <option value="be">Belarusian</option> + <option value="bn">Bengali</option> + <option value="bs">Bosnian</option> + <option value="bg">Bulgarian</option> + <option value="ca">Catalan</option> + <option value="ceb">Cebuano</option> + <option value="ny">Chichewa</option> + <option value="zh-CN">Chinese</option> + <option value="co">Corsican</option> + <option value="hr">Croatian</option> + <option value="cs">Czech</option> + <option value="da">Danish</option> + <option value="nl">Dutch</option> + <option value="en">English</option> + <option value="eo">Esperanto</option> + <option value="et">Estonian</option> + <option value="tl">Filipino</option> + <option value="fi">Finnish</option> + <option value="fr">French</option> + <option value="fy">Frisian</option> + <option value="gl">Galician</option> + <option value="ka">Georgian</option> + <option value="de">German</option> + <option value="el">Greek</option> + <option value="gu">Gujarati</option> + <option value="ht">Haitian Creole</option> + <option value="ha">Hausa</option> + <option value="haw">Hawaiian</option> + <option value="iw">Hebrew</option> + <option value="hi">Hindi</option> + <option value="hmn">Hmong</option> + <option value="hu">Hungarian</option> + <option value="is">Icelandic</option> + <option value="ig">Igbo</option> + <option value="id">Indonesian</option> + <option value="ga">Irish</option> + <option value="it">Italian</option> + <option value="ja">Japanese</option> + <option value="jw">Javanese</option> + <option value="kn">Kannada</option> + <option value="kk">Kazakh</option> + <option value="km">Khmer</option> + <option value="rw">Kinyarwanda</option> + <option value="ko">Korean</option> + <option value="ku">Kurdish (Kurmanji)</option> + <option value="ky">Kyrgyz</option> + <option value="lo">Lao</option> + <option value="la">Latin</option> + <option value="lv">Latvian</option> + <option value="lt">Lithuanian</option> + <option value="lb">Luxembourgish</option> + <option value="mk">Macedonian</option> + <option value="mg">Malagasy</option> + <option value="ms">Malay</option> + <option value="ml">Malayalam</option> + <option value="mt">Maltese</option> + <option value="mi">Maori</option> + <option value="mr">Marathi</option> + <option value="mn">Mongolian</option> + <option value="my">Myanmar (Burmese)</option> + <option value="ne">Nepali</option> + <option value="no">Norwegian</option> + <option value="or">Odia (Oriya)</option> + <option value="ps">Pashto</option> + <option value="fa">Persian</option> + <option value="pl">Polish</option> + <option value="pt">Portuguese</option> + <option value="pa">Punjabi</option> + <option value="ro">Romanian</option> + <option value="ru">Russian</option> + <option value="sm">Samoan</option> + <option value="gd">Scots Gaelic</option> + <option value="sr">Serbian</option> + <option value="st">Sesotho</option> + <option value="sn">Shona</option> + <option value="sd">Sindhi</option> + <option value="si">Sinhala</option> + <option value="sk">Slovak</option> + <option value="sl">Slovenian</option> + <option value="so">Somali</option> + <option value="es">Spanish</option> + <option value="su">Sundanese</option> + <option value="sw">Swahili</option> + <option value="sv">Swedish</option> + <option value="tg">Tajik</option> + <option value="ta">Tamil</option> + <option value="tt">Tatar</option> + <option value="te">Telugu</option> + <option value="th">Thai</option> + <option value="tr">Turkish</option> + <option value="tk">Turkmen</option> + <option value="uk">Ukrainian</option> + <option value="ur">Urdu</option> + <option value="ug">Uyghur</option> + <option value="uz">Uzbek</option> + <option value="vi">Vietnamese</option> + <option value="cy">Welsh</option> + <option value="xh">Xhosa</option> + <option value="yi">Yiddish</option> + <option value="yo">Yoruba</option> + <option value="zu">Zulu</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_engine__">Engine</h4> + <select class="engine"> + <option value="google">Google</option> + <option value="libre">Libre</option> + <option value="deepl">Deepl</option> + <option value="iciba">ICIBA</option> + <option value="reverso">Reverso</option> + </select> + </div> + <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://simplytranslate.org" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-simplyTranslate-label" for="latency-simplyTranslate"> + <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-simplyTranslate" style="display:none;"> + </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://hxecvvetgrznmprg.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + <div id="lingva"> + <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://lingvatranslate.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-lingva-label" for="latency-lingva"> + <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-lingva" style="display:none;"> + </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://tyzxppdeoojdnaux.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + </section> + <script type="module" src="../init.js"></script> + <script type="module" src="./translate.js"></script> +</body> \ No newline at end of file diff --git a/src/pages/options/translate/translate.js b/src/pages/options/translate/translate.js index 5da48740..999d5e30 100644 --- a/src/pages/options/translate/translate.js +++ b/src/pages/options/translate/translate.js @@ -90,16 +90,19 @@ translateHelper.init().then(() => { toElement.value = translateHelper.getTo(); simplyTranslateEngineElement.value = translateHelper.getSimplyTranslateEngine(); - commonHelper.processDefaultCustomInstances( - 'simplyTranslate', - 'normal', - translateHelper, - document, - translateHelper.getSimplyTranslateNormalRedirectsChecks, - translateHelper.setSimplyTranslateNormalRedirectsChecks, - translateHelper.getSimplyTranslateNormalCustomRedirects, - translateHelper.setSimplyTranslateNormalCustomRedirects - ); + browser.storage.local.get("simplyTranslateLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'simplyTranslate', + 'normal', + translateHelper, + document, + translateHelper.getSimplyTranslateNormalRedirectsChecks, + translateHelper.setSimplyTranslateNormalRedirectsChecks, + translateHelper.getSimplyTranslateNormalCustomRedirects, + translateHelper.setSimplyTranslateNormalCustomRedirects, + r.simplyTranslateLatency, + ) + }) commonHelper.processDefaultCustomInstances( 'simplyTranslate', @@ -112,16 +115,20 @@ translateHelper.init().then(() => { translateHelper.setSimplyTranslateTorCustomRedirects ); - commonHelper.processDefaultCustomInstances( - 'lingva', - 'normal', - translateHelper, - document, - translateHelper.getLingvaNormalRedirectsChecks, - translateHelper.setLingvaNormalRedirectsChecks, - translateHelper.getLingvaNormalCustomRedirects, - translateHelper.setLingvaNormalCustomRedirects - ); + browser.storage.local.get("lingvaLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'lingva', + 'normal', + translateHelper, + document, + translateHelper.getLingvaNormalRedirectsChecks, + translateHelper.setLingvaNormalRedirectsChecks, + translateHelper.getLingvaNormalCustomRedirects, + translateHelper.setLingvaNormalCustomRedirects, + r.lingvaLatency, + ); + }); + commonHelper.processDefaultCustomInstances( 'lingva', @@ -131,6 +138,65 @@ translateHelper.init().then(() => { translateHelper.getLingvaTorRedirectsChecks, translateHelper.setLingvaTorRedirectsChecks, translateHelper.getLingvaTorCustomRedirects, - translateHelper.setLingvaTorCustomRedirects + translateHelper.setLingvaTorCustomRedirects, ) -}); \ No newline at end of file +}); + + +let latencySimplyTranslateElement = document.getElementById("latency-simplyTranslate"); +let latencySimplyTranslateLabel = document.getElementById("latency-simplyTranslate-label"); +latencySimplyTranslateElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencySimplyTranslateElement.addEventListener("click", reloadWindow); + await translateHelper.init(); + let redirects = translateHelper.getRedirects(); + const oldHtml = latencySimplyTranslateLabel.innerHTML; + latencySimplyTranslateLabel.innerHTML = '...'; + commonHelper.testLatency(latencySimplyTranslateLabel, redirects.simplyTranslate.normal).then(r => { + browser.storage.local.set({ simplyTranslateLatency: r }); + latencySimplyTranslateLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'simplyTranslate', + 'normal', + translateHelper, + document, + translateHelper.getSimplyTranslateNormalRedirectsChecks, + translateHelper.setSimplyTranslateNormalRedirectsChecks, + translateHelper.getSimplyTranslateNormalCustomRedirects, + translateHelper.setSimplyTranslateNormalCustomRedirects, + r, + ); + latencySimplyTranslateElement.removeEventListener("click", reloadWindow); + }); + } +); + +let latencyLingvaElement = document.getElementById("latency-lingva"); +let latencyLingvaLabel = document.getElementById("latency-lingva-label"); +latencyLingvaElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyLingvaElement.addEventListener("click", reloadWindow); + await translateHelper.init(); + let redirects = translateHelper.getRedirects(); + const oldHtml = latencyLingvaLabel.innerHTML; + latencyLingvaLabel.innerHTML = '...'; + commonHelper.testLatency(latencyLingvaLabel, redirects.lingva.normal).then(r => { + browser.storage.local.set({ lingvaLatency: r }); + latencyLingvaLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'lingva', + 'normal', + translateHelper, + document, + translateHelper.getLingvaNormalRedirectsChecks, + translateHelper.setLingvaNormalRedirectsChecks, + translateHelper.getLingvaNormalCustomRedirects, + translateHelper.setLingvaNormalCustomRedirects, + r, + ); + latencyLingvaElement.removeEventListener("click", reloadWindow); + }); + } +); \ No newline at end of file diff --git a/src/pages/options/twitter/twitter.html b/src/pages/options/twitter/twitter.html new file mode 100644 index 00000000..6d8e0e6f --- /dev/null +++ b/src/pages/options/twitter/twitter.html @@ -0,0 +1,227 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg"> + <link href="../../stylesheets/styles.css" rel="stylesheet"> + <title>General</title> + </head> +</html> +<script type="module" src="../../../assets/javascripts/localise.js"></script> +<body class="option" dir="auto"> + <section class="links"> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor"> + <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path> + </svg><a href="../general/general.html" data-localise="__MSG_general__">General</a> + </div> + <div class="title"> <img src="../../../assets/images/youtube-icon.png"><a href="../youtube/youtube.html" data-localise="__MSG_youtube__">YouTube </a></div> + <div class="title"> <img src="../../../assets/images/youtube-music-icon.png"><a href="../youtubeMusic/youtubeMusic.html" data-localise="__MSG_ytmusic__">YT Music</a></div> + <div class="title"> <img src="../../../assets/images/twitter-icon.png"><a class="selected" href="../twitter/twitter.html" data-localise="__MSG_twitter__">Twitter</a></div> + <div class="title"> <img src="../../../assets/images/instagram-icon.png"><a href="../instagram/instagram.html" data-localise="__MSG_instagram__">Instagram</a></div> + <div class="title"> <img src="../../../assets/images/tiktok-icon.png"><a href="../tiktok/tiktok.html" data-localise="__MSG_tiktok__">TikTok</a></div> + <div class="title"> <img src="../../../assets/images/reddit-icon.png"><a href="../reddit/reddit.html" data-localise="__MSG_reddit__">Reddit</a></div> + <div class="title"> <img src="../../../assets/images/imgur-icon.png"><a href="../imgur/imgur.html" data-localise="__MSG_imgur__">Imgur</a></div> + <div class="title"> <img src="../../../assets/images/pixiv-icon.svg"><a href="../pixiv/pixiv.html" data-localise="__MSG_pixiv__">Pixiv</a></div> + <div class="title"> <img src="../../../assets/images/librespeed-icon.svg"><a href="../speedtest/speedtest.html" data-localise="__MSG_speedtest__">Speedtest</a></div> + <div class="title"> <img src="../../../assets/images/spotify-icon.png"><a href="../spotify/spotify.html" data-localise="__MSG_spotify__">Spotify</a></div> + <div class="title"> <img src="../../../assets/images/wikipedia-icon.svg"><a href="../wikipedia/wikipedia.html" data-localise="__MSG_wikipedia__">Wikipedia</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> + <circle cx="500" cy="500" r="500"></circle> + <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> + <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> + </svg><a href="../medium/medium.html" data-localise="__MSG_medium__">Medium</a> + </div> + <div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a href="../peertube/peertube.html" data-localise="__MSG_peertube__">Peertube</a></div> + <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="../lbry/lbry.html" data-localise="__MSG_lbry__">LBRY/Odysee</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg><a href="../search/search.html" data-localise="__MSG_search__">Search</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> + </svg><a href="../translate/translate.html" data-localise="__MSG_translate__">Translate</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path> + </svg><a href="../maps/maps.html" data-localise="__MSG_maps__">Maps</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> + </svg><a href="../sendTargets/sendTargets.html" data-localise="__MSG_sendFiles__">Send Files</a> + </div> + </section> + <section class="option-block"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enable__">Enable</h4> + <input id="disable-nitter" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_protocol__">Protocol</h4> + <select id="protocol"> + <option value="normal" data-localise="__MSG_normal__">Normal</option> + <option value="tor" data-localise="__MSG_tor__">Tor</option> + <option value="i2p" data-localise="__MSG_i2p__">I2P</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_bypassTwitter__">Bypass "Open in Twitter"</h4> + <input id="bypass-watch-on-twitter" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enableCustomNitter__">Enable Custom Settings (will use cookies)</h4> + <input id="enable-twitter-custom-settings" type="checkbox"> + </div> + <div id="nitter"> + <div class="custom-settings"> + <div class="some-block option-block"> + <h2>Display </h2> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_theme__">Theme</h4> + <select class="theme"> + <option value="Auto">Auto</option> + <option value="Auto (Twitter)">Auto (Twitter)</option> + <option value="Black">Black</option> + <option value="Mastodon">Mastodon</option> + <option value="Nitter">Nitter</option> + <option value="Pleroma">Pleroma</option> + <option value="Twitter">Twitter</option> + <option value="Twitter Dark">Twitter Dark</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_infiniteScroll__">Infinite scrolling (experimental, requires JavaScript)</h4> + <input class="infiniteScroll" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_stickyProfile__">Make profile sidebar stick to top</h4> + <input class="stickyProfile" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_bidiSupport__">Support bidirectional text (makes clicking on tweets harder)</h4> + <input class="bidiSupport" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_hideTweetStats__">Hide tweet stats (replies, retweets, likes)</h4> + <input class="hideTweetStats" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_hideBanner__">Hide profile banner</h4> + <input class="hideBanner" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_hidePins__">Hide pinned tweets</h4> + <input class="hidePins" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_hideReplies__">Hide tweet replies</h4> + <input class="hideReplies" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_squareAvatars__">Square profile pictures</h4> + <input class="squareAvatars" type="checkbox"> + </div> + <hr> + <div class="some-block option-block"> + <h2>Media</h2> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_mp4Playback__">Enable mp4 video playback (only for gifs)</h4> + <input class="mp4Playback" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_hlsPlayback__">Enable hls video streaming (requires JavaScript)</h4> + <input class="hlsPlayback" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_proxyVideos__">Proxy video streaming through the server (might be slow)</h4> + <input class="proxyVideos" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_muteVideos__">Mute videos by default</h4> + <input class="muteVideos" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_autoplayGifs__">Autoplay gifs</h4> + <input class="autoplayGifs" type="checkbox"> + </div> + </div> + <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://nitter.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-label" for="latency"> + <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" style="display:none;"> + </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="https://nitter.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </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="https://nitter.i2p" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + </section> + <script type="module" src="../init.js"></script> + <script type="module" src="./twitter.js"></script> +</body> \ No newline at end of file diff --git a/src/pages/options/twitter/twitter.js b/src/pages/options/twitter/twitter.js index b86fc197..4cb31643 100644 --- a/src/pages/options/twitter/twitter.js +++ b/src/pages/options/twitter/twitter.js @@ -93,16 +93,20 @@ function init() { muteVideos.checked = twitterHelper.getMuteVideos(); autoplayGifs.checked = twitterHelper.getAutoplayGifs(); - commonHelper.processDefaultCustomInstances( - 'nitter', - 'normal', - twitterHelper, - document, - twitterHelper.getNitterNormalRedirectsChecks, - twitterHelper.setNitterNormalRedirectsChecks, - twitterHelper.getNitterNormalCustomRedirects, - twitterHelper.setNitterNormalCustomRedirects - ) + browser.storage.local.get("nitterLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'nitter', + 'normal', + twitterHelper, + document, + twitterHelper.getNitterNormalRedirectsChecks, + twitterHelper.setNitterNormalRedirectsChecks, + twitterHelper.getNitterNormalCustomRedirects, + twitterHelper.setNitterNormalCustomRedirects, + r.nitterLatency, + ); + }); + commonHelper.processDefaultCustomInstances( 'nitter', 'tor', @@ -116,3 +120,32 @@ function init() { }); } init(); + +let latencyElement = document.getElementById("latency"); +let latencyLabel = document.getElementById("latency-label"); +latencyElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyElement.addEventListener("click", reloadWindow); + await twitterHelper.init(); + let redirects = twitterHelper.getRedirects(); + const oldHtml = latencyLabel.innerHTML; + latencyLabel.innerHTML = '...'; + commonHelper.testLatency(latencyLabel, redirects.nitter.normal).then(r => { + browser.storage.local.set({ nitterLatency: r }); + latencyLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'nitter', + 'normal', + twitterHelper, + document, + twitterHelper.getNitterNormalRedirectsChecks, + twitterHelper.setNitterNormalRedirectsChecks, + twitterHelper.getNitterNormalCustomRedirects, + twitterHelper.setNitterNormalCustomRedirects, + r, + ) + latencyElement.removeEventListener("click", reloadWindow) + }); + } +); \ No newline at end of file diff --git a/src/pages/options/wikipedia/wikipedia.html b/src/pages/options/wikipedia/wikipedia.html new file mode 100644 index 00000000..b7fcc40a --- /dev/null +++ b/src/pages/options/wikipedia/wikipedia.html @@ -0,0 +1,146 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg"> + <link href="../../stylesheets/styles.css" rel="stylesheet"> + <title>Wikipedia</title> + </head> +</html> +<script type="module" src="../../../assets/javascripts/localise.js"></script> +<body class="option" dir="auto"> + <section class="links"> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor"> + <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path> + </svg><a href="../general/general.html" data-localise="__MSG_general__">General</a> + </div> + <div class="title"> <img src="../../../assets/images/youtube-icon.png"><a href="../youtube/youtube.html" data-localise="__MSG_youtube__">YouTube </a></div> + <div class="title"> <img src="../../../assets/images/youtube-music-icon.png"><a href="../youtubeMusic/youtubeMusic.html" data-localise="__MSG_ytmusic__">YT Music</a></div> + <div class="title"> <img src="../../../assets/images/twitter-icon.png"><a href="../twitter/twitter.html" data-localise="__MSG_twitter__">Twitter</a></div> + <div class="title"> <img src="../../../assets/images/instagram-icon.png"><a href="../instagram/instagram.html" data-localise="__MSG_instagram__">Instagram</a></div> + <div class="title"> <img src="../../../assets/images/tiktok-icon.png"><a href="../tiktok/tiktok.html" data-localise="__MSG_tiktok__">TikTok</a></div> + <div class="title"> <img src="../../../assets/images/reddit-icon.png"><a href="../reddit/reddit.html" data-localise="__MSG_reddit__">Reddit</a></div> + <div class="title"> <img src="../../../assets/images/imgur-icon.png"><a href="../imgur/imgur.html" data-localise="__MSG_imgur__">Imgur</a></div> + <div class="title"> <img src="../../../assets/images/pixiv-icon.svg"><a href="../pixiv/pixiv.html" data-localise="__MSG_pixiv__">Pixiv</a></div> + <div class="title"> <img src="../../../assets/images/librespeed-icon.svg"><a href="../speedtest/speedtest.html" data-localise="__MSG_speedtest__">Speedtest</a></div> + <div class="title"> <img src="../../../assets/images/spotify-icon.png"><a href="../spotify/spotify.html" data-localise="__MSG_spotify__">Spotify</a></div> + <div class="title"> <img src="../../../assets/images/wikipedia-icon.svg"><a class="selected" href="../wikipedia/wikipedia.html" data-localise="__MSG_wikipedia__">Wikipedia</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> + <circle cx="500" cy="500" r="500"></circle> + <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> + <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> + </svg><a href="../medium/medium.html" data-localise="__MSG_medium__">Medium</a> + </div> + <div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a href="../peertube/peertube.html" data-localise="__MSG_peertube__">Peertube</a></div> + <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="../lbry/lbry.html" data-localise="__MSG_lbry__">LBRY/Odysee</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg><a href="../search/search.html" data-localise="__MSG_search__">Search</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> + </svg><a href="../translate/translate.html" data-localise="__MSG_translate__">Translate</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path> + </svg><a href="../maps/maps.html" data-localise="__MSG_maps__">Maps</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> + </svg><a href="../sendTargets/sendTargets.html" data-localise="__MSG_sendFiles__">Send Files</a> + </div> + </section> + <section class="option-block"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enable__">Enable</h4> + <input id="disable-wikipedia" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_protocol__">Protocol</h4> + <select id="protocol"> + <option value="normal" data-localise="__MSG_normal__">Normal</option> + <option value="tor" data-localise="__MSG_tor__">Tor</option> + <option value="i2p" data-localise="__MSG_i2p__">I2P</option> + </select> + </div> + <div id="wikiless"> + <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://wikiless.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-label" for="latency"> + <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" style="display:none;"> + </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="https://wikiless.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </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="https://wikiless.i2p" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + </section> + <script type="module" src="../init.js"></script> + <script type="module" src="./wikipedia.js"></script> +</body> \ No newline at end of file diff --git a/src/pages/options/wikipedia/wikipedia.js b/src/pages/options/wikipedia/wikipedia.js index a2dafbfe..526068b4 100644 --- a/src/pages/options/wikipedia/wikipedia.js +++ b/src/pages/options/wikipedia/wikipedia.js @@ -22,17 +22,17 @@ function changeProtocolSettings(protocol) { if (protocol == 'normal') { normalDiv.style.display = 'block'; torDiv.style.display = 'none'; - i2pDiv.style.display = 'none'; + i2pDiv.style.display = 'none'; } else if (protocol == 'tor') { normalDiv.style.display = 'none'; torDiv.style.display = 'block'; - i2pDiv.style.display = 'none'; + i2pDiv.style.display = 'none'; } else if (protocol == 'i2p') { - normalDiv.style.display = 'none'; - torDiv.style.display = 'none'; - i2pDiv.style.display = 'block'; + normalDiv.style.display = 'none'; + torDiv.style.display = 'none'; + i2pDiv.style.display = 'block'; } } @@ -44,16 +44,19 @@ wikipediaHelper.init().then(() => { protocolElement.value = protocol; changeProtocolSettings(protocol); - commonHelper.processDefaultCustomInstances( - 'wikiless', - 'normal', - wikipediaHelper, - document, - wikipediaHelper.getWikilessNormalRedirectsChecks, - wikipediaHelper.setWikilessNormalRedirectsChecks, - wikipediaHelper.getWikilessNormalCustomRedirects, - wikipediaHelper.setWikilessNormalCustomRedirects - ) + browser.storage.local.get("wikilessLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'wikiless', + 'normal', + wikipediaHelper, + document, + wikipediaHelper.getWikilessNormalRedirectsChecks, + wikipediaHelper.setWikilessNormalRedirectsChecks, + wikipediaHelper.getWikilessNormalCustomRedirects, + wikipediaHelper.setWikilessNormalCustomRedirects, + r.wikilessLatency, + ); + }) commonHelper.processDefaultCustomInstances( 'wikiless', @@ -67,13 +70,42 @@ wikipediaHelper.init().then(() => { ) commonHelper.processDefaultCustomInstances( - 'wikiless', - 'i2p', - wikipediaHelper, - document, - wikipediaHelper.getWikilessI2pRedirectsChecks, - wikipediaHelper.setWikilessI2pRedirectsChecks, - wikipediaHelper.getWikilessI2pCustomRedirects, - wikipediaHelper.setWikilessI2pCustomRedirects + 'wikiless', + 'i2p', + wikipediaHelper, + document, + wikipediaHelper.getWikilessI2pRedirectsChecks, + wikipediaHelper.setWikilessI2pRedirectsChecks, + wikipediaHelper.getWikilessI2pCustomRedirects, + wikipediaHelper.setWikilessI2pCustomRedirects ) }) + +let latencyElement = document.getElementById("latency"); +let latencyLabel = document.getElementById("latency-label"); +latencyElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyElement.addEventListener("click", reloadWindow); + await wikipediaHelper.init(); + let redirects = wikipediaHelper.getRedirects(); + const oldHtml = latencyLabel.innerHTML; + latencyLabel.innerHTML = '...'; + commonHelper.testLatency(latencyLabel, redirects.wikiless.normal).then(r => { + browser.storage.local.set({ wikilessLatency: r }); + latencyLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'wikiless', + 'normal', + wikipediaHelper, + document, + wikipediaHelper.getWikilessNormalRedirectsChecks, + wikipediaHelper.setWikilessNormalRedirectsChecks, + wikipediaHelper.getWikilessNormalCustomRedirects, + wikipediaHelper.setWikilessNormalCustomRedirects, + r, + ) + latencyElement.removeEventListener("click", reloadWindow) + }); + } +); \ No newline at end of file diff --git a/src/pages/options/youtube/invidious.js b/src/pages/options/youtube/invidious.js index d390ef87..af94c531 100644 --- a/src/pages/options/youtube/invidious.js +++ b/src/pages/options/youtube/invidious.js @@ -118,6 +118,7 @@ function init() { feed_menu0.value = youtubeHelper.getInvidiousFeedMenuList()[0]; feed_menu1.value = youtubeHelper.getInvidiousFeedMenuList()[1]; + browser.storage.local.get("invidiousLatency").then(r => { commonHelper.processDefaultCustomInstances( 'invidious', 'normal', @@ -126,8 +127,10 @@ function init() { youtubeHelper.getInvidiousNormalRedirectsChecks, youtubeHelper.setInvidiousNormalRedirectsChecks, youtubeHelper.getInvidiousNormalCustomRedirects, - youtubeHelper.setInvidiousNormalCustomRedirects - ); + youtubeHelper.setInvidiousNormalCustomRedirects, + r.invidiousLatency + ); + }) commonHelper.processDefaultCustomInstances( 'invidious', @@ -142,4 +145,33 @@ function init() { }); } -init() \ No newline at end of file +init() + +let latencyInvidiousElement = document.getElementById("latency-invidious"); +let latencyInvidiousLabel = document.getElementById("latency-invidious-label"); +latencyInvidiousElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyInvidiousElement.addEventListener("click", reloadWindow); + await youtubeHelper.init(); + let redirects = youtubeHelper.getRedirects(); + const oldHtml = latencyInvidiousLabel.innerHTML; + latencyInvidiousLabel.innerHTML = '...'; + commonHelper.testLatency(latencyInvidiousLabel, redirects.invidious.normal).then(r => { + browser.storage.local.set({ invidiousLatency: r }); + latencyInvidiousLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'invidious', + 'normal', + youtubeHelper, + document, + youtubeHelper.getInvidiousNormalRedirectsChecks, + youtubeHelper.setInvidiousNormalRedirectsChecks, + youtubeHelper.getInvidiousNormalCustomRedirects, + youtubeHelper.setInvidiousNormalCustomRedirects, + r, + ); + latencyInvidiousElement.removeEventListener("click", reloadWindow); + }); + } +); \ No newline at end of file diff --git a/src/pages/options/youtube/piped.js b/src/pages/options/youtube/piped.js index bb851ba0..a0bc45a7 100644 --- a/src/pages/options/youtube/piped.js +++ b/src/pages/options/youtube/piped.js @@ -110,16 +110,20 @@ function init() { volume.value = youtubeHelper.getVolume(); volumeValue.textContent = `${youtubeHelper.getVolume()}%`; - commonHelper.processDefaultCustomInstances( - 'piped', - 'normal', - youtubeHelper, - document, - youtubeHelper.getPipedNormalRedirectsChecks, - youtubeHelper.setPipedNormalRedirectsChecks, - youtubeHelper.getPipedNormalCustomRedirects, - youtubeHelper.setPipedNormalCustomRedirects - ); + browser.storage.local.get("pipedLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'piped', + 'normal', + youtubeHelper, + document, + youtubeHelper.getPipedNormalRedirectsChecks, + youtubeHelper.setPipedNormalRedirectsChecks, + youtubeHelper.getPipedNormalCustomRedirects, + youtubeHelper.setPipedNormalCustomRedirects, + r.pipedLatency, + ); + }); + commonHelper.processDefaultCustomInstances( 'piped', 'tor', @@ -132,4 +136,33 @@ function init() { ); }); } -init(); \ No newline at end of file +init(); + +let latencyPipedElement = document.getElementById("latency-piped"); +let latencyPipedLabel = document.getElementById("latency-piped-label"); +latencyPipedElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyPipedElement.addEventListener("click", reloadWindow); + await youtubeHelper.init(); + let redirects = youtubeHelper.getRedirects(); + const oldHtml = latencyPipedLabel.innerHTML; + latencyPipedLabel.innerHTML = '...'; + commonHelper.testLatency(latencyPipedLabel, redirects.piped.normal).then(r => { + browser.storage.local.set({ pipedLatency: r }); + latencyPipedLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'piped', + 'normal', + youtubeHelper, + document, + youtubeHelper.getPipedNormalRedirectsChecks, + youtubeHelper.setPipedNormalRedirectsChecks, + youtubeHelper.getPipedNormalCustomRedirects, + youtubeHelper.setPipedNormalCustomRedirects, + r, + ); + latencyPipedElement.removeEventListener("click", reloadWindow); + }); + } +); diff --git a/src/pages/options/youtube/pipedMaterial.js b/src/pages/options/youtube/pipedMaterial.js index 60b2c424..bc31289a 100644 --- a/src/pages/options/youtube/pipedMaterial.js +++ b/src/pages/options/youtube/pipedMaterial.js @@ -86,19 +86,22 @@ function init() { volumeElement.value = youtubeHelper.getVolume(); volumeValueElement.textContent = `${youtubeHelper.getVolume()}%`; + browser.storage.local.get("pipedMaterialLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'pipedMaterial', + 'normal', + youtubeHelper, + document, + youtubeHelper.getPipedMaterialNormalRedirectsChecks, + youtubeHelper.setPipedMaterialNormalRedirectsChecks, + youtubeHelper.getPipedMaterialNormalCustomRedirects, + youtubeHelper.setPipedMaterialNormalCustomRedirects, + r.pipedMaterialLatency, + ); + }); commonHelper.processDefaultCustomInstances( 'pipedMaterial', - 'normal', - youtubeHelper, - document, - youtubeHelper.getPipedMaterialNormalRedirectsChecks, - youtubeHelper.setPipedMaterialNormalRedirectsChecks, - youtubeHelper.getPipedMaterialNormalCustomRedirects, - youtubeHelper.setPipedMaterialNormalCustomRedirects - ); - commonHelper.processDefaultCustomInstances( - 'pipedMaterial', 'tor', youtubeHelper, document, @@ -109,4 +112,33 @@ function init() { ); }); } -init(); \ No newline at end of file +init(); + +let latencyPipedMaterialElement = document.getElementById("latency-pipedMaterial"); +let latencyPipedMaterialLabel = document.getElementById("latency-pipedMaterial-label"); +latencyPipedMaterialElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyPipedMaterialElement.addEventListener("click", reloadWindow); + await youtubeHelper.init(); + let redirects = youtubeHelper.getRedirects(); + const oldHtml = latencyPipedMaterialLabel.innerHTML; + latencyPipedMaterialLabel.innerHTML = '...'; + commonHelper.testLatency(latencyPipedMaterialLabel, redirects.pipedMaterial.normal).then(r => { + browser.storage.local.set({ pipedMaterialLatency: r }); + latencyPipedMaterialLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'pipedMaterial', + 'normal', + youtubeHelper, + document, + youtubeHelper.getPipedMaterialNormalRedirectsChecks, + youtubeHelper.setPipedMaterialNormalRedirectsChecks, + youtubeHelper.getPipedMaterialNormalCustomRedirects, + youtubeHelper.setPipedMaterialNormalCustomRedirects, + r, + ); + latencyPipedMaterialElement.removeEventListener("click", reloadWindow); + }); + } +); \ No newline at end of file diff --git a/src/pages/options/youtube/youtube.html b/src/pages/options/youtube/youtube.html new file mode 100644 index 00000000..67c86786 --- /dev/null +++ b/src/pages/options/youtube/youtube.html @@ -0,0 +1,1302 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg"> + <link href="../../stylesheets/styles.css" rel="stylesheet"> + <title>Document</title> + </head> +</html> +<script type="module" src="../../../assets/javascripts/localise.js"></script> +<body class="option" dir="auto"> + <section class="links"> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor"> + <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path> + </svg><a href="../general/general.html" data-localise="__MSG_general__">General</a> + </div> + <div class="title"> <img src="../../../assets/images/youtube-icon.png"><a class="selected" href="../youtube/youtube.html" data-localise="__MSG_youtube__">YouTube </a></div> + <div class="title"> <img src="../../../assets/images/youtube-music-icon.png"><a href="../youtubeMusic/youtubeMusic.html" data-localise="__MSG_ytmusic__">YT Music</a></div> + <div class="title"> <img src="../../../assets/images/twitter-icon.png"><a href="../twitter/twitter.html" data-localise="__MSG_twitter__">Twitter</a></div> + <div class="title"> <img src="../../../assets/images/instagram-icon.png"><a href="../instagram/instagram.html" data-localise="__MSG_instagram__">Instagram</a></div> + <div class="title"> <img src="../../../assets/images/tiktok-icon.png"><a href="../tiktok/tiktok.html" data-localise="__MSG_tiktok__">TikTok</a></div> + <div class="title"> <img src="../../../assets/images/reddit-icon.png"><a href="../reddit/reddit.html" data-localise="__MSG_reddit__">Reddit</a></div> + <div class="title"> <img src="../../../assets/images/imgur-icon.png"><a href="../imgur/imgur.html" data-localise="__MSG_imgur__">Imgur</a></div> + <div class="title"> <img src="../../../assets/images/pixiv-icon.svg"><a href="../pixiv/pixiv.html" data-localise="__MSG_pixiv__">Pixiv</a></div> + <div class="title"> <img src="../../../assets/images/librespeed-icon.svg"><a href="../speedtest/speedtest.html" data-localise="__MSG_speedtest__">Speedtest</a></div> + <div class="title"> <img src="../../../assets/images/spotify-icon.png"><a href="../spotify/spotify.html" data-localise="__MSG_spotify__">Spotify</a></div> + <div class="title"> <img src="../../../assets/images/wikipedia-icon.svg"><a href="../wikipedia/wikipedia.html" data-localise="__MSG_wikipedia__">Wikipedia</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> + <circle cx="500" cy="500" r="500"></circle> + <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> + <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> + </svg><a href="../medium/medium.html" data-localise="__MSG_medium__">Medium</a> + </div> + <div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a href="../peertube/peertube.html" data-localise="__MSG_peertube__">Peertube</a></div> + <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="../lbry/lbry.html" data-localise="__MSG_lbry__">LBRY/Odysee</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg><a href="../search/search.html" data-localise="__MSG_search__">Search</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> + </svg><a href="../translate/translate.html" data-localise="__MSG_translate__">Translate</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path> + </svg><a href="../maps/maps.html" data-localise="__MSG_maps__">Maps</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> + </svg><a href="../sendTargets/sendTargets.html" data-localise="__MSG_sendFiles__">Send Files</a> + </div> + </section> + <section class="option-block"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enable__">Enable</h4> + <input id="disable-invidious" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_frontend__">Frontend</h4> + <select id="youtube-frontend"> + <option value="invidious">Invidious</option> + <option value="piped">Piped</option> + <option value="pipedMaterial">Piped-Material</option> + <option value="freetube">FreeTube</option> + <option value="yatte">Yattee</option> + </select> + </div> + <hr> + <div id="freetube-yatte"> + <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> + <hr> + </div> + <div id="invidious-piped-pipedMaterial"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_protocol__">Protocol</h4> + <select id="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="only-embed"> + <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_bypassYoutube__">Bypass "Watch On YouTube"</h4> + <input id="bypass-watch-on-youtube" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enableCustom__">Enable Custom Settings (will use cookies and localStorage)</h4> + <input id="enable-youtube-custom-settings" type="checkbox"> + </div> + </div> + <div id="invidious"> + <div class="custom-settings"> + <hr> + <div class="some-block option-block"> + <h4 data-localise="__MSG_alwaysLoop__">Always loop</h4> + <input class="video_loop" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_autoplayVid__">Autoplay Video</h4> + <input class="youtubeAutoplay" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_playNext__">Play next by default</h4> + <input class="continue" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_autoplayNext__">Autoplay next video</h4> + <input class="continue_autoplay" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_alwaysProxy__">Always proxy videos</h4> + <input class="local" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_listenByDefault__">Listen by default</h4> + <input class="listen" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultSpeed__">Default speed</h4> + <select class="speed"> + <option>2.0</option> + <option>1.75</option> + <option>1.5</option> + <option>1.25</option> + <option>1.0</option> + <option>0.75</option> + <option>0.5</option> + <option>0.25</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_prefQuality__">Preferred video quality</h4> + <select class="quality"> + <option value="hd720">720p</option> + <option value="medium">480p</option> + <option value="dash" data-localise="__MSG_dash__">DASH (adaptive quality)</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_prefDashQuality__">Preferred DASH video quality</h4> + <select class="quality_dash"> + <option value="auto" data-localise="__MSG_auto__">Auto</option> + <option value="best" data-localise="__MSG_best__">Best</option> + <option value="4320p">4320p</option> + <option value="2160p">2160p</option> + <option value="1440p">1440p</option> + <option value="1080p">1080p</option> + <option value="720p">720p</option> + <option value="480p">480p</option> + <option value="360p">360p</option> + <option value="240p">240p</option> + <option value="144p">144p</option> + <option value="worst" data-localise="__MSG_worst__">Worst</option> + </select> + </div> + <div class="some-block option-block"> + <h4> + <x data-localise="__MSG_volume__">Volume:</x><span class="volume-value">--%</span> + </h4> + <input class="volume" type="range" min="0" max="100" step="1"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_prefDashQuality__">Default comments</h4> + <select class="comments[0]"> + <option value="" data-localise="__MSG_none__">none</option> + <option value="youtube">YouTube</option> + <option value="reddit">Reddit</option> + </select> + <select class="comments[1]"> + <option value="" data-localise="__MSG_none__">none</option> + <option value="youtube">YouTube</option> + <option value="reddit">Reddit</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultCaptions__">Default captions</h4> + <select class="captions[0]"> + <option value="" data-localise="__MSG_none__">none</option> + <option value="English">English</option> + <option value="English (auto-generated)">English (auto-generated)</option> + <option value="English (United Kingdom)">English (United Kingdom)</option> + <option value="English (United States)">English (United States)</option> + <option value="Afrikaans">Afrikaans</option> + <option value="Albanian">Albanian</option> + <option value="Amharic">Amharic</option> + <option value="Arabic">Arabic</option> + <option value="Armenian">Armenian</option> + <option value="Azerbaijani">Azerbaijani</option> + <option value="Bangla">Bangla</option> + <option value="Basque">Basque</option> + <option value="Belarusian">Belarusian</option> + <option value="Bosnian">Bosnian</option> + <option value="Bulgarian">Bulgarian</option> + <option value="Burmese">Burmese</option> + <option value="Cantonese (Hong Kong)">Cantonese (Hong Kong)</option> + <option value="Catalan">Catalan</option> + <option value="Cebuano">Cebuano</option> + <option value="Chinese">Chinese</option> + <option value="Chinese (China)">Chinese (China)</option> + <option value="Chinese (Hong Kong)">Chinese (Hong Kong)</option> + <option value="Chinese (Simplified)">Chinese (Simplified)</option> + <option value="Chinese (Taiwan)">Chinese (Taiwan)</option> + <option value="Chinese (Traditional)">Chinese (Traditional)</option> + <option value="Corsican">Corsican</option> + <option value="Croatian">Croatian</option> + <option value="Czech">Czech</option> + <option value="Danish">Danish</option> + <option value="Dutch">Dutch</option> + <option value="Dutch (auto-generated)">Dutch (auto-generated)</option> + <option value="Esperanto">Esperanto</option> + <option value="Estonian">Estonian</option> + <option value="Filipino">Filipino</option> + <option value="Finnish">Finnish</option> + <option value="French">French</option> + <option value="French (auto-generated)">French (auto-generated)</option> + <option value="Galician">Galician</option> + <option value="Georgian">Georgian</option> + <option value="German">German</option> + <option value="German (auto-generated)">German (auto-generated)</option> + <option value="Greek">Greek</option> + <option value="Gujarati">Gujarati</option> + <option value="Haitian Creole">Haitian Creole</option> + <option value="Hausa">Hausa</option> + <option value="Hawaiian">Hawaiian</option> + <option value="Hebrew">Hebrew</option> + <option value="Hindi">Hindi</option> + <option value="Hmong">Hmong</option> + <option value="Hungarian">Hungarian</option> + <option value="Icelandic">Icelandic</option> + <option value="Igbo">Igbo</option> + <option value="Indonesian">Indonesian</option> + <option value="Indonesian (auto-generated)">Indonesian (auto-generated)</option> + <option value="Interlingue">Interlingue</option> + <option value="Irish">Irish</option> + <option value="Italian">Italian</option> + <option value="Italian (auto-generated)">Italian (auto-generated)</option> + <option value="Japanese">Japanese</option> + <option value="Japanese (auto-generated)">Japanese (auto-generated)</option> + <option value="Javanese">Javanese</option> + <option value="Kannada">Kannada</option> + <option value="Kazakh">Kazakh</option> + <option value="Khmer">Khmer</option> + <option value="Korean">Korean</option> + <option value="Korean (auto-generated)">Korean (auto-generated)</option> + <option value="Kurdish">Kurdish</option> + <option value="Kyrgyz">Kyrgyz</option> + <option value="Lao">Lao</option> + <option value="Latin">Latin</option> + <option value="Latvian">Latvian</option> + <option value="Lithuanian">Lithuanian</option> + <option value="Luxembourgish">Luxembourgish</option> + <option value="Macedonian">Macedonian</option> + <option value="Malagasy">Malagasy</option> + <option value="Malay">Malay</option> + <option value="Malayalam">Malayalam</option> + <option value="Maltese">Maltese</option> + <option value="Maori">Maori</option> + <option value="Marathi">Marathi</option> + <option value="Mongolian">Mongolian</option> + <option value="Nepali">Nepali</option> + <option value="Norwegian Bokmål">Norwegian Bokmål</option> + <option value="Nyanja">Nyanja</option> + <option value="Pashto">Pashto</option> + <option value="Persian">Persian</option> + <option value="Polish">Polish</option> + <option value="Portuguese">Portuguese</option> + <option value="Portuguese (auto-generated)">Portuguese (auto-generated)</option> + <option value="Portuguese (Brazil)">Portuguese (Brazil)</option> + <option value="Punjabi">Punjabi</option> + <option value="Romanian">Romanian</option> + <option value="Russian">Russian</option> + <option value="Russian (auto-generated)">Russian (auto-generated)</option> + <option value="Samoan">Samoan</option> + <option value="Scottish Gaelic">Scottish Gaelic</option> + <option value="Serbian">Serbian</option> + <option value="Shona">Shona</option> + <option value="Sindhi">Sindhi</option> + <option value="Sinhala">Sinhala</option> + <option value="Slovak">Slovak</option> + <option value="Slovenian">Slovenian</option> + <option value="Somali">Somali</option> + <option value="Southern Sotho">Southern Sotho</option> + <option value="Spanish">Spanish</option> + <option value="Spanish (auto-generated)">Spanish (auto-generated)</option> + <option value="Spanish (Latin America)">Spanish (Latin America)</option> + <option value="Spanish (Mexico)">Spanish (Mexico)</option> + <option value="Spanish (Spain)">Spanish (Spain)</option> + <option value="Sundanese">Sundanese</option> + <option value="Swahili">Swahili</option> + <option value="Swedish">Swedish</option> + <option value="Tajik">Tajik</option> + <option value="Tamil">Tamil</option> + <option value="Telugu">Telugu</option> + <option value="Thai">Thai</option> + <option value="Turkish">Turkish</option> + <option value="Turkish (auto-generated)">Turkish (auto-generated)</option> + <option value="Ukrainian">Ukrainian</option> + <option value="Urdu">Urdu</option> + <option value="Uzbek">Uzbek</option> + <option value="Vietnamese">Vietnamese</option> + <option value="Vietnamese (auto-generated)">Vietnamese (auto-generated)</option> + <option value="Welsh">Welsh</option> + <option value="Western Frisian">Western Frisian</option> + <option value="Xhosa">Xhosa</option> + <option value="Yiddish">Yiddish</option> + <option value="Yoruba">Yoruba</option> + <option value="Zulu">Zulu</option> + </select> + <select class="captions[1]"> + <option value="" data-localise="__MSG_none__">none</option> + <option value="English">English</option> + <option value="English (auto-generated)">English (auto-generated)</option> + <option value="English (United Kingdom)">English (United Kingdom)</option> + <option value="English (United States)">English (United States)</option> + <option value="Afrikaans">Afrikaans</option> + <option value="Albanian">Albanian</option> + <option value="Amharic">Amharic</option> + <option value="Arabic">Arabic</option> + <option value="Armenian">Armenian</option> + <option value="Azerbaijani">Azerbaijani</option> + <option value="Bangla">Bangla</option> + <option value="Basque">Basque</option> + <option value="Belarusian">Belarusian</option> + <option value="Bosnian">Bosnian</option> + <option value="Bulgarian">Bulgarian</option> + <option value="Burmese">Burmese</option> + <option value="Cantonese (Hong Kong)">Cantonese (Hong Kong)</option> + <option value="Catalan">Catalan</option> + <option value="Cebuano">Cebuano</option> + <option value="Chinese">Chinese</option> + <option value="Chinese (China)">Chinese (China)</option> + <option value="Chinese (Hong Kong)">Chinese (Hong Kong)</option> + <option value="Chinese (Simplified)">Chinese (Simplified)</option> + <option value="Chinese (Taiwan)">Chinese (Taiwan)</option> + <option value="Chinese (Traditional)">Chinese (Traditional)</option> + <option value="Corsican">Corsican</option> + <option value="Croatian">Croatian</option> + <option value="Czech">Czech</option> + <option value="Danish">Danish</option> + <option value="Dutch">Dutch</option> + <option value="Dutch (auto-generated)">Dutch (auto-generated)</option> + <option value="Esperanto">Esperanto</option> + <option value="Estonian">Estonian</option> + <option value="Filipino">Filipino</option> + <option value="Finnish">Finnish</option> + <option value="French">French</option> + <option value="French (auto-generated)">French (auto-generated)</option> + <option value="Galician">Galician</option> + <option value="Georgian">Georgian</option> + <option value="German">German</option> + <option value="German (auto-generated)">German (auto-generated)</option> + <option value="Greek">Greek</option> + <option value="Gujarati">Gujarati</option> + <option value="Haitian Creole">Haitian Creole</option> + <option value="Hausa">Hausa</option> + <option value="Hawaiian">Hawaiian</option> + <option value="Hebrew">Hebrew</option> + <option value="Hindi">Hindi</option> + <option value="Hmong">Hmong</option> + <option value="Hungarian">Hungarian</option> + <option value="Icelandic">Icelandic</option> + <option value="Igbo">Igbo</option> + <option value="Indonesian">Indonesian</option> + <option value="Indonesian (auto-generated)">Indonesian (auto-generated)</option> + <option value="Interlingue">Interlingue</option> + <option value="Irish">Irish</option> + <option value="Italian">Italian</option> + <option value="Italian (auto-generated)">Italian (auto-generated)</option> + <option value="Japanese">Japanese</option> + <option value="Japanese (auto-generated)">Japanese (auto-generated)</option> + <option value="Javanese">Javanese</option> + <option value="Kannada">Kannada</option> + <option value="Kazakh">Kazakh</option> + <option value="Khmer">Khmer</option> + <option value="Korean">Korean</option> + <option value="Korean (auto-generated)">Korean (auto-generated)</option> + <option value="Kurdish">Kurdish</option> + <option value="Kyrgyz">Kyrgyz</option> + <option value="Lao">Lao</option> + <option value="Latin">Latin</option> + <option value="Latvian">Latvian</option> + <option value="Lithuanian">Lithuanian</option> + <option value="Luxembourgish">Luxembourgish</option> + <option value="Macedonian">Macedonian</option> + <option value="Malagasy">Malagasy</option> + <option value="Malay">Malay</option> + <option value="Malayalam">Malayalam</option> + <option value="Maltese">Maltese</option> + <option value="Maori">Maori</option> + <option value="Marathi">Marathi</option> + <option value="Mongolian">Mongolian</option> + <option value="Nepali">Nepali</option> + <option value="Norwegian Bokmål">Norwegian Bokmål</option> + <option value="Nyanja">Nyanja</option> + <option value="Pashto">Pashto</option> + <option value="Persian">Persian</option> + <option value="Polish">Polish</option> + <option value="Portuguese">Portuguese</option> + <option value="Portuguese (auto-generated)">Portuguese (auto-generated)</option> + <option value="Portuguese (Brazil)">Portuguese (Brazil)</option> + <option value="Punjabi">Punjabi</option> + <option value="Romanian">Romanian</option> + <option value="Russian">Russian</option> + <option value="Russian (auto-generated)">Russian (auto-generated)</option> + <option value="Samoan">Samoan</option> + <option value="Scottish Gaelic">Scottish Gaelic</option> + <option value="Serbian">Serbian</option> + <option value="Shona">Shona</option> + <option value="Sindhi">Sindhi</option> + <option value="Sinhala">Sinhala</option> + <option value="Slovak">Slovak</option> + <option value="Slovenian">Slovenian</option> + <option value="Somali">Somali</option> + <option value="Southern Sotho">Southern Sotho</option> + <option value="Spanish">Spanish</option> + <option value="Spanish (auto-generated)">Spanish (auto-generated)</option> + <option value="Spanish (Latin America)">Spanish (Latin America)</option> + <option value="Spanish (Mexico)">Spanish (Mexico)</option> + <option value="Spanish (Spain)">Spanish (Spain)</option> + <option value="Sundanese">Sundanese</option> + <option value="Swahili">Swahili</option> + <option value="Swedish">Swedish</option> + <option value="Tajik">Tajik</option> + <option value="Tamil">Tamil</option> + <option value="Telugu">Telugu</option> + <option value="Thai">Thai</option> + <option value="Turkish">Turkish</option> + <option value="Turkish (auto-generated)">Turkish (auto-generated)</option> + <option value="Ukrainian">Ukrainian</option> + <option value="Urdu">Urdu</option> + <option value="Uzbek">Uzbek</option> + <option value="Vietnamese">Vietnamese</option> + <option value="Vietnamese (auto-generated)">Vietnamese (auto-generated)</option> + <option value="Welsh">Welsh</option> + <option value="Western Frisian">Western Frisian</option> + <option value="Xhosa">Xhosa</option> + <option value="Yiddish">Yiddish</option> + <option value="Yoruba">Yoruba</option> + <option value="Zulu">Zulu</option> + </select> + <select class="captions[2]"> + <option value="" data-localise="__MSG_none__">none</option> + <option value="English">English</option> + <option value="English (auto-generated)">English (auto-generated)</option> + <option value="English (United Kingdom)">English (United Kingdom)</option> + <option value="English (United States)">English (United States)</option> + <option value="Afrikaans">Afrikaans</option> + <option value="Albanian">Albanian</option> + <option value="Amharic">Amharic</option> + <option value="Arabic">Arabic</option> + <option value="Armenian">Armenian</option> + <option value="Azerbaijani">Azerbaijani</option> + <option value="Bangla">Bangla</option> + <option value="Basque">Basque</option> + <option value="Belarusian">Belarusian</option> + <option value="Bosnian">Bosnian</option> + <option value="Bulgarian">Bulgarian</option> + <option value="Burmese">Burmese</option> + <option value="Cantonese (Hong Kong)">Cantonese (Hong Kong)</option> + <option value="Catalan">Catalan</option> + <option value="Cebuano">Cebuano</option> + <option value="Chinese">Chinese</option> + <option value="Chinese (China)">Chinese (China)</option> + <option value="Chinese (Hong Kong)">Chinese (Hong Kong)</option> + <option value="Chinese (Simplified)">Chinese (Simplified)</option> + <option value="Chinese (Taiwan)">Chinese (Taiwan)</option> + <option value="Chinese (Traditional)">Chinese (Traditional)</option> + <option value="Corsican">Corsican</option> + <option value="Croatian">Croatian</option> + <option value="Czech">Czech</option> + <option value="Danish">Danish</option> + <option value="Dutch">Dutch</option> + <option value="Dutch (auto-generated)">Dutch (auto-generated)</option> + <option value="Esperanto">Esperanto</option> + <option value="Estonian">Estonian</option> + <option value="Filipino">Filipino</option> + <option value="Finnish">Finnish</option> + <option value="French">French</option> + <option value="French (auto-generated)">French (auto-generated)</option> + <option value="Galician">Galician</option> + <option value="Georgian">Georgian</option> + <option value="German">German</option> + <option value="German (auto-generated)">German (auto-generated)</option> + <option value="Greek">Greek</option> + <option value="Gujarati">Gujarati</option> + <option value="Haitian Creole">Haitian Creole</option> + <option value="Hausa">Hausa</option> + <option value="Hawaiian">Hawaiian</option> + <option value="Hebrew">Hebrew</option> + <option value="Hindi">Hindi</option> + <option value="Hmong">Hmong</option> + <option value="Hungarian">Hungarian</option> + <option value="Icelandic">Icelandic</option> + <option value="Igbo">Igbo</option> + <option value="Indonesian">Indonesian</option> + <option value="Indonesian (auto-generated)">Indonesian (auto-generated)</option> + <option value="Interlingue">Interlingue</option> + <option value="Irish">Irish</option> + <option value="Italian">Italian</option> + <option value="Italian (auto-generated)">Italian (auto-generated)</option> + <option value="Japanese">Japanese</option> + <option value="Japanese (auto-generated)">Japanese (auto-generated)</option> + <option value="Javanese">Javanese</option> + <option value="Kannada">Kannada</option> + <option value="Kazakh">Kazakh</option> + <option value="Khmer">Khmer</option> + <option value="Korean">Korean</option> + <option value="Korean (auto-generated)">Korean (auto-generated)</option> + <option value="Kurdish">Kurdish</option> + <option value="Kyrgyz">Kyrgyz</option> + <option value="Lao">Lao</option> + <option value="Latin">Latin</option> + <option value="Latvian">Latvian</option> + <option value="Lithuanian">Lithuanian</option> + <option value="Luxembourgish">Luxembourgish</option> + <option value="Macedonian">Macedonian</option> + <option value="Malagasy">Malagasy</option> + <option value="Malay">Malay</option> + <option value="Malayalam">Malayalam</option> + <option value="Maltese">Maltese</option> + <option value="Maori">Maori</option> + <option value="Marathi">Marathi</option> + <option value="Mongolian">Mongolian</option> + <option value="Nepali">Nepali</option> + <option value="Norwegian Bokmål">Norwegian Bokmål</option> + <option value="Nyanja">Nyanja</option> + <option value="Pashto">Pashto</option> + <option value="Persian">Persian</option> + <option value="Polish">Polish</option> + <option value="Portuguese">Portuguese</option> + <option value="Portuguese (auto-generated)">Portuguese (auto-generated)</option> + <option value="Portuguese (Brazil)">Portuguese (Brazil)</option> + <option value="Punjabi">Punjabi</option> + <option value="Romanian">Romanian</option> + <option value="Russian">Russian</option> + <option value="Russian (auto-generated)">Russian (auto-generated)</option> + <option value="Samoan">Samoan</option> + <option value="Scottish Gaelic">Scottish Gaelic</option> + <option value="Serbian">Serbian</option> + <option value="Shona">Shona</option> + <option value="Sindhi">Sindhi</option> + <option value="Sinhala">Sinhala</option> + <option value="Slovak">Slovak</option> + <option value="Slovenian">Slovenian</option> + <option value="Somali">Somali</option> + <option value="Southern Sotho">Southern Sotho</option> + <option value="Spanish">Spanish</option> + <option value="Spanish (auto-generated)">Spanish (auto-generated)</option> + <option value="Spanish (Latin America)">Spanish (Latin America)</option> + <option value="Spanish (Mexico)">Spanish (Mexico)</option> + <option value="Spanish (Spain)">Spanish (Spain)</option> + <option value="Sundanese">Sundanese</option> + <option value="Swahili">Swahili</option> + <option value="Swedish">Swedish</option> + <option value="Tajik">Tajik</option> + <option value="Tamil">Tamil</option> + <option value="Telugu">Telugu</option> + <option value="Thai">Thai</option> + <option value="Turkish">Turkish</option> + <option value="Turkish (auto-generated)">Turkish (auto-generated)</option> + <option value="Ukrainian">Ukrainian</option> + <option value="Urdu">Urdu</option> + <option value="Uzbek">Uzbek</option> + <option value="Vietnamese">Vietnamese</option> + <option value="Vietnamese (auto-generated)">Vietnamese (auto-generated)</option> + <option value="Welsh">Welsh</option> + <option value="Western Frisian">Western Frisian</option> + <option value="Xhosa">Xhosa</option> + <option value="Yiddish">Yiddish</option> + <option value="Yoruba">Yoruba</option> + <option value="Zulu">Zulu</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_showRelated__">Show related videos</h4> + <input class="related_videos" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_showAnnotations__">Show annotations by default</h4> + <input class="annotations" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_autoExtendDesc__">Automatically extend video description</h4> + <input class="extend_desc" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_interactive360__">Interactive 360 degree videos (requires WebGL)</h4> + <input class="vr_mode" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_savePlaybackPos__">Save playback position</h4> + <input class="save_player_pos" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_region__">Select country</h4> + <select class="region"> + <option value="AE">AE</option> + <option value="AR">AR</option> + <option value="AT">AT</option> + <option value="AU">AU</option> + <option value="AZ">AZ</option> + <option value="BA">BA</option> + <option value="BD">BD</option> + <option value="BE">BE</option> + <option value="BG">BG</option> + <option value="BH">BH</option> + <option value="BO">BO</option> + <option value="BR">BR</option> + <option value="BY">BY</option> + <option value="CA">CA</option> + <option value="CH">CH</option> + <option value="CL">CL</option> + <option value="CO">CO</option> + <option value="CR">CR</option> + <option value="CY">CY</option> + <option value="CZ">CZ</option> + <option value="DE">DE</option> + <option value="DK">DK</option> + <option value="DO">DO</option> + <option value="DZ">DZ</option> + <option value="EC">EC</option> + <option value="EE">EE</option> + <option value="EG">EG</option> + <option value="ES">ES</option> + <option value="FI">FI</option> + <option value="FR">FR</option> + <option value="GB">GB</option> + <option value="GE">GE</option> + <option value="GH">GH</option> + <option value="GR">GR</option> + <option value="GT">GT</option> + <option value="HK">HK</option> + <option value="HN">HN</option> + <option value="HR">HR</option> + <option value="HU">HU</option> + <option value="ID">ID</option> + <option value="IE">IE</option> + <option value="IL">IL</option> + <option value="IN">IN</option> + <option value="IQ">IQ</option> + <option value="IS">IS</option> + <option value="IT">IT</option> + <option value="JM">JM</option> + <option value="JO">JO</option> + <option value="JP">JP</option> + <option value="KE">KE</option> + <option value="KR">KR</option> + <option value="KW">KW</option> + <option value="KZ">KZ</option> + <option value="LB">LB</option> + <option value="LI">LI</option> + <option value="LK">LK</option> + <option value="LT">LT</option> + <option value="LU">LU</option> + <option value="LV">LV</option> + <option value="LY">LY</option> + <option value="MA">MA</option> + <option value="ME">ME</option> + <option value="MK">MK</option> + <option value="MT">MT</option> + <option value="MX">MX</option> + <option value="MY">MY</option> + <option value="NG">NG</option> + <option value="NI">NI</option> + <option value="NL">NL</option> + <option value="NO">NO</option> + <option value="NP">NP</option> + <option value="NZ">NZ</option> + <option value="OM">OM</option> + <option value="PA">PA</option> + <option value="PE">PE</option> + <option value="PG">PG</option> + <option value="PH">PH</option> + <option value="PK">PK</option> + <option value="PL">PL</option> + <option value="PR">PR</option> + <option value="PT">PT</option> + <option value="PY">PY</option> + <option value="QA">QA</option> + <option value="RO">RO</option> + <option value="RS">RS</option> + <option value="RU">RU</option> + <option value="SA">SA</option> + <option value="SE">SE</option> + <option value="SG">SG</option> + <option value="SI">SI</option> + <option value="SK">SK</option> + <option value="SN">SN</option> + <option value="SV">SV</option> + <option value="TH">TH</option> + <option value="TN">TN</option> + <option value="TR">TR</option> + <option value="TW">TW</option> + <option value="TZ">TZ</option> + <option value="UA">UA</option> + <option value="UG">UG</option> + <option value="US">US</option> + <option value="UY">UY</option> + <option value="VE">VE</option> + <option value="VN">VN</option> + <option value="YE">YE</option> + <option value="ZA">ZA</option> + <option value="ZW">ZW</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_playerStyle__">Player Style</h4> + <select class="player_style"> + <option value="invidious" data-localise="__MSG_invidious__">Invidious</option> + <option value="youtube" data-localise="__MSG_youtube__">YouTube</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_theme__">Theme</h4> + <select class="dark_mode"> + <option value="">auto</option> + <option value="light">light</option> + <option value="dark">dark</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_thin_mode__">Thin mode</h4> + <input class="thin_mode" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_default_home__">Default homepage</h4> + <select class="default_home"> + <option value="">Search</option> + <option value="Popular">Popular</option> + <option value="Trending">Trending</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_feedMenu__">Feed menu</h4> + <select class="feed_menu[0]"> + <option value="">Search</option> + <option value="Popular">Popular</option> + <option value="Trending">Trending</option> + </select> + <select class="feed_menu[1]"> + <option value="">Search</option> + <option value="Popular">Popular</option> + <option value="Trending">Trending</option> + </select> + </div> + </div> + <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://invidious.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-invidious-label" for="latency-invidious"> + <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-invidious" style="display:none;"> + </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="https://invidious.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + <div id="piped"> + <hr> + <div class="custom-settings"> + <hr> + <div class="some-block option-block"> + <h4> + <x data-localise="__MSG_volume__">Volume:</x><span class="volume-value">--%</span> + </h4> + <input class="volume" type="range" min="0" max="100" step="1"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enableSponsorBlock__">Enable Sponsorblock</h4> + <input class="sponsorblock" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_skipSponsors__">Skip Sponsors</h4> + <input class="selectedSkip-sponsor" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_skipIntermission__">Skip Intermission/Intro Animation</h4> + <input class="selectedSkip-intro" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_skripEndcars__">Skip Endcards/Credits</h4> + <input class="selectedSkip-outro" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_skripPreview__">Skip Preview/Recap</h4> + <input class="selectedSkip-preview" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_skipReminder__">Skip Interaction Reminder (Subscribe)</h4> + <input class="selectedSkip-interaction" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_skipUnpaidPromo__">Skip Unpaid/Self Promotion(Subscribe)</h4> + <input class="selectedSkip-selfpromo" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_skipMusic__">Skip Music: Non-Music Section(Subscribe)</h4> + <input class="selectedSkip-music_offtopic" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_skipHighlight__">Skip Highlight(Subscribe)</h4> + <input class="selectedSkip-poi_highlight" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_skipFiller__">Skip Filler Tangent</h4> + <input class="selectedSkip-filler" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_theme__">Theme</h4> + <select class="ddlTheme"> + <option value="auto">Auto</option> + <option value="dark">Dark</option> + <option value="light">Light</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_autoplayVid__">Autoplay Video</h4> + <input class="youtubeAutoplay" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_audioOnly__">Audio Only</h4> + <input class="listen" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultQuality__">Default Quality</h4> + <select class="quality"> + <option value="0">Auto</option> + <option value="144">144p</option> + <option value="240">240p</option> + <option value="360">360p</option> + <option value="480">480p</option> + <option value="720">720p</option> + <option value="1080">1080p</option> + <option value="1440">1440p</option> + <option value="2160">2160p</option> + <option value="4320">4320p</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_bufferingGoal__">Buffering Goal (in seconds)</h4> + <input class="bufferGoal" type="number" min="10"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_countrySelection__">Country Selection</h4> + <select class="region"> + <option value="AF">Afghanistan</option> + <option value="AL">Albania</option> + <option value="DZ">Algeria</option> + <option value="AD">Andorra</option> + <option value="AO">Angola</option> + <option value="AG">Antigua and Barbuda</option> + <option value="AR">Argentina</option> + <option value="AM">Armenia</option> + <option value="AU">Australia</option> + <option value="AT">Austria</option> + <option value="AZ">Azerbaijan</option> + <option value="BS">Bahamas</option> + <option value="BH">Bahrain</option> + <option value="BD">Bangladesh</option> + <option value="BB">Barbados</option> + <option value="BY">Belarus</option> + <option value="BE">Belgium</option> + <option value="BZ">Belize</option> + <option value="BJ">Benin</option> + <option value="BT">Bhutan</option> + <option value="BO">Bolivia (Plurinational State of)</option> + <option value="BA">Bosnia and Herzegovina</option> + <option value="BW">Botswana</option> + <option value="BR">Brazil</option> + <option value="BN">Brunei Darussalam</option> + <option value="BG">Bulgaria</option> + <option value="BF">Burkina Faso</option> + <option value="BI">Burundi</option> + <option value="CV">Cabo Verde</option> + <option value="KH">Cambodia</option> + <option value="CM">Cameroon</option> + <option value="CA">Canada</option> + <option value="CF">Central African Republic</option> + <option value="TD">Chad</option> + <option value="CL">Chile</option> + <option value="CN">China</option> + <option value="CO">Colombia</option> + <option value="KM">Comoros</option> + <option value="CG">Congo</option> + <option value="CD">Congo, Democratic Republic of the</option> + <option value="CR">Costa Rica</option> + <option value="CI">Côte d'Ivoire</option> + <option value="HR">Croatia</option> + <option value="CU">Cuba</option> + <option value="CY">Cyprus</option> + <option value="CZ">Czechia</option> + <option value="DK">Denmark</option> + <option value="DJ">Djibouti</option> + <option value="DM">Dominica</option> + <option value="DO">Dominican Republic</option> + <option value="EC">Ecuador</option> + <option value="EG">Egypt</option> + <option value="SV">El Salvador</option> + <option value="GQ">Equatorial Guinea</option> + <option value="ER">Eritrea</option> + <option value="EE">Estonia</option> + <option value="SZ">Eswatini</option> + <option value="ET">Ethiopia</option> + <option value="FJ">Fiji</option> + <option value="FI">Finland</option> + <option value="FR">France</option> + <option value="GA">Gabon</option> + <option value="GM">Gambia</option> + <option value="GE">Georgia</option> + <option value="DE">Germany</option> + <option value="GH">Ghana</option> + <option value="GR">Greece</option> + <option value="GD">Grenada</option> + <option value="GT">Guatemala</option> + <option value="GN">Guinea</option> + <option value="GW">Guinea-Bissau</option> + <option value="GY">Guyana</option> + <option value="HT">Haiti</option> + <option value="HN">Honduras</option> + <option value="HU">Hungary</option> + <option value="IS">Iceland</option> + <option value="IN">India</option> + <option value="ID">Indonesia</option> + <option value="IR">Iran (Islamic Republic of)</option> + <option value="IQ">Iraq</option> + <option value="IE">Ireland</option> + <option value="IL">Israel</option> + <option value="IT">Italy</option> + <option value="JM">Jamaica</option> + <option value="JP">Japan</option> + <option value="JO">Jordan</option> + <option value="KZ">Kazakhstan</option> + <option value="KE">Kenya</option> + <option value="KI">Kiribati</option> + <option value="KP">Korea (Democratic People's Republic of)</option> + <option value="KR">Korea, Republic of</option> + <option value="KW">Kuwait</option> + <option value="KG">Kyrgyzstan</option> + <option value="LA">Lao People's Democratic Republic</option> + <option value="LV">Latvia</option> + <option value="LB">Lebanon</option> + <option value="LS">Lesotho</option> + <option value="LR">Liberia</option> + <option value="LY">Libya</option> + <option value="LI">Liechtenstein</option> + <option value="LT">Lithuania</option> + <option value="LU">Luxembourg</option> + <option value="MG">Madagascar</option> + <option value="MW">Malawi</option> + <option value="MY">Malaysia</option> + <option value="MV">Maldives</option> + <option value="ML">Mali</option> + <option value="MT">Malta</option> + <option value="MH">Marshall Islands</option> + <option value="MR">Mauritania</option> + <option value="MU">Mauritius</option> + <option value="MX">Mexico</option> + <option value="FM">Micronesia (Federated States of)</option> + <option value="MD">Moldova, Republic of</option> + <option value="MC">Monaco</option> + <option value="MN">Mongolia</option> + <option value="ME">Montenegro</option> + <option value="MA">Morocco</option> + <option value="MZ">Mozambique</option> + <option value="MM">Myanmar</option> + <option value="NA">Namibia</option> + <option value="NR">Nauru</option> + <option value="NP">Nepal</option> + <option value="NL">Netherlands</option> + <option value="NZ">New Zealand</option> + <option value="NI">Nicaragua</option> + <option value="NE">Niger</option> + <option value="NG">Nigeria</option> + <option value="MK">North Macedonia</option> + <option value="NO">Norway</option> + <option value="OM">Oman</option> + <option value="PK">Pakistan</option> + <option value="PW">Palau</option> + <option value="PA">Panama</option> + <option value="PG">Papua New Guinea</option> + <option value="PY">Paraguay</option> + <option value="PE">Peru</option> + <option value="PH">Philippines</option> + <option value="PL">Poland</option> + <option value="PT">Portugal</option> + <option value="QA">Qatar</option> + <option value="RO">Romania</option> + <option value="RU">Russian Federation</option> + <option value="RW">Rwanda</option> + <option value="KN">Saint Kitts and Nevis</option> + <option value="LC">Saint Lucia</option> + <option value="VC">Saint Vincent and the Grenadines</option> + <option value="WS">Samoa</option> + <option value="SM">San Marino</option> + <option value="ST">Sao Tome and Principe</option> + <option value="SA">Saudi Arabia</option> + <option value="SN">Senegal</option> + <option value="RS">Serbia</option> + <option value="SC">Seychelles</option> + <option value="SL">Sierra Leone</option> + <option value="SG">Singapore</option> + <option value="SK">Slovakia</option> + <option value="SI">Slovenia</option> + <option value="SB">Solomon Islands</option> + <option value="SO">Somalia</option> + <option value="ZA">South Africa</option> + <option value="SS">South Sudan</option> + <option value="ES">Spain</option> + <option value="LK">Sri Lanka</option> + <option value="SD">Sudan</option> + <option value="SR">Suriname</option> + <option value="SE">Sweden</option> + <option value="CH">Switzerland</option> + <option value="SY">Syrian Arab Republic</option> + <option value="TJ">Tajikistan</option> + <option value="TZ">Tanzania, United Republic of</option> + <option value="TH">Thailand</option> + <option value="TL">Timor-Leste</option> + <option value="TG">Togo</option> + <option value="TO">Tonga</option> + <option value="TT">Trinidad and Tobago</option> + <option value="TN">Tunisia</option> + <option value="TR">Turkey</option> + <option value="TM">Turkmenistan</option> + <option value="TV">Tuvalu</option> + <option value="UG">Uganda</option> + <option value="UA">Ukraine</option> + <option value="AE">United Arab Emirates</option> + <option value="GB">United Kingdom of Great Britain and Northern Ireland</option> + <option value="US">United States of America</option> + <option value="UY">Uruguay</option> + <option value="UZ">Uzbekistan</option> + <option value="VU">Vanuatu</option> + <option value="VE">Venezuela (Bolivarian Republic of)</option> + <option value="VN">Viet Nam</option> + <option value="YE">Yemen</option> + <option value="ZM">Zambia</option> + <option value="ZW">Zimbabwe</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_defaultHomepage__">Default Homepage</h4> + <select class="homepage"> + <option value="trending" data-localise="__MSG_trending__">Trending</option> + <option value="feed" data-localise="__MSG_feed__">Feed</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_showComments__">Show Comments</h4> + <input class="comments" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_minimizeDesc__">Minimize Description by default</h4> + <input class="minimizeDescription" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_storeHistory__">Store Watch History</h4> + <input class="watchHistory" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enabledCodecs__">Enabled Codecs (Multiple)</h4> + <select class="enabledCodecs"> + <option value="av1">AV1</option> + <option value="vp9">VP9</option> + <option value="avc">AVC (h.264)</option> + </select> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_disableLBRY__">Disable LBRY for Streaming</h4> + <input class="disableLBRY" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enableProxyLBRY__">Enable Proxy for LBRY</h4> + <input class="proxyLBRY" type="checkbox"> + </div> + </div> + <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://piped.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-piped-label" for="latency-piped"> + <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-piped" style="display:none;"> + </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="https://piped.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + <div id="pipedMaterial"> + <hr> + <div class="custom-settings"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_autoplayVid__">Autoplay Video</h4> + <input class="youtubeAutoplay" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4> + <x data-localise="__MSG_volume__">Volume:</x><span class="volume-value">--%</span> + </h4> + <input class="volume" type="range" min="0" max="100" step="1"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_audioOnly__">Audio Only</h4> + <input class="listen" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_disableLBRY__">Disable LBRY</h4> + <input class="disableLBRY" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_proxyLBRY__">Proxy LBRY videos</h4> + <input class="proxyLBRY" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enableSponsorBlock__">Enable Sponsorblock</h4> + <input class="sponsorblock" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_skipNote__">Skip to the last watched point when encountering a video already seen</h4> + <input class="skipToLastPoint" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_skipSponsors__">Skip Sponsors</h4> + <input class="selectedSkip-sponsor" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_skipIntermission__">Skip Intermission/Intro Animation</h4> + <input class="selectedSkip-intro" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_skripEndcars__">Skip Endcards/Credits</h4> + <input class="selectedSkip-outro" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_skripPreview__">Skip Preview/Recap</h4> + <input class="selectedSkip-preview" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_skipReminder__">Skip Interaction Reminder (Subscribe)</h4> + <input class="selectedSkip-interaction" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_skipUnpaidPromo__">Skip Unpaid/Self Promotion</h4> + <input class="selectedSkip-selfpromo" type="checkbox"> + </div> + <div class="some-block option-block"> + <h4 data-localise="__MSG_skipMusic__">Skip Music: Non-Music Section</h4> + <input class="selectedSkip-music_offtopic" type="checkbox"> + </div> + <hr> + </div> + <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://piped-material.com" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-pipedMaterial-label" for="latency-pipedMaterial"> + <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-pipedMaterial" style="display:none;"> + </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="https://piped-material.onion" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + </div> + </div> + </section> + <script type="module" src="../init.js"></script> + <script type="module" src="./youtube.js"></script> + <script type="module" src="./invidious.js"></script> + <script type="module" src="./piped.js"></script> + <script type="module" src="./pipedMaterial.js"></script> +</body> \ No newline at end of file diff --git a/src/pages/options/youtubeMusic/youtubeMusic.html b/src/pages/options/youtubeMusic/youtubeMusic.html new file mode 100644 index 00000000..eae611d6 --- /dev/null +++ b/src/pages/options/youtubeMusic/youtubeMusic.html @@ -0,0 +1,98 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg"> + <link href="../../stylesheets/styles.css" rel="stylesheet"> + <title>Document</title> + </head> +</html> +<script type="module" src="../../../assets/javascripts/localise.js"></script> +<body class="option" dir="auto"> + <section class="links"> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor"> + <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path> + </svg><a href="../general/general.html" data-localise="__MSG_general__">General</a> + </div> + <div class="title"> <img src="../../../assets/images/youtube-icon.png"><a href="../youtube/youtube.html" data-localise="__MSG_youtube__">YouTube </a></div> + <div class="title"> <img src="../../../assets/images/youtube-music-icon.png"><a class="selected" href="../youtubeMusic/youtubeMusic.html" data-localise="__MSG_ytmusic__">YT Music</a></div> + <div class="title"> <img src="../../../assets/images/twitter-icon.png"><a href="../twitter/twitter.html" data-localise="__MSG_twitter__">Twitter</a></div> + <div class="title"> <img src="../../../assets/images/instagram-icon.png"><a href="../instagram/instagram.html" data-localise="__MSG_instagram__">Instagram</a></div> + <div class="title"> <img src="../../../assets/images/tiktok-icon.png"><a href="../tiktok/tiktok.html" data-localise="__MSG_tiktok__">TikTok</a></div> + <div class="title"> <img src="../../../assets/images/reddit-icon.png"><a href="../reddit/reddit.html" data-localise="__MSG_reddit__">Reddit</a></div> + <div class="title"> <img src="../../../assets/images/imgur-icon.png"><a href="../imgur/imgur.html" data-localise="__MSG_imgur__">Imgur</a></div> + <div class="title"> <img src="../../../assets/images/pixiv-icon.svg"><a href="../pixiv/pixiv.html" data-localise="__MSG_pixiv__">Pixiv</a></div> + <div class="title"> <img src="../../../assets/images/librespeed-icon.svg"><a href="../speedtest/speedtest.html" data-localise="__MSG_speedtest__">Speedtest</a></div> + <div class="title"> <img src="../../../assets/images/spotify-icon.png"><a href="../spotify/spotify.html" data-localise="__MSG_spotify__">Spotify</a></div> + <div class="title"> <img src="../../../assets/images/wikipedia-icon.svg"><a href="../wikipedia/wikipedia.html" data-localise="__MSG_wikipedia__">Wikipedia</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor"> + <circle cx="500" cy="500" r="500"></circle> + <ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse> + <ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse> + </svg><a href="../medium/medium.html" data-localise="__MSG_medium__">Medium</a> + </div> + <div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a href="../peertube/peertube.html" data-localise="__MSG_peertube__">Peertube</a></div> + <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="../lbry/lbry.html" data-localise="__MSG_lbry__">LBRY/Odysee</a></div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> + <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg><a href="../search/search.html" data-localise="__MSG_search__">Search</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> + </svg><a href="../translate/translate.html" data-localise="__MSG_translate__">Translate</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path> + </svg><a href="../maps/maps.html" data-localise="__MSG_maps__">Maps</a> + </div> + <div class="title"> + <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> + <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> + </svg><a href="../sendTargets/sendTargets.html" data-localise="__MSG_sendFiles__">Send Files</a> + </div> + </section> + <section class="option-block"> + <div class="some-block option-block"> + <h4 data-localise="__MSG_enable__">Enable</h4> + <input id="disable-beatbump" type="checkbox"> + </div> + <div id="beatbump"> + <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://beatbump.wewe" type="url"> + <button class="add add-instance" type="submit"></button> + <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> + </div> + </form> + <div class="checklist custom-checklist"></div> + <label class="button button-inline" id="latency-label" for="latency"> + <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" style="display:none;"> + </div> + </div> + </section> + <script type="module" src="../init.js"></script> + <script type="module" src="./youtubeMusic.js"></script> +</body> \ No newline at end of file diff --git a/src/pages/options/youtubeMusic/youtubeMusic.js b/src/pages/options/youtubeMusic/youtubeMusic.js index 597458d3..98d8b9a0 100644 --- a/src/pages/options/youtubeMusic/youtubeMusic.js +++ b/src/pages/options/youtubeMusic/youtubeMusic.js @@ -9,14 +9,46 @@ disableYoutubeMusicElement.addEventListener("change", youtubeMusicHelper.init().then(() => { disableYoutubeMusicElement.checked = !youtubeMusicHelper.getDisable(); - commonHelper.processDefaultCustomInstances( - 'beatbump', - 'normal', - youtubeMusicHelper, - document, - youtubeMusicHelper.getBeatbumpNormalRedirectsChecks, - youtubeMusicHelper.setBeatbumpNormalRedirectsChecks, - youtubeMusicHelper.getBeatbumpNormalCustomRedirects, - youtubeMusicHelper.setBeatbumpNormalCustomRedirects - ) + browser.storage.local.get("beatbumpLatency").then(r => { + commonHelper.processDefaultCustomInstances( + 'beatbump', + 'normal', + youtubeMusicHelper, + document, + youtubeMusicHelper.getBeatbumpNormalRedirectsChecks, + youtubeMusicHelper.setBeatbumpNormalRedirectsChecks, + youtubeMusicHelper.getBeatbumpNormalCustomRedirects, + youtubeMusicHelper.setBeatbumpNormalCustomRedirects, + r.beatbumpLatency, + ); + }) }); + +let latencyElement = document.getElementById("latency"); +let latencyLabel = document.getElementById("latency-label"); +latencyElement.addEventListener("click", + async () => { + let reloadWindow = () => location.reload(); + latencyElement.addEventListener("click", reloadWindow); + await youtubeMusicHelper.init(); + let redirects = youtubeMusicHelper.getRedirects(); + const oldHtml = latencyLabel.innerHTML; + latencyLabel.innerHTML = '...'; + commonHelper.testLatency(latencyLabel, redirects.beatbump.normal).then(r => { + browser.storage.local.set({ beatbumpLatency: r }); + latencyLabel.innerHTML = oldHtml; + commonHelper.processDefaultCustomInstances( + 'beatbump', + 'normal', + youtubeMusicHelper, + document, + youtubeMusicHelper.getBeatbumpNormalRedirectsChecks, + youtubeMusicHelper.setBeatbumpNormalRedirectsChecks, + youtubeMusicHelper.getBeatbumpNormalCustomRedirects, + youtubeMusicHelper.setBeatbumpNormalCustomRedirects, + r, + ) + latencyElement.removeEventListener("click", reloadWindow) + }); + } +); \ No newline at end of file |