-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdev.js
More file actions
47 lines (37 loc) · 1.62 KB
/
dev.js
File metadata and controls
47 lines (37 loc) · 1.62 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
document.addEventListener('DOMContentLoaded', () => {
const dataContainer = document.getElementById('data-container');
const storageKeys = ['timeData', 'gotchaStats', 'isBlocking', 'blockedWebsites', 'currentSessionTime'];
function createSection(key, data) {
const section = document.createElement('div');
section.className = 'data-section';
const header = document.createElement('div');
header.className = 'section-header';
const title = document.createElement('h2');
title.textContent = key;
const arrow = document.createElement('span');
arrow.className = 'arrow';
arrow.textContent = '▶';
header.appendChild(title);
header.appendChild(arrow);
const content = document.createElement('div');
content.className = 'section-content';
const pre = document.createElement('pre');
pre.textContent = JSON.stringify(data, null, 2);
content.appendChild(pre);
section.appendChild(header);
section.appendChild(content);
header.addEventListener('click', () => {
header.classList.toggle('active');
const isVisible = content.style.display === 'block';
content.style.display = isVisible ? 'none' : 'block';
});
return section;
}
chrome.storage.local.get(storageKeys, (result) => {
storageKeys.forEach((key) => {
const data = result[key] !== undefined ? result[key] : 'Not set';
const sectionElement = createSection(key, data);
dataContainer.appendChild(sectionElement);
});
});
});