-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
23 lines (21 loc) · 802 Bytes
/
options.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function countToHMSText(count) {
const second = count % 60;
const minute = Math.floor(count / 60);
const hour = Math.floor(minute / 60);
return `${hour}:${minute}:${second}`;
}
document.addEventListener("DOMContentLoaded", () => {
const recordList = document.querySelector("#records");
chrome.storage.sync.get(["countRecord"], function (result) {
console.log(result.countRecord);
for (const record of result.countRecord) {
const recordElement = document.createElement("li");
const textSpanElement = document.createElement("span");
textSpanElement.textContent = `${
Object.keys(record)[0]
} ${countToHMSText(Object.values(record)[0])}`;
recordElement.appendChild(textSpanElement);
recordList.appendChild(recordElement);
}
});
});