1if ( 'undefined' === typeof window.modulacheckDevice ) { 2 window.modulacheckDevice = function ( opts ) { 3 if ( 'undefined' !== typeof opts ) { 4 let devices = true; 5 if ( 6 'undefined' !== typeof opts.lightbox_devices && 7 'both' !== opts.lightbox_devices 8 ) { 9 if ( 'mobile' === opts.lightbox_devices ) { 10 devices = 1024 > jQuery( window ).width(); 11 } else { 12 devices = 1024 < jQuery( window ).width(); 13 } 14 } 15 return devices; 16 } 17 return false; 18 }; 19} 20 21( function ( $ ) { 22 'use strict'; 23 24 $( document ).ready( function () { 25 initModulaCarousel( $( '.modula-slider' ) ); 26 } ); 27 28 //Divi builder fix - init sliders after modula galery finised building the html. 29 $( document ).on( 'modula_api_after_init', () => { 30 initModulaCarousel( $( '.modula-slider' ) ); 31 } ); 32 33 $( document ).on( 'elementor/popup/show', ( event, id, instance ) => { 34 initModulaCarousel( 35 $( '#elementor-popup-modal-' + id ).find( '.modula-slider' ) 36 ); 37 } ); 38 39 function initModulaCarousel( modulaSliders ) { 40 if ( modulaSliders.length > 0 ) { 41 $.each( modulaSliders, function () { 42 if ( $( this ).data( 'modula-carousel-initialized' ) ) { 43 return; 44 } 45 $( this ).data( 'modula-carousel-initialized', true ); 46 47 const self = this, 48 modulaID = $( this ).attr( 'id' ), 49 config = $( this ).data( 'config' ), 50 nav = $( this ).find( '.modula-carousel-nav' ), 51 main = $( this ).find( '.modula-items' ); 52 53 const options = { 54 ...config.slider_settings, 55 fill: true, 56 Thumbs: false, 57 }; 58 59 const plugins = {}; 60 61 if ( 62 'undefined' !== typeof options.MSplugins && 63 'undefined' !== typeof options.MSplugins.Autoplay && 64 options.MSplugins.Autoplay 65 ) { 66 plugins.Autoplay = Autoplay; 67 } 68 69 if ( 70 'undefined' !== typeof options.Autoplay && 71 options.Autoplay 72 ) { 73 options.Autoplay.progressParentEl = ( ref ) => { 74 if ( 75 'undefined' !== typeof options.Dots && 76 options.Dots 77 ) { 78 return ref.instance.container.querySelector( 79 '.f-carousel__dots .is-current .f-carousel__dot' 80 ); 81 } 82 return ref.instance.container; 83 }; 84 } 85 86 // Define opts.on so we can add events to it. 87 options.on = {}; 88 89 // Create a custom trigger for each fancybox event. 90 options.on[ '*' ] = function ( fancybox, eventName ) { 91 // replace . from event name with _ and set custom event. 92 jQuery( document ).trigger( 93 'modula_slider_' + eventName.replace( /\./g, '_' ), 94 [ fancybox, this ] 95 ); 96 }; 97 98 // Slide pause on hover event 99 options.on[ 'ready change' ] = function ( 100 fancybox, 101 eventName 102 ) { 103 $( self ).trigger( 'afterChange', [ 104 fancybox, 105 config, 106 this, 107 ] ); 108 109 // Compatibility with Modula Video - pauses videos after swipe. 110 const slides = fancybox.slides; 111 $.each( slides, function ( index, slide ) { 112 const initial = slides[ index ].el, 113 initial_player = $( initial ).find( 114 '.modula_video_preview_element' 115 )[ 0 ], 116 icon = $( initial ).find( '.modula-video-icon' ), 117 iframe = $( initial ).find( 'iframe, video' ); 118 if ( $( slide.el ).hasClass( 'is-selected' ) ) { 119 // On 'Auto' nav image size, scale thumbnail navigation viewport based on slide img width. 120 if ( 121 ( 'undefined' !== typeof options.navSize && 122 'auto' === options.navSize ) || 123 ( 'undefined' !== typeof options.snapSlides && 124 'auto' === options.snapSlides ) 125 ) { 126 let imgObj = $( slide.el ).find( 127 'img.pic, picture.pic img' 128 ), 129 vidObj = $( slide.el ).find( 130 '.video-sizer' 131 ), 132 navWidth = false; 133 134 // Check if we have an image, else it may be a video 135 if ( 0 != imgObj.length ) { 136 navWidth = imgObj.attr( 'width' ) + 'px'; 137 } else if ( 0 != vidObj.length ) { 138 navWidth = vidObj.width() + 'px'; 139 } else { 140 navWidth = '100%'; 141 } 142 143 if ( 144 'undefined' !== typeof options.navSize && 145 'auto' === options.navSize && 146 'undefined' !== typeof ModulaNavCarousel
147 ) { 148 $( ModulaNavCarousel.container ).css( 149 'width', 150 navWidth 151 ); 152 } 153 154 if ( 155 'undefined' !== typeof options.snapSlides && 156 'auto' === options.snapSlides && 157 1 === options.slidesToShow 158 ) { 159 $( fancybox.container ) 160 .parent() 161 .css( 'width', navWidth ); 162 } 163 } 164 165 // Start the player(s) on swipe/next 166 if ( 'undefined' !== typeof initial_player ) { 167 if ( modulaVideoPreview.duration > 0 ) { 168 if ( 169 'undefined' !== 170 typeof window.modulaVideoWatchtime[ 171 index 172 ] 173 ) { 174 clearInterval( 175 window.modulaVideoWatchtime[ index ] 176 ); 177 } 178 179 // Track Watchtime 180 window.modulaVideoWatchtime[ index ] = 181 setInterval( async function () { 182 initial_player.load(); 183 // Wait for Vimeo play now to prevent interruption by calls to pause 184 await initial_player.play(); 185 }, modulaVideoPreview.duration * 1000 ); 186 } 187 if ( 188 'undefined' !== 189 typeof $( initial_player ).data( 190 'autothumb' 191 ) && 192 '1' == 193 $( initial_player ).data( 'autothumb' ) 194 ) { 195 icon.hide(); 196 initial_player.play(); 197 } 198 } 199 } else { 200 // Stop the previous playing video in slider. 201 if ( 'undefined' !== typeof iframe ) { 202 iframe.attr( 'src', iframe.attr( 'src' ) ); 203 } 204 205 // Stop the previous player 206 if ( 'undefined' !== typeof initial_player ) { 207 clearInterval( 208 window.modulaVideoWatchtime[ index ] 209 ); 210 // Resets video element & it's poster if any. 211 initial_player.load(); 212 initial_player.pause(); 213 } 214 } 215 } ); 216 }; 217 218 options.on.init = function ( fancybox ) { 219 jQuery( document ).trigger( 220 'modula_fancybox_lightbox_on_init', 221 [ fancybox, this ] 222 ); 223 }; 224 225 const ModulaCarousel = new Carousel( 226 main[ 0 ], 227 options, 228 plugins 229 ); 230 231 if ( nav.length ) { 232 const navConfig = nav.data( 'config' ); 233 const navOptions = { 234 ...navConfig, 235 infinite: false, 236 fill: true, 237 slidesPerPage: 1, 238 dragFree: true, 239 Dots: false, 240 direction: options.direction, // import direction from main slider 241 Sync: { 242 target: ModulaCarousel, // aci dam caruselul principal ca target pentru nav 243 }, 244 center: 245 'undefined' !== typeof options.navSlides && 246 options.navSlides % 2 !== 0, 247 classes: { 248 container: 'f-carousel', 249 viewport: 'f-carousel__viewport', 250 track: 'f-carousel__track', 251 slide: 'modula-slider-nav-item', 252 isLTR: 'is-ltr', 253 isRTL: 'is-rtl', 254 isHorizontal: 'is-horizontal', 255 isVertical: 'is-vertical', 256 inTransition: 'in-transition', 257 isSelected: 'is-selected', 258 }, 259 Navigation: false, 260 }; 261 262 var ModulaNavCarousel = new Carousel( 263 nav[ 0 ], 264 navOptions 265 ); 266 } 267 268 // Lightbox functionality 269 if ( 'fancybox' === config.lightbox ) { 270 if ( 271 'undefined' === typeof config.lightboxOpts && 272 'undefined' !== typeof config.lightbox_settings 273 ) { 274 config.lightboxOpts = config.lightbox_settings; 275 delete config.lightbox_settings; 276 } 277 278 main.on( 279 'click', 280 '.modula-item-link:not( .modula-simple-link )', 281 function ( e ) { 282 e.preventDefault(); 283 284 const slides = main.find( '.f-carousel__track' ), 285 items = slides 286 .find( '.modula-item' ) 287 .filter( ':not( .modula-simple-link )' ), 288 links = jQuery.map( items, function ( o ) { 289 const link = 290 jQuery( o ).find( 291 '.modula-item-link' 292 ), 293 image = jQuery( o ).find( '.pic' ); 294 295 var image_link = image.data( 'full' ); 296 if ( typeof image_link === 'undefined' ) { 297 var image_link = image.attr( 'src' ); 298 } 299 300 if ( link.length > 0 ) { 301 return { 302 src: image_link, 303 opts: { 304 caption: link.data( 'caption' ), 305 alt: image.attr( 'alt' ), 306 thumb: link.attr( 307 'data-thumb' 308 ), 309 $thumb: image.parents( 310 '.modula-item' 311 ), 312 image_id: 313 link.attr( 314 'data-image-id' 315 ), 316 }, 317 }; 318 } 319 } ); 320 321 const index = items.index( 322 jQuery( this ).parents( '.modula-item' ) 323 ); 324 325 config.lightboxOpts.beforeLoad = function () { 326 jQuery( document ).trigger( 327 'modula_fancybox_lightbox_before_load', 328 [ main, this ] 329 ); 330 }; 331 config.lightboxOpts.afterLoad = function () { 332 jQuery( document ).trigger( 333 'modula_fancybox_lightbox_after_load', 334 [ main, this ] 335 ); 336 }; 337 config.lightboxOpts.beforeShow = function () { 338 jQuery( document ).trigger( 339 'modula_fancybox_lightbox_before_show', 340 [ main, this ] 341 ); 342 }; 343 config.lightboxOpts.afterShow = function () { 344 jQuery( document ).trigger( 345 'modula_fancybox_lightbox_after_show', 346 [ main, this ] 347 ); 348 }; 349 config.lightboxOpts.beforeClose = function () { 350 jQuery( document ).trigger( 351 'modula_fancybox_lightbox_before_close', 352 [ main, this ] 353 ); 354 }; 355 config.lightboxOpts.afterClose = function () { 356 jQuery( document ).trigger( 357 'modula_fancybox_lightbox_after_close', 358 [ main, this ] 359 ); 360 }; 361 config.lightboxOpts.onInit = function () { 362 jQuery( document ).trigger( 363 'modula_fancybox_lightbox_on_init', 364 [ main, this ] 365 ); 366 }; 367 config.lightboxOpts.onActivate = function () { 368 jQuery( document ).trigger( 369 'modula_fancybox_lightbox_on_activate', 370 [ main, this ] 371 ); 372 }; 373 config.lightboxOpts.onDeactivate = function () { 374 jQuery( document ).trigger( 375 'modula_fancybox_lightbox_on_deactivate', 376 [ main, this ] 377 ); 378 }; 379 380 if ( modulacheckDevice( config ) ) { 381 jQuery.modulaFancybox.open( 382 links, 383 config.lightboxOpts, 384 index 385 ); 386 } 387 } 388 ); 389 390 main.on( 391 'click', 392 '.gallery-link:not(.simple-link)', 393 function ( evt ) { 394 evt.preventDefault(); 395 if ( modulacheckDevice( config ) ) { 396 const images = 397 $( this ).data( 'gallery-images' ); 398 jQuery.modulaFancybox.open( 399 images, 400 config.lightboxOpts 401 ); 402 } 403 } 404 ); 405 } 406 407 $( this ).trigger( 'init', [ ModulaCarousel, config, this ] ); 408 } ); 409 } 410 } 411} )( 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.