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