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

Function addImageToFeed

web/js/imageFeed.js:426–452  ·  view source on GitHub ↗
(href)

Source from the content-addressed store, hash-verified

424 }
425
426 function addImageToFeed(href) {
427 const method = feedDirection.value === "newest first" ? "prepend" : "append";
428
429 if (maxImages.value > 0 && imageList.children.length >= maxImages.value) {
430 imageList.children[method === "prepend" ? imageList.children.length - 1 : 0].remove();
431 }
432
433 imageList[method](
434 $el("div", [
435 $el(
436 "a",
437 {
438 target: "_blank",
439 href,
440 onclick: (e) => {
441 const imgs = [...imageList.querySelectorAll("img")].map((img) => img.getAttribute("src"));
442 lightbox.show(imgs, imgs.indexOf(href));
443 e.preventDefault();
444 },
445 },
446 [$el("img", { src: href })]
447 ),
448 ])
449 );
450 // If lightbox is open, update it with new image
451 lightbox.updateWithNewImage(href, feedDirection.value);
452 }
453
454 imageFeed.append(
455 $el("div.pysssss-image-feed-menu", [

Callers 1

setupFunction · 0.85

Calls 2

updateWithNewImageMethod · 0.80
showMethod · 0.45

Tested by

no test coverage detected