1(function ($) { 2 function indyResizeLottie(player, callback) { 3 if (!player || !player.dotLottie) { 4 if (callback) { 5 callback(); 6 } 7 return; 8 } 9 10 var dotLottie = player.dotLottie; 11 12 if (typeof dotLottie.setRenderConfig === "function") { 13 dotLottie.setRenderConfig({ 14 autoResize: true, 15 devicePixelRatio: Math.min(window.devicePixelRatio || 1, 2), 16 }); 17 } 18 19 requestAnimationFrame(function () { 20 requestAnimationFrame(function () { 21 if (typeof dotLottie.resize === "function") { 22 dotLottie.resize(); 23 } 24 if (callback) { 25 callback(); 26 } 27 }); 28 }); 29 } 30 31 function indyControlLottie(player, action) { 32 if (!player) { 33 return; 34 } 35 36 var run = function () { 37 if (action === "play") { 38 indyResizeLottie(player, function () { 39 if (player.dotLottie && typeof player.dotLottie.play === "function") { 40 player.dotLottie.play(); 41 } else if (typeof player.play === "function") { 42 player.play(); 43 } 44 }); 45 return; 46 } 47 48 if (player.dotLottie && typeof player.dotLottie[action] === "function") { 49 player.dotLottie[action](); 50 } else if (typeof player[action] === "function") { 51 player[action](); 52 } 53 }; 54 55 if (player.dotLottie) { 56 run(); 57 } else { 58 player.addEventListener("ready", run, { once: true }); 59 } 60 } 61 62 function isTabsDesktopLayout() { 63 return window.innerWidth >= 1025; 64 } 65 66 function initTabsLottieObserver() { 67 const observer = new IntersectionObserver( 68 (entries) => { 69 entries.forEach((entry) => { 70 const player = entry.target; 71 72 if (entry.isIntersecting) { 73 indyControlLottie(player, "play"); 74 } else { 75 indyControlLottie(player, "stop"); 76 } 77 }); 78 }, 79 { 80 threshold: 0.5, 81 }, 82 ); 83 84 $(".indy-block-tabs .lottie-player").each(function () { 85 observer.observe(this); 86 }); 87 } 88 89 function syncDesktopTabsLottie($block) { 90 $block.find(".lottie-player").each(function () { 91 if ($(this).closest(".tab.active").length) { 92 indyControlLottie(this, "play"); 93 } else { 94 indyControlLottie(this, "stop"); 95 } 96 }); 97 } 98 99 $(document).ready(function () { 100 if (isTabsDesktopLayout()) { 101 $(".indy-block-tabs").each(function () { 102 syncDesktopTabsLottie($(this)); 103 }); 104 105 $(".indy-block-tabs .tabs-nav .tab-name").on("click", function () { 106 if (!$(this).is(".active")) { 107 let key = $(this).attr("data-key"); 108 $(this) 109 .closest(".indy-block-tabs") 110 .find(".tab-name.active") 111 .removeClass("active"); 112 $(this) 113 .closest(".indy-block-tabs") 114 .find('.tab-name[data-key="' + key + '"]') 115 .addClass("active"); 116 $(this) 117 .closest(".indy-block-tabs") 118 .find(".tab.active") 119 .removeClass("active"); 120 $(this) 121 .closest(".indy-block-tabs") 122 .find('.tab[data-key="' + key + '"]') 123 .addClass("active"); 124 125 // Stop all players 126 $(this) 127 .closest(".indy-block-tabs") 128 .find(".lottie-player") 129 .each(function () { 130 indyControlLottie(this, "stop"); 131 }); 132 // Play only the visible one 133 const player = $(this) 134 .closest(".indy-block-tabs") 135 .find('.tab[data-key="' + key + '"]') 136 .find(".lottie-player")[0]; 137 indyControlLottie(player, "play"); 138 } 139 }); 140 } else { 141 initTabsLottieObserver(); 142 } 143 }); 144})(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.