1class AnimateText { 2 3 element; 4 type; 5 delay; 6 7 constructor( element, type ) { 8 9 const { animationDelay } = element.dataset; 10 11 this.element = element; 12 this.type = type; 13 this.delay = Number(animationDelay); 14 15 if ( "line" === this.type ) { 16 this.delay = Number(this.element.parentNode.parentNode.dataset.animationDelay ); // specific to elementor 17 } 18 // Init SplitType 19 this.init(); 20 21 // Re-initialize the Split Text on window resize. 22 window.addEventListener("resize", () => { 23 this.init(); 24 }); 25 } 26 27 init() { 28 29 // Create SplitType 30 new SplitType( this.element, { types: this.type + 's' } ); 31 32 var currentType = this.type, 33 wrapline = this.wrapLine, 34 delay = this.delay / 1000, 35 delayFactor = 50; 36 37 if ( "line" === currentType ) { 38 delayFactor = 10; 39 } 40 41 // Add delays 42 this.element.querySelectorAll("." + this.type).forEach(function(el, index){ 43 el.style.transitionDelay = `${ 44 delay ? delay + index / delayFactor : index / delayFactor 45 }s`; 46 47 if ( "line" === currentType ) { 48 wrapline( el ); 49 } 50 } ); 51 } 52 53 wrapLine(el, wrapper) { 54 wrapper = wrapper || document.createElement( "div" ); 55 wrapper.classList = "line-wrapper"; 56 el.parentNode.insertBefore(wrapper, el); 57 wrapper.appendChild(el); 58 } 59} 60 61document.querySelectorAll('[data-animation="title"]').forEach((element) => new AnimateText(element, "char")); 62document.querySelectorAll('[data-animation="subtitle"]').forEach((element) => new AnimateText(element, "word")); 63document.querySelectorAll('[data-animation="paragraph"] > .elementor-widget-container').forEach( function(element) { 64 if ( element.querySelector('p' ) ) { 65 element.querySelectorAll('p').forEach((element) => new AnimateText(element, "line")); 66 } else { 67 new AnimateText(element, "line") 68 } 69} );
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.