2016-11-06 01:20:18 +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)
|
2016-11-06 01:26:30 +00:00
|
|
|
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";
|
2016-11-06 01:20:18 +00:00
|
|
|
$('#posts').append(html);
|
|
|
|
$('#posts').data('last', msg.last);
|
|
|
|
load = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|