Database requests

This commit is contained in:
Michał Gdula 2022-12-19 21:15:56 +00:00
parent f41312248c
commit 594431b420
8 changed files with 84 additions and 42 deletions

View file

@ -2,6 +2,7 @@
{% block content %}
<header>
<img src="{{ url_for('static', filename='images/leaves.jpg') }}" alt="leaves"/>
<span></span>
</header>
<div class="app">
<h1>{{error}}</h1>

View file

@ -12,10 +12,10 @@
let imageList = [];
let imageIndex = 0;
function loadMore(startIndex, amount = 10) {
function loadMore(startIndex, amount = 20) {
for (let i = startIndex; i < startIndex + amount; i++) {
if (i < imageList.length) {
loadImg(i, imageList[i]);
loadImg(imageList[i][0], imageList[i][1]);
}
}
}
@ -41,13 +41,13 @@
success: function(response) {
imageList = response;
loadMore(0, 20);
imageIndex += 20;
loadMore(0, 30);
imageIndex += 30;
}
});
$(window).scroll(function() {
if ($(window).height() + $(window).scrollTop() >= $(document).height() - 200) {
if ($(window).height() + $(window).scrollTop() >= $(document).height() - 500) {
loadMore(imageIndex);
imageIndex += 10;
}

View file

@ -15,19 +15,19 @@
<body>
<nav id="navRoot">
<div>
<a href="{{ url_for('home') }}"><i class="ph-house-line-fill"></i><span>Home</span></a>
<a href=""><i class="ph-package-fill"></i><span>Groups</span></a>
<a href=""><i class="ph-upload-fill"></i><span>Upload</span></a>
<a href="{{ url_for('home') }}"><i class="ph-house-line"></i><span>Home</span></a>
<a href=""><i class="ph-package"></i><span>Groups</span></a>
<a href=""><i class="ph-upload"></i><span>Upload</span></a>
</div>
<div>
<a href=""><i class="ph-user-circle-fill"></i><span>Profile</span></a>
<a href=""><i class="ph-gear-fill"></i><span>Settings</span></a>
<a href=""><i class="ph-user-circle"></i><span>Profile</span></a>
<a href=""><i class="ph-gear"></i><span>Settings</span></a>
</div>
</nav>
<main>
{% block content %}
{% endblock %}
<i class="ph-arrow-circle-up-fill" id="topButton"></i>
<i class="ph-arrow-circle-up" id="topButton"></i>
</main>
<script>