diff options
author | 0neGal <mail@0negal.com> | 2024-06-09 18:15:45 +0200 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2024-06-09 18:23:29 +0200 |
commit | 760031c079ce830755ba4fea029e149f4140e00b (patch) | |
tree | 8dbb9f8d5bb4e19cdaffb40e8a091b457a597769 /src/app/js/dom_events.js | |
parent | 1c1e8fb730b9974cd9b8060499773b0f37ff28d2 (diff) | |
parent | 04b0e9fcea6c60257d7bc68994103eacb340a82b (diff) | |
download | Viper-760031c079ce830755ba4fea029e149f4140e00b.tar.gz Viper-760031c079ce830755ba4fea029e149f4140e00b.zip |
Merge branch 'main' into linux-launch-v2linux-launch-v2
Diffstat (limited to 'src/app/js/dom_events.js')
-rw-r--r-- | src/app/js/dom_events.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/app/js/dom_events.js b/src/app/js/dom_events.js new file mode 100644 index 0000000..c16a838 --- /dev/null +++ b/src/app/js/dom_events.js @@ -0,0 +1,42 @@ +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") { + browser.toggle(false); + settings.popup.toggle(false); + } +}) + +document.body.addEventListener("click", (e) => { + if (e.target.tagName.toLowerCase() === "a" + && e.target.protocol != "file:") { + + e.preventDefault(); + shell.openExternal(e.target.href); + } +}) |