Skip to content

Commit

Permalink
files
Browse files Browse the repository at this point in the history
  • Loading branch information
strukturart committed Oct 22, 2023
1 parent 0d352b9 commit bc76c4e
Show file tree
Hide file tree
Showing 36 changed files with 813 additions and 548 deletions.
22 changes: 22 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

The MIT License (MIT)

Copyright (c) 2023 strukturart

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
24 changes: 0 additions & 24 deletions UNLICENSE

This file was deleted.

Binary file removed application/assets/audio/done.mp3
Binary file not shown.
Binary file removed application/assets/css/images/layers-2x.png
Binary file not shown.
Binary file removed application/assets/css/images/layers.png
Binary file not shown.
6 changes: 6 additions & 0 deletions application/assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ textarea {
color: black;
}

img {
outline: 0px;
border: none;
display: block;
}

label {
color: white;
margin: 0 0 10px 0;
Expand Down
4 changes: 2 additions & 2 deletions application/assets/js/exportGeoJson.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const geojson = ((_) => {

requestAdd.onsuccess = function () {
status.windowOpen = "map";
bottom_bar("", "", "");
helper.bottom_bar("", "", "");

if (type == "tracking") {
module.measure_distance("destroy_tracking");
Expand Down Expand Up @@ -135,7 +135,7 @@ const geojson = ((_) => {

requestAdd.onsuccess = function () {
status.windowOpen = "map";
bottom_bar("", "", "");
helper.bottom_bar("", "", "");

callback(file_path_name);

Expand Down
9 changes: 8 additions & 1 deletion application/assets/js/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,14 @@ const helper = (() => {
.then((file) => {
if (!file.done) {
if (file.value.name.includes(name)) {
callback(e);
let sdcard = navigator.b2g.getDeviceStorage("sdcard");
let request = sdcard.get(file.value.name);
request.onsuccess = function () {
callback(this.result);
};
request.onerror = function (e) {
helper.side_toaster(e + "error", 3000);
};
}
next(_files);
}
Expand Down
16 changes: 8 additions & 8 deletions application/assets/js/maps.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const maps = (() => {
var bbox = L.latLngBounds(L.latLng(swLat, swLng), L.latLng(neLat, neLng));
tilesLayer.seed(bbox, 0, zoom_depth);

top_bar("", "downloading", "");
helper.top_bar("", "downloading", "");

// Display seed progress on console
tilesLayer.on("seedprogress", function (seedData) {
Expand All @@ -107,7 +107,7 @@ const maps = (() => {
"Downloads finished";
status.caching_tiles_started = false;
setTimeout(() => {
top_bar("", "", "");
helper.top_bar("", "", "");
}, 2000);
});

Expand Down Expand Up @@ -368,7 +368,7 @@ const maps = (() => {
if (general.active_layer.includes("weather")) {
general.active_layer.splice(general.active_layer.indexOf("weather"), 1);

top_bar("", "", "");
helper.top_bar("", "", "");
map.removeLayer(weather_layer);
map.removeLayer(weather_layer0);
map.removeLayer(weather_layer1);
Expand Down Expand Up @@ -435,7 +435,7 @@ const maps = (() => {
map.removeLayer(weather_layer2);
map.removeLayer(weather_layer3);
let t = formDat(data[data.length - 5]);
top_bar(
helper.top_bar(
"",
t.year +
"." +
Expand All @@ -457,7 +457,7 @@ const maps = (() => {
map.removeLayer(weather_layer2);
map.removeLayer(weather_layer3);
let t = formDat(data[data.length - 4]);
top_bar(
helper.top_bar(
"",
t.year +
"." +
Expand All @@ -479,7 +479,7 @@ const maps = (() => {
map.removeLayer(weather_layer2);
map.removeLayer(weather_layer3);
let t = formDat(data[data.length - 3]);
top_bar(
helper.top_bar(
"",
t.year +
"." +
Expand All @@ -501,7 +501,7 @@ const maps = (() => {
map.addLayer(weather_layer2);
map.removeLayer(weather_layer3);
let t = formDat(data[data.length - 2]);
top_bar(
helper.top_bar(
"",
t.year +
"." +
Expand All @@ -522,7 +522,7 @@ const maps = (() => {
map.removeLayer(weather_layer2);
map.addLayer(weather_layer3);
let t = formDat(data[data.length - 1]);
top_bar(
helper.top_bar(
"",
t.year +
"." +
Expand Down
37 changes: 19 additions & 18 deletions application/assets/js/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const module = (() => {
navigator.getBattery().then(function (battery) {
battery.addEventListener("levelchange", function () {
if (battery_memory < battery.level) return false;
if (battery.level <= 0.3) {
if (battery.level <= 0.2 && status.tracking_running) {
module.pushLocalNotification(
"battery is weak",
"",
Expand Down Expand Up @@ -145,8 +145,8 @@ const module = (() => {
new L.GPX(url, {
async: true,
marker_options: {
startIconUrl: "assets/css/images/start.png",
endIconUrl: "assets/css/images/end.png",
startIconUrl: "/assets/css/images/start.png",
endIconUrl: "/assets/css/images/end.png",
},
})
.on("loaded", function (e) {
Expand All @@ -165,7 +165,9 @@ const module = (() => {
request.onsuccess = function () {
m(this.result);
};
request.onerror = function () {};
request.onerror = function (error) {
alert(error);
};
} catch (e) {}

if ("b2g" in navigator) {
Expand All @@ -175,7 +177,9 @@ const module = (() => {
request.onsuccess = function () {
m(this.result);
};
request.onerror = function () {};
request.onerror = function (error) {
alert(error);
};
} catch (e) {}
}

Expand All @@ -190,14 +194,11 @@ const module = (() => {
reader.onloadend = function (event) {
var gpx = reader.result;

// let a = parseGPX(gpx);
// hotline(a);

new L.GPX(gpx, {
async: true,
marker_options: {
startIconUrl: "assets/css/images/start.png",
endIconUrl: "assets/css/images/end.png",
startIconUrl: "/assets/css/images/start.png",
endIconUrl: "/assets/css/images/end.png",
},
})
.on("loaded", function (e) {
Expand Down Expand Up @@ -275,7 +276,7 @@ const module = (() => {
m(this.result);
};
request.onerror = function () {
side_toaster("file not found", 3000);
helper.side_toaster("file not found", 3000);
};
} catch (e) {}

Expand All @@ -287,7 +288,7 @@ const module = (() => {
m(this.result);
};
request.onerror = function (e) {
side_toaster(e + "error", 3000);
helper.side_toaster(e + "error", 3000);
};
} catch (e) {}
}
Expand Down Expand Up @@ -846,8 +847,11 @@ const module = (() => {
if (action == "destroy_tracking") {
clearInterval(tracking_interval);

try{ localStorage.removeItem("tracking_cache");
}catch(e){console.log(e)}
try {
localStorage.removeItem("tracking_cache");
} catch (e) {
console.log(e);
}

tracking_altitude = [];
document.getElementById("tracking-altitude").innerText = "";
Expand All @@ -858,12 +862,9 @@ const module = (() => {
document.querySelector("div#tracking-speed-average-time").innerText = "";
distances = [];



tracking_group.clearLayers();
hotline_group.clearLayers();


polyline_tracking = L.polyline(tracking_latlngs, path_option).addTo(
tracking_group
);
Expand Down Expand Up @@ -1068,7 +1069,7 @@ const module = (() => {
//Upload gpx file every 5min, unfortunately the update function doesn't work, so I have to combine create/delete
if (status.live_track) {
if (status.live_track_file_created == false) {
osm.osm_server_upload_gpx("live_track.gpx", toGPX());
osm.osm_server_upload_gpx("live_track.gpx", toGPX(), false);
status.live_track_file_created = true;
} else {
let calc_dif =
Expand Down
70 changes: 0 additions & 70 deletions application/assets/js/olc.js

This file was deleted.

10 changes: 3 additions & 7 deletions application/assets/js/osm.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
const osm = (() => {
let osm_server_upload_gpx = function (filename, gpx_data, notify) {
if (!general.osm_token) {
helper.side_toaster(
"looks like you are not connected to openstreetmap",
5000
);
return false;
let osm_server_upload_gpx = function (filename, gpx_data, notify = true) {
if (general.osm_token) {
helper.side_toaster("you are connected to openstreetmap", 5000);
}

let n = "Bearer " + general.osm_token;
Expand Down
1 change: 0 additions & 1 deletion application/assets/js/route-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ const rs = ((_) => {
let reset_routing = () => {
instructions = [];
jsonLayer.clearLayers();
//jsonLayer = L.geoJSON("", { color: "red" });
routing.data = "";
routing.active = false;
routing.loaded = false;
Expand Down
Loading

0 comments on commit bc76c4e

Please sign in to comment.