mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-06-29 11:36:16 +00:00
Move contrast checking into Python
Change banner size dependent on group content Tidy up inline JS for some files Correct spelling
This commit is contained in:
parent
cdb3836dab
commit
2b795e520f
21 changed files with 194 additions and 164 deletions
|
@ -1,7 +1,24 @@
|
|||
{% extends 'layout.html' %}
|
||||
|
||||
{% block nav_home %}selected{% endblock %}
|
||||
|
||||
{% block head %}
|
||||
<script>
|
||||
if (document.referrer.includes('image')) {
|
||||
try {
|
||||
let referrerId = document.referrer.split('/').pop();
|
||||
|
||||
let imgOffset = document.getElementById('image-' + referrerId).offsetTop;
|
||||
let imgHeight = document.getElementById('image-' + referrerId).offsetHeight;
|
||||
let windowHeight = window.innerHeight;
|
||||
|
||||
document.querySelector('html').style.scrollBehavior = 'auto';
|
||||
window.scrollTo(0, imgOffset + (imgHeight / 2) - (windowHeight / 2));
|
||||
document.querySelector('html').style.scrollBehavior = 'smooth';
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div class="banner small">
|
||||
<div class="banner-content">
|
||||
|
@ -19,7 +36,7 @@
|
|||
{% if images %}
|
||||
<div class="gallery-grid">
|
||||
{% for image in images %}
|
||||
<a id="image-{{ image.id }}" class="gallery-item" href="/image/{{ image.id }}" style="background-color: rgb({{ image.image_colours.0.0 }}, {{ image.image_colours.0.1 }}, {{ image.image_colours.0.2 }})">
|
||||
<a id="image-{{ image.id }}" class="gallery-item" href="{{ url_for('gallery.image', image_id=image.id) }}" style="background-color: rgb({{ image.image_colours.0.0 }}, {{ image.image_colours.0.1 }}, {{ image.image_colours.0.2 }})">
|
||||
<div class="image-filter">
|
||||
<p class="image-subtitle"></p>
|
||||
<p class="image-title"><span class="time">{{ image.created_at }}</span></p>
|
||||
|
@ -31,26 +48,7 @@
|
|||
{% else %}
|
||||
<div class="big-text">
|
||||
<h1>*crickets chirping*</h1>
|
||||
<p>There are no images here yet, upload some!</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block script %}
|
||||
<script>
|
||||
if (document.referrer.includes('image')) {
|
||||
try {
|
||||
let referrerId = document.referrer.split('/').pop();
|
||||
|
||||
let imgOffset = document.getElementById('image-' + referrerId).offsetTop;
|
||||
let imgHeight = document.getElementById('image-' + referrerId).offsetHeight;
|
||||
let windowHeight = window.innerHeight;
|
||||
|
||||
document.querySelector('html').style.scrollBehavior = 'auto';
|
||||
window.scrollTo(0, imgOffset + (imgHeight / 2) - (windowHeight / 2));
|
||||
document.querySelector('html').style.scrollBehavior = 'smooth';
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue