1(function($) { 2 "use strict"; 3 4 UNCODE.carousel = function(container) { 5 var $owlContainers = $('.owl-carousel-container', container); 6 $owlContainers.each(function() { 7 var $owlContainer = $(this), 8 $owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'), 9 $owlSelector = $('> [class*="owl-carousel"]', $owlContainer), 10 values = {}, 11 tempTimeStamp, 12 newWidth = UNCODE.wwidth, 13 $owlInsideEqual = []; 14 $owlSelector.each(function() { 15 var itemID = $(this).attr('id'), 16 $elSelector = $(('#' + itemID).toString()); 17 values['id'] = itemID; 18 values['items'] = 1; 19 values['columns'] = 3; 20 values['fade'] = false; 21 values['nav'] = false; 22 values['navmobile'] = false; 23 values['navskin'] = 'light'; 24 values['navspeed'] = 400; 25 values['dots'] = false; 26 values['dotsmobile'] = false; 27 values['loop'] = false; 28 values['autoplay'] = false; 29 values['timeout'] = 3000; 30 values['autoheight'] = false; 31 values['stagepadding'] = 0; 32 values['margin'] = 0; 33 values['lg'] = 1; 34 values['md'] = 1; 35 values['sm'] = 1; 36 $.each($(this).data(), function(i, v) { 37 values[i] = v; 38 }); 39 40 if ($(this).closest('.uncode-slider').length) { 41 values['navskin'] = ''; 42 values['navmobile'] = false; 43 //values['dotsmobile'] = true; 44 } else { 45 values['navskin'] = ' style-'+values['navskin']+' style-override'; 46 } 47 48 var setIndexActive = function(event, init){ 49 var init = typeof init === 'undefined' ? false : init, 50 thiis = $(event.currentTarget); 51 if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) { 52 var scrolltop = $(document).scrollTop(), 53 size = event.page.size, 54 i; 55 var setIndex = requestTimeout(function() { 56 for ( i = 0; i < size; i++ ) { 57 var itemCont = event.item.index != null ? (event.item.index + i) : i; 58 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont]; 59 if (thiis.closest('.row-slider').length) { 60 if (currentItem == undefined) { 61 currentItem = thiis.children()[i]; 62 } 63 if ($(currentItem).closest('#page-header').length) { 64 if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) { 65 UNCODE.switchColorsMenu(scrolltop, 'dark'); 66 } else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) { 67 UNCODE.switchColorsMenu(scrolltop, 'light'); 68 } 69 } 70 var owlCustomNav = $elSelector.closest('.owl-carousel-wrapper-nav').find('.uncode-owl-nav-out.skin-inherit'); 71 if (owlCustomNav.length) { 72 if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) { 73 owlCustomNav.addClass('style-dark').removeClass('style-light'); 74 } else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) { 75 owlCustomNav.addClass('style-light').removeClass('style-dark'); 76 } 77 } 78 } 79 var itendIndex = $(currentItem).attr('data-index'); 80 if ( isNaN(itendIndex) ) { 81 itendIndex = 1; 82 } 83 $elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active'); 84 $elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed'); 85 if ($.fn.counterUp) { 86 if (size <= 1) { 87 $elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){ 88 var $counter = $(this); 89 $counter.addClass('started').counterUp({ 90 delay: 10, 91 time: 1500 92 }); 93 }); 94 } else { 95 $('.owl-item', $elSelector).eq(itemCont).find('.uncode-counter:not(.started)').addClass('started').counterUp({ 96 delay: 10, 97 time: 1500 98 }); 99 } 100 } 101 } 102 $elSelector.find('.owl-item.new-indexed').removeClass('new-indexed'); 103 }, 200); 104 } 105 tempTimeStamp = event.timeStamp; 106 } 107 108 /** Initialize */ 109 $elSelector.on('initialize.owl.carousel', function(event) { 110 if (typeof UNCODE.owlNav !== 'undefined') { 111 UNCODE.owlNav(itemID, event); 112 } 113 114 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 115 window.parent.vc.events.on('shortcodeView:beforeUpdate shortcodeView:destroy', function(model) { 116 var shortcode = model.attributes.shortcode, 117 $el = model.view.$el, 118 $row_wrap = $el.closest('.row'); 119 if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') { 120 $row_wrap.find('.owl-carousel-wrapper-nav .uncode-owl-nav-out').remove(); 121 } 122 }); 123 window.parent.vc.events.on('shortcodeView:updated', function(model) { 124 var shortcode = model.attributes.shortcode; 125 if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') { 126 tempTimeStamp = Math.floor(Date.now() / 1000); 127 } 128 }); 129 window.parent.vc.events.on('shortcodeView:updated shortcodeView:ready', function(model) { 130 var shortcode = model.attributes.shortcode; 131 if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') { 132 UNCODE.owlNav(itemID, event); 133 $elSelector.trigger('refresh.owl.carousel'); 134 } 135 }); 136 } 137 // if ( $elSelector.closest('.mega-menu-inner').length ) { 138 // $elSelector.closest('.mega-menu-inner').css({ 139 // visibility: 'hidden', 140 // display: 'block' 141 // }); 142 // $elSelector.data('owl.carousel'); 143 // $elSelector.trigger('refresh.owl.carousel'); 144 // $elSelector.closest('.mega-menu-inner').css({ 145 // display: 'none', 146 // visibility: '', 147 // }); 148 // } 149 // $elSelector.closest('[class*="menu-smart"]').on('show.smapi', function(e, p){
150 // $elSelector.trigger("to.owl.carousel", 0); 151 // }); 152 }); 153 154 /** Initialized */ 155 $elSelector.on('initialized.owl.navigation', function(event) { 156 $('.owl-dot', event.currentTarget).each(function(key, val){ 157 $(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1)); 158 }); 159 }); 160 161 $elSelector.on('initialized.owl.carousel', function(event) { 162 163 if ( $('.isotope-container', event.currentTarget).length ) { 164 window.dispatchEvent(UNCODE.boxEvent); 165 } 166 167 $('.owl-dot.active', $elSelector).on('click', function(){ 168 return false; 169 }); 170 171 var thiis = $(event.currentTarget), 172 // get the time from the data method 173 time = thiis.data("timer-id"), 174 rowParent = thiis.closest('.row-parent'); 175 176 if ( typeof rowParent[0] !== 'undefined' ) { 177 rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized')); 178 } 179 180 if (time) { 181 clearRequestTimeout(time); 182 } 183 184 thiis.addClass('showControls'); 185 var new_time = requestTimeout(function() { 186 thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading'); 187 if (thiis.hasClass('owl-height-viewport')) 188 setItemsRelHeight(thiis); 189 if (thiis.hasClass('owl-height-equal') || thiis.closest('.uncode-wrapper').length) { 190 setItemsHeight(thiis); 191 } 192 if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent()); 193 if (thiis.closest('.unequal, .unexpand').length) { 194 UNCODE.setRowHeight(rowParent[0], true); 195 } 196 if (SiteParameters.dynamic_srcset_active === '1') { 197 UNCODE.refresh_dynamic_srcset_size(thiis); 198 } 199 }, 350); 200 // save the new time 201 thiis.data("timer-id", new_time); 202 203 var scrolltop = $(document).scrollTop(); 204 thiis.closest('.uncode-slider').find('video').removeAttr('poster'); 205 206 //if (!UNCODE.isMobile) { 207 /** fix autoplay when visible **/ 208 $(window).on('load', function(){ 209 if (thiis.data('autoplay')) { 210 if ( !thiis.closest('.sticky-element').length || thiis.closest('.un-submenu').length || thiis.closest('.overlay').length ) { 211 thiis.trigger('stop.owl.autoplay'); 212 } else { 213 thiis.trigger('play.owl.autoplay'); 214 } 215 } 216 if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) { 217 return; 218 } 219 if ( ! thiis.closest('.sticky-element').length && ! thiis.closest('.un-submenu').length && ! thiis.closest('.overlay').length ) { 220 var carouselInView = new Waypoint.Inview({ 221 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 222 element: thiis[0], 223 exited: function() { 224 var el = $(this.element); 225 if (el.data('autoplay') ) { 226 el.trigger('stop.owl.autoplay'); 227 el.data('stopped','true'); 228 } 229 }, 230 enter: function(direction) { 231 var el = $(this.element); 232 requestTimeout(function() { 233 if (el.data('autoplay')) { 234 el.trigger('play.owl.autoplay'); 235 el.data('stopped','false'); 236 } 237 }, 100); 238 } 239 }); 240 } 241 if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) { 242 setTimeout(function(){ 243 window.lenis.resize(); 244 }, 1000); 245 } 246 247 }); 248 //} 249 250 // $(window).on('frontend:carousel_updated', function(){ 251 // Waypoint.refreshAll(); 252 // }); 253 254 if (!thiis.closest('.isotope-system').length && !thiis.closest('.megamenu-block-wrapper').length && !thiis.closest('.overlay').length) { 255 requestTimeout(function() { 256 animate_thumb($('.t-inside', el), event); 257 }, 400); 258 } 259 if (thiis.closest('.isotope-system').length ) { 260 requestTimeout(function() { 261 thiis.closest('.isotope-container').isotope('layout'); 262 }, 400); 263 } 264 if (thiis.closest('.megamenu-block-wrapper').length ) { 265 $(document).on('un-menu-show', function(e, $ul){ 266 if ( thiis.closest($ul).length ) { 267 animate_thumb($('.t-inside', el), event); 268 } 269 }); 270 } 271 if (thiis.closest('.overlay').length ) { 272 $(window).on('menuOpen', function(e, $ul){ 273 animate_thumb($('.t-inside', el), event); 274 }); 275 } 276 277 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 278 currentIndex = $(currentItem).attr('data-index'); 279 280 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 281 if ($(val).closest('.uncode-slider').length) { 282 $(val).removeClass('start_animation'); 283 } 284 }); 285 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 286 if ($(val).closest('.uncode-slider').length) { 287 $(val).removeClass('already-animated'); 288 } 289 }); 290 291 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 292 if ($(val).closest('.uncode-slider').length) { 293 $(val).removeAttr('data-animated'); 294 } 295 }); 296 297 $.each($('.owl-item.cloned', thiis), function(index, val) {
298 $('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true); 299 }); 300 301 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 302 if ($(val).attr('data-index') != currentIndex) { 303 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 304 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 305 } 306 if ($(val).attr('data-index') != currentIndex) { 307 $('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated'); 308 } 309 if ($(val).attr('data-index') == currentIndex) { 310 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 311 } 312 }); 313 314 if (thiis.closest('.uncode-slider').length) { 315 var el = thiis.closest('.row-parent')[0], 316 section = thiis.closest('.vc_section'); 317 if ( section.length ) { 318 el = $('> .row-parent', section)[0]; 319 } 320 if ($(el).data('imgready')) { 321 firstLoaded(el, event); 322 } else { 323 el.addEventListener("imgLoaded", function(el) { 324 firstLoaded(el.target, event); 325 }, false); 326 } 327 var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder; 328 if (transHeight != null) { 329 requestTimeout(function() { 330 thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px'); 331 }, 100); 332 } 333 } else { 334 var el = thiis; 335 el.closest('.uncode-slider').addClass('slider-loaded'); 336 } 337 338 requestTimeout(function() { 339 if (typeof UNCODE.bigText !== 'undefined') { 340 UNCODE.bigText(thiis); 341 } 342 if (thiis.closest('.uncode-slider').length || thiis.closest('.row').find('.uncode-owl-nav-in').length) { 343 if (thiis.data('autoplay')) pauseOnHover(thiis); 344 } 345 }, 500); 346 347 if (thiis.closest('.unequal').length) { 348 $owlInsideEqual.push(thiis.closest('.row-parent')); 349 } 350 351 var containerClasses = '', 352 containerStyle = ''; 353 if ( $('.owl-dots-classes', $owlContainer).length ) { 354 containerClasses = $('.owl-dots-classes', $owlContainer).attr('class'); 355 containerStyle = $('.owl-dots-classes', $owlContainer).attr('style'); 356 $('.owl-dots-classes', $owlContainer).remove(); 357 } 358 359 if ( containerClasses !== '' ) { 360 requestTimeout(function() { 361 if ( containerClasses !== '' ) 362 $('.owl-dots', $owlContainer).attr('style', containerStyle); 363 if ( containerStyle !== '' ) 364 $('.owl-dots', $owlContainer).addClass(containerClasses); 365 }, 100); 366 } 367 368 $.each($('.column_child.pos-bottom', thiis), function(index, val) { 369 $(val).closest('.row-inner').css({ 370 'margin-top': '-1px' 371 }); 372 }); 373 374 if ($.fn.isotope) { 375 if ( thiis.closest('.isotope-container').length ) { 376 if (thiis.closest('.isotope-container').data('isotope')) { 377 requestTimeout(function(){ 378 thiis.closest('.isotope-container').isotope('layout'); 379 }, 300); 380 } 381 $(window).on('load', function(){ 382 if (thiis.closest('.isotope-container').data('isotope')) { 383 thiis.closest('.isotope-container').isotope('layout'); 384 } 385 }); 386 } 387 } 388 389 if (thiis.data('autoplay')) { 390 $(window).on('menuOpen', function(){ 391 if ( thiis.closest('.overlay').length ) { 392 thiis.trigger('play.owl.autoplay'); 393 thiis.data('stopped','false'); 394 } else { 395 thiis.trigger('stop.owl.autoplay'); 396 thiis.data('stopped','true'); 397 } 398 }); 399 $(window).on('menuClose', function(){ 400 if ( thiis.closest('.overlay').length ) { 401 thiis.trigger('stop.owl.autoplay'); 402 thiis.data('stopped','true'); 403 } else { 404 thiis.trigger('play.owl.autoplay'); 405 thiis.data('stopped','false'); 406 } 407 }); 408 } 409 410 setIndexActive(event, true); 411 412 var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) { 413 return !$(this).closest('.nested-carousel').length; 414 }), 415 $_galleries = $('.isotope-container:not([data-lbox-init]), .owl-carousel:not([data-lbox-init]), .custom-grid-container:not([data-lbox-init]), .index-scroll-wrapper:not([data-lbox-init]), .justified-gallery:not([data-lbox-init]), .uncode-single-media-wrapper:not([data-lbox-init]), .woocommerce-product-gallery:not([data-lbox-init]), .icon-box:not([data-lbox-init]), .grid-container:not([data-lbox-init])', thiis).has(nested_a), 416 $galleries = $_galleries.filter(function( index ) { 417 return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel'); 418 }); 419 420 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 421 UNCODE.lightgallery( $galleries ); 422 } 423 424 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 425 $(document).trigger('uncode-scrolltrigger-refresh'); 426 } 427 428 if (thiis.closest('.overlay').length && thiis.data('autoplay')) { 429 thiis.trigger('stop.owl.autoplay'); 430 thiis.data('stopped','true'); 431 } 432 433 if (thiis.closest('.un-submenu').length && thiis.data('autoplay')) { 434 thiis.trigger('stop.owl.autoplay'); 435 thiis.data('stopped','false'); 436 $(document).on('un-menu-show', function(){ 437 thiis.trigger('play.owl.autoplay'); 438 thiis.data('stopped','false'); 439 }).on('un-menu-hide', function(){ 440 thiis.trigger('stop.owl.autoplay'); 441 thiis.data('stopped','true'); 442 }); 443 } 444 }); 445 446 $elSelector.on('resized.owl.carousel', function(event) { 447 $('.owl-dot', event.currentTarget).each(function(key, val){ 448 $(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1)); 449 }); 450 }); 451 452 $elSelector.on('resized.owl.carousel', function(event) { 453 var thiis = $(event.currentTarget); 454 // if ($(this).closest('.nested-carousel').length) { 455 // requestTimeout(function() { 456 // window.dispatchEvent(UNCODE.boxEvent); 457 // }, 200); 458 // } 459 if ( thiis.hasClass('owl-height-equal') ) 460 setItemsHeight(thiis); 461 462 if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) { 463 newWidth = UNCODE.wwidth; 464 setItemsRelHeight($elSelector); 465 } 466 467 setIndexActive(event); 468
469 if (SiteParameters.dynamic_srcset_active === '1') { 470 UNCODE.refresh_dynamic_srcset_size(thiis); 471 } 472 473 if ($.fn.isotope) { 474 $(window).on('load', function(){ 475 if ($(event.currentTarget).closest('.isotope-container').data('isotope')) { 476 $(event.currentTarget).closest('.isotope-container').isotope('layout'); 477 } 478 }); 479 } 480 481 if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) { 482 setTimeout(function(){ 483 window.lenis.resize(); 484 }, 1000); 485 } 486 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 487 $(document).trigger('uncode-scrolltrigger-refresh'); 488 } 489 }); 490 491 $elSelector.on('refreshed.owl.carousel', function(event) { 492 setIndexActive(event); 493 }); 494 495 /** detect resize window for fluid height layout */ 496 var setFluidResize; 497 function manageFluidCarouseHeight() { 498 clearRequestTimeout(setFluidResize); 499 setFluidResize = requestTimeout(function(){ 500 if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) { 501 newWidth = UNCODE.wwidth; 502 setItemsRelHeight($elSelector); 503 } 504 }, 100); 505 } 506 window.addEventListener('resize', manageFluidCarouseHeight); 507 508 /** Change */ 509 $elSelector.on('change.owl.carousel', function(event) { 510 if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget); 511 }); 512 513 /** Changed */ 514 $elSelector.on('changed.owl.carousel', function(event) { 515 var $row = $elSelector.parents('.row')[0]; 516 if ( typeof $row !== 'undefined' ) { 517 $row.dispatchEvent(new CustomEvent('owl-carousel-changed')); 518 } 519 setIndexActive(event); 520 }); 521 522 var checkDrag = function(e) { 523 $elSelector.addClass('owl-dragging'); 524 }; 525 $elSelector.on('drag.owl.carousel', function(event) { 526 document.addEventListener("mousemove", checkDrag); 527 }); 528 529 $elSelector.on('dragged.owl.carousel', function(event) { 530 $elSelector.removeClass('owl-dragging'); 531 document.removeEventListener("mousemove", checkDrag); 532 }); 533 534 $elSelector.on('translate.owl.carousel', function(event) { 535 if (UNCODE.isMobile) { 536 $(event.currentTarget).addClass('owl-translating'); 537 } 538 }); 539 540 /** Translated */ 541 $elSelector.on('translated.owl.carousel', function(event) { 542 543 var thiis = $(event.currentTarget), 544 currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 545 currentIndex = $(currentItem).attr('data-index'), 546 stagePadding = thiis.data('stagepadding'); 547 548 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 549 550 if (!UNCODE.isMobile) { 551 UNCODE.owlPlayVideo(thiis); 552 } 553 554 requestTimeout(function(){ 555 var lastDelayElems = animate_elems($('.owl-item.index-active', thiis)); 556 var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event); 557 if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) { 558 if (lastDelayElems == undefined) lastDelayElems = 0; 559 if (lastDelayThumb == undefined) lastDelayThumb = 0; 560 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 561 thiis.trigger('stop.owl.autoplay'); 562 requestTimeout(function() { 563 if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay'); 564 }, maxDelay); 565 } 566 }, 200); 567 568 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 569 if ($(val).closest('.uncode-slider').length) { 570 $(val).removeClass('start_animation'); 571 } 572 }); 573 574 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 575 if ($(val).closest('.uncode-slider').length) { 576 $(val).removeClass('already-animated'); 577 } 578 }); 579 580 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 581 if ($(val).closest('.uncode-slider').length) { 582 $(val).removeAttr('data-animated'); 583 } 584 }); 585 586 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 587 if ($(val).attr('data-index') != currentIndex) { 588 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 589 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 590 } 591 if ($(val).attr('data-index') != currentIndex) { 592 $('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation'); 593 } 594 if ($(val).attr('data-index') == currentIndex) { 595 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 596 } 597 }); 598 599 if (UNCODE.isMobile) { 600 thiis.removeClass('owl-translating'); 601 } 602 603 setIndexActive(event); 604 }); 605 606 if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25; 607 608 /** Init carousel */ 609 $elSelector.not('.showControls').owlCarousel({ 610 items: values['items'], 611 animateIn: (values['fade'] == true) ? 'fadeIn' : null, 612 animateOut: (values['fade'] == true) ? 'fadeOut' : null, 613 nav: values['nav'], 614 dots: values['dots'], 615 loop: values['loop'], 616 stagePadding: values['stagepadding'], 617 margin: 0, 618 video: true, 619 autoWidth: false, 620 autoplay: false, 621 autoplayTimeout: values['timeout'], 622 autoplaySpeed: values['navspeed'], 623 autoplayHoverPause: $(this).closest('.uncode-slider:not(.uncode-wrapper)').length || $(this).closest('.carousel-no-hover').length ? false : true, 624 autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ), 625 itemSelector: SiteParameters.uncode_carousel_itemSelector, 626 rtl: $('body').hasClass('rtl') ? true : false, 627 fluidSpeed: true, 628 navSpeed: values['navspeed'], 629 dotsSpeed: values['navspeed'] / values['items'], 630 navElement: ['button type="button" aria-label="' + SiteParameters.uncode_prev_label + '"', 'button type="button" aria-label="' + SiteParameters.uncode_next_label + '"'], 631 navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ], 632 navText: ['<div class="owl-nav-container btn-default btn-hover-nobg" tabindex="0"><i class="fa fa-fw fa-angle-left"></i></div>', '<div class="owl-nav-container btn-default btn-hover-nobg" aria-label="' + SiteParameters.uncode_next_label + '" tabindex="0"><i class="fa fa-fw fa-angle-right"></i></div>'], 633 navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false, 634 responsiveClass: true, 635 responsiveBaseElement: '.box-container', 636 responsive: { 637 0: { 638 items: values['sm'], 639 nav: values['navmobile'], 640 dots: values['dotsmobile'], 641 dotsSpeed: values['navspeed'] / values['sm'], 642 }, 643 480: { 644 items: values['sm'], 645 nav: values['navmobile'], 646 dots: values['dotsmobile'], 647 dotsSpeed: values['navspeed'] / values['sm'], 648 }, 649 570: { 650 items: values['md'], 651 nav: values['navmobile'], 652 dots: values['dotsmobile'], 653 dotsSpeed: values['navspeed'] / values['md'], 654 }, 655 960: { 656 items: values['lg'], 657 dotsSpeed: values['navspeed'] / values['lg'], 658 } 659 } 660 }); 661 662 var transDuration = parseFloat(values['navspeed']) * 0.3; 663 var transDuration2 = parseFloat(values['navspeed']) * 0.8; 664 665 $('.owl-item .tmb', $elSelector).css({ 666 '-webkit-transition-delay': transDuration + 'ms', 667 '-moz-transition-delay': transDuration + 'ms', 668 '-o-transition-delay': transDuration + 'ms', 669 'transition-delay': transDuration + 'ms', 670 '-webkit-transition-duration': transDuration2 + 'ms', 671 '-moz-transition-duration': transDuration2 + 'ms', 672 '-o-transition-duration': transDuration2 + 'ms', 673 'transition-duration': transDuration2 + 'ms', 674 }); 675 676 requestTimeout(function() { 677 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 678 UNCODE.setRowHeight($owlInsideEqual[i]); 679 }; 680 }, 300); 681 682 $(window).on('load', function(){ 683 var $elCarousel = $elSelector.data('owl.carousel'); 684 if ( typeof $elCarousel !== 'undefined' ) { 685 $elCarousel.trigger('refreshed'); 686 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 687 UNCODE.setRowHeight($owlInsideEqual[i]); 688 }; 689 } 690 }); 691 692 $( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) { 693 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 694 $('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel'); 695 $('#' + carousel_id).find('.owl-item').each( function() { 696 var $item = $(this), 697 index = ( $item.index() + 1 ); 698 $item.attr('data-index', index); 699 }); 700 } 701 }); 702 703 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 704 window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) { 705 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 706 $('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel'); 707 $('#' + carousel_id).find('.owl-item').each( function() { 708 var $item = $(this), 709 index = ( $item.index() + 1 ); 710 $item.attr('data-index', index); 711 }); 712 } 713 }); 714 } 715 716 }); 717 718 function firstLoaded(el, event) { 719 var el = $(el), 720 uncode_slider = el.find('.uncode-slider'); 721 el.find('.owl-carousel').css('opacity', 1); 722 uncode_slider.addClass('slider-loaded'); 723 if (typeof UNCODE.bigText !== 'undefined') { 724 UNCODE.bigText(el.find('.owl-item.active')); 725 } 726 //if (!UNCODE.isMobile) { 727 requestTimeout(function() { 728 var lastDelayElems = animate_elems(el.find('.owl-item.index-active')); 729 var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event); 730 if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) { 731 if (lastDelayElems == undefined) lastDelayElems = 0; 732 if (lastDelayThumb == undefined) lastDelayThumb = 0; 733 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 734 $('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay'); 735 requestTimeout(function() { 736 $('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay'); 737 }, maxDelay); 738 } 739 }, 500); 740 741 //} 742 } 743 744 function navHover(el) { 745 var $owlCont = el, 746 $owlPrev = $owlCont.find('.owl-prev'), 747 $owlNext = $owlCont.find('.owl-next'), 748 $owlDots = $owlCont.find('.owl-dots-inside .owl-dots'), 749 $owlPagination = $owlCont.next(), 750 owlPrevW = $owlPrev.outerWidth(), 751 owlNextW = $owlNext.outerWidth(), 752 owlDotsH = $owlDots.innerHeight(), 753 owlTime = 400, 754 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 755 if ( $('body').hasClass('rtl') ) { 756 $owlPrev.css("margin-right", -owlPrevW); 757 $owlNext.css("margin-left", -owlNextW); 758 } else { 759 $owlPrev.css("margin-left", -owlPrevW); 760 $owlNext.css("margin-right", -owlNextW); 761 } 762 if (!owlNested) $owlDots.css("bottom", -owlDotsH); 763 $owlCont.mouseenter(function() { 764 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 765 $owlPrev.add($owlNext).css({ 766 marginLeft: 0, 767 marginRight: 0 768 }); 769 if (!owlNested) { 770 $owlDots.css({ 771 opacity: 1, 772 bottom: 0 773 }); 774 } 775 }).mouseleave(function() { 776 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 777 if ( $('body').hasClass('rtl') ) { 778 $owlPrev.css("margin-right", -owlPrevW); 779 $owlNext.css("margin-left", -owlNextW); 780 } else { 781 $owlPrev.css("margin-left", -owlPrevW); 782 $owlNext.css("margin-right", -owlNextW); 783 } 784 if (!owlNested) { 785 $owlDots.css({ 786 opacity: 1, 787 bottom: -owlDotsH 788 }); 789 } 790 }); 791 }; 792 793 function animate_elems($this) { 794 var lastDelay; 795 $.each($('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside), .animate_when_parent_almost_visible:not(.t-inside)', $this), function(index, val) { 796 var element = $(val), 797 delayAttr = element.attr('data-delay'), 798 $first_item = element.closest('.owl-item[data-index="1"]'); 799 800 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) { 801 return false;
802 } 803 804 if (delayAttr == undefined) delayAttr = 0; 805 requestTimeout(function() { 806 element.addClass('start_animation'); 807 }, delayAttr); 808 lastDelay = delayAttr; 809 }); 810 return lastDelay; 811 } 812 813 function animate_thumb(items, event) { 814 var lastDelay, 815 itemIndex, 816 thiis = $(event.currentTarget), 817 tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'), 818 numActives = $('.owl-item.active', thiis).length, 819 stagePadding = thiis.data('stagepadding'); 820 821 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 822 823 thiis.data('tempIndex', event.item.index); 824 $.each(items, function(index, val) { 825 var parent = $(val).closest('.owl-item'); 826 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 827 return; 828 } 829 if (!$(val).hasClass('start_animation')) { 830 if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) { 831 var thumbInView = new Waypoint.Inview({ 832 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 833 element: val, 834 enter: function(direction) { 835 var element = $(this.element), 836 delayAttr = parseInt(element.attr('data-delay')), 837 itemIndex = element.closest('.owl-item').index() + 1, 838 menuIndex = parseFloat(element.closest('.owl-item').attr('data-index')), 839 diffItem = Math.abs(itemIndex - tempIndex) - 1; 840 if ( thiis.closest('.megamenu-block-wrapper').length ) { 841 diffItem = menuIndex; 842 } else { 843 if (itemIndex > tempIndex) { 844 thiis.data('tempIndex', itemIndex); 845 } 846 } 847 if (isNaN(delayAttr)) delayAttr = 100; 848 if (stagePadding) { 849 var objTimeout = requestTimeout(function() { 850 if ( !element.closest('.overlay:not(.open)').length ) { 851 element.addClass('start_animation'); 852 } 853 }, index * delayAttr); 854 lastDelay = index * delayAttr; 855 } else { 856 $('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation'); 857 var objTimeout = requestTimeout(function() { 858 element.attr('data-test', diffItem + ' ' + delayAttr).addClass('start_animation'); 859 }, diffItem * delayAttr); 860 lastDelay = diffItem * delayAttr; 861 } 862 parent.data('objTimeout', objTimeout); 863 if (!UNCODE.isUnmodalOpen) { 864 this.destroy(); 865 } 866 } 867 }); 868 } 869 } 870 }); 871 return lastDelay; 872 } 873 874 function setItemsHeight(item) { 875 $.each($('.owl-item', item), function(index, val) { 876 var availableThumbHeight = $('.t-inside', $(val)).height(), 877 innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(), 878 difference = availableThumbHeight - innerThumbHeight; 879 if ($('.tmb-content-under', val).length) { 880 var visualPart = $('.t-entry-visual', val); 881 if (visualPart.length) { 882 difference -= $('.t-entry-visual', val).height(); 883 } 884 } 885 if (! $('.tmb-content-lateral', val).length) 886 $('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' ); 887 }); 888 } 889 890 function setItemsRelHeight(item) { 891 $.each($('.owl-item', item), function(index, val) { 892 var $rowContainer = $(item).parents('.row-parent').eq(0), 893 paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')), 894 $colContainer = $(item).parents('.uncell').eq(0), 895 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')), 896 winHeight = UNCODE.wheight, 897 multiplier_h = parseInt($(item).attr('data-vp-height')), 898 data_viewport_h, 899 consider_menu = $(item).data('vp-menu'); 900 901 if ( consider_menu ) { 902 winHeight = winHeight - UNCODE.menuHeight; 903 } 904 905 data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol ); 906 $('.t-inside', val).css( 'height', data_viewport_h ); 907 }); 908 } 909 910 function pauseOnHover(slider) { 911 var $owlCustomNavSels = slider.closest('.row').find('.uncode-nav-dots, .uncode-nav-prev, .uncode-nav-next'); 912 $('.owl-dots, .owl-prev, .owl-next', slider).add($owlCustomNavSels).on({ 913 mouseenter: function () { 914 $(slider).addClass('owl-mouseenter'); 915 $(slider).trigger('stop.owl.autoplay'); 916 }, 917 mouseleave: function () { 918 $(slider).removeClass('owl-mouseenter'); 919 $(slider).trigger('play.owl.autoplay'); 920 } 921 }); 922 } 923 }); 924}; 925 926UNCODE.owlPlayVideo = function(carousel) { 927 var player, iframe; 928 $('.owl-item.active .uncode-video-container', carousel).each(function(index, val) { 929 var content = $(val).html(); 930 if (content == '') { 931 var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone(); 932 $(val).append(getCloned); 933 } 934 if ($(this).attr('data-provider') == 'vimeo') { 935 iframe = $(this).find('iframe'); 936 player = new Vimeo.Player(iframe[0]); 937 player.play(); 938 } else if ($(this).attr('data-provider') == 'youtube') { 939 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 940 } else { 941 var player = $(this).find('video'); 942 if (player.length) { 943 $(this).find('video')[0].volume = 0; 944 $(this).find('video')[0].play(); 945 $(val).css('opacity', 1); 946 } 947 } 948 }); 949}; 950 951UNCODE.owlStopVideo = function(carousel) { 952 $('.owl-item .uncode-video-container', carousel).each(function(index, val) { 953 var player, iframe; 954 if ($(this).attr('data-provider') == 'vimeo') { 955 iframe = $(this).find('iframe'); 956 player = new Vimeo.Player(iframe[0]); 957 player.pause(); 958 } else if ($(this).attr('data-provider') == 'youtube') { 959 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 960 } else { 961 var player = $(this).find('video'); 962 if (player.length) { 963 $(this).find('video')[0].volume = 0; 964 $(this).find('video')[0].play(); 965 } 966 } 967 }); 968}; 969 970 971})(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.