Skip to content

Commit

Permalink
Added toggle for bookmarks menu in settings #861
Browse files Browse the repository at this point in the history
  • Loading branch information
ManeraKai committed Dec 8, 2023
1 parent 5a105da commit 0babf97
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/pages/options/widgets/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 => {
Expand Down
4 changes: 4 additions & 0 deletions src/pages/options/widgets/general.pug
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0babf97

Please sign in to comment.