forked from gapop/pinboard-webextension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreferences.js
28 lines (24 loc) · 1.3 KB
/
preferences.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
document.addEventListener('DOMContentLoaded', function () {
browser.storage.sync.get({'toolbar_button': 'show_menu'}).then(function (option) {
document.getElementById('button-select').value = option.toolbar_button;
});
document.getElementById('button-select').addEventListener('change', function () {
browser.storage.sync.set({'toolbar_button': this.value}).then(function () {
browser.runtime.sendMessage({'message': 'toolbar_button_changed'});
});
});
browser.storage.sync.get({'show_notifications': true}).then(function (option) {
document.getElementById('notifications-toggle').checked = option.show_notifications;
});
document.getElementById('notifications-toggle').addEventListener('change', function () {
browser.storage.sync.set({'show_notifications': this.checked});
});
browser.storage.sync.get({'context_menu_items': true}).then(function (option) {
document.getElementById('context-menu-toggle').checked = option.context_menu_items;
});
document.getElementById('context-menu-toggle').addEventListener('change', function () {
browser.storage.sync.set({'context_menu_items': this.checked}).then(function () {
browser.runtime.sendMessage({'message': 'context_menu_changed'});
});
});
});