-
Notifications
You must be signed in to change notification settings - Fork 0
/
mode.js
71 lines (57 loc) · 1.64 KB
/
mode.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
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
const mappings = {
"flash": "enabled",
"hybrid": "hybrid",
"circle": "circle",
"album": "disabled"
}
const mappingsReversed = {
"enabled": "flash",
"hybrid": "hybrid",
"circle": "circle",
"disabled": "album"
}
const preview = document.getElementById("preview");
const warning = document.getElementById("warning");
const buttons = {
"flash": document.getElementById("flash"),
"hybrid": document.getElementById("hybrid"),
"circle": document.getElementById("circle"),
"album": document.getElementById("album")
};
function setMode(mode) {
localStorage.setItem("kandinsky", mappings[mode]);
preview.src = `screenshots/${mode}.mp4`;
preview.alt = `A preview showing the ${mode} mode`;
Object.values(buttons).forEach(button => button.style.backgroundColor = "rgba(0, 89, 255, 0.25)");
buttons[mode].style.backgroundColor = "rgba(0, 89, 255, 0.5)";
if (mode == "flash" || mode == "hybrid" || mode == "circle") {
warning.style.display = "flex";
}
else {
warning.style.display = "none";
}
}
if (!localStorage.getItem("kandinsky")) {
setMode("album");
}
else {
setMode(mappingsReversed[localStorage.getItem("kandinsky")]);
}
function next() {
if (localStorage.getItem("warn") != "true") {
localStorage.setItem("warn", "true");
localStorage.setItem("stop-effect", "disabled");
location.href = "colour.html";
}
else {
location.href = "settings.html";
}
}
setInterval(() => {
if (window.innerWidth < window.innerHeight) {
document.getElementById("container").classList.remove("absolute-centre");
}
else {
document.getElementById("container").classList.add("absolute-centre");
}
});