about summary refs log tree commit diff stats
path: root/src/pages/options
diff options
context:
space:
mode:
authorManeraKai <manerakai@protonmail.com>2022-06-04 16:16:17 +0300
committerManeraKai <manerakai@protonmail.com>2022-06-04 16:16:17 +0300
commit4d0c773cf63a5a7040a8762a72741adb56723280 (patch)
tree15799e634d6cac6d51b91201d31395125f2bbd29 /src/pages/options
parentMerge branch 'master' of https://github.com/libredirect/libredirect (diff)
downloadlibredirect-4d0c773cf63a5a7040a8762a72741adb56723280.zip
Unify Settings on Import #285
Diffstat (limited to 'src/pages/options')
-rw-r--r--src/pages/options/index.html3
-rw-r--r--src/pages/options/widgets/general.js23
-rw-r--r--src/pages/options/widgets/general.pug2
3 files changed, 26 insertions, 2 deletions
diff --git a/src/pages/options/index.html b/src/pages/options/index.html
index f4837998..afd0b0dc 100644
--- a/src/pages/options/index.html
+++ b/src/pages/options/index.html
@@ -95,7 +95,8 @@
             <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>&nbsp; &nbsp;
+            <x data-localise="__MSG_updateInstances__">Update Instances</x></a>&nbsp; &nbsp;</div>
+        <div class="buttons buttons-inline">  
           <label class="button button-inline" id="import_settings_text" 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>
diff --git a/src/pages/options/widgets/general.js b/src/pages/options/widgets/general.js
index 6ca1e190..e635ac29 100644
--- a/src/pages/options/widgets/general.js
+++ b/src/pages/options/widgets/general.js
@@ -54,6 +54,7 @@ let importSettingsElement = document.getElementById("import-settings");
 let importSettingsElementText = document.getElementById('import_settings_text');
 importSettingsElement.addEventListener("change",
   () => {
+    importSettingsElementText.innerHTML = '...';
     let file = importSettingsElement.files[0];
     const reader = new FileReader();
     reader.readAsText(file);
@@ -67,6 +68,24 @@ importSettingsElement.addEventListener("change",
       ) {
         await browser.storage.local.clear();
         await browser.storage.local.set({ ...data })
+        await youtubeHelper.pasteInvidiousCookies();
+        await youtubeHelper.pastePipedLocalStorage();
+        await youtubeHelper.pastePipedMaterialLocalStorage();
+
+        await translateHelper.pasteSimplyTranslateCookies();
+        await translateHelper.pasteLingvaLocalStorage();
+
+        await twitterHelper.pasteNitterCookies();
+
+        await wikipediaHelper.pasteWikilessCookies();
+
+        await searchHelper.pasteSearxCookies();
+        await searchHelper.pasteSearxngCookies();
+
+        await redditHelper.pasteLibredditCookies();
+        await redditHelper.pasteTedditCookies();
+
+        await tiktokHelper.pasteProxiTokCookies();
         location.reload();
       } else
         importError()
@@ -80,8 +99,10 @@ function importError() {
   setTimeout(() => importSettingsElementText.innerHTML = oldHTML, 1000);
 }
 
-document.getElementById("reset-settings").addEventListener("click",
+const resetSettings = document.getElementById("reset-settings");
+resetSettings.addEventListener("click",
   async () => {
+    resetSettings.innerHTML = '...'
     await browser.storage.local.clear();
     fetch('/instances/blocklist.json').then(response => response.text()).then(async data => {
       await browser.storage.local.set({ cloudflareList: JSON.parse(data) })
diff --git a/src/pages/options/widgets/general.pug b/src/pages/options/widgets/general.pug
index c1fcc459..b7714b7b 100644
--- a/src/pages/options/widgets/general.pug
+++ b/src/pages/options/widgets/general.pug
@@ -39,6 +39,8 @@ section#general_page.option-block
             x(data-localise="__MSG_updateInstances__") Update Instances
 
         |&nbsp; &nbsp;
+    
+    .buttons.buttons-inline   
 
         label#import_settings_text.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")