-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblocked.js
More file actions
29 lines (23 loc) · 831 Bytes
/
blocked.js
File metadata and controls
29 lines (23 loc) · 831 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
const { STORAGE_KEY_SETTINGS, normalizeSettings } = globalThis.AnalyticsBlockerConfig;
const titleEl = document.getElementById('title');
const messageEl = document.getElementById('message');
const backBtn = document.getElementById('back');
const openOptionsBtn = document.getElementById('openOptions');
async function loadSettings() {
const data = await chrome.storage.sync.get(STORAGE_KEY_SETTINGS);
return normalizeSettings(data[STORAGE_KEY_SETTINGS]);
}
async function init() {
const settings = await loadSettings();
titleEl.textContent = settings.blockedPage.title;
messageEl.textContent = settings.blockedPage.message;
}
backBtn.addEventListener('click', () => {
history.back();
});
openOptionsBtn.addEventListener('click', () => {
chrome.runtime.openOptionsPage();
});
init().catch(() => {
// no-op
});