Skip to content

Commit

Permalink
tracking view
Browse files Browse the repository at this point in the history
  • Loading branch information
strukturart committed Dec 27, 2023
1 parent bc76c4e commit 2e01e9f
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 68 deletions.
15 changes: 8 additions & 7 deletions application/assets/js/osm.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
const osm = (() => {
let osm_server_upload_gpx = function (filename, gpx_data, notify = true) {
if (general.osm_token) {
helper.side_toaster("you are connected to openstreetmap", 5000);
if (!general.osm_token) {
helper.side_toaster(
"looks like you are not connected to openstreetmap",
5000
);
return false;
}

let n = "Bearer " + general.osm_token;
Expand All @@ -13,7 +17,7 @@ const osm = (() => {
type: "application/gpx",
});

if (notify) helper.side_toaster("try uploading file", 2000);
if (notify) helper.side_toaster("try uploading file", 5000);

let formData = new FormData();
formData.append("description", "uploaded from o.map");
Expand All @@ -28,10 +32,7 @@ const osm = (() => {
.then((response) => response.text())
.then((data) => {
status.live_track_id.push(data);
setTimeout(() => {
if (notify)
helper.side_toaster("file uploaded" + status.live_track_id, 4000);
}, 2000);
if (notify == true) helper.side_toaster("file uploaded", 4000);
})

.catch((error) => {
Expand Down
16 changes: 12 additions & 4 deletions application/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,10 @@ <h2>Export</h2>
<div id="tracking-evo-up"><span></span></div>
<div id="tracking-evo-down"><span></span></div>
</section>
<section class="item">
<strong><u>Alitude</u></strong>
<div id="tracking-altitude"></div>
</section>

<section class="item">
<strong><u>Duration</u></strong>
Expand All @@ -533,10 +537,7 @@ <h2>Export</h2>
<div id="tracking-speed-average-time"><span></span></div>
</section>

<section class="item">
<strong><u>Alitude</u></strong>
<div id="tracking-altitude"></div>
</section>

</div>
<!--GPX-->
<div class="panel menu-box" id="gpx-file-info" name="GPX File-Info">
Expand Down Expand Up @@ -656,6 +657,13 @@ <h2>Instructions</h2>
<div>1</div>
</div>
</div>

<div class="item" data-map="search">
<div class="flex justify-content-spacebetween">
<div>during tracking,<br> larger view of the parameters</div>
<div>5</div>
</div>
</div>
<div class="item" data-map="search">
<div class="flex justify-content-spacebetween">
<div>search</div>
Expand Down
37 changes: 16 additions & 21 deletions application/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,6 @@ document.addEventListener("DOMContentLoaded", function () {
};
//build menu
let build_menu = function () {
/*
document.querySelector("div#tracksmarkers").innerHTML = "";
document.querySelector("div#maps").innerHTML = "";
document.querySelector("div#layers").innerHTML = "";
document.querySelector("div#overpass").innerHTML = "";
document.querySelector("div#gpx").innerHTML = "";
*/

let el = document.querySelector("div#maps");
el.innerHTML = "";
el.insertAdjacentHTML(
Expand Down Expand Up @@ -743,7 +735,6 @@ document.addEventListener("DOMContentLoaded", function () {
files.sort((a, b) => {
return b.name.localeCompare(a.name);
});
console.log(files);
} else {
for (let n = 0; n < s[i].childNodes.length; n++) {
if (s[i].childNodes[n].tagName == "tag") {
Expand Down Expand Up @@ -1549,9 +1540,12 @@ document.addEventListener("DOMContentLoaded", function () {
document.querySelector("div#files-option").style.display = "none";
open_finder();
general.active_item.focus();
let loadGPX_data_callback = (filename, data) => {
osm.osm_server_upload_gpx(filename, data, true);
};
module.loadGPX_data(
general.active_item.getAttribute("data-filepath"),
osm.osm_server_upload_gpx
loadGPX_data_callback
);
}
}
Expand Down Expand Up @@ -2602,6 +2596,9 @@ document.addEventListener("DOMContentLoaded", function () {

case "Enter":
if (status.intro) return false;
if (status.windowOpen == "user-input" && save_mode == "routing")
return false;

if (
status.windowOpen == "user-input" &&
save_mode == "geojson-tracking"
Expand All @@ -2614,10 +2611,6 @@ document.addEventListener("DOMContentLoaded", function () {
break;
}

if (status.windowOpen == "user-input" && save_mode == "routing") {
break;
}

if (status.windowOpen == "user-input" && save_mode == "rename-file") {
helper.renameFile(
general.active_item.getAttribute("data-filepath"),
Expand All @@ -2630,7 +2623,6 @@ document.addEventListener("DOMContentLoaded", function () {

if (status.windowOpen == "map") {
open_finder();
status.windowOpen = "finder";
break;
}
if (
Expand All @@ -2654,10 +2646,7 @@ document.addEventListener("DOMContentLoaded", function () {
if (status.windowOpen == "search") {
search.search_return_data();

// map.setView([olc_lat_lng[0], olc_lat_lng[1]]);
search.hideSearch();
//mainmarker.current_lat = Number(olc_lat_lng[0]);
//mainmarker.current_lng = Number(olc_lat_lng[1]);
helper.side_toaster("press 5 to save the marker", 2000);
break;
}
Expand Down Expand Up @@ -2814,8 +2803,10 @@ document.addEventListener("DOMContentLoaded", function () {
// maps.export_db();
//maps.import_db();
if (status.tracking_running) {
document.getElementById("tracking-view").style.display = "flex";
status.windowOpen = "trackingView";
document.getElementById("tracking-view").style.display =
status.windowOpen === "trackingView" ? "none" : "flex";
status.windowOpen =
status.windowOpen === "trackingView" ? "map" : "trackingView";
}

break;
Expand Down Expand Up @@ -2857,7 +2848,11 @@ document.addEventListener("DOMContentLoaded", function () {

case "*":
if (status.intro) return false;
mainmarker.selected_marker = module.select_marker();
if (status.keylock) return false;
if (status.windowOpen == "map") {
mainmarker.selected_marker = module.select_marker();
}

break;

case "#":
Expand Down
4 changes: 2 additions & 2 deletions application/manifest.webapp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"version": "1.9.749",
"version": "1.9.752",
"version_name": "hotline",
"name": "o.map",
"description": "O.map, your ultimate navigation companion for KaiOS-powered devices. O.map is a lightweight and feature-rich map application designed specifically for KaiOS, enabling you to explore and navigate the world with ease. Whether you're a local resident, a tourist, or an adventurer, O.map is here to enhance your journey and keep you on the right track.",
"launch_path": "/index.html",
"type": "privileged",
"fullscreen": "true",
"priority": "high",
"userAgentInfo": "o.map / 1.9.7 written by [email protected]",
"userAgentInfo": "o.map / 1.9.751 written by [email protected]",
"icons": {
"56": "/assets/icons/icon-56-56.png",
"112": "/assets/icons/icon-112-112.png"
Expand Down
15 changes: 8 additions & 7 deletions docs/assets/js/osm.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
const osm = (() => {
let osm_server_upload_gpx = function (filename, gpx_data, notify = true) {
if (general.osm_token) {
helper.side_toaster("you are connected to openstreetmap", 5000);
if (!general.osm_token) {
helper.side_toaster(
"looks like you are not connected to openstreetmap",
5000
);
return false;
}

let n = "Bearer " + general.osm_token;
Expand All @@ -13,7 +17,7 @@ const osm = (() => {
type: "application/gpx",
});

if (notify) helper.side_toaster("try uploading file", 2000);
if (notify) helper.side_toaster("try uploading file", 5000);

let formData = new FormData();
formData.append("description", "uploaded from o.map");
Expand All @@ -28,10 +32,7 @@ const osm = (() => {
.then((response) => response.text())
.then((data) => {
status.live_track_id.push(data);
setTimeout(() => {
if (notify)
helper.side_toaster("file uploaded" + status.live_track_id, 4000);
}, 2000);
if (notify == true) helper.side_toaster("file uploaded", 4000);
})

.catch((error) => {
Expand Down
16 changes: 12 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,10 @@ <h2>Export</h2>
<div id="tracking-evo-up"><span></span></div>
<div id="tracking-evo-down"><span></span></div>
</section>
<section class="item">
<strong><u>Alitude</u></strong>
<div id="tracking-altitude"></div>
</section>

<section class="item">
<strong><u>Duration</u></strong>
Expand All @@ -533,10 +537,7 @@ <h2>Export</h2>
<div id="tracking-speed-average-time"><span></span></div>
</section>

<section class="item">
<strong><u>Alitude</u></strong>
<div id="tracking-altitude"></div>
</section>

</div>
<!--GPX-->
<div class="panel menu-box" id="gpx-file-info" name="GPX File-Info">
Expand Down Expand Up @@ -656,6 +657,13 @@ <h2>Instructions</h2>
<div>1</div>
</div>
</div>

<div class="item" data-map="search">
<div class="flex justify-content-spacebetween">
<div>during tracking,<br> larger view of the parameters</div>
<div>5</div>
</div>
</div>
<div class="item" data-map="search">
<div class="flex justify-content-spacebetween">
<div>search</div>
Expand Down
37 changes: 16 additions & 21 deletions docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,6 @@ document.addEventListener("DOMContentLoaded", function () {
};
//build menu
let build_menu = function () {
/*
document.querySelector("div#tracksmarkers").innerHTML = "";
document.querySelector("div#maps").innerHTML = "";
document.querySelector("div#layers").innerHTML = "";
document.querySelector("div#overpass").innerHTML = "";
document.querySelector("div#gpx").innerHTML = "";
*/

let el = document.querySelector("div#maps");
el.innerHTML = "";
el.insertAdjacentHTML(
Expand Down Expand Up @@ -743,7 +735,6 @@ document.addEventListener("DOMContentLoaded", function () {
files.sort((a, b) => {
return b.name.localeCompare(a.name);
});
console.log(files);
} else {
for (let n = 0; n < s[i].childNodes.length; n++) {
if (s[i].childNodes[n].tagName == "tag") {
Expand Down Expand Up @@ -1549,9 +1540,12 @@ document.addEventListener("DOMContentLoaded", function () {
document.querySelector("div#files-option").style.display = "none";
open_finder();
general.active_item.focus();
let loadGPX_data_callback = (filename, data) => {
osm.osm_server_upload_gpx(filename, data, true);
};
module.loadGPX_data(
general.active_item.getAttribute("data-filepath"),
osm.osm_server_upload_gpx
loadGPX_data_callback
);
}
}
Expand Down Expand Up @@ -2602,6 +2596,9 @@ document.addEventListener("DOMContentLoaded", function () {

case "Enter":
if (status.intro) return false;
if (status.windowOpen == "user-input" && save_mode == "routing")
return false;

if (
status.windowOpen == "user-input" &&
save_mode == "geojson-tracking"
Expand All @@ -2614,10 +2611,6 @@ document.addEventListener("DOMContentLoaded", function () {
break;
}

if (status.windowOpen == "user-input" && save_mode == "routing") {
break;
}

if (status.windowOpen == "user-input" && save_mode == "rename-file") {
helper.renameFile(
general.active_item.getAttribute("data-filepath"),
Expand All @@ -2630,7 +2623,6 @@ document.addEventListener("DOMContentLoaded", function () {

if (status.windowOpen == "map") {
open_finder();
status.windowOpen = "finder";
break;
}
if (
Expand All @@ -2654,10 +2646,7 @@ document.addEventListener("DOMContentLoaded", function () {
if (status.windowOpen == "search") {
search.search_return_data();

// map.setView([olc_lat_lng[0], olc_lat_lng[1]]);
search.hideSearch();
//mainmarker.current_lat = Number(olc_lat_lng[0]);
//mainmarker.current_lng = Number(olc_lat_lng[1]);
helper.side_toaster("press 5 to save the marker", 2000);
break;
}
Expand Down Expand Up @@ -2814,8 +2803,10 @@ document.addEventListener("DOMContentLoaded", function () {
// maps.export_db();
//maps.import_db();
if (status.tracking_running) {
document.getElementById("tracking-view").style.display = "flex";
status.windowOpen = "trackingView";
document.getElementById("tracking-view").style.display =
status.windowOpen === "trackingView" ? "none" : "flex";
status.windowOpen =
status.windowOpen === "trackingView" ? "map" : "trackingView";
}

break;
Expand Down Expand Up @@ -2857,7 +2848,11 @@ document.addEventListener("DOMContentLoaded", function () {

case "*":
if (status.intro) return false;
mainmarker.selected_marker = module.select_marker();
if (status.keylock) return false;
if (status.windowOpen == "map") {
mainmarker.selected_marker = module.select_marker();
}

break;

case "#":
Expand Down
4 changes: 2 additions & 2 deletions docs/manifest.webapp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"version": "1.9.749",
"version": "1.9.752",
"version_name": "hotline",
"name": "o.map",
"description": "O.map, your ultimate navigation companion for KaiOS-powered devices. O.map is a lightweight and feature-rich map application designed specifically for KaiOS, enabling you to explore and navigate the world with ease. Whether you're a local resident, a tourist, or an adventurer, O.map is here to enhance your journey and keep you on the right track.",
"launch_path": "/index.html",
"type": "privileged",
"fullscreen": "true",
"priority": "high",
"userAgentInfo": "o.map / 1.9.7 written by [email protected]",
"userAgentInfo": "o.map / 1.9.751 written by [email protected]",
"icons": {
"56": "/assets/icons/icon-56-56.png",
"112": "/assets/icons/icon-112-112.png"
Expand Down

0 comments on commit 2e01e9f

Please sign in to comment.