function scrollloader(pagesize, list, view, plan) {
window.scrollloaderinstance = this;
this.scrollpageindex = 1;
var fristloadnum;
if (list.models.length >= pagesize) {
fristloadnum = pagesize;
}
else {
fristloadnum = list.models.length;
}
for (var i = 0; i < fristloadnum; i++) {
var viewstance = new view({ model: list.models[i] });
$(plan).append(viewstance.render().el);
}
$(window).scroll(function () {
var vtop = $(document).scrollTop();
var height = $(document).height();
if (vtop > (height * 0.75)) {
window.scrollloaderinstance.scrollpageindex = window.scrollloaderinstance.scrollpageindex + 1;
var m = (window.scrollloaderinstance.scrollpageindex - 1) * pagesize;
if (m >= list.models.length) {
return;
}
var n = window.scrollloaderinstance.scrollpageindex * pagesize;
if (n >= list.models.length) {
n = list.models.length;
}
for (var i = m; i < n; i++) {
var viewstance = new view({ model: list.models[i] });
$(plan).append(viewstance.render().el);
}
}
});
}
window.scrollloaderinstance = this;
this.scrollpageindex = 1;
var fristloadnum;
if (list.models.length >= pagesize) {
fristloadnum = pagesize;
}
else {
fristloadnum = list.models.length;
}
for (var i = 0; i < fristloadnum; i++) {
var viewstance = new view({ model: list.models[i] });
$(plan).append(viewstance.render().el);
}
$(window).scroll(function () {
var vtop = $(document).scrollTop();
var height = $(document).height();
if (vtop > (height * 0.75)) {
window.scrollloaderinstance.scrollpageindex = window.scrollloaderinstance.scrollpageindex + 1;
var m = (window.scrollloaderinstance.scrollpageindex - 1) * pagesize;
if (m >= list.models.length) {
return;
}
var n = window.scrollloaderinstance.scrollpageindex * pagesize;
if (n >= list.models.length) {
n = list.models.length;
}
for (var i = m; i < n; i++) {
var viewstance = new view({ model: list.models[i] });
$(plan).append(viewstance.render().el);
}
}
});
}