about summary refs log tree commit diff stats
path: root/src/pages/options
diff options
context:
space:
mode:
authorBobIsMyManager <bobismymanager@noreply.codeberg.org>2022-08-03 00:05:49 +0200
committerBobIsMyManager <bobismymanager@noreply.codeberg.org>2022-08-03 00:05:49 +0200
commit449cd43aec71c914fda31582fd38b56580e20948 (patch)
tree9e945576147d04da169a3fd59e1b46c041cc2055 /src/pages/options
parentUnify won't save in storage anymore. Fixed Piped Unify (diff)
parentFix simplytranslate and make things prettier (diff)
downloadlibredirect-449cd43aec71c914fda31582fd38b56580e20948.zip
Merge pull request 'Latency threshold and offline instances' (https://codeberg.org/LibRedirect/libredirect/pulls/14) from latency into master
Reviewed-on: https://codeberg.org/LibRedirect/libredirect/pulls/14
Diffstat (limited to 'src/pages/options')
-rw-r--r--src/pages/options/index.html17
-rw-r--r--src/pages/options/index.pug2
-rw-r--r--src/pages/options/widgets/general.js20
-rw-r--r--src/pages/options/widgets/general.pug10
4 files changed, 32 insertions, 17 deletions
diff --git a/src/pages/options/index.html b/src/pages/options/index.html
index a868ad3a..077b3da2 100644
--- a/src/pages/options/index.html
+++ b/src/pages/options/index.html
@@ -21,7 +21,7 @@
           <div class="title"> <img src="../../../assets/images/instagram-icon.png"><a href="#instagram" data-localise="__MSG_instagram__">Instagram</a></div>
           <div class="title"> <img src="../../../assets/images/tiktok-icon.png"><a href="#tiktok" data-localise="__MSG_tiktok__">TikTok</a></div>
           <div class="title"> <img src="../../../assets/images/reddit-icon.png"><a href="#reddit" data-localise="__MSG_reddit__">Reddit</a></div>
-          <div class="title"> <img src="../../../assets/images/imgur-icon.png"><a href="#imgur" data-localise="__MSG_imgur__">Imgur</a></div>
+          <div class="title"> <img src="../../../assets/images/imgur.png"><a href="#imgur" data-localise="__MSG_imgur__">Imgur</a></div>
           <div class="title"> <img src="../../../assets/images/wikipedia-icon.svg"><a href="#wikipedia" 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">
@@ -34,7 +34,7 @@
           <div class="title"><img src="../../../assets/images/imdb.svg"><a href="#imdb" data-localise="__MSG_imdb__">IMDb</a></div>
           <div class="title"><img src="../../../assets/images/reuters.svg"><a href="#reuters" data-localise="__MSG_reuters__">Reuters</a></div>
           <div class="title"> <img src="../../../assets/images/peertube-icon.svg"><a href="#peertube" data-localise="__MSG_peertube__">PeerTube</a></div>
-          <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="#lbry" data-localise="__MSG_lbry__">LBRY/Odysee</a></div>
+          <div class="title"> <img src="../../../assets/images/lbry-icon.png"><a href="#lbry" data-localise="__MSG_lbry__">LBRY</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>
@@ -94,6 +94,13 @@
           <h4 data-localise="__MSG_autoRedirect__"></h4>
           <input id="auto-redirect" type="checkbox">
         </div>
+        <form>
+          <div class="some-block option-block">
+            <h4 data-localise="__MSG_latencyThreshold">Latency Threshold</h4>
+            <output id="latency-output" for="latencyInput" name="latencyOutput"></output>
+            <input id="latency-input" type="range" min="50" max="5000" value="1000" name="latencyInput" step="50">
+          </div>
+        </form>
         <div class="some-block option-block">
           <h4 data-localise="__MSG_exceptions__"></h4>
         </div>
@@ -173,7 +180,7 @@
             <input id="tiktok" type="checkbox">
           </div>
           <div> 
-            <div> <img src="../../../assets/images/imgur-icon.png">
+            <div> <img src="../../../assets/images/imgur.png">
               <x data-localise="__MSG_imgur__">Imgur</x>
             </div>
             <input id="imgur" type="checkbox">
@@ -254,7 +261,7 @@
           </div>
           <div> 
             <div> <img src="../../../assets/images/lbry-icon.png">
-              <x data-localise="__MSG_lbry__">LBRY/Odysee</x>
+              <x data-localise="__MSG_lbry__">LBRY</x>
             </div>
             <input id="lbry" type="checkbox">
           </div>
@@ -3179,4 +3186,4 @@
     </div>
   </body>
   <script type="module" src="./index.js"></script>
-</html>
\ No newline at end of file
+</html>
diff --git a/src/pages/options/index.pug b/src/pages/options/index.pug
index 553f918f..3711fdac 100644
--- a/src/pages/options/index.pug
+++ b/src/pages/options/index.pug
@@ -33,4 +33,4 @@ html#elementToShowWithJavaScript(lang="en")
             include ./widgets/sendTargets.pug
             include ./widgets/about.pug
 
-    script(type="module" src="./index.js")
\ No newline at end of file
+    script(type="module" src="./index.js")
diff --git a/src/pages/options/widgets/general.js b/src/pages/options/widgets/general.js
index c64eb25d..d6824251 100644
--- a/src/pages/options/widgets/general.js
+++ b/src/pages/options/widgets/general.js
@@ -81,6 +81,7 @@ resetSettings.addEventListener("click", async () => {
 			.then(response => response.text())
 			.then(async data => {
 				browser.storage.local.set({ cloudflareBlackList: JSON.parse(data).cloudflare }, () => {
+					browser.storage.local.set({ offlineBlackList: JSON.parse(data).offline }, () => {
 					browser.storage.local.set({ authenticateBlackList: JSON.parse(data).authenticate }, async () => {
 						await generalHelper.initDefaults()
 						await youtubeHelper.initDefaults()
@@ -103,6 +104,7 @@ resetSettings.addEventListener("click", async () => {
 						await lbryHelper.initDefaults()
 						location.reload()
 					})
+					})
 				})
 			})
 	})
@@ -132,14 +134,14 @@ protocolFallbackCheckbox.addEventListener("change", event => {
 	browser.storage.local.set({ protocolFallback: event.target.checked })
 })
 
-// let latencyOutput = document.getElementById("latency-output")
-// let latencyInput = document.getElementById("latency-input")
-// latencyInput.addEventListener("change", event => {
-// 	browser.storage.local.set({ latencyThreshold: event.target.value })
-// })
-// latencyInput.addEventListener("input", event => {
-// 	latencyOutput.value = event.target.value
-// })
+let latencyOutput = document.getElementById("latency-output")
+let latencyInput = document.getElementById("latency-input")
+latencyInput.addEventListener("change", event => {
+	browser.storage.local.set({ latencyThreshold: event.target.value })
+})
+latencyInput.addEventListener("input", event => {
+	latencyOutput.value = event.target.value
+})
 
 let nameCustomInstanceInput = document.getElementById("exceptions-custom-instance")
 let instanceTypeElement = document.getElementById("exceptions-custom-instance-type")
@@ -174,7 +176,7 @@ browser.storage.local.get(
 		themeElement.value = r.theme
 		protocolElement.value = r.protocol
 		protocolFallbackCheckbox.checked = r.protocolFallback
-		// latencyOutput.value = r.latencyThreshold
+		latencyOutput.value = r.latencyThreshold
 		// firstPartyIsolate.checked = r.firstPartyIsolate;
 
 		let protocolFallbackElement = document.getElementById("protocol-fallback")
diff --git a/src/pages/options/widgets/general.pug b/src/pages/options/widgets/general.pug
index e04e9e2a..e523d5bb 100644
--- a/src/pages/options/widgets/general.pug
+++ b/src/pages/options/widgets/general.pug
@@ -31,6 +31,12 @@ section#general_page.option-block
         h4(data-localise="__MSG_autoRedirect__")
         input#auto-redirect(type="checkbox")
 
+    form
+        .some-block.option-block
+            h4(data-localise="__MSG_latencyThreshold") Latency Threshold
+            output#latency-output(for="latencyInput" name="latencyOutput")
+            input#latency-input(type="range" min="50" max="5000" value="1000" name="latencyInput" step="50")
+
     .some-block.option-block
         h4(data-localise="__MSG_exceptions__")
 
@@ -117,7 +123,7 @@ section#general_page.option-block
 
         div 
             div 
-                img(src="../../../assets/images/imgur-icon.png")
+                img(src="../../../assets/images/imgur.png")
                 x(data-localise="__MSG_imgur__") Imgur
             input#imgur(type="checkbox")
 
@@ -190,7 +196,7 @@ section#general_page.option-block
         div 
             div 
                 img(src="../../../assets/images/lbry-icon.png")
-                x(data-localise="__MSG_lbry__") LBRY/Odysee
+                x(data-localise="__MSG_lbry__") LBRY
             input#lbry(type="checkbox")
 
         div