Mockup Page communication

This commit is contained in:
ManInDark 2023-08-10 00:05:07 +02:00
parent 8014ed2055
commit 39459f14c5
No known key found for this signature in database
GPG Key ID: 72EC12A5B2D62779
2 changed files with 10 additions and 1 deletions

View File

@ -116,7 +116,7 @@ def init():
try:
image: GalleryImage = db.query(GalleryImage).filter(GalleryImage.path == image_path).first()
head = "<head><link rel='stylesheet' href='/media/css/single-gallery.css'></head>"
body = "<body><img src='/image/" + image.path + "'>" + image.htmlForm() + "</body>"
body = "<body><div><button id='button'></button></div><img src='/image/" + image.path + "'>" + image.htmlForm() + "</body>"
return Response(content="<html>" + head + body + "</head>", media_type="text/html")
except Exception as e:
print(e)

View File

@ -3088,6 +3088,15 @@ let recentResolutionsValues = []
function galleryImage(item) {
let div = document.createElement("div")
let img = document.createElement("img")
img.addEventListener("click", (event) => {
let w;
w = window.open("/single_image?image_path=" + item.path, "_blank")
w.addEventListener("DOMContentLoaded", () => {
w.document.getElementById("button").addEventListener("click", () => {
document.title = "hi"
})
})
})
img.src = "/image/" + item.path
img.dataset["request"] = JSON.stringify(item)