-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
41 lines (31 loc) · 1.4 KB
/
main.ts
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
import "./init-html";
import {getPopupEnh, makeFocusable} from "../index";
const {makeMovableEx, makeResizableEx} = getPopupEnh("popup-enhance-demo");
const popup1 = document.querySelector<HTMLElement>("#popup-1")!;
const popup1h = popup1.querySelector<HTMLElement>(".popup-header")!;
const {reset: resetPos1} = makeMovableEx(popup1, "popup-1", { handle: popup1h });
const {reset: resetSiz1} = makeResizableEx(popup1, "popup-1", { minW: 128, minH: 128 });
const popup2 = document.querySelector<HTMLElement>("#popup-2")!;
const popup3 = document.querySelector<HTMLElement>("#popup-3")!;
const popup3h = popup3.querySelector<HTMLElement>(".popup-header")!;
const {reset: resetPos2} = makeMovableEx(popup2, "popup-2", { position: "relative" });
const {reset: resetPos3} = makeMovableEx(popup3, "popup-3", { handle: popup3h, position: "relative" });
makeFocusable(popup1, popup1h);
makeFocusable(popup2);
makeFocusable(popup3, popup3h);
const resetBtn = document.querySelector("#reset-btn")!;
resetBtn.addEventListener("click", () => {
resetPos1();
resetSiz1();
resetPos2();
resetPos3();
});
const reloadBtn = document.querySelector("#reload-btn")!;
reloadBtn.addEventListener("click", () => {
location.reload();
});
document.querySelectorAll<HTMLElement>(".number").forEach(elem => {
elem.addEventListener("click", _ => {
elem.innerText = String(Number(elem.innerText) + 1);
});
});