f0ckv1/s/test.js

18 lines
638 B
JavaScript
Raw Normal View History

2016-08-30 10:50:06 +00:00
$(document).ready(function() {
$(window).scroll(function() {
if($(window).scrollTop() == $(document).height() - $(window).height()) {
$.ajax({
url: './api/p/'+$('#posts').data('last'),
dataType: 'json',
success: function(msg) {
var html = "";
for(var i = 0; i < msg.items.length; i++)
if(msg.items[i].id)
html += "<a href=\"./"+msg.items[i].id+"\" title=\""+msg.items[i].mime+"\"><img class=\"thumb\" src=\"./t/"+msg.items[i].id+".png\" /></a>\n";
$('#posts').append(html);
$('#posts').data('last', msg.last);
}
});
}
});
});