From c7e5fb83fcb022057789c2751d335231c2cf7c13 Mon Sep 17 00:00:00 2001 From: Balakrishnan Balasubramanian Date: Sat, 10 Aug 2024 11:28:52 -0400 Subject: [PATCH] Move to next slot on choosing a photo --- web/choose.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/web/choose.js b/web/choose.js index 6987f78..6074f55 100644 --- a/web/choose.js +++ b/web/choose.js @@ -55,6 +55,17 @@ function main() { selectedPhotos[0].click() } +function moveToNextSlot() { + /** @type HTMLCollectionOf */ + const selectedPhotos = selectedPhotosDiv.getElementsByTagName("img") + for (const img of selectedPhotos) { + if(img.src.endsWith("stock.svg")) { + img.click() + return + } + } +} + function loadAlbums() { (async () => { try { @@ -115,6 +126,7 @@ function loadPhotos() { for(const photo of photoImgs) { photo.onclick = () => { selectedPhotoImg.src = photo.src + moveToNextSlot() } } } catch(e) {