2012-02-07 18:00:49 -05:00
|
|
|
var Pager = {
|
|
|
|
limit:0,
|
|
|
|
offset:0,
|
2012-02-12 16:52:27 -05:00
|
|
|
disable:false,
|
2012-02-07 18:00:49 -05:00
|
|
|
|
|
|
|
init:
|
2012-02-12 16:52:27 -05:00
|
|
|
function(limit) {
|
2012-02-07 18:00:49 -05: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 16:52:27 -05:00
|
|
|
} else {
|
|
|
|
this.disable = true;
|
2012-02-07 18:00:49 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
initLoadMore:
|
|
|
|
function() {
|
2012-02-12 16:52:27 -05:00
|
|
|
$(document).endlessScroll({
|
|
|
|
bottomPixels: 400,
|
|
|
|
fireDelay: 1000,
|
|
|
|
fireOnce:true,
|
|
|
|
ceaseFire: function() {
|
|
|
|
return Pager.disable;
|
|
|
|
},
|
|
|
|
callback: function(i) {
|
|
|
|
$('.loading').show();
|
2012-02-07 18:00:49 -05:00
|
|
|
Pager.getOld();
|
|
|
|
}
|
2012-02-12 16:52:27 -05:00
|
|
|
});
|
2012-02-07 18:00:49 -05:00
|
|
|
}
|
|
|
|
}
|