1jQuery(function ($) { 2 // Select all lottie container for lottie image 3 $('.difl_iconlistitem').each((index, selector) => { 4 if ($(selector).find('.difl_lottie_player.lottie-player-container').length !== 0) { 5 try { 6 let observer; 7 const lottieContainer = selector.querySelector('.difl_lottie_player.lottie-player-container'); 8 const lottieSrc = !!lottieContainer.dataset && !!lottieContainer.dataset.src ? lottieContainer.dataset.src : ''; 9 const lottieOptions = !!lottieContainer.dataset && !!lottieContainer.dataset.options ? JSON.parse(lottieContainer.dataset.options) : {}; 10 11 // lottieOptions.renderer => data.renderer, lottieOptions.loop => data.loop, lottieSrcAttr => path; 12 const _lottie = lottie.loadAnimation({ 13 'container': lottieContainer, 14 'renderer': lottieOptions.renderer || 'svg', 15 'loop': lottieOptions.loop || false, 16 'autoplay': false, 17 'path': lottieSrc // the path to the animation json 18 }); 19 20 // lottieOptions.mouse_out_event => data.speed; 21 _lottie.setSpeed(Number.parseFloat(lottieOptions.speed)); 22 23 // lottieOptions.direction_reverse => data.direction_reverse; 24 if( lottieOptions.direction_reverse === 'on' ) { 25 _lottie.setDirection( -1 ); 26 } 27 28 // animation trigger on viewport 29 // lottieOptions.interaction => data.animation_trigger; 30 if (lottieOptions.interaction === 'viewport') { 31 observer = new IntersectionObserver(function ([item]) { 32 if (item.isIntersecting) { 33 item.target.classList.add('intersecting'); 34 _lottie.play(); 35 } 36 }, { 37 // lottieOptions.delay => data.threshold; 38 threshold: parseFloat(lottieOptions.delay), 39 delay: 100, 40 trackVisibility: true, 41 }); 42 observer.observe(lottieContainer); 43 } 44 45 // animation trigger on click 46 // lottieOptions.interaction => data.animation_trigger; 47 // click => on_click; 48 if (lottieOptions.interaction === 'click') { 49 lottieContainer.addEventListener('click', function () { 50 _lottie.play(); 51 }) 52 } 53 54 // animation trigger on hover 55 // lottieOptions.interaction => data.animation_trigger; 56 if (lottieOptions.interaction === 'hover') { 57 lottieContainer.addEventListener('mouseover', function () { 58 _lottie.play(); 59 }); 60 // lottieOptions.mouse_out_event => data.stop_on_mouse_out; 61 if (lottieOptions.mouse_out_event === 'on') { 62 lottieContainer.addEventListener('mouseout', function () { 63 _lottie.pause(); 64 }); 65 } 66 } 67 68 69 // animation trigger on_scroll 70 // lottieOptions.interaction => data.animation_trigger; 71 // scroll => on_scroll; 72 if (lottieOptions.interaction === 'scroll') { 73 let isScrolling; 74 let scrollPos = 0; 75 const _transform = window.getComputedStyle(selector); 76 let _transform_value = ''; 77 window.addEventListener('scroll', function (event) { 78 79 if ((document.body.getBoundingClientRect()).top > scrollPos) { 80 // lottieOptions.direction_reverse => data.direction_reverse; 81 if (lottieOptions.direction_reverse === 'on') { 82 _lottie.setDirection(1); 83 } else { 84 _lottie.setDirection(-1); 85 } 86 } else { 87 // lottieOptions.direction => data.direction_reverse; 88 if (lottieOptions.direction_reverse === 'on') { 89 _lottie.setDirection(1); 90 } else { 91 _lottie.setDirection(-1); 92 } 93 } 94 scrollPos = (document.body.getBoundingClientRect()).top; 95 96 window.clearTimeout(isScrolling); 97 // lottieOptions.scroll_effect => data.scroll_effect; 98 if (lottieOptions.scroll_effect === 'on') { 99 if (_transform.getPropertyValue('transform') !== _transform_value) { 100 _lottie.play(); 101 } 102 } else _lottie.play(); 103 104 isScrolling = setTimeout(function () { 105 _lottie.pause(); 106 _transform_value = _transform.getPropertyValue('transform'); 107 }, 30); 108 }, false) 109 } 110 111 // animation trigger none 112 // lottieOptions.interaction => data.animation_trigger; 113 if (lottieOptions.interaction === 'none') { 114 _lottie.play(); 115 } 116 } catch (e) { 117 console.error('AdvancedList:: Lottie could not loaded!!'); 118 } 119 } 120 121 if ($(selector).find('.item-tooltip-data').length !== 0) { 122 try { 123 const tooltipContainer = $(selector).find('.difl_icon_
123item_tooltip_content'); 124 const tooltipOptionsAttr = $(tooltipContainer).attr('data-options'); 125 let tooltipContent = $(tooltipContainer).html(); 126 const ele_class = selector.classList.value.split(" ").filter(function(class_name){ 127 return class_name.indexOf('difl_iconlistitem_') !== -1; 128 }); 129 130 if (!!tooltipOptionsAttr && !!tooltipContent) { 131 const tooltipOptions = JSON.parse(tooltipOptionsAttr); 132 133 if (tooltipOptions !== {} && tooltipOptions.tooltip_enable) { 134 const itemSelector = $(selector).find('.item-elements')[0]; 135 136 const options = { 137 arrow: tooltipOptions.arrow, 138 animation: tooltipOptions.animation, 139 placement: tooltipOptions.placement, 140 trigger: tooltipOptions.trigger, 141 allowHTML: true, 142 followCursor: tooltipOptions.trigger === 'mouseenter focus' ? tooltipOptions.followCursor : false, 143 interactive: tooltipOptions.interactive, 144 interactiveBorder: parseInt(tooltipOptions.interactiveBorder), 145 interactiveDebounce: parseInt(tooltipOptions.interactiveDebounce), 146 maxWidth: parseInt(tooltipOptions.maxWidth), 147 theme: `.${ele_class[0]} difl_icon_item_tooltip` 148 }; 149 150 // Apply offset only when Tooltip Distance is on, so content still shows when distance is off 151 if (tooltipOptions.offsetEnable) { 152 options.offset = [parseInt(tooltipOptions.offsetSkidding), parseInt(tooltipOptions.offsetDistance)]; 153 } 154 155 // replace empty p tag 156 tooltipContent = tooltipContent.replaceAll(/(<p><\/p>|<p>\s*<\/p>)/gi, '') 157 options['content'] = tooltipContent; 158 tippy(itemSelector, options); 159 } 160 } 161 } catch (e) { 162 console.error('AdvancedList:: Tooltip could not loaded!!') 163 } 164 } 165 }); 166});
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.