vieux can control their blurred state

This commit is contained in:
catvayor 2023-06-13 18:17:33 +02:00
parent c94119e173
commit 751ce62099

View file

@ -35,7 +35,10 @@
<div id="below"> <div id="below">
<form id="state"> <form id="state">
<input type="checkbox" id="shown" name="shown" onclick='sendState()' /> <input type="checkbox" id="shown" name="shown" onclick='sendState()' />
<label for="shown">Visible</label></br> <label for="shown">Visible</label>
<input type="checkbox" id="blurred" name="blurred" onclick='sendState()' />
<label for="shown">Brouillé</label></br>
<input type="radio" id="npc0" name="npc" value=0 onclick='sendState()' /> <input type="radio" id="npc0" name="npc" value=0 onclick='sendState()' />
<label for="npc0">Traqueur</label> <label for="npc0">Traqueur</label>
@ -74,12 +77,14 @@
for(entry of data) for(entry of data)
nState[entry[0]] = entry[1]; nState[entry[0]] = entry[1];
nState.shown = "shown" in nState; nState.shown = "shown" in nState;
nState.blurred = "blurred" in nState;
nState.tracker = nState.npc == 0; nState.tracker = nState.npc == 0;
socket.emit('changeState', nState); socket.emit('changeState', nState);
} }
socket.on('newState', function(state){ socket.on('newState', function(state){
document.querySelector("#shown").checked = state.shown; document.querySelector("#shown").checked = state.shown;
document.querySelector("#blurred").checked = state.blurred;
document.querySelector("#npc0").checked = state.npc == 0; document.querySelector("#npc0").checked = state.npc == 0;
document.querySelector("#npc1").checked = state.npc == 1; document.querySelector("#npc1").checked = state.npc == 1;
document.querySelector("#npc2").checked = state.npc == 2; document.querySelector("#npc2").checked = state.npc == 2;