MCPcopy
hub / github.com/pythongosssss/ComfyUI-Custom-Scripts / update

Method update

web/js/common/lightbox.js:89–116  ·  view source on GitHub ↗
(shift)

Source from the content-addressed store, hash-verified

87 }
88
89 async update(shift) {
90 if (shift < 0 && this.index <= 0) {
91 return;
92 }
93 if (shift > 0 && this.index >= this.images.length - 1) {
94 return;
95 }
96 this.index += shift;
97
98 this.prev.style.visibility = this.index ? "unset" : "hidden";
99 this.next.style.visibility = this.index === this.images.length - 1 ? "hidden" : "unset";
100
101 const img = this.images[this.index];
102 this.el.style.display = "flex";
103 this.el.clientWidth; // Force a reflow
104 this.el.style.opacity = 1;
105 this.img.style.opacity = 0;
106 this.spinner.style.display = "inline-block";
107 try {
108 await loadImage(img);
109 } catch (err) {
110 console.error('failed to load image', img, err);
111 }
112 this.spinner.style.display = "none";
113 this.link.href = img;
114 this.img.src = img;
115 this.img.style.opacity = 1;
116 }
117
118 async updateWithNewImage(img, feedDirection) {
119 // No-op if lightbox is not open

Callers 6

constructorMethod · 0.95
showMethod · 0.95
updateWithNewImageMethod · 0.95
__init__.pyFile · 0.80
downloadFunction · 0.80
lightbox.jsFile · 0.80

Calls 1

loadImageFunction · 0.90

Tested by

no test coverage detected