MCPcopy Index your code
hub / github.com/pythongosssss/ComfyUI-Custom-Scripts / constructor

Method constructor

web/js/common/lightbox.js:19–73  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17
18export class Lightbox {
19 constructor() {
20 this.el = $$el("div", "", {
21 parent: document.body,
22 onclick: (e) => {
23 e.stopImmediatePropagation();
24 this.close();
25 },
26 style: {
27 display: "none",
28 opacity: 0,
29 },
30 });
31 this.closeBtn = $$el("div", "close", {
32 parent: this.el,
33 });
34 this.prev = $$el("div", "prev", {
35 parent: this.el,
36 onclick: (e) => {
37 this.update(-1);
38 e.stopImmediatePropagation();
39 },
40 });
41 this.main = $$el("div", "main", {
42 parent: this.el,
43 });
44 this.next = $$el("div", "next", {
45 parent: this.el,
46 onclick: (e) => {
47 this.update(1);
48 e.stopImmediatePropagation();
49 },
50 });
51 this.link = $$el("a", "link", {
52 parent: this.main,
53 target: "_blank",
54 });
55 this.spinner = createSpinner();
56 this.link.appendChild(this.spinner);
57 this.img = $$el("img", "img", {
58 style: {
59 opacity: 0,
60 },
61 parent: this.link,
62 onclick: (e) => {
63 e.stopImmediatePropagation();
64 },
65 onwheel: (e) => {
66 if (!(e instanceof WheelEvent) || e.ctrlKey) {
67 return;
68 }
69 const direction = Math.sign(e.deltaY);
70 this.update(direction);
71 },
72 });
73 }
74
75 close() {
76 ani(

Callers

nothing calls this directly

Calls 4

closeMethod · 0.95
updateMethod · 0.95
createSpinnerFunction · 0.90
$$elFunction · 0.85

Tested by

no test coverage detected