Add convenience scripts for pictures

This commit is contained in:
Emilia Allison 2023-11-22 00:10:44 -05:00
parent 3dbac61e65
commit 1e8c7c74e5
Signed by: emilia
GPG Key ID: 7A3F8997BFE894E0
1 changed files with 11 additions and 0 deletions

View File

@ -29,6 +29,17 @@
<footer class="lock-bottom">
<p><a href="../">Return</a></p>
</footer>
<script>
// Convenience to open images when clicked :)
// Also deletes images if they don't load
// Everything still works without JS ofc
const imgs = document.getElementsByTagName('img');
for (let img of imgs) {
img.onclick = () => window.open(img.src);
img.onerror = () => {img.remove();
console.error(`Failed to load ${img.src}`);}
}
</script>
</body>
</html>