Skip to content

Commit

Permalink
toilets
Browse files Browse the repository at this point in the history
  • Loading branch information
strukturart committed Aug 29, 2024
1 parent 553592c commit 5a51337
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 74 deletions.
22 changes: 0 additions & 22 deletions application/assets/js/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,27 +113,6 @@ const helper = (() => {
}, time);
};

//get location by ip
let geoip = function (callback, key) {
const url = "https://api.ipbase.com/v2/info?apikey=" + key;
let xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.responseType = "json";
xhr.send();
xhr.error = function (err) {
helper.side_toaster(err, 3000);
};

xhr.onload = function () {
let responseObj = xhr.response;
let latlng = [
responseObj.data.location.latitude,
responseObj.data.location.longitude,
];
callback(latlng);
};
};

//delete file
let deleteFile = function (filename) {
let sdcard = "";
Expand Down Expand Up @@ -411,7 +390,6 @@ const helper = (() => {
add_script,
deleteFile,
isOnline,
geoip,
side_toaster,
renameFile,
downloadFile,
Expand Down
26 changes: 0 additions & 26 deletions application/assets/js/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -761,32 +761,6 @@ const module = (() => {
function calculateGainAndLoss(altitudes) {
let gain = 0;
let loss = 0;
/*
let previousValidAltitude = null;
for (let i = 0; i < altitudes.length; i++) {
const currentAltitude = altitudes[i];
// Skip null or inaccurate altitude values
if (currentAltitude === null || isNaN(currentAltitude)) {
continue;
}
if (previousValidAltitude !== null) {
const altitudeDifference = currentAltitude - previousValidAltitude;
if (Math.abs(altitudeDifference) <= threshold) {
if (altitudeDifference > 0) {
gain += altitudeDifference;
} else {
loss += Math.abs(altitudeDifference);
}
}
}
previousValidAltitude = currentAltitude;
}
*/

const highestAltitude = Math.max(...altitudes);
const lowestAltitude = Math.min(...altitudes);
Expand Down
7 changes: 7 additions & 0 deletions application/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,13 @@ document.addEventListener("DOMContentLoaded", function () {
'<div class="item" data-type="overpass" data-url="amenity=bar">Bar</div>'
);

document
.querySelector("div#overpass")
.insertAdjacentHTML(
"afterend",
'<div class="item" data-type="overpass" data-url="amenity=toilets">Toilets</div>'
);

document
.querySelector("div#overpass")
.insertAdjacentHTML(
Expand Down
26 changes: 0 additions & 26 deletions docs/assets/js/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -761,32 +761,6 @@ const module = (() => {
function calculateGainAndLoss(altitudes) {
let gain = 0;
let loss = 0;
/*
let previousValidAltitude = null;
for (let i = 0; i < altitudes.length; i++) {
const currentAltitude = altitudes[i];
// Skip null or inaccurate altitude values
if (currentAltitude === null || isNaN(currentAltitude)) {
continue;
}
if (previousValidAltitude !== null) {
const altitudeDifference = currentAltitude - previousValidAltitude;
if (Math.abs(altitudeDifference) <= threshold) {
if (altitudeDifference > 0) {
gain += altitudeDifference;
} else {
loss += Math.abs(altitudeDifference);
}
}
}
previousValidAltitude = currentAltitude;
}
*/

const highestAltitude = Math.max(...altitudes);
const lowestAltitude = Math.min(...altitudes);
Expand Down
7 changes: 7 additions & 0 deletions docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,13 @@ document.addEventListener("DOMContentLoaded", function () {
'<div class="item" data-type="overpass" data-url="amenity=bar">Bar</div>'
);

document
.querySelector("div#overpass")
.insertAdjacentHTML(
"afterend",
'<div class="item" data-type="overpass" data-url="amenity=toilets">Toilets</div>'
);

document
.querySelector("div#overpass")
.insertAdjacentHTML(
Expand Down

0 comments on commit 5a51337

Please sign in to comment.