-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsheets.js
More file actions
46 lines (45 loc) · 1.62 KB
/
Copy pathsheets.js
File metadata and controls
46 lines (45 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
firstSheet.addEventListener("click", function(){
for(let i = 0; i<sheetList.children.length;i++){
sheetList.children[i].classList.remove("active-sheet");
}
firstSheet.classList.add("class", "active-sheet")
db = sheetsDB[0];
setUI();
})
createSheetIcon.addEventListener("click", function(){
let childrenNum = sheetList.children.length;
let newSheet = document.createElement("div");
newSheet.setAttribute("class", "sheet");
newSheet.setAttribute("sheetIdx", childrenNum);
newSheet.textContent = `Sheet ${childrenNum + 1}`;
sheetList.appendChild(newSheet);
initDB();
//active switch
newSheet.addEventListener("click",function(){
for(let i = 0; i<childrenNum;i++){
sheetList.children[i].classList.remove("active-sheet");
}
newSheet.classList.add("class", "active-sheet")
let index = newSheet.getAttribute("sheetIdx");
db = sheetsDB[index];
setUI();
})
})
function sheetOpenHandler(){
let childrenNum = sheetList.children.length;
let newSheet = document.createElement("div");
newSheet.setAttribute("class", "sheet");
newSheet.setAttribute("sheetIdx", childrenNum);
newSheet.textContent = `Sheet ${childrenNum + 1}`;
sheetList.appendChild(newSheet);
//active switch
newSheet.addEventListener("click",function(){
for(let i = 0; i<childrenNum;i++){
sheetList.children[i].classList.remove("active-sheet");
}
newSheet.classList.add("class", "active-sheet")
let index = newSheet.getAttribute("sheetIdx");
db = sheetsDB[index];
setUI();
})
}