-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.js
35 lines (30 loc) · 1.09 KB
/
popup.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
29
30
31
32
33
34
const default_options = {
background: false,
};
document.addEventListener('DOMContentLoaded', async () => {
const commands = await browser.commands.getAll();
for (const command of commands) {
const shortcut = document.getElementById(`${command.name}-shortcut`);
if (!shortcut) {
continue;
}
shortcut.textContent = command.shortcut || 'Not Set Yet!';
}
const options = await browser.storage.sync.get(default_options);
const background = document.getElementById('background');
background.checked = options.background;
background.addEventListener('change', () =>
browser.storage.sync.set({
background: background.checked,
}),
);
});
document.addEventListener('DOMContentLoaded', function () {
document.getElementById('configure-button').addEventListener('click', function () {
browser.runtime.openOptionsPage();
});
document.getElementById('changelog-link').addEventListener('click', function(e) {
e.preventDefault();
browser.runtime.sendMessage({action: "openChangelog"});
});
});