Add: player list manager

This commit is contained in:
2018-07-04 08:48:36 +09:00
parent 8db6dd19ad
commit 8d9e48af39
8 changed files with 435 additions and 130 deletions
+22 -48
View File
@@ -1,13 +1,16 @@
let maestroID = -1;
let playerCount = 0;
let playerListPage = 0;
let lastPageNo = 0;
// let playerCount = 0;
// let playerListPage = 0;
// let lastPageNo = 0;
let addPlayerList;
let addPlayerListNavigator;
let addPlayerListManager;
let searchPlayerListManager;
let searchPlayerList;
let searchPlayerListNavigator;
// let addPlayerList;
// let addPlayerListNavigator;
// let searchPlayerList;
// let searchPlayerListNavigator;
let mouseAppList;
@@ -19,47 +22,6 @@ $(document).ready(function() {
console.log("maestroID : " + maestroID);
});
function loadPlayerList() {
let xhr = new XMLHttpRequest(); //new로 생성.
xhr.open('POST', './../server/user/registered_player_count.php', true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("maestro_id=" + maestroID);
xhr.onload = function() {
if(xhr.readyState === 4 && xhr.status === 200) {
// console.log(xhr.responseText);
// console.log(xhr.responseText.length);
if(xhr.responseText.length === 0 || xhr.responseText === null) {
console.log("no data from server");
return;
}
let replyJSON = JSON.parse(xhr.responseText);
// console.log(replyJSON);
if(replyJSON === null) {
console.log("no data from server");
return;
}
if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
console.log(replyJSON["ERROR"]);
return;
}
if(replyJSON["RESULT"] === "fail") {
console.log(replyJSON["RESULT"]);
return;
}
playerCount = replyJSON["Count"];
loadPlayerListPage(1);
addPlayerListNavigator.addPlayerListPages(playerCount);
}
}
}
function tabClicked(tabNo) {
// hide and show tab
for(let i = 0; i < 4; i++) {
@@ -98,3 +60,15 @@ function tabClicked(tabNo) {
}
}
function onClickPlayerListPage(item, pageNo) {
let tagDiv = $(item).closest("div");
let tagDivIDName = tagDiv.prop("id");
// console.log(tagDivIDName);
if(tagDivIDName === "add_player_list_navigator")
addPlayerListManager.onClickPlayerListPage(pageNo);
else if(tagDivIDName === "search_player_list_navigator")
searchPlayerListManager.onClickPlayerListPage(pageNo);
}