1// Define a module for your functionality 2 3const DIGRTooltipModule = (function ($) { 4 // Private functions and variables 5 6 function getTippyOptions(container) { 7 const dataOptionsAttr = container.attr("data-options"); 8 const tippyOptions = JSON.parse(dataOptionsAttr); 9 10 tippyOptions.followCursor = tippyOptions.trigger === "mouseenter focus" ? tippyOptions.followCursor : false; 11 tippyOptions.interactive = tippyOptions.interactive ? true : false; 12 tippyOptions.interactiveBorder = parseInt(tippyOptions.interactiveBorder); 13 tippyOptions.interactiveDebounce = parseInt(tippyOptions.interactiveDebounce); 14 tippyOptions.maxWidth = parseInt(tippyOptions.maxWidth) || 350; 15 tippyOptions.offsetEnable = tippyOptions.offsetEnable; 16 tippyOptions.offsetSkidding = tippyOptions.offsetEnable === "on" ? parseInt(tippyOptions.offsetSkidding) : 0; 17 tippyOptions.offsetDistance = tippyOptions.offsetEnable === "on" ? parseInt(tippyOptions.offsetDistance) : 10; 18 tippyOptions.offset = [tippyOptions.offsetSkidding, tippyOptions.offsetDistance]; 19 tippyOptions.theme = "." + tippyOptions.dataTheme; 20 21 console.log(tippyOptions.theme); 22 return tippyOptions; 23 } 24 25 function initializeTippy(selector, options) { 26 $(selector).each(function () { 27 const tooltipId = $(this).data("tooltip-content"); 28 // console.log("tooltip content data: ", tooltipId); 29 30 const tooltipContent = $(tooltipId); 31 32 tippy(this, { 33 content: tooltipContent.html(), 34 allowHTML: true, 35 ...options, 36 }); 37 }); 38 } 39 40 return { 41 init: function () { 42 $(function () { 43 const digrHotspotContainers = $(".digr_ihp_hotspot_container"); 44 45 digrHotspotContainers.each(function () { 46 const tippyOptions = getTippyOptions($(this)); 47 48 if (tippyOptions.tooltip_enable) { 49 const marker = $(this).find(".digr_marker"); 50 initializeTippy(marker, tippyOptions); 51 } 52 }); 53 }); 54 }, 55 }; 56})(jQuery); 57 58DIGRTooltipModule.init();
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.