Update templates/map.html
Browse files- templates/map.html +121 -210
templates/map.html
CHANGED
|
@@ -12,43 +12,43 @@
|
|
| 12 |
<!--link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet-groupedlayercontrol/0.6.1/leaflet.groupedlayercontrol.css"/-->
|
| 13 |
<script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js"></script>
|
| 14 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" />
|
| 15 |
-
|
| 16 |
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
| 17 |
<link rel="stylesheet" href="/static/style.css" />
|
| 18 |
</head>
|
| 19 |
|
| 20 |
-
<body>
|
| 21 |
-
<nav class="navbar navbar-expand-sm navbar-dark fixed-top
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
|
|
|
| 49 |
</div>
|
| 50 |
-
</
|
| 51 |
-
</nav>
|
| 52 |
<!--nav class="navbar is-fixed-top" role="navigation" aria-label="main navigation">
|
| 53 |
<div class="navbar-brand">
|
| 54 |
Tarkov Map
|
|
@@ -141,84 +141,84 @@
|
|
| 141 |
|
| 142 |
let currentZoom = 3;
|
| 143 |
|
| 144 |
-
|
| 145 |
// Initialize WebSocket connection
|
| 146 |
const ws = new WebSocket(`wss://sebastiankay-eft-group-map-websocket.hf.space/ws`);
|
| 147 |
-
|
| 148 |
// WebSocket event handlers
|
| 149 |
-
ws.onmessage = function(event) {
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
};
|
| 180 |
-
|
| 181 |
-
ws.onopen = function(event) {
|
| 182 |
-
|
| 183 |
};
|
| 184 |
-
|
| 185 |
// Function to remove all markers
|
| 186 |
function removeAllMarkers() {
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
}
|
| 191 |
}
|
| 192 |
-
|
| 193 |
-
|
|
|
|
| 194 |
}
|
| 195 |
-
|
| 196 |
// Function to load and display local marker data
|
| 197 |
function loadLocalData() {
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
}
|
| 203 |
-
} else {
|
| 204 |
-
localStorage.removeItem("last_marker");
|
| 205 |
-
}
|
| 206 |
-
|
| 207 |
-
const markerData = localStorage.getItem("last_marker");
|
| 208 |
-
if (markerData) {
|
| 209 |
-
const parsedData = JSON.parse(markerData);
|
| 210 |
-
// Use the new addMarker function with all required parameters
|
| 211 |
-
addMarker(
|
| 212 |
-
parsedData.x,
|
| 213 |
-
parsedData.y,
|
| 214 |
-
parsedData.z,
|
| 215 |
-
parsedData.timestamp,
|
| 216 |
-
parsedData.preview || false,
|
| 217 |
-
parsedData.actualmap || "Unbekannte Map",
|
| 218 |
-
parsedData.playername || "Unnamed Player",
|
| 219 |
-
parsedData.markercolor || false
|
| 220 |
-
);
|
| 221 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
}
|
| 223 |
|
| 224 |
const images = {
|
|
@@ -1030,97 +1030,11 @@
|
|
| 1030 |
startCountdown("rade_time_remain")
|
| 1031 |
};
|
| 1032 |
|
|
|
|
| 1033 |
// Funktion zum Hinzufügen eines Markers
|
| 1034 |
function addMarker(x, y, z, timestamp, preview, actualmap, playername, markercolor) {
|
| 1035 |
|
| 1036 |
-
|
| 1037 |
-
const position = {
|
| 1038 |
-
x: parseFloat(x),
|
| 1039 |
-
y: parseFloat(y),
|
| 1040 |
-
z: parseFloat(z)
|
| 1041 |
-
};
|
| 1042 |
-
|
| 1043 |
-
if (!positionIsInBounds(position)) {
|
| 1044 |
-
console.error("Position außerhalb der Karte:", position);
|
| 1045 |
-
return;
|
| 1046 |
-
}
|
| 1047 |
-
|
| 1048 |
-
// SVG-Icon als String mit dynamischer Farbe
|
| 1049 |
-
let markerColor;
|
| 1050 |
-
if (markercolor) {
|
| 1051 |
-
markerColor = '#' + markercolor;
|
| 1052 |
-
} else {
|
| 1053 |
-
markerColor = 'currentColor';
|
| 1054 |
-
}
|
| 1055 |
-
const svgString = `
|
| 1056 |
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" class="marker-svg">
|
| 1057 |
-
<path d="M60.8 50.5 38 72.9 15.2 50.5 8.1 3.9 38 13.3l29.8-9.4-7 46.6z" style="stroke-linecap:round;stroke-linejoin:round;fill:#fff;stroke:#fff;stroke-width:4.4px"/><path d="M58.8 49.4 38 69.9 17.1 49.4 10.7 6.9 38 15.5l27.2-8.6-6.4 42.5z" style="fill:${markerColor};stroke:#000;stroke-width:4px;stroke-linecap:round;stroke-linejoin:round"/>
|
| 1058 |
-
</svg>
|
| 1059 |
-
`;
|
| 1060 |
-
const svgString2 = `
|
| 1061 |
-
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 384 512' class="marker-svg">
|
| 1062 |
-
<path fill='${markerColor}' d='M172.3 501.7C27 291 0 269.4 0 192 0 86 86 0 192 0s192 86 192 192c0 77.4-27 99-172.3 309.7-9.5 13.8-29.9 13.8-39.5 0zM192 272c44.2 0 80-35.8 80-80s-35.8-80-80-80-80 35.8-80 80 35.8 80 80 80z'/>
|
| 1063 |
-
</svg>
|
| 1064 |
-
`;
|
| 1065 |
-
|
| 1066 |
-
// DivIcon mit dynamischem SVG erstellen
|
| 1067 |
-
const markerIcon = L.divIcon({
|
| 1068 |
-
html: svgString,
|
| 1069 |
-
className: 'custom-marker',
|
| 1070 |
-
iconSize: [32, 32],
|
| 1071 |
-
iconAnchor: [16, 32],
|
| 1072 |
-
popupAnchor: [0, -32]
|
| 1073 |
-
});
|
| 1074 |
-
|
| 1075 |
-
const playerMarkerName = playername.toLowerCase().replaceAll(" ", "-")
|
| 1076 |
-
|
| 1077 |
-
// Remove old marker for this player, if it exists
|
| 1078 |
-
if (playerMarkers[playerMarkerName]) {
|
| 1079 |
-
map.removeLayer(playerMarkers[playerMarkerName]);
|
| 1080 |
-
}
|
| 1081 |
-
|
| 1082 |
-
// Create new marker
|
| 1083 |
-
playerMarkers[playerMarkerName] = L.marker(pos(position), {
|
| 1084 |
-
icon: markerIcon,
|
| 1085 |
-
position: position,
|
| 1086 |
-
title: `Koordinaten: ${x}, ${y}, ${z}`,
|
| 1087 |
-
riseOnHover: true,
|
| 1088 |
-
zIndexOffset: 400
|
| 1089 |
-
});
|
| 1090 |
-
|
| 1091 |
-
// Popup mit Informationen erstellen
|
| 1092 |
-
const popupContent = `
|
| 1093 |
-
<div class="marker-popup">
|
| 1094 |
-
${playername ? `<strong>Player: ${playername}</strong>` : ''}
|
| 1095 |
-
<strong>Koordinaten:</strong>
|
| 1096 |
-
<span>X: ${x} Y: ${y} Z: ${z}</span>
|
| 1097 |
-
${preview ? `<img class="preview-image" src="${preview}"><br>` : ''}
|
| 1098 |
-
<small>${timestamp}</small>
|
| 1099 |
-
</div>
|
| 1100 |
-
`;
|
| 1101 |
-
playerMarkers[playerMarkerName].bindPopup(popupContent, {
|
| 1102 |
-
maxWidth: 250,
|
| 1103 |
-
minWidth: 150,
|
| 1104 |
-
autoClose: true,
|
| 1105 |
-
closeOnClick: true
|
| 1106 |
-
});
|
| 1107 |
-
|
| 1108 |
-
// Marker zur Karte hinzufügen
|
| 1109 |
-
playerMarkers[playerMarkerName].addTo(map);
|
| 1110 |
-
|
| 1111 |
-
// Karte auf Marker zentrieren
|
| 1112 |
-
map.setView(pos(position), map.getZoom(), {
|
| 1113 |
-
animate: true,
|
| 1114 |
-
duration: 0.5
|
| 1115 |
-
});
|
| 1116 |
-
|
| 1117 |
-
console.log("Neuer Marker gesetzt für " + playername + ": " + position);
|
| 1118 |
-
}
|
| 1119 |
-
|
| 1120 |
-
|
| 1121 |
-
function addMarker_OLD(x, y, z, timestamp, preview = false, actualmap = false, playername = false, markercolor = false) {
|
| 1122 |
-
// Position validieren
|
| 1123 |
-
|
| 1124 |
const position = {
|
| 1125 |
x: parseFloat(x),
|
| 1126 |
y: parseFloat(y),
|
|
@@ -1133,9 +1047,7 @@
|
|
| 1133 |
}
|
| 1134 |
|
| 1135 |
// SVG-Icon als String mit dynamischer Farbe
|
| 1136 |
-
|
| 1137 |
let markerColor;
|
| 1138 |
-
|
| 1139 |
if (markercolor) {
|
| 1140 |
markerColor = '#' + markercolor;
|
| 1141 |
} else {
|
|
@@ -1157,36 +1069,37 @@
|
|
| 1157 |
html: svgString,
|
| 1158 |
className: 'custom-marker',
|
| 1159 |
iconSize: [32, 32],
|
| 1160 |
-
iconAnchor: [16, 32],
|
| 1161 |
popupAnchor: [0, -32]
|
| 1162 |
});
|
| 1163 |
|
| 1164 |
-
|
| 1165 |
-
|
| 1166 |
-
|
|
|
|
|
|
|
| 1167 |
}
|
| 1168 |
|
| 1169 |
-
//
|
| 1170 |
-
|
| 1171 |
icon: markerIcon,
|
| 1172 |
position: position,
|
| 1173 |
title: `Koordinaten: ${x}, ${y}, ${z}`,
|
| 1174 |
-
riseOnHover: true
|
|
|
|
| 1175 |
});
|
| 1176 |
|
| 1177 |
// Popup mit Informationen erstellen
|
| 1178 |
const popupContent = `
|
| 1179 |
-
|
| 1180 |
-
|
| 1181 |
-
|
| 1182 |
-
|
| 1183 |
-
|
| 1184 |
-
|
| 1185 |
-
|
| 1186 |
-
|
| 1187 |
-
|
| 1188 |
-
|
| 1189 |
-
currentMarker.bindPopup(popupContent, {
|
| 1190 |
maxWidth: 250,
|
| 1191 |
minWidth: 150,
|
| 1192 |
autoClose: true,
|
|
@@ -1194,7 +1107,7 @@
|
|
| 1194 |
});
|
| 1195 |
|
| 1196 |
// Marker zur Karte hinzufügen
|
| 1197 |
-
|
| 1198 |
|
| 1199 |
// Karte auf Marker zentrieren
|
| 1200 |
map.setView(pos(position), map.getZoom(), {
|
|
@@ -1202,9 +1115,7 @@
|
|
| 1202 |
duration: 0.5
|
| 1203 |
});
|
| 1204 |
|
| 1205 |
-
console.log("Neuer Marker gesetzt: " + position);
|
| 1206 |
-
console.log("currentMarker: ")
|
| 1207 |
-
console.log(currentMarker)
|
| 1208 |
}
|
| 1209 |
|
| 1210 |
document.onload = loadLocalData()
|
|
|
|
| 12 |
<!--link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet-groupedlayercontrol/0.6.1/leaflet.groupedlayercontrol.css"/-->
|
| 13 |
<script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js"></script>
|
| 14 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" />
|
| 15 |
+
<!--link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.2/css/bulma.min.css" /-->
|
| 16 |
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
| 17 |
<link rel="stylesheet" href="/static/style.css" />
|
| 18 |
</head>
|
| 19 |
|
| 20 |
+
<body data-bs-theme="dark">
|
| 21 |
+
<nav class="navbar navbar-expand-sm navbar-dark fixed-top">
|
| 22 |
+
<div class="container-fluid">
|
| 23 |
+
<a class="navbar-brand" href="#">Tarkov Map</a>
|
| 24 |
+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
|
| 25 |
+
<span class="navbar-toggler-icon"></span>
|
| 26 |
+
</button>
|
| 27 |
+
<div class="collapse navbar-collapse" id="navbarNavDropdown">
|
| 28 |
+
<ul class="navbar-nav">
|
| 29 |
+
<li class="nav-item">
|
| 30 |
+
<a class="nav-link active" aria-current="page" href="#">Home</a>
|
| 31 |
+
</li>
|
| 32 |
+
<li class="nav-item dropdown">
|
| 33 |
+
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
| 34 |
+
Maps
|
| 35 |
+
</a>
|
| 36 |
+
<ul class="dropdown-menu">
|
| 37 |
+
<li><a href="/map/woods" class="dropdown-item">Woods</a></li>
|
| 38 |
+
<li><a href="/map/shoreline" class="dropdown-item">Shoreline</a></li>
|
| 39 |
+
<li><a href="/map/lighthouse" class="dropdown-item">Lighthouse</a></li>
|
| 40 |
+
<li><a href="/map/customs" class="dropdown-item">Customs</a></li>
|
| 41 |
+
<li><a href="/map/interchange" class="dropdown-item">Interchange</a></li>
|
| 42 |
+
<li><a href="/map/streets-of-tarkov" class="dropdown-item">Streets of Tarkov</a></li>
|
| 43 |
+
<li><a href="/map/ground-zero" class="dropdown-item">Ground Zero</a></li>
|
| 44 |
+
<li><a href="/map/reserve" class="dropdown-item">Reserve</a></li>
|
| 45 |
+
<li><a href="/map/factory" class="dropdown-item">Factory</a></li>
|
| 46 |
+
</ul>
|
| 47 |
+
</li>
|
| 48 |
+
</ul>
|
| 49 |
+
</div>
|
| 50 |
</div>
|
| 51 |
+
</nav>
|
|
|
|
| 52 |
<!--nav class="navbar is-fixed-top" role="navigation" aria-label="main navigation">
|
| 53 |
<div class="navbar-brand">
|
| 54 |
Tarkov Map
|
|
|
|
| 141 |
|
| 142 |
let currentZoom = 3;
|
| 143 |
|
| 144 |
+
//MARK: INIT WEBSOCKET
|
| 145 |
// Initialize WebSocket connection
|
| 146 |
const ws = new WebSocket(`wss://sebastiankay-eft-group-map-websocket.hf.space/ws`);
|
| 147 |
+
|
| 148 |
// WebSocket event handlers
|
| 149 |
+
ws.onmessage = function (event) {
|
| 150 |
+
console.log(event.data);
|
| 151 |
+
const data = JSON.parse(event.data);
|
| 152 |
+
|
| 153 |
+
switch (data.type) {
|
| 154 |
+
case "coordinates":
|
| 155 |
+
const parsedData = data.data;
|
| 156 |
+
localStorage.setItem("last_marker", JSON.stringify(parsedData));
|
| 157 |
+
loadLocalData();
|
| 158 |
+
break;
|
| 159 |
+
|
| 160 |
+
case "location_map":
|
| 161 |
+
const map_name = data.data.map.toLowerCase().replaceAll(" ", "-");
|
| 162 |
+
localStorage.setItem("last_map_name", map_name);
|
| 163 |
+
localStorage.removeItem("last_marker");
|
| 164 |
+
removeAllMarkers(); // Clear all markers when the map changes
|
| 165 |
+
if (!location.pathname.includes(map_name)) {
|
| 166 |
+
location.pathname = `/map/${map_name}`;
|
| 167 |
+
} else {
|
| 168 |
+
location.reload();
|
| 169 |
+
}
|
| 170 |
+
break;
|
| 171 |
+
|
| 172 |
+
case "new_rade_data":
|
| 173 |
+
console.log(data.data);
|
| 174 |
+
const radeData = JSON.parse(data.data);
|
| 175 |
+
localStorage.setItem("rade_data", JSON.stringify(radeData));
|
| 176 |
+
loadLocalData();
|
| 177 |
+
break;
|
| 178 |
+
}
|
| 179 |
};
|
| 180 |
+
|
| 181 |
+
ws.onopen = function (event) {
|
| 182 |
+
ws.send(JSON.stringify({ type: "join", group: wsgroup }));
|
| 183 |
};
|
| 184 |
+
|
| 185 |
// Function to remove all markers
|
| 186 |
function removeAllMarkers() {
|
| 187 |
+
for (const playername in playerMarkers) {
|
| 188 |
+
if (playerMarkers.hasOwnProperty(playername)) {
|
| 189 |
+
map.removeLayer(playerMarkers[playername]);
|
|
|
|
| 190 |
}
|
| 191 |
+
}
|
| 192 |
+
Object.keys(playerMarkers).forEach(key => delete playerMarkers[key]);
|
| 193 |
+
console.log("Alle Marker wurden entfernt.");
|
| 194 |
}
|
| 195 |
+
|
| 196 |
// Function to load and display local marker data
|
| 197 |
function loadLocalData() {
|
| 198 |
+
const map_name = localStorage.getItem("last_map_name");
|
| 199 |
+
if (map_name) {
|
| 200 |
+
if (!location.pathname.includes(map_name)) {
|
| 201 |
+
localStorage.removeItem("last_marker");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
}
|
| 203 |
+
} else {
|
| 204 |
+
localStorage.removeItem("last_marker");
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
const markerData = localStorage.getItem("last_marker");
|
| 208 |
+
if (markerData) {
|
| 209 |
+
const parsedData = JSON.parse(markerData);
|
| 210 |
+
// Use the new addMarker function with all required parameters
|
| 211 |
+
addMarker(
|
| 212 |
+
parsedData.x,
|
| 213 |
+
parsedData.y,
|
| 214 |
+
parsedData.z,
|
| 215 |
+
parsedData.timestamp,
|
| 216 |
+
parsedData.preview || false,
|
| 217 |
+
parsedData.actualmap || "Unbekannte Map",
|
| 218 |
+
parsedData.playername || "Unnamed Player",
|
| 219 |
+
parsedData.markercolor || false
|
| 220 |
+
);
|
| 221 |
+
}
|
| 222 |
}
|
| 223 |
|
| 224 |
const images = {
|
|
|
|
| 1030 |
startCountdown("rade_time_remain")
|
| 1031 |
};
|
| 1032 |
|
| 1033 |
+
//MARK: ADDMARKER
|
| 1034 |
// Funktion zum Hinzufügen eines Markers
|
| 1035 |
function addMarker(x, y, z, timestamp, preview, actualmap, playername, markercolor) {
|
| 1036 |
|
| 1037 |
+
// Validate position
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1038 |
const position = {
|
| 1039 |
x: parseFloat(x),
|
| 1040 |
y: parseFloat(y),
|
|
|
|
| 1047 |
}
|
| 1048 |
|
| 1049 |
// SVG-Icon als String mit dynamischer Farbe
|
|
|
|
| 1050 |
let markerColor;
|
|
|
|
| 1051 |
if (markercolor) {
|
| 1052 |
markerColor = '#' + markercolor;
|
| 1053 |
} else {
|
|
|
|
| 1069 |
html: svgString,
|
| 1070 |
className: 'custom-marker',
|
| 1071 |
iconSize: [32, 32],
|
| 1072 |
+
iconAnchor: [16, 32],
|
| 1073 |
popupAnchor: [0, -32]
|
| 1074 |
});
|
| 1075 |
|
| 1076 |
+
const playerMarkerName = playername.toLowerCase().replaceAll(" ", "-")
|
| 1077 |
+
|
| 1078 |
+
// Remove old marker for this player, if it exists
|
| 1079 |
+
if (playerMarkers[playerMarkerName]) {
|
| 1080 |
+
map.removeLayer(playerMarkers[playerMarkerName]);
|
| 1081 |
}
|
| 1082 |
|
| 1083 |
+
// Create new marker
|
| 1084 |
+
playerMarkers[playerMarkerName] = L.marker(pos(position), {
|
| 1085 |
icon: markerIcon,
|
| 1086 |
position: position,
|
| 1087 |
title: `Koordinaten: ${x}, ${y}, ${z}`,
|
| 1088 |
+
riseOnHover: true,
|
| 1089 |
+
zIndexOffset: 400
|
| 1090 |
});
|
| 1091 |
|
| 1092 |
// Popup mit Informationen erstellen
|
| 1093 |
const popupContent = `
|
| 1094 |
+
<div class="marker-popup">
|
| 1095 |
+
${playername ? `<strong>Player: ${playername}</strong>` : ''}
|
| 1096 |
+
<strong>Koordinaten:</strong>
|
| 1097 |
+
<span>X: ${x} Y: ${y} Z: ${z}</span>
|
| 1098 |
+
${preview ? `<img class="preview-image" src="${preview}"><br>` : ''}
|
| 1099 |
+
<small>${timestamp}</small>
|
| 1100 |
+
</div>
|
| 1101 |
+
`;
|
| 1102 |
+
playerMarkers[playerMarkerName].bindPopup(popupContent, {
|
|
|
|
|
|
|
| 1103 |
maxWidth: 250,
|
| 1104 |
minWidth: 150,
|
| 1105 |
autoClose: true,
|
|
|
|
| 1107 |
});
|
| 1108 |
|
| 1109 |
// Marker zur Karte hinzufügen
|
| 1110 |
+
playerMarkers[playerMarkerName].addTo(map);
|
| 1111 |
|
| 1112 |
// Karte auf Marker zentrieren
|
| 1113 |
map.setView(pos(position), map.getZoom(), {
|
|
|
|
| 1115 |
duration: 0.5
|
| 1116 |
});
|
| 1117 |
|
| 1118 |
+
console.log("Neuer Marker gesetzt für " + playername + ": " + position);
|
|
|
|
|
|
|
| 1119 |
}
|
| 1120 |
|
| 1121 |
document.onload = loadLocalData()
|