-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.html
86 lines (74 loc) · 3.11 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="S2 Geometry Calculator.">
<meta name="robots" content="index, follow">
<title>S2 Geometry Calculator</title>
<link href="https://fonts.googleapis.com/css?family=Press+Start+2P" rel="stylesheet">
<link href="https://unpkg.com/[email protected]/css/nes.min.css" rel="stylesheet">
<link href="./style.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-127557498-1"></script>
<script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag("js", new Date());gtag("config", "UA-127557498-1");</script>
</head>
<body>
<header>
<h1>S2 Geometry Calculator</h1>
</header>
<section class="form nes-container">
<div class="nes-field">
<label for="latitude">Latitude</label>
<input type="number" id="latitude" class="nes-input">
</div>
<div class="nes-field">
<label for="longitude">Longitude</label>
<input type="number" id="longitude" class="nes-input">
</div>
<div class="nes-field">
<label for="level">Level</label>
<input type="number" id="level" class="nes-input">
</div>
<div class="nes-field">
<label for="s2id">S2 Cell ID</label>
<input type="number" id="s2id" class="nes-input">
</div>
<button type="button" id="copy-s2id" class="nes-btn is-primary">Copy S2 Cell ID</button>
<a id="open-google-maps" class="nes-btn">Open Google Maps</a>
</section>
<footer class="footer">
<p>
<a href="https://github.com/gojek" target="_blank"><i class="nes-icon github"></i></a>
<a href="https://twitter.com/gojektech" target="_blank"><i class="nes-icon twitter"></i></a>
</p>
</footer>
<a class="github-link" href="https://github.com/gojekfarm/s2-calc" target="_blank">
<p class="nes-balloon from-right">Fork me<br>on GitHub</p>
<i class="nes-octocat"></i>
</a>
<script src="wasm_exec.js"></script>
<script>
new ClipboardJS("#copy-s2id", { text: function() { return document.getElementById("s2id").value; } });
var url_string = window.location.href;
var url = new URL(url_string);
var latitude = url.searchParams.get("latitude");
var longitude = url.searchParams.get("longitude");
var level = url.searchParams.get("level");
if (latitude != null) { document.getElementById("latitude").setAttribute("value", latitude); }
if (longitude != null) { document.getElementById("longitude").setAttribute("value", longitude); }
if (level != null) { document.getElementById("level").setAttribute("value", level); }
const go = new Go();
let mod, inst;
WebAssembly.instantiateStreaming(
fetch("main.wasm"), go.importObject).then((result) => {
mod = result.module;
inst = result.instance;
run();
});
async function run() {
await go.run(inst);
}
</script>
</body>
</html>