1( function ( $ ) { 2 3 "use strict"; 4 5 var animeBreakPoint = 1199; 6 7 /****** Get window width ******/ 8 function getWindowWidth() { 9 return window.innerWidth; 10 } 11 12 $( document ).ready( function() { 13 14 let el_preloader_overlay = $( '.preloader-overlay' ); 15 16 function isElementInViewport( el ) { 17 const rect = el.getBoundingClientRect(); 18 return rect.top < window.innerHeight && rect.bottom > 0; 19 } 20 21 function checkWidgetsInView() { 22 const selected_widgets = ` 23 .elementor-widget-crafto-blog-list.entrance-animation, 24 .elementor-widget-crafto-archive-blog.entrance-animation, 25 .elementor-widget-crafto-archive-portfolio.entrance-animation, 26 .elementor-widget-crafto-portfolio.entrance-animation, 27 .elementor-widget-crafto-product-taxonomy.entrance-animation, 28 .elementor-widget-crafto-product-list.entrance-animation, 29 .elementor-widget-crafto-archive-property.entrance-animation, 30 .elementor-widget-crafto-property.entrance-animation, 31 .elementor-widget-crafto-archive-tours.entrance-animation, 32 .elementor-widget-crafto-tours.entrance-animation 33 `; 34 35 $( selected_widgets ).each( function () { 36 const $widget = $( this ); 37 38 if ( isElementInViewport( this ) && ! $widget.hasClass( 'animation-done' ) ) { 39 const check_widget = setInterval( () => { 40 if ( $widget.find( '.grid-loading' ).length === 0 ) { 41 clearInterval( check_widget ); 42 animeEffect( $widget ); 43 $widget.addClass( 'animation-done' ); 44 } 45 }, 100 ); 46 } 47 }); 48 } 49 50 function animateNonWidgets() { 51 const listed_widgets = ` 52 .elementor-widget-crafto-blog-list.entrance-animation, 53 .elementor-widget-crafto-archive-blog.entrance-animation, 54 .elementor-widget-crafto-archive-portfolio.entrance-animation, 55 .elementor-widget-crafto-portfolio.entrance-animation, 56 .elementor-widget-crafto-product-taxonomy.entrance-animation, 57 .elementor-widget-crafto-product-list.entrance-animation, 58 .elementor-widget-crafto-archive-property.entrance-animation, 59 .elementor-widget-crafto-property.entrance-animation, 60 .elementor-widget-crafto-archive-tours.entrance-animation, 61 .elementor-widget-crafto-tours.entrance-animation 62 `; 63 const $nonListed = $( '.entrance-animation' ).not( $( listed_widgets ) ); 64 65 if ( $nonListed.length > 0 ) { 66 animeEffect( $nonListed ); 67 $nonListed.addClass( 'animation-done' ); 68 } 69 } 70 71 $( window ).on( 'scroll', checkWidgetsInView ); 72 73 if ( el_preloader_overlay.length > 0 ) { 74 let checkPreloader = setInterval( () => { 75 if ( el_preloader_overlay.css( 'display' ) === 'none' ) { 76 clearInterval( checkPreloader ); 77 animateNonWidgets(); 78 checkWidgetsInView(); 79 } 80 }, 100 ); 81 } else { 82 animateNonWidgets(); 83 checkWidgetsInView(); 84 } 85 86 function animeAnimation( target, options ) { 87 let child = target; 88 let staggerValue = options.staggervalue || 0; 89 let delay = options.delay || 0; 90 let anime_animation = anime.timeline(); 91 92 function applyTransitionStyles( elements ) { 93 for ( let i = 0; i < elements.length; i++ ) { 94 const element = elements[i]; 95 element.style.transition = 'none'; 96 if ( options.willchange ) { 97 element.style.willChange = 'transform'; 98 } 99 } 100 } 101 102 if ( ( options.targets === undefined || options.targets === '' ) ) { 103 if ( 'childs' === options.el ) { 104 child = target.children; 105 applyTransitionStyles( target.children ); 106 } 107 } 108 109 if ( 'lines' === options.el ) { 110 function lineSplitting() { 111 const linesData = Splitting( { target: target, by: 'lines' } ); 112 113 // Extract lines while preserving spaces 114 const line = linesData[0].lines.map( line => 115 line.map( word => word.innerHTML ).join( " " ) 116 ); 117 118 // Set target innerHTML while preserving spaces 119 target.innerHTML = line.map( item => `<span class="d-inline-flex">${item}</span>` ).join( ' ' ); 120 121 return target.querySelectorAll( '.d-inline-flex' ); 122 } 123 124 child = lineSplitting(); 125 } 126 127 if ( 'words' === options.el ) { 128 function wordSplitting() { 129 const words = Splitting( { target: target, by: 'words' } ); 130 return words[0].words; // Return words directly 131 } 132 child = wordSplitting(); 133 } 134 135 if ( 'chars' === options.el ) { 136 function charSplitting() { 137 const chars = Splitting( { target: target, by: 'chars' } ); 138 return chars[0].chars; // Return characters directly 139 } 140 child = charSplitting(); 141 } 142 143 if ( options.perspective ) { 144 target.style.perspective = `${options.perspective}px`;
145 } 146 147 if ( options.willchange ) { 148 target.style.willChange = options.willchange; 149 } 150 151 anime_animation.add({ 152 targets: child, 153 ...options, 154 delay: anime.stagger( staggerValue, { start: delay } ), 155 complete: function() { 156 157 if ( options.el ) { 158 target.classList.add( 'anime-child' ); 159 target.classList.add( 'anime-complete' ); 160 161 for ( let i = 0; i < target.children.length; i++ ) { 162 const element = target.children[i]; 163 element.style.removeProperty( 'opacity' ); 164 element.style.removeProperty( 'transform' ); 165 element.style.removeProperty( 'transition' ); 166 167 if ( target.classList.contains( 'grid' ) ) { 168 element.style.transition = 'none'; 169 } 170 } 171 172 if ( 'lines' === options.el ) { 173 for ( let i = 0; i < target.children.length; i++ ) { 174 const element = target.children[i]; 175 element.classList.remove( 'd-inline-flex' ); 176 element.classList.add( 'd-inline' ); 177 element.style.willChange = "inherit"; 178 } 179 } 180 } else if ( options.targets ) { 181 target.classList.add( 'anime-complete' ); 182 const element = options.targets; 183 $( element ).removeAttr( 'style' ); 184 } else { 185 target.classList.add( 'anime-complete' ); 186 target.style.removeProperty( 'opacity' ); 187 target.style.removeProperty( 'transform' ); 188 target.style.removeProperty( 'transition' ); 189 } 190 } 191 }); 192 } 193 194 // Anime text revealer js 195 function slideAnimation( target, options ) { 196 let duration = options.speed ? options.speed : 100, 197 direction = options.direction ? options.direction : "lr", 198 delay = options.delay ? options.delay : 0; 199 200 target.style.position = 'relative'; 201 202 // Create slide panel div 203 let tmp = document.createElement( 'div' ); 204 tmp.style.width = tmp.style.height = '100%'; 205 tmp.style.top = tmp.style.left = 0; 206 tmp.style.background = options.color ? options.color : '#fff'; 207 tmp.style.position = 'absolute'; 208 209 if ( direction === 'lr' ) { 210 tmp.style.WebkitTransformOrigin = tmp.style.transformOrigin = '0% 50%'; 211 tmp.style.WebkitTransform = tmp.style.transform = 'scaleX(0)'; 212 } else if ( direction === 'tb' ) { 213 tmp.style.WebkitTransformOrigin = tmp.style.transformOrigin = '50% 0%'; 214 tmp.style.WebkitTransform = tmp.style.transform = 'scaleY(0)'; 215 } else if ( direction === 'bt' ) { 216 tmp.style.WebkitTransformOrigin = tmp.style.transformOrigin = '100% 100%'; 217 tmp.style.WebkitTransform = tmp.style.transform = 'scaleY(0)'; 218 } else { 219 tmp.style.WebkitTransformOrigin = tmp.style.transformOrigin = '100% 50%'; 220 tmp.style.WebkitTransform = tmp.style.transform = 'scaleX(0)'; 221 } 222 target.appendChild( tmp ); 223 224 // init Anime js. 225 let slide_anime = anime.timeline(); 226 slide_anime.add({ 227 targets: tmp, 228 scaleX: ( direction === 'lr' || direction === 'rl' ) ? [0, 1] : [1, 1], 229 scaleY: ( direction === 'tb' || direction === 'bt' ) ? [0, 1] : [1, 1], 230 duration: duration + 500, 231 easing: 'easeInOutCubic', 232 delay: delay, 233 complete: function() { 234 if ( direction === 'lr' ) { 235 tmp.style.WebkitTransformOrigin = tmp.style.transformOrigin = '100% 50%'; 236 } else if ( direction === 'tb' ) { 237 tmp.style.WebkitTransformOrigin = tmp.style.transformOrigin = '50% 100%'; 238 } else if ( direction === 'bt' ) { 239 tmp.style.WebkitTransformOrigin = tmp.style.transformOrigin = '0% 0%'; 240 } else { 241 tmp.style.WebkitTransformOrigin = tmp.style.transformOrigin = '0% 50%'; 242 } 243 244 anime({ 245 targets: tmp, 246 duration: duration + 500, 247 easing: 'easeInOutCubic', 248 scaleX: ( direction === 'lr' || direction === 'rl' ) ? [1, 0] : [1, 1], 249 scaleY: ( direction === 'tb' || direction === 'bt' ) ? [1, 0] : [1, 1], 250 complete: function() { 251 target.removeChild( tmp ); 252 if ( typeof callback === 'function' ) { 253 callback(); 254 } 255 } 256 }); 257 } 258 }).add( { 259 targets: target.querySelector( '*' ), 260 easing: 'easeOutQuint', 261 delay: direction === 'lr' ? anime.stagger( duration, { start: 1000 } ) : anime.stagger( -duration, { start: 1000 } ), 262 opacity: [ 0, 1 ] 263 }, "-=900" ); 264 } 265 266 function animeEffect( entrance_anime_element ) { 267 entrance_anime_element.each( function() { 268 let _self = $( this ); 269 let animeOptions = _self.attr( 'data-anime' ); 270
271 _self.appear(); 272 $( window ).trigger( 'resize' ); 273 274 if ( animeOptions && getWindowWidth() > animeBreakPoint ) { 275 animeOptions = JSON.parse( animeOptions ); 276 const effect = animeOptions.effect && animeOptions.effect.toLowerCase(); 277 setTimeout( () => { 278 try { 279 if ( _self.is( ':appeared' ) ) { 280 _self.addClass( 'appear' ); 281 if ( 'slide' === effect ) { 282 slideAnimation( this, animeOptions ); 283 } else { 284 if ( 'undefined' != typeof CraftoFrontend && '0' === CraftoFrontend.all_animations_disable ) { 285 animeAnimation( this, animeOptions ); 286 } 287 } 288 } else { 289 _self.on( 'appear', function() { 290 if ( ! _self.hasClass( 'appear' ) ) { 291 _self.addClass( 'appear' ); 292 if ( 'slide' === effect ) { 293 slideAnimation( this, animeOptions ); 294 } else { 295 if ( 'undefined' != typeof CraftoFrontend && '0' === CraftoFrontend.all_animations_disable ) { 296 animeAnimation( this, animeOptions ); 297 } 298 } 299 } 300 301 if ( _self.hasClass( 'grid' ) ) { 302 _self.find( '.grid-sizer' ).removeAttr( 'style' ); 303 } 304 }); 305 } 306 } catch ( error ) { 307 console.error( 'Error parsing anime options:', error ); 308 } 309 }, 100 ); 310 } else { 311 if ( 'undefined' != typeof CraftoFrontend && '1' === CraftoFrontend.mobile_animation_disable ) { 312 _self.removeAttr( 'data-anime' ); 313 } else { 314 animeOptions = JSON.parse( animeOptions ); 315 const effect = animeOptions.effect && animeOptions.effect.toLowerCase(); 316 setTimeout( () => { 317 try { 318 _self.appear(); 319 if ( _self.is( ':appeared' ) ) { 320 _self.addClass( 'appear' ); 321 if ( 'slide' === effect ) { 322 slideAnimation( this, animeOptions ); 323 } else { 324 if ( 'undefined' != typeof CraftoFrontend && '0' === CraftoFrontend.all_animations_disable ) { 325 animeAnimation( this, animeOptions ); 326 } 327 } 328 } else { 329 _self.on( 'appear', function() { 330 if ( ! _self.hasClass( 'appear' ) ) { 331 _self.addClass( 'appear' ); 332 if ( 'slide' === effect ) { 333 slideAnimation( this, animeOptions ); 334 } else { 335 if ( 'undefined' != typeof CraftoFrontend && '0' === CraftoFrontend.all_animations_disable ) { 336 animeAnimation( this, animeOptions ); 337 } 338 } 339 } 340 341 if ( _self.hasClass( 'grid' ) ) { 342 _self.find( '.grid-sizer' ).removeAttr( 'style' ); 343 } 344 }); 345 } 346 } catch ( error ) { 347 console.error( 'Error parsing anime options:', error ); 348 } 349 }, 100 ); 350 } 351 } 352 }); 353 } 354 }); 355 356})( 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.