about summary refs log tree commit diff stats
path: root/src/pages
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/background/background.js2
-rw-r--r--src/pages/options/index.js21
-rw-r--r--src/pages/options/widgets/general.js22
-rw-r--r--src/pages/options/widgets/general.pug18
-rw-r--r--src/pages/stylesheets/styles.css2
5 files changed, 55 insertions, 10 deletions
diff --git a/src/pages/background/background.js b/src/pages/background/background.js
index 542ef03b..4b8f1ca2 100644
--- a/src/pages/background/background.js
+++ b/src/pages/background/background.js
@@ -41,7 +41,7 @@ browser.webRequest.onBeforeRequest.addListener(
 			return null
 		}
 		if (tabIdRedirects[details.tabId] == false) return null
-		let newUrl = servicesHelper.redirect(url, details.type, initiator, tabIdRedirects[details.tabId], details.tabId)
+		let newUrl = servicesHelper.redirect(url, details.type, initiator, tabIdRedirects[details.tabId], details.incognito)
 
 		if (details.frameAncestors && details.frameAncestors.length > 0 && servicesHelper.isException(new URL(details.frameAncestors[0].url))) newUrl = null
 
diff --git a/src/pages/options/index.js b/src/pages/options/index.js
index dd1a6ff8..fcc51298 100644
--- a/src/pages/options/index.js
+++ b/src/pages/options/index.js
@@ -17,6 +17,9 @@ for (const a of document.getElementById("links").getElementsByTagName("a")) {
 config = await utils.getConfig()
 options = await utils.getOptions()
 
+/**
+ * @param {string} service
+ */
 async function changeFrontendsSettings(service) {
 	options = await utils.getOptions()
 	const opacityDiv = document.getElementById(`${service}-opacity`)
@@ -95,6 +98,9 @@ async function changeFrontendsSettings(service) {
 	frontend_name_element.href = config.services[service].frontends[divs[service].frontend.value].url
 }
 
+/**
+ * @param {string} path
+ */
 async function loadPage(path) {
 	options = await utils.getOptions()
 	for (const section of document.getElementById("pages").getElementsByTagName("section")) section.style.display = "none"
@@ -251,6 +257,13 @@ async function processCustomInstances(frontend, document) {
 	})
 }
 
+/**
+ * @param {string} frontend
+ * @param {*} networks
+ * @param {*} document
+ * @param {*} redirects
+ * @param {*} blacklist
+ */
 async function createList(frontend, networks, document, redirects, blacklist) {
 	const pingCache = await utils.getPingCache()
 	const options = await utils.getOptions()
@@ -331,6 +344,9 @@ const r = window.location.href.match(/#(.*)/)
 if (r) loadPage(r[1])
 else loadPage("general")
 
+/**
+ * @param {string} frontend
+ */
 async function ping(frontend) {
 	const instanceElements = [
 		...document.getElementById(frontend).getElementsByClassName("custom-checklist")[0].getElementsByTagName('x'),
@@ -357,6 +373,9 @@ async function ping(frontend) {
 	}
 }
 
+/**
+ * @param {number} time
+ */
 function processTime(time) {
 	let text
 	let color
@@ -377,4 +396,4 @@ function processTime(time) {
 	return {
 		color, text
 	}
-}
\ No newline at end of file
+}
diff --git a/src/pages/options/widgets/general.js b/src/pages/options/widgets/general.js
index ed61440b..6f2852a9 100644
--- a/src/pages/options/widgets/general.js
+++ b/src/pages/options/widgets/general.js
@@ -64,7 +64,6 @@ importSettingsElement.addEventListener("change", () => {
 	}
 })
 
-
 const exportSettingsSync = document.getElementById("export-settings-sync")
 const importSettingsSync = document.getElementById("import-settings-sync")
 const importSettingsSyncText = document.getElementById("import_settings_sync_text")
@@ -99,12 +98,29 @@ resetSettings.addEventListener("click", async () => {
 	location.reload()
 })
 
-let fetchInstancesElement = document.getElementById('fetch-instances')
+const fetchInstancesElement = document.getElementById('fetch-instances')
 fetchInstancesElement.addEventListener('change', event => {
 	setOption('fetchInstances', 'select', event)
 	location.reload()
 })
 
+const redirectOnlyInIncognitoElement = document.getElementById('redirectOnlyInIncognito')
+redirectOnlyInIncognitoElement.addEventListener('change', event => {
+	setOption('redirectOnlyInIncognito', 'checkbox', event)
+})
+
+const bookmarksMenuElement = document.getElementById('bookmarksMenu')
+bookmarksMenuElement.addEventListener('change', async event => {
+	if (event.target.checked)
+		bookmarksMenuElement.checked = await browser.permissions.request({
+			permissions: ["bookmarks"]
+		})
+	else
+		bookmarksMenuElement.checked = !await browser.permissions.remove({
+			permissions: ["bookmarks"]
+		})
+})
+
 let themeElement = document.getElementById("theme")
 themeElement.addEventListener("change", event => {
 	setOption("theme", "select", event)
@@ -132,6 +148,8 @@ for (const service in config.services) {
 let options = await utils.getOptions()
 themeElement.value = options.theme
 fetchInstancesElement.value = options.fetchInstances
+redirectOnlyInIncognitoElement.checked = options.redirectOnlyInIncognito
+bookmarksMenuElement.checked = await browser.permissions.contains({ permissions: ["bookmarks"] })
 for (const service in config.services) document.getElementById(service).checked = options.popupServices.includes(service)
 
 instanceTypeElement.addEventListener("change", event => {
diff --git a/src/pages/options/widgets/general.pug b/src/pages/options/widgets/general.pug
index 2e7c07da..70316473 100644
--- a/src/pages/options/widgets/general.pug
+++ b/src/pages/options/widgets/general.pug
@@ -18,6 +18,14 @@ section(class="block-option" id="general_page")
             option(value="disable" data-localise="__MSG_disable__") Disable
 
     div(class="block block-option")
+        label(for='redirectOnlyInIncognito' data-localise="__MSG_redirectOnlyInIncognito__") Redirect Only in Incognito
+        input(id='redirectOnlyInIncognito' type="checkbox")
+
+    div(class="block block-option")
+        label(for='bookmarksMenu' data-localise="__MSG_bookmarksMenu__") Bookmarks menu
+        input(id='bookmarksMenu' type="checkbox")
+
+    div(class="block block-option")
         label(data-localise="__MSG_excludeFromRedirecting__") Excluded from redirecting
 
     form(id="custom-exceptions-instance-form")
@@ -44,15 +52,15 @@ section(class="block-option" id="general_page")
             | 
             x(data-localise="__MSG_importSettings__") Import Settings
         input(id="import-settings" type="file" style="display: none")
-        
+
         |  
-        
+
         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")
             | 
             x(data-localise="__MSG_exportSettings__") Export Settings
-        
+
         |  
 
         button(class="button button-inline" id="export-settings-sync")
@@ -60,7 +68,7 @@ section(class="block-option" id="general_page")
                 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")
             | 
             x() Export Settings to Sync
-        
+
         |  
 
         button(class="button button-inline" id="import-settings-sync")
@@ -70,7 +78,7 @@ section(class="block-option" id="general_page")
             x(id="import_settings_sync_text") Import Settings from Sync
 
         |  
-        
+
         button(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")
diff --git a/src/pages/stylesheets/styles.css b/src/pages/stylesheets/styles.css
index 225023ec..2519a05f 100644
--- a/src/pages/stylesheets/styles.css
+++ b/src/pages/stylesheets/styles.css
@@ -131,7 +131,7 @@ section.links {
 	flex-wrap: wrap;
 	flex-direction: column;
 	width: 350px;
-	max-height: 890px;
+	max-height: 930px;
 }
 
 section.links div {