-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
31 lines (28 loc) · 1.36 KB
/
script.js
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
const collapse = (ev) => {
ev.currentTarget.parentElement.querySelectorAll('svg')[0].style.display = 'none';
ev.currentTarget.parentElement.querySelectorAll('svg')[1].style.display = 'inline';
ev.currentTarget.parentElement.parentElement.querySelectorAll('div')[1].style.display = 'none';
}
const expand = (ev) => {
ev.currentTarget.parentElement.querySelectorAll('svg')[0].style.display = 'inline';
ev.currentTarget.parentElement.querySelectorAll('svg')[1].style.display = 'none';
ev.currentTarget.parentElement.parentElement.querySelectorAll('div')[1].style.display = 'grid';
}
const changeTab = (ev) => {
const layout = ev.currentTarget.parentElement.parentElement;
const allLabels = layout.querySelectorAll('.layout-tab-label');
const allContents = layout.querySelectorAll('.layout-tab-content');
const prevIndex = [...allLabels].findIndex(it => it === layout.querySelector(".layout-tab-label.selected"));
const newIndex = [...allLabels].findIndex(it => it === ev.currentTarget);
allLabels[prevIndex].classList.remove("selected");
allContents[prevIndex].style.display = "none";
allLabels[newIndex].classList.add("selected");
allContents[newIndex].style.display = "block";
}
const showAside = (ev) => {
[...document.querySelectorAll(".aside-wrapper")].forEach(a => {
a.style.zIndex = 1;
})
const aside = ev.currentTarget;
aside.style.zIndex = 2;
}