Skip to content

Commit

Permalink
in retrospect, this shouldn't have been here
Browse files Browse the repository at this point in the history
  • Loading branch information
StrawberryMaster committed Jul 29, 2024
1 parent a39b4c5 commit 812a0c3
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions static/js/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,6 @@ function importData() {

document.querySelector("#import-data").addEventListener("click", importData);

// Helper functions
function handle_removal(button) {
button.addEventListener("click", () => {
button.parentElement.remove();
});
}

function handle_select(select) {
select.addEventListener("change", () => {
select.setAttribute("data-selected", select.value);
});
}

// We now import the data
function importPoints(data) {
const inputs = document.querySelector("#inputs");
Expand All @@ -99,15 +86,13 @@ function importPoints(data) {
const latitude = pointData.latitude;
pointElement.querySelector("input.latitude").value = latitude.slice(0, -1);
pointElement.querySelector("select.latitude").setAttribute("data-selected", latitude.slice(-1));
handle_select(pointElement.querySelector("select.latitude"));
if (latitude.slice(-1) === "S") {
pointElement.querySelector("select.latitude").selectedIndex = 1;
}

const longitude = pointData.longitude;
pointElement.querySelector("input.longitude").value = longitude.slice(0, -1);
pointElement.querySelector("select.longitude").setAttribute("data-selected", longitude.slice(-1));
handle_select(pointElement.querySelector("select.longitude"));
if (longitude.slice(-1) === "W") {
pointElement.querySelector("select.longitude").selectedIndex = 1;
}
Expand All @@ -121,7 +106,6 @@ function importPoints(data) {
}
pointElement.querySelector("input.speed").value = speed;
pointElement.querySelector("select.speed").setAttribute("data-selected", unit);
handle_select(pointElement.querySelector("select.speed"));

const stage = pointData.stage;
const stageSelect = pointElement.querySelector(".stage");
Expand All @@ -130,7 +114,6 @@ function importPoints(data) {
option.selected = true;
}
});
handle_select(stageSelect);

handle_removal(pointElement.querySelector(".remove"));
}
Expand Down

0 comments on commit 812a0c3

Please sign in to comment.