-
Notifications
You must be signed in to change notification settings - Fork 1
/
getMapZoom.user.js
29 lines (25 loc) · 985 Bytes
/
getMapZoom.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// ==UserScript==
// @name Get map zoom
// @namespace http://tampermonkey.net/
// @version 1.0.2
// @run-at document-end
// @description customize your mission Icons
// @author KeineAhnung
// @include https://rettungssimulator.online/*
// @grant none
// ==/UserScript==
const parentContainer = document.querySelector("div.leaflet-control-zoom");
const currentZoomLevel = mymap.getZoom();
const infoElement = document.createElement("a");
infoElement.href = "#";
infoElement.id = "currentMapZoomLevel";
infoElement.style.cursor = "default";
infoElement.style.fontWeight = "700";
infoElement.dataset.tooltip = "Zoomlevel der Karte";
infoElement.textContent = currentZoomLevel;
parentContainer.insertAdjacentElement("beforeend", infoElement);
const updateZoomLevel = function () {
const currentZoomLevel = mymap.getZoom();
document.querySelector("#currentMapZoomLevel").textContent = currentZoomLevel;
};
mymap.on("zoom", updateZoomLevel);