This commit is contained in:
sirx 2016-11-06 02:20:18 +01:00
parent 1429ea56d5
commit ebfebc6e09
2 changed files with 19 additions and 0 deletions

View File

@ -12,6 +12,7 @@
{% endfor %}
</ul>
<script src="./s/jquery-3.1.0.min.js"></script>
<script src="./s/scroller.js"></script>
<script src="./s/shit.js"></script>
<script src="./s/theme.js"></script>
</body>

18
s/scroller.js Normal file
View File

@ -0,0 +1,18 @@
var load = false;
$(()=>{
$(window).scroll(()=>{
if($(window).scrollTop() + $(window).height() >= $(document).height() - 130 && !load) {
load = true;
$.getJSON('./api/p/'+$('#posts').data('last'), (msg) => {
var html = "";
for(var i = 0; i < msg.items.length; i++)
if(msg.items[i].id)
html += "<li class=\"post\"><a href=\"./"+msg.items[i].id+"\" title=\""+msg.items[i].mime+"\"><img
class=\"thumb\" src=\"./t/"+msg.items[i].id+".png\" /></a></li>\n";
$('#posts').append(html);
$('#posts').data('last', msg.last);
load = false;
});
}
});
});