traque/templates/vieux.html.hbs
2024-06-23 15:59:05 +02:00

106 lines
4.6 KiB
Handlebars

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Traque -- {{name}} | Client vieilleux</title>
<!-- LEAFLET INCLUDE -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.8.0/dist/leaflet.css"
integrity="sha512-hoalWLoI8r4UszCkZ5kL8vayOGVae1oxXe/2A4AO6J9+580uKHDO3JdHb7NzwwzK5xr/Fs0W40kiNHxM9vyTtQ=="
crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.8.0/dist/leaflet.js"
integrity="sha512-BB3hKbKWOc9Ez/TAwyWxNXeoV9c1v6FIeYiBieIWkpLjauysF18NzgR1MBNBXf8/KABdlkX68nAhlwcDFLGPCQ=="
crossorigin=""></script>
<style type="text/css">
#map { height: 600px; }
#below {
position: fixed;
bottom: 0px;
z-index: 10000;
background-color: white;
width: 100%;
}
</style>
<script type="text/javascript" src="/utils.js"></script>
</head>
<body>
<div id="map"></div><br/>
<div id="below">
<form id="state">
<input type="checkbox" id="invisibility" name="invisibility" checked onclick='sendState()' />
<label for="invisibility">Invisible</label>
<input type="radio" id="npc1" name="color" value=1 onclick='sendState()' />
<label for="npc0">Traqueur</label>
<input type="radio" id="npc3" name="color" value=3 checked onclick='sendState()' />
<label for="npc1"><img src="/icons/3.png" height=15px></label>
<input type="radio" id="npc4" name="color" value=4 checked onclick='sendState()' />
<label for="npc2"><img src="/icons/4.png" height=15px></label>
<input type="radio" id="npc5" name="color" value=5 checked onclick='sendState()' />
<label for="npc3"><img src="/icons/5.png" height=15px></label>
<input type="radio" id="npc6" name="color" value=6 checked onclick='sendState()' />
<label for="npc4"><img src="/icons/6.png" height=15px></label>
<input type="radio" id="npc7" name="color" value=7 checked onclick='sendState()' />
<label for="npc5"><img src="/icons/7.png" height=15px></label>
<input type="radio" id="npc8" name="color" value=8 checked onclick='sendState()' />
<label for="npc6"><img src="/icons/8.png" height=15px></label>
<input type="radio" id="npc9" name="color" value=9 checked onclick='sendState()' />
<label for="npc7"><img src="/icons/9.png" height=15px></label>
<input type="radio" id="npc10" name="color" value=10 checked onclick='sendState()' />
<label for="npc8"><img src="/icons/10.png" height=15px></label>
<input type="radio" id="npc11" name="color" value=11 checked onclick='sendState()' />
<label for="npc9"><img src="/icons/11.png" height=15px></label>
</form><br/>
<br/>
<a href="https://dgnum.eu"><img src="/dgnum-logo.png" height=50px /></a><br/>
<span style="font-size: 0.8em">Merci à la <a href="https://dgnum.eu">Délégation Générale NUMérique de l'ENS</a>, qui héberge ce site.</span>
</div>
<script type="text/javascript">
id = "{{id}}";
name = "{{name}}";
dbg = {{dbg}};
setup_map();
setup_map_self();
{{#if gpslog}}setup_geoLoc();{{/if}}
//////////////////////////////////////////////////////////////////////////////
// EVENT LISTENNING
var form = document.querySelector("#state");
function sendState(){
const data = new FormData(form);
var nState = {};
for(entry of data)
nState[entry[0]] = entry[1];
nState.invisibility = "invisibility" in nState;
fetch("/track/{{id}}/state?inv="+nState.invisibility+
"&col="+nState.color,
{ method: 'PUT' }
);
}
function self_state_hook(state){
document.querySelector("#invisibility").checked = state.Vieux.invisible;
document.querySelector("#npc1").checked = state.Vieux.color == 1;
document.querySelector("#npc3").checked = state.Vieux.color == 3;
document.querySelector("#npc4").checked = state.Vieux.color == 4;
document.querySelector("#npc5").checked = state.Vieux.color == 5;
document.querySelector("#npc6").checked = state.Vieux.color == 6;
document.querySelector("#npc7").checked = state.Vieux.color == 7;
document.querySelector("#npc8").checked = state.Vieux.color == 8;
document.querySelector("#npc9").checked = state.Vieux.color == 9;
document.querySelector("#npc10").checked = state.Vieux.color == 10;
document.querySelector("#npc11").checked = state.Vieux.color == 11;
};
setup_evtlisten_common();
</script>
</body>
</html>