about summary refs log tree commit diff stats
path: root/src/pages/options
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages/options')
-rw-r--r--src/pages/options/index.pug11
-rw-r--r--src/pages/options/widgets/about.ejs37
-rw-r--r--src/pages/options/widgets/about.pug24
-rw-r--r--src/pages/options/widgets/general.ejs70
-rw-r--r--src/pages/options/widgets/general.pug57
-rw-r--r--src/pages/options/widgets/services.ejs76
-rw-r--r--src/pages/options/widgets/services.js18
-rw-r--r--src/pages/options/widgets/services.pug52
8 files changed, 144 insertions, 201 deletions
diff --git a/src/pages/options/index.pug b/src/pages/options/index.pug
new file mode 100644
index 00000000..12b2d2f3
--- /dev/null
+++ b/src/pages/options/index.pug
@@ -0,0 +1,11 @@
+doctype html
+html(id="elementToShowWithJavaScript" lang="en")
+    include /src/pages/widgets/head
+    body(class="option" dir="auto")
+        include /src/pages/widgets/links
+        div#pages
+            include /src/pages/options/widgets/general
+            include /src/pages/options/widgets/services
+            include /src/pages/options/widgets/about
+    script(type="module" src="./index.js")
+    
\ No newline at end of file
diff --git a/src/pages/options/widgets/about.ejs b/src/pages/options/widgets/about.ejs
deleted file mode 100644
index c6f8a58f..00000000
--- a/src/pages/options/widgets/about.ejs
+++ /dev/null
@@ -1,37 +0,0 @@
-<section class="option-block" id="about_page">
-
-  <div class="some-block option-block">
-    <h1 data-localise="__MSG_about__">About</h1>
-  </div>
-
-  <hr>
-
-  <div class="about">
-
-    <div class="some-block option-block">
-      <h4>Donate: ♥️</h4>
-      <h4><a href='https://libredirect.codeberg.page/donate'>https://libredirect.github.io/donate</a> </h4>
-    </div>
-
-    <div class="some-block option-block">
-      <h4>FAQ:</h4>
-      <h4><a href='https://libredirect.codeberg.page/faq'>https://libredirect.github.io/faq</a></h4>
-    </div>
-
-    <div class="some-block option-block">
-      <h4>Docs:</h4>
-      <h4><a href='https://libredirect.codeberg.page/docs'>https://libredirect.github.io/docs</a></h4>
-    </div>
-
-    <div class="some-block option-block">
-      <h4>Source Code:</h4>
-      <h4><a href='https://libredirect.codeberg.page/source_code'>https://libredirect.github.io/source_code</a></h4>
-    </div>
-
-    <div class="some-block option-block">
-      <h4>Forked from:</h4>
-      <h4><a href="https://github.com/SimonBrazell/privacy-redirect">Privacy Redirect</a></h4>
-    </div>
-
-  </div>
-</section>
\ No newline at end of file
diff --git a/src/pages/options/widgets/about.pug b/src/pages/options/widgets/about.pug
new file mode 100644
index 00000000..93830a1d
--- /dev/null
+++ b/src/pages/options/widgets/about.pug
@@ -0,0 +1,24 @@
+section(class="option-block" id="about_page")
+    div(class="some-block option-block")
+        h1(data-localise="__MSG_about__") About
+    hr
+    div(class="about")
+        div(class="some-block option-block")
+            h4 Donate: ♥️
+            h4 
+                a(href="https://libredirect.github.io/donate") https://libredirect.github.io/donate
+
+        div(class="some-block option-block")
+            h4 FAQ:
+            h4 
+                a(href="https://libredirect.github.io/faq") https://libredirect.github.io/faq
+
+        div(class="some-block option-block")
+            h4 Docs:
+            h4 
+                a(href="https://libredirect.github.io/docs") https://libredirect.github.io/docs
+
+        div(class="some-block option-block")
+            h4 Source Code:
+            h4 
+                a(href="https://libredirect.github.io/source_code") https://libredirect.github.io/source_code
\ No newline at end of file
diff --git a/src/pages/options/widgets/general.ejs b/src/pages/options/widgets/general.ejs
deleted file mode 100644
index 6bb15bca..00000000
--- a/src/pages/options/widgets/general.ejs
+++ /dev/null
@@ -1,70 +0,0 @@
-<section class="option-block" id="general_page">
-  <div class="some-block option-block">
-    <h1 data-localise="__MSG_general__">General</h1>
-  </div>
-  <hr />
-
-  <div class="some-block option-block">
-    <h4 data-localise="__MSG_theme__">Theme</h4>
-    <select id="theme">
-      <option value="detect" data-localise="__MSG_detect__">Detect</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_exclude_from_redirecting_">Excluded from redirecting</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" />&nbsp;
-        <select id="exceptions-custom-instance-type">
-          <option value="url">URL</option>
-          <option value="regex">Regex</option>
-        </select>&nbsp;
-      </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>
-
-  <hr>
-
-  <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>&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>
-      </svg>&nbsp;
-      <x data-localise="__MSG_importSettings__">Import Settings</x>
-    </label>
-    <input class="button button-inline" id="import-settings" type="file" style="display: none" />&nbsp; &nbsp;<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>&nbsp; <x data-localise="__MSG_exportSettings__">Export Settings</x></a>&nbsp; &nbsp;<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>
-
-  <script type="module" src="./widgets/general.js"></script>
-</section>
\ No newline at end of file
diff --git a/src/pages/options/widgets/general.pug b/src/pages/options/widgets/general.pug
new file mode 100644
index 00000000..8a3f1859
--- /dev/null
+++ b/src/pages/options/widgets/general.pug
@@ -0,0 +1,57 @@
+section(class="option-block" id="general_page")
+    div(class="some-block option-block")
+        h1(data-localise="__MSG_general__") General
+    hr
+
+    div(class="some-block option-block")
+        h4(data-localise="__MSG_theme__") Theme
+        select#theme
+            option(value="detect" data-localise="__MSG_detect__") Detect
+            option(value="light" data-localise="__MSG_light__") Light
+            option(value="dark" data-localise="__MSG_dark__") Dark
+
+    div(class="some-block option-block")
+        h4(data-localise="__MSG_exclude_from_redirecting_") Excluded from redirecting
+
+    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")
+                |&nbsp;
+                select(id="exceptions-custom-instance-type")
+                    option(value="url") URL
+                    option(value="regex") Regex
+                |&nbsp;
+            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")
+
+    hr
+
+    div(class="checklist" id="exceptions-custom-checklist")
+
+    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")
+            |&nbsp;
+            x(data-localise="__MSG_importSettings__") Import Settings
+        input(class="button button-inline" id="import-settings" type="file" style="display: none")
+        
+        |&nbsp;&nbsp;
+        
+        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")
+            |&nbsp;
+            x(data-localise="__MSG_exportSettings__") Export Settings
+        
+        |&nbsp;&nbsp;
+        
+        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(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")
+            x(localise="__MSG_resetSettings__") Reset Settings
+
+    script(type="module" src="./widgets/general.js")
\ No newline at end of file
diff --git a/src/pages/options/widgets/services.ejs b/src/pages/options/widgets/services.ejs
deleted file mode 100644
index 20b4e8fa..00000000
--- a/src/pages/options/widgets/services.ejs
+++ /dev/null
@@ -1,76 +0,0 @@
-<% for (const service in config.services) { -%>
-<section class="option-block" id="<%= service %>_page">
-  <div class="some-block option-block">
-    <h1 data-localise="__MSG_<%= service %>__"><%= config.services[service].name %></h1>
-  </div>
-  <hr />
-  <div class="some-block option-block">
-    <h4 data-localise="__MSG_enable__">Enable</h4>
-    <input id="<%= service %>-enabled" type="checkbox" />
-  </div>
-  <div class="some-block option-block">
-    <h4 data-localise="__MSG_show_in_popup__">Show in Popup</h4>
-    <input id="<%= service %>" type="checkbox" />
-  </div>
-  <% if (Object.keys(config.services[service].frontends).length> 1) { %>
-  <div class="some-block option-block">
-    <h4 data-localise="__MSG_frontend__">Frontend</h4>
-    <select id="<%= service %>-frontend">
-      <% for (const frontend in config.services[service].frontends) { -%>
-      <option value="<%= frontend %>"><%= config.services[service].frontends[frontend].name %></option>
-      <% } %>
-    </select>
-  </div>
-  <% if (config.services[service].embeddable) { _%>
-  <div class="some-block option-block">
-    <h4 data-localise="__MSG_embed_frontend__">Embed Frontend</h4>
-    <select id="<%= service %>-embedFrontend">
-      <% for (const frontend in config.services[service].frontends) { -%> <% if (config.services[service].frontends[frontend].embeddable) { _%>
-      <option value="<%= frontend %>"><%= config.services[service].frontends[frontend].name %></option>
-      <% } _%> <% } %>
-    </select>
-  </div>
-  <% } _%> <% } _%> <% if (config.services[service].embeddable) { _%>
-  <div class="some-block option-block">
-    <h4 data-localise="__MSG_redirectType__">Redirect Type</h4>
-    <select id="<%= service %>-redirectType">
-      <option value="both" data-localise="__MSG_both__">both</option>
-      <option value="sub_frame" data-localise="__MSG_onlyEmbedded__">Only Embedded</option>
-      <option value="main_frame" data-localise="__MSG_onlyNotEmbedded__">Only Not Embedded</option>
-    </select>
-  </div>
-  <% } _%>
-  <hr />
-  <% for (const frontend in config.services[service].frontends) { -%> <% if (config.services[service].frontends[frontend].instanceList) { _%>
-  <div id="<%= frontend %>">
-    <% for (const network in config.networks) { -%>
-    <div class="<%= network %>">
-      <div class="some-block option-block">
-        <h4><%= network.charAt(0).toUpperCase() + network.slice(1) %></h4>
-      </div>
-      <div class="checklist"></div>
-      <hr />
-
-      <div class="checklist custom-checklist"></div>
-      <% if (network=="clearnet" ) { _%>
-      <% } _%>
-    </div>
-    <% } %>
-    <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://<%= 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"></path>
-          </svg>
-        </button>
-      </div>
-    </form>
-  </div>
-  <% } _%> <% } %>
-</section>
-<% } %>
-<script type="module" src="./widgets/services.js"></script>
\ No newline at end of file
diff --git a/src/pages/options/widgets/services.js b/src/pages/options/widgets/services.js
index e9577260..06c560f8 100644
--- a/src/pages/options/widgets/services.js
+++ b/src/pages/options/widgets/services.js
@@ -40,24 +40,6 @@ function changeFrontendsSettings(service) {
 			}
 		}
 	}
