f0ckv1/s/scroller.js

17 lines
633 B
JavaScript
Raw Normal View History

2016-11-17 06:00:12 +00:00
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;
});
}
2016-11-06 01:20:18 +00:00
});
2016-11-17 06:00:12 +00:00
});