17 lines
633 B
JavaScript
17 lines
633 B
JavaScript
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;
|
|
});
|
|
}
|
|
});
|
|
}); |