Started Issue #16

There is now a "blurred" status that does nothing.
This commit is contained in:
Sylvain Gay 2023-06-13 17:53:30 +02:00
parent 33f643642a
commit 8c5680fd11
2 changed files with 16 additions and 8 deletions

View file

@ -49,6 +49,7 @@
<thead><tr> <thead><tr>
<th>ID</th> <th>ID</th>
<th>Visible</th> <th>Visible</th>
<th>Brouillé</th>
<th>Tracker</th> <th>Tracker</th>
<th>Npc</th> <th>Npc</th>
<th>Last Update</th> <th>Last Update</th>
@ -96,6 +97,7 @@
function sendUpdate(id){ function sendUpdate(id){
var state = {}; var state = {};
state.shown = document.getElementById(`${id}.shown`).checked; state.shown = document.getElementById(`${id}.shown`).checked;
state.blurred = document.getElementById(`${id}.blurred`).checked;
state.tracker = document.getElementById(`${id}.tracker`).checked; state.tracker = document.getElementById(`${id}.tracker`).checked;
state.npc = document.getElementById(`${id}.npc`).value; state.npc = document.getElementById(`${id}.npc`).value;
socket.emit('setState', { id: id, state: state }); socket.emit('setState', { id: id, state: state });
@ -105,20 +107,24 @@
var id = data.id; var id = data.id;
if(!(id in equipes)){ if(!(id in equipes)){
var row = `<td>${id}</td>`; var row = `<td>${id}</td>`;
row = row + `<td><input type="checkbox" row += `<td><input type="checkbox"
id="${id}.shown" id="${id}.shown"
onchange="sendUpdate('${id}')" /></td>` onchange="sendUpdate('${id}')" /></td>`
row = row + `<td><input type="checkbox" row += `<td><input type="checkbox"
id="${id}.tracker" id="${id}.blurred"
onchange="sendUpdate('${id}')" /></td>` onchange="sendUpdate('${id}')" /></td>`
row = row + `<td><input type="number" min=0 max=3 row += `<td><input type="checkbox"
id="${id}.tracker"
onchange="sendUpdate('${id}')" /></td>`
row += `<td><input type="number" min=0 max=3
id="${id}.npc" id="${id}.npc"
onchange="sendUpdate('${id}')" /></td>` onchange="sendUpdate('${id}')" /></td>`
row = row + `<td id="${id}.time"></td>` row += `<td id="${id}.time"></td>`
info_table.innerHTML = info_table.innerHTML + `<tr>${row}</tr>` info_table.innerHTML = info_table.innerHTML + `<tr>${row}</tr>`
} }
equipes[id] = data.state; equipes[id] = data.state;
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}.tracker`).checked = data.state.tracker; document.getElementById(`${id}.tracker`).checked = data.state.tracker;
document.getElementById(`${id}.npc`).value = data.state.npc; document.getElementById(`${id}.npc`).value = data.state.npc;
var now = new Date(); var now = new Date();

View file

@ -5,6 +5,7 @@
"vieux": bool, "vieux": bool,
"state" : { "state" : {
"shown" : bool, "shown" : bool,
"blurred": bool,
"tracker" : bool, "tracker" : bool,
"npc" : int "npc" : int
} }
@ -180,6 +181,7 @@ function default_team(team_id, valid) {
var equipe = {}; var equipe = {};
var state = {}; var state = {};
state.shown = valid == 0; state.shown = valid == 0;
state.blurred = false;
state.tracker = false; state.tracker = false;
state.npc = valid; state.npc = valid;
equipe.state = state; equipe.state = state;