(href)
| 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", [ |
no test coverage detected