1( function( $ ) { 2 3 FLBuilderPhoto = function( settings ) { 4 this.settings = settings; 5 this.nodeClass = '.fl-node-' + settings.id; 6 this.image = $( this.nodeClass + ' .fl-photo-img' ); 7 this.caption = $( this.nodeClass + ' .fl-photo-caption' ); 8 this.usesLightbox = this.image.data( 'link-type' ) === 'lightbox'; 9 this._init(); 10 }; 11 12 FLBuilderPhoto.prototype = { 13 14 settings : {}, 15 nodeClass : '', 16 image : null, 17 18 _init: function() { 19 this.image 20 .on( 'mouseenter', function( e ) { 21 $( this ).data( 'title', $( this ).attr( 'title' ) ).removeAttr( 'title' ); 22 } ) 23 .on( 'mouseleave', function( e ){ 24 $( this ).attr( 'title', $( this ).data( 'title' ) ).data( 'title', null ); 25 } ); 26 27 if ( this.usesLightbox ) { 28 this._doLightbox(); 29 } 30 }, 31 32 _doLightbox: function () { 33 const _self = this; 34 if (typeof $.fn.magnificPopup !== 'undefined') { 35 $(`.fl-node-${ this.settings.id } a`).magnificPopup({ 36 type: 'image', 37 closeOnContentClick: true, 38 closeBtnInside: false, 39 tLoading: '', 40 preloader: true, 41 image: { 42 titleSrc: function(item) { 43 if ( _self.caption ) { 44 return _self.caption.text(); 45 } 46 } 47 }, 48 callbacks: { 49 open: function() { 50 $('.mfp-preloader').html('<i class="fas fa-spinner fa-spin fa-3x fa-fw"></i>'); 51 } 52 } 53 }); 54 } 55 }, 56 } 57 58 function initFlPhotos() { 59 const photoModules = document.querySelectorAll( '.fl-module-photo' ); 60 61 photoModules.forEach( photo => { 62 const id = photo.dataset.node; 63 new FLBuilderPhoto( { 64 id: id, 65 } ) 66 }); 67 } 68 69 document.addEventListener( 'DOMContentLoaded', function() { 70 if ( window.FLBuilder ) { 71 FLBuilder.addHook( 'didCompleteAJAX', initFlPhotos ); 72 FLBuilder.addHook( 'didRenderLayoutComplete', initFlPhotos ); 73 } 74 initFlPhotos(); 75 } ); 76})( 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.