+ 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);
+
+ $.removeCookie("_osm_location");
+ $.cookie("_osm_location", OSM.locationCookie(map), { secure: true, expires: expiry, path: "/" });
+ });
+
+ if ($.cookie("_osm_welcome") !== "hide") {
+ $(".welcome").addClass("visible");
+ }
+
+ $(".welcome .close").on("click", function () {
+ $(".welcome").removeClass("visible");
+ $.cookie("_osm_welcome", "hide", { secure: true, expires: expiry, path: "/" });
+ });
+
+ var bannerExpiry = new Date();
+ bannerExpiry.setYear(bannerExpiry.getFullYear() + 1);
+
+ $("#banner .close-wrap").on("click", function (e) {
+ var cookieId = e.target.id;
+ $("#banner").hide();
+ e.preventDefault();
+ if (cookieId) {
+ $.cookie(cookieId, "hide", { secure: true, expires: bannerExpiry, path: "/" });
+ }
+ });
+
+ if (OSM.PIWIK) {
+ map.on("layeradd", function (e) {
+ if (e.layer.options) {
+ var goal = OSM.PIWIK.goals[e.layer.options.keyid];
+
+ if (goal) {
+ $("body").trigger("piwikgoal", goal);
+ }
+ }
+ });