blob: ab79c578879f021928a12bbe2de71e98f42d7086 (
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
|
const popups = require("./popups");
const settings = require("./settings");
let drag_timer;
document.addEventListener("dragover", (e) => {
e.preventDefault();
e.stopPropagation();
dragUI.classList.add("shown");
clearTimeout(drag_timer);
drag_timer = setTimeout(() => {
dragUI.classList.remove("shown");
}, 5000)
})
document.addEventListener("mouseover", () => {
clearTimeout(drag_timer);
dragUI.classList.remove("shown");
})
document.addEventListener("drop", (e) => {
e.preventDefault();
e.stopPropagation();
dragUI.classList.remove("shown");
mods.install_from_path(e.dataTransfer.files[0].path);
})
document.body.addEventListener("keyup", (e) => {
if (e.key == "Escape") {
popups.hide_last();
}
})
document.body.addEventListener("click", (e) => {
if (e.target.tagName.toLowerCase() === "a"
&& e.target.protocol != "file:") {
e.preventDefault();
shell.openExternal(e.target.href);
}
})
|