[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/webroot/rsrc/js/core/ -> behavior-tooltip.js (source)

   1  /**
   2   * @provides javelin-behavior-phabricator-tooltips
   3   * @requires javelin-behavior
   4   *           javelin-behavior-device
   5   *           javelin-stratcom
   6   *           phabricator-tooltip
   7   * @javelin
   8   */
   9  
  10  JX.behavior('phabricator-tooltips', function() {
  11  
  12    JX.Stratcom.listen(
  13      ['mouseover', 'mouseout'],
  14      'has-tooltip',
  15      function (e) {
  16        if (e.getType() == 'mouseout') {
  17          JX.Tooltip.hide();
  18          return;
  19        }
  20  
  21        if (JX.Device.getDevice() != 'desktop') {
  22          return;
  23        }
  24  
  25        var data = e.getNodeData('has-tooltip');
  26  
  27        JX.Tooltip.show(
  28          e.getNode('has-tooltip'),
  29          data.size || 120,
  30          data.align || 'N',
  31          data.tip);
  32      });
  33  
  34    function wipe() {
  35      JX.Tooltip.hide();
  36    }
  37  
  38    // Hide tips when any key is pressed. This prevents tips from ending up locked
  39    // on screen if you make a keypress which removes the underlying node (for
  40    // example, submitting an inline comment in Differential). See T4586.
  41    JX.Stratcom.listen('keydown', null, wipe);
  42  
  43  
  44    // Hide tips on mouseup. This removes tips on buttons in dialogs after the
  45    // buttons are clicked.
  46    JX.Stratcom.listen('mouseup', null, wipe);
  47  
  48    // When we leave the page, hide any visible tooltips. If we don't do this,
  49    // clicking a link with a tooltip and then hitting "back" will give you a
  50    // phantom tooltip.
  51    JX.Stratcom.listen('unload', null, wipe);
  52  
  53  });


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1