Sha256: a1a7fb0c9ee8efd513a8569c42ade5a4a002078edf92d65889b6af0eaa5caa73

Contents?: true

Size: 1.12 KB

Versions: 15

Compression:

Stored size: 1.12 KB

Contents

$(function(){
  $('body').popover({selector: '.hint-tooltip', html: true, trigger: 'hover', placement: 'top'});

  $('body').tooltip({selector: '.with-tip'});

  /*
   * Poll tooltips to hide them if they are no longer being hovered.
   *
   * This is necessary to fix tooltips hanging around after their attached
   * element has been removed from the DOM (and will therefore receive no
   * mouseleave event). This may be unnecessary in a future version of
   * bootstrap, which intends to solve this using MutationObserver.
   */
  var removeDesyncedTooltip = function(tooltip) {
    var interval = setInterval(function(){
      if(!$(tooltip.element).is(":hover")) {
        tooltip.hide();
        clearInterval(interval);
      }
    }, 200);
    $(tooltip.element).on('hidden.bs.tooltip', function(){
      clearInterval(interval);
    });
  };

  $('body').on('inserted.bs.tooltip', function(e){
    var $target = $(e.target);
    var tooltip = $target.data('bs.tooltip');
    removeDesyncedTooltip(tooltip);
    var $tooltip = $("#" + $target.attr("aria-describedby"));
    $tooltip.addClass("action-" + $target.data("action"));
  });
});

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
solidus_backend-2.1.1 app/assets/javascripts/spree/backend/components/tooltips.js
solidus_backend-2.0.3 app/assets/javascripts/spree/backend/components/tooltips.js
solidus_backend-1.4.2 app/assets/javascripts/spree/backend/components/tooltips.js
solidus_backend-2.0.2 app/assets/javascripts/spree/backend/components/tooltips.js
solidus_backend-1.4.1 app/assets/javascripts/spree/backend/components/tooltips.js
solidus_backend-2.1.0 app/assets/javascripts/spree/backend/components/tooltips.js
solidus_backend-2.1.0.rc1 app/assets/javascripts/spree/backend/components/tooltips.js
solidus_backend-2.0.1 app/assets/javascripts/spree/backend/components/tooltips.js
solidus_backend-2.1.0.beta1 app/assets/javascripts/spree/backend/components/tooltips.js
solidus_backend-2.0.0 app/assets/javascripts/spree/backend/components/tooltips.js
solidus_backend-1.4.0 app/assets/javascripts/spree/backend/components/tooltips.js
solidus_backend-2.0.0.rc1 app/assets/javascripts/spree/backend/components/tooltips.js
solidus_backend-1.4.0.rc1 app/assets/javascripts/spree/backend/components/tooltips.js
solidus_backend-2.0.0.beta1 app/assets/javascripts/spree/backend/components/tooltips.js
solidus_backend-1.4.0.beta1 app/assets/javascripts/spree/backend/components/tooltips.js