Data can now be saved and moved around! Also, data will be formatted appropriately.
+
2024 - 05 - 15 | 16:37 | Version 0.0.5
You can now mark collectibles as completed; the `Show All`, `Hide All`, `Show Completed` and `Hide Completed` buttons now work properly. The Youtube video player has now been fixed of a bug where it wouldn't go to the proper timestamp.
-
2024 - 05 - 14 / 13:33
+
2024 - 05 - 14 | 13:33 | Version 0.0.4
The Cayo Perico Heist and the Casino Heist now have timers in the `Tools` section.
-
2024 - 05 - 14 / 11:07
+
2024 - 05 - 14 | 11:07 | Version 0.0.3
Now the map saves the last tile selection, alongside the last zoom and coordinate you were looking at, so that refreshing the page doesn't zoom you out completely. Also having a link that points to something in the GUI will open it on load.
-
2024 - 05 - 13 / 10:57
+
2024 - 05 - 13 | 10:57 | Version 0.0.2
Added tile selection to map, now able to switch between `game`, `render` and `print`
-
2024 - 05 - 10 / 23:22
+
2024 - 05 - 10 | 23:22 | Version 0.0.1
Made the map work, aligned the SVGs kindly stolen from provided by GTALens.com
Manually got all the datapoints for Action Figures and descriptions
diff --git a/gtav-interactive-map/script.js b/gtav-interactive-map/script.js
index 7d62b84..8edd558 100644
--- a/gtav-interactive-map/script.js
+++ b/gtav-interactive-map/script.js
@@ -2,6 +2,7 @@
let insertMarkersMode = false;
let saveData = {
+ version: "0.1.0",
selectedTileLayer: "game",
lastZoom: 2,
lastCoords: [38.959409, -75.410156],
@@ -15,17 +16,44 @@ let saveData = {
completionDataLastPickFigurines: "hideAll",
}
-let temporarySaveDataStr = localStorage.getItem("saveData");
-if (temporarySaveDataStr != null) {
- let temporarySaveData = JSON.parse(temporarySaveDataStr, (key, value) => (["completionDataFigurines"].includes(key) ? new Set(value) : value));
- for (key in saveData)
- if (temporarySaveData[key] == null)
- temporarySaveData[key] = saveData[key];
-
- saveData = temporarySaveData;
+function loadInSaveData(dataStr) {
+ if (dataStr != null) {
+ let temporarySaveData = JSON.parse(dataStr, (key, value) => (["completionDataFigurines"].includes(key) ? new Set(value) : value));
+ if (temporarySaveData.version !== saveData.version) {
+ if (temporarySaveData.version === undefined) {
+ return;
+ }
+ // Here you check the version tag in the savedata and modify it accordingly to make it match the current save data type.
+ }
+ saveData = temporarySaveData;
+ }
}
+loadInSaveData(localStorage.getItem("saveData"));
saveDataSave();
+document.getElementById("backupDataButton").addEventListener("click", function() {
+ saveDataSave();
+ var element = document.createElement('a');
+ element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(localStorage.getItem("saveData")));
+ element.setAttribute('download', "GTA5InteractiveMapData.json");
+ element.style.display = 'none';
+ document.body.appendChild(element);
+ element.click();
+ document.body.removeChild(element);
+});
+
+document.getElementById("backupDataFile").addEventListener("change", function(e) {
+ let reader = new FileReader();
+ reader.readAsText(e.target.files[0]);
+ reader.addEventListener("load", function(res) {
+ console.log(res);
+ console.log(res.target.result);
+ loadInSaveData(res.target.result);
+ saveDataSave();
+ window.location.reload();
+ });
+});
+
let player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('player', {