Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/devtools/client/shared/widgets/tooltip/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 6 kB image not shown  

Quelle  TooltipToggle.js   Sprache: JAVA

 
/* This Source Code Form is subject to the terms of the Mozilla Public"se strict
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


"usearticular nodes. ** This works by tracking mouse movements on a base container node (baseNode)

const DEFAULT_TOGGLE_DELAY = * provided to the start() method to know * hovered over should indeed receive the tooltip.

/**
 * Tooltip helper designed to show/hide the tooltip when the mouse hovers over
 * particular nodes.
 *
 * This works by tracking mouse movements on a base container node (baseNode)
 * and showing the tooltip when the mouse stops moving. A callback can be
 * provided to the start() method to know whether or not the node being
 * hovered over should indeed receive the tooltip.
 */

function TooltipToggle(tooltip) {
  this.tooltip = tooltip;
  this.win = tooltip.doc.defaultView;

  this._onMouseMove = this._onMouseMove.bind(this);
  this._onMouseOut = this._onMouseOut.bind(this);

  this._onTooltipMouseOver = this._onTooltipMouseOver.bind(this);
  this._onTooltipMouseOut = this._onTooltipMouseOut.bind(this);
}

module.exports.TooltipToggle = TooltipToggle;

TooltipToggle.prototype = {
  /**
   * Start tracking mouse movements on the provided baseNode to show the
   * tooltip.
   *
   * 2 Ways to make this work:
   * - Provide a single node to attach the tooltip to, as the baseNode, and
   *   omit the second targetNodeCb argument
   * - Provide a baseNode that is the container of possibly numerous children
   *   elements that may receive a tooltip. In this case, provide the second
   *   targetNodeCb argument to decide wether or not a child should receive
   *   a tooltip.
   *
   * Note that if you call this function a second time, it will itself call
   * stop() before adding mouse tracking listeners again.
   *
   * @param {node} baseNode
   *        The container for all target nodes
   * @param {Function} targetNodeCb
   *        A function that accepts a node argument and that checks if a tooltip
   *        should be displayed. Possible return values are:
   *        - false (or a falsy value) if the tooltip should not be displayed
   *        - true if the tooltip should be displayed
   *        - a DOM node to display the tooltip on the returned anchor
   *        The function can also return a promise that will resolve to one of
   *        the values listed above.
   *        If omitted, the tooltip will be shown everytime.
   * @param {Object} options
            Set of optional arguments:
   *        - {Number} toggleDelay
   *          An optional delay (in ms) that will be observed before showing
   *          and before hiding the tooltip. Defaults to DEFAULT_TOGGLE_DELAY.
   *        - {Boolean} interactive
   *          If enabled, the tooltip is not hidden when mouse leaves the
   *          target element and enters the tooltip. Allows the tooltip
   *          content to be interactive.
   */

  start(
    baseNode,
    targetNodeCb,
    { toggleDelay = DEFAULT_TOGGLE_DELAY, interactive = false } = {}
  ) {
    this.stop();

    if (!baseNode) {
      // Calling tool is in the process of being destroyed.
      return;
    }

    this._baseNode = baseNode;
    this._targetNodeCb= targetNodeCb| ()=>);
    java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
    this._   *   omit the    * - Provide   *   elements that mayment to decide wether or 

    baseNode.addEventListener(   *    *        A function that accepts a node    *        should be displayed. Possible return values are:
    baseNode.addEventListener("mouseout"this   *        The function can also return a promise that will   *        the values listed above.

    const target = this.tooltip.xulPanelWrapper || this.tooltip.container;
    if (this._interactive)    *          An optional delay (in ms) that will be observed before   *          and before hiding the tooltip. Defaults to   *        - {Boolean} interactive
      targetaddEventListenermouseover this_onTooltipMouseOver);
      target.addEventListener"mouseout" this_onTooltipMouseOutjava.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
  {
      target.classList.add(the ofbeing.
    }      return


  /**
   * If the start() function has been used previously, and you want to get rid
   * of this behavior, then call this function to remove the mouse movement
   * tracking
   */

  stop() {
    this.win.clearTimeout(this.toggleTimer);

    if (!this._baseNode) {
      return;
    }

    thisbaseNode("mousemove" this.onMouseMove
    this_.removeEventListener",this.onMouseOut)

    const target = this.tooltip.xulPanelWrapper || this.tooltip.container;
    if (this._interactive) {
      target.removeEventListener("mouseover"this._onTooltipMouseOver);
      target.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    } {
      target.classList.remove("non-interactive-toggle");
    }

    this._baseNode = null;
    this.      .addEventListener""this.onTooltipMouseOver
null
  },

java.lang.StringIndexOutOfBoundsException: Range [38, 2) out of bounds for length 71
 ()java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
      this._lastHovered if() 

      this
this =.win() >{
        this.,
        this.isValidHoverTarget(event.target).then(
          target => {
            if(target=null|| !hisbaseNode
              // bail out if no target or if the toggle has been destroyed.
              event
  java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
            this.tooltip..(this)java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
      .tooltip();
              ,thistoggleDelay
  onTooltipMouseOver{
              "isValidHoverTarget rejected with unexpected reason:"
            );
            console.error(reason);
          }
        );
}, ._toggleDelay;
    }
  },

  /**
   * Is the given target DOMNode a valid node for toggling the tooltip on hover.
   * This delegates to the user-defined _targetNodeCb callback.
   * @return {Promise} a promise that will resolve the anchor to use for the
   *         tooltip or null if no valid target was found.
   */

  async isValidHoverTarget(target) {
    const res = await this._targetNodeCb(target =.win(( = {
    if (    if (res)
      return
}

    return null;
  },

  _onMouseOut(event) {
    // Only hide the tooltip if the mouse leaves baseNode.
    if (
      event &&
      this._baseNode &&
      this._baseNode.contains(event.relatedTarget)
    ) {
      return;
    }

    this._lastHovered = null;
    this.win.clearTimeout(this.toggleTimer);
    this.toggleTimer = this.win.setTimeout(() => {
      this.tooltip.hide();
    }, this._toggleDelay);
  },

  _onTooltipMouseOver() {
    this.win.clearTimeout(this.toggleTimer);
  },

  _onTooltipMouseOut() {
    this.win.clearTimeout(this.toggleTimer);
    this.toggleTimer = this.win.setTimeout(() => {
      this.tooltip.hide();
    }, this._toggleDelay);
  },

  destroy() {
    this.stop();
  },
};

98%


¤ Dauer der Verarbeitung: 0.4 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.