1(function($) { 2 var isBuilder = $('html').hasClass('is-builder'); 3 4 $.extend($.easing, { 5 easeInOutCubic: function(x, t, b, c, d) { 6 if ((t /= d / 2) < 1) return c / 2 * t * t * t + b; 7 return c / 2 * ((t -= 2) * t * t + 2) + b; 8 } 9 }); 10 11 $.fn.outerFind = function(selector) { 12 return this.find(selector).addBack(selector); 13 }; 14 15 $.fn.scrollEnd = function(callback, timeout) { 16 $(this).scroll(function(){ 17 var $this = $(this); 18 if ($this.data('scrollTimeout')) { 19 clearTimeout($this.data('scrollTimeout')); 20 } 21 $this.data('scrollTimeout', setTimeout(callback,timeout)); 22 }); 23 }; 24 25 $.fn.footerReveal = function() { 26 var $this = $(this); 27 var $prev = $this.prev(); 28 var $win = $(window); 29 var isIE = !!document.documentMode; 30 31 function initReveal() { 32 if (!isIE && $this.outerHeight() <= $win.outerHeight()) { 33 $this.css({ 34 'z-index': -999, 35 position: 'fixed', 36 bottom: 0 37 }); 38 39 $this.css({ 40 'width': $prev.outerWidth() 41 }); 42 43 $prev.css({ 44 'margin-bottom': $this.outerHeight() 45 }); 46 } else { 47 $this.css({ 48 'z-index': '', 49 position: '', 50 bottom: '' 51 }); 52 53 $this.css({ 54 'width': '' 55 }); 56 57 $prev.css({ 58 'margin-bottom': '' 59 }); 60 } 61 } 62 63 initReveal(); 64 65 $win.on('load resize', function() { 66 initReveal(); 67 }); 68 69 return this; 70 }; 71 72 (function($, sr) { 73 // debouncing function from John Hann 74 // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ 75 var debounce = function(func, threshold, execAsap) { 76 var timeout; 77 78 return function debounced() { 79 var obj = this, 80 args = arguments; 81 82 function delayed() { 83 if (!execAsap) func.apply(obj, args); 84 timeout = null; 85 } 86 87 if (timeout) clearTimeout(timeout); 88 else if (execAsap) func.apply(obj, args); 89 90 timeout = setTimeout(delayed, threshold || 100); 91 }; 92 }; 93 // smartresize 94 jQuery.fn[sr] = function(fn) { 95 return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); 96 }; 97 98 })(jQuery, 'smartresize'); 99 100 (function() { 101 102 var scrollbarWidth = 0, 103 originalMargin, touchHandler = function(event) { 104 event.preventDefault(); 105 }; 106 107 function getScrollbarWidth() { 108 if (scrollbarWidth) return scrollbarWidth; 109 var scrollDiv = document.createElement('div'); 110 $.each({ 111 top: '-9999px', 112 width: '50px', 113 height: '50px', 114 overflow: 'scroll', 115 position: 'absolute' 116 }, function(property, value) { 117 scrollDiv.style[property] = value; 118 }); 119 $('body').append(scrollDiv); 120 scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; 121 $('body')[0].removeChild(scrollDiv); 122 return scrollbarWidth; 123 } 124 125 })(); 126 127 $.isMobile = function(type) { 128 var reg = []; 129 var any = { 130 blackberry: 'BlackBerry', 131 android: 'Android', 132 windows: 'IEMobile', 133 opera: 'Opera Mini', 134 ios: 'iPhone|iPad|iPod' 135 }; 136 type = 'undefined' == $.type(type) ? '*' : type.toLowerCase(); 137 if ('*' == type) reg = $.map(any, function(v) { 138 return v; 139 }); 140 else if (type in any) reg.push(any[type]); 141 return !!(reg.length && navigator.userAgent.match(new RegExp(reg.join('|'), 'i'))); 142 }; 143 144 var isSupportViewportUnits = (function() { 145 // modernizr implementation 146 var $elem = $('<div style="height: 50vh; position: absolute; top: -1000px; left: -1000px;">').appendTo('body'); 147 var elem = $elem[0]; 148 var height = parseInt(window.innerHeight / 2, 10); 149 var compStyle = parseInt((window.getComputedStyle ? getComputedStyle(elem, null) : elem.currentStyle)['height'], 10); 150 $elem.remove(); 151 return compStyle == height; 152 }()); 153 154 $(function() { 155 156 $('html').addClass($.isMobile() ? 'mobile' : 'desktop'); 157 158 // .mbr-navbar--sticky 159 $(window).scroll(function() { 160 $('.mbr-navbar--sticky').each(function() { 161 var method = $(window).scrollTop() > 10 ? 'addClass' : 'removeClass'; 162 $(this)[method]('mbr-navbar--stuck') 163 .not('.mbr-navbar--open')[method]('mbr-navbar--short'); 164 }); 165 }); 166 167 if ($.isMobile() && navigator.userAgent.match(/Chrome/i)) { // simple fix for Chrome's scrolling 168 (function(width, height) { 169 var deviceSize = [width, width]; 170 deviceSize[height > width ? 0 : 1] = height; 171 $(window).smartresize(function() { 172 var windowHeight = $(window).height(); 173 if ($.inArray(windowHeight, deviceSize) < 0) 174 windowHeight = deviceSize[$(window).width() > windowHeight ? 1 : 0]; 175 $('.mbr-section--full-height').css('height', windowHeight + 'px'); 176 }); 177 })($(window).width(), $(window).height()); 178 } else if (!isSupportViewportUnits) { // fallback for .mbr-section--full-height 179 $(window).smartresize(function() { 180 $('.mbr-section--full-height').css('height', $(window).height() + 'px'); 181 }); 182 $(document).on('add.cards', function(event) { 183 if ($('html').hasClass('mbr-site-loaded') && $(event.target).outerFind('.mbr-section--full-height').length) 184 $(window).resize(); 185 }); 186 } 187 188 // .mbr-section--16by9 (16 by 9 blocks autoheight) 189 function calculate16by9() { 190 $(this).css('height', $(this).parent().width() * 9 / 16); 191 } 192 $(window).smartresize(function() { 193 $('.mbr-section--16by9').each(calculate16by9); 194 }); 195 $(document).on('add.cards changeParameter.cards', function(event) { 196 var enabled = $(event.target).outerFind('.mbr-section--16by9'); 197 if (enabled.length) { 198 enabled 199 .attr('data-16by9', 'true') 200 .each(calculate16by9); 201 } else { 202 $(event.target).outerFind('[data-16by9]') 203 .css('height', '') 204 .removeAttr('data-16by9'); 205 } 206 }); 207 208 // .mbr-parallax-background 209 function initParallax(card) { 210 setTimeout(function() { 211 $(card).outerFind('.mbr-parallax-background') 212 .jarallax({ 213 speed: 0.6 214 }) 215 .css('position', 'relative'); 216 }, 0); 217 } 218 219 function destroyParallax(card) { 220 $(card).jarallax('destroy').css('position', ''); 221 } 222 223 if ($.fn.jarallax && !$.isMobile()) { 224 $(window).on('update.parallax', function(event) { 225 setTimeout(function() {
226 var $jarallax = $('.mbr-parallax-background'); 227 228 $jarallax.jarallax('coverImage'); 229 $jarallax.jarallax('clipContainer'); 230 $jarallax.jarallax('onScroll'); 231 }, 0); 232 }); 233 234 if (isBuilder) { 235 $(document).on('add.cards', function(event) { 236 initParallax(event.target); 237 $(window).trigger('update.parallax'); 238 }); 239 240 $(document).on('changeParameter.cards', function(event, paramName, value, key) { 241 if (paramName === 'bg') { 242 destroyParallax(event.target); 243 244 switch (key) { 245 case 'type': 246 if (value.parallax === true) { 247 initParallax(event.target); 248 } 249 break; 250 case 'value': 251 if (value.type === 'image' && value.parallax === true) { 252 initParallax(event.target); 253 } 254 break; 255 case 'parallax': 256 if (value.parallax === true) { 257 initParallax(event.target); 258 } 259 } 260 } 261 262 $(window).trigger('update.parallax'); 263 }); 264 } else { 265 initParallax(document.body); 266 } 267 268 // for Tabs 269 $(window).on('shown.bs.tab', function(e) { 270 $(window).trigger('update.parallax'); 271 }); 272 } 273 274 // .mbr-fixed-top 275 var fixedTopTimeout, scrollTimeout, prevScrollTop = 0, 276 fixedTop = null, 277 isDesktop = !$.isMobile(); 278 $(window).scroll(function() { 279 if (scrollTimeout) clearTimeout(scrollTimeout); 280 var scrollTop = $(window).scrollTop(); 281 var scrollUp = scrollTop <= prevScrollTop || isDesktop; 282 prevScrollTop = scrollTop; 283 if (fixedTop) { 284 var fixed = scrollTop > fixedTop.breakPoint; 285 if (scrollUp) { 286 if (fixed != fixedTop.fixed) { 287 if (isDesktop) { 288 fixedTop.fixed = fixed; 289 $(fixedTop.elm).toggleClass('is-fixed'); 290 } else { 291 scrollTimeout = setTimeout(function() { 292 fixedTop.fixed = fixed; 293 $(fixedTop.elm).toggleClass('is-fixed'); 294 }, 40); 295 } 296 } 297 } else { 298 fixedTop.fixed = false; 299 $(fixedTop.elm).removeClass('is-fixed'); 300 } 301 } 302 }); 303 $(document).on('add.cards delete.cards', function(event) { 304 if (fixedTopTimeout) clearTimeout(fixedTopTimeout); 305 fixedTopTimeout = setTimeout(function() { 306 if (fixedTop) { 307 fixedTop.fixed = false; 308 $(fixedTop.elm).removeClass('is-fixed'); 309 } 310 $('.mbr-fixed-top:first').each(function() { 311 fixedTop = { 312 breakPoint: $(this).offset().top + $(this).height() * 3, 313 fixed: false, 314 elm: this 315 }; 316 $(window).scroll(); 317 }); 318 }, 650); 319 }); 320 321 // embedded videos 322 $(window).smartresize(function() { 323 $('.mbr-embedded-video').each(function() { 324 $(this).height( 325 $(this).width() * 326 parseInt($(this).attr('height') || 315) / 327 parseInt($(this).attr('width') || 560) 328 ); 329 }); 330 }); 331 $(document).on('add.cards', function(event) { 332 if ($('html').hasClass('mbr-site-loaded') && $(event.target).outerFind('iframe').length) 333 $(window).resize(); 334 }); 335 336 // background video 337 function videoParser(card) { 338 $(card).outerFind('[data-bg-video]').each(function() { 339 var videoURL = $(this).attr('data-bg-video'); 340 var parsedUrl = videoURL.match(/(http:\/\/|https:\/\/|)?(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(&\S+)?/); 341
342 var $img = $('<div class="mbr-background-video-preview">') 343 .hide() 344 .css({ 345 backgroundSize: 'cover', 346 backgroundPosition: 'center' 347 }); 348 $('> *:eq(0)', this).before($img); 349 350 // youtube or vimeo 351 if (parsedUrl && (/youtube/g.test(parsedUrl[3]) || /vimeo/g.test(parsedUrl[3]))) { 352 // youtube 353 if (parsedUrl && /youtube/g.test(parsedUrl[3])) { 354 var previewURL = 'http' + ('https:' === location.protocol ? 's' : '') + ':'; 355 previewURL += '//img.youtube.com/vi/' + parsedUrl[6] + '/maxresdefault.jpg'; 356 357 $('<img>').on('load', function() { 358 if (120 === (this.naturalWidth || this.width)) { 359 // selection of preview in the best quality 360 var file = this.src.split('/').pop(); 361 362 switch (file) { 363 case 'maxresdefault.jpg': 364 this.src = this.src.replace(file, 'sddefault.jpg'); 365 break; 366 case 'sddefault.jpg': 367 this.src = this.src.replace(file, 'hqdefault.jpg'); 368 break; 369 default: // image not found 370 if (isBuilder) { 371 $img.css('background-image', 'url("images/no-video.jpg")') 372 .show(); 373 } 374 } 375 } else { 376 $img.css('background-image', 'url("' + this.src + '")') 377 .show(); 378 } 379 }).attr('src', previewURL); 380 381 if ($.fn.YTPlayer && !isBuilder && !$.isMobile()) { 382 $('> *:eq(1)', this).before('<div class="mbr-background-video"></div>').prev() 383 .YTPlayer({ 384 videoURL: parsedUrl[6], 385 containment: 'self', 386 showControls: false, 387 mute: true 388 }); 389 } 390 } else if (parsedUrl && /vimeo/g.test(parsedUrl[3])) { // vimeo 391 var request = new XMLHttpRequest(); 392 request.open('GET', 'https://vimeo.com/api/v2/video/' + parsedUrl[6] + '.json', true); 393 request.onreadystatechange = function() { 394 if (this.readyState === 4) { 395 if (this.status >= 200 && this.status < 400) { 396 var response = JSON.parse(this.responseText); 397 398 $img.css('background-image', 'url("' + response[0].thumbnail_large + '")') 399 .show(); 400 } else if (isBuilder) { // image not found 401 $img.css('background-image', 'url("images/no-video.jpg")') 402 .show(); 403 } 404 } 405 }; 406 request.send(); 407 request = null; 408 409 if ($.fn.vimeo_player && !isBuilder && !$.isMobile()) { 410 $('> *:eq(1)', this).before('<div class="mbr-background-video"></div>').prev() 411 .vimeo_player({ 412 videoURL: videoURL, 413 containment: 'self', 414 showControls: false, 415 mute: true 416 }); 417 } 418 } 419 } else if (isBuilder) { // neither youtube nor vimeo 420 $img.css('background-image', 'url("images/video-placeholder.jpg")') 421 .show(); 422 } 423 }); 424 } 425 426 if (isBuilder) { 427 $(document).on('add.cards', function(event) { 428 videoParser(event.target); 429 }); 430 } else { 431 videoParser(document.body); 432 } 433 434 $(document).on('changeParameter.cards', function(event, paramName, value, key) { 435 if (paramName === 'bg') { 436 switch (key) { 437 case 'type': 438 $(event.target).find('.mbr-background-video-preview').remove(); 439 if (value.type === 'video') { 440 videoParser(event.target); 441 } 442 break; 443 case 'value': 444 if (value.type === 'video') { 445 $(event.target).find('.mbr-background-video-preview').remove(); 446 videoParser(event.target); 447 } 448 break; 449 } 450 } 451 }); 452 453 // init 454 if (!isBuilder) { 455 $('body > *:not(style, script)').trigger('add.cards'); 456 } 457 $('html').addClass('mbr-site-loaded'); 458 $(window).resize().scroll(); 459 460 // smooth scroll 461 if (!isBuilder) { 462 $(document).click(function(e) { 463 try { 464 var target = e.target; 465 466 if ($(target).parents().hasClass('carousel')) { 467 return; 468 } 469 do { 470 if (target.hash) {
471 var useBody = /#bottom|#top/g.test(target.hash); 472 $(useBody ? 'body' : target.hash).each(function() { 473 e.preventDefault(); 474 // in css sticky navbar has height 64px 475 // var stickyMenuHeight = $('.mbr-navbar--sticky').length ? 64 : 0; 476 var stickyMenuHeight = $(target).parents().hasClass('navbar-fixed-top') ? 60 : 0; 477 var goTo = target.hash == '#bottom' ? ($(this).height() - $(window).height()) : ($(this).offset().top - stickyMenuHeight); 478 // Disable Accordion's and Tab's scroll 479 if ($(this).hasClass('panel-collapse') || $(this).hasClass('tab-pane')) { 480 return; 481 } 482 $('html, body').stop().animate({ 483 scrollTop: goTo 484 }, 800, 'easeInOutCubic'); 485 }); 486 break; 487 } 488 } while (target = target.parentNode); 489 } catch (e) { 490 // throw e; 491 } 492 }); 493 } 494 495 // init the same height columns 496 $('.cols-same-height .mbr-figure').each(function() { 497 var $imageCont = $(this); 498 var $img = $imageCont.children('img'); 499 var $cont = $imageCont.parent(); 500 var imgW = $img[0].width; 501 var imgH = $img[0].height; 502 503 function setNewSize() { 504 $img.css({ 505 width: '', 506 maxWidth: '', 507 marginLeft: '' 508 }); 509 510 if (imgH && imgW) { 511 var aspectRatio = imgH / imgW; 512 513 $imageCont.addClass({ 514 position: 'absolute', 515 top: 0, 516 left: 0, 517 right: 0, 518 bottom: 0 519 }); 520 521 // change image size 522 var contAspectRatio = $cont.height() / $cont.width(); 523 if (contAspectRatio > aspectRatio) { 524 var percent = 100 * (contAspectRatio - aspectRatio) / aspectRatio; 525 $img.css({ 526 width: percent + 100 + '%', 527 maxWidth: percent + 100 + '%', 528 marginLeft: (-percent / 2) + '%' 529 }); 530 } 531 } 532 } 533 534 $img.one('load', function() { 535 imgW = $img[0].width; 536 imgH = $img[0].height; 537 setNewSize(); 538 }); 539 540 $(window).on('resize', setNewSize); 541 setNewSize(); 542 }); 543 }); 544 545 546 if (!isBuilder) { 547 // .mbr-social-likes 548 if ($.fn.socialLikes) { 549 $(document).on('add.cards', function(event) { 550 $(event.target).outerFind('.mbr-social-likes').on('counter.social-likes', function(event, service, counter) { 551 if (counter > 999) $('.social-likes__counter', event.target).html(Math.floor(counter / 1000) + 'k'); 552 }).socialLikes({ 553 initHtml: false 554 }); 555 }); 556 } 557 558 $(document).on('add.cards', function(event) { 559 if ($(event.target).hasClass('mbr-reveal')) { 560 $(event.target).footerReveal(); 561 } 562 }); 563 564 $(document).ready(function() { 565 // disable animation on scroll on mobiles 566 if ($.isMobile()) { 567 return; 568 // enable animation on scroll 569 } else if ($('input[name=animation]').length) { 570 $('input[name=animation]').remove(); 571 572 var $animatedElements = $('p, h1, h2, h3, h4, h5, a, button, small, img, li, blockquote, .mbr-author-name, em, label, input, textarea, .input-group, .iconbox, .btn-social, .mbr-figure, .mbr-map, .mbr-testimonial .card-block, .mbr-price-value, .mbr-price-figure, .dataTable, .dataTables_info').not(function() { 573 return $(this).parents().is('a, p, .navbar, .mbr-arrow, footer, .iconbox, .mbr-slider, .mbr-gallery, .mbr-testimonial .card-block, #cookiesdirective, .mbr-wowslider, .accordion, .tab-content, .engine, #scrollToTop'); 574 }).addClass('hidden animated'); 575 576 function getElementOffset(element) { 577 var top = 0; 578 do { 579 top += element.offsetTop || 0; 580 element = element.offsetParent; 581 } while (element); 582 583 return top; 584 } 585 586 function elCarouselItem(element) { 587 if (element.parents('.carousel-item').css('display') !== 'none') return false;
588 var parentEl = element.parents('.carousel-item').parent(); 589 if (parentEl.find('.carousel-item.active .hidden.animated').lenght){ 590 return false; 591 } 592 else if (parentEl.attr('data-visible') > 1){ 593 var visibleSlides = parentEl.attr('data-visible'); 594 if (element.parents().is('.cloneditem-' + (visibleSlides - 1)) && element.parents('.cloneditem-' + (visibleSlides - 1)).attr('data-cloned-index') >= visibleSlides){ 595 return true; 596 } 597 else{ 598 element.removeClass('animated hidden'); 599 return false; 600 } 601 } 602 else return true; 603 } 604 605 function checkIfInView() { 606 var window_height = window.innerHeight; 607 var window_top_position = document.documentElement.scrollTop || document.body.scrollTop; 608 var window_bottom_position = window_top_position + window_height - 50; 609 610 $.each($animatedElements, function() { 611 var $element = $(this); 612 var element = $element[0]; 613 var element_height = element.offsetHeight; 614 var element_top_position = getElementOffset(element); 615 var element_bottom_position = (element_top_position + element_height); 616 617 // check to see if this current element is within viewport 618 if ((((element_bottom_position >= window_top_position) && 619 (element_top_position <= window_bottom_position)) || elCarouselItem($element)) && 620 ($element.hasClass('hidden'))) { 621 $element.removeClass('hidden').addClass('fadeInUp') 622 .one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() { 623 $element.removeClass('animated fadeInUp'); 624 }); 625 } 626 }); 627 } 628 629 var $window = $(window); 630 $window.on('scroll resize', checkIfInView); 631 $window.trigger('scroll'); 632 } 633 }); 634 635 if ($('.nav-dropdown').length) { 636 $(".nav-dropdown").swipe({ 637 swipeLeft: function(event, direction, distance, duration, fingerCount) { 638 $('.navbar-close').click(); 639 } 640 }); 641 } 642 } 643 644 // Scroll to Top Button 645 $(document).ready(function() { 646 if ($('.mbr-arrow-up').length) { 647 var $scroller = $('#scrollToTop'), 648 $main = $('body,html'), 649 $window = $(window); 650 $scroller.css('display', 'none'); 651 $window.scroll(function() { 652 if ($(this).scrollTop() > 0) { 653 $scroller.fadeIn(); 654 } else { 655 $scroller.fadeOut(); 656 } 657 }); 658 $scroller.click(function() { 659 $main.animate({ 660 scrollTop: 0 661 }, 400); 662 return false; 663 }); 664 } 665 }); 666 667 // arrow down 668 if (!isBuilder) { 669 $('.mbr-arrow').on('click', function(e) { 670 var $next = $(e.target).closest('section').next(); 671 if($next.hasClass('engine')){ 672 $next = $next.closest('section').next(); 673 } 674 var offset = $next.offset(); 675 $('html, body').stop().animate({ 676 scrollTop: offset.top 677 }, 800, 'linear'); 678 }); 679 } 680 681 // add padding to the first element, if it exists 682 if ($('nav.navbar').length) { 683 var navHeight = $('nav.navbar').height(); 684 $('.mbr-after-navbar.mbr-fullscreen').css('padding-top', navHeight + 'px'); 685 } 686 687 function isIE() { 688 var ua = window.navigator.userAgent; 689 var msie = ua.indexOf("MSIE "); 690 691 if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) { 692 return true; 693 } 694 695 return false;
696 } 697 698 // fixes for IE 699 if (!isBuilder && isIE()) { 700 $(document).on('add.cards', function(event) { 701 var $eventTarget = $(event.target); 702 703 if ($eventTarget.hasClass('mbr-fullscreen')) { 704 $(window).on('load resize', function() { 705 $eventTarget.css('height', 'auto'); 706 707 if ($eventTarget.outerHeight() <= $(window).height()) { 708 $eventTarget.css('height', '1px'); 709 } 710 }); 711 } 712 713 if ($eventTarget.hasClass('mbr-slider') || $eventTarget.hasClass('mbr-gallery')) { 714 $eventTarget.find('.carousel-indicators').addClass('ie-fix').find('li').css({ 715 display: 'inline-block', 716 width: '30px' 717 }); 718 719 if ($eventTarget.hasClass('mbr-slider')) { 720 $eventTarget.find('.full-screen .slider-fullscreen-image').css('height', '1px'); 721 } 722 } 723 }); 724 } 725 726 // Script for popUp video 727 $(document).ready(function() { 728 if (!isBuilder) { 729 var modal = function(item) { 730 var videoIframe = $(item).parents('section').find('iframe')[0], 731 videoIframeSrc = $(videoIframe).attr('src'); 732 733 item.parents('section').css('z-index', '5000'); 734 735 if (videoIframeSrc.indexOf('youtu') !== -1) { 736 videoIframe.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*'); 737 } 738 739 if (videoIframeSrc.indexOf('vimeo') !== -1) { 740 var vimeoPlayer = new Vimeo.Player($(videoIframe)); 741 vimeoPlayer.play(); 742 } 743 744 $(item).parents('section').find($(item).attr('data-modal')) 745 .css('display', 'table') 746 .click(function() { 747 if (videoIframeSrc.indexOf('youtu') !== -1) { 748 videoIframe.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*'); 749 } 750 751 if (videoIframeSrc.indexOf('vimeo') !== -1) { 752 vimeoPlayer.pause(); 753 } 754 755 $(this).css('display', 'none').off('click'); 756 item.parents('section').css('z-index', '0'); 757 }); 758 }; 759 760 // Youtube & Vimeo 761 $('.modalWindow-video iframe').each(function() { 762 var videoURL = $(this).attr('data-src'); 763 $(this).removeAttr('data-src'); 764 765 var parsedUrl = videoURL.match(/(http:\/\/|https:\/\/|)?(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(&\S+)?/); 766 if (videoURL.indexOf('youtu') !== -1) { 767 $(this).attr('src', 'https://youtube.com/embed/' + parsedUrl[6] + '?rel=0&enablejsapi=1'); 768 } else if (videoURL.indexOf('vimeo') !== -1) { 769 $(this).attr('src', 'https://player.vimeo.com/video/' + parsedUrl[6] + '?autoplay=0&loop=0'); 770 } 771 }); 772 773 $('[data-modal]').click(function() { 774 modal($(this)); 775 }); 776 } 777 }); 778 779 if (!isBuilder) { 780 // open dropdown menu on hover 781 if (!$.isMobile()) { 782 var $menu = $('section.menu'), 783 $width = $(window).width(), 784 $collapsed = $menu.find('.navbar').hasClass('collapsed'); 785 // check if collapsed on 786 if (!$collapsed ){ 787 // check width device 788 if ($width > 991) { 789 $menu.find('ul.navbar-nav li.dropdown').hover( 790 function() { 791 if (!$(this).hasClass('open')) { 792 $(this).find('a')[0].click(); 793 } 794 }, 795 function() { 796 if ($(this).hasClass('open')) { 797 $(this).find('a')[0].click(); 798 } 799 } 800 ); 801 $menu.find('ul.navbar-nav li.dropdown .dropdown-menu .dropdown').hover( 802 function() { 803 if (!$(this).hasClass('open')) { 804 $(this).find('a')[0].click(); 805 } 806 }, 807 function() { 808 if ($(this).hasClass('open')) { 809 $(this).find('a')[0].click(); 810 } 811 } 812 ); 813 } 814 } 815 } 816 } 817 818 // Functions from plugins for 819 // compatible with old projects 820 function setActiveCarouselItem(card){ 821 var $target = $(card).find('.carousel-item:first'); 822 $target.addClass('active'); 823 }
824 function initTestimonialsCarousel(card){ 825 var $target = $(card), 826 $carouselID = $target.attr('ID') +"-carousel"; 827 $target.find('.carousel').attr('id',$carouselID); 828 $target.find('.carousel-controls a').attr('href','#'+$carouselID); 829 $target.find('.carousel-indicators li').attr('data-target','#'+$carouselID); 830 setActiveCarouselItem($target); 831 } 832 function initClientCarousel(card){ 833 var $target = $(card), 834 countElems = $target.find('.carousel-item').length, 835 visibleSlides = $target.find('.carousel-inner').attr('data-visible'); 836 if (countElems < visibleSlides){ 837 visibleSlides = countElems; 838 } 839 $target.find('.carousel-inner').attr('class', 'carousel-inner slides' + visibleSlides); 840 $target.find('.clonedCol').remove(); 841 842 $target.find('.carousel-item .col-md-12').each(function() { 843 if (visibleSlides < 2) { 844 $(this).attr('class', 'col-md-12'); 845 } else if (visibleSlides == '5') { 846 $(this).attr('class', 'col-md-12 col-lg-15'); 847 } else { 848 $(this).attr('class', 'col-md-12 col-lg-' + 12 / visibleSlides); 849 } 850 }); 851 852 $target.find('.carousel-item').each(function() { 853 var itemToClone = $(this); 854 for (var i = 1; i < visibleSlides; i++) { 855 itemToClone = itemToClone.next(); 856 if (!itemToClone.length) { 857 itemToClone = $(this).siblings(':first'); 858 } 859 var index = itemToClone.index(); 860 itemToClone.find('.col-md-12:first').clone().addClass('cloneditem-' + i).addClass('clonedCol').attr('data-cloned-index', index).appendTo($(this).children().eq(0)); 861 } 862 }); 863 } 864 function updateClientCarousel(card){ 865 var $target = $(card), 866 countElems = $target.find('.carousel-item').length, 867 visibleSlides = $target.find('.carousel-inner').attr('data-visible'); 868 if (countElems < visibleSlides){ 869 visibleSlides = countElems; 870 } 871 $target.find('.clonedCol').remove(); 872 $target.find('.carousel-item').each(function() { 873 var itemToClone = $(this); 874 for (var i = 1; i < visibleSlides; i++) { 875 itemToClone = itemToClone.next(); 876 if (!itemToClone.length) { 877 itemToClone = $(this).siblings(':first'); 878 } 879 var index = itemToClone.index(); 880 itemToClone.find('.col-md-12:first').clone().addClass('cloneditem-' + i).addClass('clonedCol').attr('data-cloned-index', index).appendTo($(this).children().eq(0)); 881 } 882 }); 883 } 884 function clickHandler(e){ 885 e.stopPropagation(); 886 e.preventDefault(); 887 888 var $target = $(e.target); 889 var curItem; 890 var curIndex; 891 892 if ($target.closest('.clonedCol').length) { 893 curItem = $target.closest('.clonedCol'); 894 curIndex = curItem.attr('data-cloned-index'); 895 } else { 896 curItem = $target.closest('.carousel-item'); 897 curIndex = curItem.index(); 898 } 899 var item = $($target.closest('.carousel-inner').find('.carousel-item')[curIndex]).find('img')[0]; 900 901 if ($target.parents('.clonedCol').length > 0) { 902 item.click(); 903 } 904 } 905 $.fn.outerFind = function(selector) { 906 return this.find(selector).addBack(selector); 907 }; 908 function initTabs(target) { 909 if ($(target).find('.nav-tabs').length !== 0) { 910 $(target).outerFind('section[id^="tabs"]').each(function() { 911 var componentID = $(this).attr('id'); 912 var $tabsNavItem = $(this).find('.nav-tabs .nav-item'); 913 var $tabPane = $(this).find('.tab-pane'); 914 915 $tabPane.removeClass('active').eq(0).addClass('active'); 916 917 $tabsNavItem.find('a').removeClass('active').removeAttr('aria-expanded') 918 .eq(0).addClass('active'); 919 920 $tabPane.each(function() { 921 $(this).attr('id', componentID + '_tab' + $(this).index()); 922 }); 923 924 $tabsNavItem.each(function() { 925 $(this).find('a').attr('href', '#' + componentID + '_tab' + $(this).index()); 926 }); 927 }); 928 } 929 } 930 function clickPrev(event){ 931 event.stopPropagation(); 932 event.preventDefault(); 933 } 934 if(!isBuilder){ 935 if(typeof window.initClientPlugin ==='undefined'){ 936 if($(document.body).find('.clients').length!=0){ 937 window.initClientPlugin = true; 938 $(document.body).find('.clients').each(function(index, el) { 939 if(!$(this).attr('data-isinit')){
940 initTestimonialsCarousel($(this)); 941 initClientCarousel($(this)); 942 } 943 }); 944 } 945 } 946 if(typeof window.initPopupBtnPlugin === 'undefined'){ 947 if($(document.body).find('section.popup-btn-cards').length!=0){ 948 window.initPopupBtnPlugin = true; 949 $('section.popup-btn-cards .card-wrapper').each(function(index, el) { 950 $(this).addClass('popup-btn'); 951 }); 952 } 953 } 954 if(typeof window.initTestimonialsPlugin === 'undefined'){ 955 if($(document.body).find('.testimonials-slider').length!=0){ 956 window.initTestimonialsPlugin = true; 957 $('.testimonials-slider').each(function(){ 958 initTestimonialsCarousel(this); 959 }); 960 } 961 } 962 if (typeof window.initSwitchArrowPlugin === 'undefined'){ 963 window.initSwitchArrowPlugin = true; 964 $(document).ready(function() { 965 if ($('.accordionStyles').length!=0) { 966 $('.accordionStyles .card-header a[role="button"]').each(function(){ 967 if(!$(this).hasClass('collapsed')){ 968 $(this).addClass('collapsed'); 969 } 970 }); 971 } 972 }); 973 $('.accordionStyles .card-header a[role="button"]').click(function(){ 974 var $id = $(this).closest('.accordionStyles').attr('id'), 975 $iscollapsing = $(this).closest('.card').find('.panel-collapse'); 976 if (!$iscollapsing.hasClass('collapsing')) { 977 if ($id.indexOf('toggle') != -1){ 978 if ($(this).hasClass('collapsed')) { 979 $(this).find('span.sign').removeClass('mbri-arrow-down').addClass('mbri-arrow-up'); 980 } 981 else{ 982 $(this).find('span.sign').removeClass('mbri-arrow-up').addClass('mbri-arrow-down'); 983 } 984 } 985 else if ($id.indexOf('accordion')!=-1) { 986 var $accordion = $(this).closest('.accordionStyles '); 987 988 $accordion.children('.card').each(function() { 989 $(this).find('span.sign').removeClass('mbri-arrow-up').addClass('mbri-arrow-down'); 990 }); 991 if ($(this).hasClass('collapsed')) { 992 $(this).find('span.sign').removeClass('mbri-arrow-down').addClass('mbri-arrow-up'); 993 } 994 } 995 } 996 }); 997 } 998 if(typeof window.initTabsPlugin === 'undefined'){ 999 window.initTabsPlugin = true; 1000 initTabs(document.body); 1001 } 1002 1003 // Fix for slider bug 1004 if($('.mbr-slider.carousel').length!=0){ 1005 $('.mbr-slider.carousel').each(function(){ 1006 var $slider = $(this), 1007 controls = $slider.find('.carousel-control'), 1008 indicators = $slider.find('.carousel-indicators li'); 1009 $slider.on('slide.bs.carousel', function () { 1010 controls.bind('click',function(event){ 1011 clickPrev(event); 1012 }); 1013 indicators.bind('click',function(event){ 1014 clickPrev(event); 1015 }) 1016 $slider.carousel({ 1017 keyboard:false 1018 }); 1019 }).on('slid.bs.carousel',function(){ 1020 controls.unbind('click'); 1021 indicators.unbind('click'); 1022 $slider.carousel({ 1023 keyboard:true 1024 }); 1025 if($slider.find('.carousel-item.active').length>1){ 1026 $slider.find('.carousel-item.active').eq(1).removeClass('active'); 1027 $slider.find('.carousel-control li.active').eq(1).removeClass('active'); 1028 } 1029 }); 1030 }); 1031 } 1032 } 1033 // Form Styler 1034 if (isBuilder) { 1035 $(document).on('add.cards', function (event) { 1036 if ($(event.target).find('.form-with-styler').length) { 1037 1038 var form = $(event.target).find('.form-with-styler'); 1039 1040 $(form).find('select:not("[multiple]")').each(function () { 1041 $(this).styler(); 1042 }); 1043 $(form).find('input[type=number]').each(function () { 1044 $(this).styler(); 1045 $(this).parent().parent().removeClass('form-control') 1046 }); 1047 // documentation about plugin https://xdsoft.net/jqplugins/datetimepicker/ 1048 $(form).find('input[type=date]').each(function () { 1049 if($(this).datetimepicker) 1050 $(this).datetimepicker({ 1051 format: 'Y-m-d', 1052 timepicker: false 1053 }); 1054 }); 1055 $(form).find('input[type=time]').each(function () { 1056 if($(this).datetimepicker) 1057 $(this).datetimepicker({ 1058 format: 'H:i', 1059 datepicker: false 1060 }); 1061 }); 1062 1063 } 1064 }); 1065 } else { 1066 function detectmob() { 1067 if (navigator.userAgent.match(/Android/i) 1068 || navigator.userAgent.match(/webOS/i) 1069 || navigator.userAgent.match(/iPhone/i) 1070 || navigator.userAgent.match(/iPad/i) 1071 || navigator.userAgent.match(/iPod/i) 1072 || navigator.userAgent.match(/BlackBerry/i) 1073 || navigator.userAgent.match(/Windows Phone/i) 1074 || navigator.userAgent.match(/Firefox/i) 1075 ) { 1076 return true; 1077 } 1078 else { 1079 return false;
1080 } 1081 } 1082 1083 $('section .form-with-styler').each(function () { 1084 $(this).find('select:not("[multiple]")').each(function () { 1085 $(this).styler(); 1086 }); 1087 $(this).find('input[type=number]').each(function () { 1088 $(this).styler(); 1089 $(this).parent().parent().removeClass('form-control') 1090 }); 1091 if (!detectmob() && $(this).datetimepicker) { 1092 $(this).find('input[type=date]').each(function () { 1093 $(this).datetimepicker({ 1094 format: 'Y-m-d', 1095 timepicker: false 1096 }); 1097 }); 1098 $(this).find('input[type=time]').each(function () { 1099 $(this).datetimepicker({ 1100 format: 'H:i', 1101 datepicker: false 1102 }); 1103 }); 1104 } 1105 }); 1106 } 1107 1108 $(document).on('change', 'input[type="range"]', function(e){ 1109 $(e.target).parents('.form-group').find('.value')[0].innerHTML = e.target.value; 1110 }); 1111 }(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.