blob: fc8e558317fab2409738bd729f1e081bda209c5a (
plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
var layouts = [
"background",
"hero",
"profile",
"page",
"card"
]
var currentLayout = 0
function switchHomeLayout() {
var old = currentLayout
currentLayout = currentLayout == layouts.length - 1 ? 0 : currentLayout + 1
var oldDiv = document.getElementById(layouts[old])
var currentDiv = document.getElementById(layouts[currentLayout])
const layoutCode = document.querySelectorAll("code[id=layout]");
currentDiv.style.display = "block";
oldDiv.style.display = "none";
layoutCode.forEach(function (el) {
el.innerText = layouts[currentLayout];
});
}
window.addEventListener("DOMContentLoaded", (event) => {
document.querySelectorAll("#switch-layout-button").forEach((button) =>
button.addEventListener("click", function (e) {
e.preventDefault();
switchHomeLayout();
})
);
});
var list_config = [
"CardViewProse",
"CardViewScreenWidth",
"NormalView"
]
var titles = {
"CardViewProse" : "card view with constrained width",
"CardViewScreenWidth" : "card view with full width",
"NormalView" : "standard list view"
}
var currentConfig = 0
function switchList() {
var old = currentConfig
currentConfig = currentConfig == list_config.length - 1 ? 0 : currentConfig + 1
var oldDiv = document.getElementById(list_config[old])
var currentDiv = document.getElementById(list_config[currentConfig])
const configCode = document.querySelectorAll("code[id=config]");
currentDiv.style.display = "block";
oldDiv.style.display = "none";
configCode.forEach(function (el) {
el.innerText = titles[list_config[currentConfig]];
});
}
window.addEventListener("DOMContentLoaded", (event) => {
document.querySelectorAll("#switch-config-button").forEach((button) =>
button.addEventListener("click", function (e) {
e.preventDefault();
switchList();
})
);
});
|