Show images from urls

This commit is contained in:
2024-08-08 12:05:40 -04:00
parent e21cc83a5f
commit 1bf6bf9033
3 changed files with 34 additions and 1 deletions

View File

@@ -8,6 +8,9 @@ let loadAlbumsBtn
/** @type {HTMLButtonElement} */
let loadPhotosBtn
/** @type {HTMLButtonElement} */
let makeCollageBtn
/** @type {HTMLSelectElement} */
let albumSelect
@@ -30,12 +33,14 @@ function main() {
albumSelect = document.getElementById("album_selector")
loadAlbumsBtn = document.getElementById("load_albums_button")
loadPhotosBtn = document.getElementById("load_photos_button")
makeCollageBtn = document.getElementById("make_collage_button")
noticeDialog = document.getElementById("notice_dialog")
albumPhotosDiv = document.getElementById("album_photos")
selectedPhotosDiv = document.getElementById("selected_photos")
noticeP = document.getElementById("notice_p")
loadAlbumsBtn.onclick = () => loadAlbums()
loadPhotosBtn.onclick = () => loadPhotos()
makeCollageBtn.onclick = () => gotoCollage()
/**
* @type HTMLImageElement[]
@@ -125,5 +130,24 @@ function loadPhotos() {
})();
}
function gotoCollage() {
/**
* @type HTMLImageElement[]
*/
const selectedPhotos = selectedPhotosDiv.getElementsByTagName("img")
/**
* @type String[]
*/
let photoUrls = [];
for (const img of selectedPhotos) {
if (!img.src.endsWith("stock.svg")) {
photoUrls.push(img.src)
}
}
const encodedURLS = encodeURIComponent(JSON.stringify(photoUrls))
window.location.href = `index.html?urls=${encodedURLS}`
}
main()