1(function($) { 2 'use strict'; 3 4 var _toBuild = []; 5 MK.api = window.MK.api || {}; 6 7 MK.component.AdvancedGMaps = function(el) { 8 var $this = $(el), 9 container = document.getElementById( 'mk-theme-container' ), 10 data = $this.data( 'advancedgmaps-config' ), 11 apikey = data.options.apikey ? ('key='+data.options.apikey+'&') : false, 12 map = null, 13 bounds = null, 14 infoWindow = null, 15 position = null; 16 17 var build = function() { 18 data.options.scrollwheel = false; 19 data.options.mapTypeId = google.maps.MapTypeId[data.options.mapTypeId]; 20 data.options.styles = data.style; 21 22 bounds = new google.maps.LatLngBounds(); 23 map = new google.maps.Map(el, data.options); 24 infoWindow = new google.maps.InfoWindow(); 25 26 map.setOptions({ 27 panControl : data.options.panControl, 28 draggable: data.options.draggable, 29 zoomControl: data.options.zoomControl, 30 mapTypeControl: data.options.scaleControl, 31 scaleControl: data.options.mapTypeControl, 32 }); 33 34 var marker, i; 35 36 map.setTilt(45); 37 38 for (i = 0; i < data.places.length; i++) { 39 if(data.places[i].latitude && data.places[i].longitude) { 40 position = new google.maps.LatLng(data.places[i].latitude, data.places[i].longitude); 41 42 bounds.extend(position); 43 44 marker = new google.maps.Marker({ 45 position: position, 46 map: map, 47 title: data.places[i].address, 48 icon: (data.places[i].marker) ? data.places[i].marker : data.icon 49 }); 50 51 52 google.maps.event.addListener(marker, 'click', (function(marker, i) { 53 return function() { 54 if(data.places[i].address && data.places[i].address.length > 1) { 55 infoWindow.setContent('<div class="info_content"><p>'+ data.places[i].address +'</p></div>'); 56 infoWindow.open(map, marker); 57 } else { 58 infoWindow.setContent(''); 59 infoWindow.close(); 60 } 61 }; 62 })(marker, i)); 63 64 /** 65 * If there is only one marker, map.fitBounds will zoom-in too much. 66 * Only run map.fitBounds if the markers are more than 1. Use setCenter 67 * instead if the the marker is only 1. 68 */ 69 if ( i > 0 ) { 70 map.fitBounds( bounds ); 71 } else { 72 // Set latitude and longtitude as float. 73 var latLang = { 74 lat: parseFloat( data.places[i].latitude ), 75 lng: parseFloat( data.places[i].longitude ) 76 }; 77 map.setCenter( latLang ); 78 // Need to setZoom here as we didn't trigger bounds_changed event. 79 map.setZoom( data.options.zoom ); 80 } 81 } 82 } 83 84 var boundsListener = google.maps.event.addListener((map), 'bounds_changed', function(event) { 85 this.setZoom(data.options.zoom); 86 google.maps.event.removeListener(boundsListener); 87 }); 88 89 90 var update = function() { 91 google.maps.event.trigger(map, "resize"); 92 map.setCenter(position); 93 }; 94 update(); 95 96 97 var bindEvents = function() { 98 $( window ).on( 'resize', update ); 99 window.addResizeListener( container, update ); 100 }; 101 bindEvents(); 102 }; 103 104 105 var initAll = function() { 106 for( var i = 0, l = _toBuild.length; i < l; i++ ) { 107 _toBuild[i](); 108 } 109 }; 110 111 MK.api.advancedgmaps = MK.api.advancedgmaps || function() { 112 initAll(); 113 }; 114 115 return { 116 init : function() { 117 _toBuild.push( build ); 118 MK.core.loadDependencies(['https://maps.googleapis.com/ma
118ps/api/js?'+apikey+'callback=MK.api.advancedgmaps']); 119 } 120 }; 121 122 }; 123 124})(jQuery); 125(function($) { 126 'use strict'; 127 function mk_animated_cols() { 128 function equalheight (container){ 129 var currentTallest = 0, 130 currentRowStart = 0, 131 rowDivs = new Array(), 132 $el, 133 topPosition = 0; 134 $(container).each(function() { 135 136 $el = $(this); 137 $($el).height('auto'); 138 topPosition = $el.position().top; 139 140 if (currentRowStart != topPosition) { 141 for (var currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { 142 rowDivs[currentDiv].height(currentTallest); 143 } 144 rowDivs.length = 0; // empty the array 145 currentRowStart = topPosition; 146 currentTallest = $el.height(); 147 rowDivs.push($el); 148 } else { 149 rowDivs.push($el); 150 currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest); 151 } 152 for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { 153 rowDivs[currentDiv].height(currentTallest); 154 } 155 156 }); 157 158 // console.log('recalc' + container + ' ' + currentTallest); 159 160 return currentTallest; 161 } 162 163 164 function prepareCols(el) { 165 var $this = el.parent().parent().find('.mk-animated-columns'); 166 167 var iconHeight = equalheight('.vc_row .animated-column-icon, .animated-column-holder .mk-svg-icon'), 168 titleHeight = equalheight('.vc_row .animated-column-title'), 169 descHeight = equalheight('.vc_row .animated-column-desc'), 170 btnHeight = $this.find('.animated-column-btn').innerHeight(); 171 172 if ($this.hasClass('full-style')) { 173 $this.find('.animated-column-item').each(function() { 174 var $this = $(this), 175 contentHeight = (iconHeight + 30) + (titleHeight + 10) + (descHeight + 70) + 34; 176 /* 177 * Fix AM-2418. 178 * 179 * Column height setting of VC Animated Column doesn't work when Animated Column 180 * content is higher than the setting. So, check column height setting first. 181 * - If the column height setting < Animated Column height, update the column 182 * height based on column height setting. 183 */ 184 var $columnHeight = contentHeight * 1.5 + 50; 185 var $minHeight = parseInt( $this.css( 'min-height' ), 10 ); 186 if ( ! isNaN( $minHeight ) ) { 187 if ( $minHeight < $columnHeight ) { 188 $columnHeight = $minHeight; 189 } 190 } 191 192 $this.height( $columnHeight ); 193 194 var $box_height = $this.outerHeight(true), 195 $icon_height = $this.find('.animated-column-icon, .animated-column-holder .mk-svg-icon').height(); 196 197 $this.find('.animated-column-holder').css({ 198 'paddingTop': $box_height / 2 - $icon_height 199 }); 200 201 202 $this.animate({opacity:1}, 300); 203 }); 204 } else { 205 $this.find('.animated-column-item').each(function() { 206 var $this = $(this), 207 halfHeight = $this.height() / 2, 208 halfIconHeight = $this.find('.animated-column-icon, .animated-column-holder .mk-svg-icon').height()/2, 209 halfTitleHeight = $this.find('.animated-column-simple-title').height()/2; 210 211 $this.find('.animated-column-holder').css({ 212 'paddingTop': halfHeight - halfIconHeight 213 }); 214 215 $this.find('.animated-column-title').css({ 216 'paddingTop': halfHeight - halfTitleHeight 217 }); 218 219 $this.animate({ 220 opacity:1 221 }, 300); 222 223 }); 224 } 225 } 226 227 $('.mk-animated-columns').each(function() { 228 var that = this; 229 MK.core.loadDependencies([ MK.core.path.plugins + 'tweenmax.js' ], function() { 230 var $this = $(that), 231 $parent = $this.parent().parent(), 232 $columns = $parent.find('.column_container'), 233 index = $columns.index($this.parent()); 234 // really bad that we cannot read it before bootstrap - needs full shortcode refactor 235 236 if($this.hasClass('full-style')) { 237 $this.find('.animated-column-item').hover( 238 function() { 239 TweenLite.to($(this).find(".animated-column-holder"), 0.5, { 240 top: '-15%', 241 ease: Back.easeOut 242 }); 243 TweenLite.to($(this).find(".animated-column-desc"), 0.5, { 244 top: '50%', 245 ease: Expo.easeOut 246 }, 0.4); 247 TweenLite.to($(this).find(".animated-column-btn"), 0.3, { 248 top: '50%', 249 ease: Expo.easeOut 250 }, 0.6); 251 }, 252 function() { 253 254 TweenLite.to($(this).find(".animated-column-holder"), 0.5, { 255 top: '0%', 256 ease: Back.easeOut, easeParams:[3] 257 }); 258 TweenLite.to($(this).find(".animated-column-desc"), 0.5, { 259 top: '100%', 260 ease: Back.easeOut 261 }, 0.4); 262 TweenLite.to($(this).find(".animated-column-btn"), 0.5, { 263 top: '100%', 264 ease: Back.easeOut 265 }, 0.2); 266 }); 267 } 268 269 if($this.hasClass('simple-style')) { 270 $this.find('.animated-column-item').hover( 271 function() { 272 TweenLite.to($(this).find(".animated-column-holder"), 0.7, { 273 top: '100%', 274 ease: Expo.easeOut 275 }); 276 TweenLite.to($(this).find(".animated-column-title"), 0.7, { 277 top: '0%', 278 ease: Back.easeOut 279 }, 0.2); 280 }, 281 function() { 282 TweenLite.to($(this).find(".animated-column-holder"), 0.7, { 283 top: '0%', 284 ease: Expo.easeOut 285 }); 286 TweenLite.to($(this).find(".animated-column-title"), 0.7, { 287 top: '-100%', 288 ease: Back.easeOut 289 }, 0.2); 290 }); 291 } 292 293 if($columns.length === index + 1) { 294 prepareCols($this); 295 $(window).on("resize", function() { 296 setTimeout(prepareCols($this), 1000); 297 }); 298 } 299 300 MK.utils.eventManager.subscribe('iconsInsert', function() { 301 prepareCols($this); 302 }); 303 }); 304 305 }); 306 } 307 308 $(window).on('load vc_reload', mk_animated_cols); 309 310}(jQuery)); 311 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 = MK.core.path; 447 448 // TODO: Repair after Rifat. He repeated The same code twice - other same code is in photoalbum (why by the way?!). 449 // Split it into two separate components when you see reusage 450 MK.component.Category = function( el ) { 451 var init = function(){ 452 core.loadDependencies([ path.plugins + 'pixastic.js' ], function() { 453 blurImage($('.blur-image-effect .mk-loop-item .item-holder ')); 454 }); 455 456 core.loadDependencies([ path.plugins + 'minigrid.js' ], masonry); 457 }; 458 459 var blurImage = function($item) { 460 return $item.each(function() { 461 var $_this = $(this); 462 463 var img = $_this.find('.item-thumbnail'); 464 465 img.clone().addClass("blur-effect item-blur-thumbnail").removeClass('item-thumbnail').prependTo(this); 466 467 var blur_this = $(".blur-effect", this); 468 blur_this.each(function(index, element){ 469 if (img[index].complete === true) { 470 Pixastic.process(blur_this[index], "blurfast", {amount:0.5}); 471 } 472 else { 473 blur_this.load(function () { 474 Pixastic.process(blur_this[index], "blurfast", {amount:0.5}); 475 }); 476 } 477 }); 478 }); 479 }; 480
481 // TODO: find other shortcodes like this design and make it as a component 482 var masonry = function() { 483 if(!$('.js-masonry').length) return; 484 485 function grid() { 486 minigrid({ 487 container: '.js-masonry', 488 item: '.js-masonry-item', 489 gutter: 0 490 }); 491 } 492 493 grid(); 494 $(window).on('resize', grid); 495 }; 496 497 return { 498 init : init 499 }; 500 }; 501 502})(jQuery); 503 504 505 506 507 508 509 510 511(function($) { 512 'use strict'; 513 514 var core = MK.core, 515 path = core.path; 516 517 MK.component.Chart = function(el) { 518 var init = function() { 519 MK.core.loadDependencies([MK.core.path.plugins + 'jquery.easyPieChart.js'], function() { 520 $('.mk-chart__chart').each(function() { 521 var $this = $(this), 522 $parent_width = $(this).parent().width(), 523 $chart_size = parseInt($this.attr('data-barSize')); 524 525 if ($parent_width < $chart_size) { 526 $chart_size = $parent_width; 527 $this.css('line-height', $chart_size); 528 $this.find('i').css({ 529 'line-height': $chart_size + 'px' 530 }); 531 $this.css({ 532 'line-height': $chart_size + 'px' 533 }); 534 } 535 536 var build = function() { 537 $this.easyPieChart({ 538 animate: 1300, 539 lineCap: 'butt', 540 lineWidth: $this.attr('data-lineWidth'), 541 size: $chart_size, 542 barColor: $this.attr('data-barColor'), 543 trackColor: $this.attr('data-trackColor'), 544 scaleColor: 'transparent', 545 onStep: function(value) { 546 this.$el.find('.chart-percent span').text(Math.ceil(value)); 547 } 548 }); 549 }; 550 551 // refactored only :in-viewport logic. rest is to-do 552 MK.utils.scrollSpy(this, { 553 position: 'bottom', 554 after: build 555 }); 556 }); 557 }); 558 }; 559 560 return { 561 init: init 562 }; 563 }; 564 565})(jQuery); 566 567(function($) { 568 "use strict"; 569 570 $('.mk-clients.column-style').each(function() { 571 var $group = $(this), 572 $listItems = $group.find('li'), 573 listItemsCount = $listItems.length, 574 listStyle = $group.find('ul').attr('style') || '', 575 fullRowColumnsCount = $group.find('ul:first-of-type li').length; 576 577 function recreateGrid() { 578 var i; 579 580 $listItems.unwrap(); 581 582 if (window.matchMedia('(max-width: 550px)').matches && fullRowColumnsCount >= 1) { 583 for (i = 0; i < listItemsCount; i += 1) { 584 $listItems.slice(i, i + 1) 585 .wrapAll('<ul class="mk-clients-fixed-list" style="' + listStyle + '"></ul>'); 586 } 587 } else if (window.matchMedia('(max-width: 767px)').matches && fullRowColumnsCount >= 2) { 588 for (i = 0; i < listItemsCount; i += 2) { 589 $listItems.slice(i, i + 2) 590 .wrapAll('<ul class="mk-clients-fixed-list" style="' + listStyle + '"></ul>'); 591 } 592 } else if (window.matchMedia('(max-width: 960px)').matches && fullRowColumnsCount >= 3) { 593 for (i = 0; i < listItemsCount; i += 3) { 594 $listItems.slice(i, i + 3) 595 .wrapAll('<ul class="mk-clients-fixed-list" style="' + listStyle + '"></ul>'); 596 } 597 } else { 598 for (i = 0; i < listItemsCount; i += fullRowColumnsCount) { 599 $listItems.slice(i, i + fullRowColumnsCount) 600 .wrapAll('<ul style="' + listStyle + '"></ul>'); 601 } 602 } 603 } 604 605 recreateGrid(); 606 $(window).on('resize', recreateGrid); 607 608 }); 609 610}(jQuery)); 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 627 $('.mk-edge-slider').find('video').each(function() { 628 this.pause(); 629 this.currentTime = 0; 630 }); 631
632 MK.component.EdgeSlider = function( el ) { 633 var self = this, 634 $this = $( el ), 635 $window = $(window), 636 $wrapper = $this.parent(), 637 config = $this.data( 'edgeslider-config' ), 638 $nav = $( config.nav ), 639 $prev = $nav.find( '.mk-edge-prev' ), 640 $prevTitle = $prev.find( '.nav-item-caption' ), 641 $prevBg = $prev.find('.edge-nav-bg'), 642 $next = $nav.find( '.mk-edge-next' ), 643 $nextTitle = $next.find( '.nav-item-caption' ), 644 $nextBg = $next.find('.edge-nav-bg'), 645 $navBtns = $nav.find( 'a' ), 646 $pagination = $( '.swiper-pagination' ), 647 $skipBtn = $( '.edge-skip-slider' ), 648 $opacityLayer = $this.find('.edge-slide-content'), 649 $videos = $this.find('video'), 650 currentSkin = null, 651 currentPoint = null, 652 winH = null, 653 opacity = null, 654 offset = null; 655 656 var callbacks = { 657 onInitialize : function( slides ) { 658 self.$slides = $( slides ); 659 660 self.slideContents = $.map( self.$slides, function( slide ) { 661 var $slide = $( slide ), 662 title = $slide.find('.edge-slide-content .edge-title').first().text(), 663 skin = $slide.attr("data-header-skin"), 664 image = $slide.find('.mk-section-image').attr('data-thumb') || 665 $slide.find('.mk-video-section-touch').attr('data-thumb'), 666 bgColor = $slide.find('.mk-section-image').css('background-color'); 667 668 669 return { 670 skin: skin, 671 title: title, 672 image: image, 673 bgColor: bgColor 674 }; 675 }); 676 677 // Set position fixed here rather than css to avoid flash of strangely styled slides befor plugin init 678 if(MK.utils.isSmoothScroll) $this.css('position', 'fixed'); 679 680 setNavigationContent( 1, self.$slides.length - 1 ); 681 setSkin( 0 ); 682 // stopVideos(); 683 playVideo(0); 684 685 setTimeout( function() { 686 $( '.edge-slider-loading' ).fadeOut( '100' ); 687 }, 1000 ); 688 }, 689 690 onBeforeSlide : function( id ) { 691 692 }, 693 694 onAfterSlide : function( id ) { 695 setNavigationContent( nextFrom(id), prevFrom(id) ); 696 setSkin( id ); 697 stopVideos(); // stop all others if needed 698 playVideo( id ); 699 } 700 }; 701 702 703 var nextFrom = function nextFrom(id) { 704 return ( id + 1 === self.$slides.length ) ? 0 : id + 1; 705 }; 706 707 708 var prevFrom = function prevFrom(id) { 709 return ( id - 1 === -1 ) ? self.$slides.length - 1 : id - 1; 710 }; 711 712 713 var setNavigationContent = function( nextId, prevId ) { 714 if(self.slideContents[ prevId ]) { 715 $prevTitle.text( self.slideContents[ prevId ].title ); 716 $prevBg.css( 'background', 717 self.slideContents[ prevId ].image !== 'none' ? 718 'url(' + self.slideContents[ prevId ].image + ')' : 719 self.slideContents[ prevId ].bgColor ); 720 } 721 722 if(self.slideContents[ nextId ]) { 723 $nextTitle.text( self.slideContents[ nextId ].title ); 724 $nextBg.css( 'background', 725 self.slideContents[ nextId ].image !== 'none' ? 726 'url(' + self.slideContents[ nextId ].image + ')' : 727 self.slideContents[ nextId ].bgColor ); 728 } 729 }; 730 731 732 var setSkin = function setSkin( id ) { 733 currentSkin = self.slideContents[ id ].skin; 734 735 $navBtns.attr('data-skin', currentSkin); 736 $pagination.attr('data-skin', currentSkin); 737 $skipBtn.attr('data-skin', currentSkin); 738 739 if( self.config.firstEl ) { 740 MK.utils.eventManager.publish( 'firstElSkinChange', currentSkin ); 741 } 742 }; 743 744 745 var stopVideos = function stopVideos() { 746 $videos.each(function() { 747 this.pause(); 748 this.currentTime = 0; 749 }); 750 }; 751 752 753 var playVideo = function playVideo(id) { 754 var video = self.$slides.eq(id).find('video').get(0); 755 if(video) { 756 video.play(); 757 console.log('play video in slide nr ' + id); 758 } 759 760 }; 761 762 763 var onResize = function onResize() { 764 var height = $wrapper.height(); 765 $this.height( height ); 766 767 var width = $wrapper.width(); 768 $this.width( width ); 769 770 winH = $window.height(); 771 offset = $this.offset().top; 772 773 if(!MK.utils.isSmoothScroll) return; 774 if(MK.utils.isResponsiveMenuState()) { 775 // Reset our parallax layers position and styles when we're in responsive mode 776 $this.css({
777 '-webkit-transform': 'translateZ(0)', 778 '-moz-transform': 'translateZ(0)', 779 '-ms-transform': 'translateZ(0)', 780 '-o-transform': 'translateZ(0)', 781 'transform': 'translateZ(0)', 782 'position': 'absolute' 783 }); 784 $opacityLayer.css({ 785 'opacity': 1 786 }); 787 } else { 788 // or proceed with scroll logic when we assume desktop screen 789 onScroll(); 790 } 791 }; 792 793 var onScroll = function onScroll() { 794 currentPoint = - MK.val.scroll(); 795 796 if( offset + currentPoint <= 0 ) { 797 opacity = 1 + ((offset + currentPoint) / winH) * 2; 798 opacity = Math.min(opacity, 1); 799 opacity = Math.max(opacity, 0); 800 801 $opacityLayer.css({ 802 opacity: opacity 803 }); 804 } 805 806 $this.css({ 807 '-webkit-transform': 'translateY(' + currentPoint + 'px) translateZ(0)', 808 '-moz-transform': 'translateY(' + currentPoint + 'px) translateZ(0)', 809 '-ms-transform': 'translateY(' + currentPoint + 'px) translateZ(0)', 810 '-o-transform': 'translateY(' + currentPoint + 'px) translateZ(0)', 811 'transform': 'translateY(' + currentPoint + 'px) translateZ(0)', 812 'position': 'fixed' 813 }); 814 }; 815 816 onResize(); 817 $window.on('load', onResize); 818 $window.on('resize', onResize); 819 window.addResizeListener( $wrapper.get(0), onResize ); 820 821 if(MK.utils.isSmoothScroll) { 822 onScroll(); 823 $window.on('scroll', function() { 824 if(MK.utils.isResponsiveMenuState()) return; 825 window.requestAnimationFrame(onScroll); 826 }); 827 } 828 829 this.el = el; 830 this.config = $.extend( config, callbacks ); 831 this.slideContents = null; // cache slide contents 832 833 // Let mk_slider know it's EdgeSlider 834 this.config.edgeSlider = true; 835 }; 836 837 MK.component.EdgeSlider.prototype = { 838 init : function() { 839 // Inherit from Slider. add prototypes if needed 840 var slider = new MK.ui.Slider( this.el, this.config ); 841 slider.init(); 842 } 843 }; 844 845})(jQuery); 846 847(function ($) { 848 'use strict'; 849 850var init = function init() { 851 $('.mk-faq-wrapper').each( function() { 852 var $this = $(this); 853 var $filter = $this.find('.filter-faq'); 854 var $filterItem = $filter.find('a'); 855 var $faq = $this.find('.mk-faq-container > div'); 856 var currentFilter = ''; 857 858 $filterItem.on('click', function(e) { 859 var $this = $(this); 860 861 currentFilter = $this.data('filter'); 862 $filterItem.removeClass('current'); 863 $this.addClass('current'); 864 865 filterItems( currentFilter ); 866 867 e.preventDefault(); 868 }); 869 870 function filterItems( cat ) { 871 if( cat === '' ) { 872 $faq.slideDown(200).removeClass('hidden'); 873 return; 874 } 875 $faq.not( '.' + cat ).slideUp(200).addClass('hidden'); 876 $faq.filter( '.' + cat ).slideDown(200).removeClass('hidden'); 877 } 878 }); 879} 880init(); 881$(window).on('vc_reload', init); 882 883}( jQuery )); 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-swipe-slideshow'); 1905 var $imgs = $swiper.find('img[data-mk-image-src-set]'); 1906 1907 if ( $swiper.hasClass('mk-swipe-slideshow-lazyload') && $imgs.length ) { 1908 1909 // Load Images if the user scrolls to them 1910 $(window).on('scroll.mk_swipe_slideshow_lazyload', MK.utils.throttle(500, function(){ 1911 $imgs.each(function(index, elem) { 1912 if ( MK.utils.isElementInViewport(elem) ) { 1913 MK.component.ResponsiveImageSetter.init( $(elem) ); 1914 $imgs = $imgs.not( $(elem) ); // Remove element from the list when loaded to reduce the amount of iteration in each() 1915 } 1916 }); 1917 })); 1918 1919 $(window).trigger('scroll.mk_swipe_slideshow_lazyload'); 1920 1921 // Handle the resize 1922 MK.component.ResponsiveImageSetter.onResize($imgs); 1923 1924 } else { 1925 1926 MK.component.ResponsiveImageSetter.init($imgs); 1927 MK.component.ResponsiveImageSetter.onResize($imgs); 1928 1929 } 1930 1931 /* Why we need to reinitialize it? it causes double sliding effect 1932 $( '.mk-swiper-container' ).each( function() { 1933 new MK.component.SwipeSlideshow( this ).init(); 1934 } ); 1935 */ 1936 } 1937 1938 init(); 1939 $(window).on('vc_reload mk-image-loaded', init); 1940 1941})( jQuery ); 1942 1943(function($) { 1944 'use strict'; 1945 1946 var core = MK.core, 1947 path = core.path; 1948 1949 MK.component.Tooltip = function(el) { 1950 var init = function() { 1951 $('.mk-tooltip').each(function() { 1952 $(this).find('.mk-tooltip--link').hover(function() { 1953 $(this).siblings('.mk-tooltip--text').stop(true).animate({ 1954 'opacity': 1 1955 }, 400); 1956 1957 }, function() { 1958 $(this).siblings('.mk-tooltip--text').stop(true).animate({ 1959 'opacity': 0 1960 }, 400); 1961 }); 1962 }); 1963 }; 1964 1965 return { 1966 init: init 1967 }; 1968 }; 1969 1970})(jQuery); 1971 1972(function( $ ) { 1973 'use strict'; 1974 1975 /** 1976 * Fix issue with WC Recent Carousel classic style when SC is active. 1977 * At the first load of shortcode, the height is not correct, only cover the image 1978 * without product detail. This script only set the min-height. 1979 */ 1980 function mkWcCarouselSwiperHeight() { 1981 var mkWCRecentCarousel = $( '.mk-woocommerce-carousel.classic-style' ); 1982 mkWCRecentCarousel.each( function() { 1983 var maxHeight = 0; 1984 var height = $( this ).height(); 1985 var childs = $( this ).find( '.item' ); 1986 childs.each( function(){ 1987 if ( $( this ).height() > maxHeight ) { 1988 maxHeight = $( this ).height(); 1989 } 1990 } ); 1991 var swiperContainers = $( this ).find( '.mk-swiper-container' ); 1992 swiperContainers[0].style.setProperty( 'min-height', maxHeight + 'px', 'important' ); 1993 } ); 1994 } 1995 1996 mkWcCarouselSwiperHeight(); 1997 1998}
1998)( jQuery ); 1999(function ($) { 2000 'use strict'; 2001 2002 function dynamicHeight() { 2003 var $this = $( this ); 2004 2005 $this.height( 'auto' ); 2006 2007 if( window.matchMedia( '(max-width: 768px)' ).matches ) { 2008 return; 2009 } 2010 2011 $this.height( $this.height() ); 2012 } 2013 2014 var $window = $( window ); 2015 var container = document.getElementById( 'mk-theme-container' ); 2016 2017 function equalColumns() { 2018 $( '.equal-columns' ).each( function() { 2019 dynamicHeight.bind( this ); 2020 $window.on( 'load', dynamicHeight.bind( this ) ); 2021 $window.on( 'resize', dynamicHeight.bind( this ) ); 2022 $window.on( 'mk-image-loaded', dynamicHeight.bind( this ) ); 2023 window.addResizeListener( container, dynamicHeight.bind( this ) ); 2024 }); 2025 } 2026 2027 equalColumns(); 2028 2029 $window.on( 'vc_reload' , function() { 2030 equalColumns(); 2031 }); 2032 2033}( jQuery )); 2034 2035(function($) { 2036 'use strict'; 2037 2038 function mk_video_play() { 2039 2040 var lightboxMargin = 60; 2041 2042 // Play self hosted video 2043 function playSelfHosted($video, isLightbox) { 2044 if (isLightbox === undefined || typeof isLightbox === 'undefined') { 2045 isLightbox = false; 2046 } 2047 2048 if (isLightbox) { 2049 2050 var content = $video.parent().html(); 2051 2052 playLightbox({ 2053 content: '<div class="fancybox-video">' + $(content).attr('autoplay', 'autoplay').wrap('<div></div>').parent().html() + '</div>', 2054 }); 2055 2056 } else { 2057 playTagVideo($video); 2058 } 2059 } 2060 2061 // Play social hosted video 2062 function playSocialHosted($iframe, isLightbox) { 2063 2064 if (isLightbox === undefined || typeof isLightbox === 'undefined') { 2065 isLightbox = false; 2066 } 2067 2068 if (isLightbox) { 2069 2070 playLightbox({ 2071 type: 'iframe', 2072 href: $iframe.attr('src'), 2073 helpers: { 2074 media: true 2075 } 2076 }); 2077 2078 } else { 2079 2080 var videoData = getSocialVideoData($iframe.attr('src')); 2081 2082 switch (videoData.source) { 2083 case 'youtube': 2084 playTagIframeYoutube(videoData.videoId, $iframe); 2085 break; 2086 case 'vimeo': 2087 playTagIframeVimeo(videoData.videoId, $iframe); 2088 break; 2089 default: 2090 playTagIframe($iframe); 2091 break; 2092 } 2093 } 2094 } 2095 2096 // Play video in lightbox 2097 function playLightbox(args) { 2098 var options = { 2099 padding: 0, 2100 margin: lightboxMargin, 2101 showCloseButton: 1, 2102 autoSize: 0, 2103 width: getVideoboxWidth(), 2104 height: getVideoHeight(), 2105 tpl: { 2106 closeBtn: '<a title="Close" class="fancybox-item fancybox-close fancybox-video-close" href="javascript:;"></a>', 2107 }, 2108 }; 2109 $.extend(options, args); 2110 $.fancybox.open(options); 2111 } 2112 2113 function playTagVideo($video) { 2114 $video.get(0).play(); 2115 $video.closest('.video-container').find('.video-thumbnail').fadeOut('slow'); 2116 } 2117 2118 function playTagIframe($iframe, videoId) { 2119 var video_loop = ''; 2120 if (videoId !== undefined && typeof videoId !== 'undefined') { 2121 video_loop = '&playlist=' + videoId; 2122 } 2123 2124 var src = $iframe.attr('src'); 2125 var separator = (src.indexOf('?') === -1) ? '?' : '&'; 2126 src += separator + 'autoplay=1'; 2127 separator = (src.indexOf('?') === -1) ? '?' : '&'; 2128 video_loop = separator + 'loop=1' + video_loop; 2129 video_loop = ( $iframe.closest('.video-container').data('loop') == '1' ) ? video_loop : ''; 2130 src += video_loop; 2131 $iframe.attr('src', src).closest('.video-container').find('.video-thumbnail').fadeOut(3000); 2132 } 2133 2134 function playTagIframeYoutube(videoId, $iframe) { 2135 2136 // Credit: https://goo.gl/ku3NgH 2137 if ( document.getElementById('mk_iframe_api') === null ) { 2138 var tag = document.createElement('script'); 2139 tag.src = "https://www.youtube.com/iframe_api"; 2140 tag.id = "mk_iframe_api"; 2141 var firstScriptTag = document.getElementsByTagName('script')[0]; 2142 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 2143 } else { 2144 runPlayer(); 2145 } 2146 2147 window.onYouTubeIframeAPIReady = function () { 2148 runPlayer(); 2149 }; 2150 2151 function runPlayer(){ 2152 var player, 2153 isPlayed = false; 2154 2155 player = new YT.Player('video-player-' + $iframe.data('id'), { 2156 videoId: videoId, 2157 rel: false, 2158 events: { 2159 onReady: function(e) { 2160 e.target.playVideo(); 2161 }, 2162 onStateChange: function(e) { 2163 let $playerWrapper = $('#video-player-' + $iframe.data('id')) 2164 2165 if (e.data === 1 && !isPlayed) { 2166 $playerWrapper.closest('.video-container').find('.video-thumbnail').fadeOut('slow'); 2167 isPlayed = true; 2168 } 2169 2170 if ($playerWrapper.closest('.video-container').data('loop') && e.data === YT.PlayerState.ENDED) { 2171 e.target.playVideo(); 2172 } 2173 }, 2174 onError: function(e) { 2175 playTagIframe($iframe, videoId); 2176 } 2177 } 2178 }); 2179 } 2180 } 2181 2182 function playTagIframeVimeo(videoId, $iframe) { 2183 // Embed async the vimeo API script 2184 $.getScript('//player.vimeo.com/api/player.js', function(data, textStatus, jqxhr) { 2185 if (jqxhr.status === 200) { 2186 2187 var player, 2188 isPlayed = false;
2189 2190 player = new Vimeo.Player('video-player-' + $iframe.data('id'), { 2191 id: videoId 2192 }); 2193 2194 player.play().then(function() { 2195 if (!isPlayed) { 2196 $iframe.closest('.video-container').find('.video-thumbnail').fadeOut('slow'); 2197 isPlayed = true; 2198 } 2199 }).catch(function(error) { 2200 playTagIframe($iframe); 2201 }); 2202 2203 if ($iframe.closest('.video-container').data('loop')) { 2204 player.setLoop(true).then(function(loop) { 2205 // Enable loop 2206 }).catch(function(error) { 2207 playTagIframe($iframe); 2208 }); 2209 } 2210 2211 } else { 2212 playTagIframe($iframe); 2213 } 2214 }); 2215 } 2216 2217 // Get Social Provider Video Data 2218 function getSocialVideoData(url) { 2219 2220 // Get Youtube video data 2221 var youtubeRegex = /(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i; 2222 var youtubeMatch = url.match(youtubeRegex); 2223 if (youtubeMatch && youtubeMatch != null) { 2224 return { 2225 source: 'youtube', 2226 videoId: youtubeMatch[3] 2227 }; 2228 } 2229 2230 // Get Vimeo video data 2231 var vimeoRegex = /(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/i; 2232 var vimeoMatch = url.match(vimeoRegex); 2233 if (vimeoMatch && vimeoMatch != null) { 2234 return { 2235 source: 'vimeo', 2236 videoId: vimeoMatch[1] 2237 }; 2238 } 2239 2240 return { 2241 source: false, 2242 videoId: false 2243 }; 2244 } 2245 2246 // Get lightbox width 2247 function getVideoboxWidth() { 2248 var $width, 2249 wWidth = $(window).width(), 2250 wHeight = $(window).height(); 2251 2252 if (wHeight >= wWidth) { 2253 2254 $width = wWidth - (lightboxMargin * 2); 2255 2256 } else { 2257 2258 var wHeightMax = (wHeight * 90) / 100; 2259 2260 if (wWidth > 1280) { 2261 var $width = (wHeightMax / 5768) * 10000; 2262 } else { 2263 var $width = (wHeightMax / 6120) * 10000; 2264 } 2265 2266 } 2267 2268 return Math.round($width) + 'px'; 2269 } 2270 2271 // Get lightbox height 2272 function getVideoHeight() { 2273 2274 var $height, 2275 wWidth = $(window).width(), 2276 wHeight = $(window).height(); 2277 2278 if (wHeight >= wWidth) { 2279 $height = ((wWidth - (lightboxMargin * 2)) * 5670) / 10000; 2280 } else { 2281 $height = ((wHeight * 90) / 100) + (lightboxMargin * 2); 2282 } 2283 return Math.round($height) + 'px'; 2284 } 2285 2286 $('.video-container').each(function() { 2287 2288 var $videoContainer = $(this); 2289 var playSource = $videoContainer.data('source'); 2290 var playTarget = $videoContainer.data('target'); 2291 var $iframe = $videoContainer.find('iframe'); 2292 var $video = $videoContainer.find('video'); 2293 2294 if ($videoContainer.data('autoplay')) { 2295 switch (playSource) { 2296 case 'social_hosted': 2297 playSocialHosted($iframe); 2298 break; 2299 case 'self_hosted': 2300 playSelfHosted($video); 2301 break; 2302 } 2303 } else { 2304 var $playIcon = $videoContainer.find('.mk-svg-icon'); 2305 $playIcon.bind('click', function(e) { 2306 e.preventDefault(); 2307 var isLightbox = (playTarget == 'lightbox') ? true : false; 2308 if (!isLightbox) { 2309 $playIcon.hide().next('.preloader-preview-area').show(); 2310 } 2311 switch (playSource) { 2312 case 'social_hosted': 2313 playSocialHosted($iframe, isLightbox); 2314 break; 2315 case 'self_hosted': 2316 playSelfHosted($video, isLightbox); 2317 break; 2318 } 2319 }); 2320 } 2321 }); 2322 } 2323 $(window).on('load vc_reload', mk_video_play); 2324 2325 // Resize icon size for responsive layout 2326 function mk_video_resize_play_icon() { 2327 $('.video-thumbnail-overlay').each(function() { 2328 var $thumbnailOverlay = $(this); 2329 var thumbnailWidth = $thumbnailOverlay.width(); 2330 var $svg = $thumbnailOverlay.find('svg'); 2331 if (typeof $svg.data('width') === 'undefined') { 2332 $svg.attr('data-width', $svg.width()); 2333 } 2334 if (typeof $svg.data('height') === 'undefined') { 2335 $svg.attr('data-height', $svg.height()); 2336 } 2337 if (($svg.data('width') * 4) > thumbnailWidth) { 2338 $svg.css({ 2339 width: Math.round((parseInt(thumbnailWidth) / 4)) + 'px', 2340 height: Math.round((parseInt(thumbnailWidth) / 4) * $svg.data('height') / $svg.data('width')) + 'px' 2341 }); 2342 } else { 2343 $svg.css({ 2344 width: $svg.data('width') + 'px', 2345 height: $svg.data('height') + 'px' 2346 }); 2347 } 2348 }); 2349 } 2350 $(window).on('load resize orientationChange vc_reload', mk_video_resize_play_icon); 2351}(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.