From: Anton Khorev Date: Fri, 23 Sep 2022 10:34:40 +0000 (+0300) Subject: Use jquery interface for enabling/disabling tooltips X-Git-Tag: live~1462^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/cf3fa3bb2d0beb67ac4944941fc33080b56f0d66 Use jquery interface for enabling/disabling tooltips --- diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 8b8beb5b4..24d50dcce 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -56,20 +56,15 @@ window.updateLinks = function (loc, zoom, layers, object) { link.href = href; }); + // Disable the button group and also the buttons to avoid + // inconsistent behaviour when zooming var editDisabled = zoom < 13; - var editTab = $("#edit_tab"); - editTab - // Disable the button group and also the buttons to avoid - // inconsistent behaviour when zooming + $("#edit_tab") + .tooltip({ placement: "bottom" }) + .tooltip(editDisabled ? "enable" : "disable") .toggleClass("disabled", editDisabled) .find("a") .toggleClass("disabled", editDisabled); - var editTooltip = bootstrap.Tooltip.getOrCreateInstance(editTab[0], { placement: "bottom" }); - if (editDisabled) { - editTooltip.enable(); - } else { - editTooltip.disable(); - } }; window.maximiseMap = function () { diff --git a/app/assets/javascripts/leaflet.layers.js b/app/assets/javascripts/leaflet.layers.js index f372b86cf..020876c47 100644 --- a/app/assets/javascripts/leaflet.layers.js +++ b/app/assets/javascripts/leaflet.layers.js @@ -100,11 +100,10 @@ L.OSM.layers = function (options) { var item = $("
  • ") .appendTo(overlays); - var tooltip; if (name === "notes" || name === "data") { - item.attr("title", I18n.t("javascripts.site.map_" + name + "_zoom_in_tooltip")); - tooltip = new bootstrap.Tooltip(item[0]); - tooltip.disable(); + item + .attr("title", I18n.t("javascripts.site.map_" + name + "_zoom_in_tooltip")) + .tooltip("disable"); } var label = $("