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