1 L.OSM.note = function (options) {
2 var control = L.control(options);
4 control.onAdd = function (map) {
5 var $container = $("<div>")
6 .attr("class", "control-note");
9 .attr("class", "control-button")
11 .html("<span class=\"icon note\"></span>")
12 .appendTo($container);
14 map.on("zoomend", update);
17 var wasDisabled = link.hasClass("disabled"),
18 isDisabled = OSM.STATUS === "database_offline" || map.getZoom() < 12;
20 .toggleClass("disabled", isDisabled)
21 .attr("data-bs-original-title", I18n.t(isDisabled ?
22 "javascripts.site.createnote_disabled_tooltip" :
23 "javascripts.site.createnote_tooltip"));
25 if (isDisabled && !wasDisabled) {
26 link.trigger("disabled");
27 } else if (wasDisabled && !isDisabled) {
28 link.trigger("enabled");