about summary refs log tree commit diff stats
path: root/pages/options
diff options
context:
space:
mode:
authorSimonBrazell <simon@brazell.com.au>2020-05-08 22:40:07 +1000
committerSimonBrazell <simon@brazell.com.au>2020-05-08 22:40:07 +1000
commit8f82745733ed063a9a14d3176abb59160ded0bc9 (patch)
treed1743a74d10aa665a978fbcf171ef15122179310 /pages/options
parentFixes #45 - some usersnames caught in instagramReservedPaths (diff)
downloadlibredirect-8f82745733ed063a9a14d3176abb59160ded0bc9.zip
Closes #36 - added option to persist Invidious prefs
Diffstat (limited to 'pages/options')
-rw-r--r--pages/options/options.html18
-rw-r--r--pages/options/options.js16
2 files changed, 33 insertions, 1 deletions
diff --git a/pages/options/options.html b/pages/options/options.html
index 321babe8..35ef7a43 100644
--- a/pages/options/options.html
+++ b/pages/options/options.html
@@ -138,6 +138,24 @@
     </section>
 
     <section class="options settings_block">
+      <div class="onoffswitch switch" aria-label="Invidious dark mode aways on">
+        <h1>Invidious dark mode always on</h1>
+        <input aria-hidden="true" id="invidious-dark-mode" type="checkbox" checked>&nbsp;
+        <label for="invidious-dark-mode" class="checkbox-label">
+        </label>
+      </div>
+    </section>
+
+    <section class="options settings_block">
+      <div class="onoffswitch switch" aria-label="Persist Invidious preferences">
+        <h1>Persist Invidious preferences (as cookie)</h1>
+        <input aria-hidden="true" id="persist-invidious-prefs" type="checkbox" checked>&nbsp;
+        <label for="persist-invidious-prefs" class="checkbox-label">
+        </label>
+      </div>
+    </section>
+
+    <section class="options settings_block">
       <div class="onoffswitch switch" aria-label="Proactively remove Twitter service worker">
         <h1>Proactively remove Twitter service worker</h1>
         <input aria-hidden="true" id="remove-twitter-sw" type="checkbox" checked>&nbsp;
diff --git a/pages/options/options.js b/pages/options/options.js
index 821d6ed4..8b848e64 100644
--- a/pages/options/options.js
+++ b/pages/options/options.js
@@ -12,6 +12,8 @@ let alwaysProxy = document.getElementById('always-proxy');
 let onlyEmbeddedVideo = document.getElementById('only-embed');
 let videoQuality = document.getElementById('video-quality');
 let removeTwitterSW = document.getElementById('remove-twitter-sw');
+let invidiousDarkMode = document.getElementById('invidious-dark-mode');
+let persistInvidiousPrefs = document.getElementById('persist-invidious-prefs');
 let whitelist;
 
 window.browser = window.browser || window.chrome;
@@ -46,7 +48,9 @@ browser.storage.sync.get(
     'onlyEmbeddedVideo',
     'videoQuality',
     'removeTwitterSW',
-    'whitelist'
+    'whitelist',
+    'invidiousDarkMode',
+    'persistInvidiousPrefs'
   ],
   result => {
     nitterInstance.value = result.nitterInstance || '';
@@ -61,6 +65,8 @@ browser.storage.sync.get(
     onlyEmbeddedVideo.checked = result.onlyEmbeddedVideo;
     videoQuality.value = result.videoQuality || '';
     removeTwitterSW.checked = !result.removeTwitterSW;
+    invidiousDarkMode.checked = result.invidiousDarkMode;
+    persistInvidiousPrefs.checked = result.persistInvidiousPrefs;
     whitelist = result.whitelist || [];
     whitelist.forEach(prependWhitelistItem);
   }
@@ -199,3 +205,11 @@ videoQuality.addEventListener('change', event => {
 removeTwitterSW.addEventListener('change', event => {
   browser.storage.sync.set({ removeTwitterSW: !event.target.checked });
 });
+
+invidiousDarkMode.addEventListener('change', event => {
+  browser.storage.sync.set({ invidiousDarkMode: event.target.checked });
+});
+
+persistInvidiousPrefs.addEventListener('change', event => {
+  browser.storage.sync.set({ persistInvidiousPrefs: event.target.checked });
+});