1/** 2 * @file 3 * Bootstrap Tooltips. 4 */ 5 6var Drupal = Drupal || {}; 7 8(function ($, Drupal, Bootstrap) { 9 "use strict"; 10 11 /** 12 * Extend the Bootstrap Tooltip plugin constructor class. 13 */ 14 Bootstrap.extendPlugin('tooltip', function (settings) { 15 return { 16 DEFAULTS: { 17 animation: !!settings.tooltip_animation, 18 enabled: settings.tooltip_enabled, 19 html: !!settings.tooltip_html, 20 placement: settings.tooltip_placement, 21 selector: settings.tooltip_selector, 22 trigger: settings.tooltip_trigger, 23 delay: parseInt(settings.tooltip_delay, 10), 24 container: settings.tooltip_container 25 } 26 }; 27 }); 28 29 /** 30 * Bootstrap Tooltips. 31 * 32 * @todo This should really be properly delegated if selector option is set. 33 */ 34 Drupal.behaviors.bootstrapTooltips = { 35 attach: function (context) { 36 // Immediately return if tooltips are not available. 37 if (!$.fn.tooltip || !$.fn.tooltip.Constructor.DEFAULTS.enabled) { 38 return; 39 } 40 41 var elements = $(context).find('[data-toggle="tooltip"]').toArray(); 42 for (var i = 0; i < elements.length; i++) { 43 var $element = $(elements[i]); 44 var options = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, $element.data()); 45 $element.tooltip(options); 46 } 47 }, 48 detach: function (context) { 49 // Immediately return if tooltips are not available. 50 if (!$.fn.tooltip || !$.fn.tooltip.Constructor.DEFAULTS.enabled) { 51 return; 52 } 53 54 // Destroy all tooltips. 55 $(context).find('[data-toggle="tooltip"]').tooltip('destroy'); 56 } 57 }; 58 59})(window.jQuery, window.Drupal, window.Drupal.bootstrap);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.