Fix: maestro html ES6 -> ES5

This commit is contained in:
2018-09-15 13:51:48 +09:00
parent 53e3dbb3bc
commit 753325d84a
9 changed files with 585 additions and 613 deletions
+81 -88
View File
@@ -1,101 +1,94 @@
class PlayerListRow {
constructor(playerID, playerName, enterCode, editButton, deleteButton) {
this.playerID = playerID;
this.playerName = playerName;
this.enterCode = enterCode;
this.editButton = editButton;
this.deleteButton = deleteButton;
}
function PlayerListRow(playerID, playerName, enterCode, editButton, deleteButton) {
this.playerID = playerID;
this.playerName = playerName;
this.enterCode = enterCode;
this.editButton = editButton;
this.deleteButton = deleteButton;
}
class PlayerList {
constructor(tagDiv, playerListManager) {
let self = this;
this.playerListManager = playerListManager;
// console.log(tagDiv);
// console.log(playerListManager);
function PlayerList(tagDiv, playerListManager) {
var self = this;
this.playerListManager = playerListManager;
// console.log(tagDiv);
// console.log(playerListManager);
this.playerCount = 0;
this.activePageNo = 1;
this.playerCount = 0;
this.activePageNo = 1;
// let id_list = tagDiv.find(".player_id");
let id_list = tagDiv.find(".player-list");
// console.log(id_list);
// var id_list = tagDiv.find(".player_id");
var id_list = tagDiv.find(".player-list");
// console.log(id_list);
this.listRows = new Array();
for(let i = 0; i < id_list.length; i++) {
this.listRows[i] = new PlayerListRow(
id_list[i].getElementsByClassName("player_id"),
id_list[i].getElementsByClassName("player_name"),
id_list[i].getElementsByClassName("player_entercode"),
id_list[i].getElementsByClassName("player_edit"),
id_list[i].getElementsByClassName("player_delete")
);
this.listRows = new Array();
for(var i = 0; i < id_list.length; i++) {
this.listRows[i] = new PlayerListRow(
id_list[i].getElementsByClassName("player_id"),
id_list[i].getElementsByClassName("player_name"),
id_list[i].getElementsByClassName("player_entercode"),
id_list[i].getElementsByClassName("player_edit"),
id_list[i].getElementsByClassName("player_delete")
);
$(this.listRows[i].editButton).click(function() {
playerListManager.editPlayer(this);
})
$(this.listRows[i].editButton).click(function() {
playerListManager.editPlayer(this);
})
$(this.listRows[i].deleteButton).click(function() {
playerListManager.deletePlayer(this);
})
// console.log(this.listRows[i]);
// console.log(this.listRows[i].playerName.val());
$(this.listRows[i].deleteButton).click(function() {
playerListManager.deletePlayer(this);
})
// console.log(this.listRows[i]);
// console.log(this.listRows[i].playerName.val());
this.disableItem(this.listRows[i]);
}
}
PlayerList.prototype.disableItem = function(item) {
$(item.playerID).empty();
$(item.playerName).prop("disabled", true);
$(item.enterCode).prop("disabled", true);
// $(item.playerName).prop("readonly", true);
// $(item.enterCode).prop("readonly", true);
$(item.editButton).prop("disabled", true);
$(item.deleteButton).prop("disabled", true);
}
PlayerList.prototype.enableItem = function(item) {
$(item.playerName).prop("disabled", false);
$(item.enterCode).prop("disabled", false);
// $(item.playerName).prop("readonly", false);
// $(item.enterCode).prop("readonly", false);
$(item.editButton).prop("disabled", false);
$(item.deleteButton).prop("disabled", false);
}
PlayerList.prototype.updatePlayerList = function(jsonData) {
if(jsonData === null) {
for(var i = 0; i < 10; i++) {
$(this.listRows[i].playerName).val("");
$(this.listRows[i].enterCode).val("");
this.disableItem(this.listRows[i]);
}
return;
}
for(var i = 0; i < 10; i++) {
$(this.listRows[i].playerID).empty();
if(i < jsonData.length) {
$(this.listRows[i].playerID).append(jsonData[i]["playerID"]);
$(this.listRows[i].playerName).val(jsonData[i]["playerName"]);
$(this.listRows[i].enterCode).val(jsonData[i]["enterCode"]);
this.enableItem(this.listRows[i]);
} else {
$(this.listRows[i].playerName).val("");
$(this.listRows[i].enterCode).val("");
this.disableItem(this.listRows[i]);
}
}
disableItem(item) {
$(item.playerID).empty();
$(item.playerName).prop("disabled", true);
$(item.enterCode).prop("disabled", true);
// $(item.playerName).prop("readonly", true);
// $(item.enterCode).prop("readonly", true);
$(item.editButton).prop("disabled", true);
$(item.deleteButton).prop("disabled", true);
}
enableItem(item) {
$(item.playerName).prop("disabled", false);
$(item.enterCode).prop("disabled", false);
// $(item.playerName).prop("readonly", false);
// $(item.enterCode).prop("readonly", false);
$(item.editButton).prop("disabled", false);
$(item.deleteButton).prop("disabled", false);
}
updatePlayerList(jsonData) {
if(jsonData === null) {
for(let i = 0; i < 10; i++) {
$(this.listRows[i].playerName).val("");
$(this.listRows[i].enterCode).val("");
this.disableItem(this.listRows[i]);
}
return;
}
for(let i = 0; i < 10; i++) {
$(this.listRows[i].playerID).empty();
if(i < jsonData.length) {
$(this.listRows[i].playerID).append(jsonData[i]["playerID"]);
$(this.listRows[i].playerName).val(jsonData[i]["playerName"]);
$(this.listRows[i].enterCode).val(jsonData[i]["enterCode"]);
this.enableItem(this.listRows[i]);
} else {
$(this.listRows[i].playerName).val("");
$(this.listRows[i].enterCode).val("");
this.disableItem(this.listRows[i]);
}
}
}
}