+ var placement = $("html").attr("dir") === "rtl" ? "right" : "left";
+ $(".leaflet-control .control-button").tooltip({ placement: placement, container: "body" });
+
+ var expiry = new Date();
+ expiry.setYear(expiry.getFullYear() + 10);
+
+ map.on("moveend layeradd layerremove", function () {
+ updateLinks(
+ map.getCenter().wrap(),
+ map.getZoom(),
+ map.getLayersCode(),
+ map._object);
+
+ Cookies.set("_osm_location", OSM.locationCookie(map), { secure: true, expires: expiry, path: "/", samesite: "lax" });
+ });
+
+ if (Cookies.get("_osm_welcome") !== "hide") {
+ $(".welcome").removeAttr("hidden");
+ }
+
+ $(".welcome .btn-close").on("click", function () {
+ $(".welcome").hide();
+ Cookies.set("_osm_welcome", "hide", { secure: true, expires: expiry, path: "/", samesite: "lax" });
+ });
+
+ var bannerExpiry = new Date();
+ bannerExpiry.setYear(bannerExpiry.getFullYear() + 1);
+
+ $("#banner .btn-close").on("click", function (e) {
+ var cookieId = e.target.id;
+ $("#banner").hide();
+ e.preventDefault();
+ if (cookieId) {
+ Cookies.set(cookieId, "hide", { secure: true, expires: bannerExpiry, path: "/", samesite: "lax" });
+ }
+ });
+
+ if (OSM.MATOMO) {
+ map.on("layeradd", function (e) {
+ if (e.layer.options) {
+ var goal = OSM.MATOMO.goals[e.layer.options.keyid];
+
+ if (goal) {
+ $("body").trigger("matomogoal", goal);
+ }
+ }
+ });