-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
35 lines (29 loc) · 1.06 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
32
33
34
35
import { getAssets } from "./modules/assets.js";
import { getTerminalCSS } from "./modules/terminal.js";
import { defaultValues } from "./modules/variables.js";
import "./modules/handlers.js";
import "./modules/presets.js";
// Init ------------------------------------------------------------------------
const root = document.querySelector(":root");
const settings = document.querySelectorAll("#settings input");
for (const i of settings) {
if (defaultValues[i.name]) {
i.value = defaultValues[i.name];
}
}
// -----------------------------------------------------------------------------
function setVariable(variable, value) {
root.style.setProperty(variable, value);
}
window.setVariable = setVariable;
// Submit Download
const settingsForm = document.querySelector("#settings");
settingsForm.addEventListener("submit", async function (e) {
e.preventDefault();
const formData = new FormData(e.target);
await getTerminalCSS(formData);
const assetsCheckbox = document.querySelector("input#assets");
if (assetsCheckbox.checked) {
getAssets();
}
});