gitlabhq/app/assets/javascripts/projects.js

43 lines
886 B
JavaScript
Raw Normal View History

var ProjectsList = {
limit:0,
offset:0,
2011-10-08 23:36:38 +02:00
init:
function(limit) {
this.limit=limit;
this.offset=limit;
this.initLoadMore();
},
2011-10-15 18:56:53 +02:00
getOld:
function() {
$('.loading').show();
$.ajax({
type: "GET",
url: location.href,
data: "limit=" + this.limit + "&offset=" + this.offset,
complete: function(){ $('.loading').hide()},
dataType: "script"});
},
2011-10-08 23:36:38 +02:00
append:
function(count, html) {
$(".tile").append(html);
if(count > 0) {
this.offset += count;
this.initLoadMore();
}
},
2011-11-07 19:38:54 +01:00
initLoadMore:
function() {
$(window).bind('scroll', function(){
if($(window).scrollTop() == $(document).height() - $(window).height()){
$(window).unbind('scroll');
$('.loading').show();
ProjectsList.getOld();
}
});
}
2011-11-07 19:38:54 +01:00
}