traque/templates/vieux.html.hbs

115 lines
4.9 KiB
Handlebars
Raw Normal View History

<!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>
2024-06-02 11:30:51 +02:00
<input type="radio" id="npc0" name="color" value=1 onclick='sendState()' />
<label for="npc0">Traqueur</label>
2024-06-02 11:30:51 +02:00
<input type="radio" id="npc1" name="color" value=3 checked onclick='sendState()' />
<label for="npc1"><img src="/icons/3.png" height=15px></label>
2024-06-02 11:30:51 +02:00
<input type="radio" id="npc2" name="color" value=4 checked onclick='sendState()' />
<label for="npc2"><img src="/icons/4.png" height=15px></label>
2024-06-02 11:30:51 +02:00
<input type="radio" id="npc3" name="color" value=5 checked onclick='sendState()' />
<label for="npc3"><img src="/icons/5.png" height=15px></label>
2024-06-02 11:30:51 +02:00
<input type="radio" id="npc4" name="color" value=6 checked onclick='sendState()' />
<label for="npc4"><img src="/icons/6.png" height=15px></label>
2024-06-02 11:30:51 +02:00
<input type="radio" id="npc5" name="color" value=7 checked onclick='sendState()' />
<label for="npc5"><img src="/icons/7.png" height=15px></label>
2024-06-02 11:30:51 +02:00
<input type="radio" id="npc6" name="color" value=8 checked onclick='sendState()' />
<label for="npc6"><img src="/icons/8.png" height=15px></label>
2024-06-02 11:30:51 +02:00
<input type="radio" id="npc7" name="color" value=9 checked onclick='sendState()' />
<label for="npc7"><img src="/icons/9.png" height=15px></label>
2024-06-02 11:30:51 +02:00
<input type="radio" id="npc8" name="color" value=10 checked onclick='sendState()' />
<label for="npc8"><img src="/icons/10.png" height=15px></label>
2024-06-02 11:30:51 +02:00
<input type="radio" id="npc9" 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">
2024-06-02 11:30:51 +02:00
//////////////////////////////////////////////////////////////////////////////
// SETUP MAP
2024-06-02 11:30:51 +02:00
setup_map();
2024-06-02 11:30:51 +02:00
//////////////////////////////////////////////////////////////////////////////
// EVENT LISTENNING
2024-06-02 11:30:51 +02:00
id = "{{id}}";
evtSource = new EventSource("/track/{{id}}/events");
setup_evtlisten_common();
2024-06-02 11:30:51 +02:00
//////////////////////////////////////////////////////////////////////////////
// SETTINGS -- State
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;
2024-06-02 15:22:59 +02:00
fetch("/track/{{id}}/state?inv="+nState.invisibility+
2024-06-02 11:30:51 +02:00
"&col="+nState.color,
{ method: 'PUT' }
);
}
// socket.on('newState', function(state){
// document.querySelector("#invisibility").checked = state.invisibility;
// document.querySelector("#blurred").checked = state.blurred;
// document.querySelector("#npc0").checked = state.npc == 0;
// document.querySelector("#npc1").checked = state.npc == 1;
// document.querySelector("#npc2").checked = state.npc == 2;
// document.querySelector("#npc3").checked = state.npc == 3;
// document.querySelector("#npc4").checked = state.npc == 4;
// document.querySelector("#npc5").checked = state.npc == 5;
// document.querySelector("#npc6").checked = state.npc == 6;
// document.querySelector("#npc7").checked = state.npc == 7;
// document.querySelector("#npc8").checked = state.npc == 8;
// document.querySelector("#npc9").checked = state.npc == 9;
// });
// //////////////////////////////////////////////////////////////////////////////
// // GEOLOCALISATION
// if({{gpslog}}) setup_geoLoc();
</script>
</body>
</html>