muh
This commit is contained in:
parent
852af35e46
commit
da08de7b79
18
s/test.js
18
s/test.js
@ -1,18 +1,22 @@
|
||||
$(document).ready(function() {
|
||||
$(window).scroll(function() {
|
||||
if($(window).scrollTop() == $(document).height() - $(window).height()) {
|
||||
$.ajax({
|
||||
var scrollListener = function () {
|
||||
$(window).one("scroll", function () {
|
||||
if($(window).scrollTop() + 256 >= $(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";
|
||||
html += "<a href=\"./"+msg.items[i].id+"\" title=\""+msg.items[i].mime+"\"><img class=\"thumb\" src=\"//f0ck.me/t/"+msg.items[i].id+".png\" /></a>\n";
|
||||
$('#posts').append(html);
|
||||
$('#posts').data('last', msg.last);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
setTimeout(scrollListener, 50);
|
||||
});
|
||||
};
|
||||
$(document).ready(function () {
|
||||
scrollListener();
|
||||
});
|
@ -9,7 +9,7 @@
|
||||
<div class="body">
|
||||
<div id="posts" data-last="{{ last }}">
|
||||
{% for item in items %}
|
||||
<a href="./{{ item.id }}" title="{{ item.mime }}"><img class="thumb" src="./t/{{ item.id }}.png" /></a>
|
||||
<a href="./{{ item.id }}" title="{{ item.mime }}"><img class="thumb" src="//f0ck.me/t/{{ item.id }}.png" /></a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
|
Loading…
Reference in New Issue
Block a user