about summary refs log tree commit diff stats
path: root/src/pages/options/widgets
diff options
context:
space:
mode:
authorManeraKai <manerakai@protonmail.com>2023-01-21 19:03:21 +0300
committerManeraKai <manerakai@protonmail.com>2023-01-21 19:03:21 +0300
commite460261c676bd3eeaa4784c1826e55443662ad91 (patch)
tree6817505d1b3382eed41c9823ca214f09bfca7a93 /src/pages/options/widgets
parentCleaned code. Fixed settings conversion not working (diff)
downloadlibredirect-e460261c676bd3eeaa4784c1826e55443662ad91.zip
Added plus button next to public instances
Diffstat (limited to 'src/pages/options/widgets')
-rw-r--r--src/pages/options/widgets/general.js9
-rw-r--r--src/pages/options/widgets/services.pug90
2 files changed, 48 insertions, 51 deletions
diff --git a/src/pages/options/widgets/general.js b/src/pages/options/widgets/general.js
index 8e999a42..e89ce173 100644
--- a/src/pages/options/widgets/general.js
+++ b/src/pages/options/widgets/general.js
@@ -2,11 +2,8 @@
 window.browser = window.browser || window.chrome
 
 import utils from "../../../assets/javascripts/utils.js"
-import generalHelper from "../../../assets/javascripts/general.js"
 import servicesHelper from "../../../assets/javascripts/services.js"
 
-
-
 async function setOption(option, type, event) {
 	let options = await utils.getOptions()
 	if (type == "select") {
@@ -70,10 +67,8 @@ function importError() {
 const resetSettings = document.getElementById("reset-settings")
 resetSettings.addEventListener("click", async () => {
 	resetSettings.innerHTML = "..."
-	browser.storage.local.clear(async () => {
-		await servicesHelper.initDefaults()
-		location.reload()
-	})
+	await servicesHelper.initDefaults()
+	location.reload()
 })
 
 let themeElement = document.getElementById("theme")
diff --git a/src/pages/options/widgets/services.pug b/src/pages/options/widgets/services.pug
index c321012a..b5f330cc 100644
--- a/src/pages/options/widgets/services.pug
+++ b/src/pages/options/widgets/services.pug
@@ -8,51 +8,53 @@ each val, service in services
 
         div(class="some-block option-block")
             h4(data-localise="__MSG_enable__") Enable
-            input(id=service+"-enabled" type="checkbox")
+            input(id=`${service}-enabled` type="checkbox")
 
-        div(class="some-block option-block")
-            h4(data-localise="__MSG_show_in_popup__") Show in Popup
-            input(id=service type="checkbox")
-
-        if Object.keys(services[service].frontends).length> 1
-            div(class="some-block option-block")
-                h4
-                    a(class="frontend_name" target="_blank" data-localise="__MSG_frontend__") Frontend
-                select(id=service+"-frontend")
-                    each val, frontend in services[service].frontends
-                        option(value=frontend)=services[service].frontends[frontend].name
-        else 
-            div(class="some-block option-block")
-                h4
-                    a(class="frontend_name" target="_blank" data-localise="__MSG_frontend__") Frontend
+        div(id=service+"-opacity")
 
-        if services[service].embeddable
             div(class="some-block option-block")
-                h4(data-localise="__MSG_redirectType__") Redirect Type
-                select(id=service+"-redirectType")
-                    option(value="both" data-localise="__MSG_both__") both
-                    option(value="sub_frame" data-localise="__MSG_onlyEmbedded__") Only Embedded
-                    option(value="main_frame" data-localise="__MSG_onlyNotEmbedded__") Only Not Embedded
-
-        hr
-
-        each val, frontend in services[service].frontends
-            if services[service].frontends[frontend].instanceList
-                div(id=frontend)
-                    div(class="some-block option-block")
-                        h4(data-localise="__MSG_instances__") Add your favorite instances
-
-                    form(class="custom-instance-form")
+                h4(data-localise="__MSG_show_in_popup__") Show in Popup
+                input(id=service type="checkbox")
+
+            if Object.keys(services[service].frontends).length> 1
+                div(class="some-block option-block")
+                    h4
+                        a(class="frontend_name" target="_blank" data-localise="__MSG_frontend__") Frontend
+                    select(id=service+"-frontend")
+                        each val, frontend in services[service].frontends
+                            option(value=frontend)=services[service].frontends[frontend].name
+            else 
+                div(class="some-block option-block")
+                    h4
+                        a(class="frontend_name" target="_blank" data-localise="__MSG_frontend__") Frontend
+
+            if services[service].embeddable
+                div(class="some-block option-block")
+                    h4(data-localise="__MSG_redirectType__") Redirect Type
+                    select(id=service+"-redirectType")
+                        option(value="both" data-localise="__MSG_both__") both
+                        option(value="sub_frame" data-localise="__MSG_onlyEmbedded__") Only Embedded
+                        option(value="main_frame" data-localise="__MSG_onlyNotEmbedded__") Only Not Embedded
+
+            hr
+
+            each val, frontend in services[service].frontends
+                if services[service].frontends[frontend].instanceList
+                    div(id=frontend)
                         div(class="some-block option-block")
-                            input(class="custom-instance" placeholder=`http://${frontend}.com` type="url" )
-                            button(class="add add-instance" type="submit")
-                                svg(xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor")
-                                    path(d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z")
-
-                    div(class="checklist custom-checklist")  
-
-                    each val, network in networks
-                        div(class=network)
-                            div(class="checklist")
-                                if (network == 'clearnet')
-                                    div(class="some-block option-block") Loading...
\ No newline at end of file
+                            h4(data-localise="__MSG_instances__") Add your favorite instances
+
+                        form(class="custom-instance-form")
+                            div(class="some-block option-block")
+                                input(class="custom-instance" placeholder=`http://${frontend}.com` type="url" )
+                                button(class="add add-instance" type="submit")
+                                    svg(xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor")
+                                        path(d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z")
+
+                        div(class="checklist custom-checklist")  
+
+                        each val, network in networks
+                            div(class=network)
+                                div(class="checklist")
+                                    if (network == 'clearnet')
+                                        div(class="some-block option-block") Loading...
\ No newline at end of file