1(function () { 2 3 "use strict"; 4 5 /* -------------------------------------------- 6 GLOBAL OBSERVER (Simple & Stable) 7 --------------------------------------------- */ 8 9 var observer = new IntersectionObserver(function (entries) { 10 11 entries.forEach(function (entry) { 12 13 var wrapper = entry.target; 14 15 var isRepeat = wrapper.classList.contains("wcf-repeat-yes"); 16 var playedOnce = wrapper.classList.contains("wcf-played"); 17 18 /* ---------------- PLAY ---------------- */ 19 20 if (entry.isIntersecting) { 21 22 if (isRepeat) { 23 24 playAnimation(wrapper); 25 26 } else { 27 28 if (!playedOnce) { 29 playAnimation(wrapper); 30 wrapper.classList.add("wcf-played"); 31 } 32 33 } 34 35 } 36 37 /* ---------------- RESET (Repeat Mode) ---------------- */ 38 39 if (!entry.isIntersecting && isRepeat) { 40 41 wrapper.classList.remove("wcf-animate"); 42 wrapper.classList.remove("wcf-played"); 43 44 } 45 46 }); 47 48 }, { threshold: 0.1 }); 49 50 51 /* -------------------------------------------- 52 INIT 53 --------------------------------------------- */ 54 55 function initStarterAnimations(scope) { 56 57 var wrapper = scope[0]; 58 59 if (!wrapper) return; 60 61 if (!wrapper.className.includes("wcf-starter-animations-")) return; 62 63 64 if (!wrapper.dataset.wcfInit) { 65 66 wrapper.dataset.wcfInit = "1"; 67 68 handleChar(wrapper); 69 handleWave(wrapper); 70 71 } 72 73 observer.observe(wrapper); 74 75 } 76 77 78 /* -------------------------------------------- 79 PLAY FUNCTION 80 --------------------------------------------- */ 81 82 function playAnimation(wrapper) { 83 84 if (!wrapper) return; 85 86 87 wrapper.classList.remove("wcf-animate"); 88 89 90 var target = 91 wrapper.querySelector(".elementor-widget-container > *") || 92 wrapper.firstElementChild; 93 94 95 if (wrapper.classList.contains("wcf-starter-animations-text-char-animate")) { 96 97 if (target) { 98 99 var originalText = target.textContent; 100 101 target.innerHTML = originalText; 102 target.dataset.charInit = ""; 103 104 handleChar(wrapper); 105 106 } 107 108 } 109 110 111 if (wrapper.classList.contains("wcf-starter-animations-text-wave")) { 112 113 if (target) { 114 115 target.removeAttribute("data-text"); 116 117 target.setAttribute( 118 "data-text", 119 target.textContent.trim() 120 ); 121 122 target.dataset.waveInit = ""; 123 124 } 125 126 } 127 128 129 void wrapper.offsetWidth; 130 131 132 wrapper.classList.add("wcf-animate"); 133 134 } 135 136 137 /* -------------------------------------------- 138 CHARACTER SPLIT 139 --------------------------------------------- */ 140 141 function handleChar(wrapper) { 142 143 if (!wrapper.className.includes("text-char")) return; 144 145 146 var target = 147 wrapper.querySelector(".elementor-widget-container > *") || 148 wrapper.firstElementChild; 149 150 151 if (!target || target.dataset.charInit) return; 152 153 154 var text = target.textContent; 155 156 157 if (!text) return; 158 159 160 target.innerHTML = ""; 161 162 163 var globalIndex = 0; 164 165 166 // Split by space but preserve spacing 167 var words = text.split(" "); 168 169 170 words.forEach(function (word, wordIndex) { 171 172 173 var wordSpan = document.createElement("span"); 174 175 wordSpan.classList.add("wcf-word"); 176 177 wordSpan.style.display = "inline-block"; 178 179 180 Array.from(word).forEach(function (char) { 181 182 183 var charSpan = document.createElement("span"); 184 185 186 charSpan.textContent = char; 187 188 charSpan.style.display = "inline-block"; 189 190 charSpan.style.setProperty("--i", globalIndex); 191 192 193 wordSpan.appendChild(charSpan); 194 195 196 globalIndex++; 197 198 199 }); 200 201 202 target.appendChild(wordSpan); 203 204 205 // Add real space between words 206 if (wordIndex < words.length - 1) { 207 208 var space = document.createTextNode(" "); 209 210 target.appendChild(space); 211 212 } 213 214 215 }); 216 217 218 target.dataset.charInit = "1"; 219 220 } 221 222 223 /* -------------------------------------------- 224 WAVE SUPPORT 225 --------------------------------------------- */ 226 227 function handleWave(wrapper) { 228 229
230 if (!wrapper.classList.contains("wcf-starter-animations-text-wave")) { 231 return; 232 } 233 234 235 var target = 236 wrapper.querySelector(".elementor-widget-container > *") || 237 wrapper.firstElementChild; 238 239 240 if (!target) return; 241 242 243 target.setAttribute( 244 "data-text", 245 target.textContent.trim() 246 ); 247 248 249 target.dataset.waveInit = "1"; 250 251 } 252 253 254 /* -------------------------------------------- 255 MANUAL REPLAY 256 --------------------------------------------- */ 257 258 window.wcfReplayAnimation = function (wrapper) { 259 260 playAnimation(wrapper); 261 262 }; 263 264 265 /* -------------------------------------------- 266 ELEMENTOR HOOK 267 --------------------------------------------- */ 268 269 window.addEventListener( 270 "elementor/frontend/init", 271 function () { 272 273 elementorFrontend.hooks.addAction( 274 "frontend/element_ready/global", 275 initStarterAnimations 276 ); 277 278 } 279 ); 280 281 282})();
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.