1/** 2 * âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 3 * â ZOEY, INC. â 4 * â __________________ â 5 * â COPYRIGHT 2026 Zoey â 6 * â All Rights Reserved. â 7 * â â 8 * â NOTICE: You are granted a non-exclusive and non-transferable license â 9 * â to use the Source Code of the Software provided under this License. â 10 * â This License is applicable to a single domain and server installation. â 11 * â Licensee may not resell, rent, lease or distribute the Source Code â 12 * â separately. Licensee may not use this Source Code to develop or â 13 * â distribute products that would compete with products marketed by the â
14 * â Licensor. All information contained herein is, and remains, the â 15 * â property of Zoey, Inc. and its suppliers, if any. The intellectual and â 16 * â technical concepts contained herein are proprietary to Zoey, Inc. and â 17 * â its suppliers and may be covered by U.S. and Foreign Patents, patents â 18 * â in process, and are protected by trade secret and/or copyright law. â 19 * â Dissemination of this information or reproduction of this material is â 20 * â strictly forbidden unless prior written permission is obtained from â 21 * â Zoey, Inc. Licensor's copyright notices must not be removed from the â 22 * â Source Code. â 23 * âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 24 * 25 * 26 * Zoey Tooltip Module 27 * 28 * This module provides a more robust tooltip using the Tippy.js library that 29 * provides enhanced repositioning with the use of the Popper.js library. 30 * Default styles can be found here: skin/designcenter/default/sass/_tooltip.scss 31 * 32 * @see {@link https://atomiks.github.io/tippyjs/|Tippy.js Documentation} 33 */ 34 35window.Zoey.require(['zoey.tooltip.tippy', 'pix.globalEvents'], function(tippy, globalEvents) { 36 "use strict"; 37 window.pix = window.pix || {}; 38 39 const TOOLTIP_HTML_PREFIX = 'data-tooltip-'; 40 41 var ZoeyTooltip = { 42 _tippy: tippy, 43 _defaults: { 44 delay: [200, null], 45 duration: [500, 250], 46 interactive: true, 47 inertia: true, 48 allowHTML: true, 49 offset: [0, 5], 50 zIndex: 99999, 51 theme: 'zoey', 52 appendTo: () => document.body, 53 maxWidth: 300, 54 content: function(reference) { 55 var content = reference.getAttribute(TOOLTIP_HTML_PREFIX + 'content'); 56 var templateId = reference.getAttribute(TOOLTIP_HTML_PREFIX + 'template'); 57 if (templateId) { 58 template = document.getElementById(templateId); 59 if(template != undefined) { 60 content = template.innerHTML; 61 } 62 } 63 return content; 64 } 65 }, 66 _defaultProps: {}, 67 init: function(selector, props = {}) { 68 69 this._tippy.setDefaultProps(this._defaults); 70 71 this._defaultProps = this._tippy.defaultProps; 72 var selectors = Array.from(document.querySelectorAll(selector)); 73 74 selectors.forEach(function(el) { 75 var config = el.getAttribute(TOOLTIP_HTML_PREFIX + 'config'); 76 if (config) { 77 try { 78 var configObj = JSON.parse(atob(config)); 79 props = Object.assign({}, this._defaultProps, props, configObj); 80 } catch (e) { 81 console.error('Invalid JSON in tooltip config:', e); 82 } 83 } 84 85 this._tippy(el, props); 86 }.bind(this)); 87 88 return this; 89 }, 90 setDefaultProps: function(props) { 91 this._tippy.setDefaultProps(props); 92 return this; 93 }, 94 hideAll: function() { 95 this._tippy.hideAll(); 96 return this; 97 }, 98 getInstance: function(selector) { 99 if(typeof selector === 'string') { 100 var el = document.querySelector(selector); 101 } else { 102 var el = selector; 103 } 104 if(!el) { 105 return null; 106 } 107 var instance = el._tippy; 108 if (instance == undefined) { 109 this._tippy(el); 110 instance = el._tippy; 111 } 112 113 return instance; 114 }, 115 getElement: function(selector) { 116 var instance = this.getInstance(selector); 117 if (instance) { 118 return instance.reference; 119 } 120 return null; 121 }, 122 // normally the config object on the element takes priority but this method allows you to override the config object on the element 123 setProps: function(selector, props) { 124 var instance = this.getInstance(selector); 125 var el = this.getElement(selector); 126 var config = el.getAttribute(TOOLTIP_HTML_PREFIX + 'config'); 127 if (config) { 128 try { 129 var configObj = JSON.parse(atob(config)); 130 props = Object.assign({}, this._defaultProps, configObj, props); 131 } catch (e) { 132 console.error('Invalid JSON in tooltip config:', e); 133 } 134 } 135 if (instance) { 136 instance.setProps(props); 137 } 138 return this; 139 }, 140 setContent: function(selector, content) { 141 var el = this.getElement(selector); 142 el.setAttribute(TOOLTIP_HTML_PREFIX + 'content', content); 143 var instance = this.getInstance(el); 144 if (instance) { 145 instance.setContent(content); 146 } 147 return this; 148 }, 149 enable: function(selector) { 150 var instance = this.getInstance(selector); 151 if (instance) { 152 instance.enable(); 153 } 154 return this; 155 }, 156 disable: function(selector) { 157 var instance = this.getInstance(selector); 158 if (instance) { 159 instance.disable(); 160 } 161 return this; 162 }, 163 show: function(selector) { 164 var instance = this.getInstance(selector); 165 if (instance) { 166 instance.show(); 167 } 168 return this; 169 }, 170 hide: function(selector) { 171 var instance = this.getInstance(selector); 172 if (instance) { 173 instance.hide(); 174 } 175 return this; 176 }, 177 destroy: function(selector) { 178 var instance = this.getInstance(selector); 179 if (instance) { 180 instance.destroy(); 181 } 182 return this; 183 } 184 }; 185 186 globalEvents.add('holepunch_bulk_after', function() { 187 ZoeyTooltip.init('[data-tooltip-content]'); 188 globalEvents.notify('tooltipsInit'); 189 }); 190 191 window.pix.ZoeyTooltip = ZoeyTooltip; 192
193 window.Zoey.export('zoey.tooltip', ZoeyTooltip); 194}); 195
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.