Added toggle for bookmarks menu in settings https://github.com/libredirect/browser_extension/issues/861
This commit is contained in:
parent
5a105da61e
commit
0babf9719d
|
@ -109,6 +109,18 @@ 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)
|
||||
|
@ -136,7 +148,8 @@ for (const service in config.services) {
|
|||
let options = await utils.getOptions()
|
||||
themeElement.value = options.theme
|
||||
fetchInstancesElement.value = options.fetchInstances
|
||||
redirectOnlyInIncognitoElement.target.checked = options.redirectOnlyInIncognito
|
||||
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 => {
|
||||
|
|
|
@ -21,6 +21,10 @@ section(class="block-option" id="general_page")
|
|||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue