65 lines
2.7 KiB
HTML
65 lines
2.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Fencing Gallery🤺</title>
|
|
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles.css') }}">
|
|
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='gallery_styles.css') }}">
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.min.js"></script>
|
|
</head>
|
|
<body>
|
|
<div class="button-container">
|
|
<a href="{{ url_for('gallery') }}" class="button">🤺🤺🤺</a>
|
|
<a href="{{ url_for('dump') }}" class="button">🎃🎃🎃</a>
|
|
</div>
|
|
<h1>Fencing Gallery🤺</h1>
|
|
<div class="gallery-container" id="gallery-container">
|
|
{% for batch in batches %}
|
|
{% set batch_number = batch[0].split('_')[0] if batch and '_' in batch[0] else 'unstructured' %}
|
|
<div class="batch-container batch-{{ batch_number }}">
|
|
{% for image in batch %}
|
|
{% if '_' in image and '.' in image.split('_')[1] %}
|
|
{% set index = image.split('_')[1].split('.')[0] %}
|
|
{% else %}
|
|
{% set index = 'unstructured' %}
|
|
{% endif %}
|
|
<a href="#" data-original="{{ url_for('uploaded_file', filename=image) }}" target="_blank">
|
|
<img class="responsive-img index-{{ index }}" src="{{ url_for('cached_file', filename=image) }}" alt="{{ image }}">
|
|
</a>
|
|
{% endfor %}
|
|
</div>
|
|
{% if not loop.last %}
|
|
<hr>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
<script>
|
|
var socket = io.connect(location.protocol + '//' + document.domain + ':' + location.port);
|
|
|
|
socket.on('update_gallery', function() {
|
|
location.reload();
|
|
});
|
|
|
|
document.addEventListener("DOMContentLoaded", function() {
|
|
var images = document.querySelectorAll('.responsive-img');
|
|
images.forEach(function(img) {
|
|
img.addEventListener('load', function() {
|
|
img.classList.add('loaded');
|
|
});
|
|
if (img.complete) {
|
|
img.classList.add('loaded');
|
|
}
|
|
});
|
|
|
|
var links = document.querySelectorAll('.gallery-container a');
|
|
links.forEach(function(link) {
|
|
link.addEventListener('click', function(event) {
|
|
event.preventDefault();
|
|
var originalUrl = link.getAttribute('data-original');
|
|
window.open(originalUrl, '_blank');
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |