-
Notifications
You must be signed in to change notification settings - Fork 5
/
example.html
48 lines (45 loc) · 1.32 KB
/
example.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
<!DOCTYPE html>
<html>
<head>
<script src="../dist/igc2kmz.js"></script>
<style type="text/css">
* {
font-family: sans-serif;
}
</style>
<script>
var filename = "track.igc";
function convertigc() {
igc2kmz(document.getElementById('igccont').value, filename).catch(err => {
alert(err);
throw err;
});
}
function handleFileSelect(evt) {
var files = evt.target.files;
if (files.length > 0) {
filename = files[0].name ?? filename
var reader = new FileReader();
reader.onload = (function(reader)
{
return function()
{
document.getElementById('igccont').value = reader.result;
}
})(reader);
reader.readAsText(files[0]);
}
}
window.onload = function() {
document.getElementById('files').addEventListener('change', handleFileSelect, false);
};
</script>
</head>
<body>
<h1>IGC to KMZ conversion</h1>
<input type="file" id="files" name="file" accept=".igc"/><BR>
<h3>IGC content :</h3>
<textarea id="igccont" cols="100" rows="10"></textarea><BR>
<input id="btn" type="button" onclick="convertigc()" value="Convert">
</body>
</html>