1(function($) { 2 'use strict'; 3 function mk_animated_cols() { 4 function equalheight (container){ 5 var currentTallest = 0, 6 currentRowStart = 0, 7 rowDivs = new Array(), 8 $el, 9 topPosition = 0; 10 $(container).each(function() { 11 12 $el = $(this); 13 $($el).height('auto'); 14 topPosition = $el.position().top; 15 16 if (currentRowStart != topPosition) { 17 for (var currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { 18 rowDivs[currentDiv].height(currentTallest); 19 } 20 rowDivs.length = 0; // empty the array 21 currentRowStart = topPosition; 22 currentTallest = $el.height(); 23 rowDivs.push($el); 24 } else { 25 rowDivs.push($el); 26 currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest); 27 } 28 for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { 29 rowDivs[currentDiv].height(currentTallest); 30 } 31 32 }); 33 34 // console.log('recalc' + container + ' ' + currentTallest); 35 36 return currentTallest; 37 } 38 39 40 function prepareCols(el) { 41 var $this = el.parent().parent().find('.mk-animated-columns'); 42 43 var iconHeight = equalheight('.vc_row .animated-column-icon, .animated-column-holder .mk-svg-icon'), 44 titleHeight = equalheight('.vc_row .animated-column-title'), 45 descHeight = equalheight('.vc_row .animated-column-desc'), 46 btnHeight = $this.find('.animated-column-btn').innerHeight(); 47 48 if ($this.hasClass('full-style')) { 49 $this.find('.animated-column-item').each(function() { 50 var $this = $(this), 51 contentHeight = (iconHeight + 30) + (titleHeight + 10) + (descHeight + 70) + 34; 52 /* 53 * Fix AM-2418. 54 * 55 * Column height setting of VC Animated Column doesn't work when Animated Column 56 * content is higher than the setting. So, check column height setting first. 57 * - If the column height setting < Animated Column height, update the column 58 * height based on column height setting. 59 */ 60 var $columnHeight = contentHeight * 1.5 + 50; 61 var $minHeight = parseInt( $this.css( 'min-height' ), 10 ); 62 if ( ! isNaN( $minHeight ) ) { 63 if ( $minHeight < $columnHeight ) { 64 $columnHeight = $minHeight; 65 } 66 } 67 68 $this.height( $columnHeight ); 69 70 var $box_height = $this.outerHeight(true), 71 $icon_height = $this.find('.animated-column-icon, .animated-column-holder .mk-svg-icon').height(); 72 73 $this.find('.animated-column-holder').css({ 74 'paddingTop': $box_height / 2 - $icon_height 75 }); 76 77 78 $this.animate({opacity:1}, 300); 79 }); 80 } else { 81 $this.find('.animated-column-item').each(function() { 82 var $this = $(this), 83 halfHeight = $this.height() / 2, 84 halfIconHeight = $this.find('.animated-column-icon, .animated-column-holder .mk-svg-icon').height()/2, 85 halfTitleHeight = $this.find('.animated-column-simple-title').height()/2; 86 87 $this.find('.animated-column-holder').css({ 88 'paddingTop': halfHeight - halfIconHeight 89 }); 90 91 $this.find('.animated-column-title').css({ 92 'paddingTop': halfHeight - halfTitleHeight 93 }); 94 95 $this.animate({ 96 opacity:1 97 }, 300); 98 99 }); 100 } 101 } 102 103 $('.mk-animated-columns').each(function() { 104 var that = this; 105 MK.core.loadDependencies([ MK.core.path.plugins + 'tweenmax.js' ], function() { 106 var $this = $(that), 107 $parent = $this.parent().parent(), 108 $columns = $parent.find('.column_container'), 109 index = $columns.index($this.parent()); 110 // really bad that we cannot read it before bootstrap - needs full shortcode refactor 111 112 if($this.hasClass('full-style')) { 113 $this.find('.animated-column-item').hover( 114 function() { 115 TweenLite.to($(this).find(".animated-column-holder"), 0.5, { 116 top: '-15%', 117 ease: Back.easeOut 118 }); 119 TweenLite.to($(this).find(".animated-column-desc"), 0.5, { 120 top: '50%', 121 ease: Expo.easeOut 122 }, 0.4); 123 TweenLite.to($(this).find(".animated-column-btn"), 0.3, { 124 top: '50%', 125 ease: Expo.easeOut 126 }, 0.6); 127 }, 128 function() { 129 130 TweenLite.to($(this).find(".animated-column-holder"), 0.5, { 131 top: '0%', 132 ease: Back.easeOut, easeParams:[3] 133 }); 134 TweenLite.to($(this).find(".animated-column-desc"), 0.5, { 135 top: '100%', 136 ease: Back.easeOut 137 }, 0.4); 138 TweenLite.to($(this).find(".animated-column-btn"), 0.5, { 139 top: '100%', 140 ease: Back.easeOut 141 }, 0.2); 142 }); 143 } 144 145 if($this.hasClass('simple-style')) { 146 $this.find('.animated-column-item').hover( 147 function() { 148 TweenLite.to($(this).find(".animated-column-holder"), 0.7, { 149 top: '100%', 150 ease: Expo.easeOut 151 }); 152 TweenLite.to($(this).find(".animated-column-title"), 0.7, { 153 top: '0%', 154 ease: Back.easeOut 155 }, 0.2); 156 }, 157 function() { 158 TweenLite.to($(this).find(".animated-column-holder"), 0.7, { 159 top: '0%', 160 ease: Expo.easeOut 161 }); 162 TweenLite.to($(this).find(".animated-column-title"), 0.7, { 163 top: '-100%', 164 ease: Back.easeOut 165 }, 0.2); 166 }); 167 } 168 169 if($columns.length === index + 1) { 170 prepareCols($this); 171 $(window).on("resize", function() { 172 setTimeout(prepareCols($this), 1000); 173 }); 174 } 175 176 MK.utils.eventManager.subscribe('iconsInsert', function() { 177 prepareCols($this); 178 }); 179 }); 180 181 }); 182 } 183 184 $(window).on('load vc_reload', mk_animated_cols); 185 186}(jQuery)); 187 188(function($) { 189 'use strict'; 190 191 var _toBuild = []; 192 MK.api = window.MK.api || {}; 193 194 MK.component.AdvancedGMaps = function(el) { 195 var $this = $(el), 196 container = document.getElementById( 'mk-theme-container' ), 197 data = $this.data( 'advancedgmaps-config' ), 198 apikey = data.options.apikey ? ('key='+data.options.apikey+'&') : false, 199 map = null, 200 bounds = null, 201 infoWindow = null, 202 position = null; 203 204 var build = function() { 205 data.options.scrollwheel = false;
206 data.options.mapTypeId = google.maps.MapTypeId[data.options.mapTypeId]; 207 data.options.styles = data.style; 208 209 bounds = new google.maps.LatLngBounds(); 210 map = new google.maps.Map(el, data.options); 211 infoWindow = new google.maps.InfoWindow(); 212 213 map.setOptions({ 214 panControl : data.options.panControl, 215 draggable: data.options.draggable, 216 zoomControl: data.options.zoomControl, 217 mapTypeControl: data.options.scaleControl, 218 scaleControl: data.options.mapTypeControl, 219 }); 220 221 var marker, i; 222 223 map.setTilt(45); 224 225 for (i = 0; i < data.places.length; i++) { 226 if(data.places[i].latitude && data.places[i].longitude) { 227 position = new google.maps.LatLng(data.places[i].latitude, data.places[i].longitude); 228 229 bounds.extend(position); 230 231 marker = new google.maps.Marker({ 232 position: position, 233 map: map, 234 title: data.places[i].address, 235 icon: (data.places[i].marker) ? data.places[i].marker : data.icon 236 }); 237 238 239 google.maps.event.addListener(marker, 'click', (function(marker, i) { 240 return function() { 241 if(data.places[i].address && data.places[i].address.length > 1) { 242 infoWindow.setContent('<div class="info_content"><p>'+ data.places[i].address +'</p></div>'); 243 infoWindow.open(map, marker); 244 } else { 245 infoWindow.setContent(''); 246 infoWindow.close(); 247 } 248 }; 249 })(marker, i)); 250 251 /** 252 * If there is only one marker, map.fitBounds will zoom-in too much. 253 * Only run map.fitBounds if the markers are more than 1. Use setCenter 254 * instead if the the marker is only 1. 255 */ 256 if ( i > 0 ) { 257 map.fitBounds( bounds ); 258 } else { 259 // Set latitude and longtitude as float. 260 var latLang = { 261 lat: parseFloat( data.places[i].latitude ), 262 lng: parseFloat( data.places[i].longitude ) 263 }; 264 map.setCenter( latLang ); 265 // Need to setZoom here as we didn't trigger bounds_changed event. 266 map.setZoom( data.options.zoom ); 267 } 268 } 269 } 270 271 var boundsListener = google.maps.event.addListener((map), 'bounds_changed', function(event) { 272 this.setZoom(data.options.zoom); 273 google.maps.event.removeListener(boundsListener); 274 }); 275 276 277 var update = function() { 278 google.maps.event.trigger(map, "resize"); 279 map.setCenter(position); 280 }; 281 update(); 282 283 284 var bindEvents = function() { 285 $( window ).on( 'resize', update ); 286 window.addResizeListener( container, update ); 287 }; 288 bindEvents(); 289 }; 290 291 292 var initAll = function() { 293 for( var i = 0, l = _toBuild.length; i < l; i++ ) { 294 _toBuild[i](); 295 } 296 }; 297 298 MK.api.advancedgmaps = MK.api.advancedgmaps || function() { 299 initAll(); 300 }; 301 302 return { 303 init : function() { 304 _toBuild.push( build ); 305 MK.core.loadDependencies(['https://maps.googleapis.com/maps/api/js?'+apikey+'callback=MK.api.advancedgmaps']); 306 } 307 }; 308 309 }; 310 311})(jQuery); 312(function($) { 313 'use strict'; 314 315 var core = MK.core, 316 path = MK.core.path; 317 318 MK.component.BannerBuilder = function( el ) { 319 var init = function(){ 320 var $this = $(el), 321 data = $this.data( 'bannerbuilder-config' ); 322 323 MK.core.loadDependencies([ MK.core.path.plugins + 'jquery.flexslider.js' ], function() { 324 $this.flexslider({ 325 selector: '.mk-banner-slides > .mk-banner-slide', 326 animation: data.animation, 327 smoothHeight: false, 328 direction:'horizontal', 329 slideshow: true, 330 slideshowSpeed: data.slideshowSpeed, 331 animationSpeed: data.animationSpeed, 332 pauseOnHover: true, 333 directionNav: data.directionNav, 334 controlNav: false, 335 initDelay: 2000,
336 prevText: '', 337 nextText: '', 338 pauseText: '', 339 playText: '' 340 }); 341 }); 342 }; 343 344 return { 345 init : init 346 }; 347 }; 348 349})(jQuery); 350 351 352 353 354 355 356 357 358(function($) { 359 'use strict'; 360 361 var zIndex = 0; 362 363 $('.mk-newspaper-wrapper').on('click', '.blog-loop-comments', function (event) { 364 event.preventDefault(); 365 366 var $this = $(event.currentTarget); 367 var $parent = $this.parents('.mk-blog-newspaper-item'); 368 369 $parent.css('z-index', ++zIndex); 370 $this.parents('.newspaper-item-footer').find('.newspaper-social-share').slideUp(200).end().find('.newspaper-comments-list').slideDown(200); 371 setTimeout( function() { 372 MK.utils.eventManager.publish('item-expanded'); 373 }, 300); 374 }); 375 376 $('.mk-newspaper-wrapper').on('click', '.newspaper-item-share', function (event) { 377 event.preventDefault(); 378 379 var $this = $(event.currentTarget); 380 var $parent = $this.parents('.mk-blog-newspaper-item'); 381 382 $parent.css('z-index', ++zIndex); 383 $this.parents('.newspaper-item-footer').find('.newspaper-comments-list').slideUp(200).end().find('.newspaper-social-share').slideDown(200); 384 setTimeout( function() { 385 MK.utils.eventManager.publish('item-expanded'); 386 }, 300); 387 }); 388 389 var init = function init() { 390 391 // setTimeout Trick to make the VC Front Editor to load the images as well 392 setTimeout( function() { 393 394 // Get All Related Layers 395 var $blog = $('.mk-blog-container'); 396 var $imgs = $blog.find('img[data-mk-image-src-set]'); 397 398 if ( $blog.hasClass('mk-blog-container-lazyload') && $imgs.length ) { 399 400 // Load Images if the user scrolls to them 401 $(window).on('scroll.mk_blog_lazyload', MK.utils.throttle(500, function(){ 402 $imgs.each(function(index, elem) { 403 if ( MK.utils.isElementInViewport(elem) ) { 404 MK.component.ResponsiveImageSetter.init( $(elem) ); 405 $imgs = $imgs.not( $(elem) ); // Remove element from the list when loaded to reduce the amount of iteration in each() 406 } 407 }); 408 })); 409 410 $(window).trigger('scroll.mk_blog_lazyload'); 411 $(window).trigger('resize') 412 413 // Handle the resize 414 MK.component.ResponsiveImageSetter.onResize($imgs); 415 416 } else { 417 418 MK.component.ResponsiveImageSetter.init($imgs); 419 MK.component.ResponsiveImageSetter.onResize($imgs); 420 421 } 422 423 }, 50); 424 425 // If in VC Editor Page, Trigger Resize after 2 second (AM-2490) 426 // This is to fix the Pagination Overlapping issue on first initial blog insert as it takes VC about 1 second to change the Blog Layout on initial stage 427 if ( $('body').hasClass('vc_editor') ) { 428 setTimeout( function() { 429 $(window).trigger('resize'); 430 }, 2000) 431 } 432 433 } 434 435 init(); 436 437 // VC Front-End Editor 438 $(window).on('vc_reload mk-image-loaded', init); 439 440}(jQuery)); 441 442(function($) { 443 'use strict'; 444 445 var core = MK.core, 446 path = core.path; 447 448 MK.component.Chart = function(el) { 449 var init = function() { 450 MK.core.loadDependencies([MK.core.path.plugins + 'jquery.easyPieChart.js'], function() { 451 $('.mk-chart__chart').each(function() { 452 var $this = $(this), 453 $parent_width = $(this).parent().width(), 454 $chart_size = parseInt($this.attr('data-barSize')); 455 456 if ($parent_width < $chart_size) { 457 $chart_size = $parent_width; 458 $this.css('line-height', $chart_size); 459 $this.find('i').css({ 460 'line-height': $chart_size + 'px' 461 }); 462 $this.css({ 463 'line-height': $chart_size + 'px' 464 }); 465 } 466 467 var build = function() { 468 $this.easyPieChart({ 469 animate: 1300, 470 lineCap: 'butt', 471 lineWidth: $this.attr('data-lineWidth'), 472 size: $chart_size, 473 barColor: $this.attr('data-barColor'), 474 trackColor: $this.attr('data-trackColor'), 475 scaleColor: 'transparent', 476 onStep: function(value) {
477 this.$el.find('.chart-percent span').text(Math.ceil(value)); 478 } 479 }); 480 }; 481 482 // refactored only :in-viewport logic. rest is to-do 483 MK.utils.scrollSpy(this, { 484 position: 'bottom', 485 after: build 486 }); 487 }); 488 }); 489 }; 490 491 return { 492 init: init 493 }; 494 }; 495 496})(jQuery); 497 498(function($) { 499 "use strict"; 500 501 $('.mk-clients.column-style').each(function() { 502 var $group = $(this), 503 $listItems = $group.find('li'), 504 listItemsCount = $listItems.length, 505 listStyle = $group.find('ul').attr('style') || '', 506 fullRowColumnsCount = $group.find('ul:first-of-type li').length; 507 508 function recreateGrid() { 509 var i; 510 511 $listItems.unwrap(); 512 513 if (window.matchMedia('(max-width: 550px)').matches && fullRowColumnsCount >= 1) { 514 for (i = 0; i < listItemsCount; i += 1) { 515 $listItems.slice(i, i + 1) 516 .wrapAll('<ul class="mk-clients-fixed-list" style="' + listStyle + '"></ul>'); 517 } 518 } else if (window.matchMedia('(max-width: 767px)').matches && fullRowColumnsCount >= 2) { 519 for (i = 0; i < listItemsCount; i += 2) { 520 $listItems.slice(i, i + 2) 521 .wrapAll('<ul class="mk-clients-fixed-list" style="' + listStyle + '"></ul>'); 522 } 523 } else if (window.matchMedia('(max-width: 960px)').matches && fullRowColumnsCount >= 3) { 524 for (i = 0; i < listItemsCount; i += 3) { 525 $listItems.slice(i, i + 3) 526 .wrapAll('<ul class="mk-clients-fixed-list" style="' + listStyle + '"></ul>'); 527 } 528 } else { 529 for (i = 0; i < listItemsCount; i += fullRowColumnsCount) { 530 $listItems.slice(i, i + fullRowColumnsCount) 531 .wrapAll('<ul style="' + listStyle + '"></ul>'); 532 } 533 } 534 } 535 536 recreateGrid(); 537 $(window).on('resize', recreateGrid); 538 539 }); 540 541}(jQuery)); 542(function($) { 543 'use strict'; 544 545 var core = MK.core, 546 path = MK.core.path; 547 548 // TODO: Repair after Rifat. He repeated The same code twice - other same code is in photoalbum (why by the way?!). 549 // Split it into two separate components when you see reusage 550 MK.component.Category = function( el ) { 551 var init = function(){ 552 core.loadDependencies([ path.plugins + 'pixastic.js' ], function() { 553 blurImage($('.blur-image-effect .mk-loop-item .item-holder ')); 554 }); 555 556 core.loadDependencies([ path.plugins + 'minigrid.js' ], masonry); 557 }; 558 559 var blurImage = function($item) { 560 return $item.each(function() { 561 var $_this = $(this); 562 563 var img = $_this.find('.item-thumbnail'); 564 565 img.clone().addClass("blur-effect item-blur-thumbnail").removeClass('item-thumbnail').prependTo(this); 566 567 var blur_this = $(".blur-effect", this); 568 blur_this.each(function(index, element){ 569 if (img[index].complete === true) { 570 Pixastic.process(blur_this[index], "blurfast", {amount:0.5}); 571 } 572 else { 573 blur_this.load(function () { 574 Pixastic.process(blur_this[index], "blurfast", {amount:0.5}); 575 }); 576 } 577 }); 578 }); 579 }; 580
581 // TODO: find other shortcodes like this design and make it as a component 582 var masonry = function() { 583 if(!$('.js-masonry').length) return; 584 585 function grid() { 586 minigrid({ 587 container: '.js-masonry', 588 item: '.js-masonry-item', 589 gutter: 0 590 }); 591 } 592 593 grid(); 594 $(window).on('resize', grid); 595 }; 596 597 return { 598 init : init 599 }; 600 }; 601 602})(jQuery); 603 604 605 606 607 608 609 610 611(function($) { 612 'use strict'; 613 // Update countdown style in VC FEE - AM-2684. 614 $(window).on('vc_reload', function() { 615 $('.mk-event-countdown-ul').each(function() { 616 if ($(this).width() < 750) { 617 $(this).addClass('mk-event-countdown-ul-block'); 618 } else { 619 $(this).removeClass('mk-event-countdown-ul-block'); 620 } 621 }); 622 }); 623})(jQuery); 624(function ($) { 625 'use strict'; 626 627var init = function init() { 628 $('.mk-faq-wrapper').each( function() { 629 var $this = $(this); 630 var $filter = $this.find('.filter-faq'); 631 var $filterItem = $filter.find('a'); 632 var $faq = $this.find('.mk-faq-container > div'); 633 var currentFilter = ''; 634 635 $filterItem.on('click', function(e) { 636 var $this = $(this); 637 638 currentFilter = $this.data('filter'); 639 $filterItem.removeClass('current'); 640 $this.addClass('current'); 641 642 filterItems( currentFilter ); 643 644 e.preventDefault(); 645 }); 646 647 function filterItems( cat ) { 648 if( cat === '' ) { 649 $faq.slideDown(200).removeClass('hidden'); 650 return; 651 } 652 $faq.not( '.' + cat ).slideUp(200).addClass('hidden'); 653 $faq.filter( '.' + cat ).slideDown(200).removeClass('hidden'); 654 } 655 }); 656} 657init(); 658$(window).on('vc_reload', init); 659 660}( jQuery )); 661(function($) { 662 'use strict'; 663 664 $('.mk-edge-slider').find('video').each(function() { 665 this.pause(); 666 this.currentTime = 0; 667 }); 668 669 MK.component.EdgeSlider = function( el ) { 670 var self = this, 671 $this = $( el ), 672 $window = $(window), 673 $wrapper = $this.parent(), 674 config = $this.data( 'edgeslider-config' ), 675 $nav = $( config.nav ), 676 $prev = $nav.find( '.mk-edge-prev' ), 677 $prevTitle = $prev.find( '.nav-item-caption' ), 678 $prevBg = $prev.find('.edge-nav-bg'), 679 $next = $nav.find( '.mk-edge-next' ), 680 $nextTitle = $next.find( '.nav-item-caption' ), 681 $nextBg = $next.find('.edge-nav-bg'), 682 $navBtns = $nav.find( 'a' ), 683 $pagination = $( '.swiper-pagination' ), 684 $skipBtn = $( '.edge-skip-slider' ), 685 $opacityLayer = $this.find('.edge-slide-content'), 686 $videos = $this.find('video'), 687 currentSkin = null, 688 currentPoint = null, 689 winH = null, 690 opacity = null, 691 offset = null; 692 693 var callbacks = { 694 onInitialize : function( slides ) { 695 self.$slides = $( slides ); 696 697 self.slideContents = $.map( self.$slides, function( slide ) { 698 var $slide = $( slide ), 699 title = $slide.find('.edge-slide-content .edge-title').first().text(), 700 skin = $slide.attr("data-header-skin"), 701 image = $slide.find('.mk-section-image').attr('data-thumb') || 702 $slide.find('.mk-video-section-touch').attr('data-thumb'), 703 bgColor = $slide.find('.mk-section-image').css('background-color'); 704 705 706 return { 707 skin: skin, 708 title: title, 709 image: image, 710 bgColor: bgColor 711 }; 712 }); 713 714 // Set position fixed here rather than css to avoid flash of strangely styled slides befor plugin init 715 if(MK.utils.isSmoothScroll) $this.css('position', 'fixed'); 716 717 setNavigationContent( 1, self.$slides.length - 1 ); 718 setSkin( 0 ); 719 // stopVideos(); 720 playVideo(0); 721 722 setTimeout( function() { 723 $( '.edge-slider-loading' ).fadeOut( '100' ); 724 }, 1000 ); 725 }, 726 727 onBeforeSlide : function( id ) { 728 729 }, 730 731 onAfterSlide : function( id ) { 732 setNavigationContent( nextFrom(id), prevFrom(id) ); 733 setSkin( id ); 734 stopVideos(); // stop all others if needed 735 playVideo( id ); 736 } 737 }; 738 739 740 var nextFrom = function nextFrom(id) { 741 return ( id + 1 === self.$slides.length ) ? 0 : id + 1; 742 }; 743 744 745 var prevFrom = function prevFrom(id) { 746 return ( id - 1 === -1 ) ? self.$slides.length - 1 : id - 1; 747 }; 748 749 750 var setNavigationContent = function( nextId, prevId ) { 751 if(self.slideContents[ prevId ]) { 752 $prevTitle.text( self.slideContents[ prevId ].title ); 753 $prevBg.css( 'background', 754 self.slideContents[ prevId ].image !== 'none' ? 755 'url(' + self.slideContents[ prevId ].image + ')' : 756 self.slideContents[ prevId ].bgColor ); 757 } 758 759 if(self.slideContents[ nextId ]) { 760 $nextTitle.text( self.slideContents[ nextId ].title ); 761 $nextBg.css( 'background', 762 self.slideContents[ nextId ].image !== 'none' ? 763 'url(' + self.slideContents[ nextId ].image + ')' : 764 self.slideContents[ nextId ].bgColor ); 765 } 766 }; 767 768 769 var setSkin = function setSkin( id ) { 770 currentSkin = self.slideContents[ id ].skin; 771 772 $navBtns.attr('data-skin', currentSkin); 773 $pagination.attr('data-skin', currentSkin); 774 $skipBtn.attr('data-skin', currentSkin); 775 776 if( self.config.firstEl ) { 777 MK.utils.eventManager.publish( 'firstElSkinChange', currentSkin ); 778 } 779 }; 780 781 782 var stopVideos = function stopVideos() { 783 $videos.each(function() { 784 this.pause(); 785 this.currentTime = 0; 786 }); 787 }; 788 789 790 var playVideo = function playVideo(id) { 791 var video = self.$slides.eq(id).find('video').get(0); 792 if(video) { 793 video.play(); 794 console.log('play video in slide nr ' + id); 795 } 796 797 }; 798 799 800 var onResize = function onResize() { 801 var height = $wrapper.height(); 802 $this.height( height ); 803 804 var width = $wrapper.width(); 805 $this.width( width ); 806 807 winH = $window.height(); 808 offset = $this.offset().top; 809 810 if(!MK.utils.isSmoothScroll) return; 811 if(MK.utils.isResponsiveMenuState()) { 812 // Reset our parallax layers position and styles when we're in responsive mode 813 $this.css({
814 '-webkit-transform': 'translateZ(0)', 815 '-moz-transform': 'translateZ(0)', 816 '-ms-transform': 'translateZ(0)', 817 '-o-transform': 'translateZ(0)', 818 'transform': 'translateZ(0)', 819 'position': 'absolute' 820 }); 821 $opacityLayer.css({ 822 'opacity': 1 823 }); 824 } else { 825 // or proceed with scroll logic when we assume desktop screen 826 onScroll(); 827 } 828 }; 829 830 var onScroll = function onScroll() { 831 currentPoint = - MK.val.scroll(); 832 833 if( offset + currentPoint <= 0 ) { 834 opacity = 1 + ((offset + currentPoint) / winH) * 2; 835 opacity = Math.min(opacity, 1); 836 opacity = Math.max(opacity, 0); 837 838 $opacityLayer.css({ 839 opacity: opacity 840 }); 841 } 842 843 $this.css({ 844 '-webkit-transform': 'translateY(' + currentPoint + 'px) translateZ(0)', 845 '-moz-transform': 'translateY(' + currentPoint + 'px) translateZ(0)', 846 '-ms-transform': 'translateY(' + currentPoint + 'px) translateZ(0)', 847 '-o-transform': 'translateY(' + currentPoint + 'px) translateZ(0)', 848 'transform': 'translateY(' + currentPoint + 'px) translateZ(0)', 849 'position': 'fixed' 850 }); 851 }; 852 853 onResize(); 854 $window.on('load', onResize); 855 $window.on('resize', onResize); 856 window.addResizeListener( $wrapper.get(0), onResize ); 857 858 if(MK.utils.isSmoothScroll) { 859 onScroll(); 860 $window.on('scroll', function() { 861 if(MK.utils.isResponsiveMenuState()) return; 862 window.requestAnimationFrame(onScroll); 863 }); 864 } 865 866 this.el = el; 867 this.config = $.extend( config, callbacks ); 868 this.slideContents = null; // cache slide contents 869 870 // Let mk_slider know it's EdgeSlider 871 this.config.edgeSlider = true; 872 }; 873 874 MK.component.EdgeSlider.prototype = { 875 init : function() { 876 // Inherit from Slider. add prototypes if needed 877 var slider = new MK.ui.Slider( this.el, this.config ); 878 slider.init(); 879 } 880 }; 881 882})(jQuery); 883 884/* Flickr Feeds */ 885/* -------------------------------------------------------------------- */ 886(function ($) { 887 'use strict'; 888function mk_flickr_feeds() { 889 890 $('.mk-flickr-feeds').each(function() { 891 var $this = $(this), 892 apiKey = $this.attr('data-key'), 893 userId = $this.attr('data-userid'), 894 perPage = $this.attr('data-count'), 895 column = $this.attr('data-column'); 896 897 if ( ! $( '.mk-flickr-feeds' ).is( ':empty' ) ) { 898 return; 899 } 900 901 jQuery.getJSON('https://api.flickr.com/services/rest/?format=json&method=' + 'flickr.photos.search&api_key=' + apiKey + '&user_id=' + userId + '&&per_page=' + perPage + '&jsoncallback=?', function(data) { 902 903 jQuery.each(data.photos.photo, function(i, rPhoto) { 904 var basePhotoURL = 'http://farm' + rPhoto.farm + '.static.flickr.com/' + rPhoto.server + '/' + rPhoto.id + '_' + rPhoto.secret; 905 906 var thumbPhotoURL = basePhotoURL + '_q.jpg'; 907 var mediumPhotoURL = basePhotoURL + '.jpg'; 908 909 var photoStringStart = '<a '; 910 var photoStringEnd = 'title="' + rPhoto.title + '" rel="flickr-feeds" class="mk-lightbox flickr-item jupiter-donut-colitem" href="' + mediumPhotoURL + '"><img src="' + thumbPhotoURL + '" alt="' + rPhoto.title + '"/></a>;'; 911 var photoString = (i < perPage) ? photoStringStart + photoStringEnd : photoStringStart + photoStringEnd; 912 913 jQuery(photoString).appendTo($this); 914 }); 915 }); 916 }); 917 918} 919 mk_flickr_feeds(); 920 $( window ).on( 'vc_reload', mk_flickr_feeds ); 921})(jQuery); 922 923jQuery(function($) { 924 925 'use strict'; 926 927 // Get All Related Layers 928 var init = function init() { 929 var $gallery = $('.mk-gallery'); 930 var $imgs = $gallery.find('img[data-mk-image-src-set]'); 931 932 if ( $gallery.hasClass('mk-gallery-lazyload') && $imgs.length ) { 933 934 // Load Images if the user scrolls to them 935 $(window).on('scroll.mk_gallery_lazyload', MK.utils.throttle(500, function(){ 936 $imgs.each(function(index, elem) { 937 if ( MK.utils.isElementInViewport(elem) ) { 938 MK.component.ResponsiveImageSetter.init( $(elem) ); 939 $imgs = $imgs.not( $(elem) ); // Remove element from the list when loaded to reduce the amount of iteration in each() 940 } 941 }); 942 })); 943 944 $(window).trigger('scroll.mk_gallery_lazyload'); 945 946 // Handle the resize 947 MK.component.ResponsiveImageSetter.onResize($imgs); 948 949 } else { 950 951 MK.component.ResponsiveImageSetter.init($imgs); 952 MK.component.ResponsiveImageSetter.onResize($imgs); 953 954 } 955 } 956 957 init(); 958 $(window).on('vc_reload mk-image-loaded', init); 959 960}); 961 962 963 964(function($) { 965 'use strict'; 966 967 /* Page Section Intro Effects */ 968 /* -------------------------------------------------------------------- */ 969 970 function mk_section_intro_effects() { 971 if (!MK.utils.isMobile()) { 972 if (!$.exists('.mk-page-section.intro-true')) return; 973 974 $('.mk-page-section.intro-true').each(function() { 975 var that = this; 976 MK.core.loadDependencies([ MK.core.path.plugins + 'jquery.sectiontrans.js', MK.core.path.plugins + 'tweenmax.js' ], function() { 977 var $this = $(that), 978 $pageCnt = $this.parent().nextAll('div'), 979 windowHeight = $(window).height(), 980 effectName = $this.attr('data-intro-effect'), 981 $header = $('.mk-header'); 982 983 var effect = { 984 fade: new TimelineLite({paused: true}) 985 .set($pageCnt, { opacity: 0, y: windowHeight * 0.3 }) 986 .to($this, 1, { opacity: 0, ease:Power2.easeInOut }) 987 .to($pageCnt, 1, { opacity: 1, y: 0, ease:Power2.easeInOut}, "-=.7") 988 .set($this, { zIndex: '-1'}), 989 990 zoom_out: new TimelineLite({paused: true}) 991 .set($pageCnt, { opacity: 0, y: windowHeight * 0.3}) 992 .to($this, 1.5, { opacity: .8, scale: 0.8, y: -windowHeight - 100, ease:Strong.easeInOut }) 993 .to($pageCnt, 1.5, { opacity: 1, y: 0, ease:Strong.easeInOut}, "-=1.3"), 994 995 shuffle: new TimelineLite({paused: true}) 996 .to($this, 1.5, { y: -windowHeight/2, ease:Strong.easeInOut }) 997 .to($pageCnt.first(), 1.5, { paddingTop: windowHeight/2, ease:Strong.easeInOut }, "-=1.3") 998 }; 999 1000 console.log($pageCnt); 1001 1002 1003 $this.sectiontrans({ 1004 effect: effectName 1005 }); 1006 1007 if($this.hasClass('shuffled')) { 1008 TweenLite.set($this, { y: -windowHeight/2 }); 1009 TweenLite.set($this.nextAll('div').first(), { paddingTop: windowHeight/2 }); 1010 } 1011 1012 $('body').on('page_intro', function() { 1013 MK.utils.scroll.disable(); 1014 $(this).data('intro', true); 1015 effect[effectName].play(); 1016 setTimeout(function() { 1017 $header.addClass('pre-sticky'); 1018 $header.addClass('a-sticky'); 1019 $('.mk-header-padding-wrapper').addClass('enable-padding'); 1020 $('body').data('intro', false); 1021 if(effectName === 'shuffle') $this.addClass('shuffled'); 1022 }, 1000); 1023
1024 setTimeout(MK.utils.scroll.enable, 1500); 1025 }); 1026 1027 $('body').on('page_outro', function() { 1028 MK.utils.scroll.disable(); 1029 $(this).data('intro', true); 1030 effect[effectName].reverse(); 1031 setTimeout(function() { 1032 $header.removeClass('pre-sticky'); 1033 $header.removeClass('a-sticky'); 1034 $('.mk-header-padding-wrapper').removeClass('enable-padding'); 1035 $('body').data('intro', false); 1036 if($this.hasClass('shuffled')) $this.removeClass('shuffled'); 1037 }, 1000); 1038 1039 setTimeout(MK.utils.scroll.enable, 1500); 1040 }); 1041 }); 1042 }); 1043 1044 } else { 1045 $('.mk-page-section.intro-true').each(function() { 1046 $(this).attr('data-intro-effect', ''); 1047 }); 1048 } 1049 } 1050 1051 mk_section_intro_effects(); 1052 1053 var debounceResize = null; 1054 $(window).on("resize", function() { 1055 if( debounceResize !== null ) { clearTimeout( debounceResize ); } 1056 debounceResize = setTimeout( mk_section_intro_effects, 300 ); 1057 }); 1058 1059 /* Page Section Adaptive Height */ 1060 /* -------------------------------------------------------------------- */ 1061 1062 function mk_section_adaptive_height() { 1063 $( ".mk-page-section.mk-adaptive-height" ).each( function() { 1064 var imageHeight = $( this ).find( ".mk-adaptive-image" ).height(); 1065 $( this ).css( "height", imageHeight ); 1066 }); 1067 } 1068 1069 $( window ).on( "load resize", mk_section_adaptive_height ); 1070 1071 1072 /* Page Section Image Loader */ 1073 /* -------------------------------------------------------------------- */ 1074 1075 // Get All Related Layers 1076 var init = function init() { 1077 var $allLayers = $('.mk-page-section .background-layer').filter(function(index) { 1078 var isLazyLoad = $(this).attr('data-mk-lazyload') === 'true'; 1079 if ( !isLazyLoad ) { 1080 MK.component.BackgroundImageSetter.init( $(this) ); 1081 } 1082 return isLazyLoad; 1083 });; 1084 1085 // Load BG Images if the user scroll to them 1086 if ( $allLayers.length ) { 1087 1088 $(window).on('scroll.mk_page_section_lazyload', MK.utils.throttle(500, function(){ 1089 $allLayers.each(function(index, elem) { 1090 if ( MK.utils.isElementInViewport(elem) ) { 1091 MK.component.BackgroundImageSetter.init( $(elem) ); 1092 $allLayers = $allLayers.not( $(elem) ); // Remove element from the list when loaded to reduce the amount of iteration in each() 1093 } 1094 }); 1095 })); 1096 1097 // First init 1098 $(window).trigger('scroll.mk_page_section_lazyload'); 1099 1100 // Handle the resize 1101 MK.component.BackgroundImageSetter.onResize($allLayers); 1102 1103 } 1104 } 1105 init(); 1106 1107 $(window).on('vc_reload', init); 1108 1109 /* Page Section Layout */ 1110 /* -------------------------------------------------------------------- */ 1111 1112 function mk_section_half_layout() { 1113 $(".mk-page-section.half_boxed").each(function() { 1114 var $section = $(this); 1115 if ($(window).width() > jupiterDonutVars.gridWidth) { 1116 var margin = ($(window).width() - jupiterDonutVars.gridWidth) / 2; 1117 var $section_inner = $section.find('.mk-half-layout-inner'); 1118 if($section.hasClass('half_left_layout')){ 1119 $section_inner.css({ 1120 marginRight: margin + 'px' 1121 }); 1122 } 1123 if($section.hasClass('half_right_layout')){ 1124 $section_inner.css({ 1125 marginLeft: margin + 'px' 1126 }); 1127 } 1128 } 1129 }); 1130 } 1131 1132 $(window).on("load resize", mk_section_half_layout); 1133 1134 /* Page Section - Fluid Width Equal Height Columns */ 1135 /* -------------------------------------------------------------------- */ 1136 function mk_reset_section_fluid_width_equal_height_columns() { 1137 var $colWrappers = '', maxWidth = 850; 1138 1139 $colWrappers = $('.page-section-content.fluid-width-equal-height-columns'); 1140 1141 $colWrappers.each(function() { 1142 var $colWrapper = '', colHeight = 0; 1143 $colWrapper = $(this); 1144 $colWrapper.find('.wpb_column.column_container').each(function() { 1145 var $col = $(this), size = $(this).children('div').length; 1146 if (size > 0) { 1147 $col.removeAttr("style"); 1148 $col.children('div').each(function() { 1149 var $this = $( this ); 1150 /** 1151 * Fix Advanced Google Maps (AGM) issue on page section. 1152 * 1153 * Problem: AGM set the height as inline CSS property (style attribute). 1154 * In this case, the style attribute will be removed before checking the 1155 * elements height in each of the column. That's why AGM container will 1156 * loose the height and the map can't be displayed properly (only 1px) 1157 * because it overlap other row in the page. We need to check if current 1158 * element is AGM or not before removing style attribute of the element. 1159 */ 1160 if ( ! $this.hasClass( 'mk-advanced-gmaps' ) ) { 1161 $this.removeAttr( 'style' ); 1162 } 1163 }); 1164 } 1165 }); 1166 }); 1167 } 1168 1169 function mk_section_fluid_width_equal_height_columns() { 1170 mk_reset_section_fluid_width_equal_height_columns(); 1171 1172 var $colWrappers = '', maxWidth = 850, $pageSection = $('.page-section-content'); 1173 1174 if ( ! $pageSection.hasClass('.fluid-width-equal-height-columns') ) { 1175 $pageSection.find('.wpb_column.column_container').removeAttr( 'style' ); 1176 $pageSection.find('.wpb_column.column_container .vc_element').removeAttr( 'style' ); 1177 } 1178 1179 $colWrappers = $('.page-section-content.fluid-width-equal-height-columns'); 1180 1181 $colWrappers.each(function() { 1182 var $colWrapper = '', colHeight = 0; 1183 $colWrapper = $(this); 1184 1185 if ($colWrapper.length > 0) { 1186 /* Get the minimum height of the wrapper */ 1187 colHeight = $colWrappers.outerHeight(true); 1188 $colWrapper.find('.wpb_column.column_container').each(function() { 1189 var $col = $(this); 1190 if ($col.length > 0) { 1191 colHeight = ($col.outerHeight(true) > colHeight) ? $col.outerHeight(true) : colHeight; 1192 } 1193 }); 1194 } 1195 1196 if (colHeight > 0) { 1197 $colWrapper.find('.wpb_column.column_container').each(function() { 1198 var $col = $(this), size = $(this).children('div').length; 1199 if (size > 0) { 1200 colHeight = ($(window).width() < maxWidth) ? 'initial' : colHe
1200ight; 1201 $col.css("height", colHeight); 1202 if ($colWrapper.hasClass('vertical-align-center')) { 1203 $col.children('div').each(function() { 1204 var elHeight = ($(window).width() < maxWidth) ? 'initial' : (colHeight/size); 1205 /** 1206 * Fix Advanced Google Maps (AGM) issue on page section. 1207 */ 1208 if ( ! $(this).hasClass( 'mk-advanced-gmaps' ) ) { 1209 $(this).css("height", elHeight); 1210 } 1211 }); 1212 } 1213 } 1214 }); 1215 } 1216 }); 1217 } 1218 $(window).on('load vc_reload', function() { 1219 setTimeout(function() { 1220 /* 1221 Somehow the values are not correctly updated for the screens 1222 and we need to put setTimeout to fix the issue. 1223 */ 1224 mk_section_fluid_width_equal_height_columns(); 1225 }, 500); 1226 }); 1227 1228 var debounceResize = null; 1229 $(window).on("resize", function() { 1230 if( debounceResize !== null ) { clearTimeout( debounceResize ); } 1231 debounceResize = setTimeout( mk_section_fluid_width_equal_height_columns(), 500 ); 1232 }); 1233 1234}(jQuery)); 1235 1236(function($) { 1237 'use strict'; 1238 1239 function mk_page_title_parallax() { 1240 if (!MK.utils.isMobile()) { 1241 1242 $('.mk-effect-wrapper').each(function() { 1243 var $this = $(this), 1244 progressVal, 1245 currentPoint, 1246 ticking = false, 1247 scrollY = MK.val.scroll(), 1248 $window = $(window), 1249 windowHeight = $(window).height(), 1250 parentHeight = $this.outerHeight(), 1251 startPoint = 0, 1252 endPoint = $this.offset().top + parentHeight, 1253 effectLayer = $this.find('.mk-effect-bg-layer'), 1254 gradientLayer = effectLayer.find('.mk-effect-gradient-layer'), 1255 cntLayer = $this.find('.mk-page-title-box-content'), 1256 animation = effectLayer.attr('data-effect'), 1257 top = $this.offset().top, 1258 height = $this.outerHeight(); 1259 1260 var parallaxSpeed = 0.7, 1261 zoomFactor = 1.3; 1262 1263 var parallaxTopGap = function() { 1264 var gap = top * parallaxSpeed; 1265 1266 effectLayer.css({ 1267 height : height + gap + 'px', 1268 top : (-gap) + 'px' 1269 }); 1270 }; 1271 1272 1273 if (animation == ("parallax" || "parallaxZoomOut") ) { 1274 parallaxTopGap(); 1275 } 1276 1277 var animationSet = function() { 1278 scrollY = MK.val.scroll(); 1279 1280 if (animation == "parallax") { 1281 currentPoint = (startPoint + scrollY) * parallaxSpeed; 1282 effectLayer.get(0).style.transform = 'translateY(' + currentPoint + 'px)'; 1283 } 1284 1285 if (animation == "parallaxZoomOut") { 1286 console.log(effectLayer); 1287 currentPoint = (startPoint + scrollY) * parallaxSpeed; 1288 progressVal = (1 / (endPoint - startPoint) * (scrollY - startPoint)); 1289 var zoomCalc = zoomFactor - ((zoomFactor - 1) * progressVal); 1290 1291 effectLayer.get(0).style.transform = 'translateY(' + currentPoint + 'px) scale(' + zoomCalc + ')'; 1292 } 1293 1294 if (animation == "gradient") { 1295 progressVal = (1 / (endPoint - startPoint) * (scrollY - startPoint)); 1296 gradientLayer.css({ 1297 opacity: progressVal * 2 1298 }); 1299 } 1300 1301 if (animation != "gradient") { 1302 progressVal = (1 / (endPoint - startPoint) * (scrollY - startPoint)); 1303 cntLayer.css({ 1304 opacity: 1 - (progressVal * 4) 1305 }); 1306 } 1307 1308 // Stop ticking 1309 ticking = false; 1310 }; 1311 animationSet(); 1312 1313 // This will limit the calculation of the background position to 1314 // 60fps as well as blocking it from running multiple times at once 1315 var requestTick = function() { 1316 if (!ticking) { 1317 window.requestAnimationFrame(animationSet); 1318 ticking = true; 1319 } 1320 }; 1321 1322 $window.off('scroll', requestTick); 1323 $window.on('scroll', requestTick); 1324 1325 }); 1326 } 1327 } 1328 1329 1330 var $window = $(window); 1331 var debounceResize = null; 1332 1333 $window.on('load', mk_page_title_parallax); 1334 $window.on("resize", function() { 1335 if( debounceResize !== null ) { clearTimeout( debounceResize ); } 1336 debounceResize = setTimeout( mk_page_title_parallax, 300 ); 1337 }); 1338 1339}(jQuery)); 1340 1341(function($) { 1342 'use strict'; 1343 var utils = MK.utils, 1344 core = MK.core, 1345 path = MK.core.path; 1346 MK.component.PhotoAlbum = function(el) { 1347 this.album = el; 1348 this.initialOpen = false;
1349 }; 1350 MK.component.PhotoAlbum.prototype = { 1351 dom: { 1352 gallery: '.slick-slider-wrapper', 1353 title: '.slick-title', 1354 galleryContainer: '.slick-slides', 1355 closeBtn: '.slick-close-icon', 1356 thumbList: '.slick-dots', 1357 thumbs: '.slick-dots li', 1358 imagesData: 'photoalbum-images', 1359 titleData: 'photoalbum-title', 1360 idData: 'photoalbum-id', 1361 urlData: 'photoalbum-url', 1362 activeClass: 'is-active' 1363 }, 1364 tpl: { 1365 gallery: '#tpl-photo-album', 1366 slide: '<div class="slick-slide"></div>' 1367 }, 1368 init: function() { 1369 this.cacheElements(); 1370 this.bindEvents(); 1371 this.openByLink(); 1372 }, 1373 cacheElements: function() { 1374 this.$album = $(this.album); 1375 this.imagesSrc = this.$album.data(this.dom.imagesData); 1376 this.albumLength = this.imagesSrc.length; 1377 this.title = this.$album.data(this.dom.titleData); 1378 this.id = this.$album.data(this.dom.idData); 1379 this.url = this.$album.data(this.dom.urlData); 1380 this.images = []; // stores dom objects to insert into gallery instance 1381 }, 1382 bindEvents: function() { 1383 this.$album.not('[data-photoalbum-images="[null]"]').on('click', this.albumClick.bind(this)); 1384 $(document).on('click', this.dom.closeBtn, this.closeClick.bind(this)); 1385 $(window).on('resize', this.thumbsVisibility.bind(this)); 1386 $(window).on('resize', this.makeArrows.bind(this)); 1387 }, 1388 albumClick: function(e) { 1389 e.preventDefault(); 1390 this.open(); 1391 MK.ui.loader.add(this.album); 1392 }, 1393 closeClick: function(e) { 1394 e.preventDefault(); 1395 // Because one close btn rules them all 1396 if (this.slider) { 1397 this.removeGallery(); 1398 this.slider.exitFullScreen(); 1399 } 1400 }, 1401 thumbsVisibility: function() { 1402 if (!this.thumbsWidth) return; 1403 if (window.matchMedia('(max-width:' + (this.thumbsWidth + 260) + 'px)').matches) this.hideThumbs(); // 260 is 2 * 120 - right corner buttons width + scrollbar 1404 else this.showThumbs(); 1405 }, 1406 hideThumbs: function() { 1407 if (!this.$thumbList) return; 1408 this.$thumbList.hide(); 1409 }, 1410 showThumbs: function() { 1411 if (!this.$thumbList) return; 1412 this.$thumbList.show(); 1413 }, 1414 open: function() { 1415 var self = this; 1416 core.loadDependencies([path.plugins + 'slick.js'], function() { 1417 self.createGallery(); 1418 self.loadImages(); 1419 }); 1420 }, 1421 createGallery: function() { 1422 // only one per page 1423 if (!$(this.dom.gallery).length) { 1424 var tpl = $(this.tpl.gallery).eq(0).html(); 1425 $('body').append(tpl); 1426 } 1427 // and cache obj 1428 this.$gallery = $(this.dom.gallery); 1429 this.$closeBtn = $(this.dom.closeBtn); 1430 }, 1431 createSlideshow: function() { 1432 var self = this; 1433 this.slider = new MK.ui.FullScreenGallery(this.dom.galleryContainer, { 1434 id: this.id, 1435 url: this.url 1436 }); 1437 this.slider.init(); 1438 $(window).trigger('resize'); 1439 this.makeArrows(); 1440 this.$thumbList = $(this.dom.thumbList); 1441 this.$thumbs = $(this.dom.thumbs); 1442 this.thumbsWidth = (this.$thumbs.length) * 95; 1443 this.thumbsVisibility(); 1444 setTimeout(function() { 1445 MK.ui.loader.remove(self.album); 1446 }, 100); 1447 MK.utils.eventManager.publish('photoAlbum-open'); 1448 }, 1449 makeArrows: function() { 1450 if (this.arrowsTimeout) clearTimeout(this.arrowsTimeout); 1451 this.arrowsTimeout = setTimeout(function() { 1452 var $prev = $('.slick-prev').find('svg'); 1453 var $next = $('.slick-next').find('svg'); 1454 $prev.wrap('<div class="slick-nav-holder"></div>'); 1455 $next.wrap('<div class="slick-nav-holder"></div>'); 1456 if (matchMedia("(max-width: 1024px)").matches) { 1457 $prev.attr({ 1458 width: 12, 1459 height: 22 1460 }).find('polyline').attr('points', '12,0 0,11 12,22'); 1461 $next.attr({ 1462 width: 12, 1463 height: 22 1464 }).find('polyline').attr('points', '0,0 12,11 0,22'); 1465 } else { 1466 $prev.attr({ 1467 width: 33, 1468 height: 65 1469 }).find('polyline').attr('points', '0.5,0.5 32.5,32.5 0.5,64.5'); 1470 $next.attr({ 1471 width: 33, 1472 height: 65 1473 }).find('polyline').attr('points', '0.5,0.5 32.5,32.5 0.5,64.5'); 1474 } 1475 }, 0); 1476 }, 1477 loadImages: function() { 1478 var self = this, 1479 n = 0; 1480 // cache images on first load. 1481 if (!this.images.length) {
1482 this.imagesSrc.forEach(function(src) { 1483 if (src === null) return; // protect from nulls 1484 var img = new Image(); 1485 img.onload = function() { 1486 self.onLoad(n += 1); 1487 }; 1488 img.src = src; 1489 self.images.push(img); 1490 }); 1491 } else { 1492 this.onLoad(this.albumLength); 1493 } 1494 }, 1495 onLoad: function(n) { 1496 if (n === this.albumLength) { 1497 this.insertImages(); 1498 this.showGallery(); 1499 this.createSlideshow(); 1500 } 1501 }, 1502 insertImages: function() { 1503 var $galleryContainer = this.$gallery.find(this.dom.galleryContainer), 1504 $title = $(this.dom.title), 1505 slide = this.tpl.slide; 1506 // clear first 1507 $galleryContainer.html(''); 1508 $title.html(this.title); 1509 this.images.forEach(function(img) { 1510 var $slide = $(slide); 1511 $slide.html(img); 1512 $galleryContainer.prepend($slide); 1513 }); 1514 }, 1515 showGallery: function() { 1516 var self = this; 1517 this.$gallery.addClass(this.dom.activeClass); 1518 utils.scroll.disable(); 1519 }, 1520 removeGallery: function() { 1521 var self = this; 1522 this.$gallery.removeClass(this.dom.activeClass); 1523 setTimeout(function() { 1524 self.$gallery.remove(); 1525 }, 300); 1526 utils.scroll.enable(); 1527 }, 1528 openByLink: function() { 1529 var loc = window.location, 1530 hash = loc.hash, 1531 id; 1532 if (hash.length && hash.substring(1).length) { 1533 id = hash.substring(1); 1534 id = id.replace('!loading', ''); 1535 if (id == this.id && !this.initialOpen) { 1536 this.initialOpen = true; 1537 this.open(); 1538 } 1539 } 1540 } 1541 }; 1542 // Barts note; Rifat duplication and coupling here. Remove it when have time 1543 MK.component.PhotoAlbumBlur = function(el) { 1544 var init = function() { 1545 core.loadDependencies([path.plugins + 'pixastic.js'], function() { 1546 blurImage($('.mk-album-item figure')); 1547 }); 1548 }; 1549 var blurImage = function($item) { 1550 return $item.each(function() { 1551 var $_this = $(this); 1552 var img = $_this.find('.album-cover-image'); 1553 img.clone().addClass("blur-effect item-blur-thumbnail").removeClass('album-cover-image').prependTo(this); 1554 var blur_this = $(".blur-effect", this); 1555 blur_this.each(function(index, element) { 1556 if (img[index].complete === true) { 1557 Pixastic.process(blur_this[index], "blurfast", { 1558 amount: 0.5 1559 }); 1560 } else { 1561 blur_this.load(function() { 1562 Pixastic.process(blur_this[index], "blurfast", { 1563 amount: 0.5 1564 }); 1565 }); 1566 } 1567 }); 1568 }); 1569 }; 1570 return { 1571 init: init 1572 }; 1573 }; 1574})(jQuery); 1575 1576jQuery(document).ready(function( $ ) { 1577 1578 // Continue only on Safari. 1579 if ( typeof window.safari === 'undefined' ) { 1580 return; 1581 } 1582 1583 // Fore redraw for Safari. This is a hack. 1584 function mkRedraw() { 1585 $('.mk-photo-roller').hide().show(0); 1586 } 1587 1588 mkRedraw(); 1589 1590 $( window ).resize( function() { 1591 mkRedraw() 1592 } ); 1593 1594}); 1595jQuery(function($) { 1596 1597 'use strict'; 1598 1599 // Get All Related Layers 1600 var init = function init() { 1601 var $portfolio = $('.portfolio-grid'); 1602 var $imgs = $portfolio.find('img[data-mk-image-src-set]'); 1603 1604 if ( $portfolio.hasClass('portfolio-grid-lazyload') && $imgs.length ) { 1605 1606 // Load Images if the user scrolls to them 1607 $(window).on('scroll.mk_portfolio_lazyload', MK.utils.throttle(500, function(){ 1608 $imgs.each(function(index, elem) { 1609 if ( MK.utils.isElementInViewport(elem) ) { 1610 MK.component.ResponsiveImageSetter.init( $(elem) ); 1611 $imgs = $imgs.not( $(elem) ); // Remove element from the list when loaded to reduce the amount of iteration in each() 1612 } 1613 }); 1614 })); 1615 1616 $(window).trigger('scroll.mk_portfolio_lazyload'); 1617 1618 // Handle the resize 1619 MK.component.ResponsiveImageSetter.onResize($imgs); 1620 1621 } else { 1622 1623 MK.component.ResponsiveImageSetter.init($imgs); 1624 MK.component.ResponsiveImageSetter.onResize($imgs); 1625 1626 } 1627 } 1628 1629 init(); 1630 $(window).on('vc_reload mk-image-loaded', function(){ 1631 init(); 1632 1633 $('.mk-portfolio-container').each(function(){ 1634 var id = $(this).attr('id'); 1635 var el = '#' + id + '.mk-portfolio-container.js-el'; 1636 1637 if($(this).data('mk-component') == 'Grid') { 1638 // Disable VC frontend component init for portfolio. 1639 $(el).data('init-Grid', true); 1640 1641 // Init Grid component on shortcode render. 1642 var component = new MK.component[ 'Grid' ]( el ); 1643 component.init(); 1644 } 1645 }); 1646 1647 }); 1648 1649}); 1650 1651 1652 1653jQuery(document).ready(function($) { 1654 'use strict'; 1655 /** 1656 * Get dynamic width of items for passing in `flexslider()`. 1657 * @param string style Style of the carousel, classic/modern 1658 * @param integer showItems Number of items to show 1659 * @param integer id ID of the carousel
1660 * @return interger The width for items 1661 */ 1662 function get_item_width(style, showItems, id) { 1663 var item_width; 1664 if (style == "classic") { 1665 item_width = 275; 1666 items_to_show = 4; 1667 } else { 1668 var screen_width = $('#portfolio-carousel-' + id).width(), 1669 items_to_show = showItems; 1670 if (screen_width >= 1100) { 1671 item_width = screen_width / items_to_show; 1672 } else if (screen_width <= 1200 && screen_width >= 800) { 1673 item_width = screen_width / 3; 1674 } else if (screen_width <= 800 && screen_width >= 540) { 1675 item_width = screen_width / 2; 1676 } else { 1677 item_width = screen_width; 1678 } 1679 } 1680 return item_width; 1681 } 1682 jQuery(window).on("load vc_reload", function() { 1683 MK.core.loadDependencies([MK.core.path.plugins + 'jquery.flexslider.js'], function() { 1684 1685 $('.portfolio-carousel .mk-flexslider').each(function() { 1686 var $this = $(this); 1687 var $pauseOnHover = $this.attr('data-pauseOnHover') == "true" ? true : false; 1688 var $slideshow = $this.attr('data-slideshow') == "true" ? true : false; 1689 1690 $this.flexslider({ 1691 selector: ".mk-flex-slides > li", 1692 animation: "slide", 1693 slideshowSpeed: parseInt($this.attr('data-slideshowSpeed')), 1694 animationSpeed: parseInt($this.attr('data-animationSpeed')), 1695 pauseOnHover: $pauseOnHover, 1696 controlNav: false, 1697 smoothHeight: false, 1698 useCSS: false, 1699 directionNav: $this.data('directionNav'), 1700 prevText: "", 1701 nextText: "", 1702 itemWidth: get_item_width($this.data('style'), $this.data('showItems'), $this.data('id')), 1703 itemMargin: 0, 1704 maxItems: ($this.data('style') === 'modern') ? $this.data('showItems') : 4, 1705 minItems: 1, 1706 move: 1, 1707 slideshow: $slideshow, 1708 }); 1709 }); // End each(). 1710 }); // End loadDependencies(). 1711 }); // End on(). 1712}); 1713 1714(function($) { 1715 if (window.addEventListener) { 1716 window.addEventListener('load', handleLoad, false); 1717 } 1718 else if (window.attachEvent) { 1719 window.attachEvent('onload', handleLoad); 1720 } 1721 1722 function handleLoad() { 1723 $('.mk-slideshow-box').each(run); 1724 } 1725 1726 function run() { 1727 var $slider = $(this); 1728 1729 var $slides = $slider.find('.mk-slideshow-box-item'); 1730 var $transition_time = $slider.data('transitionspeed'); 1731 var $time_between_slides = $slider.data('slideshowspeed'); 1732 1733 $slider.find('.mk-slideshow-box-content').children('p').filter(function() { 1734 if ( $.trim($(this).text()) == '' ) { 1735 return true; 1736 } 1737 }).remove(); 1738 1739 // set active classes 1740 $slides.first().addClass('active').fadeIn($transition_time, function(){ 1741 setTimeout(autoScroll, $time_between_slides); 1742 }); 1743 1744 // auto scroll 1745 function autoScroll(){ 1746 var $i = $slider.find('.active').index(); 1747 $slides.eq($i).removeClass('active').fadeOut($transition_time); 1748 if ($slides.length == $i + 1) $i = -1; // loop to start 1749 $slides.eq($i + 1).addClass('active').fadeIn($transition_time, function() { 1750 setTimeout(autoScroll, $time_between_slides); 1751 }); 1752 } 1753 1754 /** 1755 * Need to set the height manually as min-height property doesn't work with display 1756 * table and table-cell in Firefox and Safari. We use Javascript to set them only 1757 * for Firefox and Safari to avoid any problem with Chrome users. The problem is only 1758 * happen when the window screen size bigger than 850px. 1759 */ 1760 var browserName = MK.utils.browser.name; 1761 if ( browserName === 'Firefox' || browserName === 'Safari' ) { 1762 var currentWidth = parseInt( $( window ).width() ); 1763 if ( currentWidth >= 850 ) { 1764 var height = $slider.css( 'min-height' ); 1765 if ( typeof height !== 'undefined' ) { 1766 $slider.find( '.mk-slideshow-box-items' ).height( parseInt( height ) ); 1767 } 1768 } else { 1769 $slider.find( '.mk-slideshow-box-items' ).removeAttr( 'style' ); 1770 } 1771 } 1772 } 1773 $(window).on('vc_reload', function(){ 1774 handleLoad(); 1775 }); 1776 1777 // Handle resize event only for Safari and Firefox. 1778 window.addEventListener( 'resize', function(){ 1779 var browserName = MK.utils.browser.name; 1780 if ( browserName === 'Firefox' || browserName === 'Safari' ) { 1781 handleLoad(); 1782 } 1783 }, true); 1784}(jQuery)); 1785 1786(function($) { 1787 'use strict'; 1788 1789 $(".mk-subscribe").each(function() { 1790 var $this = $(this); 1791 1792 $this.find('.mk-subscribe--form').submit(function(e){ 1793 $this.addClass('form-in-progress'); 1794 e.preventDefault(); 1795 $.ajax({ 1796 url: MK.core.path.ajaxUrl, 1797 type: "POST", 1798 data: { 1799 action: "mk_ajax_subscribe", 1800 email: $this.find(".mk-subscribe--email").val(), 1801 list_id: $this.find(".mk-subscribe--list-id").val(), 1802 optin: $this.find(".mk-subscribe--optin").val() 1803 }, 1804 success: function (response) { 1805 console.log(response) 1806 $this.removeClass('form-in-progress'); 1807 var data = $.parseJSON(response), 1808 $messaage_box = $this.find(".mk-subscribe--message"); 1809 1810 $messaage_box.html(data.message); 1811 1812 if(data.action_status == true) { 1813 $messaage_box.addClass('success'); 1814 } else { 1815 $messaage_box.addClass('error'); 1816 } 1817 1818 $this.find(".mk-subscribe--email").val(''); 1819 1820 } 1821 }); 1822 }); 1823 }); 1824 1825}(jQuery)); 1826 1827(function( $ ) { 1828 'use strict'; 1829 1830 // If we want to get access to API of already initilised component we run a regular new conctructor. 1831 // When instance is discovered in cache object then we return exisiting instance. 1832 // 1833 // TODO move it to core functions and run logic on init
1834 // var init = function init() { 1835 var _instancesCollection = {}; 1836 1837 var MK = window.MK || {}; 1838 window.MK = MK; 1839 MK.component = window.MK.component || {}; 1840 1841 MK.component.SwipeSlideshow = function( el ) { 1842 var $this = $( el ); 1843 var id = $this.parent().attr('id'); 1844 1845 this.el = el; 1846 this.id = id; 1847 this.config = $this.data( 'swipeslideshow-config' ); 1848 if( this.config ) this.config.hasPagination = false; 1849 }; 1850 1851 MK.component.SwipeSlideshow.prototype = { 1852 init : function() { 1853 var slider = new MK.ui.Slider( this.el, this.config ); 1854 slider.init(); 1855 1856 _instancesCollection[ this.id ] = slider; 1857 } 1858 }; 1859 1860 1861 // Additional nav 1862 // Mostly for thumbs in woocommerce 1863 MK.component.SwipeSlideshowExtraNav = function( el ) { 1864 this.el = el; 1865 }; 1866 1867 MK.component.SwipeSlideshowExtraNav.prototype = { 1868 init : function init() { 1869 this.cacheElements(); 1870 this.bindEvents(); 1871 }, 1872 1873 cacheElements : function cacheElements() { 1874 var $this = $( this.el ); 1875 1876 this.sliderId = $this.data( 'gallery' ); 1877 this.slider = _instancesCollection[this.sliderId]; 1878 this.$thumbs = $( '#' + this.sliderId ).find( '.thumbnails a'); 1879 }, 1880 1881 bindEvents : function bindEvents() { 1882 this.$thumbs.on( 'click', this.clickThumb.bind( this ) ); 1883 }, 1884 1885 clickThumb : function clickThumb( e ) { 1886 e.preventDefault(); 1887 var $this = $( e.currentTarget ), 1888 id = $this.index(); 1889 1890 this.slider.goTo( id ); 1891 } 1892 }; 1893 1894 1895 // Mostly for switcher in woocommerce 1896 MK.utils.eventManager.subscribe('gallery-update', function(e, config) { 1897 if(typeof _instancesCollection[config.id] === 'undefined') return; 1898 _instancesCollection[config.id].reset(); 1899 }); 1900 1901 function init() { 1902 // Lazy load. 1903 // Get All Related Layers 1904 var $swiper = $('.mk-slider'); 1905 1906 if ( ! $swiper.hasClass('mk-slideshow') && ! $swiper.hasClass('mk-swipe-slideshow') ) { 1907 return; 1908 } 1909 1910 var $imgs = $swiper.find('img[data-mk-image-src-set]'); 1911 1912 if ( $swiper.hasClass('mk-swipe-slideshow-lazyload') && $imgs.length ) { 1913 1914 // Load Images if the user scrolls to them 1915 $(window).on('scroll.mk_swipe_slideshow_lazyload', MK.utils.throttle(500, function(){ 1916 $imgs.each(function(index, elem) { 1917 if ( MK.utils.isElementInViewport(elem) ) { 1918 MK.component.ResponsiveImageSetter.init( $(elem) ); 1919 $imgs = $imgs.not( $(elem) ); // Remove element from the list when loaded to reduce the amount of iteration in each() 1920 } 1921 }); 1922 })); 1923 1924 $(window).trigger('scroll.mk_swipe_slideshow_lazyload'); 1925 1926 // Handle the resize 1927 MK.component.ResponsiveImageSetter.onResize($imgs); 1928 1929 } else { 1930 1931 MK.component.ResponsiveImageSetter.init($imgs); 1932 MK.component.ResponsiveImageSetter.onResize($imgs); 1933 1934 } 1935 1936 /* Why we need to reinitialize it? it causes double sliding effect 1937 $( '.mk-swiper-container' ).each( function() { 1938 new MK.component.SwipeSlideshow( this ).init(); 1939 } ); 1940 */ 1941 1942 } 1943 1944 init(); 1945 $(window).on('vc_reload mk-image-loaded', init); 1946 1947})( jQuery ); 1948 1949(function( $ ) { 1950 'use strict'; 1951 1952 /** 1953 * Fix issue with WC Recent Carousel classic style when SC is active. 1954 * At the first load of shortcode, the height is not correct, only cover the image 1955 * without product detail. This script only set the min-height. 1956 */ 1957 function mkWcCarouselSwiperHeight() { 1958 var mkWCRecentCarousel = $( '.mk-woocommerce-carousel.classic-style' ); 1959 mkWCRecentCarousel.each( function() { 1960 var maxHeight = 0; 1961 var height = $( this ).height(); 1962 var childs = $( this ).find( '.item' ); 1963 childs.each( function(){ 1964 if ( $( this ).height() > maxHeight ) { 1965 maxHeight = $( this ).height(); 1966 } 1967 } ); 1968 var swiperContainers = $( this ).find( '.mk-swiper-container' ); 1969 swiperContainers[0].style.setProperty( 'min-height', maxHeight + 'px', 'important' ); 1970 } ); 1971 } 1972 1973 mkWcCarouselSwiperHeight(); 1974 1975}
1975)( jQuery ); 1976(function($) { 1977 'use strict'; 1978 1979 var core = MK.core, 1980 path = core.path; 1981 1982 MK.component.Tooltip = function(el) { 1983 var init = function() { 1984 $('.mk-tooltip').each(function() { 1985 $(this).find('.mk-tooltip--link').hover(function() { 1986 $(this).siblings('.mk-tooltip--text').stop(true).animate({ 1987 'opacity': 1 1988 }, 400); 1989 1990 }, function() { 1991 $(this).siblings('.mk-tooltip--text').stop(true).animate({ 1992 'opacity': 0 1993 }, 400); 1994 }); 1995 }); 1996 }; 1997 1998 return { 1999 init: init 2000 }; 2001 }; 2002 2003})(jQuery); 2004 2005(function ($) { 2006 'use strict'; 2007 2008 function dynamicHeight() { 2009 var $this = $( this ); 2010 2011 $this.height( 'auto' ); 2012 2013 if( window.matchMedia( '(max-width: 767px)' ).matches ) { 2014 return; 2015 } 2016 2017 $this.height( $this.height() ); 2018 } 2019 2020 var $window = $( window ); 2021 var container = document.getElementById( 'mk-theme-container' ); 2022 2023 function equalColumns() { 2024 $( '.equal-columns' ).each( function() { 2025 dynamicHeight.bind( this ); 2026 $window.on( 'load', dynamicHeight.bind( this ) ); 2027 $window.on( 'resize', dynamicHeight.bind( this ) ); 2028 $window.on( 'mk-image-loaded', dynamicHeight.bind( this ) ); 2029 window.addResizeListener( container, dynamicHeight.bind( this ) ); 2030 }); 2031 } 2032 2033 equalColumns(); 2034 2035 $window.on( 'vc_reload' , function() { 2036 equalColumns(); 2037 }); 2038 2039}( jQuery )); 2040 2041(function($) { 2042 'use strict'; 2043 2044 function mk_video_play() { 2045 2046 var lightboxMargin = 60; 2047 2048 // Play self hosted video 2049 function playSelfHosted($video, isLightbox) { 2050 if (isLightbox === undefined || typeof isLightbox === 'undefined') { 2051 isLightbox = false; 2052 } 2053 2054 if (isLightbox) { 2055 2056 var content = $video.parent().html(); 2057 2058 playLightbox({ 2059 content: '<div class="fancybox-video">' + $(content).attr('autoplay', 'autoplay').wrap('<div></div>').parent().html() + '</div>', 2060 }); 2061 2062 } else { 2063 playTagVideo($video); 2064 } 2065 } 2066 2067 // Play social hosted video 2068 function playSocialHosted($iframe, isLightbox) { 2069 2070 if (isLightbox === undefined || typeof isLightbox === 'undefined') { 2071 isLightbox = false; 2072 } 2073 2074 if (isLightbox) { 2075 2076 playLightbox({ 2077 type: 'iframe', 2078 src: $iframe.attr('src'), 2079 }); 2080 2081 } else { 2082 2083 var videoData = getSocialVideoData($iframe.attr('src')); 2084 2085 switch (videoData.source) { 2086 case 'youtube': 2087 playTagIframeYoutube(videoData.videoId, $iframe); 2088 break; 2089 case 'vimeo': 2090 playTagIframeVimeo(videoData.videoId, $iframe); 2091 break; 2092 default: 2093 playTagIframe($iframe); 2094 break; 2095 } 2096 } 2097 } 2098 2099 // Play video in lightbox 2100 function playLightbox(args) { 2101 var options = { 2102 autoSize: 0, 2103 width: getVideoboxWidth(), 2104 height: getVideoHeight(), 2105 }; 2106 $.extend(options, args); 2107 $.fancybox.open(options); 2108 } 2109 2110 function playTagVideo($video) { 2111 $video.get(0).play(); 2112 $video.closest('.video-container').find('.video-thumbnail').fadeOut('slow'); 2113 } 2114 2115 function playTagIframe($iframe, videoId) { 2116 var video_loop = ''; 2117 if (videoId !== undefined && typeof videoId !== 'undefined') { 2118 video_loop = '&playlist=' + videoId; 2119 } 2120 2121 var src = $iframe.attr('src'); 2122 var separator = (src.indexOf('?') === -1) ? '?' : '&'; 2123 src += separator + 'autoplay=1'; 2124 separator = (src.indexOf('?') === -1) ? '?' : '&'; 2125 video_loop = separator + 'loop=1' + video_loop; 2126 video_loop = ( $iframe.closest('.video-container').data('loop') == '1' ) ? video_loop : ''; 2127 src += video_loop; 2128 $iframe.attr('src', src).closest('.video-container').find('.video-thumbnail').fadeOut(3000); 2129 } 2130 2131 function playTagIframeYoutube(videoId, $iframe) { 2132 2133 // Credit: https://goo.gl/ku3NgH 2134 if ( document.getElementById('mk_iframe_api') === null ) { 2135 var tag = document.createElement('script'); 2136 tag.src = "https://www.youtube.com/iframe_api"; 2137 tag.id = "mk_iframe_api"; 2138 var firstScriptTag = document.getElementsByTagName('script')[0]; 2139 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 2140 } else { 2141 runPlayer(); 2142 } 2143 2144 window.onYouTubeIframeAPIReady = function () { 2145 runPlayer(); 2146 }; 2147 2148 function runPlayer(){ 2149 var player, 2150 isPlayed = false;
2151 2152 player = new YT.Player('video-player-' + $iframe.data('id'), { 2153 videoId: videoId, 2154 rel: false, 2155 events: { 2156 onReady: function(e) { 2157 e.target.playVideo(); 2158 }, 2159 onStateChange: function(e) { 2160 let $playerWrapper = $('#video-player-' + $iframe.data('id')) 2161 2162 if (e.data === 1 && !isPlayed) { 2163 $playerWrapper.closest('.video-container').find('.video-thumbnail').fadeOut('slow'); 2164 isPlayed = true; 2165 } 2166 2167 if ($playerWrapper.closest('.video-container').data('loop') && e.data === YT.PlayerState.ENDED) { 2168 e.target.playVideo(); 2169 } 2170 }, 2171 onError: function(e) { 2172 playTagIframe($iframe, videoId); 2173 } 2174 } 2175 }); 2176 } 2177 } 2178 2179 function playTagIframeVimeo(videoId, $iframe) { 2180 // Embed async the vimeo API script 2181 $.getScript('//player.vimeo.com/api/player.js', function(data, textStatus, jqxhr) { 2182 if (jqxhr.status === 200) { 2183 2184 var player, 2185 isPlayed = false; 2186 2187 player = new Vimeo.Player('video-player-' + $iframe.data('id'), { 2188 id: videoId 2189 }); 2190 2191 player.play().then(function() { 2192 if (!isPlayed) { 2193 $iframe.closest('.video-container').find('.video-thumbnail').fadeOut('slow'); 2194 isPlayed = true; 2195 } 2196 }).catch(function(error) { 2197 playTagIframe($iframe); 2198 }); 2199 2200 if ($iframe.closest('.video-container').data('loop')) { 2201 player.setLoop(true).then(function(loop) { 2202 // Enable loop 2203 }).catch(function(error) { 2204 playTagIframe($iframe); 2205 }); 2206 } 2207 2208 } else { 2209 playTagIframe($iframe); 2210 } 2211 }); 2212 } 2213 2214 // Get Social Provider Video Data 2215 function getSocialVideoData(url) { 2216 2217 // Get Youtube video data 2218 var youtubeRegex = /(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i; 2219 var youtubeMatch = url.match(youtubeRegex); 2220 if (youtubeMatch && youtubeMatch != null) { 2221 return { 2222 source: 'youtube', 2223 videoId: youtubeMatch[3] 2224 }; 2225 } 2226 2227 // Get Vimeo video data 2228 var vimeoRegex = /(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/i; 2229 var vimeoMatch = url.match(vimeoRegex); 2230 if (vimeoMatch && vimeoMatch != null) { 2231 return { 2232 source: 'vimeo', 2233 videoId: vimeoMatch[1] 2234 }; 2235 } 2236 2237 return { 2238 source: false, 2239 videoId: false 2240 }; 2241 } 2242 2243 // Get lightbox width 2244 function getVideoboxWidth() { 2245 var $width, 2246 wWidth = $(window).width(), 2247 wHeight = $(window).height(); 2248 2249 if (wHeight >= wWidth) { 2250 2251 $width = wWidth - (lightboxMargin * 2); 2252 2253 } else { 2254 2255 var wHeightMax = (wHeight * 90) / 100; 2256 2257 if (wWidth > 1280) { 2258 var $width = (wHeightMax / 5768) * 10000; 2259 } else { 2260 var $width = (wHeightMax / 6120) * 10000; 2261 } 2262 2263 } 2264 2265 return Math.round($width) + 'px'; 2266 } 2267 2268 // Get lightbox height 2269 function getVideoHeight() { 2270 2271 var $height, 2272 wWidth = $(window).width(), 2273 wHeight = $(window).height(); 2274 2275 if (wHeight >= wWidth) { 2276 $height = ((wWidth - (lightboxMargin * 2)) * 5670) / 10000; 2277 } else { 2278 $height = ((wHeight * 90) / 100) + (lightboxMargin * 2); 2279 } 2280 return Math.round($height) + 'px'; 2281 } 2282 2283 $('.video-container').each(function() { 2284 2285 var $videoContainer = $(this); 2286 var playSource = $videoContainer.data('source'); 2287 var playTarget = $videoContainer.data('target'); 2288 var $iframe = $videoContainer.find('iframe'); 2289 var $video = $videoContainer.find('video'); 2290 2291 if ($videoContainer.data('autoplay')) { 2292 switch (playSource) { 2293 case 'social_hosted': 2294 playSocialHosted($iframe); 2295 break; 2296 case 'self_hosted': 2297 playSelfHosted($video); 2298 break; 2299 } 2300 } else { 2301 var $playIcon = $videoContainer.find('.mk-svg-icon'); 2302 $playIcon.bind('click', function(e) { 2303 e.preventDefault(); 2304 var isLightbox = (playTarget == 'lightbox') ? true : false; 2305 if (!isLightbox) { 2306 $playIcon.hide().next('.preloader-preview-area').show(); 2307 } 2308 switch (playSource) { 2309 case 'social_hosted': 2310 playSocialHosted($iframe, isLightbox); 2311 break; 2312 case 'self_hosted': 2313 playSelfHosted($video, isLightbox); 2314 break; 2315 } 2316 }); 2317 } 2318 }); 2319 } 2320 $(window).on('load vc_reload', mk_video_play); 2321 2322 // Resize icon size for responsive layout 2323 function mk_video_resize_play_icon() { 2324 $('.video-thumbnail-overlay').each(function() { 2325 var $thumbnailOverlay = $(this); 2326 var thumbnailWidth = $thumbnailOverlay.width(); 2327 var $svg = $thumbnailOverlay.find('svg'); 2328 if (typeof $svg.data('width') === 'undefined') { 2329 $svg.attr('data-width', $svg.width()); 2330 } 2331 if (typeof $svg.data('height') === 'undefined') { 2332 $svg.attr('data-height', $svg.height()); 2333 } 2334 if (($svg.data('width') * 4) > thumbnailWidth) { 2335 $svg.css({ 2336 width: Math.round((parseInt(thumbnailWidth) / 4)) + 'px', 2337 height: Math.round((parseInt(thumbnailWidth) / 4) * $svg.data('height') / $svg.data('width')) + 'px' 2338 }); 2339 } else { 2340 $svg.css({ 2341 width: $svg.data('width') + 'px', 2342 height: $svg.data('height') + 'px' 2343 }); 2344 } 2345 }); 2346 } 2347 $(window).on('load resize orientationChange vc_reload', mk_video_resize_play_icon); 2348}(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.