Files
chocomae/src/web/js/mouse_app_list.js
T
2018-09-15 13:51:48 +09:00

47 lines
918 B
JavaScript

function MouseAppList(pageNoArea) {
var self = this;
this.pageNoArea = pageNoArea;
// console.log(parent);
}
MouseAppList.prototype.addPlayerListPages = function(playerCount) {
lastPageNo = Math.ceil( (playerCount + 1) / 10 );
$(this.pageNoArea).empty();
for(var pageNo = 1; pageNo < lastPageNo + 1; pageNo++) {
$(this.pageNoArea).append(
"<a onClick='onClickPlayerListPage(" + pageNo + ")'> " + pageNo + " </a>"
);
}
}
function onClickPlayerListPage(pageNo) {
switch(pageNo) {
case "first":
playerListPage = 1;
loadPlayerListPage(playerListPage);
return;
case "prev":
if(playerListPage > 1)
playerListPage -= 1;
loadPlayerListPage(playerListPage);
return;
case "next":
if(playerListPage < lastPageNo)
playerListPage += 1;
loadPlayerListPage(playerListPage);
return;
case "last":
loadPlayerListPage(lastPageNo);
return;
}
loadPlayerListPage(pageNo);
}