2022-12-01 18:48:31 +00:00
|
|
|
{% extends 'layout.html' %}
|
2023-01-10 12:39:29 +00:00
|
|
|
|
2023-01-25 15:13:56 +00:00
|
|
|
{% block nav_home %}navigation-item__selected{% endblock %}
|
|
|
|
{% block wrapper_class %}index-wrapper{% endblock %}
|
2023-01-10 12:39:29 +00:00
|
|
|
|
2022-12-01 18:48:31 +00:00
|
|
|
{% block content %}
|
2023-01-25 15:13:56 +00:00
|
|
|
<div class="gallery">
|
|
|
|
{% for image in images %}
|
2023-01-26 14:43:08 +00:00
|
|
|
<a id="image-{{ image['id'] }}" class="gallery__item" href="/image/{{ image['id'] }}">
|
|
|
|
<span class="gallery__item-info">
|
2023-01-25 15:13:56 +00:00
|
|
|
<p>{{ image['id'] }}</p>
|
|
|
|
<h2>{{ image['created_at'] }}</h2>
|
2023-01-26 14:43:08 +00:00
|
|
|
</span>
|
2023-01-25 15:13:56 +00:00
|
|
|
<img
|
|
|
|
class="gallery__item-image"
|
|
|
|
src="/api/uploads/{{ image['file_name'] }}/400"
|
|
|
|
onload="imgFade(this)"
|
|
|
|
style="opacity:0;"
|
|
|
|
loading="lazy"
|
|
|
|
/>
|
|
|
|
</a>
|
|
|
|
{% endfor %}
|
2022-12-01 18:48:31 +00:00
|
|
|
</div>
|
2023-01-25 15:13:56 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block script %}
|
2022-12-01 18:48:31 +00:00
|
|
|
<script>
|
2023-01-26 14:43:08 +00:00
|
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
|
|
const src = urlParams.get('src');
|
|
|
|
|
|
|
|
if (src) {
|
|
|
|
var imgOffset = document.getElementById('image-' + src).offsetTop;
|
|
|
|
var imgHeight = document.getElementById('image-' + src).offsetHeight;
|
|
|
|
var windowHeight = window.innerHeight;
|
|
|
|
|
|
|
|
document.querySelector('html').style.scrollBehavior = 'auto';
|
|
|
|
window.scrollTo(0, imgOffset + (imgHeight / 2) - (windowHeight / 2));
|
|
|
|
document.querySelector('html').style.scrollBehavior = 'smooth';
|
2022-12-14 19:55:40 +00:00
|
|
|
}
|
2022-12-01 18:48:31 +00:00
|
|
|
</script>
|
|
|
|
{% endblock %}
|