1'use strict'; 2/** 3 * Copyright Marc J. Schmidt. See the LICENSE file at the top-level 4 * directory of this distribution and at 5 * https://github.com/marcj/css-element-queries/blob/master/LICENSE. 6 */ 7(function (root, factory) { 8 if (typeof define === "function" && define.amd) { 9 define(factory); 10 } else if (typeof exports === "object") { 11 module.exports = factory(); 12 } else { 13 root.ResizeSensor = factory(); 14 } 15}(typeof window !== 'undefined' ? window : this, function () { 16 17 // Make sure it does not throw in a SSR (Server Side Rendering) situation 18 if (typeof window === "undefined") { 19 return null; 20 } 21 // Only used for the dirty checking, so the event callback count is limited to max 1 call per fps per sensor. 22 // In combination with the event based resize sensor this saves cpu time, because the sensor is too fast and 23 // would generate too many unnecessary events. 24 var requestAnimationFrame = window.requestAnimationFrame || 25 window.mozRequestAnimationFrame || 26 window.webkitRequestAnimationFrame || 27 function (fn) { 28 return window.setTimeout(fn, 20); 29 }; 30 31 /** 32 * Iterate over each of the provided element(s). 33 * 34 * @param {HTMLElement|HTMLElement[]} elements 35 * @param {Function} callback 36 */ 37 function forEachElement(elements, callback){ 38 var elementsType = Object.prototype.toString.call(elements); 39 var isCollectionTyped = ('[object Array]' === elementsType 40 || ('[object NodeList]' === elementsType) 41 || ('[object HTMLCollection]' === elementsType) 42 || ('[object Object]' === elementsType) 43 || ('undefined' !== typeof jQuery && elements instanceof jQuery) //jquery 44 || ('undefined' !== typeof Elements && elements instanceof Elements) //mootools 45 ); 46 var i = 0, j = elements.length; 47 if (isCollectionTyped) { 48 for (; i < j; i++) { 49 callback(elements[i]); 50 } 51 } else { 52 callback(elements); 53 } 54 } 55 56 /** 57 * Get element size 58 * @param {HTMLElement} element 59 * @returns {Object} {width, height} 60 */ 61 function getElementSize(element) { 62 if (!element.getBoundingClientRect) { 63 return { 64 width: element.offsetWidth, 65 height: element.offsetHeight 66 } 67 } 68 69 var rect = element.getBoundingClientRect(); 70 return { 71 width: Math.round(rect.width), 72 height: Math.round(rect.height) 73 } 74 } 75 76 /** 77 * Class for dimension change detection. 78 * 79 * @param {Element|Element[]|Elements|jQuery} element 80 * @param {Function} callback 81 * 82 * @constructor 83 */ 84 var ResizeSensor = function(element, callback) { 85 /** 86 * 87 * @constructor 88 */ 89 function EventQueue() { 90 var q = []; 91 this.add = function(ev) { 92 q.push(ev); 93 }; 94 95 var i, j; 96 this.call = function() { 97 for (i = 0, j = q.length; i < j; i++) { 98 q[i].call(); 99 } 100 }; 101 102 this.remove = function(ev) { 103 var newQueue = []; 104 for(i = 0, j = q.length; i < j; i++) { 105 if(q[i] !== ev) newQueue.push(q[i]); 106 } 107 q = newQueue; 108 }; 109 110 this.length = function() { 111 return q.length; 112 } 113 } 114 115 /** 116 * 117 * @param {HTMLElement} element 118 * @param {Function} resized 119 */ 120 function attachResizeEvent(element, resized) { 121 if (!element) return; 122 if (element.resizedAttached) { 123 element.resizedAttached.add(resized); 124 return; 125 } 126 127 element.resizedAttached = new EventQueue(); 128 element.resizedAttached.add(resized); 129 130 element.resizeSensor = document.createElement('div'); 131 element.resizeSensor.dir = 'ltr'; 132 element.resizeSensor.className = 'resize-sensor'; 133 var style = 'position: absolute; left: -10px; top: -10px; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden;'; 134 var styleChild = 'position: absolute; left: 0; top: 0; transition: 0s;'; 135 136 element.resizeSensor.style.cssText = style; 137 element.resizeSensor.innerHTML = 138 '<div class="resize-sensor-expand" style="' + style + '">' + 139 '<div style="' + styleChild + '"></div>' + 140 '</div>' + 141 '<div class="resize-sensor-shrink" style="' + style + '">' + 142 '<div style="' + styleChild + ' width: 200%; height: 200%"></div>' + 143 '</div>'; 144 element.appendChild(element.resizeSensor); 145 146 var position = window.getComputedStyle(element).getPropertyPriority('position'); 147 if ('absolute' !== position && 'relative' !== position && 'fixed' !== position) { 148 element.style.position = 'relative'; 149 } 150 151 var expand = element.resizeSensor.childNodes[0]; 152 var expandChild = expand.childNodes[0]; 153 var shrink = element.resizeSensor.childNodes[1]; 154 var dirty, rafId, newWidth, newHeight; 155 var size = getElementSize(element); 156 var lastWidth = size.width; 157 var lastHeight = size.height; 158 159 var reset = function() { 160 //set display to block, necessary otherwise hidden elements won't ever work 161 var invisible = element.offsetWidth === 0 && element.offsetHeight === 0; 162 163 if (invisible) { 164 var saveDisplay = element.style.display; 165 element.style.display = 'block'; 166 } 167 168 expandChild.style.width = '100000px'; 169 expandChild.style.height = '100000px'; 170 171 expand.scrollLeft = 100000; 172 expand.scrollTop = 100000; 173 174 shrink.scrollLeft = 100000; 175 shrink.scrollTop = 100000; 176 177 if (invisible) { 178 element.style.display = saveDisplay; 179 } 180 }; 181 element.resizeSensor.resetSensor = reset; 182 183 var onResized = function() { 184 rafId = 0; 185 186 if (!dirty) return; 187 188 lastWidth = newWidth; 189 lastHeight = newHeight; 190 191 if (element.resizedAttached) { 192 element.resizedAttached.call(); 193 } 194 }; 195 196 var onScroll = function() { 197 var size = getElementSize(element); 198 var newWidth = size.width; 199 var newHeight = size.height; 200 dirty = newWidth != lastWidth || newHeight != lastHeight; 201
202 if (dirty && !rafId) { 203 rafId = requestAnimationFrame(onResized); 204 } 205 206 reset(); 207 }; 208 209 var addEvent = function(el, name, cb) { 210 if (el.attachEvent) { 211 el.attachEvent('on' + name, cb); 212 } else { 213 el.addEventListener(name, cb); 214 } 215 }; 216 217 addEvent(expand, 'scroll', onScroll); 218 addEvent(shrink, 'scroll', onScroll); 219 220 // Fix for custom Elements 221 requestAnimationFrame(reset); 222 } 223 224 forEachElement(element, function(elem){ 225 attachResizeEvent(elem, callback); 226 }); 227 228 this.detach = function(ev) { 229 ResizeSensor.detach(element, ev); 230 }; 231 232 this.reset = function() { 233 element.resizeSensor.resetSensor(); 234 }; 235 }; 236 237 ResizeSensor.reset = function(element, ev) { 238 forEachElement(element, function(elem){ 239 elem.resizeSensor.resetSensor(); 240 }); 241 }; 242 243 ResizeSensor.detach = function(element, ev) { 244 forEachElement(element, function(elem){ 245 if (!elem) return; 246 if(elem.resizedAttached && typeof ev === "function"){ 247 elem.resizedAttached.remove(ev); 248 if(elem.resizedAttached.length()) return; 249 } 250 if (elem.resizeSensor) { 251 if (elem.contains(elem.resizeSensor)) { 252 elem.removeChild(elem.resizeSensor); 253 } 254 delete elem.resizeSensor; 255 delete elem.resizedAttached; 256 } 257 }); 258 }; 259 260 return ResizeSensor; 261 262})); 263 264(function($) { 265 'use strict'; 266 267 if (!$.isEmptyObject(window.MK)) {return} 268 269 var MK = window.MK || {}; 270 window.MK = MK; 271 MK.utils = window.MK.utils || {}; 272 273 /** 274 * Gets user browser and its version 275 * @return {Object} => {name, version} 276 */ 277 MK.utils.browser = (function() { 278 var dataBrowser = [ 279 {string: navigator.userAgent, subString: "Edge", identity: "Edge"}, 280 {string: navigator.userAgent, subString: "Chrome", identity: "Chrome"}, 281 {string: navigator.userAgent, subString: "MSIE", identity: "IE"}, 282 {string: navigator.userAgent, subString: "Trident", identity: "IE"}, 283 {string: navigator.userAgent, subString: "Firefox", identity: "Firefox"}, 284 {string: navigator.userAgent, subString: "Safari", identity: "Safari"}, 285 {string: navigator.userAgent, subString: "Opera", identity: "Opera"} 286 ]; 287 288 var versionSearchString = null; 289 var searchString = function (data) { 290 for (var i = 0; i < data.length; i++) { 291 var dataString = data[i].string; 292 versionSearchString = data[i].subString; 293 294 if (dataString.indexOf(data[i].subString) !== -1) { 295 return data[i].identity; 296 } 297 } 298 }; 299 300 var searchVersion = function (dataString) { 301 var index = dataString.indexOf(versionSearchString); 302 if (index === -1) { 303 return; 304 } 305 306 var rv = dataString.indexOf("rv:"); 307 if (versionSearchString === "Trident" && rv !== -1) { 308 return parseFloat(dataString.substring(rv + 3)); 309 } else { 310 return parseFloat(dataString.substring(index + versionSearchString.length + 1)); 311 } 312 }; 313 314 var name = searchString(dataBrowser) || "Other"; 315 var version = searchVersion(navigator.userAgent) || searchVersion(navigator.appVersion) || "Unknown"; 316 317 // Expose for css 318 $('html').addClass(name).addClass(name + version); 319 320 321 return { 322 name : name, 323 version : version 324 }; 325 326 })(); 327 328 /** 329 * Gets user operating system 330 * @return {String} 331 */ 332 MK.utils.OS = (function() { 333 if (navigator.appVersion.indexOf("Win")!=-1) return "Windows"; 334 if (navigator.appVersion.indexOf("Mac")!=-1) return "OSX"; 335 if (navigator.appVersion.indexOf("X11")!=-1) return "UNIX"; 336 if (navigator.appVersion.indexOf("Linux")!=-1) return "Linux"; 337 })(); 338 339 /** 340 * Check if mobile device. 341 * @return {Boolean} 342 */ 343 MK.utils.isMobile = function() { 344 // Problems with bigger tablets as users raport differences with behaviour. Switch to navigator sniffing 345 // return ('ontouchstart' in document.documentElement) && matchMedia( '(max-width: 1024px)' ).matches; 346 347 // http://www.abeautifulsite.net/detecting-mobile-devices-with-javascript/ 348 // if it still brings problem try to move to more sophisticated solution like 349 // apachemobilefilter.org 350 // detectright.com 351 // web.wurfl.io 352 // 353 // Seems as best solution here: 354 // hgoebl.github.io/mobile-detect.js 355 356 function android() { 357 return navigator.userAgent.match(/Android/i); 358 } 359 360 function blackBerry() { 361 return navigator.userAgent.match(/BlackBerry/i); 362 } 363 364 function iOS() { 365 return navigator.userAgent.match(/iPhone|iPad|iPod/i); 366 } 367 368 function opera() { 369 return navigator.userAgent.match(/Opera Mini/i); 370 } 371 372 function windows() { 373 return navigator.userAgent.match(/IEMobile/i); 374 } 375 376 return (android() || blackBerry() || iOS() || opera() || windows() || matchMedia( '(max-width: 1024px)' ).matches); 377 378 }; 379 380 /** 381 * Check if menu is switched to responsive state based on user width settings 382 * @return {Boolean} 383 */ 384 MK.utils.isResponsiveMenuState = function() { 385 return window.matchMedia( '(max-width: '+ mk_responsive_nav_width +'px)').matches; 386 }; 387 388 389 390 MK.utils.getUrlParameter = function getUrlParameter(sParam) { 391 var sPageURL = decodeURIComponent(window.location.search.substring(1)), 392 sURLVariables = sPageURL.split('&'), 393 sParameterName, 394 i; 395 396 for (i = 0; i < sURLVariables.length; i++) { 397 sParameterName = sURLVariables[i].split('='); 398 399 if (sParameterName[0] === sParam) { 400 return sParameterName[1] === undefined ? true : sParameterName[1]; 401 } 402 } 403 }; 404 405 MK.utils.throttle = function( delay, fn ) { 406 var last; 407 var deferTimer; 408 409 return function() { 410 var context = this; 411 var args = arguments; 412 var now = +new Date; 413 if( last && now < last + delay ) { 414 clearTimeout( deferTimer ); 415 deferTimer = setTimeout( function() { 416 last = now; fn.apply( context, args ); 417 }, delay ); 418 } else { 419 last = now; 420 fn.apply( context, args ); 421 } 422 }; 423 }; 424 425 /** 426 * This should be invoked only on page load. 427 * Scrolls to anchor from address bar 428 */ 429 MK.utils.scrollToURLHash = function() { 430 var loc = window.location, 431 hash = loc.hash; 432 433 if ( hash.length && hash.substring(1).length ) { 434 // !loading is added early after DOM is ready to prevent native jump to anchor 435 hash = hash.replace( '!loading', '' ); 436 437 // Wait for one second before animating 438 // Most of UI animations should be done by then and async operations complited 439 setTimeout( function() { 440 MK.utils.scrollToAnchor( hash ); 441 }, 1000 ); 442 443 // Right after reset back address bar 444 setTimeout( function() { 445 window.history.replaceState(undefined, undefined, hash); 446 }, 1001); 447 } 448 }; 449 450 /** 451 * Controls native scroll behaviour 452 * @return {Object} => {disable, enable} 453 */ 454 MK.utils.scroll = (function() { 455 // 37 - left arror, 38 - up arrow, 39 right arrow, 40 down arrow 456 var keys = [38, 40]; 457 458 function preventDefault(e) { 459 e = e || window.event; 460 e.preventDefault(); 461 e.returnValue = false;
462 } 463 464 function wheel(e) { 465 preventDefault(e); 466 } 467 468 function keydown(e) { 469 for (var i = keys.length; i--;) { 470 if (e.keyCode === keys[i]) { 471 preventDefault(e); 472 return; 473 } 474 } 475 } 476 477 function disableScroll() { 478 if (window.addEventListener) { 479 window.addEventListener('DOMMouseScroll', wheel, false); 480 } 481 window.onmousewheel = document.onmousewheel = wheel; 482 document.onkeydown = keydown; 483 } 484 485 function enableScroll() { 486 if (window.removeEventListener) { 487 window.removeEventListener('DOMMouseScroll', wheel, false); 488 } 489 window.onmousewheel = document.onmousewheel = document.onkeydown = null; 490 } 491 492 return { 493 disable : disableScroll, 494 enable : enableScroll 495 }; 496 497})(); 498 499MK.utils.launchIntoFullscreen = function ( element ) { 500 if(element.requestFullscreen) { 501 element.requestFullscreen(); 502 } else if(element.mozRequestFullScreen) { 503 element.mozRequestFullScreen(); 504 } else if(element.webkitRequestFullscreen) { 505 element.webkitRequestFullscreen(); 506 } else if(element.msRequestFullscreen) { 507 element.msRequestFullscreen(); 508 } 509}; 510 511MK.utils.exitFullscreen = function () { 512 if(document.exitFullscreen) { 513 document.exitFullscreen(); 514 } else if(document.mozCancelFullScreen) { 515 document.mozCancelFullScreen(); 516 } else if(document.webkitExitFullscreen) { 517 document.webkitExitFullscreen(); 518 } 519}; 520 521 /** 522 * Scroll Spy implementation. Spy dynamic offsets of elements or static pixel offset 523 * @param {Number|Element} 524 * @param {Object} => callback object {before, active, after} 525 */ 526 MK.utils.scrollSpy = function( toSpy, config ) { 527 var $window = $( window ), 528 container = $('.jupiterx-site')[0], 529 isObj = ( typeof toSpy === 'object' ), 530 offset = (isObj) ? MK.val.dynamicOffset( toSpy, config.position, config.threshold ) : function() { return toSpy; }, 531 height = (isObj) ? MK.val.dynamicHeight( toSpy ) : function() { return 0; }, 532 cacheVals = {}, 533 _p = 'before'; // current position 534 535 var checkPosition = function() { 536 var s = MK.val.scroll(), 537 o = offset(), 538 h = height(); 539 540 if( s < o && _p !== 'before' ) { 541 // console.log( toSpy, 'before' ); 542 if( config.before ) config.before(); 543 _p = 'before'; 544 } 545 else if( s >= o && s <= o + h && _p !== 'active' ) { 546 // console.log( toSpy, 'active' ); 547 if( config.active ) config.active( o ); 548 _p = 'active'; 549 } 550 else if( s > o + h && _p !== 'after' ) { 551 // console.log( toSpy, 'after' ); 552 if( config.after) config.after( o + h ); 553 _p = 'after'; 554 } 555 }; 556 557 var rAF = function() { 558 window.requestAnimationFrame( checkPosition ); 559 }; 560 561 var exportVals = function() { 562 return cacheVals; 563 }; 564 565 var updateCache = function() { 566 var o = offset(), 567 h = height(); 568 569 cacheVals = { 570 before : o - $window.height(), 571 active : o, 572 after : o + h 573 }; 574 }; 575 576 if( config.cache ) { 577 config.cache( exportVals ); 578 } 579 580 checkPosition(); 581 $window.on( 'load', checkPosition ); 582 $window.on( 'resize', checkPosition ); 583 $window.on( 'mouseup', checkPosition ); 584 window.addResizeListener( container, checkPosition ); 585 586 $window.on( 'scroll', rAF ); 587 588 updateCache(); 589 $window.on( 'load', updateCache ); 590 $window.on( 'resize', updateCache ); 591 window.addResizeListener( container, updateCache ); 592 }; 593 594 /** 595 * Scrolls page to static pixel offset 596 * @param {Number} 597 */ 598 MK.utils.scrollTo = function( offset ) { 599 $('html, body').stop().animate({ 600 scrollTop: offset 601 }, { 602 duration: 1200, 603 }); 604 }; 605 606 MK.utils.isElementInViewport = function( el ) { 607 var elemTop = el.getBoundingClientRect().top; 608 var isVisible = (elemTop < window.innerHeight); 609 return isVisible; 610}; 611 612 /** 613 * Scrolls to element passed in as object or DOM reference 614 * @param {String|Object} 615 */ 616 MK.utils.scrollToAnchor = function( hash ) { 617 // Escape meta-chars from hash name only. 618 hash = hash.substring(1).replace(/[!"#$%&'()*+,./:;<=>?@[\]^`{|}~]/g, "\\$&"); 619 hash = "#" + hash; 620 var $target = $( hash ); 621 // console.log( hash ); 622 623 if( ! $target.length ) return; 624 625 var offset = $target.offset().top; 626 offset = offset - MK.val.offsetHeaderHeight( offset ); 627 628 if( hash === '#top-of-page' ) window.history.replaceState( undefined, undefined, ' ' ); 629 else window.history.replaceState( undefined, undefined, hash ); 630 631 MK.utils.scrollTo( offset ); 632 }; 633 634 /** 635 * Basic implementation of pub / sub pattern to avoid tight coupling with direct module communication 636 * @type {Object} 637 */ 638 MK.utils.eventManager = {}; 639 640 /** 641 * Subscribe to custom event and run callbacks 642 * @param {String} 643 * @param {Function} 644 * 645 * @usage MK.utils.eventManager.subscribe('event', function(e, params) {} ) 646 */ 647 MK.utils.eventManager.subscribe = function(evt, func) { 648 $(this).on(evt, func); 649 }; 650 651 /** 652 * Unsubscribe from custom event 653 * @param {String} 654 * @param {Function} 655 */ 656 MK.utils.eventManager.unsubscribe = function(evt, func) { 657 $(this).off(evt, func); 658 }; 659 660 /** 661 * Publish custom event to notify appliaction about state change 662 * @param {String} 663 * 664 * @usage MK.utils.eventManager.publish('event', { 665 * param: val 666 * }) 667 */ 668 MK.utils.eventManager.publish = function(evt, params) { 669 $(this).trigger(evt, [params]); 670 }; 671 672 /** 673 * Get all top offsets from jQuery collection 674 * 675 * @param {$Objects} 676 * @return {Aray} 677 */ 678 MK.utils.offsets = function( $els ) { 679 return $.map( $els, function( el ) { 680 return $( el ).offset().top; 681 }); 682 }; 683 684 /** 685 * Retrive from array of numbers first number that is higher than given parameter 686 * 687 * @param {Number} 688 * @param {Array} 689 * @return {Number} 690 */ 691 MK.utils.nextHigherVal = function( val, arr ) { 692 var i = 0, 693 higher = null; 694 695 var check = function() { 696 if( val > arr[ i ]) { 697 i += 1; 698 check(); 699 } else { 700 higher = arr[ i ]; 701 } 702 }; 703 check(); 704 705 return higher; 706 }; 707 708}(jQuery)); 709 710(function($) { 711 'use strict'; 712 713 var MK = window.MK || {}; 714 715 /** 716 * MK.core holds most important methods that bootstraps whole application 717 * 718 * @type {Object} 719 */ 720 MK.core = {}; 721 722 /** 723 * State for referance of already loaded script files 724 * @type {Array} 725 */ 726 var _loadedDependencies = []; 727 728 /** 729 * State of queue represented as pairs of script ref => callback 730 * @type {Object} 731 */ 732 var _inQueue = {}; 733 734 /** 735 * Initializes all components in given scope (object or DOM reference) based on data attribute and 'pointer' css class '.js-el'. 736 * DOM work is reduced by single traversing for pointer class and later filtering through cached object. It expects init() method 737 * on every component. Component itself should be defined in MK.component namespace and assign to DOM element via data-mk-component. 738 * Use it once on DOM ready with document as a scope. For partial initialization after aja
738x operations pass as a scope element 739 * where new DOM was inserted. 740 * 741 * @param {string|object} 742 */ 743 MK.core.initAll = function( scope ) { 744 var $el = $( scope ).find( '.js-el' ), // single traversing 745 $components = $el.filter( '[data-mk-component]' ), 746 component = null; 747 748 749 // initialize component 750 var init = function init(name, el) { 751 var $el = $(el); 752 753 if ( $el.data('init-' + name) ) return; // do not initialize the same module twice 754 755 if ( typeof MK.component[ name ] !== 'function' ) console.log('Component init error: ', name); 756 else { 757 component = new MK.component[ name ]( el ); 758 component.init(); 759 $el.data('init-' + name, true); // mark as initialised 760 // TODO add name 761 MK.utils.eventManager.publish('component-inited'); 762 } 763 }; 764 765 $components.each( function() { 766 var self = this, 767 $this = $( this ), 768 names = $this.data( 'mk-component' ); 769 770 if( typeof names === 'string' ) { 771 var name = names; // containes only single name. Keep it transparent. 772 init(name, self); 773 } else { 774 names.forEach( function( name ) { 775 init(name, self); 776 }); 777 } 778 }); 779 }; 780 781 /** 782 * Async loader for 3rd party plugins available from within theme or external CDNs / APIs. 783 * Take one argument as callback which is run when loading is finished. Also keeps track of already loaded scripts 784 * and prevent duplication. Holds in queue multiple callbacks that where defined in different places but depend on the 785 * same plugin. 786 * 787 * TODO: heavy test for multiple dependencies and crosssharing one dependency and different one dependency in queue, 788 * bulletproof with single dependency 789 * 790 * @example MK.core.loadDependencies([MK.core.path.plugins + 'plugin.js'], function() { 791 * // do something when plugin is loaded 792 * }) 793 * 794 * @param {array} 795 * @param {function} 796 */ 797 MK.core.loadDependencies = function( dependencies, callback ) { 798 var _callback = callback || function() {}; 799 800 if( !dependencies ) { 801 // If no dependencies defined then run _callback imidietelly 802 _callback(); 803 return; 804 } 805 806 // Check for new dependencies 807 var newDeps = dependencies.map( function( dep ) { 808 if( _loadedDependencies.indexOf( dep ) === -1 ) { 809 if( typeof _inQueue[ dep ] === 'undefined' ) { 810 // console.log( dep ); 811 return dep; 812 } else { 813 _inQueue[ dep ].push( _callback ); 814 return true; 815 } 816 } else { 817 return false; 818 } 819 }); 820 821 // The dependency is not new but it's not resolved yet 822 // Callback is added to queue that will be run after the script is loaded 823 // Don't run callback just yet. 824 if( newDeps[0] === true ) {
825 // console.log('Waiting for ' + dependencies[0]); 826 return; 827 } 828 829 // Dependency was loaded previously. We can run callback safely 830 if( newDeps[0] === false ) { 831 _callback(); 832 return; 833 } 834 835 // Create queue and relationship script -> callback array to track 836 // all callbacks that waits for ths script 837 var queue = newDeps.map( function( script ) { 838 // console.log( script ); 839 _inQueue[ script ] = [ _callback ]; 840 return $.getCachedScript( script ); 841 }); 842 843 // Callbacks invoking 844 var onLoad = function onLoad() { 845 var index; 846 newDeps.map( function( loaded ) { 847 _inQueue[ loaded ].forEach( function( callback ) { 848 callback(); 849 }); 850 delete _inQueue[ loaded ]; 851 _loadedDependencies.push( loaded ); 852 }); 853 }; 854 855 // Run callbacks when promise is resolved 856 $.when.apply( null, queue ).done( onLoad ); 857 }; 858 859 /** 860 * Single namespace for all paths recuired in application. 861 * @type {Object} 862 */ 863 MK.core.path = { 864 theme: jupiterDonutVars.themeUrl, 865 plugins: jupiterDonutVars.assetsUrl + '/lib/js/', 866 ajaxUrl: jupiterDonutVars.ajaxUrl 867 }; 868 869 870})(jQuery); 871 872 873(function($) { 874 'use strict'; 875 876 /** 877 * Entry point of application. Runs all components 878 */ 879 $( window ).on( 'load', function() { 880 MK.core.initAll( document ); 881 MK.utils.scrollToURLHash(); 882 }); 883 884 /** 885 * VC frontend editor. Init all components. 886 */ 887 $( window ).on( 'vc_reload', function() { 888 setTimeout(function(){ 889 MK.core.initAll( document ); 890 }, 100); 891 }); 892 893 /** 894 * Assign global click handlers 895 */ 896 $( document ).on( 'click', '.js-smooth-scroll, .js-main-nav a', smoothScrollToAnchor); 897 $( '.side_dashboard_menu a' ).on( 'click', smoothScrollToAnchor); 898 899 function smoothScrollToAnchor( evt ) { 900 var anchor = MK.utils.detectAnchor( this ); 901 var $this = $(evt.currentTarget); 902 var loc = window.location; 903 var currentPage = loc.origin + loc.pathname; 904 var href = $this.attr( 'href' ); 905 var linkSplit = (href) ? href.split( '#' ) : ''; 906 var hrefPage = linkSplit[0] ? linkSplit[0] : ''; 907 var hrefHash = linkSplit[1] ? linkSplit[1] : ''; 908 909 if( anchor.length ) { 910 if(hrefPage === currentPage || hrefPage === '') evt.preventDefault(); 911 MK.utils.scrollToAnchor( anchor ); 912 913 } else if( $this.attr( 'href' ) === '#' ) { 914 evt.preventDefault(); 915 } 916 } 917 918}(jQuery)); 919 920'use strict'; 921 922/** 923 * Copyright Marc J. Schmidt. See the LICENSE file at the top-level 924 * directory of this distribution and at 925 * https://github.com/marcj/css-element-queries/blob/master/LICENSE. 926 */ 927(function (root, factory) { 928 if (typeof define === "function" && define.amd) { 929 define(['./ResizeSensor.js'], factory); 930 } else if (typeof exports === "object") { 931 module.exports = factory(require('./ResizeSensor.js')); 932 } else { 933 root.ElementQueries = factory(root.ResizeSensor); 934 root.ElementQueries.listen(); 935 } 936}(typeof window !== 'undefined' ? window : this, function (ResizeSensor) { 937 938 /** 939 * 940 * @type {Function} 941 * @constructor 942 */ 943 var ElementQueries = function () { 944 //<style> element with our dynamically created styles 945 var cssStyleElement; 946 947 //all rules found for element queries 948 var allQueries = {}; 949 950 //association map to identify which selector belongs to a element from the animationstart event. 951 var idToSelectorMapping = []; 952 953 /** 954 * 955 * @param element 956 * @returns {Number} 957 */ 958 function getEmSize(element) { 959 if (!element) { 960 element = document.documentElement; 961 } 962 var fontSize = window.getComputedStyle(element, null).fontSize; 963 return parseFloat(fontSize) || 16; 964 } 965 966 /** 967 * Get element size 968 * @param {HTMLElement} element 969 * @returns {Object} {width, height} 970 */ 971 function getElementSize(element) { 972 if (!element.getBoundingClientRect) { 973 return { 974 width: element.offsetWidth, 975 height: element.offsetHeight 976 } 977 } 978 979 var rect = element.getBoundingClientRect(); 980 return { 981 width: Math.round(rect.width), 982 height: Math.round(rect.height) 983 } 984 } 985 986 /** 987 * 988 * @copyright https://github.com/Mr0grog/element-query/blob/master/LICENSE 989 * 990 * @param {HTMLElement} element 991 * @param {*} value 992 * @returns {*} 993 */ 994 function convertToPx(element, value) { 995 var numbers = value.split(/\d/); 996 var units = numbers[numbers.length - 1]; 997 value = parseFloat(value); 998 switch (units) { 999 case "px": 1000 return value; 1001 case "em": 1002 return value * getEmSize(element); 1003 case "rem": 1004 return value * getEmSize(); 1005 // Viewport units! 1006 // According to http://quirksmode.org/mobile/tableViewport.html 1007 // documentElement.clientWidth/Height gets us the most reliable info 1008 case "vw": 1009 return value * document.documentElement.clientWidth / 100; 1010 case "vh": 1011 return value * document.documentElement.clientHeight / 100; 1012 case "vmin": 1013 case "vmax": 1014 var vw = document.documentElement.clientWidth / 100; 1015 var vh = document.documentElement.clientHeight / 100; 1016 var chooser = Math[units === "vmin" ? "min" : "max"]; 1017 return value * chooser(vw, vh); 1018 default: 1019 return value; 1020 // for now, not supporting physical units (since they are just a set number of px) 1021 // or ex/ch (getting accurate measurements is hard) 1022 } 1023 } 1024 1025 /** 1026 * 1027 * @param {HTMLElement} element 1028 * @param {String} id 1029 * @constructor 1030 */ 1031 function SetupInformation(element, id) { 1032 this.element = element; 1033 var key, option, elementSize, value, actualValue, attrValues, attrValue, attrName; 1034 1035 var attributes = ['min-width', 'min-height', 'max-width', 'max-height']; 1036 1037 /** 1038 * Extracts the computed width/height and sets to min/max- attribute. 1039 */ 1040 this.call = function () { 1041 // extract current dimensions 1042 elementSize = getElementSize(this.element); 1043 1044 attrValues = {}; 1045 1046 for (key in allQueries[id]) { 1047 if (!allQueries[id].hasOwnProperty(key)) { 1048 continue; 1049 } 1050 option = allQueries[id][key]; 1051 1052 value = convertToPx(this.element, option.value); 1053 1054 actualValue = option.property === 'width' ? elementSize.width : elementSize.height; 1055 attrName = option.mode + '-' + option.property; 1056 attrValue = ''; 1057 1058 if (option.mode === 'min' && actualValue >= value) { 1059 attrValue += option.value; 1060 } 1061 1062 if (option.mode === 'max' && actualValue <= value) { 1063 attrValue += option.value; 1064 } 1065 1066 if (!attrValues[attrName]) attrValues[attrName] = ''; 1067 if (attrValue && -1 === (' ' + attrValues[attrName] + ' ').indexOf(' ' + attrValue + ' ')) { 1068 attrValues[attrName] += ' ' + attrValue; 1069 } 1070 } 1071 1072 for (var k in attributes) { 1073 if (!attributes.hasOwnProperty(k)) continue; 1074 1075 if (attrValues[attributes[k]]) { 1076 this.element.setAttribute(attributes[k], attrValues[attributes[k]].substr(1)); 1077 } else { 1078 this.element.removeAttribute(attributes[k]); 1079 } 1080 } 1081 }; 1082 } 1083 1084 /** 1085 * @param {HTMLElement} element 1086 * @param {Object} id 1087 */ 1088 function setupElement(element, id) { 1089 if (!element.elementQueriesSetupInformation) { 1090 element.elementQueriesSetupInformation = new SetupInformation(element, id); 1091 } 1092 if (!element.elementQueriesSensor) { 1093 element.elementQueriesSensor = new ResizeSensor(element, function () { 1094 element.elementQueriesSetupInformation.call(); 1095 }); 1096 } 1097 1098 element.elementQueriesSetupInformation.call(); 1099 } 1100 1101 /** 1102 * Stores rules to the selector that should be applied once resized. 1103 * 1104 * @param {String} selector 1105 * @param {String} mode min|max 1106 * @param {String} property width|height 1107 * @param {String} value 1108 */ 1109 function queueQuery(selector, mode, property, value) { 1110 if (typeof(allQueries[selector]) === 'undefined') { 1111 allQueries[selector] = []; 1112 // add animation to trigger animationstart event, so we know exactly when a element appears in the DOM 1113 1114 var id = idToSelectorMapping.length; 1115 cssStyleElement.innerHTML += '\n' + selector + ' {animation: 0.1s element-queries;}'; 1116 cssStyleElement.innerHTML += '\n' + selector + ' > .resize-sensor {min-width: '+id+'px;}'; 1117 idToSelectorMapping.push(selector); 1118 } 1119 1120 allQueries[selector].push({ 1121 mode: mode, 1122 property: property, 1123 value: value 1124 }); 1125 } 1126 1127 function getQuery(container) { 1128 var query; 1129 if (document.querySelectorAll) query = (container) ? container.querySelectorAll.bind(container) : document.querySelectorAll.bind(document); 1130 if (!query && 'undefined' !== typeof $$) query = $$; 1131 if (!query && 'undefined' !== typeof jQuery) query = jQuery; 1132 1133 if (!query) { 1134 throw 'No document.querySelectorAll, jQuery or Mootools\'s $$ found.'; 1135 } 1136 1137 return query; 1138 } 1139 1140 /** 1141 * If animationStart didn't catch a new element in the DOM, we can manually search for it 1142 */ 1143 function findElementQueriesElements(container) { 1144 var query = getQuery(container); 1145 1146 for (var selector in allQueries) if (allQueries.hasOwnProperty(mode)) { 1147 // find all elements based on the extract query selector from the element query rule 1148 var elements = query(selector, container); 1149 1150 for (var i = 0, j = elements.length; i < j; i++) { 1151 setupElement(elements[i], selector); 1152 } 1153 } 1154 } 1155 1156 /** 1157 * 1158 * @param {HTMLElement} element 1159 */ 1160 function attachResponsiveImage(element) { 1161 var children = []; 1162 var rules = []; 1163 var sources = []; 1164 var defaultImageId = 0; 1165 var lastActiveImage = -1; 1166 var loadedImages = []; 1167 1168 for (var i in element.children) { 1169 if (!element.children.hasOwnProperty(i)) continue; 1170 1171 if (element.children[i].tagName && element.children[i].tagName.toLowerCase() === 'img') { 1172 children.push(element.children[i]); 1173 1174 var minWidth = element.children[i].getAttribute('min-width') || element.children[i].getAttribute('data-min-width'); 1175 //var minHeight = element.children[i].getAttribute('min-height') || element.children[i].getAttribute('data-min-height'); 1176 var src = element.children[i].getAttribute('data-src') || element.children[i].getAttribute('url'); 1177 1178 sources.push(src); 1179 1180 var rule = { 1181 minWidth: minWidth 1182 }; 1183 1184 rules.push(rule); 1185 1186 if (!minWidth) { 1187 defaultImageId = children.length - 1; 1188 element.children[i].style.display = 'block'; 1189 } else { 1190 element.children[i].style.display = 'none'; 1191 } 1192 } 1193 } 1194 1195 lastActiveImage = defaultImageId; 1196 1197 function check() { 1198 var imageToDisplay = false, i; 1199 1200 for (i in children) { 1201 if (!children.hasOwnProperty(i)) continue; 1202 1203 if (rules[i].minWidth) { 1204 if (element.offsetWidth > rules[i].minWidth) { 1205 imageToDisplay = i; 1206 } 1207 } 1208 } 1209 1210 if (!imageToDisplay) { 1211 //no rule matched, show default 1212 imageToDisplay = defaultImageId; 1213 } 1214 1215 if (lastActiveImage !== imageToDisplay) { 1216 //image change 1217 1218 if (!loadedImages[imageToDisplay]) { 1219 //image has not been loaded yet, we need to load the image first in memory to prevent flash of 1220 //no content 1221 1222 var image = new Image(); 1223 image.onload = function () { 1224 children[imageToDisplay].src = sources[imageToDisplay]; 1225 1226 children[lastActiveImage].style.display = 'none'; 1227 children[imageToDisplay].style.display = 'block'; 1228 1229 loadedImages[imageToDisplay] = true; 1230 1231 lastActiveImage = imageToDisplay; 1232 }; 1233 1234 image.src = sources[imageToDisplay]; 1235 } else { 1236 children[lastActiveImage].style.display = 'none'; 1237 children[imageToDisplay].style.display = 'block'; 1238 lastActiveImage = imageToDisplay; 1239 } 1240 } else { 1241 //make sure for initial check call the .src is set correctly 1242 children[imageToDisplay].src = sources[imageToDisplay]; 1243 } 1244 } 1245 1246 element.resizeSensor = new ResizeSensor(element, check); 1247 check(); 1248 } 1249 1250 function findResponsiveImages() { 1251 var query = getQuery(); 1252 1253 var elements = query('[data-responsive-image],[responsive-image]'); 1254 for (var i = 0, j = elements.length; i < j; i++) { 1255 attachResponsiveImage(elements[i]); 1256 } 1257 } 1258 1259 var regex = /,?[\s\t]*([^,\n]*?)((?:\[[\s\t]*?(?:min|max)-(?:width|height)[\s\t]*?[~$\^]?=[\s\t]*?"[^"]*?"[\s\t]*?])+)([^,\n\s\{]*)/mg
1259i; 1260 var attrRegex = /\[[\s\t]*?(min|max)-(width|height)[\s\t]*?[~$\^]?=[\s\t]*?"([^"]*?)"[\s\t]*?]/mgi; 1261 1262 /** 1263 * @param {String} css 1264 */ 1265 function extractQuery(css) { 1266 var match, smatch, attrs, attrMatch; 1267 1268 css = css.replace(/'/g, '"'); 1269 while (null !== (match = regex.exec(css))) { 1270 smatch = match[1] + match[3]; 1271 attrs = match[2]; 1272 1273 while (null !== (attrMatch = attrRegex.exec(attrs))) { 1274 queueQuery(smatch, attrMatch[1], attrMatch[2], attrMatch[3]); 1275 } 1276 } 1277 } 1278 1279 /** 1280 * @param {CssRule[]|String} rules 1281 */ 1282 function readRules(rules) { 1283 var selector = ''; 1284 1285 if (!rules) { 1286 return; 1287 } 1288 1289 if ('string' === typeof rules) { 1290 rules = rules.toLowerCase(); 1291 if (-1 !== rules.indexOf('min-width') || -1 !== rules.indexOf('max-width')) { 1292 extractQuery(rules); 1293 } 1294 } else { 1295 for (var i = 0, j = rules.length; i < j; i++) { 1296 if (1 === rules[i].type) { 1297 selector = rules[i].selectorText || rules[i].cssText; 1298 if (-1 !== selector.indexOf('min-height') || -1 !== selector.indexOf('max-height')) { 1299 extractQuery(selector); 1300 } else if (-1 !== selector.indexOf('min-width') || -1 !== selector.indexOf('max-width')) { 1301 extractQuery(selector); 1302 } 1303 } else if (4 === rules[i].type) { 1304 readRules(rules[i].cssRules || rules[i].rules); 1305 } else if (3 === rules[i].type) { 1306 readRules(rules[i].styleSheet.cssRules); 1307 } 1308 } 1309 } 1310 } 1311 1312 var defaultCssInjected = false; 1313 1314 /** 1315 * Searches all css rules and setups the event listener to all elements with element query rules.. 1316 */ 1317 this.init = function () { 1318 var animationStart = 'animationstart'; 1319 if (typeof document.documentElement.style['webkitAnimationName'] !== 'undefined') { 1320 animationStart = 'webkitAnimationStart'; 1321 } else if (typeof document.documentElement.style['MozAnimationName'] !== 'undefined') { 1322 animationStart = 'mozanimationstart'; 1323 } else if (typeof document.documentElement.style['OAnimationName'] !== 'undefined') { 1324 animationStart = 'oanimationstart'; 1325 } 1326 1327 document.body.addEventListener(animationStart, function (e) { 1328 var element = e.target; 1329 var styles = window.getComputedStyle(element, null); 1330 1331 if (-1 !== styles.getPropertyValue('animation-name').indexOf('element-queries')) { 1332 element.elementQueriesSensor = new ResizeSensor(element, function () { 1333 if (element.elementQueriesSetupInformation) { 1334 element.elementQueriesSetupInformation.call(); 1335 } 1336 }); 1337 1338 var sensorStyles = window.getComputedStyle(element.resizeSensor, null); 1339 var id = sensorStyles.getPropertyValue('min-width'); 1340 id = parseInt(id.replace('px', '')); 1341 setupElement(e.target, idToSelectorMapping[id]); 1342 } 1343 }); 1344 1345 if (!defaultCssInjected) { 1346 cssStyleElement = document.createElement('style'); 1347 cssStyleElement.type = 'text/css'; 1348 cssStyleElement.innerHTML = '[responsive-image] > img, [data-responsive-image] {overflow: hidden; padding: 0; } [responsive-image] > img, [data-responsive-image] > img {width: 100%;}'; 1349 1350 //safari wants at least one rule in keyframes to start working 1351 cssStyleElement.innerHTML += '\n@keyframes element-queries { 0% { visibility: inherit; } }'; 1352 document.getElementsByTagName('head')[0].appendChild(cssStyleElement); 1353 defaultCssInjected = true; 1354 } 1355 1356 for (var i = 0, j = document.styleSheets.length; i < j; i++) { 1357 try { 1358 if (document.styleSheets[i].href && 0 === document.styleSheets[i].href.indexOf('file://')) { 1359 console.log("CssElementQueries: unable to parse local css files, " + document.styleSheets[i].href); 1360 } 1361 1362 readRules(document.styleSheets[i].cssRules || document.styleSheets[i].rules || document.styleSheets[i].cssText); 1363 } catch (e) { 1364 } 1365 } 1366 1367 // findElementQueriesElements(); 1368 findResponsiveImages(); 1369 }; 1370 1371 /** 1372 * Go through all collected rules (readRules()) and attach the resize-listener. 1373 * Not necessary to call it manually, since we detect automatically when new elements 1374 * are available in the DOM. However, sometimes handy for dirty DOM modifications. 1375 * 1376 * @param {HTMLElement} container only elements of the container are considered (document.body if not set) 1377 */ 1378 this.findElementQueriesElements = function (container) { 1379 findElementQueriesElements(container); 1380 }; 1381 1382 this.update = function () { 1383 this.init(); 1384 }; 1385 }; 1386 1387 ElementQueries.update = function () {
1388 ElementQueries.instance.update(); 1389 }; 1390 1391 /** 1392 * Removes all sensor and elementquery information from the element. 1393 * 1394 * @param {HTMLElement} element 1395 */ 1396 ElementQueries.detach = function (element) { 1397 if (element.elementQueriesSetupInformation) { 1398 //element queries 1399 element.elementQueriesSensor.detach(); 1400 delete element.elementQueriesSetupInformation; 1401 delete element.elementQueriesSensor; 1402 1403 } else if (element.resizeSensor) { 1404 //responsive image 1405 1406 element.resizeSensor.detach(); 1407 delete element.resizeSensor; 1408 } 1409 }; 1410 1411 ElementQueries.init = function () { 1412 if (!ElementQueries.instance) { 1413 ElementQueries.instance = new ElementQueries(); 1414 } 1415 1416 ElementQueries.instance.init(); 1417 }; 1418 1419 var domLoaded = function (callback) { 1420 /* Mozilla, Chrome, Opera */ 1421 if (document.addEventListener) { 1422 document.addEventListener('DOMContentLoaded', callback, false); 1423 } 1424 /* Safari, iCab, Konqueror */ 1425 else if (/KHTML|WebKit|iCab/i.test(navigator.userAgent)) { 1426 var DOMLoadTimer = setInterval(function () { 1427 if (/loaded|complete/i.test(document.readyState)) { 1428 callback(); 1429 clearInterval(DOMLoadTimer); 1430 } 1431 }, 10); 1432 } 1433 /* Other web browsers */ 1434 else window.onload = callback; 1435 }; 1436 1437 ElementQueries.findElementQueriesElements = function (container) { 1438 ElementQueries.instance.findElementQueriesElements(container); 1439 }; 1440 1441 ElementQueries.listen = function () { 1442 domLoaded(ElementQueries.init); 1443 }; 1444 1445 return ElementQueries; 1446 1447})); 1448 1449////////////////////////////////////////////////////////////////////////// 1450// 1451// Init all scripts 1452// 1453////////////////////////////////////////////////////////////////////////// 1454 1455// This is bad but we don't have other access to this scope. 1456// Ajax Portfolio is defined as plugin and on success needs these to be reinited 1457// We'll refactor all of this. 1458window.ajaxInit = function() { 1459 mk_lightbox_init(); 1460 // mk_click_events(); 1461 // mk_social_share_global(); 1462 // mk_social_share(); 1463 mk_gallery(); 1464 loop_audio_init(); 1465}; 1466 1467window.ajaxDelayedInit = function() { 1468 mk_flexslider_init(); 1469 // mk_portfolio_ajax(); 1470}; 1471 1472$(document).ready(function() { 1473 mk_lightbox_init(); 1474 // mk_login_form(); 1475 mk_backgrounds_parallax(); 1476 mk_flexslider_init(); 1477 mk_event_countdown(); 1478 mk_skill_meter(); 1479 mk_milestone(); 1480 // mk_ajax_search(); 1481 // mk_hover_events(); 1482 // mk_portfolio_ajax(); 1483 // product_loop_add_cart(); 1484 // mk_social_share(); 1485 // mk_portfolio_widget(); 1486 mk_contact_form(); 1487 mk_blog_carousel(); 1488 // mk_header_searchform(); 1489 // mk_click_events(); 1490 // mk_text_typer(); 1491 mk_tab_slider_func(); 1492 1493 $(window).on('load', function() { 1494 // mk_unfold_footer(); 1495 // mk_tabs(); 1496 // mk_accordion_toggles_tooltip(); 1497 mk_gallery(); 1498 mk_theatre_responsive_calculator(); 1499 // mk_tabs_responsive(); 1500 // mk_start_tour_resize(); 1501 // mk_header_social_resize(); 1502 mk_page_section_social_video_bg(); 1503 loop_audio_init(); 1504 mk_one_page_scroller(); 1505 // mkPositionSidebar(); 1506 1507 setTimeout(function() { 1508 /* 1509 Somehow the values are not correctly updated for the screens 1510 and we need to put setTimeout to fix the issue 1511 */ 1512 mk_mobile_tablet_responsive_calculator(); 1513 }, 300); 1514 1515 console.log("ready for rock"); 1516 }); 1517 1518 1519 var onDebouncedResize = function() { 1520 mk_theatre_responsive_calculator(); 1521 mk_mobile_tablet_responsive_calculator(); 1522 // mk_tabs_responsive(); 1523 // mk_accordion_toggles_tooltip(); 1524 // mk_start_tour_resize(); 1525 // mk_header_social_resize(); 1526 1527 setTimeout(function() { 1528 // mk_unfold_footer(); 1529 }, 300); 1530 }; 1531 1532 var debounceResize = null; 1533 $(window).on("resize", function() { 1534 if( debounceResize !== null ) { clearTimeout( debounceResize ); } 1535 debounceResize = setTimeout( onDebouncedResize, 300 ); 1536 }); 1537 1538 var onDebouncedScroll = function() { 1539 mk_skill_meter(); 1540 //TODO: Ask to Bart how we can call javascript component 1541 //mk_charts(); 1542 mk_milestone(); 1543 }; 1544 1545 var debounceScroll = null; 1546 $(window).on("scroll", function() { 1547 if( debounceScroll !== null ) { clearTimeout( debounceScroll ); } 1548 debounceScroll = setTimeout( onDebouncedScroll, 100 ); 1549 }); 1550 1551 if (MK.utils.isMobile()) { 1552 $('body').addClass('no-transform'); 1553 } 1554 1555}); 1556 1557/* VC frontend editor */ 1558/* -------------------------------------------------------------------- */ 1559$(window).on("vc_reload",function () { 1560 mk_flexslider_init(); 1561 loop_audio_init(); 1562 mk_tab_slider_func();
1563 mk_event_countdown(); 1564 // videoLoadState(); 1565 mk_page_section_social_video_bg(); 1566 // mk_hover_events(); 1567 1568 setTimeout(function() { 1569 // mkPositionSidebar(); 1570 }, 200); 1571}); 1572 1573// Replace this if new event for remove found. 1574$( document ).on( 'click', '.vc_control-btn-delete', function() { 1575 $( window ).trigger( 'vc_reload' ); 1576} ); 1577 1578$( document ).on( 'sortupdate', '.ui-sortable', function() { 1579 $( window ).trigger( 'vc_reload' ); 1580} ); 1581 1582/* Typer */ 1583/* -------------------------------------------------------------------- */ 1584function mk_text_typer() { 1585 1586 "use strict"; 1587 1588 $('[data-typer-targets]').each(function() { 1589 var that = this; 1590 MK.core.loadDependencies([ MK.core.path.plugins + 'jquery.typed.js' ], function() { 1591 var $this = $(that), 1592 $first_string = [$this.text()], 1593 $rest_strings = $this.attr('data-typer-targets').split(','), 1594 $strings = $first_string.concat($rest_strings); 1595 1596 $this.text(''); 1597 1598 $this.typed({ 1599 strings: $strings, 1600 typeSpeed: 30, // typing speed 1601 backDelay: 1200, // pause before backspacing 1602 loop: true, // loop on or off (true or false) 1603 loopCount: false, // number of loops, false = infinite 1604 }); 1605 }); 1606 }); 1607} 1608 1609 1610 1611/* Tab Slider */ 1612/* -------------------------------------------------------------------- */ 1613 1614function mk_tab_slider_func() { 1615 1616 "use strict"; 1617 1618 $('.mk-tab-slider').each(function() { 1619 var that = this; 1620 1621 MK.core.loadDependencies([ MK.core.path.plugins + 'jquery.swiper.js' ], function() { 1622 var $this = $(that), 1623 id = $this.data('id'), 1624 $autoplayTime = $this.data('autoplay'), 1625 $content = $('.mk-slider-content'); 1626 1627 var mk_tab_slider = $this.swiper({ 1628 wrapperClass: 'mk-tab-slider-wrapper', 1629 slideClass: 'mk-tab-slider-item', 1630 calculateHeight: true, 1631 speed: 500, 1632 autoplay: $autoplayTime, 1633 onSlideChangeStart: function() { 1634 $('.mk-tab-slider-nav[data-id="' + id + '"]').find(".active").removeClass('active') 1635 $('.mk-tab-slider-nav[data-id="' + id + '"]').find("a").eq(mk_tab_slider.activeIndex).addClass('active') 1636 } 1637 }); 1638 1639 // Simple repaint for firefox issue (can't handle 100% height after plugin init) 1640 function repaintFirefox() { 1641 $content.css('display','block'); 1642 setTimeout(function() { 1643 mk_tab_slider.reInit(); 1644 $content.css('display','table'); 1645 },100); 1646 } 1647 1648 $('.mk-tab-slider-nav[data-id="' + id + '"]').find("a").first().addClass('active'); 1649 1650 $('.mk-tab-slider-nav[data-id="' + id + '"]').find("a").on('touchstart mousedown', function(e) { 1651 e.preventDefault() 1652 $('.mk-tab-slider-nav[data-id="' + id + '"]').find(".active").removeClass('active') 1653 $(this).addClass('active') 1654 mk_tab_slider.swipeTo($(this).index()) 1655 }); 1656 1657 $('.mk-tab-slider-nav[data-id="' + id + '"]').find("a").click(function(e) { 1658 e.preventDefault(); 1659 }); 1660 1661 repaintFirefox(); 1662 $(window).on('resize', repaintFirefox); 1663 }); 1664 1665 }); 1666 1667} 1668 1669 1670 1671/* Edge One Pager */ 1672/* -------------------------------------------------------------------- */ 1673function mk_one_page_scroller() { 1674 1675 "use strict"; 1676 1677 $('.mk-edge-one-pager').each(function() { 1678 var self = this; 1679 1680 MK.core.loadDependencies([ MK.core.path.plugins + 'jquery.fullpage.js' ], function() { 1681 1682 var $this = $(self), 1683 anchorArr = []; 1684 1685 $this.find('.section').each(function() { 1686 anchorArr.push($(this).attr('data-title')); 1687 }); 1688 1689 var scrollable = true; 1690 $this.find('.section').each(function() { 1691 var $section = $(this), 1692 $content = $section.find('.edge-slide-content'), 1693 sectionHeight = $section.height(),
1694 contentHeight = $content.innerHeight(); 1695 1696 if((contentHeight + 30) > $(window).height()) { 1697 scrollable = false; 1698 } 1699 }); 1700 1701 if(!scrollable){ 1702 $this.find('.section').each(function() { 1703 var $section = $(this); 1704 $section.addClass('active').css({ 1705 'padding-bottom': '50px' 1706 }); 1707 }); 1708 } 1709 1710 if(scrollable) { 1711 $this.fullpage({ 1712 verticalCentered: false, 1713 resize: true, 1714 slidesColor: ['#ccc', '#fff'], 1715 anchors: anchorArr, 1716 scrollingSpeed: 600, 1717 easing: 'easeInQuart', 1718 menu: false, 1719 navigation: true, 1720 navigationPosition: 'right', 1721 navigationTooltips: false, 1722 slidesNavigation: true, 1723 slidesNavPosition: 'bottom', 1724 loopBottom: false, 1725 loopTop: false, 1726 loopHorizontal: true, 1727 autoScrolling: true, 1728 scrollOverflow: false, 1729 css3: true, 1730 paddingTop: 0, 1731 paddingBottom: 0, 1732 normalScrollElements: '.mk-header, .mk-responsive-wrap', 1733 normalScrollElementTouchThreshold: 5, 1734 keyboardScrolling: true, 1735 touchSensitivity: 15, 1736 continuousVertical: false, 1737 animateAnchor: true, 1738 1739 onLeave: function(index, nextIndex, direction) { 1740 var currentSkin = $this.find('.one-pager-slide').eq(nextIndex - 1).attr('data-header-skin'); 1741 MK.utils.eventManager.publish( 'firstElSkinChange', currentSkin ); 1742 $('#fullPage-nav').removeClass('light-skin dark-skin').addClass(currentSkin + '-skin'); 1743 1744 }, 1745 afterRender: function() { 1746 1747 var $nav = $('#fullPage-nav'); 1748 1749 setTimeout(function() { 1750 var currentSkin = $this.find('.one-pager-slide').eq(0).attr('data-header-skin'); 1751 MK.utils.eventManager.publish( 'firstElSkinChange', currentSkin ); 1752 if($nav.length) $nav.removeClass('light-skin dark-skin').addClass(currentSkin + '-skin'); 1753 }, 300); 1754 1755 var $slide = $this.find('.section'), 1756 headerHeight = MK.val.offsetHeaderHeight(0), 1757 windowHeight = $(window).height(); 1758 1759 $slide.height(windowHeight - headerHeight); 1760 1761 if($nav.length) { 1762 $nav.css({ 1763 'top': 'calc(50% + ' + (headerHeight/2) + 'px)', 1764 'marginTop': 0 1765 }); 1766 1767 var style = $this.attr('data-pagination'); 1768 $nav.addClass('pagination-' + style); 1769 } 1770 1771 setTimeout(mk_one_pager_resposnive, 1000); 1772 }, 1773 afterResize: function() { 1774 var $slide = $this.find('.section'), 1775 headerHeight = MK.val.offsetHeaderHeight(0), 1776 windowHeight = $(window).height(); 1777 1778 $slide.height(windowHeight - headerHeight); 1779 1780 $('#fullPage-nav').css({ 1781 'top': 'calc(50% + ' + (headerHeight/2) + 'px)', 1782 'marginTop': 0 1783 }); 1784 1785 setTimeout(mk_one_pager_resposnive, 1000); 1786 console.log('Reposition pager content.'); 1787 }, 1788 }); 1789 } 1790 1791 // Linking to slides available for desktop and mobile scenarios 1792 function swipeTo(href, e) { 1793 href = '_' + href; // ensure a char before # 1794 if (!~href.indexOf('#')) return; 1795 var section = href.split('#')[1]; 1796 if (~anchorArr.indexOf(section)) { 1797 if (typeof e !== 'undefined') e.preventDefault(); 1798 if (scrollable) $.fn.fullpage.moveTo(section); 1799 else MK.utils.scrollToAnchor('[data-title="'+section+'"]'); 1800 } 1801 } 1802 1803 // onload 1804 var loc = window.location; 1805 if(loc.hash) swipeTo(loc.hash); 1806 1807 $(document).on('click', 'a', function(e) { 1808 var $link = $(e.currentTarget); 1809 swipeTo($link.attr('href'), e); 1810 }); 1811 }); 1812 }); 1813 1814 1815 1816} 1817 1818 1819function mk_one_pager_resposnive() { 1820 "use strict"; 1821 1822 $('.mk-edge-one-pager').each(function() { 1823 var $pager = $(this), 1824 headerHeight = MK.val.offsetHeaderHeight(0), 1825 windowHeight = $(window).height() - headerHeight; 1826 1827 $pager.find('.one-pager-slide').each(function() { 1828 var $slide = $(this), 1829 $content = $slide.find('.edge-slide-content'); 1830 1831 if ($slide.hasClass('left_center') || $slide.hasClass('center_center') || $slide.hasClass('right_center')) { 1832 var contentHeight = $content.height(), 1833 distanceFromTop = (windowHeight - contentHeight) / 2; 1834 1835 distanceFromTop = (distanceFromTop < 50) ? 50 + headerHeight : distanceFromTop; 1836 1837 $content.css('marginTop', distanceFromTop); 1838 } 1839 1840 if ($slide.hasClass('left_bottom') || $slide.hasClass('center_bottom') || $slide.hasClass('right_bottom')) { 1841 var distanceFromTop = windowHeight - $content.height() - 90; 1842 $content.css('marginTop', (distanceFromTop)); 1843 } 1844 }); 1845 1846 /** 1847 * Fix AM-2853 1848 * 1849 * @since 6.0.3 1850 * 1851 * At the init of Edge One Pager (EOP), EOP will render all image 1852 * background of each sections from top to bottom. In this case, 1853 * the page height will be more than screen height and the scroll 1854 * bar will appear. At the same time, the full width row will set 1855 * the container width into 100%. But, after all Slides are set up, 1856 * EOP height will be 100% of the screen height, so the scroll bar 1857 * will be disappeared. It's caused spacing issues on the left and 1858 * right side of the EOP container. To fix this, the row width 1859 * should be resized and row position should be readjusted. 1860 */ 1861 var $row = $pager.parents( '.vc_row.vc_row-fluid.mk-fullwidth-true' ); 1862 1863 // Run only if the Edge One Pager is wrapped inside full width row. 1864 if ( $row.length > 0 ) { 1865 // Set the wrapper and row width. 1866 var $wrapper = $( '.mk-main-wrapper-holder' ); 1867 var $grid = $row.children( '.mk-grid' ); 1868 var rowWidth = $row.width(); // Original width.
1869 var wrapperWidth = $wrapper.width(); // The new width. 1870 1871 // Run only if original width is smaller than the new width. 1872 if ( rowWidth >= wrapperWidth || $grid.length > 0 ) { 1873 return; 1874 } 1875 1876 // Get the content left offset. 1877 var $content = $wrapper.find( '.theme-content' ); 1878 var oriPos = $content.position(); 1879 var oriPadLeft = $content.css( 'padding-left' ); 1880 var oriLeft = parseInt( oriPos.left ) + parseInt( oriPadLeft ); 1881 1882 // Ensure the new width and left position is more than 0. 1883 if ( wrapperWidth <= 0 || oriLeft <= 0 ) { 1884 return; 1885 } 1886 1887 // Resize the width and left position of row full width. 1888 $row.css({ 1889 'width': wrapperWidth, 1890 'left': oriLeft * -1, 1891 }); 1892 } 1893 }); 1894} 1895 1896/* Image Gallery */ 1897/* -------------------------------------------------------------------- */ 1898 1899function mk_gallery() { 1900 1901 "use strict"; 1902 1903 $('.mk-gallery .mk-gallery-item.hover-overlay_layer .item-holder').each(function() { 1904 var itemHolder = $(this), 1905 galleryDesc = itemHolder.find('.gallery-desc'); 1906 1907 function updatePosition() { 1908 var parentHeight = itemHolder.outerHeight(), 1909 contentHeight = galleryDesc.innerHeight(); 1910 1911 var paddingVal = (parentHeight - contentHeight) / 2; 1912 galleryDesc.css({ 1913 'top': paddingVal, 1914 // 'padding-bottom': paddingVal 1915 }); 1916 1917 // console.log(parentHeight); 1918 // console.log(contentHeight); 1919 1920 1921 } 1922 updatePosition(); 1923 1924 $(window).on('resize', function() { 1925 setTimeout(function() { 1926 updatePosition(); 1927 }, 1000); 1928 }); 1929 }); 1930 // Execute hover state for mk gallery item 1931 if ($(window).width() <= 1024) { 1932 $('.mk-gallery .mk-gallery-item').on('click', function (e) { 1933 var clicks = $(this).data('clicks'); 1934 if (clicks) { 1935 // First click 1936 $(this).toggleClass('hover-state'); 1937 } else { 1938 // Second click 1939 $(this).toggleClass('hover-state'); 1940 } 1941 $(this).data("clicks", !clicks); 1942 }); 1943 } 1944} 1945 1946/* Theatre Slider Responsive Calculator */ 1947/* -------------------------------------------------------------------- */ 1948 1949function mk_theatre_responsive_calculator() { 1950 var $laptopContainer = $(".laptop-theatre-slider"); 1951 var $computerContainer = $(".desktop-theatre-slider"); 1952 $laptopContainer.each(function() { 1953 var $this = $(this), 1954 $window = $(window), 1955 $windowWidth = $window.outerWidth(), 1956 $windowHeight = $window.outerHeight(), 1957 $width = $this.outerWidth(), 1958 $height = $this.outerHeight(), 1959 $paddingTop = 38, 1960 $paddingRight = 143, 1961 $paddingBottom = 78, 1962 $paddingLeft = 143; 1963 1964 var $player = $this.find('.player-container'); 1965 1966 if ($windowWidth > $width) { 1967 $player.css({ 1968 'padding-left': parseInt(($width * $paddingLeft) / 1200), 1969 'padding-right': parseInt(($width * $paddingRight) / 1200), 1970 'padding-top': parseInt(($height * $paddingTop) / 690), 1971 'padding-bottom': parseInt(($height * $paddingBottom) / 690), 1972 }); 1973 } 1974 1975 }); 1976 1977 $computerContainer.each(function() { 1978 var $this = $(this), 1979 $window = $(window), 1980 $windowWidth = $window.outerWidth(), 1981 $windowHeight = $window.outerHeight(), 1982 $width = $this.outerWidth(), 1983 $height = $this.outerHeight(), 1984 $paddingTop = 60, 1985 $paddingRight = 52, 1986 $paddingBottom = 290, 1987 $paddingLeft = 49; 1988 1989 var $player = $this.find('.player-container'); 1990 1991 if ($windowWidth > $width) { 1992 $player.css({ 1993 'padding-left': parseInt(($width * $paddingLeft) / 1200), 1994 'padding-right': parseInt(($width * $paddingRight) / 1200), 1995 'padding-top': parseInt(($height * $paddingTop) / 969), 1996 'padding-bottom': parseInt(($height * $paddingBottom) / 969), 1997 }); 1998 } 1999 2000 }); 2001 2002} 2003 2004/* Mobile and Tablet Slideshow Responsive Calculator */ 2005/* -------------------------------------------------------------------- */ 2006function mk_mobile_tablet_responsive_calculator() { 2007 var $laptopSlideshow = $(".mk-laptop-slideshow-shortcode"); 2008 var $lcdSlideshow = $(".mk-lcd-slideshow"); 2009 2010 if ($.exists(".mk-laptop-slideshow-shortcode")) { 2011 $laptopSlideshow.each(function() { 2012 var $this = $(this), 2013 $window = $(window), 2014 $windowWidth = $window.outerWidth(), 2015 $windowHeight = $window.outerHeight(), 2016 $width = $this.outerWidth(), 2017 $height = $this.outerHeight(), 2018 $paddingTop = 28, 2019 $paddingRight = 102, 2020 $paddingBottom = 52, 2021 $paddingLeft = 102; 2022 2023 var $player = $this.find(".slideshow-container"); 2024 2025 $player.css({ 2026 "padding-left": parseInt(($width * $paddingLeft) / 836), 2027 "padding-right": parseInt(($width * $paddingRight) / 836), 2028 "padding-top": parseInt(($height * $paddingTop) / 481), 2029 "padding-bottom": parseInt(($height * $paddingBottom) / 481), 2030 }); 2031 2032 }); 2033 } 2034 2035 if ($.exists(".mk-lcd-slideshow")) {
2036 $lcdSlideshow.each(function() { 2037 var $this = $(this), 2038 $window = $(window), 2039 $windowWidth = $window.outerWidth(), 2040 $windowHeight = $window.outerHeight(), 2041 $width = $this.outerWidth(), 2042 $height = $this.outerHeight(), 2043 $paddingTop = 35, 2044 $paddingRight = 39, 2045 $paddingBottom = 213, 2046 $paddingLeft = 36; 2047 2048 var $player = $this.find(".slideshow-container"); 2049 $player.css({ 2050 "padding-left": parseInt(($width * $paddingLeft) / 886), 2051 "padding-right": parseInt(($width * $paddingRight) / 886), 2052 "padding-top": parseInt(($height * $paddingTop) / 713), 2053 "padding-bottom": parseInt(($height * $paddingBottom) / 713), 2054 }); 2055 }); 2056 } 2057} 2058 2059 2060/* Start a tour resize function */ 2061/* -------------------------------------------------------------------- */ 2062function mk_start_tour_resize() { 2063 2064 $('.mk-header-start-tour').each(function() { 2065 2066 var $windowWidth = $(document).width(), 2067 $this = $(this), 2068 $linkWidth = $this.width() + 15, 2069 $padding = ($windowWidth - mk_responsive_nav_width) / 2; 2070 2071 2072 2073 function updateStartTour(){ 2074 if($windowWidth < mk_responsive_nav_width){ 2075 $this.removeClass('hidden'); 2076 $this.addClass('show'); 2077 }else{ 2078 if($padding < $linkWidth){ 2079 $this.removeClass('show'); 2080 $this.addClass('hidden'); 2081 }else{ 2082 $this.removeClass('hidden'); 2083 $this.addClass('show'); 2084 } 2085 } 2086 } 2087 2088 setTimeout(function() { 2089 updateStartTour(); 2090 }, 300); 2091 }); 2092} 2093 2094/* Header social resize function */ 2095/* -------------------------------------------------------------------- */ 2096function mk_header_social_resize() { 2097 2098 $('.mk-header-social.header-section').each(function() { 2099 2100 var $windowWidth = $(document).width(), 2101 $this = $(this), 2102 $linkWidth = $this.width() + 15, 2103 $padding = ($windowWidth - mk_responsive_nav_width) / 2; 2104 2105 2106 2107 function updateStartTour(){ 2108 if($windowWidth < mk_responsive_nav_width){ 2109 $this.removeClass('hidden'); 2110 $this.addClass('show'); 2111 }else{ 2112 if($padding < $linkWidth){ 2113 $this.removeClass('show'); 2114 $this.addClass('hidden'); 2115 }else{ 2116 $this.removeClass('hidden'); 2117 $this.addClass('show'); 2118 } 2119 } 2120 } 2121 2122 setTimeout(function() { 2123 updateStartTour(); 2124 }, 300); 2125 }); 2126} 2127 2128/* Page Section Socail Video Player Controls */ 2129/* -------------------------------------------------------------------- */ 2130 2131function mk_page_section_social_video_bg() { 2132 $(".mk-page-section.social-hosted").each(function() { 2133 var $container = $(this), 2134 $sound = $container.data('sound'), 2135 $source = $container.data('source'), 2136 player, 2137 timer = 1000; 2138 2139 if ( $( 'body' ).hasClass( '.compose-mode' ) ) { 2140 timer = 2000; 2141 } 2142 2143 if ($source == 'youtube') { 2144 var youtube = $container.find('iframe')[0]; 2145 try { 2146 player = new YT.Player(youtube, { 2147 events: { 2148 'onReady': function () { 2149 player.playVideo(); 2150 if($sound == false) { 2151 player.mute(); 2152 } 2153 } 2154 } 2155 }); 2156 2157 2158 } catch (e) { 2159 console.log( e ); 2160 } 2161 } 2162 if ($source == 'vimeo') { 2163 var vimeo = $container.find('iframe')[0]; 2164 player = $f(vimeo); 2165 setTimeout(function() { 2166 player.api('play'); 2167 if($sound === false) {
2168 player.api('setVolume', 0); 2169 } 2170 }, timer); 2171 } 2172 2173 }); 2174} 2175 2176// Pre RequireJS hot bug fixing 2177 2178function videoLoadState() { 2179 $('.mk-section-video video').each(function() { 2180 var mkVideo = this; 2181 2182 mkVideo.play(); 2183 this.onload = fire(); 2184 2185 function fire() { 2186 setTimeout(function() { 2187 $(mkVideo).animate({ 2188 'opacity': 1 2189 }, 300); 2190 }, 1000); 2191 } 2192 }); 2193} 2194videoLoadState(); 2195 2196 2197// Gmap Widget 2198(function($) { 2199 2200 $(window).on('load vc_reload', initialize); 2201 2202 function initialize() { 2203 var $gmap = $('.gmap_widget'); 2204 if($gmap.length && typeof google !== 'undefined') $gmap.each(run); 2205 } 2206 2207 function run() { 2208 var $mapHolder = $(this); 2209 var myLatlng = new google.maps.LatLng($mapHolder.data('latitude'), $mapHolder.data('longitude')); 2210 var mapOptions = $mapHolder.data('options'); 2211 mapOptions.mapTypeId = google.maps.MapTypeId.ROADMAP; 2212 mapOptions.center = myLatlng; 2213 var map = new google.maps.Map(this, mapOptions); 2214 2215 new google.maps.Marker({ 2216 position: myLatlng, 2217 map: map 2218 }); 2219 } 2220 2221}(jQuery)); 2222 2223// Instagram Widget 2224(function($) { 2225 2226 $(window).on('load', function() { 2227 var $feeds = $('.mk-instagram-feeds'); 2228 if($feeds.length) $feeds.each(run); 2229 }); 2230 2231 function run() { 2232 var options = $(this).data('options'); 2233 options.template = '<a class="featured-image '+options.tmp_col+'-columns" href="{{link}}" target="_'+options.tmp_target+'"><div class="item-holder"><img src="{{image}}" /><div class="image-hover-overlay"></div></div></a>'; 2234 var feed = new Instafeed(options); 2235 feed.run(); 2236 } 2237}(jQuery)); 2238 2239 2240// Flipbox backface visibility fix for chrome 2241(function($) { 2242 $(window).on('load', function() { 2243 setTimeout( function() { 2244 $('.chrome-flipbox-backface-fix').removeClass('chrome-flipbox-backface-fix'); 2245 }, 300); 2246 }); 2247}(jQuery)); 2248 2249 2250/* Product in VC Tab Bug Fix 2251/* -------------------------------------------------------------------- */ 2252(function($) { 2253 $(window).on('load', function() { 2254 $('.vc_tta-tab a').on('click', function() { 2255 setTimeout( function() { 2256 $(window).trigger('resize'); 2257 }, 100); 2258 }); 2259 }); 2260}(jQuery)); 2261 2262 2263/* Vertical menu fix when childrens exceed screen height 2264/* -------------------------------------------------------------------- */ 2265(function($) { 2266 $(window).on('load', function() { 2267 $('#mk-vm-menu .menu-item-has-children, #mk-vm-menu .mk-vm-back').on('mouseenter', function() { 2268 var $header_inner = $(this).closest('.mk-header-inner'), 2269 $header_inner_height = $header_inner.outerHeight(), 2270 $header_bg = $header_inner.find('.mk-header-bg'), 2271 total_height = 0; 2272 $header_bg.css('height', '100%'); 2273 setTimeout( function() { 2274 $header_inner.children(':visible').each(function() { 2275 total_height += $(this).outerHeight(true); 2276 }); 2277 total_height -= $header_bg.height(); 2278 if ( total_height < $header_inner_height ) { 2279 $header_bg.css('height', '100%'); 2280 } else { 2281 $header_bg.css('height', total_height + 'px'); 2282 } 2283 }, 600); 2284 }); 2285 }); 2286}(jQuery)); 2287 2288 2289/* Woocommerce varitions lightbox fix 2290/* -------------------------------------------------------------------- */ 2291(function($) { 2292 $(window).on('load', function() { 2293 2294 var $variations_form = $('.variations_form'); 2295 2296 if ( $variations_form.length ) { 2297 2298 var $varitions_selects = $variations_form.find('.variations').find('.value').find('select'); 2299 $varitions_selects.on('change', function() { 2300 2301 // Woocommerce variations lightbox with galleries 2302 var $all_img_container = $('.mk-product-image .mk-woocommerce-main-image'); 2303 if ( $all_img_container.length ) { 2304 $( $all_img_container ).each( set_lightbox_href ); 2305 } 2306 2307 }); 2308 $varitions_selects.trigger('change'); 2309 2310 } 2311 2312 }); 2313 2314 function set_lightbox_href() { 2315 2316 var $product_img = $( this ).find( 'img' ), 2317 $lightbox = $( this ).find( '.mk-lightbox' ); 2318 2319 setTimeout( function() { 2320 var image_url = $product_img.attr( 'src' ), 2321 image_suffix = image_url.substr( image_url.lastIndexOf('.') - image_url.length ), // Get image suffix 2322 image_url = image_url.slice( 0 , image_url.lastIndexOf('-') ); // Remove image size 2323 $lightbox.attr('href', image_url + image_suffix ); 2324 }, 300); 2325 } 2326 2327}(jQuery)); 2328 2329 2330/* Remove video section when on mobile */ 2331/* -------------------------------------------------------------------- */
2332if( typeof MK.utils.showBackgroundVideo !== 'undefined' && ! MK.utils.showBackgroundVideo ) { 2333 (function($) { 2334 if ( MK.utils.isMobile() ) { 2335 $('.mk-section-video video').remove(); 2336 $('.mk-section-video').addClass('mk-section-video-disable'); 2337 } 2338 }(jQuery)); 2339} 2340 2341 2342/* Yith AJAX Product Filter & Yith Infinite Scrolling Plugin Fix 2343/* -------------------------------------------------------------------- */ 2344(function($) { 2345 $(window).on('load', function() { 2346 2347 $(document).on( 'yith-wcan-ajax-filtered yith_infs_added_elem yith-wcan-ajax-reset-filtered', function(){ 2348 setTimeout( function() { 2349 MK.utils.eventManager.publish('ajaxLoaded'); 2350 MK.core.initAll( document ); 2351 }, 1000 ); 2352 }); 2353 2354 // Fixed YITH Filter plugin causes issue for dropdown sort 2355 $(document).on( 'yith-wcan-ajax-filtered yith-wcan-ajax-reset-filtered', function(){ 2356 setTimeout( function() { 2357 $( '.woocommerce-ordering' ).on( 'change', 'select.orderby', function() { 2358 $( this ).closest( 'form' ).submit(); 2359 }); 2360 }, 1000 ); 2361 }); 2362 2363 }); 2364}(jQuery)); 2365 2366 2367/* Toggle loading state in URL for anchor links. 2368 * - Add a filter to escape meta-chars from hash string. 2369/* -------------------------------------------------------------------- */ 2370!function(e){var a=window.location,n=a.hash;if(n.length&&n.substring(1).length){var hSuf = n.substring(1).replace(/[!"#$%&'()*+,./:;<=>?@[\]^`{|}~]/g, "\\$&");var r=e(".vc_row, .mk-main-wrapper-holder, .mk-page-section, #comments"),t=r.filter("#"+hSuf);if(!t.length)return;n=n.replace("!loading","");var i=n+"!loading";a.hash=i}}(jQuery); 2371 2372 2373/* Determine the top spacing of sidebar for full-width page section & row. 2374/* -------------------------------------------------------------------- */ 2375function mkPositionSidebar() { 2376 2377 var themeContent = $( '.theme-content' ), 2378 lastFullWidthChild = themeContent.find( '.vc_row-full-width' ).last(), 2379 top, 2380 sidebar = $( '#theme-page > .mk-main-wrapper-holder > .theme-page-wrapper > #mk-sidebar' ); 2381 2382 if ( ! lastFullWidthChild.length ) { 2383 sidebar.removeAttr( 'style' ); 2384 return; 2385 } 2386 2387 top = lastFullWidthChild.offset().top - themeContent.offset().top; 2388 sidebar.css( 'padding-top', top ); 2389} 2390 2391(function($) { 2392 'use strict'; 2393 2394 $.exists = function(selector) { 2395 return ($(selector).length > 0); 2396 }; 2397 2398 /** 2399 * Helper to enable caching async scripts 2400 * https://api.jquery.com/jquery.getscript/ 2401 * http://www.vrdmn.com/2013/07/overriding-jquerygetscript-to-include.html 2402 * 2403 * @param {String} script url 2404 * @param {Function} callback 2405 */ 2406 $.getCachedScript = function( url ) { 2407 var options = { 2408 dataType: "script", 2409 cache: true, 2410 url: url 2411 }; 2412 2413 // Use $.ajax() since it is more flexible than $.getScript 2414 // Return the jqXHR object so we can chain callbacks 2415 return $.ajax( options ); 2416 }; 2417 2418 2419 2420 // Fn to allow an event to fire after all images are loaded 2421 // usage: 2422 // $.ajax({ 2423 // cache: false, 2424 // url: 'ajax/content.php', 2425 // success: function(data) { 2426 // $('#divajax').html(data).imagesLoaded().then(function(){ 2427 // // do stuff after images are loaded here 2428 // }); 2429 // } 2430 // }); 2431 $.fn.mk_imagesLoaded = function () { 2432 2433 // Edit: in strict mode, the var keyword is needed 2434 var $imgs = this.find('img[src!=""]'); 2435 // if there's no images, just return an already resolved promise 2436 if (!$imgs.length) {return $.Deferred().resolve().promise();} 2437 2438 // for each image, add a deferred object to the array which resolves when the image is loaded (or if loading fails) 2439 var dfds = []; 2440 $imgs.each(function(){ 2441 var dfd = $.Deferred(); 2442 dfds.push(dfd); 2443 var img = new Image(); 2444 img.onload = function(){dfd.resolve();}; 2445 img.onerror = function(){dfd.resolve();}; 2446 img.src = this.src; 2447 }); 2448 2449 // return a master promise object which will resolve when all the deferred objects have resolved 2450 // IE - when all the images are loaded 2451 return $.when.apply($,dfds); 2452 2453 }; 2454 2455}(jQuery)); 2456/** 2457* Detect Element Resize 2458* 2459* https://github.com/sdecima/javascript-detect-element-resize 2460* Sebastian Decima 2461* 2462* version: 0.5.3 2463**/ 2464 2465(function () { 2466 var attachEvent = document.attachEvent, 2467 stylesCreated = false;
2468 2469 if (!attachEvent) { 2470 var requestFrame = (function(){ 2471 var raf = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || 2472 function(fn){ return window.setTimeout(fn, 20); }; 2473 return function(fn){ return raf(fn); }; 2474 })(); 2475 2476 var cancelFrame = (function(){ 2477 var cancel = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || 2478 window.clearTimeout; 2479 return function(id){ return cancel(id); }; 2480 })(); 2481 2482 /* Detect CSS Animations support to detect element display/re-attach */ 2483 var animation = false, 2484 animationstring = 'animation', 2485 keyframeprefix = '', 2486 animationstartevent = 'animationstart', 2487 domPrefixes = 'Webkit Moz O ms'.split(' '), 2488 startEvents = 'webkitAnimationStart animationstart oAnimationStart MSAnimationStart'.split(' '), 2489 pfx = ''; 2490 { 2491 var elm = document.createElement('fakeelement'); 2492 if( elm.style.animationName !== undefined ) { animation = true; } 2493 2494 if( animation === false ) { 2495 for( var i = 0; i < domPrefixes.length; i++ ) { 2496 if( elm.style[ domPrefixes[i] + 'AnimationName' ] !== undefined ) { 2497 pfx = domPrefixes[ i ]; 2498 animationstring = pfx + 'Animation'; 2499 keyframeprefix = '-' + pfx.toLowerCase() + '-'; 2500 animationstartevent = startEvents[ i ]; 2501 animation = true; 2502 break; 2503 } 2504 } 2505 } 2506 } 2507 2508 var animationName = 'resizeanim'; 2509 var animationKeyframes = '@' + keyframeprefix + 'keyframes ' + animationName + ' { from { opacity: 0; } to { opacity: 0; } } '; 2510 var animationStyle = keyframeprefix + 'animation: 1ms ' + animationName + '; '; 2511 } 2512 2513 function createStyles() { 2514 if (!stylesCreated) { 2515 //opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360 2516 var css = (animationKeyframes ? animationKeyframes : '') + 2517 '.resize-triggers { ' + (animationStyle ? animationStyle : '') + 'visibility: hidden; opacity: 0; } ' + 2518 '.resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }', 2519 head = document.head || document.getElementsByTagName('head')[0], 2520 style = document.createElement('style'); 2521 2522 style.type = 'text/css'; 2523 if (style.styleSheet) { 2524 style.styleSheet.cssText = css; 2525 } else { 2526 style.appendChild(document.createTextNode(css)); 2527 } 2528 2529 head.appendChild(style); 2530 stylesCreated = true; 2531 } 2532 } 2533 2534 window.addResizeListener = function(element, fn){ 2535 2536 function resetTriggers(element){ 2537 var triggers = element.__resizeTriggers__, 2538 expand = triggers.firstElementChild, 2539 contract = triggers.lastElementChild, 2540 expandChild = expand.firstElementChild; 2541 contract.scrollLeft = contract.scrollWidth; 2542 contract.scrollTop = contract.scrollHeight; 2543 expandChild.style.width = expand.offsetWidth + 1 + 'px'; 2544 expandChild.style.height = expand.offsetHeight + 1 + 'px'; 2545 expand.scrollLeft = expand.scrollWidth; 2546 expand.scrollTop = expand.scrollHeight; 2547 }; 2548 2549 function checkTriggers(element){ 2550 return element.offsetWidth != element.__resizeLast__.width || 2551 element.offsetHeight != element.__resizeLast__.height; 2552 } 2553 2554 function scrollListener(e){ 2555 var element = this; 2556 resetTriggers(this); 2557 if (this.__resizeRAF__) cancelFrame(this.__resizeRAF__); 2558 this.__resizeRAF__ = requestFrame(function(){ 2559 if (checkTriggers(element)) { 2560 element.__resizeLast__.width = element.offsetWidth; 2561 element.__resizeLast__.height = element.offsetHeight; 2562 element.__resizeListeners__.forEach(function(fn){ 2563 fn.call(element, e); 2564 }); 2565 } 2566 }); 2567 }; 2568 2569 if (!element) {return} 2570 2571 if (attachEvent) element.attachEvent('onresize', fn); 2572 else { 2573 if (!element.__resizeTriggers__) { 2574 if (getComputedStyle(element).position == 'static') element.style.position = 'relative'; 2575 createStyles(); 2576 element.__resizeLast__ = {}; 2577 element.__resizeListeners__ = []; 2578 (element.__resizeTriggers__ = document.createElement('div')).className = 'resize-triggers'; 2579 element.__resizeTriggers__.innerHTML = '<div class="expand-trigger"><div></div></div>' + 2580 '<div class="contract-trigger"></div>'; 2581 element.appendChild(element.__resizeTriggers__); 2582 resetTriggers(element); 2583 element.addEventListener('scroll', scrollListener, true); 2584 2585 /* Listen for a css animation to detect element display/re-attach */ 2586 animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function(e) { 2587 if(e.animationName == animationName) 2588 resetTriggers(element); 2589 }); 2590 } 2591 element.__resizeListeners__.push(fn); 2592 } 2593 }; 2594 2595 window.removeResizeListener = function(element, fn){ 2596 if (attachEvent) element.detachEvent('onresize', fn); 2597 else { 2598 element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1); 2599 if (!element.__resizeListeners__.length) { 2600 element.removeEventListener('scroll', scrollListener); 2601 element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__); 2602 } 2603 } 2604 } 2605})(); 2606 2607(function($) { 2608 'use strict'; 2609 2610 var MK = window.MK || {}; 2611 2612 /** 2613 * MK.val is collection of Lambdas responsible for returning up to date values of method type like scrollY or el offset. 2614 * The Lambda is responsible for keeping track of value of a particular property, usually takes as argument an object 2615 * (or DOM reference) and internally creates and updates data that is returned as primitive value - through variable reference. 2616 * 2617 * Benefits of this approach: 2618 * - reduced DOM reads 2619 * - auto-updating values without need for additional logic where methods are called 2620 * - updating values when needed to be updated not read 2621 * 2622 * Downsides: 2623 * - Memory overhead with closures and keeping state in memory ( still beter than read state from DOM, but use wisely - 2624 * do not use it when you really need static value on runtime ) 2625 */ 2626 MK.val = {}; 2627 2628 /** 2629 * Current window offsetY position 2630 * 2631 * @uses MK.val.scroll() 2632 * @return {number} 2633 */ 2634 MK.val.scroll = (function() { 2635 var offset = 0, 2636 $window = $(window), 2637 hasPageYOffset = (window.pageYOffset !== undefined), 2638 body = (document.documentElement || document.body.parentNode || document.body); // cross browser handling 2639 2640 var update = function() { 2641 offset = hasPageYOffset ? window.pageYOffset : body.scrollTop; 2642 }; 2643 2644 var rAF = function() { 2645 window.requestAnimationFrame(update); 2646 }; 2647 2648 update(); 2649 $window.on('load', update); 2650 $window.on('resize', update); 2651 $window.on('scroll', rAF); 2652 2653 return function() { 2654 return offset; 2655 }; 2656 })(); 2657 2658 2659 /** 2660 * Changes number of percent to pixels based on viewport height 2661 * 2662 * @uses MK.val.viewportPercentHeight({percent val}) 2663 * @param {number} 2664 * @return {number} 2665 */ 2666 MK.val.viewportPercentHeight = function(percent) { 2667 return $(window).height() * (percent / 100); 2668 }; 2669 2670 2671 /** 2672 * Wordpress adminbar height based on wp media queries 2673 * @return {Number} 2674 */ 2675 MK.val.adminbarHeight = function() { 2676 if (php.hasAdminbar) { 2677 // apply WP native media-query and sizes 2678 return (window.matchMedia('( max-width: 782px )').matches) ? 46 : 32; 2679 } else { 2680 return 0; 2681 } 2682 }; 2683 2684 2685 /** 2686 * Offset when header becomes sticky. Evaluates viewport % and header height to pixels for according options 2687 * @return {Number} 2688 */ 2689 MK.val.stickyOffset = (function() { 2690 var $header = $('.mk-header').not('.js-header-shortcode').first(); 2691 2692 // We need to have returning function even when header is disabled 2693 if (!$header.length) { 2694 return function() { 2695 return 0; 2696 }; 2697 } 2698 2699 2700 2701 var $toolbar = $header.find('.mk-header-toolbar'), 2702 config = $header.data(), 2703 hasToolbar = $toolbar.length, 2704 toolbarHeight = (hasToolbar) ? $toolbar.height() : 0, 2705 isVertical = (config.headerStyle === 4), 2706 headerHeight = (isVertical) ? 0 : config.height; 2707 2708 var type = ((typeof config.stickyOffset === 'number') ? 'number' : false) || 2709 ((config.stickyOffset === 'header') ? 'header' : false) || 2710 'percent'; 2711 2712 var stickyOffset = 0; 2713 var setOffset = function() { 2714 2715 //we calculate toolbar height for When the device is changed Size 2716 //Toolbar height in responsive state is 0 2717 toolbarHeight = (hasToolbar) ? $toolbar.height() : 0; 2718 2719 if (MK.utils.isResponsiveMenuState()) { 2720 headerHeight = config.responsiveHeight; 2721 2722 if (hasToolbar) { 2723 if ($toolbar.is(':hidden')) { 2724 toolbarHeight = 0; 2725 } 2726 } 2727 } 2728 2729 if (type === 'number') { 2730 stickyOffset = config.stickyOffset; 2731 } else if (type === 'header') { 2732 2733 stickyOffset = headerHeight + toolbarHeight + MK.val.adminbarHeight(); // add all header components here, make them 0 if needed 2734 2735 } else if (type === 'percent') { 2736 stickyOffset = MK.val.viewportPercentHeight(parseInt(config.stickyOffset)); 2737 } 2738 }; 2739 2740 setOffset(); 2741 $(window).on('resize', setOffset); 2742 2743 return function() { 2744 return stickyOffset; 2745 }; 2746 }()); 2747 2748 2749 2750 /** 2751 * Gets header height on particular offsetY position. Use to determine logic for fullHeight, smooth scroll etc. 2752 * Takes one parameter which is offset position we're interested in. 2753 * 2754 * @uses MK.val.offsetHeaderHeight({offset val}) 2755 * @param {number} 2756 * @return {number} 2757 */ 2758 MK.val.offsetHeaderHeight = (function() { // Closure avoids multiple DOM reads. We need to fetch header config only once. 2759 var $header = $('.mk-header').not('.js-header-shortcode').first(); 2760 2761 // We need to have returning function even when header is disabled 2762 if (!$header.length) { 2763 return function() { 2764 return 0; 2765 }; 2766 } 2767 2768 var $toolbar = $header.find('.mk-header-toolbar'), 2769 config = $header.data(), 2770 stickyHeight = config.stickyHeight, 2771 desktopHeight = config.height, 2772 mobileHeight = config.responsiveHeight, 2773 isTransparent = $header.hasClass('transparent-header'), 2774 isSticky = config.stickyStyle.length, 2775 isStickyLazy = config.stickyStyle === 'lazy', 2776 isVertical = config.headerStyle === 4, 2777 hasToolbar = $toolbar.length, 2778 toolbarHeight = hasToolbar ? $toolbar.height() : 0, 2779 bufor = 5; 2780 2781 /**
2782 * The sticky section of header style 2 has fixed height. 2783 * The stickey height option does not affect this header style. 2784 */ 2785 if ( config.headerStyle === 2 ) { 2786 stickyHeight = $header.find( '.mk-header-nav-container' ).outerHeight(); 2787 } 2788 2789 // if header has border bottom we can calculate that (for responsive state) 2790 var $innerHeader = $header.find('.mk-header-inner'); 2791 var hasInnerHeader = $innerHeader.length; 2792 2793 var headerHeight = function(offset) { 2794 2795 toolbarHeight = hasToolbar ? $toolbar.height() : 0 2796 var stickyOffset = MK.val.stickyOffset(); 2797 2798 2799 if (MK.utils.isResponsiveMenuState()) { // Header avaible only on top for mobile 2800 2801 if (hasToolbar && $toolbar.is(':hidden')) { 2802 toolbarHeight = 0; 2803 } 2804 2805 //in responsive state , .mk-header-holder position's changed to "relative" 2806 //and header's border affected to offset,so borders must be calculated 2807 var headerBorder = 0; 2808 headerBorder = parseInt($innerHeader.css('border-bottom-width')); 2809 2810 var totalHeight = mobileHeight + MK.val.adminbarHeight() + toolbarHeight + headerBorder; 2811 2812 if (offset <= totalHeight) return totalHeight; 2813 else return MK.val.adminbarHeight(); 2814 } else { 2815 if (offset <= stickyOffset) { 2816 if (isVertical) { 2817 if (hasToolbar) { 2818 return toolbarHeight + MK.val.adminbarHeight(); 2819 } else { 2820 return MK.val.adminbarHeight(); 2821 } 2822 } else if (isTransparent) { 2823 return MK.val.adminbarHeight(); 2824 } else { 2825 return desktopHeight + toolbarHeight + MK.val.adminbarHeight(); 2826 } // For any other return regular desktop height 2827 } else if (offset > stickyOffset) { 2828 if (isVertical) { 2829 return MK.val.adminbarHeight(); 2830 } else if (!isSticky) { 2831 return MK.val.adminbarHeight(); 2832 } else if (isStickyLazy) { 2833 return MK.val.adminbarHeight(); 2834 } else if (isSticky) { 2835 return stickyHeight + MK.val.adminbarHeight(); 2836 } 2837 } 2838 } 2839 // default to 0 to prevent errors ( need to return number ) 2840 // Anyway make sure all scenarios are covered in IFs 2841 return 0; 2842 }; 2843 2844 return function(offset) { 2845 return headerHeight(offset - MK.val.adminbarHeight()); 2846 }; 2847 })(); 2848 2849 2850 /** 2851 * Gets current offset of given element (passed as object or DOM reference) from top or bottom (default to top) 2852 * of screen with possible threshold (default to 0) 2853 * 2854 * @uses MK.val.dynamicOffset({obj reference}, {'top'|'bottom'}, {threshold val}) 2855 * @param {string|object} 2856 * @param {string} 2857 * @param {number} 2858 * @return {number} 2859 */ 2860 MK.val.dynamicOffset = function(el, position, threshold) { 2861 var $window = $(window), 2862 $el = $(el), 2863 pos = position || 'top', 2864 thr = threshold || 0, 2865 container = $('.jupiterx-site')[0], 2866 currentPos = 0; 2867 2868 var offset = 0, 2869 winH = 0, 2870 rect = 0, 2871 x = 0; 2872 2873 var update = function() { 2874 winH = $window.height(); 2875 rect = $el[0].getBoundingClientRect(); 2876 offset = (rect.top + MK.val.scroll()); 2877 x = (pos === 'top') ? MK.val.offsetHeaderHeight(offset) : winH + (rect.height - thr); 2878 currentPos = offset - x - 1; 2879 }; 2880 2881 update(); 2882 $window.on('load', update); 2883 $window.on('resize', update); 2884 window.addResizeListener(container, update); 2885 2886 return function() { 2887 return currentPos; 2888 }; 2889 }; 2890 2891 /** 2892 * Gets current height of given element (passed as object or DOM reference) 2893 * 2894 * @uses MK.val.dynamicHeight({obj reference}) 2895 * @param {string|object} 2896 * @return {number} 2897 */ 2898 MK.val.dynamicHeight = function(el) { 2899 var $window = $(window), 2900 $el = $(el), 2901 container = $('.jupiterx-site')[0], 2902 currentHeight = 0; 2903 2904 var update = function() { 2905 currentHeight = $el.outerHeight(); 2906 }; 2907 2908 update(); 2909 $window.on('load', update); 2910 $window.on('resize', update); 2911 window.addResizeListener(container, update); 2912 2913 return function() { 2914 return currentHeight; 2915 }; 2916 }; 2917 2918})(jQuery); 2919 2920(function($) { 2921 'use strict'; 2922 2923 var Accordion = function(el) { 2924 // Private 2925 var that = this, 2926 $el = $(el), 2927 initial = $el.data('initialindex'), 2928 timeout; 2929 2930 // Public 2931 this.$el = $el; 2932 this.$single = $('.' + this.dom.single, $el); 2933 this.isExpendable = ($el.data('style') === 'toggle-action'); 2934 2935 // Init 2936 this.bindClicks(); 2937 // Reveal initial tab on load event (wait for possible images inside) 2938 $(window).on('load', function() {
2939 if( initial !== -1 ) that.show(that.$single.eq(initial), true) 2940 }); 2941 $(window).on('resize', function() { 2942 clearTimeout(timeout); 2943 timeout = setTimeout(that.bindClicks.bind(that), 500); 2944 }); 2945 } 2946 2947 Accordion.prototype.dom = { 2948 // only class names please! 2949 single : 'mk-accordion-single', 2950 tab : 'mk-accordion-tab', 2951 pane : 'mk-accordion-pane', 2952 current : 'current', 2953 mobileToggle : 'mobile-false', 2954 mobileBreakPoint : 767 2955 } 2956 2957 Accordion.prototype.bindClicks = function() { 2958 // Prevent multiple events binding 2959 this.$single.off('click', '.' + this.dom.tab); 2960 2961 if( !(window.matchMedia('(max-width: ' + this.dom.mobileBreakPoint +'px)').matches 2962 && this.$el.hasClass(this.dom.mobileToggle)) ) { 2963 2964 this.$single.on('click', '.' + this.dom.tab, this.handleEvent.bind(this)); 2965 // When website is loaded in mobile view and resized to desktop 'current' will 2966 // inherit display: none from css. Repair it by calling show() on this element 2967 var $current = $('.' + this.dom.current, this.$el); 2968 if($('.' + this.dom.pane, $current).css('display') === 'none') this.show($current); 2969 } 2970 } 2971 2972 Accordion.prototype.handleEvent = function(e) { 2973 e.preventDefault(); 2974 e.stopPropagation(); 2975 2976 var $single = $(e.delegateTarget); 2977 2978 if(!$single.hasClass(this.dom.current)) { 2979 this.show($single); 2980 } 2981 else { 2982 if(this.isExpendable) this.hide($single); 2983 } 2984 } 2985 2986 Accordion.prototype.hide = function($single) { 2987 $single.removeClass(this.dom.current);
2988 $('.' + this.dom.pane, $single).slideUp(); 2989 } 2990 2991 Accordion.prototype.show = function($single, initial) { 2992 // hide currently opened tab 2993 if(!this.isExpendable) { 2994 var that = this; 2995 this.hide($('.' + this.dom.current, that.$el)); 2996 } 2997 2998 $single.addClass(this.dom.current); 2999 $('.' + this.dom.pane, $single).slideDown( '', function() { 3000 if ( initial || ! $(this).parents('.mk-accordion').hasClass('scroll-click') ) { 3001 return; 3002 } 3003 3004 if (typeof $single.prev() === 'undefined') { 3005 $single = $single.prev() 3006 } 3007 3008 window.scrollTo({ top: $single.offset().top - 100, left: 0, behavior: 'smooth' }); 3009 } ); 3010 } 3011 3012 3013 3014 // /////////////////////////////////////// 3015 // 3016 // Apply to: 3017 // 3018 // /////////////////////////////////////// 3019 3020 function init() { 3021 $('.mk-accordion').each(function() { 3022 new Accordion(this); 3023 }); 3024 } 3025 3026 init(); 3027 $(window).on('vc_reload', init); 3028 3029})(jQuery); 3030(function($) { 3031 'use strict'; 3032 3033 var MK = window.MK || {}; 3034 window.MK = MK; 3035 MK.ui = window.MK.ui || {}; 3036 3037 var _ajaxUrl = MK.core.path.ajaxUrl; 3038 var _instances = {}; 3039 3040 MK.utils.ajaxLoader = function ajaxLoader(el) { 3041 // retrun a cached instance to have control over state from within multiple places 3042 // we may need for example to reset pageId when do filtering. It is really one instance that controls both filtering and pagination / load more 3043 var id = '#' + ($(el).attr('id')); 3044 if(typeof _instances[id] !== 'undefined') return _instances[id]; 3045 3046 // else lets start new instance 3047 this.id = id; 3048 this.el = el; 3049 this.isLoading = false; 3050 this.xhrCounter = 0; 3051 }; 3052 3053 MK.utils.ajaxLoader.prototype = { 3054 init: function init() { 3055 // prevent double initialization of we return an instance 3056 if ( this.initialized && typeof window.vc_iframe === 'undefined' ) { 3057 return; 3058 } 3059 3060 this.createInstance(); 3061 this.cacheElements(); 3062 3063 this.initialized = true; 3064 }, 3065 3066 cacheElements: function cacheElements() { 3067 this.$container = $(this.el); 3068 this.id = '#' + (this.$container.attr('id')); 3069 this.categories = this.$container.data('loop-categories'); 3070 3071 this.data = {}; 3072 this.data.action = 'mk_load_more'; 3073 this.data.query = this.$container.data('query'); 3074 this.data.atts = this.$container.data('loop-atts'); 3075 this.data.loop_iterator = this.$container.data('loop-iterator'); 3076 this.data.author = this.$container.data('loop-author'); 3077 this.data.posts = this.$container.data('loop-posts'); 3078 this.data.safe_load_more = this.$container.siblings('#safe_load_more').val(); 3079 this.data._wp_http_referer = this.$container.siblings('input[name="_wp_http_referer"]').val(); 3080 this.data.paged = 1; 3081 this.data.maxPages = this.$container.data('max-pages'); 3082 this.data.term = this.categories; 3083 }, 3084 3085 createInstance: function() { 3086 _instances[this.id] = this; 3087 }, 3088 3089 load: function load(unique) { 3090 var self = this; 3091 var seq = ++this.xhrCounter; 3092 this.isLoading = true; 3093 3094 // If mk-ajax-loaded-posts span exists, get the post ids 3095 if ( this.$container.siblings('.mk-ajax-loaded-posts').length ) { 3096 var loaded_posts = this.$container.siblings('.mk-ajax-loaded-posts').attr('data-loop-loaded-posts'); 3097 3098 // Do not send looaded posts for Classic Pagination Navigation 3099 if ( this.$container.attr('data-pagination-style') != 1 ) { 3100 self.data.loaded_posts = loaded_posts.split(','); 3101 } 3102 } 3103 3104 return $.when( 3105 $.ajax({ 3106 url : _ajaxUrl, 3107 type : "POST", 3108 data : self.data 3109 }) 3110 ).done(function(response) { 3111 self.onDone(response, unique, seq); 3112 }); 3113 }, 3114 3115 onDone: function(response, unique, seq) { 3116 if(seq === this.xhrCounter) { 3117 var self = this; 3118 3119 response = $.parseJSON(response); 3120 response.unique = unique; 3121 response.id = this.id; 3122 3123 // If mk-ajax-loaded-posts span exists, update current post ids 3124 // with new post ids from server's response 3125 if ( this.$container.siblings('.mk-ajax-loaded-posts').length ) { 3126 this.$container.siblings('.mk-ajax-loaded-posts').attr('data-loop-loaded-posts', response.loaded_posts); 3127 } 3128 3129 this.setData({ 3130 maxPages: response.maxPages, 3131 found_posts: response.found_posts, 3132 loop_iterator: response.i 3133 }); 3134 3135 // Preload images first by creating object from returned content. 3136 // mk_imagesLoaded() method will create a promise that gets resolved when all images inside are loaded. 3137 // Our ajaxLoad is somehow more similar to window.onload event now. 3138 $(response.content).mk_imagesLoaded().then(function() { 3139 MK.utils.eventManager.publish('ajaxLoaded', response); 3140 self.isLoading = false;
3141 self.initNewComponents(); 3142 }); 3143 3144 } else console.log('XHR request nr '+ seq +' aborted'); 3145 3146 }, 3147 3148 setData: function setData(atts) { 3149 for(var att in atts) { 3150 if(att === 'term' && atts[att] === '*') this.data.term = ''; 3151 else this.data[att] = atts[att]; 3152 } 3153 }, 3154 3155 getData: function getData(att) { 3156 return this.data[att]; 3157 }, 3158 3159 initNewComponents: function initNewComponents() { 3160 // Legacy scripts reinit 3161 window.ajaxInit(); 3162 setTimeout(window.ajaxDelayedInit, 1000); 3163 // New way to init apended things 3164 MK.core.initAll(this.el); 3165 } 3166 }; 3167 3168}(jQuery)); 3169 3170/* Background Parallax Effects */ 3171/* -------------------------------------------------------------------- */ 3172 3173function mk_backgrounds_parallax() { 3174 3175 "use strict"; 3176 3177 $('.mk-parallax-enabled').each(function () { 3178 var $this = $( this ); 3179 if (!MK.utils.isMobile()) { 3180 MK.core.loadDependencies([ MK.core.path.plugins + 'jquery.parallax.js' ], function() { 3181 $this.parallax("49%", 0.3); 3182 }); 3183 } 3184 }); 3185 3186 $('.mk-fullwidth-slideshow.parallax-slideshow').each(function () { 3187 var $this = $( this ); 3188 if (!MK.utils.isMobile()) { 3189 MK.core.loadDependencies([ MK.core.path.plugins + 'jquery.parallax.js' ], function() { 3190 var speed_factor = $this.attr('data-speedFactor'); 3191 $this.parallax("49%", speed_factor); 3192 }); 3193 } 3194 }); 3195 3196} 3197 3198 3199var MK = window.MK || {}; 3200window.MK = MK; 3201MK.component = window.MK.component || {}; 3202 3203MK.component.BackgroundImageSetter = (function ($) { 3204 3205 'use strict'; 3206 3207 var module = {}; 3208 3209 3210 /*---------------------------------------------------------------------------------*/ 3211 /* Private Variables 3212 /*---------------------------------------------------------------------------------*/ 3213 3214 /** 3215 * Take all elements with data-mk-img-set attribute and evaluate best image according to given device orientation and resolution, 3216 * sets style for backround-image on the same node element. * 3217 */ 3218 3219 var $win = $(window), 3220 // $layers = $('[data-mk-img-set]'), 3221 screen = getScreenSize(), 3222 orientation = getOrientation(), 3223 device = getDevice(), 3224 lastOrientation = orientation, 3225 lastDevice = device; 3226 3227 3228 /*---------------------------------------------------------------------------------*/ 3229 /* Private Methods 3230 /*---------------------------------------------------------------------------------*/ 3231 3232 function run($layers) { 3233 $layers.filter( function() { 3234 return !this.hasAttribute("mk-img-loaded"); 3235 }).each(applyBg); 3236 } 3237 3238 // Keep our main side effect out of calculations so they can be run once before loop of applying bg as a result 3239 function applyBg() { 3240 var $this = $(this), 3241 imgs = $this.data('mk-img-set'); 3242 3243 $this.css('background-image', 'url('+ module.getImage(imgs) +')'); 3244 $this.find('.mk-adaptive-image').attr('src', module.getImage(imgs)); 3245 } 3246 3247 // Keep track of current screen size while resizing but update device reference 3248 // and reapply backgrounds only when we discover switch point 3249 function handleResize($layers) { 3250 updateScreenSize(); 3251 if(hasSwitched()) { 3252 updateDevice(); 3253 run($layers); 3254 } 3255 } 3256 3257 function getScreenSize() { 3258 return { 3259 w: $win.width(), 3260 h: $win.height() 3261 }; 3262 } 3263 3264 // Name our device classes and add them id which simply means which one is wider 3265 function getDevice() { 3266 if (screen.w > 1024) return {class: 'desktop', id: 2}; 3267 else if(screen.w > 736) return {class: 'tablet', id: 1}; 3268 else return {class: 'mobile', id: 0}; 3269 } 3270 3271 function getOrientation() { 3272 if(screen.w > screen.h) return 'landscape'; 3273 else return 'portrait'; 3274 } 3275 3276 function updateScreenSize() { 3277 screen = getScreenSize(); 3278 } 3279 3280 function updateDevice() { 3281 if(lastOrientation !== orientation) orientation = lastOrientation; 3282 // Switch device only if going from smaller size to bigger. 3283 // Bigger to smaller is perfectly handled by browsers and doesn't require change and reupload 3284 if(lastDevice.id > device.id) device = lastDevice; 3285 } 3286 3287 function hasSwitched() { 3288 lastOrientation = getOrientation(); 3289 lastDevice = getDevice(); 3290 3291 if(lastOrientation !== orientation || lastDevice.class !== device.class) return true; 3292 else return false;
3293 } 3294 3295 3296 /*---------------------------------------------------------------------------------*/ 3297 /* Public Methods 3298 /*---------------------------------------------------------------------------------*/ 3299 3300 // As desired image might be not available we have to evaluate the best match. 3301 module.getImage = function (imgs) { 3302 if (imgs['responsive'] === 'false') { 3303 return (imgs['landscape']['desktop']) ? imgs['landscape']['desktop'] : (imgs['landscape']['external'] ? imgs['landscape']['external'] : ''); 3304 3305 } 3306 var hasOrientation = !!imgs[orientation]; 3307 // there are only two orientations now and we may get them by string name if both are there 3308 // or by index of 0 if only one is available. Note Objects has no lexical order so we need to grab key name by its index. 3309 // Also we may have external file for each orientation which we don't scale internaly so we grab it as it is. If nothing found return an empty string 3310 var imgOriented = imgs[ (hasOrientation ? orientation : Object.keys(imgs)[0]) ], 3311 imgExact = (imgOriented[device.class]) ? imgOriented[device.class] : (imgOriented['external'] ? imgOriented['external'] : ''); 3312 return imgExact; 3313 } 3314 3315 module.init = function ($layers) { 3316 3317 // Run and bind 3318 run($layers); 3319 $layers.attr('mk-img-loaded', ''); 3320 }; 3321 3322 module.onResize = function ($layers) { 3323 $win.on('resize', MK.utils.throttle( 500, function() { 3324 handleResize($layers); 3325 })); 3326 }; 3327 3328 return module; 3329 3330}(jQuery)); 3331 3332 3333jQuery(function($) { 3334 3335 var init = function init() { 3336 // Get All Layers, Excluding Edge Slider and Page Section 3337 var $allLayers = $('[data-mk-img-set]').filter(function(index) { 3338 return !$(this).hasClass('mk-section-image') && !$(this).hasClass('background-layer') && !$(this).hasClass('mk-video-section-touch'); 3339 });; 3340 3341 // Handle the resize 3342 MK.component.BackgroundImageSetter.onResize($allLayers); 3343 3344 // Set all the BG Layers 3345 MK.component.BackgroundImageSetter.init($allLayers); 3346 } 3347 init(); 3348 3349 $(window).on('vc_reload', init); 3350 3351}); 3352 3353/* Blog, Portfolio Audio */ 3354/* -------------------------------------------------------------------- */ 3355 3356function loop_audio_init() { 3357 if (!$.exists('.jp-jplayer')) { 3358 return; 3359 } 3360 3361 $('.jp-jplayer.mk-blog-audio').each(function () { 3362 var $this = $(this); 3363 var $thisControls = $this.next('.jp-audio'); 3364 var audio = $this.find( '.mk-audio' )[0]; 3365 3366 // Set initial values. 3367 $thisControls.find('.jp-current-time').text('0:0'); 3368 $thisControls.find('.jp-volume-bar-value').css('width', 25); 3369 3370 /* 3371 * When audio data is loaded. 3372 */ 3373 audio.addEventListener('loadeddata', jsPlayerloaded(audio, $thisControls), false); 3374 3375 audio.addEventListener('loadedmetadata', function() { 3376 var minutes = Math.floor(audio.duration / 60); 3377 var seconds = Math.floor(audio.duration % 60); 3378 3379 // Update the duration time. 3380 if (!isNaN(minutes)) { 3381 $thisControls.find('.jp-duration').text(minutes + ':' + seconds); 3382 } 3383 3384 // Show play button when audio is loaded. 3385 $thisControls.removeClass('jp-audio-loading').addClass('jp-audio-loaded'); 3386 }); 3387 3388 /* 3389 * When audio is playing. 3390 */ 3391 audio.addEventListener('timeupdate', function() { 3392 var minutes = Math.floor(audio.currentTime / 60); 3393 var seconds = Math.floor(audio.currentTime % 60); 3394 3395 // Update curren time. 3396 $thisControls.find('.jp-current-time').text(minutes + ':' + seconds); 3397 3398 // Convert length of audio to 0 - 100 while keeping ratio. 3399 var position = ((audio.currentTime - 0) / (audio.duration - 0)) * (100 - 0) + 0; 3400 3401 // Update position of progress bar. 3402 $thisControls.find('.jp-play-bar').css('width', position + '%'); 3403 }); 3404 3405 /* 3406 * When audio is ended. 3407 */ 3408 audio.addEventListener('ended', function() { 3409 // Show play button. 3410 $thisControls.removeClass('jp-audio-playing'); 3411 3412 // Reset the position of progress bar. 3413 $thisControls.find('.jp-play-bar').css('width', 0); 3414 3415 // Reset the current time. 3416 $thisControls.find('.jp-current-time').text('0:0'); 3417 }); 3418 3419 /* 3420 * Play the audio. 3421 */ 3422 $thisControls.find('.jp-play').on('click', function() { 3423 audio.play(); 3424 3425 // Show pause button. 3426 $thisControls.addClass('jp-audio-playing').removeClass('jp-audio-paused'); 3427 }); 3428 3429 /* 3430 * Pause the audio.. 3431 */ 3432 $thisControls.find('.jp-pause').on('click', function() { 3433 audio.pause(); 3434 3435 // Show play button. 3436 $thisControls.addClass('jp-audio-paused').removeClass('jp-audio-playing'); 3437 }); 3438 3439 /* 3440 * Mute the audio. 3441 */ 3442 $thisControls.find('.jp-volume-bar svg').on('click', function() { 3443 audio.muted = !audio.muted; 3444 3445 $(this).parent().toggleClass('jp-muted'); 3446 }); 3447 3448 /* 3449 * Adjust the volume. 3450 */ 3451 $thisControls.find('.inner-value-adjust').on('click', function(e) { 3452 // Get the posiiton of mouse click, between 0 to 25. 3453 var position = e.pageX - $(this).offset().left; 3454 3455 // Scale the number from 0 - 25 to 0 - 1 while keeping ratio. 3456 var volume = ((position - 0) / (25 - 0)) * (1 - 0) + 0; 3457 3458 // Set volume. 3459 audio.volume = volume; 3460 3461 // Update the position of volume bar. 3462 $(this).find('.jp-volume-bar-value').css('width', position); 3463 }); 3464 3465 /* 3466 * Adjust current time from progress bar. 3467 */ 3468 $thisControls.find('.jp-seek-bar').on('click', function(e) { 3469 // Get the position of mouse click. 3470 var position = e.pageX - $(this).offset().left; 3471
3472 // Scale the number from 0 - currentTime to 0 - 100 while keeping ratio. 3473 var currnetTime = ((position - 0) / ($(this).width() - 0)) * (audio.duration - 0) + 0; 3474 3475 // Set current time. 3476 audio.currentTime = currnetTime; 3477 3478 // Update the position of progress bar. 3479 $thisControls.find('.jp-play-bar').css('width', currnetTime + '%'); 3480 }); 3481 }); 3482 3483 function jsPlayerloaded(audio, $thisControls) { 3484 var minutes = Math.floor(audio.duration / 60); 3485 var seconds = Math.floor(audio.duration % 60); 3486 3487 // Update the duration time. 3488 if (!isNaN(minutes)) { 3489 $thisControls.find('.jp-duration').text(minutes + ':' + seconds); 3490 } 3491 3492 // Show play button when audio is loaded. 3493 $thisControls.removeClass('jp-audio-loading').addClass('jp-audio-loaded'); 3494 } 3495} 3496 3497/* Blog Loop Carousel Shortcode */ 3498/* -------------------------------------------------------------------- */ 3499 3500 3501function mk_blog_carousel() { 3502 3503 "use strict"; 3504 3505 if (!$.exists('.mk-blog-showcase')) { 3506 return; 3507 } 3508 $('.mk-blog-showcase ul li').each(function () { 3509 3510 $(this).mouseenter( function () { 3511 3512 $(this).siblings('li').removeClass('mk-blog-first-el').end().addClass('mk-blog-first-el'); 3513 3514 }); 3515 3516 }); 3517 3518 3519} 3520 3521 3522 3523 3524/** 3525 * Contact Form 3526 * 3527 * Mostly implemented in Vanilla JS instead of jQuery. 3528 */ 3529function mk_contact_form() { 3530 "use strict"; 3531 var mkContactForms = document.getElementsByClassName('mk-contact-form'); 3532 if (mkContactForms.length === 0) { 3533 return; 3534 } 3535 var captchaImageHolder = $('.captcha-image-holder'); 3536 var activeClassName = 'is-active'; 3537 var invalidClassName = 'mk-invalid'; 3538 for (var i = 0; i < mkContactForms.length; i++) { 3539 initializeForm(mkContactForms[i], activeClassName, invalidClassName); 3540 } 3541 if (captchaImageHolder.length > 0) { 3542 $(window).on('load', initializeCaptchas); 3543 } 3544 /** 3545 * Initialize mk forms. e.g add activeClassName for inputs. 3546 * 3547 * @param form 3548 * @param activeClassName 3549 * @param invalidClassName 3550 */ 3551 function initializeForm(form, activeClassName, invalidClassName) { 3552 var inputs = getFormInputs(form); 3553 for (var i = 0; i < inputs.length; i++) { 3554 markActiveClass(inputs[i]); 3555 } 3556 form.addEventListener('submit', function(e) { 3557 validateForm(e, invalidClassName); 3558 }); 3559 /** 3560 * Set activeClassName for the parent node of the inout 3561 */ 3562 function setActiveClass() { 3563 addClass(this.parentNode, activeClassName); 3564 } 3565 /** 3566 * Unset activeClassName from the parent node of the input. 3567 * We need to unset activeClassName only if the data was empty. 3568 * e.g. in the line style of the mk-contact-form, we set labels position based on activeClassName. 3569 */ 3570 function unsetActiveClass() { 3571 if (this.value === '') { 3572 removeClass(this.parentNode, activeClassName); 3573 } 3574 } 3575 /** 3576 * Add event listeners (focus,blur) for input to set and unset activeClassName. 3577 * 3578 * @param input 3579 */ 3580 function markActiveClass(input) { 3581 input.addEventListener('focus', setActiveClass); 3582 input.addEventListener('blur', unsetActiveClass); 3583 } 3584 } 3585 /** 3586 * Validate form when it's submitted. If everything was valid, we with post form in ajax request. 3587 * 3588 * @param e 3589 * @param invalidClassName 3590 */ 3591 function validateForm(e, invalidClassName) { 3592 e.preventDefault(); 3593 var form = e.target || e.srcElement; 3594 var inputs = getFormInputs(form); 3595 var isValidForm = true; 3596 var hasCaptchaField = false; 3597 for (var i = 0; i < inputs.length; i++) { 3598 var input = inputs[i]; 3599 input.value = String(input.value).trim(); 3600 switch (input.type) { 3601 case 'hidden': 3602 break; 3603 case 'checkbox': 3604 isValidForm = validateCheckBox(input, invalidClassName) && isValidForm; 3605 break; 3606 case 'email': 3607 isValidForm = validateEmail(input, invalidClassName) && isValidForm; 3608 break; 3609 case 'textarea': 3610 isValidForm = validateText(input, invalidClassName) && isValidForm; 3611 break; 3612 case 'text': 3613 /** 3614 * Some old browsers such as IE 8 and 9 detect email type as text. 3615 * So, we need to extra check for data-type attribute 3616 */ 3617 if (input.dataset.type === 'captcha') { 3618 isValidForm = validateText(input, invalidClassName) && isValidForm; 3619 hasCaptchaField = true; 3620 } else if (input.dataset.type === 'email') { 3621 isValidForm = validateEmail(input, invalidClassName) && isValidForm; 3622 } else { 3623 isValidForm = validateText(input, invalidClassName) && isValidForm; 3624 } 3625 break; 3626 default: 3627 /** 3628 * e.g. validating for radiobox, selectbox and etc. 3629 */ 3630 console.warn('Implement validation for ' + input.name + ':' + input.type); 3631 break; 3632 } 3633 } 3634 if (isValidForm) { 3635 if (hasCaptchaField) { 3636 validateCaptcha(form, invalidClassName, sendForm); 3637 } else { 3638 sendForm(form); 3639 } 3640 } 3641 } 3642 /** 3643 * Validate captcha of form. If everything was, we will execute captchaIsValidCallback which as sendForm(). 3644 * 3645 * @param form 3646 * @param invalidClassName 3647 * @param captchaIsValidCallback 3648 * @returns boolean 3649 */ 3650 function validateCaptcha(form, invalidClassName, captchaIsValidCallback) { 3651 var input = form.querySelectorAll('[data-type="captcha"]')[0]; 3652 if (input.value.length === 0) { 3653 addClass(input, invalidClassName); 3654 return false;
3655 } else { 3656 jQuery.get( jupiterDonutVars.ajaxUrl, { 3657 action: 'jupiter_donut_validate_captcha', 3658 nonce: jupiterDonutVars.nonce, 3659 captcha: input.value, 3660 }) 3661 .done(function(data) { 3662 loadCaptcha(); 3663 input.value = ''; 3664 3665 if ( data.success !== true ) { 3666 addClass(input, invalidClassName); 3667 addClass(input, 'contact-captcha-invalid'); 3668 removeClass(input, 'contact-captcha-valid'); 3669 input.placeholder = data.data; 3670 } else { 3671 removeClass(input, invalidClassName); 3672 removeClass(input, 'contact-captcha-invalid'); 3673 addClass(input, 'contact-captcha-valid'); 3674 input.placeholder = data.data; 3675 captchaIsValidCallback(form); 3676 } 3677 }) 3678 } 3679 } 3680 /** 3681 * Send submitted form. 3682 * 3683 * @param form 3684 */ 3685 function sendForm(form) { 3686 var $form = $(form); 3687 var data = getFormData(form); 3688 progressButton.loader($form); 3689 $.post(jupiterDonutVars.ajaxUrl, data, function(response) { 3690 var res = JSON.parse(response); 3691 if (res.action_Status) { 3692 progressButton.success($form); 3693 $form.find('.text-input').val(''); 3694 $form.find('textarea').val(''); 3695 $form.find('input[type=checkbox]').attr("checked", false); 3696 $form.find('.contact-form-message').slideDown().addClass('state-success').html(res.message); 3697 setTimeout(function() { 3698 $form.find('.contact-form-message').slideUp(); 3699 }, 5000); 3700 } else { 3701 progressButton.error($form); 3702 $form.find('.contact-form-message').removeClass('state-success').html(res.message); 3703 } 3704 }); 3705 } 3706 /** 3707 * Initialize all captcha images for first time. All captcha images is always same. e.g. if we have multiple form, 3708 * all of them will have the same image. 3709 * It will also add event listener for '.captcha-change-image' objects to reload the captcha. 3710 */ 3711 function initializeCaptchas() { 3712 var captchaChangeImageButtons = document.getElementsByClassName('captcha-change-image'); 3713 for (var i = 0; i < captchaChangeImageButtons.length; i++) { 3714 captchaChangeImageButtons[i].addEventListener('click', loadCaptcha); 3715 } 3716 } 3717 /** 3718 * Load captcha text and append the image to captcha container. 3719 * If it used as a callback, it will prevent default behave of the event. 3720 * e.g. loading new captcha by click on <a> without changing url. 3721 */ 3722 function loadCaptcha(e) { 3723 if (e) { 3724 e.preventDefault(); 3725 } 3726 $.post(jupiterDonutVars.ajaxUrl, { 3727 action: 'mk_create_captcha_image' 3728 }, appendImage); 3729 /** 3730 * The callback function for append or change old image src based on response. T 3731 * The captchaImageURL is the url of the captcha which is provided in ajax response of mk_create_captcha_image. 3732 * @param captchaImageURL 3733 */ 3734 function appendImage(captchaImageURL) { 3735 if (captchaImageHolder.find('.captcha-image').length === 0) { 3736 captchaImageHolder.html('<img src="' + captchaImageURL + '" class="captcha-image" alt="captcha txt">'); 3737 } else { 3738 captchaImageHolder.find('.captcha-image').attr("src", captchaImageURL + '?' + new Date().getTime()); 3739 } 3740 } 3741 } 3742 /** 3743 * Get form inputs using querySelectorAll(). 3744 * It returns <input> and <textarea> tags. If you need any other tags such as <select>, please update this function. 3745 * 3746 * @param form 3747 * @returns {NodeList} 3748 */ 3749 function getFormInputs(form) { 3750 return form.querySelectorAll('input,textarea'); 3751 } 3752 /** 3753 * Get data of the form inputs and textareas as a object. 3754 * 3755 * @param form 3756 * @returns {{action: string}} 3757 */ 3758 function getFormData(form) { 3759 var data = { 3760 action: 'mk_contact_form' 3761 }; 3762 var inputs = getFormInputs(form); 3763 for (var i = 0; i < inputs.length; i++) {
3764 data[inputs[i].name] = inputs[i].value; 3765 } 3766 return data; 3767 } 3768} 3769/* Ajax Login Form */ 3770/* -------------------------------------------------------------------- */ 3771function mk_login_form() { 3772 $('form.mk-login-form').each(function() { 3773 var $this = $(this); 3774 $this.on('submit', function(e) { 3775 $('p.mk-login-status', $this).show().text(ajax_login_object.loadingmessage); 3776 $.ajax({ 3777 type: 'POST', 3778 dataType: 'json', 3779 url: ajax_login_object.ajaxurl, 3780 data: { 3781 'action': 'ajaxlogin', 3782 'username': $('#username', $this).val(), 3783 'password': $('#password', $this).val(), 3784 'security': $('#security', $this).val() 3785 }, 3786 success: function(data) { 3787 $('p.mk-login-status', $this).text(data.message); 3788 if (data.loggedin === true) { 3789 document.location.href = ajax_login_object.redirecturl; 3790 } 3791 } 3792 }); 3793 e.preventDefault(); 3794 }); 3795 }); 3796} 3797/* Progress Button */ 3798/* -------------------------------------------------------------------- */ 3799var progressButton = { 3800 loader: function(form) { 3801 MK.core.loadDependencies([MK.core.path.plugins + 'tweenmax.js'], function() { 3802 var $form = form, 3803 progressBar = $form.find(".mk-progress-button .mk-progress-inner"), 3804 buttonText = $form.find(".mk-progress-button .mk-progress-button-content"), 3805 progressButton = new TimelineLite(); 3806 progressButton.to(progressBar, 0, { 3807 width: "100%", 3808 scaleX: 0, 3809 scaleY: 1 3810 }).to(buttonText, .3, { 3811 y: -5 3812 }).to(progressBar, 1.5, { 3813 scaleX: 1, 3814 ease: Power2.easeInOut 3815 }, "-=.1").to(buttonText, .3, { 3816 y: 0 3817 }).to(progressBar, .3, { 3818 scaleY: 0 3819 }); 3820 }); 3821 }, 3822 success: function(form) { 3823 MK.core.loadDependencies([MK.core.path.plugins + 'tweenmax.js'], function() { 3824 var $form = form, 3825 buttonText = $form.find(".mk-button .mk-progress-button-content, .mk-contact-button .mk-progress-button-content"), 3826 successIcon = $form.find(".mk-progress-button .state-success"), 3827 progressButtonSuccess = new TimelineLite({ 3828 onComplete: hideSuccessMessage 3829 }); 3830 progressButtonSuccess.to(buttonText, .3, { 3831 paddingRight: 20, 3832 ease: Power2.easeInOut 3833 }, "+=1").to(successIcon, .3, { 3834 opacity: 1 3835 }).to(successIcon, 2, { 3836 opacity: 1 3837 }); 3838 3839 function hideSuccessMessage() { 3840 progressButtonSuccess.reverse() 3841 } 3842 }); 3843 }, 3844 error: function(form) { 3845 MK.core.loadDependencies([MK.core.path.plugins + 'tweenmax.js'], function() { 3846 var $form = form, 3847 buttonText = $form.find(".mk-button .mk-progress-button-content, .mk-contact-button .mk-progress-button-content"), 3848 errorIcon = $form.find(".mk-progress-button .state-error"), 3849 progressButtonError = new TimelineLite({ 3850 onComplete: hideErrorMessage 3851 }); 3852 progressButtonError.to(buttonText, .3, { 3853 paddingRight: 20 3854 }, "+=1").to(errorIcon, .3, { 3855 opacity: 1 3856 }).to(errorIcon, 2, { 3857 opacity: 1 3858 }); 3859 3860 function hideErrorMessage() { 3861 progressButtonError.reverse() 3862 } 3863 }); 3864 } 3865}; 3866 3867/* Event Count Down */ 3868/* -------------------------------------------------------------------- */ 3869 3870function mk_event_countdown() { 3871 if ($.exists('.mk-event-countdown')) { 3872 3873 MK.core.loadDependencies([ MK.core.path.plugins + 'jquery.countdown.js' ], function() { 3874 3875 $('.mk-event-countdown').each(function () { 3876 var $this = $(this), 3877 $date = $this.attr('data-date'), 3878 $offset = $this.attr('data-offset'); 3879 3880 $this.downCount({ 3881 date: $date, 3882 offset: $offset 3883 }); 3884 }); 3885 3886 }); 3887 } 3888} 3889 3890/* Flexslider init */ 3891/* -------------------------------------------------------------------- */ 3892 3893function mk_flexslider_init() { 3894 3895 var $lcd = $('.mk-lcd-slideshow'), 3896 $laptop = $('.mk-laptop-slideshow-shortcode'); 3897 3898 if($lcd.length) $lcd.find('.mk-lcd-image').fadeIn(); 3899 if($laptop.length) $laptop.find(".mk-laptop-image").fadeIn(); 3900 3901 $('.js-flexslider').each(function () { 3902 3903 if ($(this).parents('.mk-tabs').length || $(this).parents('.mk-accordion').length) { 3904 $(this).removeData("flexslider"); 3905 } 3906 3907 var $this = $(this), 3908 $selector = $this.attr('data-selector'), 3909 $animation = $this.attr('data-animation'), 3910 $easing = $this.attr('data-easing'), 3911 $direction = $this.attr('data-direction'), 3912 $smoothHeight = $this.attr('data-smoothHeight') == "true" ? true : false,
3913 $slideshowSpeed = $this.attr('data-slideshowSpeed'), 3914 $animationSpeed = $this.attr('data-animationSpeed'), 3915 $controlNav = $this.attr('data-controlNav') == "true" ? true : false, 3916 $directionNav = $this.attr('data-directionNav') == "true" ? true : false, 3917 $pauseOnHover = $this.attr('data-pauseOnHover') == "true" ? true : false, 3918 $isCarousel = $this.attr('data-isCarousel') == "true" ? true : false; 3919 3920 3921 if ($selector !== undefined) { 3922 var $selector_class = $selector; 3923 } else { 3924 var $selector_class = ".mk-flex-slides > li"; 3925 } 3926 3927 if ($isCarousel === true) { 3928 var $itemWidth = parseInt($this.attr('data-itemWidth')), 3929 $itemMargin = parseInt($this.attr('data-itemMargin')), 3930 $minItems = parseInt($this.attr('data-minItems')), 3931 $maxItems = parseInt($this.attr('data-maxItems')), 3932 $move = parseInt($this.attr('data-move')); 3933 } else { 3934 var $itemWidth = $itemMargin = $minItems = $maxItems = $move = 0; 3935 } 3936 3937 MK.core.loadDependencies([ MK.core.path.plugins + 'jquery.flexslider.js' ], function() { 3938 $this.flexslider({ 3939 selector: $selector_class, 3940 animation: $animation, 3941 easing: $easing, 3942 direction: $direction, 3943 smoothHeight: $smoothHeight, 3944 slideshow: true, // autoplay 3945 slideshowSpeed: $slideshowSpeed, 3946 animationSpeed: $animationSpeed, 3947 controlNav: $controlNav, 3948 directionNav: $directionNav, 3949 pauseOnHover: $pauseOnHover, 3950 prevText: "", 3951 nextText: "", 3952 itemWidth: $itemWidth, 3953 itemMargin: $itemMargin, 3954 minItems: $minItems, 3955 maxItems: $maxItems, 3956 move: $move 3957 }); 3958 }); 3959 3960 }); 3961 3962} 3963 3964(function( $ ) { 3965 'use strict'; 3966 3967 var val = MK.val; 3968 3969 MK.component.FullHeight = function( el ) { 3970 var $window = $( window ), 3971 $this = $( el ), 3972 config = $this.data( 'fullheight-config' ), 3973 container = document.getElementById( 'mk-theme-container' ), 3974 minH = (config && config.min) ? config.min : 0, 3975 winH = null, 3976 height = null, 3977 update_count = 0, 3978 testing = MK.utils.getUrlParameter('testing'), 3979 offset = null; 3980 3981 // We need to provide height on the same specificity level for workaround to IE bug 3982 // connect.microsoft.com/IE/feedback/details/802625/min-height-and-flexbox-flex-direction-column-dont-work-together-in-ie-10-11-preview 3983 // stackoverflow.com/questions/19371626/flexbox-not-centering-vertically-in-ie 3984 if(MK.utils.browser.name === ('IE' || 'Edge')) $this.css( 'height', '1px' ); 3985 3986 var update = function() { 3987 3988 if(update_count === 0) { 3989 winH = $window.height(); 3990 // for correct calculate 3991 offset = $this.offset().top - 1; 3992 height = Math.max(minH, winH - val.offsetHeaderHeight( offset )); 3993 $this.css( 'min-height', height ); 3994 if(testing !== undefined ) 3995 update_count++; 3996 } 3997 3998 }; 3999 4000 // TODO remove scroll listener by dynamic offset reader 4001 var init = function() { 4002 update(); 4003 $window.on( 'resize', update ); 4004 $window.on( 'scroll', update ); 4005 window.addResizeListener( container, update ); 4006 }; 4007 4008 return { 4009 init : init 4010 }; 4011 }; 4012 4013})( jQuery ); 4014 4015 4016(function( $ ) { 4017 'use strict'; 4018 4019 var core = MK.core, 4020 utils = MK.utils, 4021 path = MK.core.path; 4022 4023 4024 MK.ui.FullScreenGallery = function( element, settings ) { 4025 this.element = element; 4026 this.config = settings; 4027 4028 this.isFullScreen = false; 4029 }; 4030 4031 4032 // preload slick PLUGIN TO USE THIS 4033 MK.ui.FullScreenGallery.prototype = { 4034 dom : { 4035 fullScrBtn : '.slick-full-screen', 4036 exitFullScrBtn : '.slick-minimize', 4037 playBtn : '.slick-play', 4038 pauseBtn : '.slick-pause', 4039 shareBtn : '.slick-share', 4040 socialShare : '.slick-social-share', 4041 wrapper : '.slick-slider-wrapper', 4042 slider : '.slick-slides', 4043 slides : '.slick-slide', 4044 dots : '.slick-dot', 4045 active : '.slick-active', 4046 hiddenClass : 'jupiter-donut-is-hidden', 4047 dataId : 'slick-index' 4048 }, 4049 4050 tpl: { 4051 dot : '<div class="slick-dot"></div>', 4052 next : '<a href="javascript:;" class="slick-next"> <svg width="33px" height="65px"> <polyline fill="none" stroke="#FFFFFF" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points=" 0.5,0.5 32.5,32.5 0.5,64.5"/> </svg> </a>', 4053 prev : '<a href="javascript:;" class="slick-prev"> <svg width="33px" height="65px"> <polyline fill="none" stroke="#FFFFFF" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points=" 32.5,64.5 0.5,32.5 32.5,0.5"/> </svg> </a>' 4054 }, 4055 4056 init : function() { 4057 var self = this; 4058 4059 // core.loadDependencies([ path.plugins + 'slick.js' ], function() { 4060 self.cacheElements(); 4061 self.getViewportSizes(); 4062 self.updateSizes( 'window' ); 4063 self.create(); 4064 // update cache with elements propagated by plugin 4065 self.updateCacheElements(); 4066 self.createPagination(); 4067 self.bindEvents(); 4068 // }); 4069 }, 4070 4071 create : function() { 4072 var self = this; 4073 4074 this.slick = this.$gallery.slick({ 4075 dots: true, 4076 arrows: true, 4077 infinite: true, 4078 speed: 300, 4079 slidesToShow: 1, 4080 centerMode: true, 4081 centerPadding: '0px', 4082 variableWidth: true, 4083 autoplay: false, 4084 autoplaySpeed: 3000, 4085 useTransform: true, 4086 prevArrow: self.tpl.prev, 4087 nextArrow: self.tpl.next, 4088 customPaging: function(slider, i) { 4089 return self.tpl.dot; 4090 }, 4091 }); 4092 }, 4093 4094 cacheElements : function() { 4095 this.$window = $( window ); 4096 this.$gallery = $( this.element ); 4097 4098 this.$fullScrBtn = $( this.dom.fullScrBtn ); 4099 this.$exitFullScrBtn = $( this.dom.exitFullScrBtn ); 4100 this.$playBtn = $( this.dom.playBtn ); 4101 this.$pauseBtn = $( this.dom.pauseBtn ); 4102 this.$shareBtn = $( this.dom.shareBtn ); 4103 this.$socialShare = $( this.dom.socialShare ); 4104 4105 this.$wrapper = $( this.dom.wrapper ); 4106 this.$slider = $( this.dom.slider ); 4107 this.$slides = $( this.dom.slides ); 4108 this.$imgs = this.$slides.find( 'img' ); 4109 // store reference to initial images without slides appended by pugin 4110 // - needed for creating of pagination 4111 this.$originalImgs = this.$imgs; 4112 }, 4113 4114 updateCacheElements : function() { 4115 this.$slides = $( this.dom.slides ); 4116 this.$imgs = this.$slides.find( 'img' ); 4117 this.$dots = $( this.dom.dots ); 4118 }, 4119 4120 bindEvents : function() { 4121 var self = this; 4122 this.$fullScrBtn.on( 'click', this.toFullScreen.bind( this ) ); 4123 this.$exitFullScrBtn.on( 'click', this.exitFullScreen.bind( this ) ); 4124 this.$playBtn.on( 'click', this.play.bind( this ) ); 4125 this.$pauseBtn.on( 'click', this.pause.bind( this ) ); 4126 this.$shareBtn.on( 'click', this.toggleShare.bind( this ) ); 4127 this.$socialShare.on( 'click', 'a', this.socialShare.bind( this ) ); 4128 this.$window.on( 'resize', this.onResize.bind( this ) ); 4129 this.$window.on( 'keydown', function(e) { 4130 if(e.keyCode === 39) self.$gallery.slick('slickNext'); 4131 if(e.keyCode === 37) self.$gallery.slick('slickPrev'); 4132 }); 4133 $( document ).on( 'fullscreenchange mozfullscreenchange webkitfullscreenchange msfullcreenchange', this.exitFullScreen.bind( this ) ); 4134 }, 4135 4136 getViewportSizes : function() { 4137 this.screen = { 4138 w: screen.width, 4139 h: screen.height 4140 }; 4141 this.window = { 4142 w: this.$window.width(), 4143 h: this.$window.height() 4144 }; 4145 }, 4146 4147 updateSizes : function( viewport ) { 4148 this.$wrapper.width( this[ viewport ].w ); 4149 this.$wrapper.height( '100%' ); 4150 this.$imgs.height( '100%'); 4151 }, 4152 4153 createPagination : function() { 4154 var self = this; 4155 this.$dots.each( function( i ) { 4156 var img = self.$originalImgs.eq( i ).attr( 'src' ); 4157 4158 $( this ).css({ 4159 'background-image': 'url('+ img +')' 4160 }); 4161 }); 4162 }, 4163 4164 play : function(e) { 4165 e.preventDefault(); 4166 this.$playBtn.addClass( this.dom.hiddenClass ); 4167 this.$pauseBtn.removeClass( this.dom.hiddenClass ); 4168 $( this.element ).slick( 'slickPlay' ); 4169 }, 4170 4171 pause : function(e) { 4172 e.preventDefault(); 4173 this.$pauseBtn.addClass( this.dom.hiddenClass ); 4174 this.$playBtn.removeClass( this.dom.hiddenClass ); 4175 $( this.element ).slick( 'slickPause' ); 4176 }, 4177 4178 toggleShare : function(e) { 4179 e.preventDefault(); 4180 this.$socialShare.toggleClass( this.dom.hiddenClass ); 4181 }, 4182 4183 getCurentId : function() { 4184 return this.$slides.filter( this.dom.active ).data( this.dom.dataId ); 4185 }, 4186 4187 toFullScreen : function() { 4188 var self = this; 4189 4190 this.$fullScrBtn.addClass( this.dom.hiddenClass ); 4191 this.$exitFullScrBtn.removeClass( this.dom.hiddenClass ); 4192 4193 this.$slider.hide().fadeIn( 500 ); 4194 utils.launchIntoFullscreen( document.documentElement ); 4195 this.updateSizes( 'screen' ); 4196 $( this.element ).slick( 'slickGoTo', this.getCurentId(), true ); 4197 4198 // Update state with delay so we avoid triggering exitFullScreen fn from 4199 // fullscreenchange event 4200 setTimeout( function() { 4201 self.isFullScreen = true; 4202 }, 1000); 4203 }, 4204 4205 exitFullScreen : function() { 4206 if( this.isFullScreen ) { 4207 this.$exitFullScrBtn.addClass( this.dom.hiddenClass ); 4208 this.$fullScrBtn.removeClass( this.dom.hiddenClass ); 4209 4210 utils.exitFullscreen(); 4211 this.updateSizes( 'window' ); 4212 $( this.element ).slick( 'slickGoTo', this.getCurentId(), true ); 4213 4214 this.isFullScreen = false;
4215 } 4216 4217 }, 4218 4219 onResize : function() { 4220 this.getViewportSizes(); 4221 this.updateSizes( this.isFullScreen ? 'screen' : 'window' ); 4222 $( this.element ).slick( 'refresh' ); 4223 $( this.element ).slick( 'slickGoTo', this.getCurentId(), true ); 4224 this.updateCacheElements(); 4225 this.createPagination(); 4226 }, 4227 4228 socialShare : function( e ) { 4229 e.preventDefault(); 4230 var $this = $( e.currentTarget ), 4231 network = $this.data( 'network' ), 4232 id = this.config.id, 4233 url = this.config.url, 4234 title = this.$wrapper.find( '.slick-title' ).text(), 4235 name; 4236 var picture = this.$slides.filter( this.dom.active ).children().first().attr( 'src' ); 4237 switch( network ) { 4238 case 'facebook': 4239 url = 'https://www.facebook.com/sharer/sharer.php?picture=' + picture+'&u=' + url + '#id=' + id; 4240 name = 'Facebook Share'; 4241 break; 4242 case 'twitter': 4243 url = 'http://twitter.com/intent/tweet?text=' + url + '#id=' + id; 4244 name = 'Twitter Share'; 4245 break; 4246 case 'pinterest': 4247 url = 'http://pinterest.com/pin/create/bookmarklet/?media=' + picture + '&url=' + url + '&is_video=false&description=' + title; 4248 // other available link paranmeters: media, description 4249 name = 'Pinterest Share'; 4250 break; 4251 4252 } 4253 4254 window.open( url, name, "height=380 ,width=660, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0" ); 4255 } 4256 }; 4257 4258})( jQuery ); 4259 4260(function($) { 4261 'use strict'; 4262 4263 MK.component.Grid = function( el ) { 4264 var $container = $(el); 4265 var config = $container.data( 'grid-config' ); 4266 var isSlideshow = $container.closest('[data-mk-component="SwipeSlideshow"]').length; 4267 var miniGridConfig = { 4268 container: el, 4269 item: config.item + ':not(.is-hidden)', 4270 gutter: 0 4271 }; 4272 4273 var init = function init(){ 4274 // Flags for cancelling usage goes first : 4275 // Quit early if we discover that Grid is used inside SwipeSlideshow as it brings bug with crossoverriding positioning 4276 // + grid is not really needed as we have single row all handled by slider. 4277 // It happens only in woocommerce carousel as of hardcoded Grid in loop-start.php 4278 if(isSlideshow) return; 4279 MK.core.loadDependencies([ MK.core.path.plugins + 'minigrid.js' ], create); 4280 }; 4281 4282 // Remove el hidden without adding proper class 4283 var prepareForGrid = function prepareForGrid() { 4284 var $item = $(this); 4285 var isHidden = ($item.css('display') === 'none'); 4286 if(isHidden) $item.addClass('is-hidden'); 4287 else $item.removeClass('is-hidden'); 4288 }; 4289 4290 var create = function create() { 4291 var timer = null; 4292 4293 function draw() { 4294 // Prevent plugin breaking when feeding it with hidden elements 4295 $container.find(config.item).each( prepareForGrid ); 4296 minigrid(miniGridConfig); 4297 } 4298 4299 function redraw() { 4300 if (timer) clearTimeout(timer); 4301 timer = setTimeout(draw, 100); 4302 } 4303 4304 // init 4305 draw(); 4306 // If reinitializing drop existing event handler 4307 $(window).off('resize', redraw); 4308 $(window).on('resize mk-image-loaded', redraw); 4309 MK.utils.eventManager.subscribe('item-expanded', redraw); 4310 MK.utils.eventManager.subscribe('ajaxLoaded', redraw); 4311 MK.utils.eventManager.subscribe('staticFilter', redraw); 4312 }; 4313 4314 return { 4315 init : init 4316 }; 4317 }; 4318 4319})(jQuery); 4320 4321 4322 4323 4324 4325 4326 4327 4328/*! 4329 * imagesLoaded PACKAGED v4.1.1 4330 * JavaScript is all like "You images are done yet or what?" 4331 * MIT License 4332 */ 4333 4334!function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||{};return n[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=0,o=i[n];e=e||[];for(var r=this._onceEvents&&this._onceEvents[t];o;){var s=r&&r[o];s&&(this.off(t,o),delete r[o]),o.apply(this,e),n+=s?0:1,o=i[n]}return this}},t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define(["ev-emitter/ev-emitter"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.imagesLoaded=e(t,t.EvEmitter)}(window,function(t,e){function i(t,e){for(var i in e)t[i]=e[i];return t}function n(t){var e=[];
4334if(Array.isArray(t))e=t;else if("number"==typeof t.length)for(var i=0;i<t.length;i++)e.push(t[i]);else e.push(t);return e}function o(t,e,r){return this instanceof o?("string"==typeof t&&(t=document.querySelectorAll(t)),this.elements=n(t),this.options=i({},this.options),"function"==typeof e?r=e:i(this.options,e),r&&this.on("always",r),this.getImages(),h&&(this.jqDeferred=new h.Deferred),void setTimeout(function(){this.check()}.bind(this))):new o(t,e,r)}function r(t){this.img=t}function s(t,e){this.url=t,this.element=e,this.img=new Image}var h=t.jQuery,a=t.console;o.prototype=Object.create(e.prototype),o.prototype.options={},o.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},o.prototype.addElementImages=function(t){"IMG"==t.nodeName&&this.addImage(t),this.options.background===!0&&this.addElementBackgroundImages(t);var e=t.nodeType;if(e&&d[e]){for(var i=t.querySelectorAll("img"),n=0;n<i.length;n++){var o=i[n];this.addImage(o)}if("string"==typeof this.options.background){var r=t.querySelectorAll(this.options.background);for(n=0;n<r.length;n++){var s=r[n];this.addElementBackgroundImages(s)}}}};var d={1:!0,9:!0,11:!0};return o.prototype.addElementBackgroundImages=function(t){var e=getComputedStyle(t);if(e)for(var i=/url\((['"])?(.*?)\1\)/gi,n=i.exec(e.backgroundImage);null!==n;){var o=n&&n[2];o&&this.addBackground(o,t),n=i.exec(e.backgroundImage)}},o.prototype.addImage=function(t){var e=new r(t);this.images.push(e)},o.prototype.addBackground=function(t,e){var i=new s(t,e);this.images.push(i)},o.prototype.check=function(){function t(t,i,n){setTimeout(function(){e.progress(t,i,n)})}var e=this;return this.progressedCount=0,this.hasAnyBroken=!1,this.images.length?void this.images.forEach(function(e){e.once("progress",t),e.check()}):void this.complete()},o.prototype.progress=function(t,e,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!t.isLoaded,this.emitEvent("progress",[this,t,e]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,t),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&a&&a.log("progress: "+i,t,e)},o.prototype.complete=function(){var t=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(t,[this]),this.emitEvent("always",[this]),this.jqDeferred){var e=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[e](this)}},r.prototype=Object.create(e.prototype),r.prototype.check=function(){var t=this.getIsImageComplete();return t?void this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),void(this.proxyImage.src=this.img.src))},r.prototype.getIsImageComplete=function(){return this.img.complete&&void 0!==this.img.naturalWidth},r.prototype.confirm=function(t,e){this.isLoaded=t,this.emitEvent("progress",[this,this.img,e])},r.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},r.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},r.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},r.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},s.prototype=Object.create(r.prototype),s.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url;var t=this.getIsImageComplete();t&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},s.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},s.prototype.confirm=function(t,e){this.isLoaded=t,this.emitEvent("progress",[this,this.element,e])},o.makeJQueryPlugin=function(e){e=e||t.jQuery,e&&(h=e,h.fn.imagesLoaded=function(t,e){var i=new o(this,t,e);return i.jqDeferred.promise(h(this))})},o.makeJQueryPlugin(),o}); 4335 4336// ================================================== 4337// fancyBox v3.5.7 4338// 4339// Licensed GPLv3 for open source use 4340// or fancyBox Commercial License for commercial use 4341// 4342// http://fancyapps.com/fancybox/ 4343// Copyright 2019 fancyApps 4344// 4345// ================================================== 4346!function(c,a,h,g){"use strict";var i,s,r,d,e,l,f,u,o,t,n,p,b;function m(t,e){var n,o,i,s=[],a=0;t&&t.isDefaultPrevented()||(t.preventDefault(),e=e||{},t&&t.data&&(e=u(t.data.options,e)),n=e.$target||h(t.currentTarget).trigger("blur"),(i=h.fancybox.getInstance())&&i.$trigger&&i.$trigger.is(n)||(s=e.selector?h(e.selector):(o=n.attr("data-fancybox")||"")?(s=t.data?t.data.items:[]).length?s.filter('[data-fancybox="'+o+'"]'):h('[data-fancybox="'+o+'"]'):[n],(a=h(s).index(n))<0&&(a=0),(i=h.fancybox.open(s,e,a)).$trigger=n))}c.console=c.console||{info:function(t){}}
vendor: 4,881 bytes, line 4346
4346,h&&(h.fn.fancybox?console.info("fancyBox already initialized"):(t={closeExisting:!1,loop:!1,gutter:50,keyboard:!0,preventCaptionOverlap:!0,arrows:!0,infobar:!0,smallBtn:"auto",toolbar:"auto",buttons:["zoom","slideShow","thumbs","close"],idleTime:3,protect:!1,modal:!1,image:{preload:!1},ajax:{settings:{data:{fancybox:!0}}},iframe:{tpl:'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" allowfullscreen="allowfullscreen" allow="autoplay; fullscreen" src=""></iframe>',preload:!0,css:{},attr:{scrolling:"auto"}},video:{tpl:'<video class="fancybox-video" controls controlsList="nodownload" poster="{{poster}}"><source src="{{src}}" type="{{format}}" />Sorry, your browser doesn\'t support embedded videos, <a href="{{src}}">download</a> and watch with your favorite video player!</video>',format:"",autoStart:!0},defaultType:"image",animationEffect:"zoom",animationDuration:366,zoomOpacity:"auto",transitionEffect:"fade",transitionDuration:366,slideClass:"",baseClass:"",baseTpl:'<div class="fancybox-container" role="dialog" tabindex="-1"><div class="fancybox-bg"></div><div class="fancybox-inner"><div class="fancybox-infobar"><span data-fancybox-index></span> / <span data-fancybox-count></span></div><div class="fancybox-toolbar">{{buttons}}</div><div class="fancybox-navigation">{{arrows}}</div><div class="fancybox-stage"></div><div class="fancybox-caption"><div class="fancybox-caption__body"></div></div></div></div>',spinnerTpl:'<div class="fancybox-loading"></div>',errorTpl:'<div class="fancybox-error"><p>{{ERROR}}</p></div>',btnTpl:{download:'<a download data-fancybox-download class="fancybox-button fancybox-button--download" title="{{DOWNLOAD}}" href="javascript:;"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.62 17.09V19H5.38v-1.91zm-2.97-6.96L17 11.45l-5 4.87-5-4.87 1.36-1.32 2.68 2.64V5h1.92v7.77z"/></svg></a>',zoom:'<button data-fancybox-zoom class="fancybox-button fancybox-button--zoom" title="{{ZOOM}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.7 17.3l-3-3a5.9 5.9 0 0 0-.6-7.6 5.9 5.9 0 0 0-8.4 0 5.9 5.9 0 0 0 0 8.4 5.9 5.9 0 0 0 7.7.7l3 3a1 1 0 0 0 1.3 0c.4-.5.4-1 0-1.5zM8.1 13.8a4 4 0 0 1 0-5.7 4 4 0 0 1 5.7 0 4 4 0 0 1 0 5.7 4 4 0 0 1-5.7 0z"/></svg></button>',close:'<button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 10.6L6.6 5.2 5.2 6.6l5.4 5.4-5.4 5.4 1.4 1.4 5.4-5.4 5.4 5.4 1.4-1.4-5.4-5.4 5.4-5.4-1.4-1.4-5.4 5.4z"/></svg></button>',arrowLeft:'<button data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}"><div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.28 15.7l-1.34 1.37L5 12l4.94-5.07 1.34 1.38-2.68 2.72H19v1.94H8.6z"/></svg></div></button>',arrowRight:'<button data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}"><div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.4 12.97l-2.68 2.72 1.34 1.38L19 12l-4.94-5.07-1.34 1.38 2.68 2.72H5v1.94z"/></svg></div></button>',smallBtn:'<button type="button" data-fancybox-close class="fancybox-button fancybox-close-small" title="{{CLOSE}}"><svg xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 24 24"><path d="M13 12l5-5-1-1-5 5-5-5-1 1 5 5-5 5 1 1 5-5 5 5 1-1z"/></svg></button>'},parentEl:"body",hideScrollbar:!0,autoFocus:!0,backFocus:!0,trapFocus:!0,fullScreen:{autoStart:!1},touch:{vertical:!0,momentum:!0},hash:null,media:{},slideShow:{autoStart:!1,speed:3e3},thumbs:{autoStart:!1,hideOnClose:!0,parentEl:".fancybox-container",axis:"y"},wheel:"auto",onInit:h.noop,beforeLoad:h.noop,afterLoad:h.noop,beforeShow:h.noop,afterShow:h.noop,beforeClose:h.noop,afterClose:h.noop,onActivate:h.noop,onDeactivate:h.noop,clickContent:function(t,e){return"image"===t.type&&"zoom"},clickSlide:"close",clickOutside:"close",dblclickContent:!1,dblclickSlide:!1,dblclickOutside:!1,mobile:{preventCaptionOverlap:!1,idleTime:!1,clickContent:function(t,e){return"image"===t.type&&"toggleControls"},clickSlide:function(t,e){return"image"===t.type?"toggleControls":"close"},dblclickContent:function(t,e){return"image"===t.type&&"zoom"},dblclickSlide:function(t,e){return"image"===t.type&&"zoom"}},lang:"en",i18n:{en:{CLOSE:"Close",NEXT:"Next",PREV:"Previous",ERROR:"The requested content cannot be loaded. <br/> Please try again later.",PLAY_START:"Start slideshow",PLAY_STOP:"Pause slideshow",FULL_SCREEN:"Full screen",THUMBS:"Thumbnails",DOWNLOAD:"Download",SHARE:"Share",ZOOM:"Zoom"},de:{CLOSE:"Schließen",NEXT:"Weiter",PREV:"Zurück",ERROR:"Die angeforderten Daten konnten nicht geladen werden. <br/> Bitte versuchen Sie es später nochmal.",PLAY_START:"Diaschau starten",PLAY_STOP:"Diaschau beenden",FULL_SCREEN:"Vollbild",THUMBS:"Vorschaub
4346ilder",DOWNLOAD:"Herunterladen",SHARE:"Teilen",ZOOM:"Vergrößern"}}},i=h(c),s=h(a),r=0,d=c.requestAnimationFrame||c.webkitRequestAnimationFrame||c.mozRequestAnimationFrame||c.oRequestAnimationFrame||function(t){return c.setTimeout(t,1e3/60)},e=c.cancelAnimationFrame||c.webkitCancelAnimationFrame||c.mozCancelAnimationFrame||c.oCancelAnimationFrame||function(t){c.clearTimeout(t)},l=function(){var t,e=a.createElement("fakeelement"),n={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(t in n)if(e.style[t]!==g)return n[t];return"transitionend"}(),f=function(t){return t&&t.length&&t[0].offsetHeight},u=function(t,e){var n=h.extend(!0,{},t,e);return h.each(e,function(t,e){h.isArray(e)&&(n[t]=e)}),n},o=function(t,e,n){var o=this;o.opts=u({index:n},h.fancybox.defaults),h.isPlainObject(e)&&(o.opts=u(o.opts,e)),h.fancybox.isMobile&&(o.opts=u(o.opts,o.opts.mobile)),o.id=o.opts.id||++r,o.currIndex=parseInt(o.opts.index,10)||0,o.prevIndex=null,o.prevPos=null,o.currPos=0,o.firstRun=!0,o.group=[],o.slides={},o.addContent(t),o.group.length&&o.init()},h.extend(o.prototype,{init:function(){var e,n,o=this,i=o.group[o.currIndex].opts;i.closeExisting&&h.fancybox.close(!0),h("body").addClass("fancybox-active"),!h.fancybox.getInstance()&&!1!==i.hideScrollbar&&!h.fancybox.isMobile&&a.body.scrollHeight>c.innerHeight&&(h("head").append('<style id="fancybox-style-noscroll" type="text/css">.compensate-for-scrollbar{margin-right:'+(c.innerWidth-a.documentElement.clientWidth)+"px;}</style>"),h("body").addClass("compensate-for-scrollbar")),n="",h.each(i.buttons,function(t,e){n+=i.btnTpl[e]||""}),e=h(o.translate(o,i.baseTpl.replace("{{buttons}}",n).replace("{{arrows}}",i.btnTpl.arrowLeft+i.btnTpl.arrowRight))).attr("id","fancybox-container-"+o.id).addClass(i.baseClass).data("FancyBox",o).appendTo(i.parentEl),o.$refs={container:e},["bg","inner","infobar","toolbar","stage","caption","navigation"].forEach(function(t){o.$refs[t]=e.find(".fancybox-"+t)}),o.trigger("onInit"),o.activate(),o.jumpTo(o.currIndex)},translate:function(t,e){var n=t.opts.i18n[t.opts.lang]||t.opts.i18n.en;return e.replace(/\{\{(\w+)\}\}/g,function(t,e){return n[e]===g?t:n[e]})},addContent:function(t){var r=this,t=h.makeArray(t);h.each(t,function(t,e){var n,o,i,s={},a={};h.isPlainObject(e)?a=(s=e).opts||e:"object"===h.type(e)&&h(e).length?(a=(o=h(e)).data()||{},(a=h.extend(!0,{},a,a.options)).$orig=o,s.src=r.opts.src||a.src||o.attr("href"),s.type||s.src||(s.type="inline",s.src=e)):s={type:"html",src:e+""},s.opts=h.extend(!0,{},r.opts,a),h.isArray(a.buttons)&&(s.opts.buttons=a.buttons),h.fancybox.isMobile&&s.opts.mobile&&(s.opts=u(s.opts,s.opts.mobile)),n=s.type||s.opts.type,o=s.src||"",!n&&o&&((a=o.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(n="video",s.opts.video.format||(s.opts.video.format="video/"+("ogv"===a[1]?"ogg":a[1]))):o.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?n="image":o.match(/\.(pdf)((\?|#).*)?$/i)?(n="iframe",s=h.extend(!0,s,{contentType:"pdf",opts:{iframe:{preload:!1}}})):"#"===o.charAt(0)&&(n="inline")),n?s.type=n:r.trigger("objectNeedsType",s),s.contentType||(s.contentType=-1<h.inArray(s.type,["html","inline","ajax"])?"html":s.type),s.index=r.group.length,"auto"==s.opts.smallBtn&&(s.opts.smallBtn=-1<h.inArray(s.type,["html","inline","ajax"])),"auto"===s.opts.toolbar&&(s.opts.toolbar=!s.opts.smallBtn),s.$thumb=s.opts.$thumb||null,s.opts.$trigger&&s.index===r.opts.index&&(s.$thumb=s.opts.$trigger.find("img:first"),s.$thumb.length&&(s.opts.$orig=s.opts.$trigger)),s.$thumb&&s.$thumb.length||!s.opts.$orig||(s.$thumb=s.opts.$orig.find("img:first")),s.$thumb&&!s.$thumb.length&&(s.$thumb=null),s.thumb=s.opts.thumb||(s.$thumb?s.$thumb[0].src:null),"function"===h.type(s.opts.caption)&&(s.opts.caption=s.opts.caption.apply(e,[r,s])),"function"===h.type(r.opts.caption)&&(s.opts.caption=r.opts.caption.apply(e,[r,s])),s.opts.caption instanceof h||(s.opts.caption=s.opts.caption===g?"":s.opts.caption+""),"ajax"===s.type&&1<(i=o.split(/\s+/,2)).length&&(s.src=i.shift(),s.opts.filter=i.shift()),s.opts.modal&&(s.opts=h.extend(!0,s.opts,{trapFocus:!0,infobar:0,toolbar:0,smallBtn:0,keyboard:0,slideShow:0,fullScreen:0,thumbs:0,touch:0,clickContent:!1,clickSlide:!1,clickOutside:!1,dblclickContent:!1,dblclickSlide:!1,dblclickOutside:!1})),r.group.push(s)}),Object.keys(r.slides).length&&(r.updateControls(),(t=r.Thumbs)&&t.isActive&&(t.create(),t.focus()))},addEvents:function(){var o=this;o.removeEvents(),o.$refs.container.on("click.fb-close","[data-fancybox-close]",function(t){t.stopPropagation(),t.preventDefault(),o.close(t)}).on("touchstart.fb-prev click.fb-prev","[data-fancybox-prev]",function(t){t.stopPropagation(),t.preventDefault(),o.previous()}).on("touchstart.fb-next click.fb-next","[data-fancybox-next]",function(t){t.stopPropagation(),t.preventDefault(),o.next()}).on("click.fb","[data-fancybox-zoom]",function(t){o[o.isScaledDown()?"scaleToActual":"scaleToFit"]()}),i.on("orientationchange.fb resize.fb",function(t){t&&t.originalEvent&&"resize"===t.originalEvent.type?(o.requestId&&e(o.requestId),o.requestId=d(function(){o.update(t)})):(o.current&&"iframe"===o.current.type&&o.$refs.stage.hide(),setTimeout(function(){o.$refs.stage.show(),o.update(t)},h.fancybox.isMobile?600:250))}),s.on("keydown.fb",function(t){var e=(h.fancybox?h.fancybox.getInstance():null).current,n=t.keyCode||t.which;if(9!=n){if(!(!e.opts.keyboard||t.ctrlKey||t.altKey||t.shiftKey||h(t.target).is("input,textarea,video,audio,select")))return 8===n||27===n?(t.preventDefault(),void o.close(t)):37===n||38===n?(t.preventDefault(),void o.previous()):39===n||40===n?(t.preventDefault(),void o.next()):void o.trigger("afterKeydown",t,n)}else e.opts.trapFocus&&o.focus(t)}),o.group[o.currIndex].opts.idleTime&&(o.idleSecondsCounter=0,s.on("mousemove.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle",function(t){o.idleSecondsCounter=0,o.isIdle&&o.showControls(),o.isIdle=!1}),o.idleInterval=c.setInterval(function(){o.idleSecondsCounter++,o.idleSecondsCounter>=o.group[o.currIndex].opts.idleTime&&!o.isDragging&&(o.isIdle=!0,o.idleSecondsCounter=0,o.hideControls())},1e3))},removeEvents:function(){i.off("orientationchange.fb resize.fb"),s.off("keydown.fb .fb-idle"),this.$refs.container.off(".fb-close .fb-prev .fb-next"),this.idleInterval&&(c.clearInterval(this.idleInterval),this.idleInterval=null)},previous:function(t){return this.jumpTo(this.currPos-1,t)},next:function(t){return this.jumpTo(this.currPos+1,t)},jumpTo:function(t,o){var e,n,i,s,a,r,c,l,d=this,u=d.group.length;if(!(d.isDragging||d.isClosing||d.isAnimating&&d.firstRun))return t=parseInt(t,10),!(!(n=(d.current||d).opts.loop)&&(t<0||u<=t))&&(e=d.firstRun=!Object.keys(d.slides).length,s=d.current,d.prevIndex=d.currIndex,d.prevPos=d.currPos,i=d.createSlide(t),1<u&&((n||i.index<u-1)&&d.createSlide(t+1),(n||0<i.index)&&d.createSlide(t-1)),d.current=i,d.currIndex=i.index,d.currPos=i.pos,d.trigger("beforeShow",e),d.updateControls(),i.forcedDuration=g,h.isNumeric(o)?i.forcedDuration=o:o=i.opts[e?"animationDuration":"transitionDuration"],o=parseInt(o,10),t=d.isMoved(i),i.$slide.addClass("fancybox-slide--current"),e?(i.opts.animationEffect&&o&&d.$refs.container.css("transition-duration",o+"ms"),d.$refs.container.addClass("fancybox-is-open").trigger("focus"),d.loadSlide(i)):(a=h.fancybox.getTranslate(s.$slide),r=h.fancybox.getTranslate(d.$refs.stage),h.each(d.slides,function(t,e){h.fancybox.stop(e.$slide,!0)}),s.pos!==i.pos&&(s.isComplete=!1),s.$slide.removeClass("fancybox-slide--complete fancybox-slide--current"),t?(l=a.left-(s.pos*a.width+s.pos*s.opts.gutter),h.each(d.slides,function(t,e){e.$slide.removeClass("fancybox-animated").removeClass(function(t,e){return(e.match(/(^|\s)fancybox-fx-\S+/g)||[]).join(" ")});var n=e.pos*a.width+e.pos*e.opts.gutter;h.fancybox.setTranslate(e.$slide,{top:0,left:n-r.left+l}),e.pos!==i.pos&&e.$slide.addClass("fancybox-slide--"+(e.pos>i.pos?"next":"previous")),f(e.$slide),h.fancybox.animate(e.$slide,{top:0,left:(e.pos-i.pos)*a.width+(e.pos-i.pos)*e.opts.gutter},o,function(){e.$slide.css({transform:"",opacity:""}).removeClass("fancybox-slide--next fancybox-slide--previous"),e.pos===d.currPos&&d.complete()})})):o&&i.opts.transitionEffect&&(c="fancybox-animated fancybox-fx-"+i.opts.transitionEffect,s.$slide.addClass("fancybox-slide--"+(s.pos>i.pos?"next":"previous")),h.fancybox.animate(s.$slide,c,o,function(){s.$slide.removeClass(c).removeClass("fancybox-slide--next fancybox-slide--previous")},!1)),i.isLoaded?d.revealContent(i):d.loadSlide(i)),void d.preload("image"))},createSlide:function(t){var e,n=this,o=t%n.group.length;return o=o<0?n.group.length+o:o,!n.slides[t]&&n.group[o]&&(e=h('<div class="fancybox-slide"></div>').appendTo(n.$refs.stage),n.slides[t]=h.extend(!0,{},n.group[o],{pos:t,$slide:e,isLoaded:!1}),n.updateSlide(n.slides[t])),n.slides[t]},scaleToActual:function(t,e,n){var o,i,s,a,r=this,c=r.current,l=c.$content,d=h.fancybox.getTranslate(c.$slide).width,u=h.fancybox.getTranslate(c.$slide).height,f=c.width,p=c.height;r.isAnimating||r.isMoved()||!l||"image"!=c.type||!c.isLoaded||c.hasError||(r.isAnimating=!0,h.fancybox.stop(l),t=t===g?.5*d:t,e=e===g?.5*u:e,(o=h.fancybox.getTranslate(l)).top-=h.fancybox.getTranslate(c.$slide).top,o.left-=h.fancybox.getTranslate(c.$slide).left,s=f/o.width,a=p/o.height,i=.5*d-.5*f,c=.5*u-.5*p,d<f&&(0<(i=o.left*s-(t*s-t))&&(i=0),i<d-f&&(i=d-f)),u<p&&(0<(c=o.top*a-(e*a-e))&&(c=0),c<u-p&&(c=u-p)),r.updateCursor(f,p),h.fancybox.animate(l,{top:c,left:i,scaleX:s,scaleY:a},n||366,function(){r.isAnimating=!1}),r.SlideShow&&r.SlideShow.isActive&&r.SlideShow.stop())},scaleToFit:function(t){var e=this,n=e.current,o=n.$content;e.isAnimating||e.isMoved()||!o||"image"!=n.type||!n.isLoaded||n.hasError||(e.isAnimating=!0,h.fancybox.stop(o),n=e.getFitPos(n),e.updateCursor(n.width,n.height),h.fancybox.animate(o,{top:n.top,left
4346:n.left,scaleX:n.width/o.width(),scaleY:n.height/o.height()},t||366,function(){e.isAnimating=!1}))},getFitPos:function(t){var e,n,o=t.$content,i=t.$slide,s=t.width||t.opts.width,a=t.height||t.opts.height,r={};return!!(t.isLoaded&&o&&o.length)&&(e=h.fancybox.getTranslate(this.$refs.stage).width,n=h.fancybox.getTranslate(this.$refs.stage).height,e-=parseFloat(i.css("paddingLeft"))+parseFloat(i.css("paddingRight"))+parseFloat(o.css("marginLeft"))+parseFloat(o.css("marginRight")),n-=parseFloat(i.css("paddingTop"))+parseFloat(i.css("paddingBottom"))+parseFloat(o.css("marginTop"))+parseFloat(o.css("marginBottom")),s&&a||(s=e,a=n),e-.5<(s*=o=Math.min(1,e/s,n/a))&&(s=e),n-.5<(a*=o)&&(a=n),"image"===t.type?(r.top=Math.floor(.5*(n-a))+parseFloat(i.css("paddingTop")),r.left=Math.floor(.5*(e-s))+parseFloat(i.css("paddingLeft"))):"video"===t.contentType&&(s/(t=t.opts.width&&t.opts.height?s/a:t.opts.ratio||16/9)<a?a=s/t:a*t<s&&(s=a*t)),r.width=s,r.height=a,r)},update:function(n){var o=this;h.each(o.slides,function(t,e){o.updateSlide(e,n)})},updateSlide:function(t,e){var n=this,o=t&&t.$content,i=t.width||t.opts.width,s=t.height||t.opts.height,a=t.$slide;n.adjustCaption(t),o&&(i||s||"video"===t.contentType)&&!t.hasError&&(h.fancybox.stop(o),h.fancybox.setTranslate(o,n.getFitPos(t)),t.pos===n.currPos&&(n.isAnimating=!1,n.updateCursor())),n.adjustLayout(t),a.length&&(a.trigger("refresh"),t.pos===n.currPos&&n.$refs.toolbar.add(n.$refs.navigation.find(".fancybox-button--arrow_right")).toggleClass("compensate-for-scrollbar",a.get(0).scrollHeight>a.get(0).clientHeight)),n.trigger("onUpdate",t,e)},centerSlide:function(t){var e=this,n=e.current,o=n.$slide;!e.isClosing&&n&&(o.siblings().css({transform:"",opacity:""}),o.parent().children().removeClass("fancybox-slide--previous fancybox-slide--next"),h.fancybox.animate(o,{top:0,left:0,opacity:1},t===g?0:t,function(){o.css({transform:"",opacity:""}),n.isComplete||e.complete()},!1))},isMoved:function(t){var e,n=t||this.current;return!!n&&(e=h.fancybox.getTranslate(this.$refs.stage),t=h.fancybox.getTranslate(n.$slide),!n.$slide.hasClass("fancybox-animated")&&(.5<Math.abs(t.top-e.top)||.5<Math.abs(t.left-e.left)))},updateCursor:function(t,e){var n=this,o=n.current,i=n.$refs.container;o&&!n.isClosing&&n.Guestures&&(i.removeClass("fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-zoomOut fancybox-can-swipe fancybox-can-pan"),e=!!(t=n.canPan(t,e))||n.isZoomable(),i.toggleClass("fancybox-is-zoomable",e),h("[data-fancybox-zoom]").prop("disabled",!e),t?i.addClass("fancybox-can-pan"):e&&("zoom"===o.opts.clickContent||h.isFunction(o.opts.clickContent)&&"zoom"==o.opts.clickContent(o))?i.addClass("fancybox-can-zoomIn"):o.opts.touch&&(o.opts.touch.vertical||1<n.group.length)&&"video"!==o.contentType&&i.addClass("fancybox-can-swipe"))},isZoomable:function(){var t,e=this.current;if(e&&!this.isClosing&&"image"===e.type&&!e.hasError){if(!e.isLoaded)return!0;if((t=this.getFitPos(e))&&(e.width>t.width||e.height>t.height))return!0}return!1},isScaledDown:function(t,e){var n=!1,o=this.current,i=o.$content;return t!==g&&e!==g?n=t<o.width&&e<o.height:i&&(n=(n=h.fancybox.getTranslate(i)).width<o.width&&n.height<o.height),n},canPan:function(t,e){var n=this.current,o=null,i=!1;return"image"===n.type&&(n.isComplete||t&&e)&&!n.hasError&&(i=this.getFitPos(n),t!==g&&e!==g?o={width:t,height:e}:n.isComplete&&(o=h.fancybox.getTranslate(n.$content)),o&&i&&(i=1.5<Math.abs(o.width-i.width)||1.5<Math.abs(o.height-i.height))),i},loadSlide:function(n){var t,e,o,i=this;if(!n.isLoading&&!n.isLoaded){if(!(n.isLoading=!0)===i.trigger("beforeLoad",n))return n.isLoading=!1;switch(t=n.type,(e=n.$slide).off("refresh").trigger("onReset").addClass(n.opts.slideClass),t){case"image":i.setImage(n);break;case"iframe":i.setIframe(n);break;case"html":i.setContent(n,n.src||n.content);break;case"video":i.setContent(n,n.opts.video.tpl.replace(/\{\{src\}\}/gi,n.src).replace("{{format}}",n.opts.videoFormat||n.opts.video.format||"").replace("{{poster}}",n.thumb||""));break;case"inline":h(n.src).length?i.setContent(n,h(n.src)):i.setError(n);break;case"ajax":i.showLoading(n),o=h.ajax(h.extend({},n.opts.ajax.settings,{url:n.src,success:function(t,e){"success"===e&&i.setContent(n,t)},error:function(t,e){t&&"abort"!==e&&i.setError(n)}})),e.one("onReset",function(){o.abort()});break;default:i.setError(n)}return!0}},setImage:function(e){var t,n=this;setTimeout(function(){var t=e.$image;n.isClosing||!e.isLoading||t&&t.length&&t[0].complete||e.hasError||n.showLoading(e)},50),n.checkSrcset(e),e.$content=h('<div class="fancybox-content"></div>').addClass("fancybox-is-hidden").appendTo(e.$slide.addClass("fancybox-slide--image")),!1!==e.opts.preload&&e.opts.width&&e.opts.height&&e.thumb&&(e.width=e.opts.width,e.height=e.opts.height,(t=a.createElement("img")).onerror=function(){h(this).remove(),e.$ghost=null},t.onload=function(){n.afterLoad(e)},e.$ghost=h(t).addClass("fancybox-image").appendTo(e.$content).attr("src",e.thumb)),n.setBigImage(e)}
vendor: 5,216 bytes, line 4346
4346,checkSrcset:function(t){var e,n,o,i,s=t.opts.srcset||t.opts.image.srcset;if(s){o=c.devicePixelRatio||1,i=c.innerWidth*o,(n=s.split(",").map(function(t){var o={};return t.trim().split(/\s+/).forEach(function(t,e){var n=parseInt(t.substring(0,t.length-1),10);if(0===e)return o.url=t;n&&(o.value=n,o.postfix=t[t.length-1])}),o})).sort(function(t,e){return t.value-e.value});for(var a=0;a<n.length;a++){var r=n[a];if("w"===r.postfix&&r.value>=i||"x"===r.postfix&&r.value>=o){e=r;break}}!e&&n.length&&(e=n[n.length-1]),e&&(t.src=e.url,t.width&&t.height&&"w"==e.postfix&&(t.height=t.width/t.height*e.value,t.width=e.value),t.opts.srcset=s)}},setBigImage:function(e){var n=this,t=a.createElement("img"),o=h(t);e.$image=o.one("error",function(){n.setError(e)}).one("load",function(){var t;e.$ghost||(n.resolveImageSlideSize(e,this.naturalWidth,this.naturalHeight),n.afterLoad(e)),n.isClosing||(e.opts.srcset&&((t=e.opts.sizes)&&"auto"!==t||(t=(1<e.width/e.height&&1<i.width()/i.height()?"100":Math.round(e.width/e.height*100))+"vw"),o.attr("sizes",t).attr("srcset",e.opts.srcset)),e.$ghost&&setTimeout(function(){e.$ghost&&!n.isClosing&&e.$ghost.hide()},Math.min(300,Math.max(1e3,e.height/1600))),n.hideLoading(e))}).addClass("fancybox-image").attr("src",e.src).appendTo(e.$content),(t.complete||"complete"==t.readyState)&&o.naturalWidth&&o.naturalHeight?o.trigger("load"):t.error&&o.trigger("error")},resolveImageSlideSize:function(t,e,n){var o=parseInt(t.opts.width,10),i=parseInt(t.opts.height,10);t.width=e,t.height=n,0<o&&(t.width=o,t.height=Math.floor(o*n/e)),0<i&&(t.width=Math.floor(i*e/n),t.height=i)},setIframe:function(i){var s,e=this,a=i.opts.iframe,r=i.$slide;i.$content=h('<div class="fancybox-content'+(a.preload?" fancybox-is-hidden":"")+'"></div>').css(a.css).appendTo(r),r.addClass("fancybox-slide--"+i.contentType),i.$iframe=s=h(a.tpl.replace(/\{rnd\}/g,(new Date).getTime())).attr(a.attr).appendTo(i.$content),a.preload?(e.showLoading(i),s.on("load.fb error.fb",function(t){this.isReady=1,i.$slide.trigger("refresh"),e.afterLoad(i)}),r.on("refresh.fb",function(){var t,e=i.$content,n=a.css.width,o=a.css.height;if(1===s[0].isReady){try{t=s.contents().find("body")}catch(t){}t&&t.length&&t.children().length&&(r.css("overflow","visible"),e.css({width:"100%","max-width":"100%",height:"9999px"}),n===g&&(n=Math.ceil(Math.max(t[0].clientWidth,t.outerWidth(!0)))),e.css("width",n||"").css("max-width",""),o===g&&(o=Math.ceil(Math.max(t[0].clientHeight,t.outerHeight(!0)))),e.css("height",o||""),r.css("overflow","auto")),e.removeClass("fancybox-is-hidden")}})):e.afterLoad(i),s.attr("src",i.src),r.one("onReset",function(){try{h(this).find("iframe").hide().unbind().attr("src","//about:blank")}catch(t){}h(this).off("refresh.fb").empty(),i.isLoaded=!1,i.isRevealed=!1})},setContent:function(t,e){var n;this.isClosing||(this.hideLoading(t),t.$content&&h.fancybox.stop(t.$content),t.$slide.empty(),(n=e)&&n.hasOwnProperty&&n instanceof h&&e.parent().length?((e.hasClass("fancybox-content")||e.parent().hasClass("fancybox-content"))&&e.parents(".fancybox-slide").trigger("onReset"),t.$placeholder=h("<div>").hide().insertAfter(e),e.css("display","inline-block")):t.hasError||("string"===h.type(e)&&(e=h("<div>").append(h.trim(e)).contents()),t.opts.filter&&(e=h("<div>").html(e).find(t.opts.filter))),t.$slide.one("onReset",function(){h(this).find("video,audio").trigger("pause"),t.$placeholder&&(t.$placeholder.after(e.removeClass("fancybox-content").hide()).remove(),t.$placeholder=null),t.$smallBtn&&(t.$smallBtn.remove(),t.$smallBtn=null),t.hasError||(h(this).empty(),t.isLoaded=!1,t.isRevealed=!1)}),h(e).appendTo(t.$slide),h(e).is("video,audio")&&(h(e).addClass("fancybox-video"),h(e).wrap("<div></div>"),t.contentType="video",t.opts.width=t.opts.width||h(e).attr("width"),t.opts.height=t.opts.height||h(e).attr("height")),t.$content=t.$slide.children().filter("div,form,main,video,audio,article,.fancybox-content").first(),t.$content.siblings().hide(),t.$content.length||(t.$content=t.$slide.wrapInner("<div></div>").children().first()),t.$content.addClass("fancybox-content"),t.$slide.addClass("fancybox-slide--"+t.contentType),this.afterLoad(t))},setError:function(t){t.hasError=!0,t.$slide.trigger("onReset").removeClass("fancybox-slide--"+t.contentType).addClass("fancybox-slide--error"),t.contentType="html",this.setContent(t,this.translate(t,t.opts.errorTpl)),t.pos===this.currPos&&(this.isAnimating=!1)},showLoading:function(t){(t=t||this.current)&&!t.$spinner&&(t.$spinner=h(this.translate(this,this.opts.spinnerTpl)).appendTo(t.$slide).hide().fadeIn("fast"))},hideLoading:function(t){(t=t||this.current)&&t.$spinner&&(t.$spinner.stop().remove(),delete t.$spinner)},afterLoad:function(t){var e=this;e.isClosing||(t.isLoading=!1,t.isLoaded=!0,e.trigger("afterLoad",t),e.hideLoading(t),!t.opts.smallBtn||t.$smallBtn&&t.$smallBtn.length||(t.$smallBtn=h(e.translate(t,t.opts.btnTpl.smallBtn)).appendTo(t.$content)),t.opts.protect&&t.$content&&!t.hasError&&(t.$content.on("contextmenu.fb",function(t){return 2==t.button&&t.preventDefault(),!0}),"image"===t.type&&h('<div class="fancybox-spaceball"></div>').appendTo(t.$content)),e.adjustCaption(t),e.adjustLayout(t),t.pos===e.currPos&&e.updateCursor(
4346),e.revealContent(t))},adjustCaption:function(t){var e=this,n=t||e.current,o=n.opts.caption,i=n.opts.preventCaptionOverlap,s=e.$refs.caption,t=!1;s.toggleClass("fancybox-caption--separate",i),i&&o&&o.length&&(n.pos!==e.currPos?((s=s.clone().appendTo(s.parent())).children().eq(0).empty().html(o),t=s.outerHeight(!0),s.empty().remove()):e.$caption&&(t=e.$caption.outerHeight(!0)),n.$slide.css("padding-bottom",t||""))},adjustLayout:function(t){var e,n,o,i=t||this.current;i.isLoaded&&!0!==i.opts.disableLayoutFix&&(i.$content.css("margin-bottom",""),i.$content.outerHeight()>i.$slide.height()+.5&&(n=i.$slide[0].style["padding-bottom"],o=i.$slide.css("padding-bottom"),0<parseFloat(o)&&(t=i.$slide[0].scrollHeight,i.$slide.css("padding-bottom",0),Math.abs(t-i.$slide[0].scrollHeight)<1&&(e=o),i.$slide.css("padding-bottom",n))),i.$content.css("margin-bottom",e))},revealContent:function(t){var e,n,o,i,s=this,a=t.$slide,r=!1,c=!1,l=s.isMoved(t),d=t.isRevealed;return t.isRevealed=!0,e=t.opts[s.firstRun?"animationEffect":"transitionEffect"],o=t.opts[s.firstRun?"animationDuration":"transitionDuration"],o=parseInt(t.forcedDuration===g?o:t.forcedDuration,10),!l&&t.pos===s.currPos&&o||(e=!1),"zoom"===e&&(t.pos===s.currPos&&o&&"image"===t.type&&!t.hasError&&(c=s.getThumbPos(t))?r=s.getFitPos(t):e="fade"),"zoom"===e?(s.isAnimating=!0,r.scaleX=r.width/c.width,r.scaleY=r.height/c.height,"auto"==(i=t.opts.zoomOpacity)&&(i=.1<Math.abs(t.width/t.height-c.width/c.height)),i&&(c.opacity=.1,r.opacity=1),h.fancybox.setTranslate(t.$content.removeClass("fancybox-is-hidden"),c),f(t.$content),void h.fancybox.animate(t.$content,r,o,function(){s.isAnimating=!1,s.complete()})):(s.updateSlide(t),e?(h.fancybox.stop(a),n="fancybox-slide--"+(t.pos>=s.prevPos?"next":"previous")+" fancybox-animated fancybox-fx-"+e,a.addClass(n).removeClass("fancybox-slide--current"),t.$content.removeClass("fancybox-is-hidden"),f(a),"image"!==t.type&&t.$content.hide().show(0),void h.fancybox.animate(a,"fancybox-slide--current",o,function(){a.removeClass(n).css({transform:"",opacity:""}),t.pos===s.currPos&&s.complete()},!0)):(t.$content.removeClass("fancybox-is-hidden"),d||!l||"image"!==t.type||t.hasError||t.$content.hide().fadeIn("fast"),void(t.pos===s.currPos&&s.complete())))},getThumbPos:function(t){var e,n,o,i,s=t.$thumb;return!!(s&&(o=s[0])&&o.ownerDocument===a&&(h(".fancybox-container").css("pointer-events","none"),i={x:o.getBoundingClientRect().left+o.offsetWidth/2,y:o.getBoundingClientRect().top+o.offsetHeight/2},o=a.elementFromPoint(i.x,i.y)===o,h(".fancybox-container").css("pointer-events",""),o))&&(n=h.fancybox.getTranslate(s),t=parseFloat(s.css("border-top-width")||0),i=parseFloat(s.css("border-right-width")||0),o=parseFloat(s.css("border-bottom-width")||0),s=parseFloat(s.css("border-left-width")||0),e={top:n.top+t,left:n.left+s,width:n.width-i-s,height:n.height-t-o,scaleX:1,scaleY:1},0<n.width&&0<n.height&&e)},complete:function(){var t,n=this,e=n.current,o={};!n.isMoved()&&e.isLoaded&&(e.isComplete||(e.isComplete=!0,e.$slide.siblings().trigger("onReset"),n.preload("inline"),f(e.$slide),e.$slide.addClass("fancybox-slide--complete"),h.each(n.slides,function(t,e){e.pos>=n.currPos-1&&e.pos<=n.currPos+1?o[e.pos]=e:e&&(h.fancybox.stop(e.$slide),e.$slide.off().remove())}),n.slides=o),n.isAnimating=!1,n.updateCursor(),n.trigger("afterShow"),e.opts.video.autoStart&&e.$slide.find("video,audio").filter(":visible:first").trigger("play").one("ended",function(){Document.exitFullscreen?Document.exitFullscreen():this.webkitExitFullscreen&&this.webkitExitFullscreen(),n.next()}),e.opts.autoFocus&&"html"===e.contentType&&((t=e.$content.find("input[autofocus]:enabled:visible:first")).length?t.trigger("focus"):n.focus(null,!0)),e.$slide.scrollTop(0).scrollLeft(0))},preload:function(t){var e,n,o=this;o.group.length<2||(n=o.slides[o.currPos+1],(e=o.slides[o.currPos-1])&&e.type===t&&o.loadSlide(e),n&&n.type===t&&o.loadSlide(n))},focus:function(t,e){var n=this,o=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not
4346([tabindex^="-"])'].join(",");n.isClosing||((e=(e=!t&&n.current&&n.current.isComplete?n.current.$slide.find("*:visible"+(e?":not(.fancybox-close-small)":"")):n.$refs.container.find("*:visible")).filter(o).filter(function(){return"hidden"!==h(this).css("visibility")&&!h(this).hasClass("disabled")})).length?(o=e.index(a.activeElement),t&&t.shiftKey?(o<0||0==o)&&(t.preventDefault(),e.eq(e.length-1).trigger("focus")):(o<0||o==e.length-1)&&(t&&t.preventDefault(),e.eq(0).trigger("focus"))):n.$refs.container.trigger("focus"))},activate:function(){var e=this;h(".fancybox-container").each(function(){var t=h(this).data("FancyBox");t&&t.id!==e.id&&!t.isClosing&&(t.trigger("onDeactivate"),t.removeEvents(),t.isVisible=!1)}),e.isVisible=!0,(e.current||e.isIdle)&&(e.update(),e.updateControls()),e.trigger("onActivate"),e.addEvents()},close:function(t,e){function n(){c.cleanUp(t)}var o,i,s,a,r,c=this,l=c.current;return!c.isClosing&&(!(c.isClosing=!0)===c.trigger("beforeClose",t)?(c.isClosing=!1,d(function(){c.update()}),!1):(c.removeEvents(),s=l.$content,o=l.opts.animationEffect,i=h.isNumeric(e)?e:o?l.opts.animationDuration:0,l.$slide.removeClass("fancybox-slide--complete fancybox-slide--next fancybox-slide--previous fancybox-animated"),!0!==t?h.fancybox.stop(l.$slide):o=!1,l.$slide.siblings().trigger("onReset").remove(),i&&c.$refs.container.removeClass("fancybox-is-open").addClass("fancybox-is-closing").css("transition-duration",i+"ms"),c.hideLoading(l),c.hideControls(!0),c.updateCursor(),"zoom"!==o||s&&i&&"image"===l.type&&!c.isMoved()&&!l.hasError&&(r=c.getThumbPos(l))||(o="fade"),"zoom"===o?(h.fancybox.stop(s),e={top:(a=h.fancybox.getTranslate(s)).top,left:a.left,scaleX:a.width/r.width,scaleY:a.height/r.height,width:r.width,height:r.height},"auto"==(a=l.opts.zoomOpacity)&&(a=.1<Math.abs(l.width/l.height-r.width/r.height)),a&&(r.opacity=0),h.fancybox.setTranslate(s,e),f(s),h.fancybox.animate(s,r,i,n)):o&&i?h.fancybox.animate(l.$slide.addClass("fancybox-slide--previous").removeClass("fancybox-slide--current"),"fancybox-animated fancybox-fx-"+o,i,n):!0===t?setTimeout(n,i):n(),!0))},cleanUp:function(t){var e,n=this,o=n.current.opts.$orig;n.current.$slide.trigger("onReset"),n.$refs.container.empty().remove(),n.trigger("afterClose",t),n.current.opts.backFocus&&(o&&o.length&&o.is(":visible")||(o=n.$trigger),o&&o.length&&(e=c.scrollX,t=c.scrollY,o.trigger("focus"),h("html, body").scrollTop(t).scrollLeft(e))),n.current=null,(n=h.fancybox.getInstance())?n.activate():(h("body").removeClass("fancybox-active compensate-for-scrollbar"),h("#fancybox-style-noscroll").remove())},trigger:function(t,e){var n,o=Array.prototype.slice.call(arguments,1),i=this,e=e&&e.opts?e:i.current;if(e?o.unshift(e):e=i,o.unshift(i),h.isFunction(e.opts[t])&&(n=e.opts[t].apply(e,o)),!1===n)return n;("afterClose"!==t&&i.$refs?i.$refs.container:s).trigger(t+".fb",o)},updateControls:function(){var t=this,e=t.current,n=e.index,o=t.$refs.container,i=t.$refs.caption,s=e.opts.caption;e.$slide.trigger("refresh"),s&&s.length?(t.$caption=i).children().eq(0).html(s):t.$caption=null,t.hasHiddenControls||t.isIdle||t.showControls(),o.find("[data-fancybox-count]").html(t.group.length),o.find("[data-fancybox-index]").html(n+1),o.find("[data-fancybox-prev]").prop("disabled",!e.opts.loop&&n<=0),o.find("[data-fancybox-next]").prop("disabled",!e.opts.loop&&n>=t.group.length-1),"image"===e.type?o.find("[data-fancybox-zoom]").show().end().find("[data-fancybox-download]").attr("href",e.opts.image.src||e.src).show():e.opts.toolbar&&o.find("[data-fancybox-download],[data-fancybox-zoom]").hide(),h(a.activeElement).is(":hidden,[disabled]")&&t.$refs.container.trigger("focus")},hideControls:function(t){var e=["infobar","toolbar","nav"];!t&&this.current.opts.preventCaptionOverlap||e.push("caption"),this.$refs.container.removeClass(e.map(function(t){return"fancybox-show-"+t}).join(" ")),this.hasHiddenControls=!0},showControls:function(){var t=this,e=(t.current||t).opts,n=t.$refs.container;t.hasHiddenControls=!1,t.idleSecondsCounter=0,n.toggleClass("fancybox-show-toolbar",!(!e.toolbar||!e.buttons)).toggleClass("fancybox-show-infobar",!!(e.infobar&&1<t.group.length)).toggleClass("fancybox-show-caption",!!t.$caption).toggleClass("fancybox-show-nav",!!(e.arrows&&1<t.group.length)).toggleClass("fancybox-is-modal",!!e.modal)}
4346,toggleControls:function(){this.hasHiddenControls?this.showControls():this.hideControls()}}),h.fancybox={version:"3.5.7",defaults:t,getInstance:function(t){var e=h('.fancybox-container:not(".fancybox-is-closing"):last').data("FancyBox"),n=Array.prototype.slice.call(arguments,1);return e instanceof o&&("string"===h.type(t)?e[t].apply(e,n):"function"===h.type(t)&&t.apply(e,n),e)},open:function(t,e,n){return new o(t,e,n)},close:function(t){var e=this.getInstance();e&&(e.close(),!0===t&&this.close(t))},destroy:function(){this.close(!0),s.add("body").off("click.fb-start","**")},isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),use3d:(t=a.createElement("div"),c.getComputedStyle&&c.getComputedStyle(t)&&c.getComputedStyle(t).getPropertyValue("transform")&&!(a.documentMode&&a.documentMode<11)),getTranslate:function(t){var e;return!(!t||!t.length)&&{top:(e=t[0].getBoundingClientRect()).top||0,left:e.left||0,width:e.width,height:e.height,opacity:parseFloat(t.css("opacity"))}},setTranslate:function(t,e){var n="",o={};if(t&&e)return e.left===g&&e.top===g||(n=(e.left===g?t.position():e).left+"px, "+(e.top===g?t.position():e).top+"px",n=this.use3d?"translate3d("+n+", 0px)":"translate("+n+")"),e.scaleX!==g&&e.scaleY!==g?n+=" scale("+e.scaleX+", "+e.scaleY+")":e.scaleX!==g&&(n+=" scaleX("+e.scaleX+")"),n.length&&(o.transform=n),e.opacity!==g&&(o.opacity=e.opacity),e.width!==g&&(o.width=e.width),e.height!==g&&(o.height=e.height),t.css(o)},animate:function(e,n,o,i,s){var a,r=this;h.isFunction(o)&&(i=o,o=null),r.stop(e),a=r.getTranslate(e),e.on(l,function(t){t&&t.originalEvent&&(!e.is(t.originalEvent.target)||"z-index"==t.originalEvent.propertyName)||(r.stop(e),h.isNumeric(o)&&e.css("transition-duration",""),h.isPlainObject(n)?n.scaleX!==g&&n.scaleY!==g&&r.setTranslate(e,{top:n.top,left:n.left,width:a.width*n.scaleX,height:a.height*n.scaleY,scaleX:1,scaleY:1}):!0!==s&&e.removeClass(n),h.isFunction(i)&&i(t))}),h.isNumeric(o)&&e.css("transition-duration",o+"ms"),h.isPlainObject(n)?(n.scaleX!==g&&n.scaleY!==g&&(delete n.width,delete n.height,e.parent().hasClass("fancybox-slide--image")&&e.parent().addClass("fancybox-is-scaling")),h.fancybox.setTranslate(e,n)):e.addClass(n),e.data("timer",setTimeout(function(){e.trigger(l)},o+33))},stop:function(t,e){t&&t.length&&(clearTimeout(t.data("timer")),e&&t.trigger(l),t.off(l).css("transition-duration",""),t.parent().removeClass("fancybox-is-scaling"))}},h.fn.fancybox=function(t){var e;return(e=(t=t||{}).selector||!1)?h("body").off("click.fb-start",e).on("click.fb-start",e,{options:t},m):this.off("click.fb-start").on("click.fb-start",{items:this,options:t},m),this},s.on("click.fb-start","[data-fancybox]",m),s.on("click.fb-start","[data-fancybox-trigger]",function(t){h('[data-fancybox="'+h(this).attr("data-fancybox-trigger")+'"]').eq(h(this).attr("data-fancybox-index")||0).trigger("click.fb-start",{$trigger:h(this)})}),n=".fancybox-button",p="fancybox-focus",b=null,s.on("mousedown mouseup focus blur",n,function(t){switch(t.type){case"mousedown":b=h(this);break;case"mouseup":b=null;break;case"focusin":h(n).removeClass(p),h(this).is(b)||h(this).is("[disabled]")||h(this).addClass(p);break;case"focusout":h(n).removeClass(p)}})))}(window,document,jQuery),function(p){"use strict";function h(n,t,e){if(n)return e=e||"","object"===p.type(e)&&(e=p.param(e,!0)),p.each(t,function(t,e){n=n.replace("$"+t,e||"")}),e.length&&(n+=(0<n.indexOf("?")?"&":"?")+e),n}var o={youtube:{matcher:/(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i,params:{autoplay:1,autohide:1,fs:1,rel:0,hd:1,wmode:"transparent",enablejsapi:1,html5:1},paramPlace:8,type:"iframe",url:"https://www.youtube-nocookie.com/embed/$4",thumb:"https://img.youtube.com/vi/$4/hqdefault.jpg"},vimeo:{matcher:/^.+vimeo.com\/(.*\/)?([\d]+)(.*)?/,params:{autoplay:1,hd:1,show_title:1,show_byline:1,show_portrait:0,fullscreen:1},paramPlace:3,type:"iframe",url:"//player.vimeo.com/video/$2"},instagram:{matcher:/(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,type:"image",url:"//$1/p/$2/media/?size=l"},gmap_place:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i,type:"iframe",url:function(t){return"//maps.google."+t[2]+"/?ll="+(t[9]?t[9]+"&z="+Math.floor(t[10])+(t[12]?t[12].replace(/^\//,"&"):""):t[12]+"").replace(/\?/,"&")+"&output="+(t[12]&&
43460<t[12].indexOf("layer=c")?"svembed":"embed")}},gmap_search:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i,type:"iframe",url:function(t){return"//maps.google."+t[2]+"/maps?q="+t[5].replace("query=","q=").replace("api=1","")+"&output=embed"}}};p(document).on("objectNeedsType.fb",function(t,e,i){var s,a,r,c,l,d,u=i.src||"",f=!1,n=p.extend(!0,{},o,i.opts.media);p.each(n,function(t,e){if(a=u.match(e.matcher)){if(f=e.type,d=t,l={},e.paramPlace&&a[e.paramPlace]){"?"==(c=a[e.paramPlace])[0]&&(c=c.substring(1)),c=c.split("&");for(var n=0;n<c.length;++n){var o=c[n].split("=",2);2==o.length&&(l[o[0]]=decodeURIComponent(o[1].replace(/\+/g," ")))}}return r=p.extend(!0,{},e.params,i.opts[t],l),u="function"===p.type(e.url)?e.url.call(this,a,r,i):h(e.url,a,r),s="function"===p.type(e.thumb)?e.thumb.call(this,a,r,i):h(e.thumb,a),"youtube"===t?u=u.replace(/&t=((\d+)m)?(\d+)s/,function(t,e,n,o){return"&start="+((n?60*parseInt(n,10):0)+parseInt(o,10))}):"vimeo"===t&&(u=u.replace("&%23","#")),!1}}),f?(i.opts.thumb||i.opts.$thumb&&i.opts.$thumb.length||(i.opts.thumb=s),"iframe"===f&&(i.opts=p.extend(!0,i.opts,{iframe:{preload:!1,attr:{scrolling:"no"}}})),p.extend(i,{type:f,src:u,origSrc:i.src,contentSource:d,contentType:"image"===f?"image":"gmap_place"==d||"gmap_search"==d?"map":"video"})):u&&(i.type=i.opts.defaultType)});var i={youtube:{src:"https://www.youtube.com/iframe_api",class:"YT",loading:!1,loaded:!1},vimeo:{src:"https://player.vimeo.com/api/player.js",class:"Vimeo",loading:!1,loaded:!1},load:function(t){var e,n=this;this[t].loaded?setTimeout(function(){n.done(t)}):this[t].loading||(this[t].loading=!0,(e=document.createElement("script")).type="text/javascript",e.src=this[t].src,"youtube"===t?window.onYouTubeIframeAPIReady=function(){n[t].loaded=!0,n.done(t)}:e.onload=function(){n[t].loaded=!0,n.done(t)},document.body.appendChild(e))},done:function(t){var e,n;"youtube"===t&&delete window.onYouTubeIframeAPIReady,(e=p.fancybox.getInstance())&&(n=e.current.$content.find("iframe"),"youtube"===t&&void 0!==YT&&YT?new YT.Player(n.attr("id"),{events:{onStateChange:function(t){0==t.data&&e.next()}}}):"vimeo"===t&&void 0!==Vimeo&&Vimeo&&new Vimeo.Player(n).on("ended",function(){e.next()}))}};p(document).on({"afterShow.fb":function(t,e,n){1<e.group.length&&("youtube"===n.contentSource||"vimeo"===n.contentSource)&&i.load(n.contentSource)}})}(jQuery),function(d,c,u){"use strict";function f(t){var e,n=[];for(e in t=(t=t.originalEvent||t||d.e).touches&&t.touches.length?t.touches:t.changedTouches&&t.changedTouches.length?t.changedTouches:[t])t[e].pageX?n.push({x:t[e].pageX,y:t[e].pageY}):t[e].clientX&&n.push({x:t[e].clientX,y:t[e].clientY});return n}function p(t,e,n){return e&&t?"x"===n?t.x-e.x:"y"===n?t.y-e.y:Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)):0}function l(t){if(t.is('a,area,button,[role="button"],input,label,select,summary,textarea,video,audio,iframe')||u.isFunction(t.get(0).onclick)||t.data("selectable"))return 1;for(var e=0,n=t[0].attributes,o=n.length;e<o;e++)if("data-fancybox-"===n[e].nodeName.substr(0,14))return 1}function h(t){for(var e,n,o,i=!1;e=t.get(0),n=o=n=void 0,n=d.getComputedStyle(e)["overflow-y"],o=d.getComputedStyle(e)["overflow-x"],n=("scroll"===n||"auto"===n)&&e.scrollHeight>e.clientHeight,e=("scroll"===o||"auto"===o)&&e.scrollWidth>e.clientWidth,!(i=n||e)&&(t=t.parent()).length&&!t.hasClass("fancybox-stage")&&!t.is("body"););return i}function n(t){var e=this;e.instance=t,e.$bg=t.$refs.bg,e.$stage=t.$refs.stage,e.$container=t.$refs.container,e.destroy(),e.$container.on("touchstart.fb.touch mousedown.fb.touch",u.proxy(e,"ontouchstart"))}var g=d.requestAnimationFrame||d.webkitRequestAnimationFrame||d.mozRequestAnimationFrame||d.oRequestAnimationFrame||function(t){return d.setTimeout(t,1e3/60)},b=d.cancelAnimationFrame||d.webkitCancelAnimationFrame||d.mozCancelAnimationFrame||d.oCancelAnimationFrame||function(t){d.clearTimeout(t)};n.prototype.destroy=function(){var t=this;t.$container.off(".fb.touch"),u(c).off(".fb.touch"),t.requestId&&(b(t.requestId),t.requestId=null),t.tapped&&(clearTimeout(t.tapped),t.tapped=null)},n.prototype.ontouchstart=function(t){var e=this,n=u(t.target),o=e.instance,i=o.current,s=i.$slide,a=i.$content,r="touchstart"==t.type;if(r&&e.$container.off("mousedown.fb.touch"),(!t.originalEvent||2!=t.originalEvent.button)&&s.length&&n.length&&!l(n)&&!l(n.parent())&&(n.is("img")||!(t.originalEvent.clientX>n[0].clientWidth+n.offset().left))){if(!i||o.isAnimating||i.$slide.hasClass("fancybox-animated"))return t.stopPropagation(),void t.preventDefault();e.realPoints=e.startPoints=f(t),e.startPoints.length&&(i.touch&&t.stopPropagation(),e.startEvent=t,e.canTap=!0,e.$target=n,e.$content=a,e.opts=i.opts.touch,e.isPanning=!1,e.isSwiping=!1,e.isZooming=!1,e.isScrolling=!1,e.canPan=o.canPan(),e.startTime=(new Date).getTime(),e.distanceX=e.distanceY=e.distance=0,e.canvasWidth=Math.round(s[0].clientWidth),e.canvasHeight=Math.round(s[0].clientHeight),e.contentLastPos=null,e.contentStartPos=u.fancybox.getTranslate(e.$content)||{top:0,left:0},e.sliderStartPos=u.fancybox.getTranslate(s),e.stagePos=u.fancybox.getTranslate(o.$refs.stage),e.sliderStartPos.top-=e.stagePos.top,e.sliderStartPos.left-=e.stagePos.left,e.contentStartPos.top-=e.stagePos.top,e.contentStartPos.left-=e.stagePos.left,u(c).off(".fb.touch").on(r?"touchend.fb.touch touchcancel.fb.touch":"mouseup.fb.touch mouseleave.fb.touch",u.proxy(e,"ontouchend")).on(r?"touchmove.fb.touch":"mousemove.fb.touch",u.proxy(e,"ontouchmove")),u.fancybox.isMobile&&c.addEventListener("scroll",e.onscroll,!0),((e.opts||e.canPan)&&(n.is(e.$stage)||e.$stage.find(n).length)||(n.is(".fancybox-image")&&t.preventDefault(),u.fancybox.isMobile&&n.parents(".fancybox-caption").length))&&(e.isScrollable=h(n)||h(n.parent()),u.fancybox.isMobile&&e.isScrollable||t.preventDefault(),1!==e.startPoints.length&&!i.hasError||(e.canPan?(u.fancybox.stop(e.$content),e.isPanning=!0):e.isSwiping=!0,e.$container.addClass("fancybox-is-grabbing")),2===e.startPoints.length&&"image"===i.type&&(i.isLoaded||i.$ghost)&&(e.canTap=!1,e.isSwiping=!1,e.isPanning=!1,e.isZooming=!0,u.fancybox.stop(e.$content),e.centerPointStartX=.5*(e.startPoints[0].x+e.startPoints[1].x)-u(d).scrollLeft(),e.centerPointStartY=.5*(e.startPoints[0].y+e.startPoints[1].y)-u(d).scrollTop(),e.percentageOfImageAtPinchPointX=(e.centerPointStartX-e.contentStartPos.left)/e.contentStartPos.width,e.percentageOfImageAtPinchPointY=(e.centerPointStartY-e.contentStartPos.top)/e.contentStartPos.height,e.startDistanceBetweenFingers=p(e.startPoints[0],e.startPoints[1]))))}},n.prototype.onscroll=function(t){this.isScrolling=!0,c.removeEventListener("scroll",this.onscroll,!0)},n.prototype.ontouchmove=function(t){var e=this;void 0===t.originalEvent.buttons||0!==t.originalEvent.buttons?e.isScrolling?e.canTap=!1:(e.newPoints=f(t),(e.opts||e.canPan)&&e.newPoints.length&&e.newPoints.length&&(e.isSwiping&&!0===e.isSwiping||t.preventDefault(),e.distanceX=p(e.newPoints[0],e.startPoints[0],"x"),e.distanceY=p(e.newPoints[0],e.startPoints[0],"y"),e.distance=p(e.newPoints[0],e.startPoints[0]),0<e.distance&&(e.isSwiping?e.onSwipe(t):e.isPanning?e.onPan():e.isZooming&&e.onZoom()))):e.ontouchend(t)},n.prototype.onSwipe=function(t){var i=this,s=i.instance,e=i.isSwiping,n=i.sliderStartPos.left||0;if(!0!==e)"x"==e&&(0<i.distanceX&&(i.instance.group.length<2||0===i.instance.current.index&&!i.instance.current.opts.loop)?n+=Math.pow(i.distanceX,.8):i.distanceX<0&&(i.instance.group.length<2||i.instance.current.index===i.instance.group.length-1&&!i.instance.current.opts.loop)?n-=Math.pow(-i.distanceX,.8):n+=i.distanceX),i.sliderLastPos={top:"x"==e?0:i.sliderStartPos.top+i.distanceY,left:n},i.requestId&&(b(i.requestId),i.requestId=null),i.requestId=g(function(){i.sliderLastPos&&(u.each(i.instance.slides,function(t,e){var n=e.pos-i.instance.currPos;
4346u.fancybox.setTranslate(e.$slide,{top:i.sliderLastPos.top,left:i.sliderLastPos.left+n*i.canvasWidth+n*e.opts.gutter})}),i.$container.addClass("fancybox-is-sliding"))});else if(10<Math.abs(i.distance)){if(i.canTap=!1,s.group.length<2&&i.opts.vertical?i.isSwiping="y":s.isDragging||!1===i.opts.vertical||"auto"===i.opts.vertical&&800<u(d).width()?i.isSwiping="x":(n=Math.abs(180*Math.atan2(i.distanceY,i.distanceX)/Math.PI),i.isSwiping=45<n&&n<135?"y":"x"),"y"===i.isSwiping&&u.fancybox.isMobile&&i.isScrollable)return void(i.isScrolling=!0);s.isDragging=i.isSwiping,i.startPoints=i.newPoints,u.each(s.slides,function(t,e){var n,o;u.fancybox.stop(e.$slide),n=u.fancybox.getTranslate(e.$slide),o=u.fancybox.getTranslate(s.$refs.stage),e.$slide.css({transform:"",opacity:"","transition-duration":""}).removeClass("fancybox-animated").removeClass(function(t,e){return(e.match(/(^|\s)fancybox-fx-\S+/g)||[]).join(" ")}),e.pos===s.current.pos&&(i.sliderStartPos.top=n.top-o.top,i.sliderStartPos.left=n.left-o.left),u.fancybox.setTranslate(e.$slide,{top:n.top-o.top,left:n.left-o.left})}),s.SlideShow&&s.SlideShow.isActive&&s.SlideShow.stop()}},n.prototype.onPan=function(){var t=this;p(t.newPoints[0],t.realPoints[0])<(u.fancybox.isMobile?10:5)?t.startPoints=t.newPoints:(t.canTap=!1,t.contentLastPos=t.limitMovement(),t.requestId&&b(t.requestId),t.requestId=g(function(){u.fancybox.setTranslate(t.$content,t.contentLastPos)}))},n.prototype.limitMovement=function(){var t=this,e=t.canvasWidth,n=t.canvasHeight,o=t.distanceX,i=t.distanceY,s=t.contentStartPos,a=s.left,r=s.top,c=s.width,l=s.height,d=e<c?a+o:a,u=r+i,t=Math.max(0,.5*e-.5*c),s=Math.max(0,.5*n-.5*l),c=Math.min(e-c,.5*e-.5*c),l=Math.min(n-l,.5*n-.5*l);return 0<o&&t<d&&(d=t-1+Math.pow(-t+a+o,.8)||0),o<0&&d<c&&(d=c+1-Math.pow(c-a-o,.8)||0),0<i&&s<u&&(u=s-1+Math.pow(-s+r+i,.8)||0),i<0&&u<l&&(u=l+1-Math.pow(l-r-i,.8)||0),{top:u,left:d}},n.prototype.limitPosition=function(t,e,n,o){var i=this.canvasWidth,s=this.canvasHeight;return t=i<n?(t=0<t?0:t)<i-n?i-n:t:Math.max(0,i/2-n/2),{top:e=s<o?(e=0<e?0:e)<s-o?s-o:e:Math.max(0,s/2-o/2),left:t}},n.prototype.onZoom=function(){var t=this,e=t.contentStartPos,n=e.width,o=e.height,i=e.left,s=e.top,a=p(t.newPoints[0],t.newPoints[1])/t.startDistanceBetweenFingers,r=Math.floor(n*a),c=Math.floor(o*a),l=(n-r)*t.percentageOfImageAtPinchPointX,e=(o-c)*t.percentageOfImageAtPinchPointY,n=(t.newPoints[0].x+t.newPoints[1].x)/2-u(d).scrollLeft(),o=(t.newPoints[0].y+t.newPoints[1].y)/2-u(d).scrollTop(),n=n-t.centerPointStartX,a={top:s+(e+(o-t.centerPointStartY)),left:i+(l+n),scaleX:a,scaleY:a};t.canTap=!1,t.newWidth=r,t.newHeight=c,t.contentLastPos=a,t.requestId&&b(t.requestId),t.requestId=g(function(){u.fancybox.setTranslate(t.$content,t.contentLastPos)})},n.prototype.ontouchend=function(t){var e=this,n=e.isSwiping,o=e.isPanning,i=e.isZooming,s=e.isScrolling;if(e.endPoints=f(t),e.dMs=Math.max((new Date).getTime()-e.startTime,1),e.$container.removeClass("fancybox-is-grabbing"),u(c).off(".fb.touch"),c.removeEventListener("scroll",e.onscroll,!0),e.requestId&&(b(e.requestId),e.requestId=null),e.isSwiping=!1,e.isPanning=!1,e.isZooming=!1,e.isScrolling=!1,e.instance.isDragging=!1,e.canTap)return e.onTap(t);e.speed=100,e.velocityX=e.distanceX/e.dMs*.5,e.velocityY=e.distanceY/e.dMs*.5,o?e.endPanning():i?e.endZooming():e.endSwiping(n,s)},n.prototype.endSwiping=function(t,e){var n=this,o=!1,i=n.instance.group.length,s=Math.abs(n.distanceX),s="x"==t&&1<i&&(130<n.dMs&&10<s||50<s);n.sliderLastPos=null,"y"==t&&!e&&50<Math.abs(n.distanceY)?(u.fancybox.animate(n.instance.current.$slide,{top:n.sliderStartPos.top+n.distanceY+150*n.velocityY,opacity:0},200),o=n.instance.close(!0,250)):s&&0<n.distanceX?o=n.instance.previous(300):s&&n.distanceX<0&&(o=n.instance.next(300)),!1!==o||"x"!=t&&"y"!=t||n.instance.centerSlide(200),n.$container.removeClass("fancybox-is-sliding")},n.prototype.endPanning=function(){var t,e,n=this;n.contentLastPos&&(e=!1===n.opts.momentum||350<n.dMs?(t=n.contentLastPos.left,n.contentLastPos.top):(t=n.contentLastPos.left+500*n.velocityX,n.contentLastPos.top+500*n.velocityY),(e=n.limitPosition(t,e,n.contentStartPos.width,n.contentStartPos.height)).width=n.contentStartPos.width,e.height=n.contentStartPos.height,u.fancybox.animate(n.$content,e,366))},n.prototype.endZooming=function(){var t,e,n,o=this,i=o.instance.current,s=o.newWidth,a=o.newHeight;o.contentLastPos&&(t=o.contentLastPos.left,n={top:e=o.contentLastPos.top,left
vendor: 4,256 bytes, line 4346
4346:t,width:s,height:a,scaleX:1,scaleY:1},u.fancybox.setTranslate(o.$content,n),s<o.canvasWidth&&a<o.canvasHeight?o.instance.scaleToFit(150):s>i.width||a>i.height?o.instance.scaleToActual(o.centerPointStartX,o.centerPointStartY,150):(a=o.limitPosition(t,e,s,a),u.fancybox.animate(o.$content,a,150)))},n.prototype.onTap=function(e){function t(t){if(t=a.opts[t],u.isFunction(t)&&(t=t.apply(s,[a,e])),t)switch(t){case"close":s.close(o.startEvent);break;case"toggleControls":s.toggleControls();break;case"next":s.next();break;case"nextOrClose":1<s.group.length?s.next():s.close(o.startEvent);break;case"zoom":"image"==a.type&&(a.isLoaded||a.$ghost)&&(s.canPan()?s.scaleToFit():s.isScaledDown()?s.scaleToActual(c,l):s.group.length<2&&s.close(o.startEvent))}}var n,o=this,i=u(e.target),s=o.instance,a=s.current,r=e&&f(e)||o.startPoints,c=r[0]?r[0].x-u(d).scrollLeft()-o.stagePos.left:0,l=r[0]?r[0].y-u(d).scrollTop()-o.stagePos.top:0;if((!e.originalEvent||2!=e.originalEvent.button)&&(i.is("img")||!(c>i[0].clientWidth+i.offset().left))){if(i.is(".fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-container"))n="Outside";else if(i.is(".fancybox-slide"))n="Slide";else{if(!s.current.$content||!s.current.$content.find(i).addBack().filter(i).length)return;n="Content"}if(o.tapped){if(clearTimeout(o.tapped),o.tapped=null,50<Math.abs(c-o.tapX)||50<Math.abs(l-o.tapY))return this;t("dblclick"+n)}else o.tapX=c,o.tapY=l,a.opts["dblclick"+n]&&a.opts["dblclick"+n]!==a.opts["click"+n]?o.tapped=setTimeout(function(){o.tapped=null,s.isAnimating||t("click"+n)},500):t("click"+n);return this}},u(c).on("onActivate.fb",function(t,e){e&&!e.Guestures&&(e.Guestures=new n(e))}).on("beforeClose.fb",function(t,e){e&&e.Guestures&&e.Guestures.destroy()})}(window,document,jQuery),function(s,a){"use strict";function n(t){this.instance=t,this.init()}a.extend(!0,a.fancybox.defaults,{btnTpl:{slideShow:'<button data-fancybox-play class="fancybox-button fancybox-button--play" title="{{PLAY_START}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6.5 5.4v13.2l11-6.6z"/></svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.33 5.75h2.2v12.5h-2.2V5.75zm5.15 0h2.2v12.5h-2.2V5.75z"/></svg></button>'},slideShow:{autoStart:!1,speed:3e3,progress:!0}}),a.extend(n.prototype,{timer:null,isActive:!1,$button:null,init:function(){var t=this,e=t.instance,n=e.group[e.currIndex].opts.slideShow;t.$button=e.$refs.toolbar.find("[data-fancybox-play]").on("click",function(){t.toggle()}),e.group.length<2||!n?t.$button.hide():n.progress&&(t.$progress=a('<div class="fancybox-progress"></div>').appendTo(e.$refs.inner))},set:function(t){var e=this,n=e.instance,o=n.current;o&&(!0===t||o.opts.loop||n.currIndex<n.group.length-1)?e.isActive&&"video"!==o.contentType&&(e.$progress&&a.fancybox.animate(e.$progress.show(),{scaleX:1},o.opts.slideShow.speed),e.timer=setTimeout(function(){n.current.opts.loop||n.current.index!=n.group.length-1?n.next():n.jumpTo(0)},o.opts.slideShow.speed)):(e.stop(),n.idleSecondsCounter=0,n.showControls())},clear:function(){clearTimeout(this.timer),this.timer=null,this.$progress&&this.$progress.removeAttr("style").hide()},start:function(){var t=this,e=t.instance.current;e&&(t.$button.attr("title",(e.opts.i18n[e.opts.lang]||e.opts.i18n.en).PLAY_STOP).removeClass("fancybox-button--play").addClass("fancybox-button--pause"),t.isActive=!0,e.isComplete&&t.set(!0),t.instance.trigger("onSlideShowChange",!0))},stop:function(){var t=this,e=t.instance.current;t.clear(),t.$button.attr("title",(e.opts.i18n[e.opts.lang]||e.opts.i18n.en).PLAY_START).removeClass("fancybox-button--pause").addClass("fancybox-button--play"),t.isActive=!1,t.instance.trigger("onSlideShowChange",!1),t.$progress&&t.$progress.removeAttr("style").hide()},toggle:function(){this.isActive?this.stop():this.start()}}),a(s).on({"onInit.fb":function(t,e){e&&!e.SlideShow&&(e.SlideShow=new n(e))},"beforeShow.fb":function(t,e,n,o){e=e&&e.SlideShow;o?e&&n.opts.slideShow.autoStart&&e.start():e&&e.isActive&&e.clear()},"afterShow.fb":function(t,e,n){e=e&&e.SlideShow;e&&e.isActive&&e.set()},"afterKeydown.fb":function(t,e,n,o,i){e=e&&e.SlideShow;!e||!n.opts.slideShow||80!==i&&32!==i||a(s.activeElement).is("button,a,input")||(o.preventDefault(),e.toggle(
4346))},"beforeClose.fb onDeactivate.fb":function(t,e){e=e&&e.SlideShow;e&&e.stop()}}),a(s).on("visibilitychange",function(){var t;"3.5.7"!=a.fancybox.version||(t=(t=a.fancybox.getInstance())&&t.SlideShow)&&t.isActive&&(s.hidden?t.clear():t.set())})}(document,jQuery),function(s,n){"use strict";var o,i=function(){for(var t=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],e={},n=0;n<t.length;n++){var o=t[n];if(o&&o[1]in s){for(var i=0;i<o.length;i++)e[t[0][i]]=o[i];return e}}return!1}();i&&(o={request:function(t){(t=t||s.documentElement)[i.requestFullscreen](t.ALLOW_KEYBOARD_INPUT)},exit:function(){s[i.exitFullscreen]()},toggle:function(t){t=t||s.documentElement,this.isFullscreen()?this.exit():this.request(t)},isFullscreen:function(){return Boolean(s[i.fullscreenElement])},enabled:function(){return Boolean(s[i.fullscreenEnabled])}},n.extend(!0,n.fancybox.defaults,{btnTpl:{fullScreen:'<button data-fancybox-fullscreen class="fancybox-button fancybox-button--fsenter" title="{{FULL_SCREEN}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 16h3v3h2v-5H5zm3-8H5v2h5V5H8zm6 11h2v-3h3v-2h-5zm2-11V5h-2v5h5V8z"/></svg></button>'},fullScreen:{autoStart:!1}}),n(s).on(i.fullscreenchange,function(){var t=o.isFullscreen(),e=n.fancybox.getInstance();e&&(e.current&&"image"===e.current.type&&e.isAnimating&&(e.isAnimating=!1,e.update(!0,!0,0),e.isComplete||e.complete()),e.trigger("onFullscreenChange",t),e.$refs.container.toggleClass("fancybox-is-fullscreen",t),e.$refs.toolbar.find("[data-fancybox-fullscreen]").toggleClass("fancybox-button--fsenter",!t).toggleClass("fancybox-button--fsexit",t))})),n(s).on({"onInit.fb":function(t,e){i?e&&e.group[e.currIndex].opts.fullScreen?(e.$refs.container.on("click.fb-fullscreen","[data-fancybox-fullscreen]",function(t){t.stopPropagation(),t.preventDefault(),o.toggle()}),e.opts.fullScreen&&!0===e.opts.fullScreen.autoStart&&o.request(),e.FullScreen=o):e&&e.$refs.toolbar.find("[data-fancybox-fullscreen]").hide():e.$refs.toolbar.find("[data-fancybox-fullscreen]").remove()},"afterKeydown.fb":function(t,e,n,o,i){e&&e.FullScreen&&70===i&&(o.preventDefault(),e.FullScreen.toggle())},"beforeClose.fb":function(t,e){e&&e.FullScreen&&e.$refs.container.hasClass("fancybox-is-fullscreen")&&o.exit()}})}(document,jQuery),function(t,s){"use strict";var a="fancybox-thumbs",r=a+"-active";function o(t){this.init(t)}s.fancybox.defaults=s.extend(!0,{btnTpl:{thumbs:'<button data-fancybox-thumbs class="fancybox-button fancybox-button--thumbs" title="{{THUMBS}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14.59 14.59h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76H5.65v-3.76zm8.94-4.47h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76H5.65v-3.76zm8.94-4.47h3.76v3.76h-3.76V5.65zm-4.47 0h3.76v3.76h-3.76V5.65zm-4.47 0h3.76v3.76H5.65V5.65z"/></svg></button>'},thumbs:{autoStart:!1,hideOnClose:!0,parentEl:".fancybox-container",axis:"y"}},s.fancybox.defaults),s.extend(o.prototype,{$button:null,$grid:null,$list:null,isVisible:!1,isActive:!1,init:function(t){var e=this,n=t.group,o=0;e.instance=t,e.opts=n[t.currIndex].opts.thumbs,(t.Thumbs=e).$button=t.$refs.toolbar.find("[data-fancybox-thumbs]");for(var i=0,s=n.length;i<s&&(n[i].thumb&&o++,!(1<o));i++);1<o&&e.opts?(e.$button.removeAttr("style").on("click",function(){e.toggle(
vendor: 4,205 bytes, line 4346
4346)}),e.isActive=!0):e.$button.hide()},create:function(){var n,t=this,e=t.instance,o=t.opts.parentEl,i=[];t.$grid||(t.$grid=s('<div class="'+a+" "+a+"-"+t.opts.axis+'"></div>').appendTo(e.$refs.container.find(o).addBack().filter(o)),t.$grid.on("click","a",function(){e.jumpTo(s(this).attr("data-index"))})),t.$list||(t.$list=s('<div class="'+a+'__list">').appendTo(t.$grid)),s.each(e.group,function(t,e){(n=e.thumb)||"image"!==e.type||(n=e.src),i.push('<a href="javascript:;" tabindex="0" data-index="'+t+'"'+(n&&n.length?' style="background-image:url('+n+')"':'class="fancybox-thumbs-missing"')+"></a>")}),t.$list[0].innerHTML=i.join(""),"x"===t.opts.axis&&t.$list.width(parseInt(t.$grid.css("padding-right"),10)+e.group.length*t.$list.children().eq(0).outerWidth(!0))},focus:function(t){var e,n,o=this,i=o.$list,s=o.$grid;o.instance.current&&(n=(e=i.children().removeClass(r).filter('[data-index="'+o.instance.current.index+'"]').addClass(r)).position(),"y"===o.opts.axis&&(n.top<0||n.top>i.height()-e.outerHeight())?i.stop().animate({scrollTop:i.scrollTop()+n.top},t):"x"===o.opts.axis&&(n.left<s.scrollLeft()||n.left>s.scrollLeft()+(s.width()-e.outerWidth()))&&i.parent().stop().animate({scrollLeft:n.left},t))},update:function(){var t=this;t.instance.$refs.container.toggleClass("fancybox-show-thumbs",this.isVisible),t.isVisible?(t.$grid||t.create(),t.instance.trigger("onThumbsShow"),t.focus(0)):t.$grid&&t.instance.trigger("onThumbsHide"),t.instance.update()},hide:function(){this.isVisible=!1,this.update()},show:function(){this.isVisible=!0,this.update()},toggle:function(){this.isVisible=!this.isVisible,this.update()}}),s(t).on({"onInit.fb":function(t,e){var n;e&&!e.Thumbs&&(n=new o(e)).isActive&&!0===n.opts.autoStart&&n.show()},"beforeShow.fb":function(t,e,n,o){e=e&&e.Thumbs;e&&e.isVisible&&e.focus(o?0:250)},"afterKeydown.fb":function(t,e,n,o,i){e=e&&e.Thumbs;e&&e.isActive&&71===i&&(o.preventDefault(),e.toggle())},"beforeClose.fb":function(t,e){e=e&&e.Thumbs;e&&e.isVisible&&!1!==e.opts.hideOnClose&&e.$grid.hide()}})}(document,jQuery),function(t,i){"use strict";i.extend(!0,i.fancybox.defaults,{btnTpl:{share:'<button data-fancybox-share class="fancybox-button fancybox-button--share" title="{{SHARE}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2.55 19c1.4-8.4 9.1-9.8 11.9-9.8V5l7 7-7 6.3v-3.5c-2.8 0-10.5 2.1-11.9 4.2z"/></svg></button>'},share:{url:function(t,e){return!t.currentHash&&"inline"!==e.type&&"html"!==e.type&&(e.origSrc||e.src)||window.location},tpl:'<div class="fancybox-share"><h1>{{SHARE}}</h1><p><a class="fancybox-share__button fancybox-share__button--fb" href="https://www.facebook.com/sharer/sharer.php?u={{url}}"><svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m287 456v-299c0-21 6-35 35-35h38v-63c-7-1-29-3-55-3-54 0-91 33-91 94v306m143-254h-205v72h196" /></svg><span>Facebook</span></a><a class="fancybox-share__button fancybox-share__button--tw" href="https://twitter.com/intent/tweet?url={{url}}&text={{descr}}"><svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m456 133c-14 7-31 11-47 13 17-10 30-27 37-46-15 10-34 16-52 20-61-62-157-7-141 75-68-3-129-35-169-85-22 37-11 86 26 109-13 0-26-4-37-9 0 39 28 72 65 80-12 3-25 4-37 2 10 33 41 57 77 57-42 30-77 38-122 34 170 111 378-32 359-208 16-11 30-25 41-42z" /></svg><span>Twitter</span></a><a class="fancybox-share__button fancybox-share__button--pt" href="https://www.pinterest.com/pin/create/button/?url={{url}}&description={{descr}}&media={{media}}"><svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m265 56c-109 0-164 78-164 144 0 39 15 74 47 87 5 2 10 0 12-5l4-19c2-6 1-8-3-13-9-11-15-25-15-45 0-58 43-110 113-110 62 0 96 38 96 88 0 67-30 122-73 122-24 0-42-19-36-44 6-29 20-60 20-81 0-19-10-35-31-35-25 0-44 26-44 60 0 21 7 36 7 36l-30 125c-8 37-1 83 0 87 0 3 4 4 5 2 2-3 32-39 42-75l16-64c8 16 31 29 56 29 74 0 124-67 124-157 0-69-58-132-146-132z" fill="#fff"/></svg><span>Pinterest</span></a></p><p><input class="fancybox-share__input" type="text" value="{{url_raw}}" onclick="select()" /></p></div>'}}),i(t).on("click","[data-fancybox-share]",function(){var t,e,n=i.fancybox.getInstance(),o=n.current||null;
4346o&&("function"===i.type(o.opts.share.url)&&(t=o.opts.share.url.apply(o,[n,o])),t=o.opts.share.tpl.replace(/\{\{media\}\}/g,"image"===o.type?encodeURIComponent(o.src):"").replace(/\{\{url\}\}/g,encodeURIComponent(t)).replace(/\{\{url_raw\}\}/g,(e={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},String(t).replace(/[&<>"'`=\/]/g,function(t){return e[t]}))).replace(/\{\{descr\}\}/g,n.$caption?encodeURIComponent(n.$caption.text()):""),i.fancybox.open({src:n.translate(n,t),type:"html",opts:{touch:!1,animationEffect:!1,afterLoad:function(t,e){n.$refs.container.one("beforeClose.fb",function(){t.close(null,0)}),e.$content.find(".fancybox-share__button").on("click",function(){return window.open(this.href,"Share","width=550, height=450"),!1})},mobile:{autoFocus:!1}}}))})}(document,jQuery),function(s,a,o){"use strict";function i(){var t=s.location.hash.substr(1),e=t.split("-"),n=1<e.length&&/^\+?\d+$/.test(e[e.length-1])&&parseInt(e.pop(-1),10)||1;return{hash:t,index:n<1?1:n,gallery:e.join("-")}}function e(t){""!==t.gallery&&o("[data-fancybox='"+o.escapeSelector(t.gallery)+"']").eq(t.index-1).focus().trigger("click.fb-start")}function r(t){return!!t&&(""!==(t=(t=(t.current||t).opts).hash||(t.$orig?t.$orig.data("fancybox")||t.$orig.data("fancybox-trigger"):""))&&t)}o.escapeSelector||(o.escapeSelector=function(t){return(t+"").replace(/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t})}),o(function(){"3.5.7"==o.fancybox.version&&!1!==o.fancybox.defaults.hash&&(o(a).on({"onInit.fb":function(t,e){var n,o;!1!==e.group[e.currIndex].opts.hash&&(n=i(),(o=r(e))&&n.gallery&&o==n.gallery&&(e.currIndex=n.index-1))},"beforeShow.fb":function(t,e,n,o){var i;n&&!1!==n.opts.hash&&(i=r(e))&&(e.currentHash=i+(1<e.group.length?"-"+(n.index+1):""),s.location.hash!=="#"+e.currentHash&&(o&&!e.origHash&&(e.origHash=s.location.hash),e.hashTimer&&clearTimeout(e.hashTimer),e.hashTimer=setTimeout(function(){"replaceState"in s.history?(s.history[o?"pushState":"replaceState"]({},a.title,s.location.pathname+s.location.search+"#"+e.currentHash),o&&(e.hasCreatedHistory=!0)):s.location.hash=e.currentHash,e.hashTimer=null},300)))},"beforeClose.fb":function(t,e,n){n&&!1!==n.opts.hash&&(clearTimeout(e.hashTimer),e.currentHash&&e.hasCreatedHistory?s.history.back():e.currentHash&&("replaceState"in s.history?s.history.replaceState({},a.title,s.location.pathname+s.location.search+(e.origHash||"")):s.location.hash=e.origHash),e.currentHash=null)}}),o(s).on("hashchange.fb",function(){var t=i(),n=null;o.each(o(".fancybox-container").get().reverse(),function(t,e){e=o(e).data("FancyBox");if(e&&e.currentHash)return n=e,!1}),n?n.currentHash===t.gallery+"-"+t.index||1===t.index&&n.currentHash==t.gallery||(n.currentHash=null,n.close()):""!==t.gallery&&e(t)}),setTimeout(function(){"3.5.7"==o.fancybox.version&&(o.fancybox.getInstance()||e(i()))},50))})}(window,document,jQuery),function(t,e){"use strict";var i=(new Date).getTime();e(t).on({"onInit.fb":function(t,o,e){o.$refs.stage.on("mousewheel DOMMouseScroll wheel MozMousePixelScroll",function(t){var e=o.current,n=(new Date).getTime();o.group.length<2||!1===e.opts.wheel||"auto"===e.opts.wheel&&"image"!==e.type||(t.preventDefault(),t.stopPropagation(),e.$slide.hasClass("fancybox-animated")||(t=t.originalEvent||t,n-i<250||(i=n,o[(-t.deltaY||-t.deltaX||t.wheelDelta||-t.detail)<0?"next":"previous"]())))})}})}(document,jQuery); 4347 4348/* jQuery fancybox lightbox */ 4349/* -------------------------------------------------------------------- */ 4350function mk_lightbox_init() { 4351 4352 $(".mk-lightbox").fancybox({ 4353 loop: true, 4354 }); 4355 4356 $.fancybox.defaults.hash = false; 4357 4358} 4359 4360 4361(function($, window){ 4362 'use strict'; 4363 4364 var scrollY = MK.val.scroll; 4365 var dynamicHeight = MK.val.dynamicHeight; 4366 4367 var $window = $(window); 4368 var $containers = $('.js-loop'); 4369 4370 $containers.each( pagination ); 4371 4372 $window.on( 'vc_reload', function() { 4373 $('.js-loop').each( pagination ); 4374 } ); 4375 4376 function pagination() { 4377 var unique = Date.now(); 4378 var $container = $(this); 4379 var $superContainer = $container.parent(); // should contain clearing so it stretches with floating children 4380 var $loadBtn = $container.siblings('.js-loadmore-holder').find('.js-loadmore-button'); 4381 var $loadScroll = $('.js-load-more-scroll'); 4382 var style = $container.data('pagination-style'); 4383 var maxPages = $container.data('max-pages'); 4384 var id = '#' + ($container.attr('id')); 4385 var ajaxLoader = new MK.utils.ajaxLoader(id); 4386 var isLoadBtn = (style === 2); 4387 var isInfiniteScroll = (style === 3); // add flag for last container 4388 var scrollCheckPoint = null; 4389 var isHandlerBinded = false;
4390 4391 ajaxLoader.init(); 4392 4393 init(); 4394 4395 function init() { 4396 MK.utils.eventManager.subscribe('ajaxLoaded', onLoad); 4397 bindHandlers(); 4398 if( isInfiniteScroll ) scrollCheckPoint = spyScrollCheckPoint(); 4399 4400 $window.on( 'vc_reload', function() { 4401 $window.off('scroll', handleScroll); 4402 } ); 4403 } 4404 4405 function bindHandlers() { 4406 if( isLoadBtn ) $loadBtn.on('click', handleClick); 4407 if( isInfiniteScroll ) $window.on('scroll', handleScroll); 4408 isHandlerBinded = true; 4409 } 4410 4411 function unbindHandlers() { 4412 if( isLoadBtn ) $loadBtn.off('click', handleClick); 4413 if( isInfiniteScroll ) $window.off('scroll', handleScroll); 4414 isHandlerBinded = false; 4415 } 4416 4417 function handleClick(e) { 4418 e.preventDefault(); 4419 if(!ajaxLoader.isLoading) loadMore(); 4420 } 4421 4422 function handleScroll() { 4423 if((scrollY() > scrollCheckPoint()) && !ajaxLoader.isLoading) loadMore(); 4424 } 4425 4426 function loadMore() { 4427 loadingIndicatorStart(); 4428 var page = ajaxLoader.getData('paged'); 4429 ajaxLoader.setData({paged: ++page}); 4430 ajaxLoader.load(unique); 4431 } 4432 4433 function onLoad(e, response) { 4434 if( typeof response !== 'undefined' && response.id === id) { 4435 // Checking found posts helps to fix all pagination styles 4436 if( ajaxLoader.getData('found_posts') <= 0 && ajaxLoader.getData('paged') >= ajaxLoader.getData('maxPages')) loadingIndicatorHide(); 4437 else loadingIndicatorShow(); 4438 if(response.unique === unique) $container.append(response.content); 4439 loadingIndicatorStop(); 4440 } 4441 } 4442 4443 function loadingIndicatorStart() { 4444 if(isLoadBtn) $loadBtn.addClass('is-active'); 4445 else if(isInfiniteScroll) MK.ui.loader.add('.js-load-more-scroll'); 4446 4447 } 4448 4449 function loadingIndicatorStop() { 4450 if(isLoadBtn) $loadBtn.removeClass('is-active'); 4451 else if(isInfiniteScroll) MK.ui.loader.remove('.js-load-more-scroll'); 4452 } 4453 4454 function loadingIndicatorShow() { 4455 if(isHandlerBinded) return; 4456 if(isLoadBtn) $loadBtn.show(); 4457 else if(isInfiniteScroll) $loadScroll.show(); 4458 bindHandlers(); 4459 } 4460 4461 function loadingIndicatorHide() { 4462 if(!isHandlerBinded) return; 4463 if(isLoadBtn) $loadBtn.hide(); 4464 else if(isInfiniteScroll) $loadScroll.hide(); 4465 unbindHandlers(); 4466 } 4467 4468 4469 function spyScrollCheckPoint() { 4470 var containerO = 0; 4471 var containerH = dynamicHeight( $superContainer ); 4472 var winH = dynamicHeight( window ); 4473 4474 var setVals = function() { 4475 containerO = $superContainer.offset().top; 4476 }; 4477 4478 setVals(); 4479 $window.on('resize', function() { requestAnimationFrame(setVals); }); 4480 4481 return function() { 4482 return (containerH() + containerO) - (winH() * 2); 4483 }; 4484 } 4485 } 4486 4487})(jQuery, window); 4488(function($) { 4489 'use strict'; 4490 4491 var MK = window.MK || {}; 4492 window.MK = MK; 4493 MK.component = window.MK.component || {}; 4494 4495 // Check if it's inside hidden parent 4496 // Cannot be position: fixed 4497 function isHidden(el) { 4498 return (el.offsetParent === null); 4499 } 4500 4501 MK.component.Masonry = function(el) { 4502 var $window = $(window); 4503 var $container = $(el); 4504 var config = $container.data( 'masonry-config' ); 4505 var $masonryItems = $container.find(config.item); 4506 var cols = config.cols || 8; 4507 var $filterItems = null; // assign only when apply filter 4508 var wall = null; 4509 4510 var init = function init() { 4511 MK.core.loadDependencies([ MK.core.path.plugins + 'freewall.js' ], onDepLoad); 4512 }; 4513 4514 var onDepLoad = function onDepLoad() { 4515 masonry(); 4516 4517 // Events 4518 $window.on('resize', onResize); 4519 MK.utils.eventManager.subscribe('ajaxLoaded', onPostAddition); 4520 MK.utils.eventManager.subscribe('staticFilter', resize); 4521 }; 4522 4523 var masonry = function masonry() { 4524 // Quit for hidden elements for now. 4525 if(isHidden(el)) return; 4526 4527 var newCols; 4528 if(window.matchMedia( '(max-width:600px)' ).matches) newCols = 2; 4529 else if(window.matchMedia( '(max-width:850px)' ).matches) newCols = 4; 4530 else newCols = cols; 4531 4532 var colW = $container.width() / newCols; 4533 4534 wall = new Freewall( config.container ); 4535 4536 // We need to pass settings to a plugin via reset method. Strange but works fine. 4537 wall.reset({
4538 selector: config.item + ':not(.is-hidden)', 4539 gutterX: 0, // set default gutter to 0 and again - apply margins to item holders in css 4540 gutterY: 0, 4541 cellW: colW, 4542 cellH: colW 4543 }); 4544 4545 wall.fillHoles(); 4546 wall.fitWidth(); 4547 4548 $masonryItems.each(function() { 4549 $(this).data('loaded', true); 4550 }); 4551 }; 4552 4553 4554 // Clear attributes after the plugin. It's API method dosn't handle it properly 4555 var destroyContainer = function destroyContainer() { 4556 $container.removeAttr('style') 4557 .removeData('wall-height') 4558 .removeData('wall-width') 4559 .removeData('min-width') 4560 .removeData('total-col') 4561 .removeData('total-row') 4562 .removeAttr('data-wall-height') 4563 .removeAttr('data-wall-width') 4564 .removeAttr('data-min-width') 4565 .removeAttr('data-total-col') 4566 .removeAttr('data-total-row'); 4567 }; 4568 4569 var destroyItem = function destroyItem() { 4570 var $item = $(this); 4571 $item.removeAttr('style') 4572 .removeData('delay') 4573 .removeData('height') 4574 .removeData('width') 4575 .removeData('state') 4576 .removeAttr('data-delay') 4577 .removeAttr('data-height') 4578 .removeAttr('data-width') 4579 .removeAttr('data-state'); 4580 }; 4581 4582 var destroyAll = function destroyAll() { 4583 if( !wall ) return; 4584 wall.destroy(); // API destroy 4585 destroyContainer(); 4586 $masonryItems.each( destroyItem ); // run our deeper destroy 4587 }; 4588 4589 var onResize = function onResize() { 4590 requestAnimationFrame(resize); 4591 }; 4592 4593 var refresh = function refresh() { 4594 if( !wall ) return; 4595 setTimeout(wall.fitWidth.bind(wall), 5); 4596 }; 4597 4598 var resize = function resize() { 4599 destroyAll(); 4600 masonry(); 4601 }; 4602 4603 var onPostAddition = function onPostAddition() { 4604 $masonryItems = $container.find(config.item); 4605 4606 $masonryItems.each(function() { 4607 var $item = $(this), 4608 isLoaded = $item.data('loaded'); 4609 4610 if(!isLoaded) $item.css('visibility', 'hidden'); 4611 }); 4612 4613 4614 $container.mk_imagesLoaded().then(function() { 4615 destroyAll(); 4616 masonry(); 4617 }); 4618 }; 4619 4620 return { 4621 init : init 4622 }; 4623 }; 4624 4625}(jQuery)); 4626 4627/* Milestone Number Shortcode */ 4628/* -------------------------------------------------------------------- */ 4629 4630function mk_milestone() { 4631 4632 "use strict"; 4633 4634 if( !$.exists('.mk-milestone') ) return; 4635 4636 $('.mk-milestone').each(function () { 4637 var $this = $(this), 4638 stop_number = $this.find('.milestone-number').attr('data-stop'), 4639 animation_speed = parseInt($this.find('.milestone-number').attr('data-speed')); 4640 4641 var build = function() { 4642 if (!$this.hasClass('scroll-animated')) { 4643 $this.addClass('scroll-animated'); 4644 4645 $({ 4646 countNum: $this.find('.milestone-number').text() 4647 }).animate({ 4648 countNum: stop_number 4649 }, { 4650 duration: animation_speed, 4651 easing: 'linear', 4652 step: function () { 4653 $this.find('.milestone-number').text(Math.floor(this.countNum)); 4654 }, 4655 complete: function () { 4656 $this.find('.milestone-number').text(this.countNum); 4657 } 4658 }); 4659 } 4660 }; 4661 4662 if ( !MK.utils.isMobile() ) { 4663 // refactored only :in-viewport logic. rest is to-do 4664 MK.utils.scrollSpy( this, { 4665 position: 'bottom', 4666 after: build 4667 }); 4668 } else { 4669 build(); 4670 } 4671 4672 }); 4673 4674} 4675 4676 4677 4678 4679(function($) { 4680 'use strict'; 4681 4682 MK.component.Pagination = function(el) { 4683 this.el = el; 4684 }; 4685 4686 MK.component.Pagination.prototype = { 4687 init: function init() { 4688 this.cacheElements(); 4689 this.bindEvents(); 4690 this.onInitLoad(); 4691 }, 4692 4693 cacheElements: function cacheElements() { 4694 this.lastId = 1; 4695 this.unique = Date.now(); 4696 this.$pagination = $(this.el); 4697 this.$container = this.$pagination.prev('.js-loop'); 4698 this.$pageLinks = this.$pagination.find('.js-pagination-page'); 4699 this.$nextLink = this.$pagination.find('.js-pagination-next'); 4700 this.$prevLink = this.$pagination.find('.js-pagination-prev'); 4701 this.$current = this.$pagination.find('.js-current-page'); 4702 this.$maxPages = this.$pagination.find('.pagination-max-pages'); // TODO change in DOM and here to js class 4703 this.containerId = '#' + this.$container.attr('id'); 4704 this.pagePathname = window.location.pathname; 4705 this.pageSearch = window.location.search; 4706 this.popState = false;
4707 this.ajaxLoader = new MK.utils.ajaxLoader('#' + this.$container.attr('id')); 4708 this.ajaxLoader.init(); 4709 }, 4710 4711 bindEvents: function bindEvents() { 4712 this.$pageLinks.on('click', this.pageClick.bind(this)); 4713 this.$nextLink.on('click', this.nextClick.bind(this)); 4714 this.$prevLink.on('click', this.prevClick.bind(this)); 4715 MK.utils.eventManager.subscribe('ajaxLoaded', this.onLoad.bind(this)); 4716 }, 4717 4718 pageClick: function pageClick(e) { 4719 e.preventDefault(); 4720 var $this = $(e.currentTarget); 4721 var id = parseFloat($this.attr('data-page-id')); 4722 4723 if(id > this.ajaxLoader.getData('maxPages') || id < 1) return; 4724 this.load(id, $this); 4725 this.updatePagedNumUrl( id ); 4726 }, 4727 4728 nextClick: function nextClick(e) { 4729 e.preventDefault(); 4730 if(this.ajaxLoader.getData('paged') === this.ajaxLoader.getData('maxPages')) return; 4731 this.load(++this.lastId, $(e.currentTarget)); 4732 this.updatePagedNumUrl( this.lastId ); 4733 }, 4734 4735 prevClick: function prevClick(e) { 4736 e.preventDefault(); 4737 if(this.ajaxLoader.getData('paged') === 1) return; 4738 this.load(--this.lastId, $(e.currentTarget)); 4739 this.updatePagedNumUrl( this.lastId ); 4740 }, 4741 4742 load: function load(id, $el) { 4743 this.lastId = id; 4744 this.ajaxLoader.setData({paged: id}); 4745 this.ajaxLoader.load(this.unique); 4746 this.removeIndicator(); 4747 MK.ui.loader.add($el); 4748 }, 4749 4750 onLoad: function success(e, response) { 4751 if (typeof response !== 'undefined' && response.id === this.containerId) { 4752 this.updatePagination(); 4753 this.lastId = this.ajaxLoader.getData('paged'); 4754 4755 if (response.unique === this.unique) { 4756 this.removeIndicator(); 4757 this.scrollPage(); 4758 this.$container.html(response.content); 4759 } 4760 } 4761 }, 4762 4763 updatePagination: function updatePagination() { 4764 var self = this; 4765 4766 // Hide / show arrows 4767 var isFirst = (this.ajaxLoader.getData('paged') === 1); 4768 var isLast = (this.ajaxLoader.getData('paged') === this.ajaxLoader.getData('maxPages')); 4769 4770 if(isFirst) this.$prevLink.addClass('is-vis-hidden'); 4771 else this.$prevLink.removeClass('is-vis-hidden'); 4772 4773 if(isLast) this.$nextLink.addClass('is-vis-hidden'); 4774 else this.$nextLink.removeClass('is-vis-hidden'); 4775 4776 // X of Y 4777 this.$current.html(this.ajaxLoader.getData('paged')); 4778 this.$maxPages.html(this.ajaxLoader.getData('maxPages')); 4779 4780 // Move overfloating items 4781 var displayItems = 10; 4782 var centerAt = displayItems / 2; 4783 4784 if(this.ajaxLoader.getData('maxPages') > displayItems) { 4785 this.$pageLinks.each(function(i) { 4786 4787 var id = self.lastId - centerAt; 4788 id = Math.max(id, 1); 4789 id = Math.min(id, self.ajaxLoader.getData('maxPages') - displayItems + 1); 4790 id = id + i; 4791 4792 $(this).html( id ).attr('data-page-id', id).show(); 4793 4794 if(i === 0 && id > 1) $(this).html('...'); 4795 if(i === displayItems - 1 && id < self.ajaxLoader.getData('maxPages')) $(this).html('...'); 4796 }); 4797 } else { 4798 this.$pageLinks.each(function(i) { 4799 var $link = $(this); 4800 var id = i + 1; 4801 4802 $link.html(id).attr('data-page-id', id); 4803 4804 if( self.ajaxLoader.getData('maxPages') === 1) { 4805 self.$pageLinks.hide(); 4806 } else { 4807 if(i > self.ajaxLoader.getData('maxPages') - 1) $link.hide(); 4808 else $link.show(); 4809 } 4810 4811 }); 4812 } 4813 4814 // Highlight current only 4815 this.$pageLinks.filter('[data-page-id="' + this.ajaxLoader.getData('paged') + '"]' ).addClass('current-page') 4816 .siblings().removeClass('current-page'); 4817 4818 }, 4819 4820 scrollPage: function scrollPage() { 4821 var containerOffset = this.$container.offset().top; 4822 var offset = containerOffset - MK.val.offsetHeaderHeight( containerOffset ) - 20; 4823 4824 this.$container.find('a:first').focus() 4825 MK.utils.scrollTo( offset ); 4826 }, 4827 4828 removeIndicator: function removeIndicator() { 4829 MK.ui.loader.remove('.js-pagination-page, .js-pagination-next, .js-pagination-prev'); 4830 }, 4831 4832 /** 4833 * Set some actions when archive/category page is loaded. Actions list: 4834 * - Select the correct paged ID on pagination list. 4835 * - Set current paged ID on the label. 4836 * - Add event listener onpopstate for handling prev/next button of Browser URL. 4837 * - Set info for updatePagedNumUrl() about request comes from popstate. 4838 * 4839 * @since 5.9.8 4840 */ 4841 onInitLoad: function onInitLoad() { 4842 var initPagedID = this.$pagination.data( 'init-pagination' ); 4843 if ( initPagedID && initPagedID > 1 ) { 4844 this.$current.html( initPagedID ); 4845 this.$pageLinks.filter( '[data-page-id="' + initPagedID + '"]' ).addClass( 'current-page' ).siblings().removeClass( 'current-page' ); 4846 } 4847 4848 // Run popstate only if it's supported by the browser. 4849 if ( 'onpopstate' in window ) { 4850 var thisPop = this; 4851 window.onpopstate = function( event ) { 4852 var id = 1; 4853 4854 // At start, state is always null. So, we should check it before processing. 4855 if ( typeof event.state === 'object' && event.state ) { 4856 var state = event.state; 4857 4858 // Set paged ID for updating page. 4859 if ( state.hasOwnProperty( 'MkPagination' ) ) { 4860 var currentState = state.MkPagination; 4861 if ( currentState.hasOwnProperty( 'paged' ) ) { 4862 id = parseFloat( currentState.paged ); 4863 } 4864 } 4865 } else { 4866 id = parseFloat( thisPop.getURLPagedID() ); 4867 } 4868 4869 // Tell updatePagedNumUrl() if request come from popstate. 4870 thisPop.popState = true; 4871 thisPop.$pageLinks.filter( '[data-page-id="' + id + '"]' ).trigger( 'click' ); 4872 } 4873 } 4874 }, 4875 4876 /** 4877 * Update current pagination browser URL by adding/changing paged number. Only run if 4878 * the browser support pushState and the request not coming from popstate. 4879 * 4880 * WordPress has some ways to set paged number: 4881 * 1. page/[number], paged=[number] will be directed here. 4882 * 2. page=[number] 4883 * So, we should check which one the request is used here. 4884 * 4885 * @since 5.9.8 4886 */ 4887 updatePagedNumUrl: function updatePagedNumUrl( id ) { 4888 // Check pushState browser support and ignore if request come from popstate. 4889 if ( 'history' in window && 'pushState' in history && id && ! this.popState ) { 4890 var fullPage = this.pagePathname + this.pageSearch; 4891 var isQueryPage = false;
4892 4893 // Style 1 - /page/[number], as default value. 4894 var newPage = 'page/' + id + '/'; 4895 var expPage = /page\/\d+\/?/; 4896 var result = this.pagePathname.match( /\/page\/\d+/ ); 4897 var isPagedExist = ( result ) ? true : false; 4898 4899 // Style 2 - ?page=[number], only run if /page/ is not exist and URL query var exist. 4900 if ( ! isPagedExist && this.pageSearch ) { 4901 isQueryPage = this.pageSearch.match( /page\=\d+/ ); 4902 if ( isQueryPage ) { 4903 newPage = 'page=' + id; 4904 expPage = /page\=\d+/; 4905 } 4906 } 4907 4908 // If page number is 1, remove paged number from URL. 4909 if ( id === 1 ) { 4910 newPage = ''; 4911 if ( isQueryPage ) { 4912 expPage = ( this.pageSearch.match( /\&+/ ) ) ? /page\=\d+\&?/ : /\?page\=\d+\&?/; 4913 } 4914 } 4915 4916 // Set new pathname. Do replacement only if the new pathname contains paged number. 4917 var newURL = this.pagePathname + newPage + this.pageSearch; 4918 if ( fullPage.match( expPage ) ) { 4919 newURL = fullPage.replace( expPage, newPage ); 4920 } 4921 4922 // Set history state and return popstate back to fal
4922se. 4923 var historyState = { 4924 MkPagination: { 4925 url: newURL, 4926 paged: id 4927 } 4928 } 4929 this.popState = false; 4930 4931 // Push new pathname to display/hide the paged number. 4932 window.history.pushState( historyState, null, newURL ); 4933 } 4934 this.popState = false; 4935 }, 4936 4937 /** 4938 * Get current URL page ID. Notes: 4939 * 1. page/[number], paged=[number] will be directed here. 4940 * 2. page=[number] 4941 * 4942 * @return {integer} Current paged ID. Default 1. 4943 */ 4944 getURLPagedID: function getURLPagedID() { 4945 var pathname = window.location.pathname; 4946 var search = window.location.search; 4947 var pagedId = 1; 4948 var result = ''; 4949 var isPagedExist = false; 4950 4951 // Search based on style 1. 4952 result = pathname.match( /\/page\/(\d+)/ ); 4953 if ( result ) { 4954 isPagedExist = true; 4955 pagedId = ( result.hasOwnProperty( 1 ) ) ? result[1] : 1; 4956 } 4957 4958 // Search based on style 2. 4959 if ( ! isPagedExist && search ) { 4960 result = search.match( /page\=(\d+)/ ); 4961 if ( result ) { 4962 isPagedExist = true; 4963 pagedId = ( result.hasOwnProperty( 1 ) ) ? result[1] : 1; 4964 } 4965 } 4966 4967 return pagedId; 4968 } 4969 }; 4970 4971}(jQuery)); 4972 4973(function( $ ) { 4974 'use strict'; 4975 4976 var MK = window.MK || {}; 4977 window.MK = MK; 4978 MK.component = window.MK.component || {}; 4979 4980 var val = MK.val, 4981 utils = MK.utils; 4982 4983 MK.component.Parallax = function( el ) { 4984 var self = this, 4985 $this = $( el ), 4986 obj = $this[0], 4987 $window = $( window ), 4988 container = $('.jupiterx-main')[0], 4989 config = $this.data( 'parallax-config' ), 4990 $holder = $( config.holder ), 4991 headerHeight = null, 4992 offset = null, 4993 elHeight = null, 4994 ticking = false, 4995 isMobile = null; 4996 4997 4998 var clientRect = null; 4999 5000 var update = function() { 5001 // Clear styles to check for natural styles 5002 // then apply position and size 5003 obj.style.transform = null; 5004 obj.style.top = null; 5005 obj.style.bottom = null; 5006 5007 isMobile = MK.utils.isMobile(); 5008 5009 if( isMobile ) { 5010 $this.css( 'height', '' ); 5011 return; 5012 } 5013 5014 clientRect = $this[ 0 ].getBoundingClientRect(); 5015 offset = clientRect.top; 5016 elHeight = clientRect.height; 5017 // headerHeight = val.offsetHeaderHeight( offset ); 5018 headerHeight = 150; 5019 offset = offset - headerHeight + val.scroll(); 5020 5021 setPosition(); 5022 setSize( ); 5023 }; 5024 5025 5026 var h = 0, 5027 winH = 0, 5028 proportion = 0, 5029 height = 0; 5030 5031 // Position and background attachement should me moved to CSS but we repair it high specificity here as styles are not reliable currently 5032 var setSize = function() { 5033 $this.css( 'height', '' ); 5034 winH = $window.height() - headerHeight; 5035 h = obj.getBoundingClientRect().height; 5036 5037 if( config.speed <= 1 && config.speed > 0 ) { 5038 if( offset === 0 ) { 5039 $this.css({ 5040 backgroundAttachment: 'scroll', 5041 'will-change': 'transform' 5042 }); 5043 } else { 5044 $this.css({ 5045 height : h + ( (winH - h) * config.speed ), 5046 backgroundAttachment: 'scroll', 5047 'will-change': 'transform' 5048 }); 5049 } 5050 5051 } else if ( config.speed > 1 && h <= winH ) { 5052 $this.css({ 5053 // good for full heights - 2 because it's viewable by 2 screen heights 5054 height: ( winH + ( ( winH * config.speed ) - winH ) * 2 ), 5055 top: -( ( winH * config.speed ) - winH ), 5056 backgroundAttachment: 'scroll', 5057 'will-change': 'transform' 5058 }); 5059 5060 } else if ( config.speed > 1 && h > winH ) { 5061 proportion = h / winH; 5062 height = ( winH + ( ( winH * config.speed ) - winH ) * (1 + proportion) ); 5063 5064 $this.css({ 5065 height: height, 5066 top: -( height - (winH * config.speed) ), 5067 backgroundAttachment: 'scroll', 5068 'will-change': 'transform' 5069 }); 5070 5071 } else if ( config.speed < 0 && h >= winH ) { 5072 height = h * (1 - config.speed); 5073 $this.css({ 5074 height: height + (height - h), 5075 top: h - height, 5076 backgroundAttachment: 'scroll', 5077 'will-change': 'transform' 5078 }); 5079 5080 } else if ( config.speed < 0 && h < winH ) { 5081 // candidate to change 5082 var display = (winH + h) / winH; 5083 height = h * -config.speed * display; 5084 $this.css({ 5085 height: h + (height * 2), 5086 top: -height, 5087 backgroundAttachment: 'scroll', 5088 'will-change': 'transform' 5089 }); 5090 } 5091 }; 5092 5093 5094 var currentPoint = null, 5095 progressVal = null, 5096 startPoint = null, 5097 endPoint = null, 5098 $opacityLayer = config.opacity ? $this.find( config.opacity ) : null, 5099 scrollY = null; 5100 5101 var setPosition = function() { 5102 startPoint = offset - winH; 5103 endPoint = offset + elHeight + winH - headerHeight; 5104 scrollY = val.scroll(); 5105 5106 if( scrollY < startPoint || scrollY > endPoint ) { 5107 ticking = false;
5108 return; 5109 } 5110 5111 currentPoint = (( -offset + scrollY ) * config.speed); 5112 5113 $this.css({ 5114 '-webkit-transform': 'translateY(' + currentPoint + 'px) translateZ(0)', 5115 '-moz-transform': 'translateY(' + currentPoint + 'px) translateZ(0)', 5116 '-ms-transform': 'translateY(' + currentPoint + 'px) translateZ(0)', 5117 '-o-transform': 'translateY(' + currentPoint + 'px) translateZ(0)', 5118 'transform': 'translateY(' + currentPoint + 'px) translateZ(0)' 5119 }); 5120 5121 ticking = false; 5122 }; 5123 5124 5125 var requestTick = function() { 5126 if( !ticking && !isMobile ) { 5127 ticking = true; 5128 window.requestAnimationFrame( setPosition ); 5129 } 5130 }; 5131 5132 5133 var init = function() { 5134 update(); 5135 setTimeout(update, 100); 5136 $window.on( 'load', update ); 5137 $window.on( 'resize', update ); 5138 window.addResizeListener( container, update ); 5139 5140 $window.on( 'scroll', requestTick ); 5141 }; 5142 5143 5144 return { 5145 init : init 5146 }; 5147 }; 5148 5149})( jQuery ); 5150 5151(function($) { 5152 'use strict'; 5153 5154 var MK = window.MK || {}; 5155 window.MK = MK; 5156 MK.component = window.MK.component || {}; 5157 MK.ui = window.MK.ui || {}; 5158 5159 MK.component.Preloader = function(el) { 5160 this.el = el; 5161 }; 5162 5163 MK.component.Preloader.prototype = { 5164 init: function init() { 5165 this.cacheElements(); 5166 this.bindEvents(); 5167 }, 5168 5169 cacheElements: function cacheElements() { 5170 this.$preloader = $(this.el); 5171 }, 5172 5173 bindEvents: function bindEvents() { 5174 this.onLoad(); // all components inited on page load 5175 }, 5176 5177 onLoad: function onLoad() { 5178 setTimeout(this.hidePreloader.bind(this), 300); 5179 }, 5180 5181 hidePreloader: function hidePreloader() { 5182 this.$preloader.hide(); 5183 } 5184 }; 5185 5186}(jQuery)); 5187 5188(function($) { 5189 'use strict'; 5190 5191 // Image added for proportional scaling 5192 MK.ui.loader = { 5193 tpl : function() { 5194 return '<div class="mk-loading-indicator">' + 5195 '<div class="mk-loading-indicator__inner">' + 5196 '<div class="mk-loading-indicator__icon"></div>' + 5197 '<img style="height:100%; width:auto;" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7">' + 5198 '</div>' + 5199 '</div>'; 5200 }, 5201 5202 add : function(item) { 5203 $(item).append(this.tpl); 5204 }, 5205 5206 remove : function(item) { 5207 if(item) $(item).find('.mk-loading-indicator').remove(); 5208 else $('.mk-loading-indicator').remove(); 5209 } 5210 }; 5211 5212}(jQuery)); 5213 5214var MK = window.MK || {}; 5215window.MK = MK; 5216MK.component = window.MK.component || {}; 5217 5218MK.component.ResponsiveImageSetter = (function ($) { 5219 5220 'use strict'; 5221 5222 var module = {}; 5223 5224 5225 /*---------------------------------------------------------------------------------*/ 5226 /* Private Variables 5227 /*---------------------------------------------------------------------------------*/ 5228 5229 var viewportClass = getViewportClass(); 5230 var isRetina = window.devicePixelRatio >= 2; 5231 5232 5233 /*---------------------------------------------------------------------------------*/ 5234 /* Private Methods 5235 /*---------------------------------------------------------------------------------*/ 5236 5237 function run($imgs) { 5238 $imgs.filter( function() { 5239 return !this.hasAttribute("mk-img-src-setted"); 5240 }).each(setSrcAttr); 5241 } 5242 5243 function setSrcAttr() { 5244 var $img = $(this); 5245 var set = $img.data('mk-image-src-set'); 5246 // Set src attribute to img link suitable for our logic. It will load the image. 5247 if(set['responsive'] === 'false' && isRetina && set['2x']) $img.attr('src', set['2x']); 5248 else if(set['responsive'] === 'false') $img.attr('src', set.default); 5249 else if(viewportClass === 1 && isRetina && set['2x']) $img.attr('src', set['2x']); // default x2 for retina 5250 else if(viewportClass === 0 && set.mobile) $img.attr('src', set.mobile); 5251 else $img.attr('src', set.default); 5252 5253 $img.load(function() { 5254 $(window).trigger('mk-image-loaded') 5255 }) 5256 } 5257 5258 function getViewportClass() { 5259 if(window.matchMedia('(max-width: 736px)').matches) return 0; 5260 else return 1; 5261 } 5262 5263 function handleResize($imgs) { 5264 if(!$imgs.length) return; // Do not run if empty collection 5265 var currentViewportClass = getViewportClass(); 5266 // We don't need to reload bigger images when screen size is decreasing as browser already performs resize operation. 5267 // Run update on for increasing screen size 5268 if( currentViewportClass > viewportClass) { 5269 viewportClass = currentViewportClass; // update for further reference 5270 run($imgs); 5271 } 5272 } 5273 5274 5275 /*---------------------------------------------------------------------------------*/ 5276 /* Public Methods 5277 /*---------------------------------------------------------------------------------*/ 5278 5279 module.init = function ($imgs) { 5280
5281 // Do not run if empty collection 5282 if(!$imgs.length) return; 5283 5284 // Run and bind to events 5285 run($imgs); 5286 $imgs.attr('mk-img-src-setted', ''); 5287 5288 }; 5289 5290 module.onResize = function ($imgs) { 5291 5292 $(window).on( 'resize', MK.utils.throttle( 500, function() { 5293 handleResize($imgs); 5294 })); 5295 5296 5297 }; 5298 5299 5300 module.handleAjax = function () { 5301 setTimeout(function ajaxDelayedCallback() { // give it a chance to insert content first 5302 var $newImgs = $('img[data-mk-image-src-set]').filter( function() { 5303 return !this.hasAttribute("mk-lazyload"); 5304 }); 5305 if(!$newImgs.length) return; 5306 run($newImgs); 5307 }, 100); 5308 } 5309 5310 5311 return module; 5312 5313}(jQuery)); 5314 5315 5316jQuery(function($) { 5317 5318 var init = function init() { 5319 // Get All Responsive Images 5320 var $allImages = $('img[data-mk-image-src-set]').filter(function(index) { 5321 var isNotPortfolioImage = !$(this).hasClass('portfolio-image'), 5322 isNotBlogImage = $(this).closest('.mk-blog-container').length == 0, 5323 isNotSwiperImage = !$(this).hasClass('swiper-slide-image'), 5324 isNotGalleryImage = !$(this).hasClass('mk-gallery-image'); 5325 return isNotPortfolioImage && isNotBlogImage && isNotSwiperImage && isNotGalleryImage; 5326 });; 5327 5328 // Handle the resize 5329 MK.component.ResponsiveImageSetter.onResize($allImages); 5330 5331 MK.component.ResponsiveImageSetter.init($allImages); 5332 5333 MK.utils.eventManager.subscribe('ajaxLoaded', MK.component.ResponsiveImageSetter.handleAjax ); // ajax loops 5334 MK.utils.eventManager.subscribe('ajax-preview', MK.component.ResponsiveImageSetter.handleAjax ); // ajax portfolio 5335 MK.utils.eventManager.subscribe('quickViewOpen', MK.component.ResponsiveImageSetter.handleAjax ); 5336 }
5337 init(); 5338 $(window).on('vc_reload', init); 5339 5340}); 5341 5342 5343 5344(function( $ ) { 5345 'use strict'; 5346 5347 var MK = window.MK || {}; 5348 window.MK = MK; 5349 MK.utils = window.MK.utils || {}; 5350 MK.val = window.MK.val || {}; 5351 5352 /** 5353 * Keep track of top Level sections so we can easly skip to next one. 5354 * We must be explicit about DOM level to nested sections. 5355 * The list of sections is static. If you'd need to refreh it on ajax etc do it with pub/sub (not really needed now). 5356 * We keep track for the same sections in Footer for mutating window location with '!loading' to prevent native anchor behaviour. 5357 */ 5358 var $topLevelSections = $('.jupiterx-main > .vc_row, .jupiterx-main > .mk-main-wrapper-holder, .jupiterx-main > .mk-page-section'); 5359 5360 $( document ).on( 'click', '.mk-skip-to-next', function() { 5361 var $this = $( this ), 5362 5363 /** 5364 * Static height of button + the space to the bottom of the container. 5365 * 5366 * @TODO Possible to calculate dynamically. 5367 */ 5368 btnHeight = $this.hasClass( 'edge-skip-slider' ) ? 150 : 76, 5369 offset = $this.offset().top + btnHeight, 5370 nextOffset = MK.utils.nextHigherVal( MK.utils.offsets( $topLevelSections ), [offset] ); 5371 5372 MK.utils.scrollTo( nextOffset ); 5373 }); 5374 5375})( jQuery ); 5376 5377 5378(function($) { 5379 5380 'use strict'; 5381 5382 var SkillDiagram = function( el ) { 5383 this.el = el; 5384 } 5385 5386 SkillDiagram.prototype = { 5387 init : function() { 5388 this.cacheElements(); 5389 this.createDiagram(); 5390 this.$skills.each( this.createSkill.bind( this ) ); 5391 }, 5392 5393 cacheElements : function() { 5394 this.$el = $( this.el ); 5395 this.$skills = this.$el.find( '.mk-meter-arch'); 5396 this.config = this.$el.data(); 5397 this.config.radius = this.config.dimension / 2; 5398 }, 5399 5400 random : function( l, u ) { 5401 return Math.floor( ( Math.random() * ( u - l + 1 ) ) + l ); 5402 }, 5403 5404 createDiagram : function() { 5405 var self = this; 5406 $(this.el).find('svg').remove(); 5407 5408 this.diagram = Raphael( this.el, this.config.dimension, this.config.dimension ); 5409 5410 // Make svg scalable in different screen sizes 5411 this.diagram.setViewBox(0,0,this.config.dimension,this.config.dimension,true); 5412 this.diagram.setSize('90%', '90%'); 5413 5414 this.diagram.circle( this.config.radius, this.config.radius, 80 ).attr({ 5415 stroke: 'none', 5416 fill: this.config.circleColor 5417 }); 5418 5419 // Export title 5420 this.title = this.diagram.text( this.config.radius, this.config.radius, this.config.defaultText ).attr({ 5421 font: "22px helvetica", 5422 fill: this.config.defaultTextColor 5423 }).toFront(); 5424 5425 this.diagram.customAttributes.arc = function(value, color, rad){ 5426 var v = 3.6 * value, 5427 alpha = v == 360 ? 359.99 : v, 5428 r = self.random( 91, 240 ), 5429 a = (r - alpha) * Math.PI/180, 5430 b = r * Math.PI/180, 5431 sx = self.config.radius + rad * Math.cos(b), 5432 sy = self.config.radius - rad * Math.sin(b), 5433 x = self.config.radius + rad * Math.cos(a), 5434 y = self.config.radius - rad * Math.sin(a), 5435 path = [['M', sx, sy], ['A', rad, rad, 0, +(alpha > 180), 1, x, y]]; 5436 5437 return { 5438 path: path, 5439 stroke: color 5440 } 5441 } 5442 }, 5443 5444 createSkill : function( id, el ) { 5445 var self = this, 5446 $this = $( el ), 5447 config = $this.data(), 5448 radMin = 72, 5449 radVal = 27, 5450 newRad = radMin + ( radVal * (id + 1) ); 5451 5452 var $path = this.diagram.path().attr({ 5453 'stroke-width': 28, 5454 arc: [config.percent, config.color, newRad] 5455 }); 5456 5457 $path.mouseover( function() { 5458 self.showSkill( this, config.name, config.percent ); 5459 }).mouseout( function() { 5460 self.hideSkill( this ) 5461 }); 5462 }, 5463 5464 showSkill : function( self, name, percent ) { 5465 var $this = self, 5466 time = 250; 5467 5468 //solves IE problem 5469 if(Raphael.type != 'VML') $this.toFront(); 5470 5471 $this.animate({ 5472 'stroke-width': 50, 5473 'opacity': 0.9, 5474 }, 800, 'elastic' ); 5475 5476 this.title.stop() 5477 .animate({ opacity: 0 }, time, '>', function(){ 5478 this.attr({ text: name + '\n' + percent + '%' }).animate({ opacity: 1 }, time, '<'); 5479 }).toFront(); 5480 }, 5481 5482 hideSkill : function( self ) { 5483 var $this = self, 5484 self = this, 5485 time = 250; 5486 5487 $this.stop().animate({ 5488 'stroke-width': 28, 5489 opacity: 1 5490 }, time * 4, 'elastic' ); 5491 5492 self.title.stop() 5493 .animate({ opacity: 0 }, time, '>', function(){ 5494 self.title.attr({ text: self.config.defaultText }) 5495 .animate({ opacity: 1 }, time, '<'); 5496 }); 5497 } 5498 } 5499
5500 var init = function init() { 5501 if( typeof Raphael === 'undefined' ) return; 5502 $( '.mk-skill-diagram' ).each( function() { 5503 var diagram = new SkillDiagram( this ); 5504 diagram.init(); 5505 }); 5506 } 5507 5508 init(); 5509 $(window).on('vc_reload', init); 5510 5511})(jQuery); 5512 5513/* Skill Meter and Charts */ 5514/* -------------------------------------------------------------------- */ 5515function mk_skill_meter() { 5516 "use strict"; 5517 if ($.exists('.mk-skill-meter')) { 5518 if (!MK.utils.isMobile()) { 5519 $(".mk-skill-meter .progress-outer").each(function() { 5520 var $this = $(this); 5521 5522 var build = function() { 5523 if (!$this.hasClass('scroll-animated')) { 5524 $this.addClass('scroll-animated'); 5525 $this.animate({ 5526 width: $this.attr("data-width") + '%' 5527 }, 2000); 5528 } 5529 }; 5530 5531 MK.utils.scrollSpy( this, { 5532 position: 'bottom', 5533 after: build 5534 }); 5535 }); 5536 } else { 5537 $(".mk-skill-meter .progress-outer").each(function() { 5538 var $this = $(this); 5539 if (!$this.hasClass('scroll-animated')) { 5540 $this.addClass('scroll-animated'); 5541 $this.css({ 5542 width: $(this).attr("data-width") + '%' 5543 }); 5544 } 5545 }); 5546 } 5547 } 5548} 5549 5550// function mk_charts() { 5551// "use strict"; 5552 5553// if( !$.exists('.mk-chart') ) return; 5554 5555// MK.core.loadDependencies([ MK.core.path.plugins + 'jquery.easyPieChart.js' ], function() { 5556 5557// $('.mk-chart').each(function() { 5558 5559// var $this = $(this), 5560// $parent_width = $(this).parent().width(), 5561// $chart_size = parseInt($this.attr('data-barSize')); 5562 5563// if ($parent_width < $chart_size) { 5564// $chart_size = $parent_width; 5565// $this.css('line-height', $chart_size); 5566// $this.find('i').css({ 5567// 'line-height': $chart_size + 'px' 5568// }); 5569// $this.css({ 5570// 'line-height': $chart_size + 'px' 5571// }); 5572// } 5573 5574// var build = function() { 5575// $this.easyPieChart({ 5576// animate: 1300, 5577// lineCap: 'butt', 5578// lineWidth: $this.attr('data-lineWidth'), 5579// size: $chart_size, 5580// barColor: $this.attr('data-barColor'), 5581// trackColor: $this.attr('data-trackColor'), 5582// scaleColor: 'transparent', 5583// onStep: function(value) { 5584// this.$el.find('.chart-percent span').text(Math.ceil(value)); 5585// } 5586// }); 5587// }; 5588 5589// // refactored only :in-viewport logic. rest is to-do 5590// MK.utils.scrollSpy( this, { 5591// position: 'bottom', 5592// after: build 5593// }); 5594 5595 5596// }); 5597// }); 5598// } 5599 5600(function($) { 5601 'use strict'; 5602 5603 var MK = window.MK || {}; 5604 window.MK = MK; 5605 MK.ui = window.MK.ui || {}; 5606 5607 // 5608 // Constructor 5609 // 5610 // ///////////////////////////////////////////////////////// 5611 5612 MK.ui.Slider = function( container, config ) { 5613 5614 var defaults = { 5615 slide : '.mk-slider-slide', 5616 nav : '.mk-slider-nav', 5617 effect : 'roulete', 5618 ease : 'easeOutQuart', // should not be changed, remove 5619 slidesPerView : 1, 5620 slidesToView : 1, 5621 transitionTime : 700, 5622 displayTime : 3000, 5623 autoplay : true, 5624 hasNav : true, 5625 hasPagination : true, 5626 paginationTpl : '<span></span>', 5627 paginationEl : '#pagination', 5628 draggable : true, 5629 fluidHeight : false, 5630 pauseOnHover : false, 5631 lazyload : false, 5632 activeClass : 'is-active', 5633 edgeSlider : false, 5634 spinnerTpl : '<div class="mk-slider-spinner-wrap"><div class="mk-slider-spinner-fallback"></div><svg class="mk-slider-spinner" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg"><circle class="mk-slider-spinner-path" fill="none" stroke-width="4" stroke-linecap="round" cx="33" cy="33" r="30"></circle></svg></div>', 5635 onInitialize : function() {}, 5636 onAfterSlide : function( id ) {}, 5637 onBeforeSlide : function( id ) {} 5638 }; 5639 5640 this.state = { 5641 id : 0, 5642 moveForward : true, 5643 running : false, 5644 zIFlow : null, 5645 stop : false, 5646 }; 5647 5648 this.config = $.extend( defaults, config ); 5649 this.container = container; 5650 5651 this.initPerView = this.config.slidesPerView; 5652 5653 // Timer holder 5654 this.activeTimer = null; 5655 this.autoplay = null; 5656 this.timer = null; 5657 this.timerRemaining = parseInt(this.config.displayTime); 5658 5659 // Boolean 'Em All, Making sure it's not string 5660 this.config.lazyload = JSON.parse(this.config.lazyload); 5661 this.config.edgeSlider = JSON.parse(this.config.edgeSlider); 5662 5663 // Image Loader Instance 5664 this.imageLoader = null; 5665 5666 // Add abort command to imagesLoaded, Placing it inside script makes it to work with different versions 5667 // of imagesLoaded if loaded by other Plugins 5668 imagesLoaded.prototype.abort = function() { 5669 this.progress = this.complete = function() { }; 5670 }; 5671 }; 5672 5673 5674 5675 // 5676 // Shared methods 5677 // 5678 // ///////////////////////////////////////////////////////// 5679 5680 MK.ui.Slider.prototype = { 5681 5682 init : function() { 5683 this.setPerViewItems(); 5684 this.cacheElements();
5685 this.getSlideSize(); 5686 this.bindEvents(); 5687 this.setSize(); 5688 this.setPos(); 5689 5690 // Hack for preparing 'prev' on first click if needed 5691 this.updateId( -1 ); 5692 this.updateId( 1 ); 5693 5694 this.val = this.dynamicVal(); 5695 this.timeline = this.prepareTimeline( this.config.transitionTime ); 5696 5697 this.timeline.build(); 5698 5699 if( this.config.hasPagination ) { this.buildPagination(); } 5700 5701 if( this.config.autoplay && document.hasFocus() ) { this.setTimer(); } 5702 5703 if( typeof this.config.onInitialize === 'function' ) { 5704 this.config.onInitialize( this.slides ); 5705 } 5706 5707 if( this.config.fluidHeight === true ) { 5708 $( this.slides ).height( 'auto' ); 5709 $( this.container ).css( 'transition', 'height ' + 200 + 'ms ease-out' ); 5710 this.setHeight( 0 ); 5711 } 5712 5713 5714 if( this.config.fluidHeight === 'toHighest' ) { 5715 this.setHeightToHighest(); 5716 } 5717 5718 // Create timer per slide if required 5719 $(this.slides).each(this.createTimer); 5720 5721 // If it's Edge Slider and Lazy Load is enabled 5722 if ( this.config.lazyload && this.config.edgeSlider ) { 5723 5724 // If It's not a Video Slide 5725 if ( $(this.slides[this.state.id]).find('video').length === 0 ) { 5726 // Set the first slide's BG image 5727 var $slideImg = $(this.slides[this.state.id]).children('[data-mk-img-set]'); 5728 MK.component.BackgroundImageSetter.init( $slideImg ); 5729 } 5730 $(this.config.spinnerTpl).prependTo( this.$slides ); 5731 5732 } else { 5733 5734 // Set all slides's BG images 5735 MK.component.BackgroundImageSetter.init( $(this.slides).children('[data-mk-img-set]') ); 5736 5737 } 5738 5739 5740 5741 }, 5742 5743 5744 cacheElements : function () { 5745 this.container = this.isNode( this.container ) ? this.container 5746 : document.querySelectorAll( this.container )[0]; 5747 this.slides = this.container.querySelectorAll( this.config.slide ); 5748 this.$slides = $(this.slides); 5749 5750 if( this.config.hasNav ) { this.$nav = $( this.config.nav ); } 5751 if( this.config.hasPagination ) { this.$pagination = $( this.config.paginationEl ); } 5752 }, 5753 5754 5755 bindEvents : function() { 5756 var $window = $( window ); 5757 5758 if( this.config.slidesPerView > 1 ) { $window.on( 'resize', this.setPerViewItems.bind( this ) ); } 5759 if( this.config.hasNav ) { this.eventsNav(); } 5760 if( this.config.hasPagination ) { this.eventsPag(); } 5761 if( this.config.draggable ) { this.dragHandler(); } 5762 if( this.config.autoplay ) { 5763 $window.on( 'focus', this.windowActive.bind( this ) ); 5764 $window.on( 'blur', this.windowInactive.bind( this ) ); 5765 } 5766 if( this.config.pauseOnHover ) { 5767 $(this.container).on( 'mouseleave', this.setTimer.bind( this ) ); 5768 $(this.container).on( 'mouseenter', this.unsetTimer.bind( this ) ); 5769 } 5770 if( this.config.fluidHeight === 'toHighest' ) { 5771 $window.on( 'resize', this.setHeightToHighest.bind( this ) ); 5772 } 5773 }, 5774 5775 5776 setPerViewItems: function() { 5777 if(window.matchMedia( '(max-width: 500px)' ).matches) { this.config.slidesPerView = 1; } 5778 else if(window.matchMedia( '(max-width: 767px)' ).matches && this.initPerView >= 2 ) { this.config.slidesPerView = 2; } 5779 else if(window.matchMedia( '(max-width: 1024px)' ).matches && this.initPerView >= 3 ) { this.config.slidesPerView = 3; } 5780 else { this.config.slidesPerView = this.initPerView; } 5781 5782 if( typeof this.slides === 'undefined' ) return; 5783 this.getSlideSize(); 5784 this.setSize(); 5785 this.setPos(); 5786 this.timeline = this.prepareTimeline( this.config.transitionTime ); 5787 this.timeline.build(); 5788 }, 5789 5790 5791 eventsNav : function() { 5792 this.$nav.on( 'click', 'a', this.handleNav.bind( this ) ); 5793 }, 5794 5795 5796 eventsPag : function() { 5797 this.$pagination.on( 'click', 'a', this.handlePagination.bind( this ) ); 5798 }, 5799 5800 5801 handleNav : function( e ) { 5802 e.preventDefault(); 5803 5804 if( this.state.running ) { return; } 5805 this.state.running = true; 5806 5807 var $this = $( e.currentTarget ), 5808 moveForward = $this.data( 'direction' ) === 'next'; 5809 5810 5811 if( this.config.autoplay ) { 5812 this.unsetTimer(); 5813 setTimeout( this.setTimer.bind( this ), this.config.transitionTime ); 5814 } 5815 5816 this.state.moveForward = moveForward; 5817 this.timeline.build(); 5818 this.timeline.play(); 5819 5820 this.setActive( this.nextId( moveForward ? 1 : -1 ) ); 5821 if( this.config.fluidHeight ) { this.setHeight( this.nextId( moveForward ? 1 : -1 ) ); } 5822 }, 5823 5824 5825 handlePagination : function( e ) { 5826 e.preventDefault(); 5827 5828 var $this = $( e.currentTarget ), 5829 id = $this.index(); 5830 5831 this.goTo( id ); 5832 }, 5833 5834 5835 reset: function() { 5836 this.state.stop = true; 5837 this.state.id = 0; 5838 this.setPos(); 5839 this.unsetTimer(); 5840 this.setTimer(); 5841 }, 5842 5843 5844 goTo : function(id) { 5845 if( this.state.running ) { return; } 5846 this.state.running = true; 5847 5848 var lastId = this.state.id; 5849 5850 if( lastId === id ) { 5851 return; 5852 } else if( lastId < id ) { 5853 this.state.moveForward = true; 5854 } else { 5855 this.state.moveForward = false;
5856 } 5857 5858 if( this.config.autoplay ) { 5859 this.unsetTimer(); 5860 setTimeout( this.setTimer.bind( this ), this.config.transitionTime ); 5861 } 5862 5863 this.timeline.build( Math.abs( lastId - id ) ); 5864 this.timeline.play(); 5865 5866 this.setActive( id ); 5867 if( this.config.fluidHeight ) { this.setHeight( id ); } 5868 }, 5869 5870 5871 windowActive : function() { 5872 this.setTimer(false, true); 5873 $(this.container).removeClass('is-paused'); 5874 }, 5875 5876 5877 windowInactive : function() { 5878 this.unsetTimer(); 5879 $(this.container).addClass('is-paused'); 5880 }, 5881 5882 5883 updateId : function( val ) { 5884 this.state.id = this.nextId(val); 5885 }, 5886 5887 nextId : function( val ) { 5888 var len = this.slides.length, 5889 insertVal = this.state.id + val; 5890 insertVal = ( insertVal >= 0 ) ? insertVal : len + val; 5891 insertVal = ( insertVal >= len ) ? 0 : insertVal; 5892 5893 return insertVal; 5894 }, 5895 5896 5897 setStyle : function( obj, style ) { 5898 var hasT = style.transform, 5899 t = { 5900 x : ( hasT ) ? style.transform.translateX : null, 5901 y : ( hasT ) ? style.transform.translateY : null, 5902 scale : ( hasT ) ? style.transform.scale : null, 5903 rotate : ( hasT ) ? style.transform.rotate : null, 5904 rotateX : ( hasT ) ? style.transform.rotateX : null, 5905 rotateY : ( hasT ) ? style.transform.rotateY : null 5906 }, 5907 z = 'translateZ(0)', 5908 x = (t.x) ? 'translateX(' + t.x + '%)' : 'translateX(0)', 5909 y = (t.y) ? 'translateY(' + t.y + '%)' : 'translateY(0)', 5910 s = (t.scale) ? 'scale(' + t.scale + ')' : 'scale(1)', 5911 r = (t.rotate) ? 'rotate(' + t.rotate + 'deg)' : 'rotate(0)', 5912 rX = (t.rotateX) ? 'rotateX(' + t.rotateX + 'deg)' : '', 5913 rY = (t.rotateY) ? 'rotateY(' + t.rotateY + 'deg)' : '', 5914 5915 o = style.opacity, 5916 h = style.height, 5917 w = style.width; 5918 5919 var c = z + x + y + s + r + rX + rY; 5920 5921 if( c.length ) { 5922 obj.style.webkitTransform = c; 5923 obj.style.msTransform = c; 5924 obj.style.transform = c; 5925 } 5926 5927 if( typeof o === 'number' ) { obj.style.opacity = o; } 5928 if( h ) { obj.style.height = h + '%'; } 5929 if( w ) { obj.style.width = w + '%'; } 5930 }, 5931 5932 5933 setPos : function() { 5934 if( typeof this.slides === 'undefined' ) return; 5935 var id = this.state.id, 5936 i = 0, 5937 len = this.slides.length, 5938 animation = this.animation[ this.config.effect ], 5939 axis = animation.axis, 5940 animNext = animation.next, 5941 animActi = animation.active, 5942 animPrev = animation.prev, 5943 perView = this.config.slidesPerView, 5944 slideId = null, 5945 zIFlow = null, 5946 style = {}; 5947 5948 style.transform = {}; 5949 5950 5951 for( ; i < len; i += 1 ) { 5952 if(i < perView) { 5953 // Position for visible slides. Apply active styles 5954 style = animActi; 5955 style.transform[ 'translate' + axis ] = i * 100; 5956 } else { 5957 // Rest slides move after edge based on axis and moveForward. Apply Next / Prev styles 5958 style = this.state.moveForward ? animNext : animPrev; 5959 style.transform[ 'translate' + axis ] = this.state.moveForward ? perView * 100 : -100; 5960 } 5961 5962 this.slides[ i ].style.zIndex = 0; 5963 5964 slideId = ( i + id ) % len; 5965 this.setStyle( this.slides[ slideId ], style ); 5966 } 5967 }, 5968 5969 5970 // When we're setting animation along Y axis we're going to set up height 5971 // otherwise width. It is shared amongst all slides 5972 setSize : function() { 5973 if( typeof this.slides === 'undefined' ) return; 5974 var i = 0, 5975 len = this.slides.length, 5976 axis = this.animation[ this.config.effect ].axis, 5977 slideSize = this.slideSize, 5978 style = {}; 5979 5980 if( axis === 'Y' ) { 5981 style.height = slideSize[ axis ]; 5982 } else { 5983 style.width = slideSize[ axis ]; 5984 } 5985 5986 for( ; i < len; i += 1 ) { 5987 this.setStyle( this.slides[ i ], style ); 5988 } 5989 }, 5990 5991 5992 setHeight : function( id ) { 5993 var $slides = $( this.slides ), 5994 $activeSlide = $slides.eq( id ); 5995 5996 var currentHeight = $activeSlide.height(); 5997 $( this.container ).height( currentHeight ); 5998 }, 5999 6000 6001 setHeightToHighest : function() { 6002 // this is becouse of alliginig woocommrece carousel. Too much DOM 6003 // Refactor someday 6004 var $slides = $( this.slides ), 6005 height = 0; 6006 6007 $slides.each(function() { 6008 height = Math.max(height, $(this).find('> div').outerHeight()); 6009 }); 6010 6011 $( this.container ).height( height ); 6012 }, 6013 6014 6015 // Little utility inspired by GreenSock. 6016 // We export this to this.timeline on init. 6017 prepareTimeline : function( time ) { 6018 var self = this, 6019 iteration = 0, 6020 totalIter = time / (1000 / 60), 6021 animLoop = [], 6022 aL = 0, // animation length 6023 loops = 1, 6024 ease = this.config.ease, 6025 currentStyle, timeProg, 6026 build, move, add, play, reverse, progress, kill; 6027 6028 6029 // Build constants, run them only once 6030 // take out possibly 6031 var len = this.slides.length, 6032 perView = this.config.slidesPerView, 6033 animation = this.animation[ this.config.effect ], 6034 animAxis = animation.axis, 6035 animNext = animation.next, 6036 animActi = animation.active, 6037 animPrev = animation.prev, 6038 style = {}, 6039 slideId = null, 6040 zIFlow = null; 6041 6042 style.transform = {}; 6043 6044 6045 build = function( repeats ) { 6046 var currentEase = ease; 6047 loops = repeats || loops; 6048 6049 // console.log('build', loops); 6050 6051 if( !loops ) { return; } 6052 if( loops > 1 ) { 6053 currentEase = 'linearEase'; 6054 } 6055 6056 // clean before running new build 6057 kill(); 6058 // set new positions 6059 self.setPos(); 6060 6061 var id = self.state.id, 6062 moveForward = self.state.moveForward, 6063 i = 0, 6064 axisMove = (moveForward) ? -100 : 100; 6065
6066 for( ; i <= perView; i += 1 ) { 6067 slideId = ( (moveForward) ? i + id : i + id - 1 ) % len; 6068 slideId = ( slideId < 0 ) ? len + slideId : slideId; 6069 6070 if( i === 0 ) { 6071 style = moveForward ? animPrev : animActi; 6072 } else if( i === perView ) { 6073 style = moveForward ? animActi : animNext; 6074 } else { 6075 style = animActi; 6076 } 6077 6078 zIFlow = (self.state.moveForward) ? animNext.zIndex : animPrev.zIndex; 6079 if( zIFlow ) { 6080 // console.log( zIFlow ); 6081 self.slides[ slideId ].style.zIndex = (zIFlow === '+') ? i + 1 : len - i; 6082 } 6083 6084 style.transform[ 'translate' + animAxis ] = axisMove; 6085 add( self.slides[ slideId ], style, currentEase ); 6086 } 6087 }; 6088 6089 add = function( slide, toStyles, ease ) { 6090 if( typeof slide === 'undefined' ) { 6091 throw 'Add at least one slide'; 6092 } 6093 6094 var fromStyles = slide.style, 6095 style = self.refStyle( toStyles, fromStyles ); 6096 6097 animLoop.push( [slide, style, ease] ); 6098 aL += 1; 6099 }; 6100 6101 move = function( startProg, mode ) { 6102 var currentTotalIter = totalIter; 6103 6104 if( loops > 1 ) { 6105 currentTotalIter = totalIter / 5; 6106 } 6107 6108 if( !self.state.running ) { self.state.running = true; } 6109 6110 if( startProg ) { 6111 // update iteration val to cached outside var 6112 // ceil to handle properly play after mouse up / touch end 6113 iteration = Math.ceil(startProg * currentTotalIter); 6114 } 6115 6116 timeProg = iteration / currentTotalIter; 6117 progress( timeProg ); 6118 6119 // Break loop 6120 if( iteration >= currentTotalIter && mode === 'play' || 6121 iteration <= 0 && mode === 'reverse' ) { 6122 6123 self.state.running = false; 6124 iteration = 0; 6125 kill(); 6126 self.updateId( self.state.moveForward ? 1 : -1 ); 6127 // If we're creating multiple animation loop we trigger outside only first pass to start all game. 6128 // the rest are triggered as callback 6129 loops -= 1; 6130 if( loops > 0 ) { 6131 build(); 6132 play(); 6133 } 6134 6135 // if we run all loops reset back the default value 6136 if( !loops ) { 6137 loops = 1; 6138 self.timerRemaining = parseInt(self.config.displayTime); 6139 self.config.onAfterSlide( self.state.id ); 6140 } 6141 6142 return; 6143 } 6144 6145 // Run in given mode 6146 if( mode === 'play') { 6147 iteration += 1; 6148 } else { 6149 iteration -= 1; 6150 } 6151 6152 requestAnimationFrame( function() { 6153 if(self.state.stop) return; 6154 move( 0, mode ); 6155 }); 6156 }; 6157 6158 play = function( startProg ) { 6159 6160 var $nextSlide = $(self.slides[ self.nextId(self.state.moveForward ? 1 : -1) ] ); 6161 6162 // If it's Edge Slider and Lazy Load is enabled and It's not a Video Slide 6163 if ( self.config.lazyload && self.config.edgeSlider ) { 6164 6165 // Set the next slide's BG Image 6166 var $slideImg = $nextSlide.find('[data-mk-img-set]'); 6167 if ( $slideImg.length ) { 6168 MK.component.BackgroundImageSetter.init( $slideImg ); 6169 } 6170 6171 } 6172 6173 self.config.onBeforeSlide( self.nextId(self.state.moveForward ? 1 : -1) ); 6174 var start = startProg || 0; 6175 iteration = 0; 6176 self.state.stop = false; 6177 move( start, 'play' ); 6178 6179 }; 6180 6181 reverse = function( startProg ) { 6182 var start = startProg || 1; 6183 move( start, 'reverse' ); 6184 }; 6185 6186 progress = function( progVal ) { 6187 var aI = 0, 6188 currentStyle; 6189 6190 for( aI; aI < aL; aI++ ) { 6191 if( progVal !== 1 && progVal !== 0 ) { 6192 currentStyle = self.currentStyle( progVal, animLoop[ aI ][ 1 ], animLoop[ aI ][ 2 ] ); 6193 } else if( progVal === 1) { 6194 currentStyle = self.currentStyle( progVal, animLoop[ aI ][ 1 ], 'linearEase' ); 6195 } else if ( progVal === 0 ) { 6196 currentStyle = self.currentStyle( progVal, animLoop[ aI ][ 1 ], 'linearEase' ); 6197 } 6198 self.setStyle( animLoop[ aI ][ 0 ], currentStyle ); 6199 } 6200 }; 6201 6202 // Clear previous loop 6203 kill = function() { 6204 animLoop = []; 6205 aL = 0; 6206 }; 6207 6208 6209 return { 6210 build : build, 6211 add : add, 6212 play : play, 6213 reverse : reverse, 6214 progress : progress 6215 }; 6216 }, 6217 6218 6219 // Build reference styles. 6220 // Return object with array containig initial style and change of its value 6221 // as required for easing functions 6222 refStyle : function( toStyles, fromStyles ) { 6223 var axis = this.animation[ this.config.effect ].axis, 6224 style = {}, 6225 initVal, changeVal, endVal, dynamicEnd, styleProp, transProp, transform; 6226 6227 for( styleProp in toStyles ) { 6228 6229 if( styleProp === 'transform' ) { 6230 transform = this.getTransforms( fromStyles ); 6231 style.transform = {}; 6232 6233 for( transProp in toStyles.transform ) { 6234 // don't care about z 6235 if( transProp === 'translateZ' ) { continue; } 6236 6237 initVal = transform[ transProp ] || 0; // if it is undefined it means it's 0 6238 dynamicEnd = ( transProp === 'translate' + axis ) ? initVal : 0; 6239 endVal = toStyles.transform[ transProp ] + dynamicEnd; // it is dynamic, based on slide position in current set 6240 changeVal = endVal - initVal; 6241 style.transform[ transProp ] = [ initVal, changeVal ]; 6242 } 6243 } else if( styleProp === 'zIndex' ) { 6244 // console.log( 'z' ); 6245 continue; 6246 } else { 6247 initVal = parseFloat( fromStyles[ styleProp ] ) || 0; // if it is undefined it means it's 0 6248 endVal = toStyles[ styleProp ]; 6249 changeVal = endVal - initVal; 6250 style[ styleProp ] = [ initVal, changeVal ]; 6251 } 6252 } 6253 6254 return style; 6255 }, 6256 6257 6258 currentStyle : function( progress, style, ease ) { 6259 var self = this, 6260 currentStyle = {}, 6261 currentVals, styleProp, transProp, prog; 6262 6263 // Redo same loop but construct currentStyle object out of cached values 6264 for( styleProp in style ) { 6265 6266 if( styleProp === 'transform' ) { 6267 currentStyle.transform = {}; 6268 6269 for( transProp in style.transform ) { 6270 // remove this line. double check first if needed by logging 6271 if( transProp === 'translateZ' ) { continue; } 6272 6273 currentVals = style.transform[ transProp ]; 6274 currentStyle.transform[ transProp ] = 6275 // (currentIteration, startValue, changeInValue, totalIterations) 6276 self.ease[ ease ]( progress, currentVals[ 0 ], currentVals[ 1 ], 1 ); 6277 } 6278 } else { 6279 currentVals = style[ styleProp ]; 6280 currentStyle[ styleProp ] = 6281 self.ease[ ease ]( progress, currentVals[ 0 ], currentVals[ 1 ], 1 ); 6282 } 6283 } 6284 6285 return currentStyle; 6286 }, 6287 6288 6289 setActive : function( id ) { 6290 var $slides = $( this.slides ), 6291 className = this.config.activeClass; 6292 6293 $slides.removeClass( className ); 6294 6295 if( this.config.hasPagination ) { 6296 var $pagination = this.$pagination.find( 'a' ); 6297 $pagination.removeClass( className ); 6298 $pagination.eq( id ).addClass( className ); 6299 } 6300 6301 if( this.activeTimer ) { 6302 clearTimeout( this.activeTimer ); 6303 if ( this.imageLoader ) { 6304 this.imageLoader.abort(); 6305 } 6306 } 6307 6308 6309 var self = this; 6310 6311 this.activeTimer = setTimeout( function() { 6312 6313 var $currentSlide = $slides.eq( id ); 6314 6315 if ( self.config.lazyload && self.config.edgeSlider ) { // If it's Edge Slider and Lazy Load is enabled 6316
6317 if ( $currentSlide.find('.mk-section-video').length && $currentSlide.children('.mk-video-section-touch').length ) { // If it's a Video Slide and has a Preview image 6318 6319 var imgSet = $currentSlide.children('.mk-video-section-touch').data('mk-img-set'); 6320 var exactImg = MK.component.BackgroundImageSetter.getImage( imgSet ); 6321 var $bgImage = $('<img>').attr('src', exactImg ); 6322 6323 self.imageLoader = imagesLoaded( $bgImage[0], function( instance ) { 6324 $currentSlide.children('.mk-slider-spinner-wrap').addClass('mk-slider-spinner-wrap-hidden'); 6325 setTimeout( function() { 6326 $currentSlide.children('.mk-slider-spinner-wrap').hide(); 6327 }, 200); 6328 $currentSlide.addClass( className ); 6329 }); 6330 6331 } else if ( $currentSlide.find('.mk-section-video').length && $currentSlide.children('.mk-video-section-touch').length === 0 ) { // If it's a Video Slide and has NOT a Preview image 6332 6333 $currentSlide.children('.mk-slider-spinner-wrap').addClass('mk-slider-spinner-wrap-hidden'); 6334 setTimeout( function() { 6335 $currentSlide.children('.mk-slider-spinner-wrap').hide(); 6336 }, 200); 6337 $currentSlide.addClass( className ); 6338 6339 } else { // If it's a Image Slide 6340 6341 if ( $currentSlide.children('[data-mk-img-set]').length ) { 6342 // Get the matching Image URL to start lazy loading 6343 var imgSet = $currentSlide.children('[data-mk-img-set]').data('mk-img-set'); 6344 var exactImg = MK.component.BackgroundImageSetter.getImage( imgSet ); 6345 var $bgImage = $('<img>').attr('src', exactImg ); 6346 6347 // Prevent counting time on slide until the image loads 6348 self.unsetTimer(); 6349 self.imageLoader = imagesLoaded( $bgImage[0], function( instance ) { 6350 // Hide spinner, Continue counting time on slide and show the content 6351 $currentSlide.children('.mk-slider-spinner-wrap').addClass('mk-slider-spinner-wrap-hidden'); 6352 setTimeout( function() { 6353 $currentSlide.children('.mk-slider-spinner-wrap').hide(); 6354 }, 200); 6355 self.setTimer(false, false, $currentSlide.data('timer') || Number(self.config.displayTime) ); 6356 $currentSlide.addClass( className ); 6357 }); 6358 } else { 6359 $currentSlide.children('.mk-slider-spinner-wrap').addClass('mk-slider-spinner-wrap-hidden'); 6360 setTimeout( function() { 6361 $currentSlide.children('.mk-slider-spinner-wrap').hide(); 6362 }, 200); 6363 self.setTimer(false, false, $currentSlide.data('timer') || Number(self.config.displayTime) ); 6364 $currentSlide.addClass( className ); 6365 } 6366 6367 } 6368 6369 } else { 6370 6371 $currentSlide.addClass( className ); 6372 6373 } 6374 6375 6376 }, this.config.transitionTime ); 6377 }, 6378 6379 createTimer : function() { 6380 6381 var $slide = $(this), 6382 video = $slide.find('video').get(0); 6383 6384 if(video) { 6385 // A hacky but reliable way to ge the video duration 6386 var interval = setInterval( function() { 6387 // If the metadata is ready 6388 if ( video.readyState > 0 ) { 6389 $slide.data('timer', (video.duration * 1000)); 6390 $slide.attr('data-timer', (video.duration * 1000)); 6391 clearInterval(interval); 6392 } 6393 }, 100); 6394 } 6395 6396 }, 6397 6398 setTimer : function( isFirst, isPaused, fixed_time ) { 6399 // check for custom timer 6400 var customTimer = this.$slides.eq(this.nextId(this.state.moveForward ? 1 : -1)).data('timer'), 6401 trans = parseInt( this.config.transitionTime ), 6402 interval = customTimer ? customTimer : parseInt( this.config.displayTime ), 6403 timer = interval + trans; 6404 6405 var self = this, 6406 first = isFirst || true, 6407 fixed_time = fixed_time || 0, 6408 create, run; 6409 6410 this.timer = true; 6411 this.lastSetTimer = Date.now(); 6412 6413 create = function() { 6414 6415 if( self.autoplay ) { clearTimeout( self.autoplay ); } 6416 if( !self.timer ) { 6417 return; 6418 } 6419 self.state.moveForward = true; 6420 self.timeline.build(); 6421 self.timeline.play(); 6422 self.setActive( self.nextId( 1 ) ); 6423 if( self.config.fluidHeight ) { self.setHeight( self.nextId( 1 ) ); } 6424 first = false; 6425 self.lastSetTimer = Date.now(); 6426 6427 run(); 6428 }; 6429 6430 run = function(newInterval) { 6431 // check for custom timer 6432 customTimer = self.$slides.eq(self.nextId(self.state.moveForward ? 1 : -1)).data('timer'); 6433 interval = customTimer ? customTimer : parseInt( self.config.displayTime ); 6434 timer = interval + trans; // update timer with current val 6435 6436 var time = newInterval || timer; 6437 self.autoplay = setTimeout( create, time ); 6438 }; 6439 6440 if ( fixed_time ) { 6441 run( fixed_time ); 6442 } else if (isPaused) { 6443 run( this.timerRemaining ); 6444 } else { 6445 run(); 6446 } 6447 }, 6448 6449 6450 unsetTimer : function() { 6451 this.timer = false;
6452 this.lastUnsetTimer = Date.now(); 6453 this.timerRemaining -= this.lastUnsetTimer - this.lastSetTimer; 6454 if( this.autoplay ) { clearTimeout( this.autoplay ); } 6455 }, 6456 6457 6458 buildPagination : function() { 6459 var i = 0, 6460 len = this.slides.length, 6461 tpl = ''; 6462 6463 for( ; i < len; i += 1 ) { 6464 tpl += '<a href="javascript:;">' + this.config.paginationTpl + '</a>'; 6465 } 6466 6467 this.$pagination.html( tpl ); 6468 this.setActive( 0 ); 6469 }, 6470 6471 6472 getSlideSize : function() { 6473 this.slideSize = { 6474 X: 100 / this.config.slidesPerView, 6475 Y: 100 / this.config.slidesPerView 6476 }; 6477 }, 6478 6479 6480 getTransforms : function( style ) { 6481 // console.log( style ); 6482 var transform = style.transform || style.webkitTransform || style.mozTransform, 6483 regex = /(\w+)\(([^)]*)\)/g, 6484 match, 6485 T = {}; 6486 6487 if( typeof transform !== 'string' ) { 6488 throw 'Transform prop is not a string.'; 6489 } 6490 6491 if( !transform ) { return; } 6492 6493 // Run regex assignment 6494 while( match = regex.exec( transform ) ) { 6495 T[ match[ 1 ] ] = parseFloat( match[ 2 ] ); 6496 } 6497 6498 return T; 6499 }, 6500 6501 isNode : function( o ) { 6502 return ( 6503 typeof Node === "object" ? o instanceof Node : 6504 o && typeof o === "object" && typeof o.nodeType === "number" && typeof o.nodeName==="string" 6505 ); 6506 }, 6507 6508 6509 dragHandler : function() { 6510 var self = this, 6511 $container = $( this.container ), 6512 prevBuild = false, 6513 nextBuild = false, 6514 dragging = false, 6515 buffor = 5, // helpful for decoupling with click events 6516 dragStart, dragMove, dragEnd, progress; 6517 6518 progress = function( moveX ) { 6519 return moveX / self.val.viewportW(); 6520 }; 6521 6522 dragStart = function( moveX, startX ) { 6523 // console.log( 'start', moveX, startX ); 6524 }; 6525 6526 dragMove = function( moveX ) { 6527 // console.log('move'); 6528 if( self.state.running ) return; 6529 6530 // Don't need to check for existance here 6531 6532 if( moveX < -buffor ) { 6533 6534 if( !nextBuild ) { 6535 self.state.moveForward = true; 6536 self.timeline.build(); 6537 nextBuild = true; 6538 prevBuild = false; 6539 self.unsetTimer(); 6540 } else { 6541 // turn progress into positive val 6542 self.timeline.progress( -progress( moveX ) ); 6543 } 6544 dragging = true; 6545 } else if( moveX > buffor ) { 6546 6547 if( !prevBuild ) { 6548 self.state.moveForward = false; 6549 self.timeline.build(); 6550 prevBuild = true; 6551 nextBuild = false; 6552 self.unsetTimer(); 6553 } else { 6554 self.timeline.progress( progress( moveX ) ); 6555 } 6556 dragging = true; 6557 } 6558 }; 6559 6560 dragEnd = function( moveX ) { 6561 if( dragging ) { 6562 var prog = progress( moveX ), 6563 absProg = prog < 0 ? -prog : prog; 6564 6565 if( absProg > 0.1 ) { 6566 self.timeline.play( absProg ); 6567 self.setActive( self.nextId( prog < 0 ? 1 : -1 ) ); 6568 if( self.config.fluidHeight ) { self.setHeight( self.nextId( prog < 0 ? 1 : -1 ) ); } 6569 } else { 6570 self.timeline.reverse( absProg ); 6571 // eventually move this to reverse callbacks 6572 if(prog < 0) { 6573 self.updateId( -1 ); 6574 } else { 6575 self.updateId( 1 ); 6576 } 6577 } 6578 6579 prevBuild = false; 6580 nextBuild = false; 6581 dragging = false; 6582 if( self.config.autoplay ) { self.setTimer( false ); } 6583 } 6584 }; 6585 6586 this.drag( $container, dragStart, dragMove, dragEnd ); 6587 }, 6588 6589 6590 drag : function( $el, startFn, moveFn, stopFn ) { 6591 6592 var touchX, touchY, movX, movY, go, evt, 6593 prevent, start, move, stop; 6594 6595 prevent = function( e ) { 6596 e.preventDefault(); 6597 }; 6598 6599 start = function( e ) { 6600 // $el.on("touchmove", prevent); 6601 $el.on("mousemove", prevent); 6602 $el.on("touchmove", move); 6603 $el.on("mousemove", move); 6604 6605 evt = (e.type === 'touchstart') ? e.originalEvent.touches[0] : e; 6606 touchX = evt.pageX; 6607 6608 if(typeof startFn === 'function') { 6609 startFn(movX, touchX); 6610 } 6611 }; 6612 6613 move = function( e ) { 6614 evt = (e.type === 'touchmove') ? e.originalEvent.touches[0] : e; 6615 movX = evt.pageX - touchX; 6616 6617 if(typeof moveFn === 'function') { 6618 moveFn(movX); 6619 } 6620 }; 6621 6622 stop = function( e ) { 6623 // $el.off("touchmove", prevent); 6624 $el.off("mousemove", prevent); 6625 $el.off("touchmove", move); 6626 $el.off("mousemove", move); 6627 6628 if(typeof stopFn === 'function') { 6629 stopFn(movX); 6630 } 6631 }; 6632 6633 $el.on("touchstart", start); 6634 $el.on("mousedown", start); 6635 $el.on("touchend", stop); 6636 $el.on("touchleave", stop); 6637 $el.on("touchcancel", stop);
6638 $el.on("mouseup", stop); 6639 $el.on("mouseleave", stop); 6640 }, 6641 6642 6643 dynamicVal : function() { 6644 var $window = $( window ), 6645 update, 6646 getViewportW, viewportW; 6647 6648 update = function() { 6649 viewportW = $window.width(); 6650 }; 6651 6652 getViewportW = function() { 6653 return viewportW; 6654 }; 6655 6656 update(); 6657 $window.on( 'load', update ); 6658 $window.on( 'resize', update ); 6659 6660 return { 6661 viewportW : getViewportW 6662 }; 6663 } 6664 }; 6665 6666 6667 6668 // 6669 // Set of default animations 6670 // 6671 // ///////////////////////////////////////////////////////// 6672 6673 MK.ui.Slider.prototype.animation = { 6674 6675 slide : { 6676 axis : 'X', 6677 next : { transform: {} }, 6678 active : { transform: {} }, 6679 prev : { transform: {} } 6680 }, 6681 6682 vertical_slide : { 6683 axis : 'Y', 6684 next : { transform: {} }, 6685 active : { transform: {} }, 6686 prev : { transform: {} } 6687 }, 6688 6689 perspective_flip : { 6690 axis : 'Y', 6691 next : { 6692 transform: { 6693 rotateX : 80 6694 } 6695 }, 6696 active : { 6697 transform: { 6698 rotateX : 0 6699 } 6700 }, 6701 prev : { 6702 transform: { 6703 rotateX : 0 6704 } 6705 } 6706 }, 6707 6708 zoom : { 6709 axis : 'Z', 6710 next: { 6711 opacity : 0, 6712 transform : { 6713 scale : 0.9 6714 } 6715 }, 6716 active: { 6717 opacity : 1, 6718 transform : { 6719 scale : 1 6720 } 6721 }, 6722 prev: { 6723 opacity : 0, 6724 transform : { 6725 scale : 1.1 6726 } 6727 } 6728 }, 6729 6730 fade : { 6731 axis : 'Z', 6732 next: { 6733 opacity : 0, 6734 transform : {} 6735 }, 6736 active: { 6737 opacity : 1, 6738 transform : {} 6739 }, 6740 prev: { 6741 opacity : 0, 6742 transform : {} 6743 } 6744 }, 6745 6746 kenburned : { 6747 axis : 'Z', 6748 next: { 6749 opacity : 0, 6750 transform : {} 6751 }, 6752 active: { 6753 opacity : 1, 6754 transform : {} 6755 }, 6756 prev: { 6757 opacity : 0, 6758 transform : {} 6759 } 6760 }, 6761 6762 zoom_out : { 6763 axis : 'Z', 6764 next: { 6765 zIndex : '+', 6766 opacity : 1, 6767 transform : { 6768 translateY : 100, 6769 scale : 1 6770 } 6771 }, 6772 active: { 6773 opacity : 1, 6774 transform : { 6775 translateY : 0, 6776 scale : 1 6777 } 6778 }, 6779 prev: { 6780 zIndex : '+', 6781 opacity : 0, 6782 transform : { 6783 translateY : 0, 6784 scale : 0.5 6785 } 6786 } 6787 }, 6788 6789 // Problem with Z-Flow 6790 horizontal_curtain : { 6791 axis : 'Z', 6792 next: { 6793 zIndex : '+', 6794 transform : { 6795 translateX : 100, 6796 } 6797 }, 6798 active: { 6799 transform : { 6800 translateX : 0, 6801 } 6802 }, 6803 prev: { 6804 zIndex : '+', 6805 transform : { 6806 translateX : -70, 6807 } 6808 } 6809 }, 6810 6811 roulete : { 6812 axis : 'X', 6813 next: { 6814 opacity : 0.5, 6815 transform : { 6816 scale : 0.5, 6817 rotate : 10, 6818 translateY : 20 6819 } 6820 }, 6821 active: { 6822 opacity : 1, 6823 transform : { 6824 scale : 1, 6825 rotate : 0, 6826 translateY : 0 6827 } 6828 }, 6829 prev: { 6830 opacity : 0.3, 6831 transform : { 6832 scale : 0.5, 6833 rotate : -10, 6834 translateY : 20 6835 } 6836 } 6837 } 6838 }; 6839 6840 6841 6842 // 6843 // Penner's easing library 6844 // 6845 // ///////////////////////////////////////////////////////// 6846 6847 MK.ui.Slider.prototype.ease = { 6848 /* 6849 *
6850 * TERMS OF USE - EASING EQUATIONS 6851 * 6852 * Open source under the BSD License. 6853 * 6854 * Copyright © 2001 Robert Penner 6855 * All rights reserved. 6856 * 6857 * Redistribution and use in source and binary forms, with or without modification, 6858 * are permitted provided that the following conditions are met: 6859 * 6860 * Redistributions of source code must retain the above copyright notice, this list of 6861 * conditions and the following disclaimer. 6862 * Redistributions in binary form must reproduce the above copyright notice, this list 6863 * of conditions and the following disclaimer in the documentation and/or other materials 6864 * provided with the distribution. 6865 * 6866 * Neither the name of the author nor the names of contributors may be used to endorse 6867 * or promote products derived from this software without specific prior written permission. 6868 * 6869 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 6870 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 6871 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 6872 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 6873 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 6874 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 6875 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 6876 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 6877 * OF THE POSSIBILITY OF SUCH DAMAGE. 6878 * 6879 */ 6880 linearEase : function(currentIteration, startValue, changeInValue, totalIterations) { 6881 return changeInValue * currentIteration / totalIterations + startValue; 6882 }, 6883 6884 easeInQuad : function(currentIteration, startValue, changeInValue, totalIterations) { 6885 return changeInValue * (currentIteration /= totalIterations) * currentIteration + startValue; 6886 }, 6887 6888 easeOutQuad : function(currentIteration, startValue, changeInValue, totalIterations) { 6889 return -changeInValue * (currentIteration /= totalIterations) * (currentIteration - 2) + startValue; 6890 }, 6891 6892 easeInOutQuad : function(currentIteration, startValue, changeInValue, totalIterations) { 6893 if ((currentIteration /= totalIterations / 2) < 1) { 6894 return changeInValue / 2 * currentIteration * currentIteration + startValue; 6895 } 6896 return -changeInValue / 2 * ((--currentIteration) * (currentIteration - 2) - 1) + startValue; 6897 }, 6898 6899 easeInCubic : function(currentIteration, startValue, changeInValue, totalIterations) { 6900 return changeInValue * Math.pow(currentIteration / totalIterations, 3) + startValue; 6901 }, 6902 6903 easeOutCubic : function(currentIteration, startValue, changeInValue, totalIterations) { 6904 return changeInValue * (Math.pow(currentIteration / totalIterations - 1, 3) + 1) + startValue; 6905 }, 6906 6907 easeInOutCubic : function(currentIteration, startValue, changeInValue, totalIterations) { 6908 if ((currentIteration /= totalIterations / 2) < 1) { 6909 return changeInValue / 2 * Math.pow(currentIteration, 3) + startValue; 6910 } 6911 return changeInValue / 2 * (Math.pow(currentIteration - 2, 3) + 2) + startValue; 6912 }, 6913 6914 easeInQuart : function(currentIteration, startValue, changeInValue, totalIterations) { 6915 return changeInValue * Math.pow (currentIteration / totalIterations, 4) + startValue; 6916 }, 6917 6918 easeOutQuart : function(currentIteration, startValue, changeInValue, totalIterations) { 6919 return -changeInValue * (Math.pow(currentIteration / totalIterations - 1, 4) - 1) + startValue; 6920 }, 6921 6922 easeInOutQuart : function(currentIteration, startValue, changeInValue, totalIterations) { 6923 if ((currentIteration /= totalIterations / 2) < 1) { 6924 return changeInValue / 2 * Math.pow(currentIteration, 4) + startValue; 6925 } 6926 return -changeInValue/2 * (Math.pow(currentIteration - 2, 4) - 2) + startValue; 6927 }, 6928 6929 easeInQuint : function(currentIteration, startValue, changeInValue, totalIterations) { 6930 return changeInValue * Math.pow (currentIteration / totalIterations, 5) + startValue; 6931 }, 6932 6933 easeOutQuint : function(currentIteration, startValue, changeInValue, totalIterations) { 6934 return changeInValue * (Math.pow(currentIteration / totalIterations - 1, 5) + 1) + startValue; 6935 }, 6936 6937 easeInOutQuint : function(currentIteration, startValue, changeInValue, totalIterations) { 6938 if ((currentIteration /= totalIterations / 2) < 1) { 6939 return changeInValue / 2 * Math.pow(currentIteration, 5) + startValue; 6940 } 6941 return changeInValue / 2 * (Math.pow(currentIteration - 2, 5) + 2) + startValue; 6942 }, 6943 6944 easeInSine : function(currentIteration, startValue, changeInValue, totalIterations) { 6945 return changeInValue * (1 - Math.cos(currentIteration / totalIterations * (Math.PI / 2))) + startValue; 6946 }, 6947 6948 easeOutSine : function(currentIteration, startValue, changeInValue, totalIterations) { 6949 return changeInValue * Math.sin(currentIteration / totalIterations * (Math.PI / 2)) + startValue; 6950 }, 6951 6952 easeInOutSine : function(currentIteration, startValue, changeInValue, totalIterations) { 6953 return changeInValue / 2 * (1 - Math.cos(Math.PI * currentIteration / totalIterations)) + startValue; 6954 }, 6955 6956 easeInExpo : function(currentIteration, startValue, changeInValue, totalIterations) { 6957 return changeInValue * Math.pow(2, 10 * (currentIteration / totalIterations - 1)) + startValue; 6958 }, 6959 6960 easeOutExpo : function(currentIteration, startValue, changeInValue, totalIterations) { 6961 return changeInValue * (-Math.pow(2, -10 * currentIteration / totalIterations) + 1) + startValue; 6962 }, 6963 6964 easeInOutExpo : function(currentIteration, startValue, changeInValue, totalIterations) { 6965 if ((currentIteration /= totalIterations / 2) < 1) { 6966 return changeInValue / 2 * Math.pow(2, 10 * (currentIteration - 1)) + startValue; 6967 } 6968 return changeInValue / 2 * (-Math.pow(2, -10 * --currentIteration) + 2) + startValue; 6969 }, 6970 6971 easeInCirc : function(currentIteration, startValue, changeInValue, totalIterations) { 6972 return changeInValue * (1 - Math.sqrt(1 - (currentIteration /= totalIterations) * currentIteration)) + startValue; 6973 }, 6974 6975 easeOutCirc : function(currentIteration, startValue, changeInValue, totalIterations) { 6976 return changeInValue * Math.sqrt(1 - (currentIteration = currentIteration / totalIterations - 1) * currentIteration) + startValue; 6977 }, 6978 6979 easeInOutCirc : function(currentIteration, startValue, changeInValue, totalIterations) { 6980 if ((currentIteration /= totalIterations / 2) < 1) { 6981 return changeInValue / 2 * (1 - Math.sqrt(1 - currentIteration * currentIteration)) + startValue; 6982 } 6983 return changeInValue / 2 * (Math.sqrt(1 - (currentIteration -= 2) * currentIteration) + 1) + startValue; 6984 } 6985 }; 6986 6987})(jQuery); 6988 6989(function($) { 6990 'use strict'; 6991 var MK = window.MK || {}; 6992 window.MK = MK; 6993 MK.ui = window.MK.ui || {}; 6994 6995 MK.component.Sortable = function(el) { 6996 this.el = el; 6997 }; 6998 6999 MK.component.Sortable.prototype = {
7000 init: function init() { 7001 this.cacheElements(); 7002 this.bindEvents(); 7003 }, 7004 7005 cacheElements: function cacheElements() { 7006 this.unique = Date.now(); 7007 this.$filter = $(this.el); 7008 this.config = this.$filter.data('sortable-config'); 7009 7010 this.ajaxLoader = new MK.utils.ajaxLoader(this.config.container); 7011 this.ajaxLoader.init(); 7012 7013 this.$container = $( this.config.container ); 7014 this.$navItems = this.$filter.find('a'); 7015 this.$filterItems = this.$container.find(this.config.item); 7016 }, 7017 7018 bindEvents: function bindEvents() { 7019 this.$navItems.on('click', this.handleClick.bind(this)); 7020 MK.utils.eventManager.subscribe('ajaxLoaded', this.onLoad.bind(this)); 7021 }, 7022 7023 handleClick: function handleClick(e) { 7024 e.preventDefault(); 7025 7026 var $item = $(e.currentTarget); 7027 var term = $item.data('filter'); 7028 7029 this.$navItems.removeClass('current'); 7030 $item.addClass('current'); 7031 7032 if(this.config.mode === 'ajax') this.inDB(term, $item); 7033 else this.inPage(term); 7034 }, 7035 7036 inDB: function inDB(term, $item) { 7037 // Add load indicator only for long requests 7038 MK.ui.loader.remove(this.$filter); 7039 MK.ui.loader.add($item); 7040 7041 // If mk-ajax-loaded-posts span exists and one of the filter is clicked, 7042 // clear post ids 7043 if ( this.$container.siblings('.mk-ajax-loaded-posts').length ) { 7044 this.$container.siblings('.mk-ajax-loaded-posts').attr('data-loop-loaded-posts', ''); 7045 } 7046 7047 this.ajaxLoader.setData({ 7048 paged: 1, 7049 term: term 7050 }); 7051 this.ajaxLoader.load(this.unique); 7052 }, 7053 7054 inPage: function inPage(term) { 7055 var $filterItems = this.$container.find(this.config.item); 7056 $filterItems.removeClass('is-hidden'); // show all first 7057 // Replace all ', ' with ', .'. It's used to add '.' as class selector of each category. 7058 var className = term.replace( /, /g, ", ." ); 7059 if(term !== '*') $filterItems.not( '.' + className ).addClass('is-hidden'); // hide filtered 7060 MK.utils.eventManager.publish('staticFilter'); 7061 }, 7062 7063 onLoad: function onLoad(e, response) { 7064 if(this.config.mode === 'static') { 7065 this.$navItems.removeClass('current').first().addClass('current'); 7066 } 7067 if( typeof response !== 'undefined' && response.id === this.config.container) { 7068 MK.ui.loader.remove(this.$filter); 7069 if(response.unique === this.unique) { 7070 this.$container.html(response.content); 7071 this.ajaxLoader.setData({paged: 1}); 7072 } 7073 } 7074 } 7075 }; 7076 7077})(jQuery); 7078 7079(function($) { 7080 'use strict'; 7081 7082 MK.component.Tabs = function( el ) { 7083 var defaults = { 7084 activeClass : 'is-active' 7085 }; 7086 7087 this.config = defaults; 7088 this.el = el; 7089 }; 7090 7091 MK.component.Tabs.prototype = { 7092 7093 init : function() { 7094 this.cacheElements(); 7095 this.bindEvents(); 7096 }, 7097 7098 cacheElements : function() { 7099 this.$this = $( this.el ); 7100 this.$tabs = this.$this.find( '.mk-tabs-tab' ); 7101 this.$panes = this.$this.find( '.mk-tabs-pane' ); 7102 this.currentId = 0; 7103 }, 7104 7105 bindEvents : function() { 7106 var self = this; 7107 7108 this.$tabs.on( 'click', this.switchPane.bind( this ) ); 7109 }, 7110 7111 switchPane : function( evt ) { 7112 evt.preventDefault(); 7113 7114 var clickedId = $( evt.currentTarget ).index(); 7115 7116 this.hide( this.currentId ); 7117 this.show( clickedId ); 7118 7119 // Update current id 7120 this.currentId = clickedId; 7121 7122 // Notify rest of the app 7123 MK.utils.eventManager.publish('item-expanded'); 7124 }, 7125 7126 show : function( id ) { 7127 this.$tabs.eq( id ).addClass( this.config.activeClass ); 7128 this.$panes.eq( id ).addClass( this.config.activeClass ); 7129 }, 7130 7131 hide : function( id ) { 7132 this.$tabs.eq( id ).removeClass( this.config.activeClass ); 7133 this.$panes.eq( id ).removeClass( this.config.activeClass ); 7134 } 7135 }; 7136 7137})(jQuery); 7138 7139 7140/* Tabs */ 7141/* -------------------------------------------------------------------- */ 7142 7143function mk_tabs() { 7144 7145 // "use strict"; 7146 7147 // if ($.exists('.mk-tabs, .mk-news-tab, .mk-woo-tabs')) { 7148 // $(".mk-tabs, .mk-news-tab, .mk-woo-tabs").tabs(); 7149 7150 // $('.mk-tabs').on('click', function () { 7151 // $('.mk-theme-loop').isotope('layout'); 7152 // }); 7153 7154 // $('.mk-tabs.vertical-style').each(function () { 7155 // $(this).find('.mk-tabs-pane').css('minHeight', $(this).find('.mk-tabs-tabs').height() - 1); 7156 // }); 7157 7158 // } 7159} 7160 7161function mk_tabs_responsive(){ 7162 // $('.mk-tabs, .mk-news-tab').each(function () { 7163 // $this = $(this); 7164 // if ($this.hasClass('mobile-true')) { 7165 // if (window.matchMedia('(max-width: 767px)').matches) 7166 // { 7167 // $this.tabs("destroy"); 7168 // } else { 7169 // $this.tabs(); 7170 // } 7171 // } 7172 // }); 7173 7174} 7175 7176 7177(function($) { 7178 'use strict'; 7179 7180 $(document).on('click', function(e) { 7181 $('.mk-toggle-trigger').removeClass('mk-toggle-active'); 7182 }); 7183 7184 function toggle(e) { 7185 e.preventDefault(); 7186 e.stopPropagation(); 7187 var $this = $(e.currentTarget); 7188 7189 if (!$this.hasClass('mk-toggle-active')) { 7190 7191 $('.mk-box-to-trigger').fadeOut(200); 7192 $this.parent().find('.mk-box-to-trigger').fadeIn(250); 7193 $('.mk-toggle-trigger').removeClass('mk-toggle-active'); 7194 $this.addClass('mk-toggle-active'); 7195 7196 } else { 7197 7198 $('.mk-box-to-trigger').fadeOut(200); 7199 $this.removeClass('mk-toggle-active'); 7200 7201 } 7202 } 7203 7204 function assignToggle() { 7205 // wait for ajax response propagation and insertion 7206 setTimeout(function() { 7207 $('.mk-toggle-trigger').off('click', toggle); 7208 $('.mk-toggle-trigger').on('click', toggle); 7209 }, 100); 7210 } 7211 7212 assignToggle(); 7213 MK.utils.eventManager.subscribe('ajaxLoaded', assignToggle); 7214 MK.utils.eventManager.subscribe('ajax-preview', assignToggle); 7215 7216 $(window).on('vc_reload', function(){ 7217 assignToggle(); 7218 MK.utils.eventManager.subscribe('ajaxLoaded', assignToggle); 7219 MK.utils.eventManager.subscribe('ajax-preview', assignToggle); 7220 }); 7221 7222}(jQuery)); 7223(function($) { 7224 'use strict'; 7225
7226 var init = function init() { 7227 var Toggle = function(el) { 7228 var that = this, 7229 $el = $(el); 7230 7231 this.$el = $el; 7232 $el.on('click', function() { 7233 $el.hasClass('active-toggle') ? that.close() : that.open() 7234 }); 7235 }; 7236 7237 Toggle.prototype.dom = { 7238 pane : 'mk-toggle-pane', 7239 active : 'active-toggle' 7240 }; 7241 7242 Toggle.prototype.open = function() { 7243 var $this = this.$el; 7244 $this.addClass(this.dom.active); 7245 $this.siblings('.' + this.dom.pane).slideDown(200); 7246 }; 7247 7248 Toggle.prototype.close = function() { 7249 var $this = this.$el; 7250 $this.removeClass(this.dom.active); 7251 $this.siblings('.' + this.dom.pane).slideUp(200); 7252 }; 7253 7254 // Apply to. 7255 var $toggle = $('.mk-toggle-title'); 7256 7257 if(!$toggle.length) return; 7258 7259 $toggle.each(function() { 7260 new Toggle(this); 7261 }); 7262 } 7263 $(window).on('load vc_reload', init); 7264 7265})(jQuery); 7266 7267/** 7268 * Add class to tag. It's vanilla js instead of jQuery. 7269 * @param tag 7270 * @param className 7271 */ 7272function addClass(tag, className) { 7273 tag.className += ' ' + className; 7274} 7275 7276/** 7277* Remove class from tag. It's vanilla js instead of jQuery. 7278* Replacing should be with g for replacing all occurrence. 7279* 7280* @param tag 7281* @param className 7282*/ 7283function removeClass(tag, className) { 7284 tag.className = tag.className.replace(new RegExp(className, 'g'), ''); 7285} 7286 7287/** 7288 * Validate email address. 7289 * 7290 * @param input 7291 * @param invalidClassName 7292 * @returns boolean 7293 */ 7294function validateEmail(input, invalidClassName) { 7295 var value = input.value.trim(); 7296 if ((input.required || value.length > 0) && !/^([a-z0-9_\.\-\+]+)@([\da-z\.\-]+)\.([a-z\.]{2,63})$/i.test(value)) { 7297 if (invalidClassName) { 7298 addClass(input, invalidClassName); 7299 } 7300 return false; 7301 } else { 7302 if (invalidClassName) { 7303 removeClass(input, invalidClassName); 7304 } 7305 return true; 7306 } 7307} 7308/** 7309 * Validate text entry. 7310 * 7311 * @param input 7312 * @param invalidClassName 7313 * @returns boolean 7314 */ 7315function validateText(input, invalidClassName) { 7316 var value = input.value.trim(); 7317 if (input.required && value.length === 0) { 7318 if (invalidClassName) { 7319 addClass(input, invalidClassName); 7320 } 7321 return false; 7322 } else { 7323 if (invalidClassName) { 7324 removeClass(input, invalidClassName); 7325 } 7326 return true; 7327 } 7328} 7329/** 7330 * Validate Checkbox. 7331 * 7332 * @param input 7333 * @param invalidClassName 7334 * @returns boolean 7335 */ 7336function validateCheckBox(input, invalidClassName) { 7337 if (input.required && input.checked == false) { 7338 if (invalidClassName) { 7339 addClass(input, invalidClassName); 7340 } 7341 return false; 7342 } else { 7343 if (invalidClassName) { 7344 removeClass(input, invalidClassName); 7345 } 7346 return true; 7347 } 7348} 7349/** 7350 * If we're running under Node for testing purpose. 7351 */ 7352if (typeof exports !== 'undefined') { 7353 exports.validateEmail = validateEmail; 7354 exports.validateText = validateText; 7355} 7356(function( $ ) { 7357 'use strict'; 7358 7359 if( MK.utils.isMobile() ) { 7360 $('.mk-animate-element').removeClass('mk-animate-element'); 7361 return; 7362 } 7363 7364 7365 var init = function init() { 7366 var $rootLevelEls = $('.js-master-row, .widget'); 7367 $rootLevelEls.each( spyViewport ); 7368 $rootLevelEls.each( function rootLevelEl() { 7369 var $animateEl = $(this).find( '.mk-animate-element' ); 7370 $animateEl.each( spyViewport ); 7371 7372 /** 7373 * Firefox has known issue where horizontal scrollbar will appear if an 7374 * element uses animation CSS. The solution should be set the element 7375 * position as fixed or overflow-x as hidden. Position fixed is not possible 7376 * to use because it's only cause other big problems. The best way is 7377 * set overflow-x as hidden in the page content container #theme-page. 7378 * 7379 * NOTE: The problem is spotted on Right To Left viewport only. So, it's 7380 * limited to '.right-to-left' selector only for now to avoid other 7381 * problems. Please extend the functionallity if it's happen in 7382 * other viewport animation effect. 7383 */ 7384 var browserName = MK.utils.browser.name; 7385 if ( browserName === 'Firefox' ) { 7386 var $rightToLeft = $( this ).find( '.right-to-left' ); 7387 if ( $rightToLeft.length > 0 ) { 7388 $( '#theme-page' ).css( 'overflow-x', 'hidden' ); 7389 } 7390 } 7391 }); 7392 }; 7393 7394 var spyViewport = function spyViewport(i) { 7395 var self = this; 7396 7397 MK.utils.scrollSpy( this, { 7398 position : 'bottom', 7399 threshold : 200, 7400 after : function() { 7401 animate.call(self, i); 7402 } 7403 }); 7404 }; 7405 7406 var animate = function animate(i) { 7407 var $this = $(this); 7408 7409 setTimeout(function() { 7410 $this.addClass( 'mk-in-viewport' ); 7411 }, 100 * i); 7412 }; 7413 7414 7415 $(window).on('load vc_reload', init); 7416 7417}(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.