HTML fmt
This commit is contained in:
parent
2329eadae4
commit
6445883f00
82
index.html
82
index.html
@ -1,48 +1,47 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>Honestly stolen from BlackSharkDen</title>
|
<title>Honestly stolen from BlackSharkDen</title>
|
||||||
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
|
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
|
||||||
<script src="https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.js"></script>
|
<script src="https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.js"></script>
|
||||||
<link href="https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.css" rel="stylesheet" />
|
<link href="https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.css" rel="stylesheet" />
|
||||||
<style>
|
<style>
|
||||||
body { margin: 0; padding: 0; }
|
body { margin: 0; padding: 0; }
|
||||||
#map { position: absolute; top: 0; bottom: 0; width: 100%; }
|
#map { position: absolute; top: 0; bottom: 0; width: 100%; }
|
||||||
|
#info {
|
||||||
|
display: block;
|
||||||
|
position: relative;
|
||||||
|
margin: 0px auto;
|
||||||
|
width: 50%;
|
||||||
|
padding: 10px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 3px;
|
||||||
|
font-size: 12px;
|
||||||
|
text-align: center;
|
||||||
|
color: #222;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="map"></div>
|
||||||
|
<pre id="info"></pre>
|
||||||
|
<script>
|
||||||
|
var map = new maplibregl.Map({
|
||||||
|
container: 'map',
|
||||||
|
style: 'https://api.maptiler.com/maps/topo-v2/style.json?key=<replace-me>',
|
||||||
|
center: [42, 42],
|
||||||
|
zoom: 7
|
||||||
|
});
|
||||||
|
|
||||||
#info {
|
map.on('load', function () {
|
||||||
display: block;
|
|
||||||
position: relative;
|
|
||||||
margin: 0px auto;
|
|
||||||
width: 50%;
|
|
||||||
padding: 10px;
|
|
||||||
border: none;
|
|
||||||
border-radius: 3px;
|
|
||||||
font-size: 12px;
|
|
||||||
text-align: center;
|
|
||||||
color: #222;
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="map"></div>
|
|
||||||
<pre id="info"></pre>
|
|
||||||
<script>
|
|
||||||
var map = new maplibregl.Map({
|
|
||||||
container: 'map',
|
|
||||||
style: 'https://api.maptiler.com/maps/topo-v2/style.json?key=<replace-me>',
|
|
||||||
center: [42, 42],
|
|
||||||
zoom: 7
|
|
||||||
});
|
|
||||||
|
|
||||||
map.on('load', function () {
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function MGRSString (Lat, Long) {
|
function MGRSString (Lat, Long) {
|
||||||
//if (Lat < -80) return 'Too far South' ; if (Lat > 84) return 'Too far North' ;
|
//if (Lat < -80) return 'Too far South' ; if (Lat > 84) return 'Too far North' ;
|
||||||
|
|
||||||
var c = 1 + Math.floor ((Long+180)/6);
|
var c = 1 + Math.floor ((Long+180)/6);
|
||||||
@ -76,14 +75,13 @@ function MGRSString (Lat, Long) {
|
|||||||
aa = Math.floor (aa%100000); aa = pad (aa);
|
aa = Math.floor (aa%100000); aa = pad (aa);
|
||||||
ab = Math.floor (ab%100000); ab = pad (ab);
|
ab = Math.floor (ab%100000); ab = pad (ab);
|
||||||
return c + ad + ' ' + af + ah + ' ' + aa + ' ' + ab;
|
return c + ad + ' ' + af + ah + ' ' + aa + ' ' + ab;
|
||||||
};
|
};
|
||||||
|
|
||||||
map.on('mousemove', function (e) {
|
map.on('mousemove', function (e) {
|
||||||
var coordinate = e.lngLat.wrap();
|
var coordinate = e.lngLat.wrap();
|
||||||
document.getElementById('info').innerHTML = MGRSString(coordinate.lat, coordinate.lng);
|
document.getElementById('info').innerHTML = MGRSString(coordinate.lat, coordinate.lng);
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
</body>
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user