uploader
parent
316edcb369
commit
17b649560d
|
|
@ -0,0 +1 @@
|
|||
0.01: Initial Release
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
# Gipy Uploader
|
||||
|
||||
Uploads and convert a gpx file to the watch for use with gipy.
|
||||
|
||||
## Requests
|
||||
|
||||
Reach out to frederic.wagner@imag.fr if you have feature requests or notice bugs.
|
||||
|
||||
## Creator
|
||||
|
||||
Made by [Frederic Wagner](mailto:frederic.wagner@imag.fr)
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../../css/spectre.min.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Please select a gpx file to be converted to gpc and loaded.</p>
|
||||
|
||||
|
||||
<input type="file" is="gpx_file" id="fileInput" accept=".gpx">
|
||||
|
||||
<script src="../../core/lib/customize.js"></script>
|
||||
|
||||
<script type="module">
|
||||
|
||||
import init, { convert_gpx_strings } from "./pkg/gpconv.js";
|
||||
console.log("imported wasm");
|
||||
document.getElementById('fileInput').addEventListener('change', function selectedFileChanged() {
|
||||
if (this.files.length === 0) {
|
||||
console.log('No file selected.');
|
||||
return;
|
||||
}
|
||||
|
||||
let gpx_filename = this.files[0].name;
|
||||
let gpc_filename = gpx_filename.slice(0, gpx_filename.length-4) + ".gpc";
|
||||
while (gpc_filename.length > 28) {
|
||||
let new_name = prompt("enter a shorter destination filename than '" + gpc_filename + "' (28 chars max)", gpc_filename);
|
||||
if (new_name != null && new_name.slice(new_name.length-4) == ".gpc") {
|
||||
gpc_filename = new_name;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const reader = new FileReader();
|
||||
reader.onload = function fileReadCompleted() {
|
||||
console.log("reading file completed");
|
||||
// when the reader is done, the content is in reader.result.
|
||||
console.log(reader.result);
|
||||
|
||||
init().then(() => {
|
||||
|
||||
let gpc_file = convert_gpx_strings(reader.result);
|
||||
|
||||
sendCustomizedApp({
|
||||
storage:[
|
||||
{name:gpc_filename, content:gpc_file)},
|
||||
]
|
||||
});
|
||||
});
|
||||
}
|
||||
reader.readAsText(this.files[0]);
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"id": "gipy_uploader",
|
||||
"name": "Gipy uploader",
|
||||
"version": "0.01",
|
||||
"description": "uploads and convert gpx files for use with gipy",
|
||||
"icon": "slidingtext.png",
|
||||
"type": "app",
|
||||
"tags": "tool.outdoors,gps",
|
||||
"supports": ["BANGLEJS2"],
|
||||
"readme": "README.md",
|
||||
"custom": "custom.html",
|
||||
"allow_emulator": false
|
||||
}
|
||||
Loading…
Reference in New Issue