40 lines
1.5 KiB
HTML
40 lines
1.5 KiB
HTML
<!DOCTYPE blah>
|
|
<html>
|
|
<head>
|
|
<title>f0ck me!</title>
|
|
<link rel="icon" type="image/gif" href="./s/favicon.gif" />
|
|
<link rel="stylesheet" type="text/css" href="./s/style.css">
|
|
</head>
|
|
<body>
|
|
<div class="navbar"><a href="/">f0ck.me</a> | <a href="/how">how to</a> | <a href="/contact">Contact</a></div>
|
|
<ul id="posts" data-last="{{ last }}">
|
|
{% for item in items %}<li class="post"><a href="//f0ck.me/{{ item.id }}" title="{{ item.mime }}"><img class="thumb" src="//f0ck.me/t/{{ item.id }}.png" /></a></li>
|
|
{% endfor %}
|
|
</ul>
|
|
<script src="./s/jquery-3.1.0.min.js"></script>
|
|
<script>
|
|
var scrollListener = () => {
|
|
$(window).one("scroll", () => {
|
|
if($(window).scrollTop() + 256 >= $(document).height() - $(window).height()) {
|
|
$.ajax({
|
|
url: './api/p/'+$('#posts').data('last'),
|
|
dataType: 'json',
|
|
success: (msg) => {
|
|
var html = "";
|
|
for(var i = 0; i < msg.items.length; i++)
|
|
if(msg.items[i].id)
|
|
html += "<li class=\"post\"><a href=\"//f0ck.me/"+msg.items[i].id+"\" title=\""+msg.items[i].mime+"\"><img class=\"thumb\" src=\"//f0ck.me/t/"+msg.items[i].id+".png\" /></a></li>\n";
|
|
$('#posts').append(html);
|
|
$('#posts').data('last', msg.last);
|
|
}
|
|
});
|
|
}
|
|
setTimeout(scrollListener, 200);
|
|
});
|
|
};
|
|
$(document).ready(() => {
|
|
scrollListener();
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |