forked from Calculamatrise/svg-drawpad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.js
35 lines (27 loc) · 1.3 KB
/
bootstrap.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
import Canvas from "./utils/Canvas.js";
window.canvas = new Canvas(document.querySelector("#view"));
container.addEventListener("contextmenu", function(event) {
event.preventDefault();
});
document.querySelector("#patch-notes").addEventListener("click", function(event) {
if (this.iframe) {
this.iframe.remove();
this.iframe = null;
return;
}
this.iframe = document.createElement("iframe");
this.iframe.id = "patch-notes-iframe";
this.iframe.src = location.origin + "/svg/drawpad/updates/patch-1.2.5/";
document.querySelector("#container").appendChild(this.iframe);
});
if (JSON.parse(localStorage.getItem("dark")) ?? window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.documentElement.style.setProperty("--background", "#1B1B1B");
document.documentElement.style.setProperty("--hard-background", "#111111");
document.documentElement.style.setProperty("--soft-background", "#333333");
document.documentElement.style.setProperty("--text", "#FBFBFB");
} else {
document.documentElement.style.setProperty("--background", "#EBEBEB");
document.documentElement.style.setProperty("--hard-background", "#EEEEEE");
document.documentElement.style.setProperty("--soft-background", "#CCCCCC");
document.documentElement.style.setProperty("--text", "#1B1B1B");
}