-
-	if (config.services[service].embeddable) {
-		if (typeof divs[service].frontend !== "undefined") {
-			if (!config.services[service].frontends[divs[service].frontend.value].embeddable) {
-				divs[service].embedFrontend.disabled = false
-				for (const frontend in config.services[service].frontends) {
-					if (config.services[service].frontends[frontend].embeddable) {
-						const frontendDiv = document.getElementById(frontend)
-						if (frontend == divs[service].embedFrontend.value) {
-							frontendDiv.style.display = "block"
-						} else {
-							frontendDiv.style.display = "none"
-						}
-					}
-				}
-			} else if (Object.keys(config.services[service].frontends).length > 1) divs[service].embedFrontend.disabled = true
-		}
-	}
 }
 
 for (const service in config.services) {
diff --git a/src/pages/options/widgets/services.pug b/src/pages/options/widgets/services.pug
new file mode 100644
index 00000000..3a32f517
--- /dev/null
+++ b/src/pages/options/widgets/services.pug
@@ -0,0 +1,52 @@
+each val, service in services
+    section(class="option-block" id=service+"_page")
+        div(class="some-block option-block")
+            h1(data-localise="__MSG_"+service+"__")=services[service].name
+
+        hr
+
+        div(class="some-block option-block")
+            h4(data-localise="__MSG_enable__") Enable
+            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(data-localise="__MSG_frontend__") Frontend
+                select(id=service+"-frontend")
+                    each val, frontend in services[service].frontends
+                        option(value=frontend)=services[service].frontends[frontend].name
+
+        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)
+                    each val, network in networks
+                        div(class=network)
+                            div(class="some-block option-block")
+                                h4=network.charAt(0).toUpperCase() + network.slice(1)
+                            div(class="checklist")
+                            hr
+                    div(class="some-block option-block")
+                        h4(data-localise="__MSG_customInstances__") Custom 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")
+
+        script(type="module" src="./widgets/services.js")