cleaner admin

This commit is contained in:
catvayor 2023-06-13 18:14:49 +02:00
parent 8c5680fd11
commit c94119e173

View file

@ -31,11 +31,15 @@
top: 1%; top: 1%;
right: 0.5%; right: 0.5%;
} }
.vieux { color: DarkOrchid; }
.tableFixHead { overflow: auto; height: 40%; } .tableFixHead { overflow: auto; height: 40%; }
.tableFixHead thead th { position: sticky; top: 0; z-index: 1; } .tableFixHead thead th { position: sticky; top: 0; z-index: 1; }
table { border-collapse: collapse; width: 100%; } table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px 16px; } th, td { padding: 8px 16px; }
th { background:#eee; } th { background: Grey; }
tr:nth-child(even) { background-color: Silver; }
</style> </style>
<script type="text/javascript" src="utils.js"></script> <script type="text/javascript" src="utils.js"></script>
@ -106,7 +110,7 @@
socket.on('update', function(data){ socket.on('update', function(data){
var id = data.id; var id = data.id;
if(!(id in equipes)){ if(!(id in equipes)){
var row = `<td>${id}</td>`; var row = `<td class="${data.vieux?"vieux":"conscrit"}">${id}</td>`;
row += `<td><input type="checkbox" row += `<td><input type="checkbox"
id="${id}.shown" id="${id}.shown"
onchange="sendUpdate('${id}')" /></td>` onchange="sendUpdate('${id}')" /></td>`
@ -120,9 +124,16 @@
id="${id}.npc" id="${id}.npc"
onchange="sendUpdate('${id}')" /></td>` onchange="sendUpdate('${id}')" /></td>`
row += `<td id="${id}.time"></td>` row += `<td id="${id}.time"></td>`
info_table.innerHTML = info_table.innerHTML + `<tr>${row}</tr>` info_table.innerHTML += `<tr>${row}</tr>`
for(i in equipes){
var equipe = equipes[i];
document.getElementById(`${i}.shown`).checked = equipe.state.shown;
document.getElementById(`${i}.blurred`).checked = equipe.state.blurred;
document.getElementById(`${i}.tracker`).checked = equipe.state.tracker;
document.getElementById(`${i}.npc`).value = equipe.state.npc;
}
} }
equipes[id] = data.state; equipes[id] = data;
document.getElementById(`${id}.shown`).checked = data.state.shown; document.getElementById(`${id}.shown`).checked = data.state.shown;
document.getElementById(`${id}.blurred`).checked = data.state.blurred; document.getElementById(`${id}.blurred`).checked = data.state.blurred;
document.getElementById(`${id}.tracker`).checked = data.state.tracker; document.getElementById(`${id}.tracker`).checked = data.state.tracker;