1(function ($) { 2 Drupal.behaviors.qtip = { 3 attach: function (context, settings) { 4 $(function () { 5 var instances = $.parseJSON(settings.instances); 6 var debug = $.parseJSON(settings.qtipDebug); 7 8 $('.qtip-link', context).each(function() { // Call .each() so we can access $(this) in the settings/config 9 // Check for a sibling .qtip-tooltip containing the tooltip information, otherwise (for forms) 10 // go to the element's parent and look for .qtip-tooltip container as a sibling of the parent 11 if ($(this, context).next('.qtip-tooltip').length) { 12 var tooltipElement = $(this).next('.qtip-tooltip'); 13 } 14 else { 15 var tooltipElement = $(this).parent().siblings('.qtip-tooltip'); 16 } 17 var tooltip = tooltipElement; 18 19 if (!debug.leaveElement) { 20 // Remove the tooltip element to keep the DOM clean 21 tooltipElement.remove(); 22 } 23 24 var text = tooltip.html(); 25 var title = (tooltip.data('qtip-title') != undefined) ? tooltip.data('qtip-title') + '' : ''; // Concatenate an empty string to make sure that the value being passed as the title is a string, otherwise it will not display 26 var instance = (tooltip.data('qtip-instance') != undefined) ? tooltip.data('qtip-instance') : ''; 27 var settings = (instances[instance] != undefined) ? instances[instance] : ''; 28 29 if (settings) { 30 $(this).qtip(settings); 31 $(this).qtip('option', 'content.text', text); 32 if (title) { 33 $(this).qtip('option', 'content.title', title); 34 } 35 } 36 // If no settings have been passed through, we still want to display a tooltip 37 else { 38 $(this).qtip({ 39 content: { 40 text: text, 41 title: title, 42 } 43 }); 44 } 45 46 // Add instance class to the container to aid in styling 47 $(this).addClass('qtip-instance-' + instance); 48 }); 49 }); 50 } 51 }; 52})(jQuery);
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.