mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-08-09 23:57:42 +02:00
Masonry gallery, add timestamp
This commit is contained in:
@ -3085,13 +3085,25 @@ let recentResolutionsValues = []
|
||||
})()
|
||||
|
||||
/* Gallery JS */
|
||||
function galleryImage(item) {
|
||||
let div = document.createElement("div")
|
||||
let img = document.createElement("img")
|
||||
|
||||
img.src = "/image/" + item.path
|
||||
img.dataset["request"] = JSON.stringify(item)
|
||||
div.appendChild(img)
|
||||
return div
|
||||
}
|
||||
|
||||
function refreshGallery() {
|
||||
let container = document.getElementById("imagecontainer")
|
||||
container.remove()
|
||||
container.innerHTML=""
|
||||
fetch('/all_images')
|
||||
.then(response => response.text())
|
||||
.then(text => new DOMParser().parseFromString(text, 'text/html'))
|
||||
.then(html_like => html_like.getElementsByTagName('div')[0])
|
||||
.then(div => document.getElementById("tab-content-gallery").appendChild(div))
|
||||
}
|
||||
.then(response => response.json())
|
||||
.then(json => {
|
||||
console.log(json)
|
||||
json.forEach( item => {
|
||||
container.appendChild(galleryImage(item))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user