-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelp.js
More file actions
29 lines (26 loc) · 948 Bytes
/
help.js
File metadata and controls
29 lines (26 loc) · 948 Bytes
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
(function() {
const browserApi = typeof browser !== 'undefined' ? browser : chrome;
async function applyDarkMode() {
try {
const result = await browserApi.storage.local.get(['appearanceSettings']);
const settings = result.appearanceSettings || { darkMode: false };
if (settings.darkMode) {
document.body.classList.add('dark-mode');
} else {
document.body.classList.remove('dark-mode');
}
} catch (error) {
console.error('Error applying dark mode:', error);
}
}
// Initial load
applyDarkMode();
// Listen for changes
if (browserApi.storage && browserApi.storage.onChanged) {
browserApi.storage.onChanged.addListener((changes, area) => {
if (area === 'local' && changes.appearanceSettings) {
applyDarkMode();
}
});
}
})();