1/** 2* Copyright (c) Loft.Ocean 3* http://www.loftocean.com 4*/ 5 6( function( $ ) { 7 "use strict"; 8 var llp_file_ext = [ 9 'jpg', 'jpeg', 'png', 'gif', 'mov', 'avi', 'mpg', 10 '3gp', '3g2', 'midi', 'mid', 'pdf', 'doc', 'ppt', 11 'odt', 'pptx', 'docx', 'pps', 'ppsx', 'xls', 'xlsx', 12 'key', 'mp3', 'ogg', 'wma', 'm4a', 'wav', 'mp4', 13 'm4v', 'webm', 'ogv', 'wmv', 'flv', 'svg', 'svgz' 14 ]; 15 var $DOMBody = $( 'body' ), leavingShowAll = loftloaderPro['insiteTransitionShowAll'] === 'undefined' ? false : loftloaderPro['insiteTransitionShowAll'], 16 leavingProgressMax = ( typeof loftloaderPro['leavingProgressMax'] === 'undefined' ) ? 60 : loftloaderPro['leavingProgressMax'], $globalExcluded = $(), 17 minTimer = '', maxTimer = '', rapidPercentage = parseInt( ( leavingProgressMax * 0.9 ), 10 ), LoftLoaderProSessionStorage = { 18 getItem: function( name ) { 19 try { 20 return sessionStorage.getItem( name ); 21 } catch( msg ) { 22 return false; 23 } 24 }, 25 setItem: function( name, value ) { 26 try { 27 sessionStorage.setItem( name, value ); 28 } catch ( msg ) { } 29 } 30 }; 31 function llp_check_a( $a ) { 32 if ( $a && $a.length ) { 33 var target = $a.attr( 'target' ), 34 href = $a.attr( 'href' ); 35 return ( ( typeof target == 'undefined' ) || ( target.toLowerCase() !== '_blank' ) ) && llp_exclude_a( $a ) && ( href && llp_check_url( href ) ); 36 } 37 return false; 38 } 39 function llp_check_random_message() { 40 var $message = $( '#loftloader-wrapper .loader-message' ), message = llp_get_random_message(); 41 if ( $message.length && message ) { 42 $message.html( message ); 43 LoftLoaderProSessionStorage.setItem( 'loftloader-pro-next-random-message', message ); 44 } 45 } 46 function register_smooth_transition_link( $item ) { 47 var href = $item.attr( 'href' ); 48 if ( ! $item.data( 'loftloader-pro-checked' ) ) { 49 if ( href && llp_check_a( $item ) ) { 50 $item.off( 'click' ).on( 'click', function( e ) { 51 e.preventDefault(); 52 var $loader = $( '#loftloader-wrapper' ), $closeBtn = $loader.find( '.loader-close-button' ); 53 llp_check_random_message(); 54 $( document ).trigger( 'loftloaderpro.spt.start' ); 55 $( 'html' ).removeClass( 'loftloader-pro-spt-hide' ); 56 $loader.length && ! loftloaderPro.insiteTransitionDisplayOption ? $loader.css( 'transition-delay', '' ) : ''; 57 $DOMBody.addClass( 'leaves' ); 58 if ( leavingShowAll ) { 59 var leavingTimer = typeof loftloaderPro[ 'leavingTimer' ] === 'undefined' ? 900 : loftloaderPro[ 'leavingTimer' ]; 60 leavingTimer = isNaN( leavingTimer ) ? 900 : Math.max( 0, parseInt( leavingTimer, 10 ) ); 61 62 $DOMBody.addClass( 'spt-show-all' ); 63 $( document ).trigger( 'loftloaderpro.image.check' ); 64 Progress.initValue = 0; 65 Progress.reset(); 66 Progress.render( rapidPercentage, leavingTimer * 0.7 ); 67 setTimeout( function() { 68 Progress.render( ( loftloaderPro.insiteTransitionDisplayOnCurrent ? 100 : leavingProgressMax ), leavingTimer * 0.3 ); 69 }, leavingTimer * 0.7 ); 70 LoftLoaderProSessionStorage.setItem( 'loftloader-pro-smooth-transition', 'on' ); 71 72 setTimeout( function() { 73 window.location.href = href; 74 if ( $closeBtn.length && loftloaderPro.insiteTransitionShowCloseButton ) { 75 $closeBtn.css( { 'display': '', 'opacity': 1 } ); 76 } 77 }, leavingTimer ); 78 } else { 79 window.location.href = href; 80 } 81 } ); 82 } 83 $item.data( 'loftloader-pro-checked', true ); 84 } 85 } 86 function observe_DOM_changes() { 87 var targetNode = $DOMBody.get( 0 ), // Select the node that will be observed for mutations 88 config = { attributes: false, childList: true, subtree: true }, // Options for the observer (which mutations to observe) 89 callback = function( mutationsList, observer ) { // Callback function to execute when mutations are observed 90 //for ( let mutation of mutationsList ) { 91 mutationsList.forEach( function( mutation ) { 92 if ( mutation.type === 'childList' ) { 93 var $links = ( 'A' === mutation.target.tagName ) ? $( mutation.target ) : $( mutation.target ).find( 'a' ); 94 if ( $links.length ) { 95 $links.each( function() { 96 register_smooth_transition_link( $( this ) ); 97 } ); 98 } 99 } 100 } ); 101 }, 102 observer = new MutationObserver( callback ); 103 104 // Start observing the target node for configured mutations 105 observer.observe( targetNode, config ); 106 } 107 function llp_update_percentage_progress( current ) { 108 llp_loader_update_style( 109 'loftloader-pro-progress-percentage-style', 110 '#loftloader-wrapper span.percentage:after, #loftloader-wrapper .load-count:after { content: "' + Math.ceil( current ) + '%"; };' 111 ); 112 } 113 function llp_exclude_a( $a ) { 114 var $loader = $( '#loftloader-wrapper' ), 115 classes = $a.attr( 'class' ), 116 ajax_enabled = classes && ( classes.indexOf( 'ajax' ) !== -1 ), 117 cart = $a.parent( '.site-header-cart').length, 118 excluded = loftloaderPro.insiteTransitionCustomExcluded ? loftloaderPro.insiteTransitionCustomExcluded : false;
119 excluded = ( excluded && $( excluded ).length ) ? $( excluded ) : false; 120 return ! $a.parent('.product-remove').length 121 && ( ( ! $globalExcluded.length ) || $a.not( $globalExcluded ).length ) 122 && ( ( excluded && $a.not( excluded ).length ) || ! excluded ) 123 && ( typeof $a.attr( 'onclick' ) == 'undefined' ) 124 && ! ajax_enabled && ! cart; 125 } 126 // Check if url is to current site 127 function llp_check_url( url ) { 128 if ( url ) { 129 var file_ext = false, site_root = document.createElement( 'a' ), 130 current = document.createElement( 'a' ), target = document.createElement( 'a' ); 131 132 target.href = url; 133 current.href = window.location.href; 134 site_root.href = loftloaderPro.siteRootURL; 135 file_ext = target.pathname.split( '.' ).pop(); 136 137 return ( target.href.replace( /https?:\/\//i, '' ).indexOf( site_root.href.replace( /https?:\/\//i, '' ) ) === 0 ) 138 && ( url.substr( 0, 1 ) !== '#' ) 139 && ! ( ( current.pathname == target.pathname ) && ( target.hash || ( url.indexOf( '#' ) !== -1 ) ) ) 140 && ( llp_file_ext.indexOf( file_ext ) === -1 ); 141 } 142 return false; 143 } 144 // Check if the smooth insite page transition enabled 145 function llp_check_insite_transition() { 146 return loftloaderPro && loftloaderPro.insiteTransition && ( 'on' == loftloaderPro.insiteTransition ) && loftloaderPro.siteRootURL; 147 } 148 /* 149 * @description Update the number when choose progress type bar+number 150 * @param int current percentage number 0 - 100 151 */ 152 function llp_update_progress_count( current, $load ) { 153 if ( $load && $load.length ) { 154 var $count = $load.next( '.load-count' ), 155 container_width = $load.width() * current / 100, 156 offset_x = ( container_width > $count.width() ) ? ( container_width - $count.width() ) : 0, 157 offset_y = $load.parent().hasClass( 'bottom' ) ? '-100%' : '100%'; 158 $count.css( 'transform', 'translate(' + offset_x + 'px, ' + offset_y + ')' ); 159 } 160 } 161 $( window ).bind( 'pageshow', function( event ) { 162 if ( event.originalEvent.persisted ) { 163 var $body = $('body'), $loader = $( '#loftloader-wrapper' ); 164 $loader.length ? $loader.css( 'transition-delay', '0s' ) : ''; 165 if ( $body.length && $body.hasClass( 'leaves' ) ) { 166 $body.removeClass( 'leaves' ); 167 } 168 if ( $body.length && ! $body.hasClass( 'loftloader-loaded' ) ) { 169 $body.addClass( 'loaded loftloader-loaded' ); 170 } 171 } 172 } ); 173 174 // Helper extention to test current element has any of the classes listed. 175 $.fn.llpHasAnyClass = function( classes ) { 176 var self = $( $( this )[0] ), ret = false;
177 $.each( classes, function( i, cls ) { 178 if ( self.hasClass( cls ) ) { 179 ret = true; 180 return false; 181 } 182 } ); 183 return ret; 184 } 185 // Helper function, updating style element in <head> with given id 186 function llp_loader_update_style( id, style ) { 187 var $style = $( 'head' ).find( '#' + id ); 188 if ( ! $style.length ) { 189 $style = $( '<style>' ).attr( 'id', id ).html( '' ).appendTo( $( 'head' ) ); 190 } 191 $style.html( style ); 192 } 193 // Change bg image span width and height for loader type image loading 194 function llp_loader_type_load_bg_span( $span, $image ) { 195 if ( $span.length && $image.length ) { 196 var values = llp_get_width_height( $image ), 197 width = values && values.width ? parseInt( values.width * 10000 ) / 10000 : '100%', 198 height = values && values.height ? parseInt( values.height * 10000 ) / 10000 : '100%'; 199 $span.css( { 'width': width, 'height': height, 'display': '' } ); 200 $image.length ? $image.attr( 'width', width ).attr( 'height', height ) : ''; 201 } 202 } 203 // Helper function to get the image width and height 204 function llp_get_width_height( $elem ) { 205 if ( $elem.length ) { 206 var rect = $elem[0].getBoundingClientRect(); 207 return { 208 'width': ( rect.width ? rect.width : ( rect.right - rect.left ) ), 209 'height': ( rect.height ? rect.height : ( rect.bottom - rect.top ) ) 210 }; 211 } 212 return false; 213 } 214 // Show random message by js 215 function llp_show_random_message() { 216 var $message = $( '#loftloader-wrapper .loader-message' ), message = llp_get_random_message(), 217 presetMessage = LoftLoaderProSessionStorage.getItem( 'loftloader-pro-next-random-message' ); 218 if ( $message.length && message ) { 219 $message.html( presetMessage ? presetMessage : message ); 220 } 221 } 222 // Get random message 223 function llp_get_random_message() { 224 var list = ( typeof loftloaderPro['randomMessage'] === 'undefined' ) ? false : loftloaderPro['randomMessage']; 225 if ( $.isArray( list ) && ( list.length > 0 ) ) { 226 var messageLength = list.length, 227 random = Math.random() * ( messageLength - 1 ); 228 return list[ Math.round( random ) ]; 229 } 230 return false; 231 } 232 233 var $loader = $( '#loftloader-wrapper' ), // Loader container 234 llp_is_customize_preview = loftloaderPro && loftloaderPro.isLoaderPreview && ( 'on' == loftloaderPro.isLoaderPreview ), 235 llp_is_loader_customize = llp_is_customize_preview && ( typeof parent.wp.customize.settings.settings.loftloader_pro_main_switch !== 'undefined' ), 236 llp_is_theme_customize = llp_is_customize_preview && ( typeof parent.wp.customize.settings.settings.loftloader_pro_main_switch === 'undefined' ), 237 llp_load_time = loftloaderPro.minimalLoadTime ? parseFloat( loftloaderPro.minimalLoadTime ) : false, 238 llp_flag_wait = llp_load_time ? true : false, 239 llp_flag_running = true; 240 llp_is_theme_customize ? $( '#loftloader-preview-style-css' ).remove() : ''; 241 llp_show_random_message(); 242 243 // Always run for both customize preview and normal front end. 244 $( document ).on( 'loftloaderpro.image.check', function() { 245 var $img_load_span = $( '#loftloader-wrapper .imgloading-container span' ); 246 if ( $img_load_span.length ) { 247 var $image = $( '#loftloader-wrapper #loader img' ); 248 llp_loader_type_load_bg_span( $img_load_span, $image ); 249 $image.on( 'load', function( e ) { 250 llp_loader_type_load_bg_span( $img_load_span, $image ); 251 } ); 252 $( window ).on( 'resize', function( e ) { 253 llp_loader_type_load_bg_span( $img_load_span, $image ); 254 } ); 255 } 256 } ).ready( function() { 257 $( this ).trigger( 'loftloaderpro.image.check' ); 258 } ); 259 260 // Test if in preview mode. If so, add the hover handler to <body> for loader with percentage progress. 261 if ( llp_is_loader_customize ) { 262 // Remove smooth page transition related styles 263 if ( $( 'html' ).hasClass( 'loftloader-smooth-transition' ) ) { 264 var $html = $( 'html' ); 265 $html.attr( 'data-original-styles' ) ? $html.attr( 'style', $html.attr( 'data-original-styles' ) ) : $html.removeAttr( 'style' ); 266 $html.removeAttr( 'data-original-styles' ).removeClass( 'loftloader-smooth-transition' ); 267 } 268 269 if ( $( '#loftloader-wrapper .percentage' ).length || $( '#loftloader-wrapper .bar .load-count' ).length ) { 270 var $loader = $( '#loftloader-wrapper .percentage' ).length ? $( '#loftloader-wrapper .percentage' ) : $( '#loftloader-wrapper .bar .load-count' ), 271 $bar = $( '#loftloader-wrapper .bar' ); 272 $bar.children( '.load-count' ).length ? llp_update_progress_count( 100, $bar.children( '.load' ) ) : ''; 273 $loader.prop( 'percentage', 0 ); 274 275 $( 'body' ).hover( function() { 276 $loader.prop( 'percentage', 0 ).animate( 277 { percentage: 100 }, 278 { duration: 2850, easing: 'linear', step: function( now ) { 279 $( this ).text( Math.ceil( now ) + '%' ); 280 $( this ).hasClass( 'load-count' ) ? llp_update_progress_count( now, $( this ).prev( '.load' ) ) : ''; 281 } } 282 ) 283 }, function() { 284 $loader.stop( true, true ).text( '100%' ).prop( 'percentage', 0 ); 285 $loader.hasClass( 'load-count' ) ? llp_update_progress_count( 100, $loader.prev( '.load' ) ) : ''; 286 }); 287 } 288 } 289 if ( ! llp_is_customize_preview || llp_is_theme_customize ) { // Otherwise, roll the normal loader script 290 var $progress = $( '#loftloader-wrapper .percentage' ), // Progress element 291 progress_once = $loader.hasClass( 'loftloader-once' ) && $loader.llpHasAnyClass( [ 'loftloader-imgloading', 'loftloader-rainbow', 'loftloader-circlefilling', 'loftloader-waterfilling', 'loftloader-petal
291s' ] ), 292 progress_type = $progress.hasClass( 'percentage' ) ? 'percentage' : 'bar'; 293 $progress = $progress.length ? $progress : $loader.find( '.bar .load' ); 294 var Progress = { 295 finishPause: 800, $el: $loader, runDuration: 700, initValue: 0, startPercentage: 0, 296 progress: $progress, type: progress_type, once: progress_once, max_timeup : false, 297 start: function() { 298 if ( LoftLoaderProSessionStorage.getItem( 'loftloader-pro-smooth-transition' ) && ( 'on' === LoftLoaderProSessionStorage.getItem( 'loftloader-pro-smooth-transition' ) ) ) { 299 this.initValue = leavingProgressMax / 100; 300 LoftLoaderProSessionStorage.setItem( 'loftloader-pro-smooth-transition', 0 ); 301 } 302 $( 'body' ).removeClass( 'loaded loftloader-loaded' ); 303 this.reset(); 304 }, 305 reset: function() { 306 ( this.type == 'percentage' ) ? llp_update_percentage_progress( 100 * this.initValue ) : $progress.css( 'transform', 'scaleX(' + this.initValue + ')' ); 307 this.current = 100 * this.initValue; 308 this.startPercentage = 100 * this.initValue; 309 this.$el.prop( 'percentage', this.startPercentage ); 310 this.render( this.startPercentage, 1 ); 311 }, 312 stop: function( timeup ) { 313 var cb = this.finish; 314 this.render( 100, this.finishPause ); 315 if ( timeup ) { 316 this.timeup = true; 317 } 318 setTimeout( function() { 319 cb(); 320 }, ( this.finishPause + 100 ) ); 321 }, 322 update: function( percentage ) { 323 this.render( percentage ); 324 }, 325 render: function( current, duration ) { 326 if ( this.timeup || ! ( this.$el && this.$el.animate ) ) { 327 return ''; 328 } 329 var progress = this; 330 duration = ( typeof duration === 'undefined' ) ? this.runDuration : duration; 331 if ( current === 100 ) { 332 this.$el.stop( true, false ).animate( { 333 percentage: 100 334 }, { 335 duration: duration, 336 easing: 'swing', 337 step: function( now ) { 338 progress.renderProgress( progress, now ); 339 } } ); 340 } else { 341 this.$el.animate( { 342 percentage: current 343 }, { 344 duration: duration, 345 easing: 'linear', 346 step: function( now ) { 347 progress.renderProgress( progress, now ); 348 } } ); 349 } 350 }, 351 renderProgress: function( progress, now ) { 352 var once = progress.once, type = progress.type, $progress = progress.progress; 353 if ( type == 'percentage' ) { 354 llp_update_percentage_progress( Math.ceil( now ) ); 355 } else { 356 $progress.css( 'transform', 'scaleX(' + ( now / 100 ) + ')' ); 357 if ( $progress.next( '.load-count' ).length ) { 358 llp_update_percentage_progress( Math.ceil( now ) ); 359 llp_update_progress_count( now, $progress ); 360 } 361 } 362 if ( once ) { 363 if ( $loader.hasClass( 'loftloader-imgloading' ) ) { 364 var $img_load_container = $loader.find( '.imgloading-container' ); 365 if ( $loader.hasClass( 'imgloading-horizontal' ) ) { 366 $img_load_container.css( 'width', ( now + '%' ) ); 367 } else { 368 $img_load_container.css( 'height', ( now + '%' ) ); 369 } 370 } else if ( $loader.hasClass( 'loftloader-rainbow' ) ) { 371 var deg = now * 1.8 - 180; 372 llp_loader_update_style( 373 'loftloader_pro_once_rainbow', 374 '#loftloader-wrapper.loftloader-rainbow #loader span { -webkit-transform: rotate(' + deg + 'deg); transform: rotate(' + deg + 'deg); }' 375 ); 376 } else if ( $loader.hasClass( 'loftloader-circlefilling' ) ) { 377 var scaleY = now / 100; 378 llp_loader_update_style( 379 'loftloader_pro_once_circlefilling', 380 '#loftloader-wrapper.loftloader-circlefilling #loader span { -webkit-transform: scaleY(' + scaleY + '); transform: scaleY(' + scaleY + '); }' 381 ); 382 } else if ( $loader.hasClass( 'loftloader-waterfilling' ) ) { 383 var scaleY = now / 100, transY = now - 100; 384 llp_loader_update_style( 385 'loftloader_pro_once_waterfilling', 386 '#loftloader-wrapper.loftloader-waterfilling #loader:before { transform: scaleY(' + scaleY + '); } #loftloader-wrapper.loftloader-waterfilling #loader span {-webkit-transform: translateY(' + transY + '%); transform: translateY(' + transY + '%); }' 387 ); 388 }
388 else if ( $loader.hasClass( 'loftloader-petals' ) ) { 389 var petals = { 390 petal0: '{box-shadow: 0 -15px 0 -15px transparent, 10.5px -10.5px 0 -15px transparent, 15px 0 0 -15px transparent, 10.5px 10.5px 0 -15px transparent, 0 15px 0 -15px transparent, -10.5px 10.5px 0 -15px transparent, -15px 0 0 -15px transparent, -10.5px -10.5px 0 -15px transparent;}', 391 petal1: '{box-shadow: 0 -25px 0 -15px currentColor, 10.5px -10.5px 0 -15px transparent, 15px 0 0 -15px transparent, 10.5px 10.5px 0 -15px transparent, 0 15px 0 -15px transparent, -10.5px 10.5px 0 -15px transparent, -15px 0 0 -15px transparent, -10.5px -10.5px 0 -15px transparent;}', 392 petal2: '{box-shadow: 0 -25px 0 -15px currentColor, 17.5px -17.5px 0 -15px currentColor, 15px 0 0 -15px transparent, 10.5px 10.5px 0 -15px transparent, 0 15px 0 -15px transparent, -10.5px 10.5px 0 -15px transparent, -15px 0 0 -15px transparent, -10.5px -10.5px 0 -15px transparent;}', 393 petal3: '{box-shadow: 0 -25px 0 -15px currentColor, 17.5px -17.5px 0 -15px currentColor, 25px 0 0 -15px currentColor, 10.5px 10.5px 0 -15px transparent, 0 15px 0 -15px transparent, -10.5px 10.5px 0 -15px transparent, -15px 0 0 -15px transparent, -10.5px -10.5px 0 -15px transparent;}', 394 petal4: '{box-shadow: 0 -25px 0 -15px currentColor, 17.5px -17.5px 0 -15px currentColor, 25px 0 0 -15px currentColor, 17.5px 17.5px 0 -15px currentColor, 0 15px 0 -15px transparent, -10.5px 10.5px 0 -15px transparent, -15px 0 0 -15px transparent, -10.5px -10.5px 0 -15px transparent;}', 395 petal5: '{box-shadow: 0 -25px 0 -15px currentColor, 17.5px -17.5px 0 -15px currentColor, 25px 0 0 -15px currentColor, 17.5px 17.5px 0 -15px currentColor, 0 25px 0 -15px currentColor, -10.5px 10.5px 0 -15px transparent, -15px 0 0 -15px transparent, -10.5px -10.5px 0 -15px transparent;}', 396 petal6: '{box-shadow: 0 -25px 0 -15px currentColor, 17.5px -17.5px 0 -15px currentColor, 25px 0 0 -15px currentColor, 17.5px 17.5px 0 -15px currentColor, 0 25px 0 -15px currentColor, -17.5px 17.5px 0 -15px currentColor, -15px 0 0 -15px transparent, -10.5px -10.5px 0 -15px transparent;}', 397 petal7: '{box-shadow: 0 -25px 0 -15px currentColor, 17.5px -17.5px 0 -15px currentColor, 25px 0 0 -15px currentColor, 17.5px 17.5px 0 -15px currentColor, 0 25px 0 -15px currentColor, -17.5px 17.5px 0 -15px currentColor, -25px 0 0 -15px currentColor, -10.5px -10.5px 0 -15px transparent;}', 398 petal8: '{box-shadow: 0 -25px 0 -15px currentColor, 17.5px -17.5px 0 -15px currentColor, 25px 0 0 -15px currentColor, 17.5px 17.5px 0 -15px currentColor, 0 25px 0 -15px currentColor, -17.5px 17.5px 0 -15px currentColor, -25px 0 0 -15px currentColor, -17.5px -17.5px 0 -15px currentColor;}' 399 }, style = '', nums = [88, 75, 63, 50, 38, 25, 13], steps = {88: 'petal7', 75: 'petal6', 63: 'petal5', 50: 'petal4', 38: 'petal3', 25: 'petal2', 13: 'petal1'}; 400 $.each( nums, function( index, value ) { 401 if ( now >= value ) { 402 style = petals[ steps[ value ] ]; 403 return false; 404 } 405 } ); 406 style = ( now === 0 ) ? petals['petal0'] : ( ( now > 98 ) ? petals['petal8'] : style ); 407 llp_loader_update_style( 'loftloader_pro_once_petals', '#loftloader-wrapper.loftloader-petals #loader span' + style ); 408 } 409 } 410 }, 411 finish: function() { 412 $( 'body' ).addClass( 'loaded loftloader-loaded' ).removeClass( 'leaves spt-show-all' ); 413 // Remove class for disable page scroll while loaded 414 setTimeout( function() { 415 $('body').removeClass( 'loftloader-disable-scrolling' ); 416 if ( $('#loftloader-pro-always-show-scrollbar').length ) { 417 $('#loftloader-pro-always-show-scrollbar').remove(); 418 } 419 }, 1000 ); 420 // Remove smooth page transition related styles 421 if ( $( 'html' ).hasClass( 'loftloader-smooth-transition' ) ) { 422 var $html = $( 'html' ); 423 $html.attr( 'data-original-styles' ) ? $html.attr( 'style', $html.attr( 'data-original-styles' ) ) : $html.removeAttr( 'style' ); 424 $html.removeAttr( 'data-original-styles' ).removeClass( 'loftloader-smooth-transition' ); 425 } 426 // Remove settings for diagonally split effect 427 var $loader_wrap = $( '#loftloader-wrapper' ); 428 if ( $loader_wrap.hasClass( 'split-diagonally' ) ) { 429 $loader_wrap.find( '.loader-bg' ).css( 'background', 'none' ); 430 } 431 432 setTimeout( function() { 433 Progress.timeup = false;
434 $( document ).trigger( 'loftloaderprodone' ); 435 }, 1100 ); 436 437 maxTimer ? clearTimeout( maxTimer ) : ''; 438 minTimer ? clearTimeout( minTimer ) : ''; 439 } 440 } 441 if ( $( 'html' ).hasClass( 'loftloader-pro-spt-hide' ) ) { 442 $( 'body' ).addClass( 'loaded loftloader-loaded' ).removeClass( 'loftloader-disable-scrolling' ); 443 $( 'head' ).append( $( '<style>', { 'text': '#loftloader-wrapper.end-split-v.split-diagonally .loader-bg, #loftloader-wrapper.end-split-h.split-diagonally .loader-bg { background: none; }' } ) ); 444 $( 'html' ).removeClass( 'loftloader-pro-spt-hide' ); 445 } else { 446 Progress.start(); 447 // If enable progress or loader with once option, run the loaded percentage calculation. 448 if ( $progress.length || progress_once ) { 449 if ( llp_load_time ) { 450 minTimer = setTimeout( function() { 451 if ( ! llp_flag_running ) { 452 Progress.stop(); 453 } 454 llp_flag_wait = false; 455 }, llp_load_time ); 456 } 457 $( 'body' ).loftloaderProWaitForMedia( { 458 waitForAll: true, 459 each: function( percentage ) { 460 if ( percentage > Progress.startPercentage ) { 461 Progress.update( percentage ); 462 } 463 }, 464 finished: function( previousPercentage ) { 465 if ( llp_flag_wait ) { 466 Progress.render( Math.max( 95, previousPercentage ), llp_load_time ); 467 } else { 468 Progress.stop(); 469 } 470 llp_flag_running = false; 471 } 472 } ); 473 } else { // Otherwise, run the simple process, add the loaded class name to <body> after full content loaded. 474 if ( llp_load_time ) { 475 minTimer = setTimeout( function() { 476 if ( ! llp_flag_running ) { 477 Progress.finish(); 478 } 479 llp_flag_wait = false; 480 }, llp_load_time ); 481 } 482 $( 'body' ).loftloaderProWaitForMedia( { 483 waitForAll: true, 484 each: function( percentage ) { }, 485 finished: function( previousPercentage ) { 486 if ( llp_flag_wait ) { 487 Progress.render( Math.max( 95, previousPercentage ), llp_load_time ); 488 } else { 489 Progress.finish(); 490 } 491 llp_flag_running = false; 492 } 493 } ); 494 } 495 document.addEventListener( 'DOMContentLoaded', function() { 496 var $loader_wrapper = $( '#loftloader-wrapper' ), $closeBtn = $( '#loftloader-wrapper .loader-close-button' ), 497 show_close_time = '', max_load_time = 0; 498 if ( $closeBtn.length && loftloaderPro.showCloseBtnTime ) { 499 show_close_time = parseInt( loftloaderPro.showCloseBtnTime, 10 ); 500 if ( show_close_time ) { 501 setTimeout( function() { 502 $closeBtn.css( 'display', '' ); 503 }, show_close_time ); 504 $closeBtn.on( 'click', function() { 505 Progress.finish(); 506 $( this ).css( 'opacity', '' ); 507 } ); 508 } 509 } 510 if ( loftloaderPro.maximalLoadTime ) { 511 max_load_time = parseInt( loftloaderPro.maximalLoadTime, 10 ); 512 if( max_load_time ) { 513 maxTimer = setTimeout( function( ) { 514 Progress.stop( true ); 515 }, max_load_time ); 516 } 517 } 518 } ); 519 } 520 $( window ).one( 'load', function( e ) { 521 if ( llp_check_insite_transition() ) { 522 if ( loftloaderPro.insiteTransitionURLExcluded && Array.isArray( loftloaderPro.insiteTransitionURLExcluded ) && loftloaderPro.insiteTransitionURLExcluded.length ) { 523 loftloaderPro.insiteTransitionURLExcluded.forEach( function( url ) { 524 if ( $( 'a[href^="' + url + '"]' ).length ) { 525 $globalExcluded = $globalExcluded.add( $( 'a[href^="' + url + '"]' ) ); 526 } 527 } ); 528 } 529 if ( loftloaderPro.insiteTransitionButtons ) { 530 var $sptButtons = $( loftloaderPro.insiteTransitionButtons ); 531 if ( $sptButtons.length ) { 532 $sptButtons.on( 'click', function( e ) { 533 var $loader = $( '#loftloader-wrapper' ); 534 llp_check_random_message(); 535 $( document ).trigger( 'loftloaderpro.spt.start' ); 536 $( 'html' ).removeClass( 'loftloader-pro-spt-hide' ); 537 $loader.length && ! loftloaderPro.insiteTransitionDisplayOption ? $loader.css( 'transition-delay', '' ) : ''; 538 $DOMBody.addClass( 'leaves' ); 539 if ( leavingShowAll ) { 540 $DOMBody.addClass( 'spt-show-all' ); 541 $( document ).trigger( 'loftloaderpro.image.check' ); 542 Progress.initValue = 0; 543 Progress.reset(); 544 Progress.render( ( loftloaderPro.insiteTransitionDisplayOnCurrent ? 100 : leavingProgressMax ), 400 ); 545 LoftLoaderProSessionStorage.setItem( 'loftloader-pro-smooth-transition', 'on' ); 546 } 547 } ); 548 } 549 } 550 $( 'body a' ).each( function() { 551 register_smooth_transition_link( $( this ) ); 552 } ); 553 observe_DOM_changes(); 554 } 555 } ); 556 } 557} ) ( 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.