Artberry-web/templates/content.html
2025-02-17 00:22:28 +02:00

151 lines
6.3 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{% block title %}🫐artberry🫐{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="{{ url_for('static', filename='css/styles.css') }}">
<link rel="icon" href="{{ url_for('static', filename='artberry.ico') }}" type="image/x-icon">
{% if extra_css %}
<link rel="stylesheet" href="{{ url_for('static', filename=extra_css) }}">
{% endif %}
<link href="https://fonts.googleapis.com/css2?family=Comfortaa:wght@300&display=swap" rel="stylesheet">
</head>
<body>
{% include 'navbar.html' %}
<header class="header">
<form method="GET"
action="{{ search_url if search_url else url_for(request.endpoint, pub_type=pub_type, username=username) }}"
class="search-form">
<!-- </form>
<div id="autocomplete-suggestions" class="autocomplete-suggestions"></div>
</form>
подсказки будут добавлены позже -->
</header>
<section class="content" id="content">
{% block content %}
{% if content_type in ['art', 'video', 'comic'] %}
<div class="{{ content_type }}-details">
<h2>{{ content.title }}</h2>
{% if content_type == 'art' %}
<img src="{{ url_for('static', filename='uploads/' + content.filename) }}" alt="{{ content.title }}"
class="art-image" loading="lazy" width="800" height="600">
{% elif content_type == 'video' %}
<video controls class="video-player">
<source src="{{ url_for('static', filename='uploads/videos/' + content.filename) }}" type="video/mp4">
Your browser does not support the video tag.
</video>
{% elif content_type == 'comic' %}
<div class="comic-pages">
{% for page in content.pages %}
<img src="{{ url_for('static', filename='uploads/comics/' + content.name + '/' + page) }}"
alt="Comic Page {{ loop.index }}" class="comic-page">
{% endfor %}
</div>
{% endif %}
</div>
{% else %}
{% endif %}
{% endblock %}
</section>
<!-- {% if pagination %}
<div class="pagination">
{% if pagination.has_prev %}
<a href="{{ url_for(request.endpoint, page=pagination.prev_num, search=request.args.get('search')) }}"
class="button">«</a>
{% endif %}
{% for page in pagination.iter_pages() %}
{% if page %}
<a href="{{ url_for(request.endpoint, page=page, search=request.args.get('search')) }}" class="button"
style="{% if page == pagination.page %}color: yellow;{% endif %}">
{{ page }}
</a>
{% endif %}
{% endfor %}
{% if pagination.has_next %}
<a href="{{ url_for(request.endpoint, page=pagination.next_num, search=request.args.get('search')) }}"
class="button">»</a>
{% endif %}
</div>
{% endif %} -->
<div class="modal-overlay" id="ageVerificationModal">
<div class="modal-content">
<p>By clicking "Yes", you agree that you are of legal age according to your state/city/province/country.</p>
<div class="modal-buttons">
<button class="modal-button" id="yesButton">Yes</button>
<button class="modal-button cancel" id="noButton">No</button>
</div>
</div>
</div>
<!-- <script>
window.onload = function () {
var modal = document.getElementById('ageVerificationModal');
var body = document.body;
var content = document.getElementById('content');
if (document.cookie.indexOf('ageVerified=true') !== -1) {
return;
}
modal.style.display = 'flex';
content.classList.add('blur');
document.getElementById('yesButton').addEventListener('click', function () {
modal.style.display = 'none';
content.classList.remove('blur');
document.cookie = "ageVerified=true; path=/; max-age=31536000";
});
document.getElementById('noButton').addEventListener('click', function () {
window.location.href = 'https://www.google.com/search?q=cats';
});
};
document.getElementById('search-input').addEventListener('input', function () {
var query = this.value;
if (query.length < 2) {
document.getElementById('autocomplete-suggestions').innerHTML = '';
return;
}
fetch(`/autocomplete?search=${encodeURIComponent(query)}`)
.then(response => response.json())
.then(data => {
var suggestionsContainer = document.getElementById('autocomplete-suggestions');
suggestionsContainer.innerHTML = '';
if (data.length > 0) {
data.forEach(function (suggestion) {
var suggestionElement = document.createElement('div');
suggestionElement.classList.add('suggestion-item');
suggestionElement.textContent = suggestion;
suggestionElement.addEventListener('click', function () {
var searchInput = document.getElementById('search-input');
var currentValue = searchInput.value;
var tags = currentValue.split(',').map(tag => tag.trim());
tags[tags.length - 1] = suggestion;
searchInput.value = tags.join(', ');
suggestionsContainer.innerHTML = '';
});
suggestionsContainer.appendChild(suggestionElement);
});
}
})
.catch(error => console.error('Error fetching autocomplete data:', error));
});
</script> -->
</body>
</html>