]> git.openstreetmap.org Git - rails.git/blob - app/assets/javascripts/leaflet.note.js
That new message in the HTML version of the mail should also be added to the plain...
[rails.git] / app / assets / javascripts / leaflet.note.js
1 L.OSM.note = function (options) {
2   var control = L.control(options);
3
4   control.onAdd = function (map) {
5     var $container = $('<div>')
6       .attr('class', 'control-note');
7
8     var link = $('<a>')
9       .attr('class', 'control-button')
10       .attr('href', '#')
11       .html('<span class="icon note"></span>')
12       .appendTo($container);
13
14     map.on('zoomend', update);
15
16     function update() {
17       var disabled = OSM.STATUS === "database_offline" || map.getZoom() < 12;
18       link
19         .toggleClass('disabled', disabled)
20         .attr('data-original-title', I18n.t(disabled ?
21           'javascripts.site.createnote_disabled_tooltip' :
22           'javascripts.site.createnote_tooltip'));
23     }
24
25     update();
26
27     return $container[0];
28   };
29
30   return control;
31 };