X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/9d5b81094c69a02782faead1528ef32ffcc48aea..8ca781ac75e7b4627a2c2ccdf7aee84c4771b759:/app/assets/javascripts/leaflet.note.js diff --git a/app/assets/javascripts/leaflet.note.js b/app/assets/javascripts/leaflet.note.js index 77fb9baff..c0f72af20 100644 --- a/app/assets/javascripts/leaflet.note.js +++ b/app/assets/javascripts/leaflet.note.js @@ -5,13 +5,25 @@ L.OSM.note = function (options) { var $container = $('
') .attr('class', 'control-note'); - $('') + var link = $('') .attr('class', 'control-button') .attr('href', '#') - .attr('title', I18n.t('javascripts.notes.new.add')) .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]; };