diff --git a/s/index.tpl.html b/s/index.tpl.html index cdd64c5..4f4ac55 100644 --- a/s/index.tpl.html +++ b/s/index.tpl.html @@ -12,6 +12,7 @@ {% endfor %} + diff --git a/s/scroller.js b/s/scroller.js new file mode 100644 index 0000000..e548f8a --- /dev/null +++ b/s/scroller.js @@ -0,0 +1,18 @@ + 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 += "
  • \n"; + $('#posts').append(html); + $('#posts').data('last', msg.last); + load = false; + }); + } + }); + });