X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/c8fb5ad24c5751bd2d43b86e4359381d200af066..e4504399ae55525f22a7fb47e0c47434cef8cf0a:/app/assets/javascripts/leaflet.note.js?ds=inline diff --git a/app/assets/javascripts/leaflet.note.js b/app/assets/javascripts/leaflet.note.js index a38e012de..c0f72af20 100644 --- a/app/assets/javascripts/leaflet.note.js +++ b/app/assets/javascripts/leaflet.note.js @@ -5,14 +5,25 @@ L.OSM.note = function (options) { var $container = $('
') .attr('class', 'control-note'); - $('') - .attr('id', 'createnoteanchor') - .attr('class', 'control-button geolink') - .attr('data-minzoom', 12) + var link = $('') + .attr('class', 'control-button') .attr('href', '#') .html('') .appendTo($container); + map.on('zoomend', update); + + update(); + + function update() { + var disabled = map.getZoom() < 12; + link + .toggleClass('disabled', disabled) + .attr('data-original-title', I18n.t(disabled ? + 'javascripts.site.createnote_disabled_tooltip' : + 'javascripts.site.createnote_tooltip')); + } + return $container[0]; };