traque/static/tracking/vieux.html

100 lines
3.4 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Traque | 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>
<!-- SOCKET.IO INCLUDE -->
<script src="/socket.io/socket.io.js"></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="shown" name="shown" onclick='sendState()' />
<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()' />
<label for="npc0">Traqueur</label>
<input type="radio" id="npc1" name="npc" value=1 checked onclick='sendState()' />
<label for="npc1">NPC Violet</label>
<input type="radio" id="npc2" name="npc" value=2 onclick='sendState()' />
<label for="npc2">NPC Vert</label>
<input type="radio" id="npc3" name="npc" value=3 onclick='sendState()' />
<label for="npc3">NPC Orange</label>
</form>
</div>
<script type="text/javascript">
//////////////////////////////////////////////////////////////////////////////
// SETUP MAP
setup_map();
//////////////////////////////////////////////////////////////////////////////
// UPDATE MAP
id = "%ID"; // %ID will be replaced by the real id.
socket = io({rejectUnauthorized: false, auth: {id: id, type:"vieux"}});
setup_socket_common();
//////////////////////////////////////////////////////////////////////////////
// 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.shown = "shown" in nState;
nState.blurred = "blurred" in nState;
nState.tracker = nState.npc == 0;
socket.emit('changeState', nState);
}
socket.on('newState', function(state){
document.querySelector("#shown").checked = state.shown;
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;
});
//////////////////////////////////////////////////////////////////////////////
// GEOLOCALISATION
if(%GPSLOG) setup_geoLoc();
</script>
</body>
</html>