X-Git-Url: https://git-public.kairo.at/?p=lantea.git;a=blobdiff_plain;f=js%2Fui.js;h=187a84d6663b674619ab7a710ea562990dbc7aff;hp=f82dddb022839098cc17b70e5133f8cfca67b120;hb=99631a7543656fb58fe3c7f7913773d49630db03;hpb=b47b4a65e0de47e607e0f675402e69239d012ad6 diff --git a/js/ui.js b/js/ui.js index f82dddb..187a84d 100644 --- a/js/ui.js +++ b/js/ui.js @@ -46,6 +46,7 @@ window.onload = function() { initMap(); resizeAndDraw(); + startTracking(); } window.onresize = function() { @@ -61,3 +62,38 @@ function toggleSettings() { fs.style.display = "none"; } } + +function makeISOString(aTimestamp) { + // ISO time format is YYYY-MM-DDTHH:mm:ssZ + var tsDate = new Date(aTimestamp); + return tsDate.getUTCFullYear() + "-" + + (tsDate.getUTCMonth() < 10 ? "0" : "") + tsDate.getUTCMonth() + "-" + + (tsDate.getUTCDate() < 10 ? "0" : "") + tsDate.getUTCDate() + "T" + + (tsDate.getUTCHours() < 10 ? "0" : "") + tsDate.getUTCHours() + ":" + + (tsDate.getUTCMinutes() < 10 ? "0" : "") + tsDate.getUTCMinutes() + ":" + + (tsDate.getUTCSeconds() < 10 ? "0" : "") + tsDate.getUTCSeconds() + "Z"; +} + +function saveTrack() { + if (gTrack.length) { + var out = '' + "\n\n"; + out += '' + "\n"; + out += ' ' + "\n"; + out += ' ' + "\n"; + for (var i = 0; i < gTrack.length; i++) { + out += ' ' + "\n"; + if (gTrack[i].coords.altitude) { + out += ' ' + gTrack[i].coords.altitude + '' + "\n"; + } + out += ' ' + "\n"; + out += ' ' + "\n"; + gTrack[i].coords.latitude, gTrack[i].coords.longitude; + } + out += ' ' + "\n"; + out += ' ' + "\n"; + out += '' + "\n"; + var outDataURI = "data:application/octet-stream," + encodeURIComponent(out); + window.open(outDataURI, 'GPX Track'); + } +}