X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/34e251c225c7903b64f1fda2b594dd1c70aeeb93..043d29fd7eb72048cf5d07edfbc20ec5c25af708:/app/assets/javascripts/leaflet.key.js
diff --git a/app/assets/javascripts/leaflet.key.js b/app/assets/javascripts/leaflet.key.js
index d88ce5d6e..5223b1420 100644
--- a/app/assets/javascripts/leaflet.key.js
+++ b/app/assets/javascripts/leaflet.key.js
@@ -8,7 +8,6 @@ L.OSM.key = function (options) {
var button = $('')
.attr('class', 'control-button')
.attr('href', '#')
- .attr('title', I18n.t('javascripts.key.tooltip'))
.html('')
.on('click', toggle)
.appendTo($container);
@@ -20,10 +19,9 @@ L.OSM.key = function (options) {
.attr('class', 'sidebar_heading')
.appendTo($ui)
.append(
- $('')
+ $('')
.text(I18n.t('javascripts.close'))
- .attr('class', 'sidebar_close')
- .attr('href', '#')
+ .attr('class', 'icon close')
.bind('click', toggle))
.append(
$('')
@@ -58,11 +56,17 @@ L.OSM.key = function (options) {
if (!button.hasClass('disabled')) {
options.sidebar.togglePane($ui, button);
}
+ $('.leaflet-control .control-button').tooltip('hide');
}
function updateButton() {
- var layer = map.getMapBaseLayerId();
- button.toggleClass('disabled', layer !== 'mapnik');
+ var disabled = ['mapnik', 'cyclemap'].indexOf(map.getMapBaseLayerId()) === -1;
+ button
+ .toggleClass('disabled', disabled)
+ .attr('data-original-title',
+ I18n.t(disabled ?
+ 'javascripts.key.tooltip_disabled' :
+ 'javascripts.key.tooltip'));
}
function update() {
@@ -71,7 +75,7 @@ L.OSM.key = function (options) {
$('.mapkey-table-entry').each(function () {
var data = $(this).data();
- if (layer == data.layer && zoom >= data.zoomMin && zoom <= data.zoomMax) {
+ if (layer === data.layer && zoom >= data.zoomMin && zoom <= data.zoomMax) {
$(this).show();
} else {
$(this).hide();