2012-02-08 00:00:49 +01:00
|
|
|
var Pager = {
|
|
|
|
limit:0,
|
|
|
|
offset:0,
|
2012-02-12 22:52:27 +01:00
|
|
|
disable:false,
|
2012-02-08 00:00:49 +01:00
|
|
|
|
|
|
|
init:
|
2012-02-12 22:52:27 +01:00
|
|
|
function(limit) {
|
2012-02-08 00:00:49 +01:00
|
|
|
this.limit=limit;
|
|
|
|
this.offset=limit;
|
|
|
|
this.initLoadMore();
|
|
|
|
$('.loading').show();
|
|
|
|
},
|
|
|
|
|
|
|
|
getOld:
|
|
|
|
function() {
|
|
|
|
$('.loading').show();
|
|
|
|
$.ajax({
|
|
|
|
type: "GET",
|
|
|
|
url: location.href,
|
|
|
|
data: "limit=" + this.limit + "&offset=" + this.offset,
|
|
|
|
complete: function(){ $('.loading').hide()},
|
|
|
|
dataType: "script"});
|
|
|
|
},
|
|
|
|
|
|
|
|
append:
|
|
|
|
function(count, html) {
|
|
|
|
$(".content_list").append(html);
|
|
|
|
if(count > 0) {
|
|
|
|
this.offset += count;
|
2012-02-12 22:52:27 +01:00
|
|
|
} else {
|
|
|
|
this.disable = true;
|
2012-02-08 00:00:49 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
initLoadMore:
|
|
|
|
function() {
|
2012-02-12 22:52:27 +01:00
|
|
|
$(document).endlessScroll({
|
|
|
|
bottomPixels: 400,
|
|
|
|
fireDelay: 1000,
|
|
|
|
fireOnce:true,
|
|
|
|
ceaseFire: function() {
|
|
|
|
return Pager.disable;
|
|
|
|
},
|
|
|
|
callback: function(i) {
|
|
|
|
$('.loading').show();
|
2012-02-08 00:00:49 +01:00
|
|
|
Pager.getOld();
|
|
|
|
}
|
2012-02-12 22:52:27 +01:00
|
|
|
});
|
2012-02-08 00:00:49 +01:00
|
|
|
}
|
|
|
|
}
|