Skip to content

Commit

Permalink
rewrote these functions with the libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
FallBackITA27 committed Jun 9, 2024
1 parent 9f9970b commit 8533278
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 50 deletions.
22 changes: 12 additions & 10 deletions gtav-interactive-map/menus/settings/data.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
function dataSettings() {
resetContentPart2();
let optionDiv = document.createElement("div");
optionDiv.innerHTML = "Backup Data<p>Click Here</p>";
let backupDataBtn = new OptionDivFactory(
"Backup Data",
"Click Here"
).createArrowless();
contentPart2.append(backupDataBtn);

optionDiv.addEventListener("click", function () {
backupDataBtn.addEventListener("click", function () {
saveDataSave();
var element = document.createElement("a");
element.setAttribute(
Expand All @@ -18,12 +21,13 @@ function dataSettings() {
document.body.removeChild(element);
});

contentPart2.append(optionDiv);
let loadBackupDataBtn = new OptionDivFactory(
"Load Backup Data",
"Click Here"
).createArrowless();
contentPart2.append(loadBackupDataBtn);

let option2Div = document.createElement("div");
option2Div.innerHTML = "Load Backup Data<p>Click Here</p>";

option2Div.addEventListener("click", function () {
loadBackupDataBtn.addEventListener("click", function () {
var element = document.createElement("input");
element.type = "File";
element.accept = "application/json, text/plain";
Expand All @@ -41,6 +45,4 @@ function dataSettings() {
element.click();
document.body.removeChild(element);
});

contentPart2.append(option2Div);
}
25 changes: 5 additions & 20 deletions gtav-interactive-map/menus/settings/debug.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
function debugSettings() {
resetContentPart2();
let optionDiv = document.createElement("div");
optionDiv.innerHTML = "On Click Coordinates";

let interactiveDiv = document.createElement("div");

let img1 = document.createElement("img");
img1.src = "./websiteIcons/small_arr_left.svg";
interactiveDiv.appendChild(img1);

interactiveDiv.innerHTML += `<p>${
let optionDiv = new OptionDivFactory(
"On Click Coordinates",
saveData.pointerMode ? "True" : "False"
}</p>`;

let img2 = document.createElement("img");
img2.src = "./websiteIcons/small_arr_right.svg";
interactiveDiv.appendChild(img2);
interactiveDiv.style = "display: flex; align-items: center;";
).createArrowful();
contentPart2.append(optionDiv);

optionDiv.appendChild(interactiveDiv);
optionDiv.addEventListener("click", function () {
saveData.pointerMode = !saveData.pointerMode;
saveDataSave();
interactiveDiv.children[1].innerHTML = saveData.pointerMode
optionDiv.children[0].children[1].innerHTML = saveData.pointerMode
? "True"
: "False";

Expand All @@ -32,6 +19,4 @@ function debugSettings() {
map.off("click", clickDebugFunction);
}
});

contentPart2.append(optionDiv);
}
24 changes: 4 additions & 20 deletions gtav-interactive-map/menus/settings/mapStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,14 @@ function mapStyleSettings() {
const names = ["game", "render", "print"];
const namesDisp = ["In Game", "Satellite", "Game Manual"];

let optionDiv = document.createElement("div");
optionDiv.innerHTML = "Map Style";

let interactiveDiv = document.createElement("div");

let img1 = document.createElement("img");
img1.src = "./websiteIcons/small_arr_left.svg";
interactiveDiv.appendChild(img1);

interactiveDiv.innerHTML += `<p>${
let optionDiv = new OptionDivFactory(
"Map Style",
namesDisp[names.indexOf(saveData.selectedTileLayer)]
}</p>`;

let img2 = document.createElement("img");
img2.src = "./websiteIcons/small_arr_right.svg";
interactiveDiv.appendChild(img2);

interactiveDiv.style = "display: flex; align-items: center;";
optionDiv.appendChild(interactiveDiv);

).createArrowful();
contentPart2.append(optionDiv);

function refreshMap(idx) {
interactiveDiv.children[1].innerHTML = namesDisp[idx];
optionDiv.children[0].children[1].innerHTML = namesDisp[idx];
constantData.tileLayers.mainMap[saveData.selectedTileLayer].remove();
saveData.selectedTileLayer = names[idx];
saveDataSave();
Expand Down

0 comments on commit 8533278

Please sign in to comment.