1if( typeof jQuery !== 'undefined' ) { 2 var $ = jQuery.noConflict(); 3} 4 5(function (global, factory) { 6 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 7 typeof define === 'function' && define.amd ? define(factory) : 8 ( global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.SEMICOLON = factory() ); 9} (this, (function() { 10 11 // USE STRICT 12 "use strict"; 13 14 var options = { 15 pageTransition: false, 16 cursor: false, 17 tips: false, 18 headerSticky: true, 19 headerMobileSticky: false, 20 menuBreakpoint: 992, 21 pageMenuBreakpoint: 992, 22 gmapAPI: '', 23 scrollOffset: 60, 24 scrollExternalLinks: true, 25 smoothScroll: false, 26 jsFolder: 'js/', 27 cssFolder: 'css/', 28 }; 29 30 if( typeof cnvsOptions !== 'undefined' ) { 31 options = Object.assign({}, options, cnvsOptions); 32 } 33 34 var vars = { 35 baseEl: document, 36 elRoot: document.documentElement, 37 elHead: document.head, 38 elBody: document.body, 39 viewport: { 40 width: 0, 41 height: 0, 42 }, 43 hash: window.location.hash, 44 topScrollOffset: 0, 45 elWrapper: document.getElementById('wrapper'), 46 elHeader: document.getElementById('header'), 47 headerClasses: '', 48 elHeaderWrap: document.getElementById('header-wrap'), 49 headerWrapClasses: '', 50 headerHeight: 0, 51 headerOffset: 0, 52 headerWrapHeight: 0, 53 headerWrapOffset: 0, 54 elPrimaryMenus: document.querySelectorAll('.primary-menu'), 55 elPrimaryMenuTriggers: document.querySelectorAll('.primary-menu-trigger'), 56 elPageMenu: document.getElementById('page-menu'), 57 pageMenuOffset: 0, 58 elSlider: document.getElementById('slider'), 59 elFooter: document.getElementById('footer'), 60 elAppMenu: document.querySelector('.app-menu'), 61 portfolioAjax: {}, 62 sliderParallax: { 63 el: document.querySelector('.slider-parallax'), 64 caption: document.querySelector('.slider-parallax .slider-caption'), 65 inner: document.querySelector('.slider-inner'), 66 offset: 0, 67 }, 68 get menuBreakpoint() { 69 return this.elBody.getAttribute('data-menu-breakpoint') || options.menuBreakpoint; 70 }, 71 get pageMenuBreakpoint() { 72 return this.elBody.getAttribute('data-pagemenu-breakpoint') || options.pageMenuBreakpoint; 73 }, 74 get customCursor() { 75 var value = this.elBody.getAttribute('data-custom-cursor') || options.cursor; 76 return value == 'true' || value === true ? true : false; 77 }, 78 get pageTransition() { 79 var value = this.elBody.classList.contains('page-transition') || options.pageTransition; 80 return value == 'true' || value === true ? true : false; 81 }, 82 get tips() { 83 var value = this.elBody.getAttribute('data-tips') || options.tips; 84 return value == 'true' || value === true ? true : false; 85 }, 86 get smoothScroll() { 87 var value = this.elBody.getAttribute('data-smooth-scroll') || options.smoothScroll; 88 return value == 'true' || value === true ? true : false; 89 }, 90 get isRTL() { 91 return this.elRoot.getAttribute('dir') == 'rtl' ? true : false; 92 }, 93 scrollPos: { 94 x: 0, 95 y: 0, 96 }, 97 $jq: typeof jQuery !== "undefined" ? jQuery.noConflict() : '', 98 resizers: {}, 99 recalls: {}, 100 debounced: false, 101 events: {}, 102 modules: {}, 103 fn: {}, 104 required: { 105 jQuery: { 106 plugin: 'jquery', 107 fn: function(){ 108 return typeof jQuery !== 'undefined'; 109 }, 110 file: options.jsFolder+'jquery.js', 111 id: 'canvas-jquery', 112 } 113 }, 114 fnInit: function() { 115 DocumentOnReady.init(); 116 DocumentOnLoad.init(); 117 DocumentOnResize.init(); 118 } 119 }; 120 121 var Core = function() { 122 return { 123 getOptions: options, 124 getVars: vars, 125 126 run: function(obj) { 127 Object.values(obj).map( function(fn) { 128 return typeof fn === 'function' && fn.call(); 129 }); 130 }, 131 132 runBase: function() { 133 Core.run(Base); 134 }, 135 136 runModules: function() { 137 Core.run(Modules); 138 }, 139 140 runContainerModules: function(parent) { 141 if( typeof parent === 'undefined' ) { 142 return false; 143 } 144 145 Core.getVars.baseEl = parent; 146 Core.runModules(); 147 Core.getVars.baseEl = document; 148 }, 149 150 breakpoints: function() { 151 var viewWidth = Core.viewport().width; 152 153 var breakpoint = { 154 xxl: { 155 enter: 1400, 156 exit: 99999 157 }, 158 xl: { 159 enter: 1200, 160 exit: 1399 161 }, 162 lg: { 163 enter: 992, 164 exit: 1199.98 165 }, 166 md: { 167 enter: 768, 168 exit: 991.98 169 }, 170 sm: { 171 enter: 576, 172 exit: 767.98 173 }, 174 xs: { 175 enter: 0, 176 exit: 575.98 177 } 178 }; 179 180 var previous = ''; 181 182 Object.keys( breakpoint ).forEach( function(key) { 183 if ( (viewWidth > breakpoint[key].enter) && (viewWidth <= breakpoint[key].exit) ) { 184 vars.elBody.classList.add( 'device-'+key ); 185 } else { 186 vars.elBody.classList.remove( 'device-'+key ); 187 if( previous != '' ) { 188 vars.elBody.classList.remove( 'device-down-'+previous ); 189 } 190 } 191 192 if ( viewWidth <= breakpoint[key].exit ) { 193 if( previous != '' ) { 194 vars.elBody.classList.add( 'device-down-'+previous ); 195 } 196 } 197 198 previous = key; 199 200 if ( viewWidth > breakpoint[key].enter ) { 201 vars.elBody.classList.add( 'device-up-'+key ); 202 return; 203 } else { 204 vars.elBody.classList.remove( 'device-up-'+key ); 205 } 206 }); 207 }, 208 209 colorScheme: function() { 210 if( vars.elBody.classList.contains('adaptive-color-scheme') ) { 211 window.matchMedia('(prefers-color-scheme: dark)').matches ? vars.elBody.classList.add( 'dark' ) : vars.elBody.classList.remove('dark'); 212 } 213 214 var bodyColorScheme = Core.cookie.get('__cnvs_body_color_scheme'); 215 216 if( bodyColorScheme && bodyColorScheme != '' ) { 217 bodyColorScheme.split(" ").includes('dark') ? vars.elBody.classList.add( 'dark' ) : vars.elBody.classList.remove( 'dark' ); 218 } 219 }, 220 221 throttle: function(timer, func, delay) { 222 if(timer) { 223 return; 224 } 225 226 timer = setTimeout( function() { 227 func(); 228 timer = undefined; 229 }, delay); 230 }, 231 232 debounce: function(callback, delay) { 233 clearTimeout(vars.debounced); 234 vars.debounced = setTimeout(callback, delay); 235 }, 236 237 debouncedResize: function(func, delay) { 238 var timeoutId; 239 return function() { 240 var context = this; 241 var args = arguments; 242 clearTimeout(timeoutId); 243 timeoutId = setTimeout( function() {
244 func.apply(context, args); 245 }, delay); 246 }; 247 }, 248 249 addEvent: function(el, event, args = {}) { 250 if( typeof el === "undefined" || typeof event === "undefined" ) { 251 return; 252 } 253 254 var createEvent = new CustomEvent( event, { 255 detail: args 256 }); 257 258 el.dispatchEvent( createEvent ); 259 vars.events[event] = true; 260 }, 261 262 scrollEnd: function(callback, refresh = 199) { 263 if (!callback || typeof callback !== 'function') return; 264 265 window.addEventListener('scroll', function() { 266 Core.debounce( callback, refresh ); 267 }, {passive: true}); 268 }, 269 270 viewport: function() { 271 var viewport = { 272 width: window.innerWidth || vars.elRoot.clientWidth, 273 height: window.innerHeight || vars.elRoot.clientHeight 274 }; 275 276 vars.viewport = viewport; 277 278 document.documentElement.style.setProperty('--cnvs-viewport-width', viewport.width); 279 document.documentElement.style.setProperty('--cnvs-viewport-height', viewport.height); 280 document.documentElement.style.setProperty('--cnvs-body-height', vars.elBody.clientHeight); 281 282 return viewport; 283 }, 284 285 isElement: function(selector) { 286 if (typeof selector === 'object' && selector !== null) { 287 return true; 288 } 289 290 if (selector instanceof Element || selector instanceof HTMLElement) { 291 return true; 292 } 293 294 if (typeof selector.jquery !== 'undefined') { 295 selector = selector[0]; 296 } 297 298 if (typeof selector.nodeType !== 'undefined') { 299 return true; 300 } 301 302 return false; 303 }, 304 305 getSelector: function(selector, jquery=true, customjs=true) { 306 if(jquery) { 307 if( Core.getVars.baseEl !== document ) { 308 selector = jQuery(Core.getVars.baseEl).find(selector); 309 } else { 310 selector = jQuery(selector); 311 } 312 313 if( customjs ) { 314 if( typeof customjs == 'string' ) { 315 selector = selector.filter(':not('+ customjs +')'); 316 } else { 317 selector = selector.filter(':not(.customjs)'); 318 } 319 } 320 } else { 321 if( Core.isElement(selector) ) { 322 selector = selector; 323 } else { 324 if( customjs ) { 325 if( typeof customjs == 'string' ) { 326 selector = Core.getVars.baseEl.querySelectorAll(selector+':not('+customjs+')'); 327 } else { 328 selector = Core.getVars.baseEl.querySelectorAll(selector+':not(.customjs)'); 329 } 330 } else { 331 selector = Core.getVars.baseEl.querySelectorAll(selector); 332 } 333 } 334 } 335 336 return selector; 337 }, 338 339 onResize: function(callback, refresh = 333) { 340 if (!callback || typeof callback !== 'function') return; 341 342 window.addEventListener('resize', function() { 343 Core.debounce( callback, refresh ); 344 }); 345 }, 346 347 imagesLoaded: function(el) { 348 var imgs = el.getElementsByTagName('img') || document.images, 349 len = imgs.length, 350 counter = 0; 351 352 if(len < 1) { 353 Core.addEvent(el, 'CanvasImagesLoaded'); 354 } 355 356 var incrementCounter = async function() { 357 counter++; 358 if(counter === len) { 359 Core.addEvent(el, 'CanvasImagesLoaded'); 360 } 361 }; 362 363 [].forEach.call( imgs, function( img ) { 364 if(img.complete) { 365 incrementCounter(); 366 } else { 367 img.addEventListener('load', incrementCounter, false); 368 } 369 }); 370 }, 371 372 contains: function(classes, selector) { 373 var classArray = classes.split(" "); 374 var hasClass = false; 375 376 classArray.forEach( function(classTxt) { 377 if( vars.elBody.classList.contains(classTxt) ) { 378 hasClass = true; 379 } 380 }); 381 382 return hasClass; 383 }, 384 385 has: function(nodeList, selector) { 386 return [].slice.call(nodeList)?.filter( function(e) { 387 return e.querySelector(selector); 388 }); 389 }, 390 391 filtered: function(nodeList, selector) { 392 return [].slice.call(nodeList)?.filter( function(e) { 393 return e.matches(selector); 394 }); 395 }, 396 397 parents: function(elem, selector) { 398 if (!Element.prototype.matches) { 399 Element.prototype.matches = 400 Element.prototype.matchesSelector || 401 Element.prototype.mozMatchesSelector || 402 Element.prototype.msMatchesSelector || 403 Element.prototype.oMatchesSelector || 404 Element.prototype.webkitMatchesSelector || 405 function(s) { 406 var matches = (this.document || this.ownerDocument).querySelectorAll(s), 407 i = matches.length; 408 while (--i >= 0 && matches.item(i) !== this) {} 409 return i > -1; 410 }; 411 } 412 413 var parents = []; 414 415 for ( ; elem && elem !== document; elem = elem.parentNode ) { 416 if (selector) { 417 if (elem.matches(selector)) { 418 parents.push(elem); 419 } 420 continue; 421 } 422 parents.push(elem); 423 } 424 425 return parents; 426 }, 427 428 siblings: function(elem, nodes = false) { 429 if( nodes ) { 430 return [].slice.call(nodes).filter( function(sibling) { 431 return sibling !== elem; 432 }); 433 } else { 434 return [].slice.call(elem.parentNode.children).filter( function(sibling) { 435 return sibling !== elem; 436 }); 437 } 438 }, 439 440 getNext: function(elem, selector) { 441 var nextElem = elem.nextElementSibling; 442 443 if( !selector ) { 444 return nextElem; 445 } 446 447 if( nextElem && nextElem.matches(selector) ) { 448 return nextElem; 449 } 450 451 return null; 452 }, 453 454 offset: function(el) { 455 var rect = el.getBoundingClientRect(), 456 scrollLeft = window.scrollX || document.documentElement.scrollLeft, 457 scrollTop = window.scrollY || document.documentElement.scrollTop; 458 459 return {top: rect.top + scrollTop, left: rect.left + scrollLeft}; 460 }, 461 462 isHidden: function(el) { 463 return (el.offsetParent === null); 464 }, 465 466 classesFn: function(func, classes, selector) { 467 var classArray = classes.split(" "); 468 classArray.forEach( function(classTxt) { 469 if( func == 'add' ) { 470 selector.classList.add(classTxt); 471 } else if( func == 'toggle' ) { 472 selector.classList.toggle(classTxt); 473 } else { 474 selector.classList.remove(classTxt); 475 } 476 }); 477 }, 478 479 cookie: function() { 480 return { 481 set: function(name, value, daysToExpire) { 482 var date = new Date(); 483 date.setTime(date.getTime() + (daysToExpire * 24 * 60 * 60 * 1000)); 484 var expires = "expires=" + date.toUTCString(); 485 document.cookie = name + "=" + value + ";" + expires + ";path=/"; 486 }, 487 488 get: function(name) { 489 var decodedCookies = decodeURIComponent(document.cookie); 490 var cookies = decodedCookies.split(";"); 491 492 for (let i = 0; i < cookies.length; i++) { 493 var cookie = cookies[i].trim(); 494 if (cookie.startsWith(name + "=")) { 495 return cookie.substring(name.length + 1); 496 } 497 } 498 499 return null; 500 }, 501 502 remove: function(name) { 503 document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; 504 } 505 }; 506 }(), 507 508 scrollTo: function(offset = 0, speed = 1250, easing, behavior = 'smooth') { 509 if( easing && (typeof jQuery !== 'undefined' && typeof jQuery.easing["easeOutQuad"] !== 'undefined') ) { 510 jQuery('body,html').stop(true).animate({ 511 'scrollTop': Number(offset) 512 }, Number( speed ), easing ); 513 } else { 514 var smoothScroll = 'scrollBehavior' in document.documentElement.style; 515 516 if( typeof window.scroll === 'function' && smoothScroll ) { 517 window.scroll({ 518 top: Number(offset), 519 behavior: behavior 520 }); 521 } else { 522 var body = Core.getVars.elBody; 523 var rootEl = Core.getVars.elRoot; 524 525 body.scrollIntoView(); 526 rootEl.scrollIntoView(); 527 528 var scrollToTop = function() { 529 if (body.scrollTop > Number(offset) || rootEl.scrollTop > Number(offset)) { 530 body.scrollTop -= 20; 531 rootEl.scrollTop -= 20; 532 setTimeout(scrollToTop, 10); 533 } 534 }; 535 536 scrollToTop(); 537 } 538 } 539 }, 540 541 smoothScroll: function() { 542 new initSmoothScrollfunction(document,90,5); 543 544 function initSmoothScrollfunction(target, speed, smooth) { 545 if (target === document) 546 target = (document.scrollingElement 547 || document.documentElement 548 || document.body.parentNode 549 || document.body); // cross browser support for document scrolling 550 551 var moving = false;
552 var pos = target.scrollTop; 553 var frame = target === document.body 554 && document.documentElement 555 ? document.documentElement 556 : target; // safari is the new IE 557 558 target.addEventListener('mousewheel', scrolled, { passive: false }); 559 target.addEventListener('DOMMouseScroll', scrolled, { passive: false }); 560 561 function scrolled(e) { 562 e.preventDefault(); // disable default scrolling 563 564 var delta = normalizeWheelDelta(e); 565 566 pos += -delta * speed; 567 pos = Math.max(0, Math.min(pos, target.scrollHeight - frame.clientHeight)); // limit scrolling 568 569 if (!moving) update(); 570 } 571 572 function normalizeWheelDelta(e){ 573 if(e.detail){ 574 if(e.wheelDelta) 575 return e.wheelDelta/e.detail/40 * (e.detail>0 ? 1 : -1); // Opera 576 else 577 return -e.detail/3; // Firefox 578 }else 579 return e.wheelDelta/120; // IE,Safari,Chrome 580 }; 581 582 function update() { 583 moving = true; 584 585 var delta = (pos - target.scrollTop) / smooth; 586 587 target.scrollTop += delta; 588 589 if (Math.abs(delta) > 0.5) 590 requestFrame(update); 591 else 592 moving = false; 593 } 594 595 var requestFrame = function() { // requestAnimationFrame cross browser 596 return ( 597 window.requestAnimationFrame || 598 window.webkitRequestAnimationFrame || 599 window.mozRequestAnimationFrame || 600 window.oRequestAnimationFrame || 601 window.msRequestAnimationFrame || 602 function(func) { 603 window.setTimeout(func, 1000 / 50); 604 } 605 ); 606 }(); 607 } 608 }, 609 610 loadCSS: function(params) { 611 var file = params.file; 612 var htmlID = params.id || false; 613 var cssFolder = params.cssFolder || false; 614 615 if( !file ) { 616 return false; 617 } 618 619 if( htmlID && document.getElementById(htmlID) ) { 620 return false; 621 } 622 623 var htmlStyle = document.createElement('link'); 624 625 htmlStyle.id = htmlID; 626 htmlStyle.href = cssFolder ? options.cssFolder+file : file; 627 htmlStyle.rel = 'stylesheet'; 628 htmlStyle.type = 'text/css'; 629 630 vars.elHead.appendChild(htmlStyle); 631 return true; 632 }, 633 634 loadJS: function(params) { 635 var file = params.file; 636 var htmlID = params.id || false; 637 var type = params.type || false; 638 var callback = params.callback; 639 var async = params.async || true; 640 var defer = params.defer || true; 641 var jsFolder = params.jsFolder || false; 642 643 if( !file ) { 644 return false; 645 } 646 647 if( htmlID && document.getElementById(htmlID) ) { 648 return false; 649 } 650 651 var htmlScript = document.createElement('script'); 652 653 if ( typeof callback !== 'undefined' ) { 654 if( typeof callback != 'function' ) { 655 throw new Error('Not a valid callback!'); 656 } else { 657 htmlScript.onload = callback; 658 } 659 } 660 661 htmlScript.id = htmlID; 662 htmlScript.src = jsFolder ? options.jsFolder+file : file; 663 if( type ) { 664 htmlScript.type = type; 665 } 666 htmlScript.async = async ? true : false; 667 htmlScript.defer = defer ? true : false; 668 669 vars.elBody.appendChild(htmlScript); 670 return true; 671 }, 672 673 isFuncTrue: async function(fn) { 674 if( 'function' !== typeof fn ) { 675 return false; 676 } 677 678 var counter = 0; 679 680 return new Promise( function(resolve, reject) { 681 if(fn()) { 682 resolve(true); 683 } else { 684 var int = setInterval( function() { 685 if(fn()) { 686 clearInterval( int ); 687 resolve(true); 688 } else { 689 if( counter > 30 ) { 690 clearInterval( int ); 691 reject(true); 692 } 693 } 694 counter++; 695 }, 333); 696 } 697 }).catch( function(error) { 698 console.log('Function does not exist: ' + fn); 699 }); 700 }, 701 702 initFunction: function(params) { 703 vars.elBody.classList.add(params.class); 704 Core.addEvent(window, params.event); 705 vars.events[params.event] = true; 706 }, 707 708 topScrollOffset: function() { 709 var headerHeight = 0; 710 var pageMenuOffset = vars.elPageMenu?.querySelector('#page-menu-wrap')?.offsetHeight || 0; 711 712 if( vars.elBody.classList.contains('is-expanded-menu') ) { 713 if( vars.elHeader?.classList.contains('sticky-header') ) { 714 headerHeight = vars.elHeaderWrap.offsetHeight; 715 } 716 717 if( vars.elPageMenu?.classList.contains('dots-menu') || !vars.elPageMenu?.classList.contains('sticky-page-menu') ) { 718 pageMenuOffset = 0; 719 } 720 } 721 722 Core.getVars.topScrollOffset = headerHeight + pageMenuOffset + options.scrollOffset; 723 }, 724 }; 725 }(); 726 727 var Base = function() { 728 return { 729 init: function() { 730 Mobile.any() && vars.elBody.classList.add('device-touch'); 731 }, 732
733 menuBreakpoint: function() { 734 if( Core.getVars.menuBreakpoint <= Core.viewport().width ) { 735 vars.elBody.classList.add( 'is-expanded-menu' ); 736 } else { 737 vars.elBody.classList.remove( 'is-expanded-menu' ); 738 } 739 740 if( vars.elPageMenu ) { 741 if( typeof Core.getVars.pageMenuBreakpoint === 'undefined' ) { 742 Core.getVars.pageMenuBreakpoint = Core.getVars.menuBreakpoint; 743 } 744 745 if( Core.getVars.pageMenuBreakpoint <= Core.viewport().width ) { 746 vars.elBody.classList.add( 'is-expanded-pagemenu' ); 747 } else { 748 vars.elBody.classList.remove( 'is-expanded-pagemenu' ); 749 } 750 } 751 }, 752 753 goToTop: function() { 754 CNVS.GoToTop.init('#gotoTop'); 755 }, 756 757 stickFooterOnSmall: function() { 758 CNVS.StickFooterOnSmall && CNVS.StickFooterOnSmall.init('#footer'); 759 }, 760 761 logo: function() { 762 CNVS.Logo.init('#logo'); 763 }, 764 765 headers: function() { 766 Core.getVars.headerClasses = vars.elHeader?.className || ''; 767 Core.getVars.headerWrapClasses = vars.elHeaderWrap?.className || ''; 768 CNVS.Headers.init('#header'); 769 }, 770 771 menus: function() { 772 CNVS.Menus.init('#header'); 773 }, 774 775 pageMenu: function() { 776 CNVS.PageMenu && CNVS.PageMenu.init('#page-menu'); 777 }, 778 779 sliderDimensions: function() { 780 CNVS.SliderDimensions && CNVS.SliderDimensions.init('.slider-element'); 781 }, 782 783 sliderMenuClass: function() { 784 CNVS.SliderMenuClass && CNVS.SliderMenuClass.init('.transparent-header + .swiper_wrapper,.swiper_wrapper + .transparent-header,.transparent-header + .revslider-wrap,.revslider-wrap + .transparent-header'); 785 }, 786 787 topSearch: function() { 788 CNVS.TopSearch.init('#top-search-trigger'); 789 }, 790 791 topCart: function() { 792 CNVS.TopCart.init('#top-cart'); 793 }, 794 795 sidePanel: function() { 796 CNVS.SidePanel && CNVS.SidePanel.init('#side-panel'); 797 }, 798 799 adaptiveColorScheme: function() { 800 CNVS.AdaptiveColorScheme && CNVS.AdaptiveColorScheme.init('.adaptive-color-scheme'); 801 }, 802 803 portfolioAjax: function() { 804 CNVS.PortfolioAjax && CNVS.PortfolioAjax.init('.portfolio-ajax'); 805 }, 806 807 cursor: function() { 808 if( vars.customCursor ) { 809 CNVS.Cursor && CNVS.Cursor.init('body'); 810 } 811 }, 812 813 setBSTheme: function() { 814 if( vars.elBody.classList.contains('dark') ) { 815 document.querySelector('html').setAttribute('data-bs-theme', 'dark'); 816 } else { 817 document.querySelector('html').removeAttribute('data-bs-theme'); 818 document.querySelectorAll('.dark')?.forEach( function(el) { 819 el.setAttribute('data-bs-theme', 'dark'); 820 }); 821 } 822 823 vars.elBody.querySelectorAll('.not-dark')?.forEach( function(el) { 824 el.setAttribute('data-bs-theme', 'light'); 825 }); 826 } 827 } 828 }(); 829 830 var Modules = function() { 831 return { 832 bootstrap: function() { 833 var notExec = true; 834 document.querySelectorAll('*').forEach( function(el) { 835 if( notExec ) { 836 el.getAttributeNames().some( function(text) { 837 if( text.includes('data-bs') ) { 838 notExec = false; 839 CNVS.Bootstrap && CNVS.Bootstrap.init('body'); 840 return true; 841 } 842 }); 843 } 844 }); 845 }, 846 847 resizeVideos: function(element) { 848 CNVS.ResizeVideos && CNVS.ResizeVideos.init(element ? element : 'iframe[src*="youtube"],iframe[src*="vimeo"],iframe[src*="dailymotion"],iframe[src*="maps.google.com"],iframe[src*="google.com/maps"]'); 849 }, 850 851 pageTransition: function() { 852 if( vars.pageTransition ) { 853 CNVS.PageTransition && CNVS.PageTransition.init('body'); 854 } 855 }, 856 857 lazyLoad: function(element) { 858 CNVS.LazyLoad && CNVS.LazyLoad.init(element ? element : '.lazy:not(.lazy-loaded)'); 859 }, 860 861 dataClasses: function() { 862 CNVS.DataClasses && CNVS.DataClasses.init('[data-class]'); 863 }, 864 865 dataHeights: function() { 866 CNVS.DataHeights && CNVS.DataHeights.init('[data-height-xxl],[data-height-xl],[data-height-lg],[data-height-md],[data-height-sm],[data-height-xs]'); 867 }, 868 869 lightbox: function(element) { 870 CNVS.Lightbox && CNVS.Lightbox.init(element ? element : '[data-lightbox]'); 871 }, 872 873 modal: function(element) { 874 CNVS.Modal && CNVS.Modal.init(element ? element : '.modal-on-load'); 875 }, 876 877 animations: function(element) { 878 CNVS.Animations && CNVS.Animations.init(element ? element : '[data-animate]'); 879 }, 880 881 hoverAnimations: function(element) { 882 CNVS.HoverAnimations && CNVS.HoverAnimations.init(element ? element : '[data-hover-animate]'); 883 }, 884 885 gridInit: function(element) { 886 CNVS.Grid && CNVS.Grid.init(element ? element : '.grid-container'); 887 }, 888 889 filterInit: function(element) { 890 CNVS.Filter && CNVS.Filter.init(element ? element : '.grid-filter,.custom-filter'); 891 }, 892 893 canvasSlider: function(element) { 894 CNVS.CanvasSlider && CNVS.CanvasSlider.init(element ? element : '.swiper_wrapper'); 895 }, 896 897 sliderParallax: function() { 898 CNVS.SliderParallax && CNVS.SliderParallax.init('.slider-parallax'); 899 }, 900 901 flexSlider: function(element) { 902 CNVS.FlexSlider && CNVS.FlexSlider.init(element ? element : '.fslider'); 903 }, 904 905 html5Video: function(element) { 906 CNVS.FullVideo && CNVS.FullVideo.init(element ? element : '.video-wrap'); 907 }, 908 909 youtubeBgVideo: function(element) { 910 CNVS.YoutubeBG && CNVS.YoutubeBG.init(element ? element : '.yt-bg-player'); 911 }, 912 913 toggle: function(element) { 914 CNVS.Toggle && CNVS.Toggle.init(element ? element : '.toggle'); 915 }, 916 917 accordion: function(element) { 918 CNVS.Accordion && CNVS.Accordion.init(element ? element : '.accordion'); 919 }, 920 921 counter: function(element) { 922 CNVS.Counter && CNVS.Counter.init(element ? element : '.counter'); 923 }, 924 925 countdown: function(element) { 926 CNVS.Countdown && CNVS.Countdown.init(element ? element : '.countdown'); 927 }, 928 929 gmap: function(element) { 930 CNVS.GoogleMaps && CNVS.GoogleMaps.init(element ? element : '.gmap'); 931 }, 932 933 roundedSkills: function(element) { 934 CNVS.RoundedSkills && CNVS.RoundedSkills.init(element ? element : '.rounded-skill'); 935 }, 936 937 progress: function(element) { 938 CNVS.Progress && CNVS.Progress.init(element ? element : '.skill-progress'); 939 }, 940 941 twitterFeed: function(element) { 942 CNVS.Twitter && CNVS.Twitter.init(element ? element : '.twitter-feed'); 943 }, 944 945 flickrFeed: function(element) { 946 CNVS.Flickr && CNVS.Flickr.init(element ? element : '.flickr-feed'); 947 }, 948 949 instagram: function(element) { 950 CNVS.Instagram && CNVS.Instagram.init(element ? element : '.instagram-photos'); 951 }, 952 953 // Dribbble Pending 954 955 navTree: function(element) { 956 CNVS.NavTree && CNVS.NavTree.init(element ? element : '.nav-tree'); 957 }, 958 959 carousel: function(element) { 960 CNVS.Carousel && CNVS.Carousel.init(element ? element : '.carousel-widget'); 961 }, 962 963 masonryThumbs: function(element) { 964 CNVS.MasonryThumbs && CNVS.MasonryThumbs.init(element ? element : '.masonry-thumbs'); 965 }, 966 967 notifications: function(element) { 968 CNVS.Notifications && CNVS.Notifications.init(element ? element : false); 969 }, 970 971 textRotator: function(element) { 972 CNVS.TextRotator && CNVS.TextRotator.init(element ? element : '.text-rotater'); 973 }, 974 975 onePage: function(element) { 976 CNVS.OnePage && CNVS.OnePage.init(element ? element : '[data-scrollto],.one-page-menu'); 977 }, 978 979 ajaxForm: function(element) { 980 CNVS.AjaxForm && CNVS.AjaxForm.init(element ? element : '.form-widget'); 981 }, 982 983 subscribe: function(element) { 984 CNVS.Subscribe && CNVS.Subscribe.init(element ? element : '.subscribe-widget'); 985 }, 986 987 conditional: function(element) { 988 CNVS.Conditional && CNVS.Conditional.init(element ? element : '.form-group[data-condition],.form-group[data-conditions]'); 989 }, 990 991 shapeDivider: function(element) { 992 CNVS.ShapeDivider && CNVS.ShapeDivider.init(element ? element : '.shape-divider'); 993 }, 994 995 stickySidebar: function(element) { 996 CNVS.StickySidebar && CNVS.StickySidebar.init(element ? element : '.sticky-sidebar-wrap'); 997 }, 998 999 cookies: function(element) { 1000 CNVS.Cookies && CNVS.Cookies.init(element ? element : '.gdpr-settings,[data-cookies]'); 1001 }, 1002 1003 quantity: function(element) { 1004 CNVS.Quantity && CNVS.Quantity.init(element ? element : '.quantity'); 1005 }, 1006 1007 readmore: function(element) { 1008 CNVS.ReadMore && CNVS.ReadMore.init(element ? element : '[data-readmore]'); 1009 }, 1010 1011 pricingSwitcher: function(element) { 1012 CNVS.PricingSwitcher && CNVS.PricingSwitcher.init(element ? element : '.pricing-tenure-switcher'); 1013 }, 1014 1015 ajaxTrigger: function(element) { 1016 CNVS.AjaxTrigger && CNVS.AjaxTrigger.init(element ? element : '[data-ajax-loader]'); 1017 }, 1018 1019 videoFacade: function(element) { 1020 CNVS.VideoFacade && CNVS.VideoFacade.init(element ? element : '.video-facade'); 1021 }, 1022 1023 schemeToggle: function(element) { 1024 CNVS.SchemeToggle && CNVS.SchemeToggle.init(element ? element : '.body-scheme-toggle'); 1025 }, 1026 1027 clipboardCopy: function(element) { 1028 CNVS.Clipboard && CNVS.Clipboard.init(element ? element : '.clipboard-copy'); 1029 }, 1030 1031 codeHighlight: function(element) { 1032 CNVS.CodeHighlight && CNVS.CodeHighlight.init(element ? element : '.code-highlight'); 1033 }, 1034 1035 tips: function() { 1036 if( vars.tips ) { 1037 CNVS.Tips && CNVS.Tips.init('body'); 1038 } 1039 }, 1040 1041 textSplitter: function(element) { 1042 CNVS.TextSplitter && CNVS.TextSplitter.init(element ? element : '.text-splitter'); 1043 }, 1044 1045 mediaActions: function(element) { 1046 CNVS.MediaActions && CNVS.MediaActions.init(element ? element : '.media-wrap'); 1047 }, 1048 1049 viewportDetect: function(element) { 1050 CNVS.ViewportDetect && CNVS.ViewportDetect.init(element ? element : '.viewport-detect'); 1051 }, 1052 1053 scrollDetect: function(element) { 1054 CNVS.ScrollDetect && CNVS.ScrollDetect.init(element ? element : '.scroll-detect'); 1055 }, 1056 1057 fontSizer: function(element) { 1058 CNVS.FontSizer && CNVS.FontSizer.init(element ? element : '.font-sizer'); 1059 }, 1060 1061 hover3D: function(element) { 1062 CNVS.Hover3D && CNVS.Hover3D.init(element ? element : '.hover-3d'); 1063 }, 1064 1065 buttons: function(element) { 1066 CNVS.Buttons && CNVS.Buttons.init(element ? element : '.button-text-effect'); 1067 }, 1068 1069 bsComponents: function(element) { 1070 CNVS.BSComponents && CNVS.BSComponents.init(element ? element : '[data-bs-toggle="tooltip"],[data-bs-toggle="popover"],[data-bs-toggle="tab"],[data-bs-toggle="pill"],.style-msg'); 1071 } 1072 }; 1073 }(); 1074 1075 var Mobile = function() { 1076 return { 1077 Android: function() { 1078 return navigator.userAgent.match(/Android/i); 1079 }, 1080 BlackBerry: function() { 1081 return navigator.userAgent.match(/BlackBerry/i); 1082 }, 1083 iOS: function() { 1084 return navigator.userAgent.match(/iPhone|iPad|iPod/i); 1085 }, 1086 Opera: function() { 1087 return navigator.userAgent.match(/Opera Mini/i); 1088 }, 1089 Windows: function() { 1090 return navigator.userAgent.match(/IEMobile/i); 1091 }, 1092 any: function() { 1093 return (Mobile.Android() || Mobile.BlackBerry() || Mobile.iOS() || Mobile.Opera() || Mobile.Windows()); 1094 } 1095 } 1096 }(); 1097 1098 // Add your Custom JS Codes here 1099 var Custom = function() { 1100 return { 1101 onReady: function() { 1102 // Add JS Codes here to Run on Document Ready 1103 }, 1104 1105 onLoad: function() { 1106 // Add JS Codes here to Run on Window Load 1107 }, 1108 1109 onResize: function() { 1110 // Add JS Codes here to Run on Window Resize 1111 } 1112 } 1113 }(); 1114 1115 var DocumentOnResize = function() { 1116 return { 1117 init: function() { 1118 Core.viewport(); 1119 Core.breakpoints();
1120 Base.menuBreakpoint(); 1121 1122 Core.run(vars.resizers); 1123 1124 Custom.onResize(); 1125 Core.addEvent( window, 'cnvsResize' ); 1126 } 1127 }; 1128 }(); 1129 1130 var DocumentOnReady = function() { 1131 return { 1132 init: function() { 1133 Core.breakpoints(); 1134 Core.colorScheme(); 1135 Core.runBase(); 1136 Core.runModules(); 1137 Core.topScrollOffset(); 1138 1139 if( vars.smoothScroll ) { 1140 new Core.smoothScroll(); 1141 } 1142 1143 DocumentOnReady.windowscroll(); 1144 1145 Custom.onReady(); 1146 }, 1147 1148 windowscroll: function() { 1149 Core.scrollEnd( function() { 1150 Base.pageMenu(); 1151 }); 1152 } 1153 }; 1154 }(); 1155 1156 var DocumentOnLoad = function() { 1157 return { 1158 init: function() { 1159 Custom.onLoad(); 1160 } 1161 }; 1162 }(); 1163 1164 document.addEventListener( 'DOMContentLoaded', function() { 1165 DocumentOnReady.init(); 1166 }); 1167 1168 window.addEventListener('load', function() { 1169 DocumentOnLoad.init(); 1170 }); 1171 1172 var resizeFunctions = Core.debouncedResize( function() { 1173 DocumentOnResize.init(); 1174 }, 250); 1175 1176 window.addEventListener('resize', function() { 1177 resizeFunctions(); 1178 }); 1179 1180 var canvas_umd = { 1181 Core, 1182 Base, 1183 Modules, 1184 Mobile, 1185 Custom, 1186 }; 1187 1188 return canvas_umd; 1189}))); 1190 1191(function (global, factory) { 1192 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 1193 typeof define === 'function' && define.amd ? define(factory) : 1194 ( global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.CNVS = factory() ); 1195} (this, (function() { 1196 // USE STRICT 1197 "use strict"; 1198 1199 /** 1200 * -------------------------------------------------------------------------- 1201 * DO NOT DELETE!! Start (Required) 1202 * -------------------------------------------------------------------------- 1203 */ 1204 if( SEMICOLON === 'undefined' || SEMICOLON.Core === 'undefined' || SEMICOLON.Base === 'undefined' || SEMICOLON.Modules === 'undefined' || SEMICOLON.Mobile === 'undefined' ) { 1205 return false; 1206 } 1207 1208 var __core = SEMICOLON.Core; 1209 var __base = SEMICOLON.Base; 1210 var __modules = SEMICOLON.Modules; 1211 var __mobile = SEMICOLON.Mobile; 1212 // DO NOT DELETE!! End 1213 1214 return { 1215 /** 1216 * -------------------------------------------------------------------------- 1217 * Logo Functions Start (Required) 1218 * -------------------------------------------------------------------------- 1219 */ 1220 Logo: function() { 1221 return { 1222 init: function(selector) { 1223 selector = __core.getSelector( selector, false ); 1224 if( selector.length < 1 ){ 1225 return true; 1226 } 1227 1228 var head = __core.getVars.elHead, 1229 style, 1230 css; 1231 1232 if( selector[0].querySelector('.logo-dark') ) { 1233 style = document.createElement('style'); 1234 head.appendChild(style); 1235 css = '.dark #header-wrap:not(.not-dark) #logo [class^="logo-"], .dark .header-row:not(.not-dark) #logo [class^="logo-"] { display: none; } .dark #header-wrap:not(.not-dark) #logo .logo-dark, .dark .header-row:not(.not-dark) #logo .logo-dark { display: flex; }'; 1236 style.appendChild(document.createTextNode(css)); 1237 } 1238 1239 if( selector[0].querySelector('.logo-sticky') ) { 1240 style = document.createElement('style'); 1241 head.appendChild(style); 1242 css = '.sticky-header #logo [class^="logo-"] { display: none !important; } .sticky-header #logo .logo-sticky { display: flex !important; }'; 1243 style.appendChild(document.createTextNode(css)); 1244 } 1245 1246 if( selector[0].querySelector('.logo-sticky-shrink') ) { 1247 style = document.createElement('style'); 1248 head.appendChild(style); 1249 css = '.sticky-header-shrink #logo [class^="logo-"] { display: none; } .sticky-header-shrink #logo .logo-sticky-shrink { display: flex; }'; 1250 style.appendChild(document.createTextNode(css)); 1251 } 1252 1253 if( selector[0].querySelector('.logo-mobile') ) { 1254 style = document.createElement('style'); 1255 head.appendChild(style); 1256 css = 'body:not(.is-expanded-menu) #logo [class^="logo-"] { display: none; } body:not(.is-expanded-menu) #logo .logo-mobile { display: flex; }'; 1257 style.appendChild(document.createTextNode(css)); 1258 } 1259 } 1260 }; 1261 }(), 1262 // Logo Functions End 1263 1264 /** 1265 * -------------------------------------------------------------------------- 1266 * GoToTop Functions Start (Required) 1267 * -------------------------------------------------------------------------- 1268 */ 1269 GoToTop: function() { 1270 var _init = function(element) { 1271 var elSpeed = element.getAttribute('data-speed') || 700, 1272 elEasing = element.getAttribute('data-easing'); 1273 1274 element.onclick = function(e) { 1275 __core.scrollTo(0, Number(elSpeed), elEasing); 1276 e.preventDefault(); 1277 }; 1278 }; 1279 1280 var _scroll = function(element) { 1281 var body = __core.getVars.elBody.classList; 1282 1283 var elMobile = element.getAttribute('data-mobile') || 'false', 1284 elOffset = element.getAttribute('data-offset') || 450; 1285 1286 if( elMobile == 'false' && ( body.contains('device-xs') || body.contains('device-sm') || body.contains('device-md') ) ) { 1287 return true; 1288 } 1289 1290 if( window.scrollY > Number(elOffset) ) { 1291 body.add('gototop-active'); 1292 } else { 1293 body.remove('gototop-active'); 1294 } 1295 }; 1296 1297 return { 1298 init: function(selector) { 1299 selector = __core.getSelector( selector, false ); 1300 if( selector.length < 1 ){ 1301 return true; 1302 } 1303 1304 _init(selector[0]); 1305 _scroll(selector[0]); 1306 1307 window.addEventListener('scroll', function(){ 1308 _scroll(selector[0]); 1309 }, {passive:true}); 1310 } 1311 }; 1312 }(), 1313 // GoToTop Functions End 1314 1315 /** 1316 * -------------------------------------------------------------------------- 1317 * StickFooterOnSmall Functions Start 1318 * -------------------------------------------------------------------------- 1319 */ 1320 StickFooterOnSmall: function() { 1321 return { 1322 init: function(selector) { 1323 selector = __core.getSelector( selector, false ); 1324 if( selector.length < 1 ){ 1325 return true; 1326 } 1327 1328 __core.getVars.elFooter.style.marginTop = ''; 1329 1330 var windowH = __core.viewport().height, 1331 wrapperH = __core.getVars.elWrapper.offsetHeight; 1332 1333 if( !__core.getVars.elBody.classList.contains('sticky-footer') && __core.getVars.elFooter !== 'undefined' && __core.getVars.elWrapper.contains( __core.getVars.elFooter ) ) { 1334 if( windowH > wrapperH ) { 1335 __core.getVars.elFooter.style.marginTop = (windowH - wrapperH)+'px'; 1336 } 1337 } 1338 1339 if( __core.getVars.elAppMenu ) { 1340 if((__core.viewport().height - (__core.getVars.elAppMenu.getBoundingClientRect().top + __core.getVars.elAppMenu.getBoundingClientRect().height)) === 0) { 1341 __core.getVars.elFooter.style.marginBottom = __core.getVars.elAppMenu.offsetHeight+'px'; 1342 } 1343 } 1344 1345 __core.getVars.resizers.stickfooter = function() { 1346 __base.stickFooterOnSmall(); 1347 }; 1348 } 1349 }; 1350 }(), 1351 // StickFooterOnSmall Functions End 1352 1353 /** 1354 * -------------------------------------------------------------------------- 1355 * Header Functions Start (Required) 1356 * -------------------------------------------------------------------------- 1357 */ 1358 Headers: function() { 1359 var _offset = function() { 1360 var elHeader = __core.getVars.elHeader; 1361 var elHeaderInc = document.querySelector('.include-header'); 1362 1363 __core.getVars.headerOffset = elHeader.offsetTop; 1364 if( __core.getVars.elHeader?.classList.contains('floating-header') || elHeaderInc?.classList.contains('include-topbar') ) { 1365 __core.getVars.headerOffset = __core.offset(elHeader).top; 1366 } 1367 __core.getVars.elHeaderWrap?.classList.add('position-absolute'); 1368 __core.getVars.headerWrapOffset = __core.getVars.headerOffset + __core.getVars.elHeaderWrap?.offsetTop; 1369 __core.getVars.elHeaderWrap?.classList.remove('position-absolute'); 1370 1371 if( elHeader.hasAttribute('data-sticky-offset') ) { 1372 var headerDefinedOffset = elHeader.getAttribute('data-sticky-offset'); 1373 if( headerDefinedOffset == 'full' ) { 1374 __core.getVars.headerWrapOffset = __core.viewport().height; 1375 var headerOffsetNegative = elHeader.getAttribute('data-sticky-offset-negative'); 1376 if( typeof headerOffsetNegative !== 'undefined' ) { 1377 if( headerOffsetNegative == 'auto' ) { 1378 __core.getVars.headerWrapOffset = __core.getVars.headerWrapOffset - elHeader.offsetHeight - 1; 1379 } else { 1380 __core.getVars.headerWrapOffset = __core.getVars.headerWrapOffset - Number(headerOffsetNegative) - 1; 1381 } 1382 } 1383 } else { 1384 __core.getVars.headerWrapOffset = Number(headerDefinedOffset); 1385 } 1386 } 1387 }; 1388 1389 var _sticky = function(stickyOffset) { 1390 if( !__core.getVars.elBody.classList.contains('is-expanded-menu') && __core.getVars.mobileSticky != 'true' ) { 1391 return true; 1392 } 1393 1394 if( window.scrollY > stickyOffset ) { 1395 if( !__core.getVars.elBody.classList.contains('side-header') ) { 1396 __core.getVars.elHeader.classList.add('sticky-header'); 1397 _changeMenuClass('sticky'); 1398 1399 if( __core.getVars.elBody.classList.contains('is-expanded-menu') && __core.getVars.stickyShrink == 'true' && !__core.getVars.elHeader.classList.contains('no-sticky') ) { 1400 if( ( window.scrollY - stickyOffset ) > Number( __core.getVars.stickyShrinkOffset ) ) { 1401 __core.getVars.elHeader.classList.add('sticky-header-shrink'); 1402 } else { 1403 __core.getVars.elHeader.classList.remove('sticky-header-shrink'); 1404 } 1405 } 1406 } 1407 } else { 1408 _removeSticky(); 1409 if( __core.getVars.mobileSticky == 'true' ) { 1410 _changeMenuClass('responsive'); 1411 } 1412 } 1413 }; 1414 1415 var _removeSticky = function() { 1416 __core.getVars.elHeader.className = __core.getVars.headerClasses; 1417 __core.getVars.elHeader.classList.remove('sticky-header', 'sticky-header-shrink'); 1418 1419 if( __core.getVars.elHeaderWrap ) { 1420 __core.getVars.elHeaderWrap.className = __core.getVars.headerWrapClasses; 1421 } 1422 if( !__core.getVars.elHeaderWrap?.classList.contains('force-not-dark') ) { 1423 __core.getVars.elHeaderWrap?.classList.remove('not-dark'); 1424 } 1425 1426 __base.sliderMenuClass(); 1427 }; 1428 1429 var _changeMenuClass = function(type) { 1430 var newClassesArray = ''; 1431 1432 if( 'responsive' == type ) { 1433 if( __core.getVars.elBody.classList.contains('is-expanded-menu') ){ 1434 return true; 1435 } 1436 1437 if( __core.getVars.mobileHeaderClasses ) { 1438 newClassesArray = __core.getVars.mobileHeaderClasses.split(/ +/); 1439 } 1440 } else { 1441 if( !__core.getVars.elHeader.classList.contains('sticky-header') ){ 1442 return true; 1443 } 1444 1445 if( __core.getVars.stickyHeaderClasses ) { 1446 newClassesArray = __core.getVars.stickyHeaderClasses.split(/ +/); 1447 } 1448 } 1449 1450 var noOfNewClasses = newClassesArray.length; 1451 1452 if( noOfNewClasses > 0 ) { 1453 var i = 0; 1454 for( i=0; i<noOfNewClasses; i++ ) { 1455 if( newClassesArray[i] == 'not-dark' ) { 1456 __core.getVars.elHeader.classList.remove('dark'); 1457 if( !__core.getVars.elHeaderWrap?.classList.contains('.not-dark') ) { 1458 __core.getVars.elHeaderWrap?.classList.add('not-dark'); 1459 } 1460 }
1460 else if( newClassesArray[i] == 'dark' ) { 1461 __core.getVars.elHeaderWrap?.classList.remove('not-dark force-not-dark'); 1462 if( !__core.getVars.elHeader.classList.contains( newClassesArray[i] ) ) { 1463 __core.getVars.elHeader.classList.add( newClassesArray[i] ); 1464 } 1465 } else if( !__core.getVars.elHeader.classList.contains( newClassesArray[i] ) ) { 1466 __core.getVars.elHeader.classList.add( newClassesArray[i] ); 1467 } 1468 } 1469 } 1470 1471 __base.setBSTheme(); 1472 }; 1473 1474 var _includeHeader = function() { 1475 var elHeaderInc = document.querySelector('.include-header'); 1476 var elHeader = __core.getVars.elHeader; 1477 __core.getVars.headerHeight = elHeader.offsetHeight; 1478 1479 if( !elHeaderInc ) { 1480 return true; 1481 } 1482 1483 elHeaderInc.style.marginTop = ''; 1484 1485 if( !__core.getVars.elBody.classList.contains('is-expanded-menu') ) { 1486 return true; 1487 } 1488 1489 if( elHeader.classList.contains('floating-header') || elHeaderInc.classList.contains('include-topbar') ) { 1490 __core.getVars.headerHeight = elHeader.offsetHeight + __core.offset(elHeader).top; 1491 } 1492 1493 elHeaderInc.style.marginTop = (__core.getVars.headerHeight * -1) + 'px'; 1494 __modules.sliderParallax(); 1495 } 1496 1497 var _sideHeader = function() { 1498 var headerTrigger = document.getElementById("header-trigger"); 1499 if( headerTrigger ) { 1500 headerTrigger.onclick = function(e) { 1501 e.preventDefault(); 1502 __core.getVars.elBody.classList.contains('open-header') && __core.getVars.elBody.classList.toggle("side-header-open"); 1503 }; 1504 } 1505 }; 1506 1507 return { 1508 init: function(selector) { 1509 selector = __core.getSelector( selector, false ); 1510 if( selector.length < 1 ){ 1511 return true; 1512 } 1513 1514 var elHeader = __core.getVars.elHeader; 1515 var isSticky = elHeader.classList.contains('no-sticky') ? false : true; 1516 var headerWrapClone = elHeader.querySelector('.header-wrap-clone'); 1517 1518 __core.getVars.stickyHeaderClasses = elHeader.getAttribute('data-sticky-class'); 1519 __core.getVars.mobileHeaderClasses = elHeader.getAttribute('data-responsive-class'); 1520 __core.getVars.stickyShrink = elHeader.getAttribute('data-sticky-shrink') || 'true'; 1521 __core.getVars.stickyShrinkOffset = elHeader.getAttribute('data-sticky-shrink-offset') || 300; 1522 __core.getVars.mobileSticky = elHeader.getAttribute('data-mobile-sticky') || 'false'; 1523 __core.getVars.headerHeight = elHeader.offsetHeight; 1524 1525 if( !headerWrapClone ) { 1526 headerWrapClone = document.createElement('div'); 1527 headerWrapClone.classList = 'header-wrap-clone'; 1528 1529 __core.getVars.elHeaderWrap?.parentNode.insertBefore( headerWrapClone, __core.getVars.elHeaderWrap?.nextSibling); 1530 headerWrapClone = elHeader.querySelector('.header-wrap-clone'); 1531 } 1532 1533 if( isSticky ) { 1534 setTimeout( function() { 1535 _offset(); 1536 _sticky( __core.getVars.headerWrapOffset ); 1537 _changeMenuClass('sticky'); 1538 }, 500); 1539 1540 window.addEventListener('scroll', function(){ 1541 _sticky( __core.getVars.headerWrapOffset ); 1542 }, {passive:true}); 1543 } 1544 1545 _changeMenuClass('responsive'); 1546 _includeHeader(); 1547 _sideHeader(); 1548 1549 __core.getVars.resizers.headers = function() { 1550 setTimeout( function() { 1551 _removeSticky(); 1552 if( isSticky ) { 1553 _offset(); 1554 _sticky( __core.getVars.headerWrapOffset ); 1555 _changeMenuClass('sticky'); 1556 } 1557 _changeMenuClass('responsive'); 1558 _includeHeader(); 1559 }, 250); 1560 }; 1561 } 1562 }; 1563 }(), 1564 // Header Functions End 1565 1566 /** 1567 * -------------------------------------------------------------------------- 1568 * Menu Functions Start (Required) 1569 * -------------------------------------------------------------------------- 1570 */ 1571 Menus: function() { 1572 var _init = function() { 1573 __core.getVars.headerWrapHeight = __core.getVars.elHeaderWrap?.offsetHeight; 1574 1575 var onClickMenus = [].slice.call(__core.getVars.elPrimaryMenus).filter( function(elem) { 1576 return elem.matches('.on-click'); 1577 }); 1578 1579 var onClickTopMenus = document.querySelectorAll('.top-links.on-click'); 1580 1581 var onClickMenuCurrent = []; 1582
1583 onClickMenus.forEach( function(pMenu) { 1584 onClickMenuCurrent.push(pMenu.querySelector('.current')); 1585 }); 1586 1587 var onClickTopMenuCurrent = []; 1588 1589 onClickTopMenus.forEach( function(topMenu) { 1590 onClickTopMenuCurrent.push(topMenu.querySelector('.current')); 1591 }); 1592 1593 document.addEventListener('click', function(e) { 1594 if( !e.target.closest('.primary-menu-trigger') && !e.target.closest('.primary-menu') ) { 1595 _reset(); 1596 _functions(); 1597 } 1598 1599 if ( !e.target.closest('.primary-menu.on-click') ) { 1600 onClickMenus.forEach( function(pMenu) { 1601 pMenu.querySelectorAll('.menu-item').forEach( function(item) { 1602 item.classList.remove('current'); 1603 }); 1604 }); 1605 1606 onClickMenuCurrent?.forEach( function(current) { 1607 current?.classList.add('current'); 1608 }); 1609 } 1610 1611 if ( !e.target.closest('.top-links.on-click') ) { 1612 onClickTopMenus.forEach( function(topMenu) { 1613 topMenu.querySelectorAll('.top-links-sub-menu,.top-links-section').forEach( function(item) { 1614 item.classList.remove('d-block'); 1615 }); 1616 }); 1617 1618 onClickTopMenus.forEach( function(topMenu) { 1619 topMenu.querySelectorAll('.top-links-item').forEach( function(item) { 1620 item.classList.remove('current'); 1621 }); 1622 }); 1623 1624 onClickTopMenuCurrent?.forEach( function(current) { 1625 current?.classList.add('current'); 1626 }); 1627 } 1628 }, false); 1629 1630 document.querySelectorAll( '.menu-item' ).forEach(function(el) { 1631 if( el.querySelectorAll('.sub-menu-container').length > 0 ) { 1632 el.classList.add('sub-menu'); 1633 } 1634 1635 if( !el.classList.contains('mega-menu-title') && el.querySelectorAll('.sub-menu-container').length > 0 && el.querySelectorAll('.sub-menu-trigger').length < 1 ) { 1636 var subMenuTrigger = document.createElement('button'); 1637 subMenuTrigger.classList = 'sub-menu-trigger fa-solid fa-chevron-right'; 1638 subMenuTrigger.innerHTML = '<span class="visually-hidden">Open Sub-Menu</span>'; 1639 el.append( subMenuTrigger ); 1640 } 1641 }); 1642 }; 1643 1644 var _reset = function() { 1645 var body = __core.getVars.elBody, 1646 subMenusSel = '.mega-menu-content, .sub-menu-container', 1647 menuItemSel = '.menu-item'; 1648 1649 document.querySelectorAll('.primary-menu-trigger').forEach( function(el) { 1650 el.classList.remove('primary-menu-trigger-active'); 1651 }); 1652 1653 __core.getVars.elPrimaryMenus.forEach( function(el) { 1654 if( !body.classList.contains('is-expanded-menu') ) { 1655 el.querySelector('.menu-container')?.classList.remove('d-block'); 1656 } else { 1657 el.querySelector('.menu-container')?.classList.remove('d-block', 'd-none'); 1658 1659 el.querySelectorAll(subMenusSel)?.forEach( function(item) { 1660 item.classList.remove('d-none'); 1661 }); 1662 1663 document.querySelectorAll('.menu-container:not(.mobile-primary-menu)').forEach( function(el) { 1664 el.style.display = ''; 1665 }); 1666 1667 __core.getVars.elPrimaryMenus.forEach( function(el) { 1668 el.querySelectorAll('.mobile-primary-menu')?.forEach( function(elem) { 1669 elem.classList.remove('d-block'); 1670 }); 1671 }); 1672 } 1673 1674 el.querySelectorAll(subMenusSel)?.forEach( function(item) { 1675 item.classList.remove('d-block'); 1676 }); 1677 1678 el.classList.remove('primary-menu-active'); 1679 1680 var classes = body.className.split(" ").filter( function(classText) { 1681 return !classText.startsWith('primary-menu-open'); 1682 }); 1683 1684 body.className = classes.join(" ").trim(); 1685 }); 1686 }; 1687 1688 var _withIcon = function() { 1689 document.querySelectorAll('.mega-menu-content, .sub-menu-container').forEach( function(subMenu) { 1690 subMenu.querySelectorAll('.menu-item').forEach( function(item) { 1691 var link = item.querySelector('.menu-link'); 1692 link?.querySelector('i') && link.querySelector('span')?.classList.add('menu-subtitle-icon-offset'); 1693 }); 1694 }); 1695 }; 1696 1697 var _arrows = function() { 1698 var addArrow = function(menuItemDiv) { 1699 if( menuItemDiv && !menuItemDiv.querySelector('.sub-menu-indicator') ) { 1700 var arrow = document.createElement("i");
1701 arrow.classList.add('sub-menu-indicator'); 1702 1703 var customArrow = menuItemDiv.closest('.primary-menu')?.getAttribute('data-arrow-class') || 'fa-solid fa-caret-down'; 1704 customArrow && customArrow.split(" ").forEach( function(className) { 1705 arrow.classList.add(className); 1706 }); 1707 1708 menuItemDiv.append(arrow); 1709 } 1710 }; 1711 1712 // Arrows for Top Links Items 1713 document.querySelectorAll( '.top-links-item' ).forEach( function(menuItem) { 1714 var menuItemDiv = menuItem.querySelector(':scope > a'); 1715 menuItem.querySelector(':scope > .top-links-sub-menu, :scope > .top-links-section') && addArrow( menuItemDiv ); 1716 }); 1717 1718 // Arrows for Primary Menu Items 1719 document.querySelectorAll( '.menu-item' ).forEach( function(menuItem) { 1720 var menuItemDiv = menuItem.querySelector(':scope > .menu-link > div'); 1721 ( !menuItem.classList.contains('mega-menu-title') && menuItem.querySelector(':scope > .sub-menu-container, :scope > .mega-menu-content') ) && addArrow( menuItemDiv ); 1722 }); 1723 1724 // Arrows for Page Menu Items 1725 document.querySelectorAll( '.page-menu-item' ).forEach( function(menuItem) { 1726 var menuItemDiv = menuItem.querySelector(':scope > a > div'); 1727 menuItem.querySelector(':scope > .page-menu-sub-menu') && addArrow( menuItemDiv ); 1728 }); 1729 }; 1730 1731 var _invert = function(subMenuEl) { 1732 var subMenus = subMenuEl || document.querySelectorAll( '.mega-menu-content, .sub-menu-container, .top-links-section' ); 1733 1734 // if( !__core.getVars.elBody.classList.contains('is-expanded-menu') ) { 1735 // return false; 1736 // } 1737 1738 if( subMenus.length < 1 ) { 1739 return false; 1740 } 1741 1742 var primaryMenus; 1743 1744 subMenus.forEach( function(el) { 1745 primaryMenus = el.closest('.header-row')?.querySelectorAll('.primary-menu'); 1746 el.classList.remove('menu-pos-invert'); 1747 var elChildren = el.querySelectorAll(':scope > *'); 1748 1749 elChildren.forEach( function(elChild) { 1750 elChild.style.display = 'block'; 1751 }); 1752 el.style.display = 'block'; 1753 1754 var viewportOffset = el.getBoundingClientRect(); 1755 1756 if( el.closest('.mega-menu-small') ) { 1757 var outside = __core.viewport().width - (viewportOffset.left + viewportOffset.width); 1758 if( outside < 0 ) { 1759 el.style.left = outside + 'px'; 1760 } 1761 } 1762 1763 if( __core.getVars.elBody.classList.contains('rtl') ) { 1764 if( viewportOffset.left < 0 ) { 1765 el.classList.add('menu-pos-invert'); 1766 } 1767 } 1768 1769 if( __core.viewport().width - (viewportOffset.left + viewportOffset.width) < 0 ) { 1770 el.classList.add('menu-pos-invert'); 1771 } 1772 }); 1773 1774 subMenus.forEach( function(el) { 1775 var elChildren = el.querySelectorAll(':scope > *'); 1776 elChildren.forEach( function(elChild) { 1777 elChild.style.display = ''; 1778 }); 1779 el.style.display = ''; 1780 }); 1781 1782 primaryMenus?.forEach( function(pMenu){ 1783 pMenu.classList.add('primary-menu-init'); 1784 }); 1785 }; 1786 1787 var _hover = function() { 1788 if( !__core.getVars.elBody.classList.contains('is-expanded-menu') ) { 1789 return true; 1790 } 1791 1792 var menuHoverDelay = getComputedStyle(__core.getVars.elHeader).getPropertyValue('--cnvs-primary-menu-submenu-display-speed') || 666; 1793 1794 if( !isNaN(menuHoverDelay.split('ms')[0]) ) { 1795 menuHoverDelay = menuHoverDelay.split('ms')[0]; 1796 } else if( !isNaN(menuHoverDelay.split('s')[0]) ) { 1797 menuHoverDelay = menuHoverDelay.split('s')[0] * 1000; 1798 } 1799 1800 [].slice.call(__core.getVars.elPrimaryMenus).filter( function(elem) { 1801 return !elem.matches('.on-click'); 1802 }
1802).forEach( function(pMenu) { 1803 pMenu.querySelectorAll('.sub-menu').forEach( function(item){ 1804 var _t; 1805 1806 item.addEventListener('mouseenter', function() { 1807 clearTimeout(_t); 1808 item.classList.add('menu-item-hover'); 1809 _invert(item.querySelectorAll('.mega-menu-content, .sub-menu-container')); 1810 }); 1811 1812 item.addEventListener('mouseleave', function() { 1813 _t = setTimeout( function(){ 1814 item.classList.remove('menu-item-hover'); 1815 }, Number(menuHoverDelay)); 1816 }); 1817 }); 1818 }); 1819 }; 1820 1821 var _functions = function() { 1822 var subMenusSel = '.mega-menu-content, .sub-menu-container', 1823 menuItemSel = '.menu-item', 1824 subMenuSel = '.sub-menu', 1825 subMenuTriggerSel = '.sub-menu-trigger', 1826 body = __core.getVars.elBody.classList; 1827 1828 var triggersBtn = document.querySelectorAll( subMenuTriggerSel ); 1829 var triggerLinks = new Array; 1830 1831 triggersBtn.forEach( function(el) { 1832 var triggerLink = el.closest('.menu-item').querySelector('.menu-link[href^="#"]'); 1833 if( triggerLink ) { 1834 triggerLinks.push(triggerLink); 1835 } 1836 }); 1837 1838 var triggers = [].slice.call(triggersBtn).concat([].slice.call(triggerLinks)); 1839 1840 document.querySelectorAll(subMenuTriggerSel).forEach( function(el) { 1841 el.classList.remove('icon-rotate-90') 1842 }); 1843 1844 /** 1845 * Mobile Menu Functionality 1846 */ 1847 if( !body.contains('is-expanded-menu') ) { 1848 // Reset Menus to their Closed State 1849 __core.getVars.elPrimaryMenus.forEach( function(el) { 1850 el.querySelectorAll(subMenusSel).forEach( function(elem) { 1851 elem.classList.add('d-none'); 1852 body.remove("primary-menu-open"); 1853 }) 1854 }); 1855 1856 triggers.forEach( function(trigger) { 1857 trigger.onclick = function(e) { 1858 e.preventDefault(); 1859 1860 var triggerEl = trigger; 1861 1862 if( !trigger.classList.contains('sub-menu-trigger') ) { 1863 triggerEl = trigger.closest(menuItemSel).querySelector(':scope >
1863 ' + subMenuTriggerSel); 1864 } 1865 1866 __core.siblings(triggerEl.closest(menuItemSel)).forEach( function(item) { 1867 item.querySelectorAll(subMenusSel).forEach( function(item) { 1868 item.classList.add('d-none'); 1869 }); 1870 }); 1871 1872 if( triggerEl.closest('.mega-menu-content') ) { 1873 var parentSubMenuContainers = []; 1874 1875 __core.parents(triggerEl, menuItemSel).forEach( function(item) { 1876 parentSubMenuContainers.push(item.querySelector(':scope > ' + subMenusSel)); 1877 }); 1878 1879 [].slice.call(triggerEl.closest('.mega-menu-content').querySelectorAll(subMenusSel)).filter( function(item) { 1880 return !parentSubMenuContainers.includes(item); 1881 }).forEach( function(item) { 1882 item.classList.add('d-none'); 1883 }); 1884 } 1885 1886 _triggerState(triggerEl, menuItemSel, subMenusSel, subMenuTriggerSel, 'd-none'); 1887 }; 1888 }); 1889 } 1890 1891 /** 1892 * On-Click Menu Functionality 1893 */ 1894 if( body.contains('is-expanded-menu') ) { 1895 if( body.contains('side-header') || body.contains('overlay-menu') ) { 1896 __core.getVars.elPrimaryMenus.forEach( function(pMenu) { 1897 pMenu.classList.add('on-click'); 1898 pMenu.querySelectorAll(subMenuTriggerSel).forEach( function(item) { 1899 item.style.zIndex = '-1'; 1900 }); 1901 }); 1902 } 1903 1904 [].slice.call(__core.getVars.elPrimaryMenus).filter( function(elem) { 1905 return elem.matches('.on-click'); 1906 }
1906).forEach( function(pMenu) { 1907 var menuItemSubs = __core.has( pMenu.querySelectorAll(menuItemSel), subMenuTriggerSel ); 1908 1909 menuItemSubs.forEach( function(el) { 1910 var triggerEl = el.querySelector(':scope > .menu-link'); 1911 1912 triggerEl.onclick = function(e) { 1913 e.preventDefault(); 1914 1915 __core.siblings(triggerEl.closest(menuItemSel)).forEach( function(item) { 1916 item.querySelectorAll(subMenusSel).forEach( function(item) { 1917 item.classList.remove('d-block'); 1918 }); 1919 }); 1920 1921 if( triggerEl.closest('.mega-menu-content') ) { 1922 var parentSubMenuContainers = []; 1923 1924 __core.parents(triggerEl, menuItemSel).forEach( function(item) { 1925 parentSubMenuContainers.push(item.querySelector(':scope > ' + subMenusSel)); 1926 }); 1927 1928 [].slice.call(triggerEl.closest('.mega-menu-content').querySelectorAll(subMenusSel)).filter( function(item) { 1929 return !parentSubMenuContainers.includes(item); 1930 }).forEach( function(item) { 1931 item.classList.remove('d-block'); 1932 }); 1933 } 1934 1935 _triggerState(triggerEl, menuItemSel, subMenusSel, subMenuTriggerSel, 'd-block'); 1936 }; 1937 }); 1938 }); 1939 } 1940 1941 /** 1942 * Top-Links On-Click Functionality 1943 */ 1944 document.querySelectorAll('.top-links').forEach( function(item) { 1945 if( item.classList.contains('on-click') || !body.contains('device-up-lg') ) { 1946 item.querySelectorAll('.top-links-item').forEach( function(menuItem) { 1947 if( menuItem.querySelectorAll('.top-links-sub-menu,.top-links-section').length > 0 ) { 1948 var triggerEl = menuItem.querySelector(':scope > a'); 1949 1950 triggerEl.onclick = function(e) { 1951 e.preventDefault(); 1952 1953 __core.siblings(menuItem).forEach( function(item) { 1954 item.querySelectorAll('.top-links-sub-menu, .top-links-section').forEach( function(item) { 1955 item.classList.remove('d-block'); 1956 }); 1957 }); 1958 menuItem.querySelector(':scope > .top-links-sub-menu, :scope > .top-links-section').classList.toggle('d-block'); 1959 __core.siblings(menuItem).forEach( function(item) { 1960 item.classList.remove('current'); 1961 }); 1962 menuItem.classList.toggle('current'); 1963 }; 1964 } 1965 }) 1966 } 1967 }); 1968 1969 _invert( document.querySelectorAll('.top-links-section') ); 1970 1971 }; 1972 1973 var _triggerState = function(triggerEl, menuItemSel, subMenusSel, subMenuTriggerSel, classCheck) { 1974 triggerEl.closest('.menu-container').querySelectorAll(subMenuTriggerSel).forEach( function(el) { 1975 el.classList.remove('icon-rotate-90'); 1976 }); 1977 1978 var triggerredSubMenus = triggerEl.closest(menuItemSel).querySelector( ':scope > ' + subMenusSel ); 1979 var childSubMenus = triggerEl.closest(menuItemSel).querySelectorAll( subMenusSel ); 1980 1981 if( classCheck == 'd-none' ) { 1982 if( triggerredSubMenus.classList.contains('d-none') ) { 1983 triggerredSubMenus.classList.remove('d-none'); 1984 } else { 1985 childSubMenus.forEach( function(item) { 1986 item.classList.add('d-none'); 1987 }); 1988 } 1989 } else { 1990 if( triggerredSubMenus.classList.contains('d-block') ) { 1991 childSubMenus.forEach( function(item) { 1992 item.classList.remove('d-block'); 1993 }); 1994 } else { 1995 triggerredSubMenus.classList.add('d-block'); 1996 } 1997 } 1998 1999 _current(triggerEl, menuItemSel, subMenusSel, subMenuTriggerSel); 2000 } 2001 2002 var _current = function(triggerEl, menuItemSel, subMenusSel, subMenuTriggerSel) { 2003 [].slice.call(triggerEl.closest('.menu-container').querySelectorAll(menuItemSel)).forEach( function(item) { 2004 item.classList.remove('current'); 2005 }); 2006 2007 var setCurrent = function(item, menuItemSel, subMenusSel) { 2008 if( !__core.isHidden(item.closest(menuItemSel).querySelector(':scope > ' + subMenusSel)) ) { 2009 item.closest(menuItemSel).classList.add('current'); 2010 item.closest(menuItemSel).querySelector(':scope >
2010 ' + subMenuTriggerSel)?.classList.add('icon-rotate-90'); 2011 } else { 2012 item.closest(menuItemSel).classList.remove('current'); 2013 item.closest(menuItemSel).querySelector(':scope > ' + subMenuTriggerSel)?.classList.remove('icon-rotate-90'); 2014 } 2015 }; 2016 2017 setCurrent(triggerEl, menuItemSel, subMenusSel, subMenuTriggerSel); 2018 __core.parents(triggerEl, menuItemSel).forEach( function(item) { 2019 setCurrent(item, menuItemSel, subMenusSel, subMenuTriggerSel); 2020 }); 2021 }; 2022 2023 var _trigger = function() { 2024 var body = __core.getVars.elBody.classList; 2025 2026 document.querySelectorAll('.primary-menu-trigger').forEach( function(menuTrigger) { 2027 menuTrigger.onclick = function(e) { 2028 e.preventDefault(); 2029 2030 var elTarget = menuTrigger.getAttribute( 'data-target' ) || '*'; 2031 2032 if( __core.filtered( __core.getVars.elPrimaryMenus, elTarget ).length < 1 ) { 2033 return; 2034 } 2035 2036 if( !body.contains('is-expanded-menu') ) { 2037 __core.getVars.elPrimaryMenus.forEach( function(el) { 2038 if( el.querySelectorAll('.mobile-primary-menu').length > 0 ) { 2039 el.matches(elTarget) && el.querySelectorAll('.mobile-primary-menu').forEach( function(elem) { 2040 elem.classList.toggle('d-block'); 2041 }); 2042 } else { 2043 el.matches(elTarget) && el.querySelectorAll('.menu-container').forEach( function(elem) { 2044 elem.classList.toggle('d-block'); 2045 }); 2046 } 2047 }); 2048 } 2049 2050 menuTrigger.classList.toggle('primary-menu-trigger-active'); 2051 __core.getVars.elPrimaryMenus.forEach( function(elem) { 2052 elem.matches(elTarget) && elem.classList.toggle('primary-menu-active'); 2053 }); 2054 2055 body.toggle('primary-menu-open'); 2056 2057 if( elTarget != '*' ) { 2058 body.toggle('primary-menu-open-' + elTarget.replace(/[^a-zA-Z0-9-]/g, "")); 2059 } else { 2060 body.toggle('primary-menu-open-all'); 2061 } 2062 }; 2063 }); 2064 }; 2065 2066 var _fullWidth = function() { 2067 var body = __core.getVars.elBody.classList; 2068 2069 if( !body.contains('is-expanded-menu') ) { 2070 document.querySelectorAll('.mega-menu-content, .top-search-form').forEach( function(el) { 2071 el.style.width = ''; 2072 }); 2073 return true; 2074 } 2075 2076 var headerWidth = document.querySelector('.mega-menu:not(.mega-menu-full):not(.mega-menu-small) .mega-menu-content')?.closest('.header-row').offsetWidth; 2077 2078 if( __core.getVars.elHeader.querySelectorAll('.container-fullwidth').length > 0 ) { 2079 document.querySelectorAll('.mega-menu:not(.mega-menu-full):not(.mega-menu-small) .mega-menu-content').forEach( function(el) { 2080 el.style.width = headerWidth + 'px'; 2081 }); 2082 } 2083 2084 document.querySelectorAll('.mega-menu:not(.mega-menu-full):not(.mega-menu-small) .mega-menu-content, .top-search-form').forEach( function(el) { 2085 el.style.width = headerWidth + 'px'; 2086 }); 2087 2088 if( __core.getVars.elHeader.classList.contains('full-header') ) { 2089 document.querySelectorAll('.mega-menu:not(.mega-menu-full):not(.mega-menu-small) .mega-menu-content').forEach( function(el) { 2090 el.style.width = headerWidth + 'px'; 2091 }); 2092 } 2093 2094 if( __core.getVars.elHeader.classList.contains('floating-header') ) { 2095 var floatingHeaderPadding = getComputedStyle(document.querySelector('#header')).getPropertyValue('--cnvs-header-floating-padding'); 2096 document.querySelectorAll('.mega-menu:not(.mega-menu-full):not(.mega-menu-small) .mega-menu-content').forEach( function(el) { 2097 el.style.width = (headerWidth + (Number(floatingHeaderPadding.split('px')[0]) *2)) + 'px'; 2098 }); 2099 } 2100 }; 2101 2102 return { 2103 init: function(selector) { 2104 selector = __core.getSelector( selector, false ); 2105 if( selector.length < 1 ){ 2106 return true; 2107 } 2108 2109 _init(); 2110 _reset(); 2111 _withIcon(); 2112 _arrows(); 2113 _invert(); 2114 _hover(); 2115 _functions(); 2116 _trigger(); 2117 _fullWidth(); 2118 2119 var windowWidth = __core.viewport().width; 2120 __core.getVars.resizers.menus = function() { 2121 if( windowWidth != __core.viewport().width ) { 2122 __base.menus(); 2123 } 2124 }; 2125 2126 __core.getVars.recalls.menureset = function() { 2127 _reset(); 2128 _functions(); 2129 }; 2130 } 2131 }; 2132 }(), 2133 // Menu Functions End 2134 2135 /** 2136 * -------------------------------------------------------------------------- 2137 * Page-Menu Functions Start 2138 * -------------------------------------------------------------------------- 2139 */ 2140 PageMenu: function() { 2141 var _sticky = function(stickyOffset) { 2142 var pageMenu = __core.getVars.elPageMenu; 2143 2144 if( window.scrollY > stickyOffset ) { 2145 if( __core.getVars.elBody.classList.contains('device-up-lg') ) { 2146 pageMenu.classList.add('sticky-page-menu'); 2147 } else { 2148 if( pageMenu.getAttribute('data-mobile-sticky') == 'true' ) { 2149 pageMenu.classList.add('sticky-page-menu'); 2150 } 2151 } 2152 } else { 2153 pageMenu.classList.remove('sticky-page-menu'); 2154 } 2155 }; 2156 2157 return { 2158 init: function(selector) { 2159 selector = __core.getSelector( selector, false ); 2160 if( selector.length < 1 ){ 2161 return true; 2162 } 2163 2164 var pageMenu = __core.getVars.elPageMenu, 2165 pageMenuWrap = pageMenu.querySelector('#page-menu-wrap'), 2166 pageMenuClone = pageMenu.querySelector('.page-menu-wrap-clone'); 2167 2168 if( !pageMenuClone ) { 2169 pageMenuClone = document.createElement('div'); 2170 pageMenuClone.classList = 'page-menu-wrap-clone'; 2171 2172 pageMenuWrap.parentNode.insertBefore( pageMenuClone, pageMenuWrap.nextSibling); 2173 pageMenuClone = pageMenu.querySelector('.page-menu-wrap-clone'); 2174 } 2175 2176 pageMenuClone.style.height = pageMenu.querySelector('#page-menu-wrap').offsetHeight + 'px'; 2177 2178 pageMenu.querySelector('#page-menu-trigger').onclick = function(e) { 2179 e.preventDefault(); 2180 2181 __core.getVars.elBody.classList.remove('top-search-open'); 2182 pageMenu.classList.toggle('page-menu-open'); 2183 }; 2184 2185 pageMenu.querySelector('nav').onclick = function(e) { 2186 __core.getVars.elBody.classList.remove('top-search-open'); 2187 document.getElementById('top-cart').classList.remove('top-cart-open'); 2188 }; 2189 2190 document.addEventListener('click', function(e) { 2191 if( !e.target.closest('#page-menu') ) { 2192 pageMenu.classList.remove('page-menu-open'); 2193 } 2194 }, false); 2195 2196 if( pageMenu.classList.contains('no-sticky') || pageMenu.classList.contains('dots-menu') ) { 2197 return true; 2198 } 2199 2200 var headerHeight; 2201 2202 if( __core.getVars.elHeader.classList.contains('no-sticky') ) { 2203 headerHeight = 0; 2204 } else if( __core.getVars.elHeader.getAttribute('data-sticky-shrink') == 'false' ) { 2205 headerHeight = getComputedStyle(__core.getVars.elHeader).getPropertyValue('--cnvs-header-height').split('px')[0]; 2206 } else { 2207 headerHeight = getComputedStyle(__core.getVars.elHeader).getPropertyValue('--cnvs-header-height-shrink').split('px')[0]; 2208 } 2209 2210 pageMenu.style.setProperty("--cnvs-page-submenu-sticky-offset", headerHeight+'px'); 2211 2212 setTimeout(function() { 2213 __core.getVars.pageMenuOffset = __core.offset(pageMenu).top - headerHeight; 2214 _sticky( __core.getVars.pageMenuOffset ); 2215 }, 500); 2216 2217 window.addEventListener('scroll', function(){ 2218 _sticky( __core.getVars.pageMenuOffset ); 2219 }, {passive:true}); 2220 2221 __core.getVars.resizers.pagemenu = function() { 2222 setTimeout( function() { 2223 __core.getVars.pageMenuOffset = __core.offset(pageMenu).top - headerHeight; 2224 _sticky( __core.getVars.pageMenuOffset ); 2225 }, 250); 2226 }; 2227 } 2228 }; 2229 }(), 2230 // Page-Menu Functions End 2231 2232 /** 2233 * -------------------------------------------------------------------------- 2234 * SliderDimension Functions Start (Required if using Sliders) 2235 * -------------------------------------------------------------------------- 2236 */ 2237 SliderDimensions: function() { 2238 return { 2239 init: function(selector) { 2240 selector = __core.getSelector( selector, false ); 2241 if( selector.length < 1 ){ 2242 return true; 2243 } 2244 2245 var slider = document.querySelector('.slider-element'), 2246 sliderParallaxEl = document.querySelector('.slider-parallax'), 2247 body = __core.getVars.elBody, 2248 parallaxElHeight = sliderParallaxEl?.offsetHeight, 2249 parallaxElWidth = sliderParallaxEl?.offsetWidth, 2250 slInner = sliderParallaxEl?.querySelector('.slider-inner'), 2251 slSwiperW = slider.querySelector('.swiper-wrapper'), 2252 slSwiperS = slider.querySelector('.swiper-slide'), 2253 slFlexHeight = slider.classList.contains('h-auto') || slider.classList.contains('min-vh-0'); 2254 2255 if( body.classList.contains('device-up-lg') ) { 2256 setTimeout(function() { 2257 if( slInner ) { 2258 slInner.style.height = parallaxElHeight + 'px'; 2259 } 2260 if( slFlexHeight ) { 2261 parallaxElHeight = slider.querySelector('.slider-inner')?.querySelector('*').offsetHeight; 2262 slider.style.height = parallaxElHeight + 'px'; 2263 if( slInner ) { 2264 slInner.style.height = parallaxElHeight + 'px'; 2265 } 2266 } 2267 }, 500); 2268 2269 if( slFlexHeight && slSwiperS ) { 2270 var slSwiperFC = slSwiperS.querySelector('*'); 2271 if( slSwiperFC.classList.contains('container') || slSwiperFC.classList.contains('container-fluid') ) {
2272 slSwiperFC = slSwiperFC.querySelector('*'); 2273 } 2274 if( slSwiperFC.offsetHeight > slSwiperW.offsetHeight ) { 2275 slSwiperW.style.height = 'auto'; 2276 } 2277 } 2278 2279 if( body.classList.contains('side-header') && slInner ) { 2280 slInner.style.width = parallaxElWidth + 'px'; 2281 } 2282 2283 if( !body.classList.contains('stretched') ) { 2284 parallaxElWidth = __core.getVars.elWrapper.offsetWidth; 2285 if( slInner ) { 2286 slInner.style.width = parallaxElWidth + 'px'; 2287 } 2288 } 2289 } else { 2290 if( slSwiperW ) { 2291 slSwiperW.style.height = ''; 2292 } 2293 2294 if( sliderParallaxEl ) { 2295 sliderParallaxEl.style.height = ''; 2296 } 2297 2298 if( slInner ) { 2299 slInner.style.width = ''; 2300 slInner.style.height = ''; 2301 } 2302 } 2303 2304 __core.getVars.resizers.sliderdimensions = function() { 2305 __base.sliderDimensions(); 2306 }; 2307 } 2308 }; 2309 }(), 2310 // SliderDimension Functions End 2311 2312 /** 2313 * -------------------------------------------------------------------------- 2314 * SliderMenuClass Functions Start (Required if using Sliders with Transparent Headers) 2315 * -------------------------------------------------------------------------- 2316 */ 2317 SliderMenuClass: function() { 2318 var _swiper = function() { 2319 if( !__core.getVars.elHeader.classList.contains('ignore-slider') && ( __core.getVars.elBody.classList.contains('is-expanded-menu') || ( __core.getVars.elHeader.classList.contains('transparent-header-responsive') && !__core.getVars.elBody.classList.contains('primary-menu-open') ) ) ) { 2320 var activeSlide = __core.getVars.elSlider.querySelector('.swiper-slide-active'); 2321 _schemeChanger(activeSlide); 2322 } 2323 }; 2324 2325 var _revolution = function() { 2326 if( !__core.getVars.elHeader.classList.contains('ignore-slider') && ( __core.getVars.elBody.classList.contains('is-expanded-menu') || ( __core.getVars.elHeader.classList.contains('transparent-header-responsive') && !__core.getVars.elBody.classList.contains('primary-menu-open') ) ) ) { 2327 var activeSlide = __core.getVars.elSlider.querySelector('.active-revslide'); 2328 _schemeChanger(activeSlide); 2329 } 2330 }; 2331 2332 var _schemeChanger = function(activeSlide) { 2333 if( !activeSlide ) { 2334 return; 2335 } 2336 2337 var darkExists = false, 2338 oldClassesArray, 2339 noOfOldClasses; 2340 2341 if( activeSlide.classList.contains('dark') ){ 2342 if( __core.getVars.headerClasses ) { 2343 oldClassesArray = __core.getVars.headerClasses; 2344 } else { 2345 oldClassesArray = ''; 2346 } 2347 2348 noOfOldClasses = oldClassesArray.length; 2349 2350 if( noOfOldClasses > 0 ) { 2351 for( var i=0; i<noOfOldClasses; i++ ) { 2352 if( oldClassesArray[i] == 'dark' ) { 2353 darkExists = true; 2354 break; 2355 } 2356 } 2357 } 2358 2359 var headerToChange = document.querySelector('#header.transparent-header:not(.sticky-header,.semi-transparent,.floating-header)'); 2360 if( headerToChange ) { 2361 headerToChange.classList.add('dark'); 2362 } 2363 2364 if( !darkExists ) { 2365 var headerToChange = document.querySelector('#header.transparent-header.sticky-header,#header.transparent-header.semi-transparent.sticky-header,#header.transparent-header.floating-header.sticky-header'); 2366 if( headerToChange ) { 2367 headerToChange.classList.remove('dark'); 2368 } 2369 } 2370 __core.getVars.elHeaderWrap.classList.remove('not-dark'); 2371 } else { 2372 if( __core.getVars.elBody.classList.contains('dark') ) { 2373 activeSlide.classList.add('not-dark'); 2374 document.querySelector('#header.transparent-header:not(.semi-transparent,.floating-header)').classList.remove('dark'); 2375 document.querySelector('#header.transparent-header:not(.sticky-header,.semi-transparent,.floating-header)')?.querySelector('#header-wrap').classList.add('not-dark'); 2376 } else { 2377 document.querySelector('#header.transparent-header:not(.semi-transparent,.floating-header)').classList.remove('dark'); 2378 __core.getVars.elHeaderWrap.classList.remove('not-dark'); 2379 } 2380 } 2381 2382 if( __core.getVars.elHeader.classList.contains('sticky-header') ) { 2383 __base.headers(); 2384 } 2385 }; 2386 2387 return { 2388 init: function(selector) { 2389 selector = __core.getSelector( selector, false ); 2390 if( selector.length < 1 ){ 2391 return true; 2392 } 2393 2394 if( !__core.getVars.elBody.classList.contains('is-expanded-menu') ) { 2395 return true; 2396 } 2397 2398 _swiper(); 2399 _revolution(); 2400 __base.setBSTheme(); 2401 2402 __core.getVars.resizers.slidermenuclass = function() { 2403 __base.sliderMenuClass(); 2404 }; 2405 } 2406 }; 2407 }(), 2408 // SliderMenuClass Functions End 2409 2410 /** 2411 * -------------------------------------------------------------------------- 2412 * TopSearch Functions Start (Required) 2413 * -------------------------------------------------------------------------- 2414 */ 2415 TopSearch: function() { 2416 return { 2417 init: function(selector) { 2418 selector = __core.getSelector( selector, false ); 2419 if( selector.length < 1 ){ 2420 return true; 2421 } 2422 2423 var searchForm = document.querySelector('.top-search-form'); 2424 2425 if( !searchForm ) { 2426 return true; 2427 } 2428 2429 searchForm.closest('.header-row')?.classList.add( 'top-search-parent' ); 2430 2431 var topSearchParent = document.querySelector('.top-search-parent'), 2432 timeout; 2433 2434 selector[0].onclick = function(e) { 2435 e.stopPropagation(); 2436 e.preventDefault(); 2437 2438 clearTimeout( timeout ); 2439 2440 __core.getVars.elBody.classList.toggle('top-search-open'); 2441 document.getElementById('top-cart')?.classList.remove('top-cart-open'); 2442 2443 __core.getVars.recalls.menureset(); 2444 2445 if( __core.getVars.elBody.classList.contains('top-search-open') ) { 2446 topSearchParent?.classList.add('position-relative'); 2447 } else { 2448 timeout = setTimeout( function() { 2449 topSearchParent?.classList.remove('position-relative'); 2450 }, 500); 2451 } 2452 2453 __core.getVars.elBody.classList.remove("primary-menu-open"); 2454 __core.getVars.elPageMenu && __core.getVars.elPageMenu.classList.remove('page-menu-open'); 2455 2456 if (__core.getVars.elBody.classList.contains('top-search-open')){ 2457 searchForm.querySelector('input').focus(); 2458 } 2459 }; 2460 2461 document.addEventListener( 'click', function(e) { 2462 if (!e.target.closest('.top-search-form')) { 2463 __core.getVars.elBody.classList.remove('top-search-open'); 2464 timeout = setTimeout( function() { 2465 topSearchParent?.classList.remove('position-relative'); 2466 }, 500); 2467 } 2468 }, false); 2469 } 2470 }; 2471 }(), 2472 // TopSearch Functions End 2473 2474 /** 2475 * -------------------------------------------------------------------------- 2476 * TopCart Functions Start (Required) 2477 * -------------------------------------------------------------------------- 2478 */ 2479 TopCart: function() { 2480 return { 2481 init: function(selector) { 2482 selector = __core.getSelector( selector, false ); 2483 if( selector.length < 1 ){ 2484 return true; 2485 } 2486 2487 if( !document.getElementById('top-cart-trigger') ) { 2488 return false;
2489 } 2490 2491 document.getElementById('top-cart-trigger').onclick = function(e) { 2492 e.stopPropagation(); 2493 e.preventDefault(); 2494 2495 selector[0].classList.toggle('top-cart-open'); 2496 }; 2497 2498 document.addEventListener('click', function(e) { 2499 if( !e.target.closest('#top-cart') ) { 2500 selector[0].classList.remove('top-cart-open'); 2501 } 2502 }, false); 2503 } 2504 }; 2505 }(), 2506 // TopCart Functions End 2507 2508 /** 2509 * -------------------------------------------------------------------------- 2510 * SidePanel Functions Start 2511 * -------------------------------------------------------------------------- 2512 */ 2513 SidePanel: function() { 2514 return { 2515 init: function(selector) { 2516 selector = __core.getSelector( selector, false ); 2517 if( selector.length < 1 ){ 2518 return true; 2519 } 2520 2521 var body = __core.getVars.elBody.classList; 2522 2523 document.addEventListener('click', function(e) { 2524 if( !e.target.closest('#side-panel') && !e.target.closest('.side-panel-trigger') ) { 2525 body.remove('side-panel-open'); 2526 } 2527 }, false); 2528 2529 document.querySelectorAll('.side-panel-trigger').forEach( function(el) { 2530 el.onclick = function(e) { 2531 e.preventDefault(); 2532 2533 body.toggle('side-panel-open'); 2534 if( body.contains('device-touch') && body.contains('side-push-panel') ) { 2535 body.toggle('ohidden'); 2536 } 2537 }; 2538 }); 2539 } 2540 }; 2541 }(), 2542 // SidePanel Functions End 2543 2544 /** 2545 * -------------------------------------------------------------------------- 2546 * AdaptiveColorScheme Functions Start 2547 * -------------------------------------------------------------------------- 2548 */ 2549 AdaptiveColorScheme: function() { 2550 return { 2551 init: function(selector) { 2552 if( __core.getSelector(selector, false, false).length < 1 ){ 2553 return true; 2554 } 2555 2556 __core.initFunction({ class: 'has-plugin-adaptivecolorscheme', event: 'pluginAdaptiveColorSchemeReady' }); 2557 2558 selector = __core.getSelector( selector, false ); 2559 if( selector.length < 1 ){ 2560 return true; 2561 } 2562 2563 var adaptiveEl = document.querySelector('[data-adaptive-light-class],[data-adaptive-dark-class]'); 2564 var adaptLightClass; 2565 var adaptDarkClass; 2566 2567 if( __core.getVars.elBody.contains(adaptiveEl) ) { 2568 adaptLightClass = adaptiveEl.getAttribute( 'data-adaptive-light-class' ); 2569 adaptDarkClass = adaptiveEl.getAttribute( 'data-adaptive-dark-class' ); 2570 } 2571 2572 var adaptClasses = function(dark) { 2573 if( dark ) { 2574 __core.getVars.elBody.classList.add( 'dark' ); 2575 } else { 2576 __core.getVars.elBody.classList.remove('dark'); 2577 } 2578 2579 if( __core.getVars.elBody.contains(adaptiveEl) ) { 2580 if( dark ) { 2581 adaptiveEl.classList.remove( adaptLightClass ); 2582 adaptiveEl.classList.add( adaptDarkClass ); 2583 } else { 2584 adaptiveEl.classList.remove( adaptDarkClass ); 2585 adaptiveEl.classList.add( adaptLightClass ); 2586 } 2587 } 2588 2589 __base.setBSTheme(); 2590 }; 2591 2592 if( window.matchMedia ) { 2593 adaptClasses( window.matchMedia('(prefers-color-scheme: dark)').matches ); 2594 2595 window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', function(e) { 2596 adaptClasses( e.matches ); 2597 }); 2598 } 2599 } 2600 }; 2601 }(), 2602 // AdaptiveColorScheme Functions End 2603 2604 /** 2605 * -------------------------------------------------------------------------- 2606 * PortfolioAjax Functions Start 2607 * -------------------------------------------------------------------------- 2608 */ 2609 PortfolioAjax: function() { 2610 var _newNextPrev = function(portPostId) { 2611 var portNext = _getNext(portPostId); 2612 var portPrev = _getPrev(portPostId); 2613 var portNav = document.getElementById('portfolio-navigation'); 2614 2615 if( !document.getElementById('prev-portfolio') && portPrev ) { 2616 var prevPortItem = document.createElement('a'); 2617 prevPortItem.setAttribute('href', '#'); 2618 prevPortItem.setAttribute('id', 'prev-portfolio'); 2619 prevPortItem.setAttribute('data-id', portPrev); 2620 prevPortItem.innerHTML = '<i class="bi-arrow-left"></i>'; 2621 prevPortItem && portNav?.insertBefore(prevPortItem, document.getElementById('close-portfolio')); 2622 } 2623 2624 if( !document.getElementById('next-portfolio') && portNext ) { 2625 var nextPortItem = document.createElement('a'); 2626 nextPortItem.setAttribute('href', '#'); 2627 nextPortItem.setAttribute('id', 'next-portfolio'); 2628 nextPortItem.setAttribute('data-id', portNext); 2629 nextPortItem.innerHTML = '<i class="bi-arrow-right"></i>'; 2630 nextPortItem && portNav?.insertBefore(nextPortItem, document.getElementById('close-portfolio')); 2631 } 2632 }; 2633 2634 var _load = function(portPostId, prevPostPortId, getIt) { 2635 if( !getIt ) { 2636 getIt = false;
2637 } 2638 2639 var portNext = _getNext(portPostId); 2640 var portPrev = _getPrev(portPostId); 2641 2642 if( getIt == false ) { 2643 _close(); 2644 __core.getVars.elBody.classList.add('portfolio-ajax-loading'); 2645 // __core.getVars.portfolioAjax.loader.classList.add('loader-overlay-display'); 2646 var portfolioDataLoader = document.getElementById(portPostId).getAttribute('data-loader'); 2647 2648 fetch(portfolioDataLoader).then( function(response) { 2649 return response.text(); 2650 }).then( function(html) { 2651 __core.getVars.portfolioAjax.container.innerHTML = html; 2652 2653 var nextPortfolio = document.getElementById('next-portfolio'), 2654 prevPortfolio = document.getElementById('prev-portfolio'); 2655 2656 nextPortfolio?.classList.add('d-none'); 2657 prevPortfolio?.classList.add('d-none'); 2658 2659 if( portNext ) { 2660 nextPortfolio?.setAttribute('data-id', portNext); 2661 nextPortfolio?.classList.remove('d-none'); 2662 } 2663 2664 if( portPrev ) { 2665 prevPortfolio?.setAttribute('data-id', portPrev); 2666 prevPortfolio?.classList.remove('d-none'); 2667 } 2668 2669 _initAjax(portPostId); 2670 _open(); 2671 2672 __core.getVars.portfolioAjax.items.forEach( function(item) { 2673 item.classList.remove('portfolio-active'); 2674 }); 2675 2676 document.getElementById(portPostId).classList.add('portfolio-active'); 2677 }).catch( function(error) { 2678 console.warn('Something went wrong.', error); 2679 }); 2680 } 2681 }; 2682 2683 var _close = function() { 2684 if( __core.getVars.portfolioAjax.wrapper && __core.getVars.portfolioAjax.wrapper.offsetHeight > 32 ) { 2685 __core.getVars.elBody.classList.remove('portfolio-ajax-loading'); 2686 // __core.getVars.portfolioAjax.loader.classList.add('loader-overlay-display'); 2687 __core.getVars.portfolioAjax.wrapper.classList.remove('portfolio-ajax-opened'); 2688 2689 __core.getVars.portfolioAjax.wrapper.querySelector('#portfolio-ajax-single').addEventListener('transitionend', function() { 2690 __core.getVars.portfolioAjax.wrapper.querySelector('#portfolio-ajax-single').remove(); 2691 }); 2692 2693 __core.getVars.portfolioAjax.items.forEach( function(item) { 2694 item.classList.remove('portfolio-active'); 2695 }); 2696 } 2697 }; 2698 2699 var _open = function() { 2700 var countImages = __core.getVars.portfolioAjax.container.querySelectorAll('img').length; 2701 2702 if( countImages < 1 ) { 2703 _display(); 2704 } else { 2705 __core.imagesLoaded(__core.getVars.portfolioAjax.container); 2706 __core.getVars.portfolioAjax.container.addEventListener( 'CanvasImagesLoaded', function() { 2707 _display(); 2708 }); 2709 } 2710 }; 2711 2712 var _display = function() { 2713 __core.getVars.portfolioAjax.container.style.display = 'block'; 2714 __core.getVars.portfolioAjax.wrapper.classList.add('portfolio-ajax-opened'); 2715 __core.getVars.elBody.classList.remove('portfolio-ajax-loading'); 2716 // __core.getVars.portfolioAjax.loader.classList.remove('loader-overlay-display'); 2717 setTimeout( function() { 2718 __core.runContainerModules( __core.getVars.portfolioAjax.wrapper ); 2719 __core.scrollTo((__core.getVars.portfolioAjax.wrapperOffset - __core.getVars.topScrollOffset - 60), false, false); 2720 }, 500); 2721 } 2722 2723 var _getNext = function(portPostId) { 2724 var portNext = false; 2725 var hasNext = document.getElementById(portPostId).nextElementSibling; 2726 2727 if( hasNext ) { 2728 portNext = hasNext.getAttribute('id'); 2729 } 2730 2731 return portNext; 2732 }; 2733 2734 var _getPrev = function(portPostId) { 2735 var portPrev = false; 2736 var hasPrev = document.getElementById(portPostId).previousElementSibling; 2737 2738 if( hasPrev ) { 2739 portPrev = hasPrev.getAttribute('id'); 2740 } 2741 2742 return portPrev; 2743 }; 2744 2745 var _initAjax = function(portPostId) { 2746 __core.getVars.portfolioAjax.prevItem = document.getElementById(portPostId); 2747 2748 _newNextPrev(portPostId); 2749 2750 document.querySelectorAll('#next-portfolio, #prev-portfolio').forEach( function(el) { 2751 el.onclick = function(e) { 2752 e.preventDefault(); 2753 _close(); 2754 2755 var portPostId = el.getAttribute('data-id'); 2756 document.getElementById(portPostId).classList.add('portfolio-active'); 2757 _load(portPostId, __core.getVars.portfolioAjax.prevItem); 2758 }; 2759 }) 2760 2761 document.getElementById('close-portfolio').onclick = function(e) { 2762 e.preventDefault(); 2763 _close(); 2764 }; 2765 }; 2766 2767 return { 2768 init: function(selector) { 2769 if( __core.getSelector(selector, false, false).length < 1 ){ 2770 return true; 2771 } 2772 2773 __core.initFunction({ class: 'has-plugin-ajaxportfolio', event: 'pluginAjaxPortfolioReady' }); 2774 2775 selector = __core.getSelector( selector, false ); 2776 if( selector.length < 1 ){ 2777 return true; 2778 } 2779 2780 __core.getVars.portfolioAjax.items = selector[0].querySelectorAll('.portfolio-item'); 2781 __core.getVars.portfolioAjax.wrapper = document.getElementById('portfolio-ajax-wrap'); 2782 __core.getVars.portfolioAjax.wrapperOffset = __core.offset(__core.getVars.portfolioAjax.wrapper).top; 2783 __core.getVars.portfolioAjax.container = document.getElementById('portfolio-ajax-container'); 2784 __core.getVars.portfolioAjax.loader = document.getElementById('portfolio-ajax-loader'); 2785 __core.getVars.portfolioAjax.prevItem = ''; 2786 2787 selector[0].querySelectorAll('.portfolio-ajax-trigger').forEach( function(el) { 2788 if( !el.querySelector('i:nth-child(2)') ) { 2789 el.innerHTML += '<i class="bi-arrow-repeat icon-spin"></i>'; 2790 } 2791 2792 el.onclick = function(e) { 2793 e.preventDefault(); 2794 2795 var portPostId = e.target.closest('.portfolio-item').getAttribute('id'); 2796 2797 if( !e.target.closest('.portfolio-item').classList.contains('portfolio-active') ) { 2798 _load(portPostId, __core.getVars.portfolioAjax.prevItem); 2799 } 2800 }; 2801 }); 2802 } 2803 }; 2804 }(), 2805 // PortfolioAjax Functions End 2806 2807 /** 2808 * --------------------------------------------------------------------------
2809 * Cursor Functions Start 2810 * -------------------------------------------------------------------------- 2811 */ 2812 Cursor: function() { 2813 return { 2814 init: function(selector) { 2815 __core.initFunction({ class: 'has-plugin-cursor', event: 'pluginCursorReady' }); 2816 2817 var cursor = document.querySelector('.cnvs-cursor'); 2818 var cursorFollower = document.querySelector('.cnvs-cursor-follower'); 2819 var cursorDot = document.querySelector('.cnvs-cursor-dot'); 2820 2821 var addCursorEl = function(selector, parent) { 2822 var el = document.createElement('div'); 2823 el.classList.add(selector.split('.')[1]); 2824 2825 parent.prepend( el ); 2826 return document.querySelector(selector); 2827 }; 2828 2829 if( !cursor ) { 2830 cursor = addCursorEl('.cnvs-cursor', __core.getVars.elWrapper); 2831 } 2832 2833 if( !cursorFollower ) { 2834 cursorFollower = addCursorEl('.cnvs-cursor-follower', cursor); 2835 } 2836 2837 if( !cursorDot ) { 2838 cursorDot = addCursorEl('.cnvs-cursor-dot', cursor); 2839 } 2840 2841 var onMouseMove = function(event) { 2842 cursor.style.transform = "translate3d("+ event.clientX + 'px'+","+event.clientY+'px'+",0px)"; 2843 } 2844 2845 document.addEventListener('mousemove', onMouseMove); 2846 2847 document.querySelectorAll('a,button').forEach( function(el) { 2848 el.addEventListener('mouseenter', function() { 2849 cursor.classList.add('cnvs-cursor-action'); 2850 }); 2851 2852 el.addEventListener('mouseleave', function() { 2853 cursor.classList.remove('cnvs-cursor-action'); 2854 }); 2855 }); 2856 2857 document.querySelectorAll('.cursor-disable').forEach( function(el) { 2858 el.addEventListener('mouseenter', function() { 2859 cursor.classList.add('cnvs-cursor-disabled'); 2860 }); 2861 2862 el.addEventListener('mouseleave', function() { 2863 cursor.classList.remove('cnvs-cursor-disabled'); 2864 }); 2865 }); 2866 } 2867 }; 2868 }(), 2869 // Cursor Functions End 2870 2871 /** 2872 * -------------------------------------------------------------------------- 2873 * Bootstrap Functions Start 2874 * -------------------------------------------------------------------------- 2875 */ 2876 Bootstrap: function() { 2877 return { 2878 init: function(selector) { 2879 __core.isFuncTrue( function() { 2880 return typeof bootstrap !== 'undefined'; 2881 }).then( function(cond) { 2882 if( !cond ) { 2883 return false; 2884 } 2885 2886 __core.initFunction({ class: 'has-plugin-bootstrap', event: 'pluginBootstrapReady' }); 2887 }); 2888 } 2889 }; 2890 }(), 2891 // Bootstrap Functions End 2892 2893 /** 2894 * -------------------------------------------------------------------------- 2895 * ResizeVideos Functions Start 2896 * -------------------------------------------------------------------------- 2897 */ 2898 ResizeVideos: function() { 2899 return { 2900 init: function(selector) { 2901 if( __core.getSelector(selector, false, false).length < 1 ){ 2902 return true; 2903 } 2904 2905 __core.isFuncTrue( function() { 2906 return typeof jQuery !== 'undefined' && jQuery().fitVids; 2907 }).then( function(cond) { 2908 if( !cond ) { 2909 return false; 2910 } 2911 2912 __core.initFunction({ class: 'has-plugin-fitvids', event: 'pluginFitVidsReady' }); 2913 2914 selector = __core.getSelector( selector ); 2915 if( selector.length < 1 ){ 2916 return true; 2917 } 2918 2919 selector.parent().fitVids({ 2920 customSelector: 'iframe[src*="youtube"],iframe[src*="vimeo"],iframe[src*="dailymotion"],iframe[src*="maps.google.com"],iframe[src*="google.com/maps"]', 2921 ignore: '.no-fv' 2922 }); 2923 }); 2924 } 2925 }; 2926 }(), 2927 // ResizeVideos Functions End 2928 2929 /** 2930 * -------------------------------------------------------------------------- 2931 * PageTransition Functions Start 2932 * -------------------------------------------------------------------------- 2933 */ 2934 PageTransition: function() { 2935 return { 2936 init: function(selector) { 2937 var body = __core.getVars.elBody; 2938 2939 __core.initFunction({ class: 'has-plugin-pagetransition', event: 'pluginPageTransitionReady' }); 2940 2941 if( body.classList.contains('no-transition') ) { 2942 return true; 2943 } 2944 2945 if( !body.classList.contains('page-transition') ) { 2946 body.classList.add('page-transition'); 2947 } 2948 2949 window.onpageshow = function(event) { 2950 if(event.persisted) { 2951 window.location.reload(); 2952 } 2953 }; 2954 2955 var pageTransition = document.querySelector('.page-transition-wrap'); 2956 2957 var elAnimIn = body.getAttribute('data-animation-in') || 'fadeIn', 2958 elSpeedIn = body.getAttribute('data-speed-in') || 1000, 2959 elTimeoutActive = false, 2960 elTimeout = body.getAttribute('data-loader-timeout'), 2961 elLoader = body.getAttribute('data-loader'), 2962 elLoaderColor = body.getAttribute('data-loader-color'), 2963 elLoaderHtml = body.getAttribute('data-loader-html'), 2964 elLoaderAppend = '', 2965 elLoaderCSSVar = ''; 2966 2967 if( !elTimeout ) { 2968 elTimeoutActive = false;
2969 elTimeout = false; 2970 } else { 2971 elTimeoutActive = true; 2972 elTimeout = Number(elTimeout); 2973 } 2974 2975 if( elLoaderColor ) { 2976 if( elLoaderColor == 'theme' ) { 2977 elLoaderCSSVar = ' style="--cnvs-loader-color:var(--cnvs-themecolor);"'; 2978 } else { 2979 elLoaderCSSVar = ' style="--cnvs-loader-color:'+elLoaderColor+';"'; 2980 } 2981 } 2982 2983 var elLoaderBefore = '<div class="css3-spinner"'+elLoaderCSSVar+'>', 2984 elLoaderAfter = '</div>'; 2985 2986 if( elLoader == '2' ) { 2987 elLoaderAppend = '<div class="css3-spinner-flipper"></div>'; 2988 } else if( elLoader == '3' ) { 2989 elLoaderAppend = '<div class="css3-spinner-double-bounce1"></div><div class="css3-spinner-double-bounce2"></div>'; 2990 } else if( elLoader == '4' ) { 2991 elLoaderAppend = '<div class="css3-spinner-rect1"></div><div class="css3-spinner-rect2"></div><div class="css3-spinner-rect3"></div><div class="css3-spinner-rect4"></div><div class="css3-spinner-rect5"></div>'; 2992 } else if( elLoader == '5' ) { 2993 elLoaderAppend = '<div class="css3-spinner-cube1"></div><div class="css3-spinner-cube2"></div>'; 2994 } else if( elLoader == '6' ) { 2995 elLoaderAppend = '<div class="css3-spinner-scaler"></div>'; 2996 } else if( elLoader == '7' ) { 2997 elLoaderAppend = '<div class="css3-spinner-grid-pulse"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>'; 2998 } else if( elLoader == '8' ) { 2999 elLoaderAppend = '<div class="css3-spinner-clip-rotate"><div></div></div>'; 3000 } else if( elLoader == '9' ) { 3001 elLoaderAppend = '<div class="css3-spinner-ball-rotate"><div></div><div></div><div></div></div>'; 3002 } else if( elLoader == '10' ) { 3003 elLoaderAppend = '<div class="css3-spinner-zig-zag"><div></div><div></div></div>'; 3004 } else if( elLoader == '11' ) { 3005 elLoaderAppend = '<div class="css3-spinner-triangle-path"><div></div><div></div><div></div></div>'; 3006 } else if( elLoader == '12' ) { 3007 elLoaderAppend = '<div class="css3-spinner-ball-scale-multiple"><div></div><div></div><div></div></div>'; 3008 } else if( elLoader == '13' ) { 3009 elLoaderAppend = '<div class="css3-spinner-ball-pulse-sync"><div></div><div></div><div></div></div>'; 3010 } else if( elLoader == '14' ) { 3011 elLoaderAppend = '<div class="css3-spinner-scale-ripple"><div></div><div></div><div></div></div>'; 3012 } else { 3013 elLoaderAppend = '<div class="css3-spinner-bounce1"></div><div class="css3-spinner-bounce2"></div><div class="css3-spinner-bounce3"></div>'; 3014 } 3015 3016 if( !elLoaderHtml ) { 3017 elLoaderHtml = elLoaderAppend; 3018 } 3019 3020 elLoaderHtml = elLoaderBefore + elLoaderHtml + elLoaderAfter; 3021 3022 if( elAnimIn == 'fadeIn' ) { 3023 __core.getVars.elWrapper.classList.add('op-1'); 3024 } else { 3025 __core.getVars.elWrapper.classList.add('not-animated'); 3026 } 3027 3028 if( !pageTransition ) { 3029 var divPT = document.createElement('div'); 3030 divPT.classList.add('page-transition-wrap'); 3031 divPT.innerHTML = elLoaderHtml; 3032 body.prepend( divPT ); 3033 pageTransition = document.querySelector('.page-transition-wrap'); 3034 } 3035 3036 if( elSpeedIn ) { 3037 __core.getVars.elWrapper.style.setProperty('--cnvs-animate-duration', Number(elSpeedIn)+'ms'); 3038 if( elAnimIn == 'fadeIn' ) { 3039 pageTransition.style.setProperty('--cnvs-animate-duration', Number(elSpeedIn)+'ms'); 3040 } 3041 } 3042 3043 var endPageTransition = function() { 3044 elAnimIn.split(" ").forEach( function(_class) { 3045 pageTransition.classList.remove(_class); 3046 }); 3047 3048 pageTransition.classList.add('fadeOut', 'animated'); 3049 3050 var removePageTransition = function() { 3051 pageTransition.remove(); 3052 if( elAnimIn != 'fadeIn' ) { 3053 __core.getVars.elWrapper.classList.remove('not-animated'); 3054 (elAnimIn + ' animated').split(" ").forEach(function(_class) { 3055 __core.getVars.elWrapper.classList.add(_class); 3056 }); 3057 } 3058 }; 3059 3060 var displayContent = function() { 3061 body.classList.remove('page-transition'); 3062 3063 setTimeout(function() { 3064 (elAnimIn + ' animated').split(" ").forEach( function(_class) { 3065 __core.getVars.elWrapper.classList.remove(_class); 3066 }); 3067 }, 333); 3068 3069 setTimeout(function() { 3070 __core.getVars.elWrapper.style.removeProperty('--cnvs-animate-duration'); 3071 }, 666); 3072 }; 3073 3074 pageTransition.addEventListener('transitionend', removePageTransition); 3075 pageTransition.addEventListener('animationend', removePageTransition); 3076 __core.getVars.elWrapper.addEventListener('transitionend', displayContent); 3077 __core.getVars.elWrapper.addEventListener('animationend', displayContent); 3078 3079 return true; 3080 }; 3081 3082 if( document.readyState === 'complete' ) { 3083 endPageTransition(); 3084 } 3085 3086 if( elTimeoutActive ) { 3087 setTimeout( endPageTransition, elTimeout ); 3088 } 3089 3090 window.addEventListener('load', function(){ 3091 endPageTransition(); 3092 }); 3093 } 3094 }; 3095 }(), 3096 // PageTransition Functions End 3097 3098 /** 3099 * -------------------------------------------------------------------------- 3100 * LazyLoad Functions Start 3101 * -------------------------------------------------------------------------- 3102 */ 3103 LazyLoad: function() { 3104 return { 3105 init: function(selector) { 3106 if( __core.getSelector(selector, false, false).length < 1 ){ 3107 return true; 3108 } 3109 3110 __core.isFuncTrue( function() { 3111 return typeof LazyLoad !== "undefined" 3112 }).then( function(cond) { 3113 if( !cond ) { 3114 return false;
3115 } 3116 3117 __core.initFunction({ class: 'has-plugin-lazyload', event: 'pluginlazyLoadReady' }); 3118 3119 window.lazyLoadInstance = new LazyLoad({ 3120 threshold: 0, 3121 elements_selector: '.lazy:not(.lazy-loaded)', 3122 class_loading: 'lazy-loading', 3123 class_loaded: 'lazy-loaded', 3124 class_error: 'lazy-error', 3125 callback_loaded: function(el) { 3126 __core.addEvent( window, 'lazyLoadLoaded' ); 3127 if( el.parentNode.getAttribute('data-lazy-container') == 'true' ) { 3128 __core.runContainerModules( el.parentNode ); 3129 } 3130 } 3131 }); 3132 }); 3133 } 3134 }; 3135 }(), 3136 // LazyLoad Functions End 3137 3138 /** 3139 * -------------------------------------------------------------------------- 3140 * DataClasses Functions Start 3141 * -------------------------------------------------------------------------- 3142 */ 3143 DataClasses: function() { 3144 return { 3145 init: function(selector) { 3146 if( __core.getSelector(selector, false, false).length < 1 ){ 3147 return true; 3148 } 3149 3150 __core.initFunction({ class: 'has-plugin-dataclasses', event: 'pluginDataClassesReady' }); 3151 3152 selector = __core.getSelector( selector, false, false ); 3153 if( selector.length < 1 ){ 3154 return true; 3155 } 3156 3157 selector.forEach( function(el) { 3158 var classes = el.getAttribute('data-class'); 3159 3160 classes = classes.split(/ +/); 3161 if( classes.length > 0 ) { 3162 classes.forEach( function(_class) { 3163 var deviceClass = _class.split(":"); 3164 if( __core.getVars.elBody.classList.contains(deviceClass[0] == 'dark' ? deviceClass[0] : 'device-' + deviceClass[0]) ) { 3165 el.classList.add(deviceClass[1]); 3166 } else { 3167 el.classList.remove(deviceClass[1]); 3168 } 3169 }); 3170 } 3171 }); 3172 3173 __core.getVars.resizers.dataClasses = function() { 3174 setTimeout( function() { 3175 __modules.dataClasses(); 3176 }, 333); 3177 }; 3178 } 3179 }; 3180 }(), 3181 // DataClasses Functions End 3182 3183 /** 3184 * -------------------------------------------------------------------------- 3185 * DataHeights Functions Start 3186 * -------------------------------------------------------------------------- 3187 */ 3188 DataHeights: function() { 3189 return { 3190 init: function(selector) { 3191 if( __core.getSelector(selector, false, false).length < 1 ){ 3192 return true; 3193 } 3194 3195 __core.initFunction({ class: 'has-plugin-dataheights', event: 'pluginDataHeightsReady' }); 3196 3197 selector = __core.getSelector( selector, false, false ); 3198 if( selector.length < 1 ){ 3199 return true; 3200 } 3201 3202 selector.forEach( function(el) { 3203 var heightXs = el.getAttribute('data-height-xs') || 'auto', 3204 heightSm = el.getAttribute('data-height-sm') || heightXs, 3205 heightMd = el.getAttribute('data-height-md') || heightSm, 3206 heightLg = el.getAttribute('data-height-lg') || heightMd, 3207 heightXl = el.getAttribute('data-height-xl') || heightLg, 3208 heightXxl = el.getAttribute('data-height-xxl') || heightXl, 3209 body = __core.getVars.elBody.classList, 3210 elHeight; 3211 3212 if( body.contains('device-xs') ) { 3213 elHeight = heightXs; 3214 } else if( body.contains('device-sm') ) { 3215 elHeight = heightSm; 3216 } else if( body.contains('device-md') ) { 3217 elHeight = heightMd; 3218 } else if( body.contains('device-lg') ) { 3219 elHeight = heightLg; 3220 } else if( body.contains('device-xl') ) { 3221 elHeight = heightXl; 3222 } else if( body.contains('device-xxl') ) { 3223 elHeight = heightXxl; 3224 } 3225 3226 if( elHeight ) { 3227 el.style.height = !isNaN( elHeight ) ? elHeight + 'px' : elHeight; 3228 } 3229 }); 3230 3231 __core.getVars.resizers.dataHeights = function() { 3232 __modules.dataHeights(); 3233 }; 3234 } 3235 }; 3236 }(), 3237 // DataHeights Functions End 3238 3239 /** 3240 * -------------------------------------------------------------------------- 3241 * Lightbox Functions Start 3242 * -------------------------------------------------------------------------- 3243 */ 3244 Lightbox: function() { 3245 return { 3246 init: function(selector) { 3247 if( __core.getSelector(selector, false, false).length < 1 ){ 3248 return true; 3249 } 3250 3251 __core.isFuncTrue( function() { 3252 return typeof jQuery !== 'undefined' && jQuery().magnificPopup; 3253 }).then( function(cond) { 3254 if( !cond ) { 3255 return false;
3256 } 3257 3258 __core.initFunction({ class: 'has-plugin-lightbox', event: 'pluginLightboxReady' }); 3259 3260 selector = __core.getSelector( selector ); 3261 if( selector.length < 1 ){ 3262 return true; 3263 } 3264 3265 var closeButtonIcon = '<i class="bi-x-lg"></i>'; 3266 3267 selector.each( function(){ 3268 var element = jQuery(this), 3269 elType = element.attr('data-lightbox'), 3270 elCloseButton = element.attr('data-close-button') || 'outside', 3271 elDisableUnder = element.attr('data-disable-under') || 600, 3272 elFixedContent = element.attr('data-content-position') || 'auto', 3273 elZoom = element.attr('data-zoom'), 3274 $body = jQuery('body'); 3275 3276 elCloseButton = elCloseButton == 'inside' ? true : false; 3277 elFixedContent = elFixedContent == 'fixed' ? true : false; 3278 3279 if( elType == 'image' ) { 3280 var settings = { 3281 type: 'image', 3282 tLoading: '', 3283 closeOnContentClick: true, 3284 closeBtnInside: elCloseButton, 3285 fixedContentPos: true, 3286 mainClass: 'mfp-no-margins mfp-fade', 3287 image: { 3288 verticalFit: true 3289 }, 3290 closeIcon: closeButtonIcon, 3291 }; 3292 3293 if( elZoom == 'true' ) { 3294 settings.zoom = { 3295 enabled: true, 3296 duration: 300, 3297 easing: 'ease-in-out', 3298 opener: function(openerElement) { 3299 return openerElement.is('img') ? openerElement : openerElement.find('img'); 3300 } 3301 }; 3302 } 3303 3304 element.magnificPopup(settings); 3305 } 3306 3307 if( elType == 'gallery' ) { 3308 if( element.find('a[data-lightbox="gallery-item"]').parent('.clone').hasClass('clone') ) { 3309 element.find('a[data-lightbox="gallery-item"]').parent('.clone').find('a[data-lightbox="gallery-item"]').attr('data-lightbox',''); 3310 } 3311 3312 if( element.find('a[data-lightbox="gallery-item"]').parents('.cloned').hasClass('cloned') ) { 3313 element.find('a[data-lightbox="gallery-item"]').parents('.cloned').find('a[data-lightbox="gallery-item"]').attr('data-lightbox',''); 3314 } 3315 3316 element.magnificPopup({ 3317 delegate: element.hasClass('grid-container-filterable') ? 'a.grid-lightbox-filtered[data-lightbox="gallery-item"]' : 'a[data-lightbox="gallery-item"]', 3318 type: 'image', 3319 tLoading: '', 3320 closeOnContentClick: true, 3321 closeBtnInside: elCloseButton, 3322 fixedContentPos: true, 3323 mainClass: 'mfp-no-margins mfp-fade', // class to remove default margin from left and right side 3324 image: { 3325 verticalFit: true 3326 }, 3327 gallery: { 3328 enabled: true, 3329 navigateByImgClick: true, 3330 preload: [0,1] // Will preload 0 - before current, and 1 after the current image 3331 }, 3332 closeIcon: closeButtonIcon, 3333 }); 3334 } 3335 3336 if( elType == 'iframe' ) { 3337 element.magnificPopup({ 3338 disableOn: Number( elDisableUnder ), 3339 type: 'iframe', 3340 tLoading: '', 3341 removalDelay: 160, 3342 preloader: false, 3343 closeBtnInside: elCloseButton, 3344 fixedContentPos: elFixedContent, 3345 closeIcon: closeButtonIcon, 3346 }); 3347 } 3348 3349 if( elType == 'inline' ) { 3350 element.magnificPopup({ 3351 type: 'inline', 3352 tLoading: '', 3353 mainClass: 'mfp-no-margins mfp-fade', 3354 closeBtnInside: elCloseButton, 3355 fixedContentPos: true, 3356 overflowY: 'scroll', 3357 closeIcon: closeButtonIcon, 3358 }); 3359 } 3360 3361 if( elType == 'ajax' ) { 3362 element.magnificPopup({ 3363 type: 'ajax', 3364 tLoading: '', 3365 closeBtnInside: elCloseButton, 3366 autoFocusLast: false, 3367 closeIcon: closeButtonIcon, 3368 callbacks: { 3369 ajaxContentAdded: function(mfpResponse) { 3370 __core.runContainerModules( document.querySelector('.mfp-content') ); 3371 }, 3372 open: function() { 3373 $body.addClass('ohidden'); 3374 }, 3375 close: function() { 3376 $body.removeClass('ohidden'); 3377 } 3378 } 3379 }); 3380 } 3381 3382 if( elType == 'ajax-gallery' ) { 3383 element.magnificPopup({ 3384 delegate: 'a[data-lightbox="ajax-gallery-item"]', 3385 type: 'ajax', 3386 tLoading: '', 3387 closeBtnInside: elCloseButton, 3388 closeIcon: closeButtonIcon, 3389 autoFocusLast: false, 3390 gallery: { 3391 enabled: true, 3392 preload: 0, 3393 navigateByImgClick: false 3394 }, 3395 callbacks: { 3396 ajaxContentAdded: function(mfpResponse) { 3397 __core.runContainerModules( document.querySelector('.mfp-content') ); 3398 }, 3399 open: function() { 3400 $body.addClass('ohidden'); 3401 }, 3402 close: function() { 3403 $body.removeClass('ohidden'); 3404 } 3405 } 3406 }); 3407 } 3408 3409 element.on( 'mfpOpen', function(){ 3410 var lightboxItem = jQuery.magnificPopup.instance.currItem.el, 3411 lightboxClass = jQuery( lightboxItem ).attr('data-lightbox-class'),
3412 lightboxBgClass = jQuery( lightboxItem ).attr('data-lightbox-bg-class'); 3413 3414 if( lightboxClass != '' ) { 3415 jQuery(jQuery.magnificPopup.instance.container).addClass( lightboxClass ); 3416 } 3417 3418 if( lightboxBgClass != '' ) { 3419 jQuery(jQuery.magnificPopup.instance.bgOverlay).addClass( lightboxBgClass ); 3420 } 3421 }); 3422 }); 3423 }); 3424 } 3425 }; 3426 }(), 3427 // Lightbox Functions End 3428 3429 /** 3430 * -------------------------------------------------------------------------- 3431 * Modal Functions Start 3432 * -------------------------------------------------------------------------- 3433 */ 3434 Modal: function() { 3435 return { 3436 init: function(selector) { 3437 if( __core.getSelector(selector, false, false).length < 1 ){ 3438 return true; 3439 } 3440 3441 __core.isFuncTrue( function() { 3442 return typeof jQuery !== 'undefined' && jQuery().magnificPopup; 3443 }).then( function(cond) { 3444 if( !cond ) { 3445 return false; 3446 } 3447 3448 __core.initFunction({ class: 'has-plugin-modal', event: 'pluginModalReady' }); 3449 3450 selector = __core.getSelector( selector ); 3451 if( selector.length < 1 ){ 3452 return true; 3453 } 3454 3455 var closeButtonIcon = '<i class="bi-x-lg"></i>'; 3456 3457 selector.each( function(){ 3458 var element = jQuery(this), 3459 elTarget = element.attr('data-target'), 3460 elTargetValue = '__cnvs_' + elTarget.split('#')[1], 3461 elDelay = element.attr('data-delay') || 500, 3462 elTimeout = element.attr('data-timeout'), 3463 elAnimateIn = element.attr('data-animate-in'), 3464 elAnimateOut = element.attr('data-animate-out'), 3465 elBgClick = element.attr('data-bg-click'), 3466 elCloseBtn = element.attr('data-close-btn'), 3467 elCookies = element.attr('data-cookies'), 3468 elCookiePath = element.attr('data-cookie-path'), 3469 elCookieExp = element.attr('data-cookie-expire'); 3470 3471 if( elCookies == "false" ) { 3472 __core.cookie.remove( elTargetValue ); 3473 } 3474 3475 if( elCookies == 'true' ) { 3476 var elementCookie = __core.cookie.get( elTargetValue ); 3477 3478 if( typeof elementCookie !== 'undefined' && elementCookie == '0' ) { 3479 return true; 3480 } 3481 } 3482 3483 if( elBgClick == 'false' ) { 3484 elBgClick = false; 3485 } else { 3486 elBgClick = true; 3487 } 3488 3489 if( elCloseBtn == 'false' ) { 3490 elCloseBtn = false; 3491 } else { 3492 elCloseBtn = true; 3493 } 3494 3495 elDelay = Number(elDelay) + 500; 3496 3497 setTimeout(function() { 3498 jQuery.magnificPopup.open({ 3499 items: { src: elTarget }, 3500 type: 'inline', 3501 mainClass: 'mfp-no-margins mfp-fade', 3502 closeBtnInside: false, 3503 fixedContentPos: true, 3504 closeOnBgClick: elBgClick, 3505 showCloseBtn: elCloseBtn, 3506 removalDelay: 500, 3507 closeIcon: closeButtonIcon, 3508 callbacks: { 3509 open: function(){ 3510 if( elAnimateIn != '' ) { 3511 jQuery(elTarget).addClass( elAnimateIn + ' animated' ); 3512 } 3513 }, 3514 beforeClose: function(){ 3515 if( elAnimateOut != '' ) { 3516 jQuery(elTarget).removeClass( elAnimateIn ).addClass( elAnimateOut ); 3517 } 3518 }, 3519 afterClose: function() { 3520 if( elAnimateIn != '' || elAnimateOut != '' ) { 3521 jQuery(elTarget).removeClass( elAnimateIn + ' ' + elAnimateOut + ' animated' ); 3522 } 3523 } 3524 } 3525 }, 0); 3526 }, elDelay ); 3527 3528 if( document.querySelector('.modal-cookies-close') ) { 3529 document.querySelector('.modal-cookies-close').onclick = function() { 3530 jQuery.magnificPopup.close(); 3531 3532 if( elCookies == 'true' ) { 3533 var cookieOps = {}; 3534 3535 if( elCookieExp ) { 3536 cookieOps.expires = Number( elCookieExp ); 3537 } 3538 3539 if( elCookiePath ) { 3540 cookieOps.path = elCookiePath; 3541 } 3542 3543 __core.cookie.set( elTargetValue, '0', cookieOps ); 3544 } 3545 } 3546 } 3547 3548 if( elTimeout != '' ) { 3549 setTimeout(function() { 3550 jQuery.magnificPopup.close(); 3551 }, elDelay + Number(elTimeout) ); 3552 } 3553 }); 3554 }); 3555 } 3556 }; 3557 }(), 3558 // Modal Functions End 3559 3560 /** 3561 * -------------------------------------------------------------------------- 3562 * Animations Functions Start 3563 * -------------------------------------------------------------------------- 3564 */ 3565 Animations: function() { 3566 return { 3567 init: function(selector) { 3568 if( __core.getSelector(selector, false, false).length < 1 ){ 3569 return true; 3570 } 3571 3572 __core.initFunction({ class: 'has-plugin-animations', event: 'pluginAnimationsReady' }); 3573 3574 selector = __core.getSelector( selector, false ); 3575 if( selector.length < 1 ){ 3576 return true; 3577 } 3578 3579 var SELECTOR = '[data-animate]', 3580 ANIMATE_CLASS_NAME = 'animated'; 3581 3582 var isAnimated = function(element) { 3583 element.classList.contains(ANIMATE_CLASS_NAME); 3584 }; 3585 3586 var intersectionObserver = new IntersectionObserver( 3587 function(entries, observer) {
3588 entries.forEach( function(entry) { 3589 var element = entry.target, 3590 elAnimation = element.getAttribute('data-animate'), 3591 elAnimOut = element.getAttribute('data-animate-out'), 3592 elAnimDelay = element.getAttribute('data-delay'), 3593 elAnimDelayOut = element.getAttribute('data-delay-out'), 3594 elAnimDelayTime = 0, 3595 elAnimDelayOutTime = 3000, 3596 elAnimations = elAnimation.split(' '); 3597 3598 if( element.closest('.fslider.no-thumbs-animate') ) { 3599 return true; 3600 } 3601 3602 if( element.closest('.swiper-slide') ) { 3603 return true; 3604 } 3605 3606 if( elAnimDelay ) { 3607 elAnimDelayTime = Number( elAnimDelay ) + 500; 3608 } else { 3609 elAnimDelayTime = 500; 3610 } 3611 3612 if( elAnimOut && elAnimDelayOut ) { 3613 elAnimDelayOutTime = Number( elAnimDelayOut ) + elAnimDelayTime; 3614 } 3615 3616 if( !element.classList.contains('animated') ) { 3617 element.classList.add('not-animated'); 3618 if( entry.intersectionRatio > 0 ) { 3619 setTimeout( function() { 3620 element.classList.remove('not-animated'); 3621 elAnimations.forEach( function(item) { 3622 element.classList.add(item); 3623 }); 3624 element.classList.add('animated'); 3625 }, elAnimDelayTime); 3626 3627 if( elAnimOut ) { 3628 setTimeout( function() { 3629 elAnimations.forEach( function(item) { 3630 element.classList.remove(item); 3631 }); 3632 3633 elAnimOut.split(' ').forEach( function(item) { 3634 element.classList.add(item); 3635 }); 3636 }, elAnimDelayOutTime); 3637 } 3638 } 3639 } 3640 3641 if( !element.classList.contains('not-animated') ) { 3642 observer.unobserve(element); 3643 } 3644 }); 3645 } 3646 ); 3647 3648 var elements = [].filter.call(document.querySelectorAll(SELECTOR), function(element) { 3649 return !isAnimated(element, ANIMATE_CLASS_NAME); 3650 }); 3651 3652 elements.forEach( function(element) { 3653 return intersectionObserver.observe(element); 3654 }); 3655 } 3656 }; 3657 }(), 3658 // Animations Functions End 3659 3660 /** 3661 * -------------------------------------------------------------------------- 3662 * HoverAnimations Functions Start 3663 * -------------------------------------------------------------------------- 3664 */ 3665 HoverAnimations: function() { 3666 var _t, _x; 3667 3668 var _showOverlay = function(params) { 3669 clearTimeout(_x); 3670 3671 _t = setTimeout( function() { 3672 params.element.classList.add( 'not-animated' ); 3673 3674 (params.elAnimateOut + ' not-animated').split(" ").forEach( function(_class) { 3675 params.element.classList.remove(_class); 3676 }); 3677 3678 (params.elAnimate + ' animated').split(" ").forEach( function(_class) { 3679 params.element.classList.add(_class); 3680 }); 3681 }, params.elDelayT ); 3682 }; 3683 3684 var _hideOverlay = function(params) { 3685 params.element.classList.add( 'not-animated' ); 3686 3687 (params.elAnimate + ' not-animated').split(" ").forEach( function(_class) { 3688 params.element.classList.remove(_class); 3689 }); 3690 3691 (params.elAnimateOut + ' animated').split(" ").forEach( function(_class) { 3692 params.element.classList.add(_class); 3693 }); 3694 3695 if( params.elReset == 'true' ) { 3696 _x = setTimeout( function() { 3697 (params.elAnimateOut + ' animated').split(" ").forEach( function(_class) { 3698 params.element.classList.remove(_class); 3699 }); 3700 3701 params.element.classList.add( 'not-animated' ); 3702 }, Number( params.elSpeed ) ); 3703 } 3704 3705 clearTimeout(_t); 3706 }; 3707 3708 var _isInsideElement = function(touch){ 3709 var rect = element.getBoundingClientRect(); 3710 3711 return ( 3712 touch.clientX >= rect.left && 3713 touch.clientX <= rect.right && 3714 touch.clientY >= rect.top && 3715 touch.clientY <= rect.bottom 3716 ); 3717 }; 3718 3719 return { 3720 init: function(selector) { 3721 if( __core.getSelector(selector, false, false).length < 1 ){ 3722 return true; 3723 } 3724 3725 __core.initFunction({ class: 'has-plugin-hoveranimation', event: 'pluginHoverAnimationReady' }); 3726 3727 selector = __core.getSelector( selector, false ); 3728 if( selector.length < 1 ){ 3729 return true; 3730 } 3731 3732 selector.forEach( function(element) { 3733 var elAnimate = element.getAttribute( 'data-hover-animate' ), 3734 elAnimateOut = element.getAttribute( 'data-hover-animate-out' ) || 'fadeOut', 3735 elSpeed = element.getAttribute( 'data-hover-speed' ) || 600, 3736 elDelay = element.getAttribute( 'data-hover-delay' ), 3737 elParent = element.getAttribute( 'data-hover-parent' ), 3738 elReset = element.getAttribute( 'data-hover-reset' ) || 'false', 3739 elMobile = element.getAttribute( 'data-hover-mobile' ) || 'true'; 3740 3741 if( elMobile != 'true' ) { 3742 if( elMobile == 'false' ) { 3743 if( !__core.getVars.elBody.classList.contains('device-up-lg') ) { 3744 return true; 3745 } 3746 } else { 3747 if( !__core.getVars.elBody.classList.contains('device-up-' + elMobile) ) { 3748 return true; 3749 } 3750 } 3751 } 3752 3753 element.classList.add( 'not-animated' ); 3754 3755 if( !elParent ) { 3756 if( element.closest( '.bg-overlay' ) ) { 3757 elParent = element.closest( '.bg-overlay' ); 3758 } else { 3759 elParent = element; 3760 } 3761 } else { 3762 if( elParent == 'self' ) { 3763 elParent = element; 3764 } else { 3765 elParent = element.closest( elParent ); 3766 } 3767 } 3768 3769 var elDelayT = 0; 3770 3771 if( elDelay ) { 3772 elDelayT = Number( elDelay ); 3773 } 3774 3775 if( elSpeed ) { 3776 element.style.animationDuration = Number( elSpeed ) + 'ms'; 3777 } 3778 3779 var params = { 3780 element: element, 3781 elAnimate: elAnimate, 3782 elAnimateOut: elAnimateOut, 3783 elSpeed: elSpeed, 3784 elDelayT: elDelayT, 3785 elParent: elParent, 3786 elReset: elReset, 3787 } 3788 3789 elParent.addEventListener( 'mouseenter', function(){ 3790 _showOverlay(params); 3791 }, false); 3792 3793 elParent.addEventListener( 'mouseleave', function(){ 3794 _hideOverlay(params); 3795 }, false); 3796 3797 // elParent.addEventListener( 'touchstart', function(e){ 3798 // e.preventDefault(); 3799 3800 // _showOverlay(params); 3801 3802 // elParent.addEventListener('touchmove', function(e){ 3803 // if (!_isInsideElement(e.touches[0])) { 3804 // _hideOverlay(params); 3805 // elParent.removeEventListener('touchmove'); 3806 // } 3807 // }); 3808 3809 // elParent.addEventListener('touchend', function(){ 3810 // _hideOverlay(params); 3811 // elParent.removeEventListener('touchmove'); 3812 // elParent.removeEventListener('touchend'); 3813 // }); 3814 // }); 3815 }); 3816 } 3817 }; 3818 }(), 3819 // HoverAnimations Functions End 3820 3821 /** 3822 * -------------------------------------------------------------------------- 3823 * Grid Functions Start 3824 * -------------------------------------------------------------------------- 3825 */ 3826 Grid: function() { 3827 var _reLayout = function(el) { 3828 el.filter('.has-init-isotope').isotope('layout'); 3829 }; 3830 3831 return { 3832 init: function(selector) { 3833 if( __core.getSelector(selector, false, false).length < 1 ){ 3834 return true; 3835 } 3836 3837 __core.isFuncTrue( function() { 3838 return typeof jQuery !== 'undefined' && typeof Isotope !== 'undefined'; 3839 }).then( function(cond) { 3840 if( !cond ) { 3841 return false;
3842 } 3843 3844 __core.initFunction({ class: 'has-plugin-isotope', event: 'pluginIsotopeReady' }); 3845 3846 selector = __core.getSelector( selector ); 3847 if( selector.length < 1 ){ 3848 return true; 3849 } 3850 3851 selector.each( function() { 3852 var element = jQuery(this), 3853 elTransition = element.attr('data-transition') || '0.65s', 3854 elLayoutMode = element.attr('data-layout') || 'masonry', 3855 elStagger = element.attr('data-stagger') || 0, 3856 elBase = element.attr('data-basewidth') || '.portfolio-item:not(.wide):eq(0)', 3857 elOriginLeft = true, 3858 elGrid; 3859 3860 _reLayout(element); 3861 3862 if( __core.getVars.isRTL ) { 3863 elOriginLeft = false; 3864 } 3865 3866 if( element.hasClass('portfolio') || element.hasClass('post-timeline') ){ 3867 elGrid = element.filter(':not(.has-init-isotope)').isotope({ 3868 layoutMode: elLayoutMode, 3869 isOriginLeft: elOriginLeft, 3870 transitionDuration: elTransition, 3871 stagger: Number( elStagger ), 3872 percentPosition: true, 3873 masonry: { 3874 columnWidth: element.find( elBase )[0] 3875 } 3876 }); 3877 } else { 3878 elGrid = element.filter(':not(.has-init-isotope)').isotope({ 3879 layoutMode: elLayoutMode, 3880 isOriginLeft: elOriginLeft, 3881 transitionDuration: elTransition, 3882 stagger: Number( elStagger ), 3883 percentPosition: true, 3884 }); 3885 } 3886 3887 if( element.data('isotope') ) { 3888 element.addClass('has-init-isotope'); 3889 } 3890 3891 var int = setInterval( function() { 3892 if( element.find('.lazy.lazy-loaded').length == element.find('.lazy').length ) { 3893 setTimeout( function() { 3894 _reLayout(element); 3895 }, 666); 3896 3897 clearInterval(int); 3898 } 3899 }, 1000); 3900 3901 window.addEventListener( 'lazyLoadLoaded', function() { 3902 _reLayout(element); 3903 }); 3904 3905 window.addEventListener( 'load', function() { 3906 _reLayout(element); 3907 }); 3908 3909 __core.getVars.resizers.isotope = function() { 3910 _reLayout(element); 3911 }; 3912 }); 3913 }); 3914 } 3915 }; 3916 }(), 3917 // Grid Functions End 3918 3919 /** 3920 * -------------------------------------------------------------------------- 3921 * Filter Functions Start 3922 * -------------------------------------------------------------------------- 3923 */ 3924 Filter: function() { 3925 return { 3926 init: function(selector) { 3927 if( __core.getSelector(selector, false, false).length < 1 ){ 3928 return true; 3929 } 3930 3931 __core.isFuncTrue( function() { 3932 return typeof jQuery !== 'undefined' && typeof Isotope !== 'undefined'; 3933 }).then( function(cond) { 3934 if( !cond ) { 3935 return false; 3936 } 3937 3938 __core.initFunction({ class: 'has-plugin-isotope-filter', event: 'pluginGridFilterReady' }); 3939 3940 selector = __core.getSelector( selector ); 3941 if( selector.length < 1 ){ 3942 return true; 3943 } 3944 3945 selector.each( function() { 3946 var element = jQuery(this), 3947 elCon = element.attr('data-container'), 3948 elActClass = element.attr('data-active-class'), 3949 elDefFilter = element.attr('data-default'); 3950 3951 if( !elActClass ) { 3952 elActClass = 'activeFilter'; 3953 } 3954 3955 if( !jQuery(elCon).hasClass('grid-container') ) { 3956 return false; 3957 } 3958 3959 element.find('a').off( 'click' ).on( 'click', function(){ 3960 element.find('li').removeClass( elActClass ); 3961 jQuery(this).parent('li').addClass( elActClass ); 3962 var selector = jQuery(this).attr('data-filter'); 3963 jQuery(elCon).isotope({ filter: selector }); 3964 return false; 3965 }); 3966 3967 if( elDefFilter ) { 3968 element.find('li').removeClass( elActClass ); 3969 element.find('[data-filter="'+ elDefFilter +'"]').parent('li').addClass( elActClass ); 3970 jQuery(elCon).isotope({ filter: elDefFilter }); 3971 } 3972 3973 jQuery(elCon).on( 'arrangeComplete layoutComplete', function(event, filteredItems) { 3974 jQuery(elCon).addClass('grid-container-filterable'); 3975 if( jQuery(elCon).attr('data-lightbox') == 'gallery' ) { 3976 jQuery(elCon).find("[data-lightbox]").removeClass('grid-lightbox-filtered');
3977 filteredItems.forEach( function(item) { 3978 jQuery(item.element).find("[data-lightbox]").addClass('grid-lightbox-filtered'); 3979 }); 3980 } 3981 __modules.lightbox(); 3982 }); 3983 }); 3984 3985 jQuery('.grid-shuffle').off( 'click' ).on( 'click', function(){ 3986 var element = jQuery(this), 3987 elCon = element.attr('data-container'); 3988 3989 if( !jQuery(elCon).hasClass('grid-container') ) { 3990 return false; 3991 } 3992 3993 jQuery(elCon).isotope('shuffle'); 3994 }); 3995 }); 3996 } 3997 }; 3998 }(), 3999 // Filter Functions End 4000 4001 /** 4002 * -------------------------------------------------------------------------- 4003 * CanvasSlider Functions Start 4004 * -------------------------------------------------------------------------- 4005 */ 4006 CanvasSlider: function() { 4007 return { 4008 init: function(selector) { 4009 if( __core.getSelector(selector, false, false).length < 1 ){ 4010 return true; 4011 } 4012 4013 __core.isFuncTrue( function() { 4014 return typeof Swiper !== "undefined"; 4015 }).then( function(cond) { 4016 if( !cond ) { 4017 return false; 4018 } 4019 4020 __core.initFunction({ class: 'has-plugin-swiper', event: 'pluginSwiperReady' }); 4021 4022 selector = __core.getSelector( selector, false ); 4023 if( selector.length < 1 ){ 4024 return true; 4025 } 4026 4027 selector.forEach( function(element) { 4028 if( !element.classList.contains('swiper_wrapper') ) { 4029 return true; 4030 } 4031 4032 if( element.querySelectorAll('.swiper-slide').length < 1 ) { 4033 return true; 4034 } 4035 4036 var elDirection = element.getAttribute('data-direction') || 'horizontal', 4037 elSpeed = element.getAttribute('data-speed') || 300, 4038 elAutoPlay = element.getAttribute('data-autoplay'), 4039 elAutoPlayDisableOnInteraction = element.getAttribute('data-autoplay-disable-on-interaction') || true, 4040 elPauseOnHover = element.getAttribute('data-hover'), 4041 elLoop = element.getAttribute('data-loop'), 4042 elStart = element.getAttribute('data-start') || 1, 4043 elEffect = element.getAttribute('data-effect') || 'slide', 4044 elGrabCursor = element.getAttribute('data-grab'), 4045 elParallax = element.getAttribute('data-parallax'), 4046 elAutoHeight = element.getAttribute('data-autoheight'), 4047 slideNumberTotal = element.querySelector('.slide-number-total'), 4048 slideNumberCurrent = element.querySelector('.slide-number-current'), 4049 elVideoAutoPlay = element.getAttribute('data-video-autoplay'), 4050 elSettings = element.getAttribute('data-settings'), 4051 elPagination, elPaginationClickable; 4052 4053 elAutoPlay = elAutoPlay ? Number( elAutoPlay ) : 999999999; 4054 elPauseOnHover = elPauseOnHover == 'true' ? true : false; 4055 elAutoPlayDisableOnInteraction = elAutoPlayDisableOnInteraction == 'false' ? false : true; 4056 elLoop = elLoop == 'true' ? true : false; 4057 elParallax = elParallax == 'true' ? true : false; 4058 elGrabCursor = elGrabCursor == 'false' ? false : true; 4059 elAutoHeight = elAutoHeight == 'true' ? true : false; 4060 elVideoAutoPlay = elVideoAutoPlay == 'false' ? false : true; 4061 elStart = elStart == 'random' ? Math.floor( Math.random() * element.querySelectorAll('.swiper-slide:not(.swiper-slide-duplicate)').length ) : Number( elStart ) - 1; 4062 4063 if( element.querySelector('.swiper-pagination') ) { 4064 elPagination = element.querySelector('.swiper-pagination'); 4065 elPaginationClickable = true; 4066 } else { 4067 elPagination = ''; 4068 elPaginationClickable = false; 4069 } 4070 4071 var elementNavNext = element.querySelector('.slider-arrow-right'), 4072 elementNavPrev = element.querySelector('.slider-arrow-left'), 4073 elementScollBar = element.querySelector('.swiper-scrollbar'); 4074 4075 var cnvsSwiper = new Swiper( element.querySelector('.swiper-parent'), { 4076 direction: elDirection, 4077 speed: Number( elSpeed ), 4078 autoplay: { 4079 delay: elAutoPlay, 4080 pauseOnMouseEnter: elPauseOnHover, 4081 disableOnInteraction: elAutoPlayDisableOnInteraction 4082 }, 4083 loop: elLoop, 4084 initialSlide: elStart, 4085 effect: elEffect, 4086 parallax: elParallax, 4087 slidesPerView: 1, 4088 grabCursor: elGrabCursor, 4089 autoHeight: elAutoHeight, 4090 pagination: { 4091 el: elPagination, 4092 clickable: elPaginationClickable 4093 }, 4094 navigation: { 4095 prevEl: elementNavPrev, 4096 nextEl: elementNavNext 4097 }, 4098 scrollbar: { 4099 el: elementScollBar 4100 }, 4101 on: { 4102 afterInit: function(swiper) { 4103 __base.sliderDimensions(); 4104 4105 if( element.querySelectorAll('.yt-bg-player').length > 0 ) { 4106 element.querySelectorAll('.yt-bg-player').forEach( function(el) { 4107 el.setAttribute('data-autoplay', 'false'); 4108 el.classList.remove('customjs'); 4109 }); 4110 4111 __modules.youtubeBgVideo(); 4112 4113 var activeYTVideo = jQuery('.swiper-slide-active').find('.yt-bg-player:not(.customjs)'); 4114 activeYTVideo.on('YTPReady', function() { 4115 setTimeout( function() { 4116 activeYTVideo.filter('.mb_YTPlayer').YTPPlay(); 4117 }, 1200); 4118 }); 4119 } 4120 4121 document.querySelectorAll('.swiper-slide-active [data-animate]').forEach( function(el) { 4122 var toAnimateDelay = el.getAttribute('data-delay'), 4123 toAnimateDelayTime = 0; 4124 4125 if( toAnimateDelay ) { 4126 toAnimateDelayTime = Number( toAnimateDelay ) + 750; 4127 } else { 4128 toAnimateDelayTime = 750; 4129 } 4130 4131 if( !el.classList.contains('animated') ) { 4132 el.classList.add('not-animated'); 4133 4134 var elementAnimation = el.getAttribute('data-animate'); 4135 4136 setTimeout( function() { 4137 el.classList.remove('not-animated'); 4138 4139 ( elementAnimation + ' animated').split(" ").forEach( function(_class) { 4140 el.classList.add(_class); 4141 }); 4142 }, toAnimateDelayTime); 4143 } 4144 }); 4145 4146 element.querySelectorAll('[data-animate]').forEach( function(el) { 4147 var elementAnimation = el.getAttribute('data-animate'); 4148 4149 if( el.closest('.swiper-slide').classList.contains('swiper-slide-active') ) { 4150 return true; 4151 } 4152 4153 ( elementAnimation + ' animated').split(" ").forEach( function(_class) { 4154 el.classList.remove(_class); 4155 }); 4156 4157 el.classList.add('not-animated'); 4158 }); 4159 4160 if( elAutoHeight ) { 4161 setTimeout( function() { 4162 swiper.updateAutoHeight(300); 4163 }, 1000); 4164 } 4165 }, 4166 transitionStart: function(swiper) { 4167 element.querySelectorAll('[data-animate]').forEach( function(el) { 4168 var elementAnimation = el.getAttribute('data-animate'); 4169 4170 if( el.closest('.swiper-slide').classList.contains('swiper-slide-active') ) { 4171 return true; 4172 } 4173 4174 ( elementAnimation + ' animated').split(" ").forEach( function(_class) { 4175 el.classList.remove(_class); 4176 }); 4177 4178 el.classList.add('not-animated'); 4179 }); 4180 4181 SEMICOLON.Base.sliderMenuClass(); 4182 }, 4183 transitionEnd: function(swiper) { 4184 if( slideNumberCurrent ){ 4185 if( elLoop == true ) { 4186 slideNumberCurrent.innerHTML = Number( element.querySelector('.swiper-slide.swiper-slide-active').getAttribute('data-swiper-slide-index') ) + 1; 4187 } else { 4188 slideNumberCurrent.innerHTML = swiper.activeIndex + 1; 4189 } 4190 } 4191 4192 element.querySelectorAll('.swiper-slide').forEach( function(slide) { 4193 if( slide.querySelector('video') && elVideoAutoPlay == true ) { 4194 slide.querySelector('video').pause(); 4195 } 4196 4197 if( slide.querySelector('.yt-bg-player.mb_YTPlayer:not(.customjs)') ) { 4198 jQuery(slide).find('.yt-bg-player.mb_YTPlayer:not(.customjs)').YTPPause(); 4199 } 4200 }); 4201 4202 element.querySelectorAll('.swiper-slide:not(.swiper-slide-active)').forEach( function(slide) { 4203 if( slide.querySelector('video') ) { 4204 if( slide.querySelector('video').currentTime != 0 ) { 4205 slide.querySelector('video').currentTime = 0; 4206 } 4207 } 4208 4209 var activeYTPlayer = slide.querySelector('.yt-bg-player.mb_YTPlayer:not(.customjs)'); 4210 4211 if( activeYTPlayer ) { 4212 jQuery(activeYTPlayer).YTPSeekTo( activeYTPlayer.getAttribute('data-start') ); 4213 } 4214 }); 4215 4216 if( element.querySelector('.swiper-slide.swiper-slide-active').querySelector('video') && elVideoAutoPlay == true ) { 4217 element.querySelector('.swiper-slide.swiper-slide-active').querySelector('video').play(); 4218 } 4219 4220 if( element.querySelector('.swiper-slide.swiper-slide-active').querySelector('.yt-bg-player.mb_YTPlayer:not(.customjs)') && elVideoAutoPlay == true ) { 4221 jQuery(element).find('.swiper-slide.swiper-slide-active').find('.yt-bg-player.mb_YTPlayer:not(.customjs)').YTPPlay(); 4222 } 4223 4224 element.querySelectorAll('.swiper-slide.swiper-slide-active [data-animate]').forEach( function(el) { 4225 var toAnimateDelay = el.getAttribute('data-delay'), 4226 toAnimateDelayTime = 0; 4227 4228 if( toAnimateDelay ) { 4229 toAnimateDelayTime = Number( toAnimateDelay ) + 300; 4230 } else { 4231 toAnimateDelayTime = 300; 4232 } 4233 4234 if( !el.classList.contains('animated') ) { 4235 el.classList.add('not-animated'); 4236 4237 var elementAnimation = el.getAttribute('data-animate'); 4238 4239 setTimeout( function() { 4240 el.classList.remove('not-animated'); 4241 4242 ( elementAnimation + ' animated').split(" ").forEach( function(_class) { 4243 el.classList.add(_class); 4244 }); 4245 }, toAnimateDelayTime); 4246 } 4247 }); 4248 } 4249 } 4250 }); 4251 4252 if( slideNumberCurrent ) { 4253 if( elLoop == true ) { 4254 slideNumberCurrent.innerHTML = cnvsSwiper.realIndex + 1; 4255 } else { 4256 slideNumberCurrent.innerHTML = cnvsSwiper.activeIndex + 1; 4257 } 4258 } 4259 4260 if( slideNumberTotal ) { 4261 slideNumberTotal.innerHTML = element.querySelectorAll('.swiper-slide:not(.swiper-slide-duplicate)').length; 4262 } 4263 }); 4264 }); 4265 } 4266 }; 4267 }(), 4268 // CanvasSlider Functions End 4269 4270 /** 4271 * -------------------------------------------------------------------------- 4272 * SliderParallax Functions Start 4273 * -------------------------------------------------------------------------- 4274 */ 4275 SliderParallax: function() { 4276 var _settings; 4277 var _transform; 4278 var _transform2; 4279 4280 var _parallax = function(_settings) { 4281 if( !_settings.sliderPx.el ) { 4282 return true; 4283 } 4284 4285 fastdom.measure( function(){ 4286 _settings.scrollPos.y = window.scrollY; 4287 4288 if( _settings.body.classList.contains('is-expanded-menu') && !_settings.isMobile ) { 4289 if( ( _settings.height + _settings.sliderPx.offset + 50 ) > _settings.scrollPos.y ){ 4290 _settings.classes.add('slider-parallax-visible'); 4291 _settings.classes.remove('slider-parallax-invisible'); 4292 if ( _settings.scrollPos.y > _settings.sliderPx.offset ) { 4293 if( typeof _settings.sliderPx.el.querySelector('.slider-inner') === 'object' ) { 4294 _transform = ((_settings.scrollPos.y-_settings.sliderPx.offset) * -.4); 4295 _transform2 = ((_settings.scrollPos.y-_settings.sliderPx.offset) * -.15); 4296 4297 _setParallax(0, _transform, _settings.sliderPx.inner); 4298 _setParallax(0, _transform2, _settings.sliderPx.caption); 4299 } else { 4300 _transform = ((_settings.scrollPos.y-_settings.sliderPx.offset) / 1.5); 4301 _transform2 = ((_settings.scrollPos.y-_settings.sliderPx.offset) / 7); 4302 4303 _setParallax(0, _transform, _settings.sliderPx.el); 4304 _setParallax(0, _transform2, _settings.sliderPx.caption); 4305 } 4306 } else { 4307 if( _settings.sliderPx.el.querySelector('.slider-inner') ) { 4308 _setParallax(0, 0, _settings.sliderPx.inner); 4309 _setParallax(0, 0, _settings.sliderPx.caption); 4310 } else { 4311 _setParallax(0, 0, _settings.sliderPx.el); 4312 _setParallax(0, 0, _settings.sliderPx.caption); 4313 } 4314 } 4315 } else { 4316 _settings.classes.add('slider-parallax-invisible'); 4317 _settings.classes.remove('slider-parallax-visible'); 4318 } 4319 } else { 4320 if( _settings.sliderPx.el.querySelector('.slider-inner') ) { 4321 _setParallax(0, 0, _settings.sliderPx.inner); 4322 _setParallax(0, 0, _settings.sliderPx.caption); 4323 } else { 4324 _setParallax(0, 0, _settings.sliderPx.el); 4325 _setParallax(0, 0, _settings.sliderPx.caption); 4326 } 4327 4328 _settings.classes.add('slider-parallax-visible'); 4329 _settings.classes.remove('slider-parallax-invisible'); 4330 } 4331 }); 4332 }; 4333 4334 var _offset = function() { 4335 var sliderPx = __core.getVars.sliderParallax; 4336 4337 var sliderParallaxOffsetTop = 0, 4338 headerHeight = __core.getVars.elHeader?.offsetHeight || 0; 4339 4340 if( __core.getVars.elBody.classList.contains('side-header') || (__core.getVars.elHeader && __core.getNext(__core.getVars.elHeader, '.include-header').length > 0) ) { 4341 headerHeight = 0; 4342 } 4343 4344 // if( $pageTitle.length > 0 ) { 4345 // sliderParallaxOffsetTop = $pageTitle.outerHeight() + headerHeight - 20; 4346 // } else { 4347 // sliderParallaxOffsetTop = headerHeight - 20; 4348 // } 4349 4350 if( __core.getNext(__core.getVars.elSlider, '#header').length > 0 ) { 4351 sliderParallaxOffsetTop = 0; 4352 } 4353 4354 sliderPx.offset = sliderParallaxOffsetTop; 4355 }; 4356 4357 var _setParallax = function(xPos, yPos, el) { 4358 if( el ) { 4359 fastdom.mutate( function(){ 4360 el.style.transform = "translate3d(" + xPos + ", " + yPos + "px, 0)"; 4361 }); 4362 } 4363 }; 4364 4365 var _elementFade = function(_settings) { 4366 if( _settings.sliderPx.el.length < 1 ) { 4367 return true; 4368 } 4369 4370 fastdom.mutate( function(){ 4371 if( _settings.body.classList.contains('is-expanded-menu') && !_settings.isMobile ) { 4372 var tHeaderOffset; 4373 4374 if( (_settings.header && _settings.header.classList.contains('transparent-header')) || _settings.body.classList.contains('side-header') ) { 4375 tHeaderOffset = 100; 4376 } else { 4377 tHeaderOffset = 0; 4378 } 4379 4380 if( _settings.sliderPx.el.classList.contains('slider-parallax-visible') ) { 4381 _settings.sliderPx.el.querySelectorAll('.slider-arrow-left,.slider-arrow-right,.slider-caption,.slider-element-fade').forEach( function(el) { 4382 el.style.opacity = 1 - ( ( ( _settings.scrollPos.y - tHeaderOffset ) * 1.85 ) / _settings.height ); 4383 }); 4384 } 4385 } else { 4386 _settings.sliderPx.el.querySelectorAll('.slider-arrow-left,.slider-arrow-right,.slider-caption,.slider-element-fade').forEach( function(el) { 4387 el.style.opacity = 1; 4388 }); 4389 } 4390 }); 4391 }; 4392 4393 return { 4394 init: function(selector) { 4395 if( __core.getSelector(selector, false, false).length < 1 ){ 4396 return true; 4397 } 4398 4399 __core.isFuncTrue( function() { 4400 return typeof fastdom !== 'undefined'; 4401 }).then( function(cond) { 4402 if( !cond ) { 4403 return false;
4404 } 4405 4406 _settings = { 4407 sliderPx: __core.getVars.sliderParallax, 4408 body: __core.getVars.elBody, 4409 header: __core.getVars.elHeader, 4410 scrollPos: __core.getVars.scrollPos, 4411 isMobile: __mobile.any(), 4412 get height() { 4413 return this.sliderPx.el.offsetHeight; 4414 }, 4415 get classes() { 4416 return this.sliderPx.el.classList; 4417 }, 4418 }; 4419 4420 if( _settings.sliderPx.el.querySelector('.slider-inner') ) { 4421 _setParallax(0, 0, _settings.sliderPx.inner); 4422 _setParallax(0, 0, _settings.sliderPx.caption); 4423 } else { 4424 _setParallax(0, 0, _settings.sliderPx.el); 4425 _setParallax(0, 0, _settings.sliderPx.caption); 4426 } 4427 4428 window.addEventListener('scroll', function(){ 4429 _parallax(_settings); 4430 _elementFade(_settings); 4431 }, {passive:true}); 4432 4433 __core.getVars.resizers.sliderparallax = function() { 4434 _parallax(_settings); 4435 _elementFade(_settings); 4436 }; 4437 }); 4438 } 4439 }; 4440 }(), 4441 // SliderParallax Functions End 4442 4443 /** 4444 * -------------------------------------------------------------------------- 4445 * FlexSlider Functions Start 4446 * -------------------------------------------------------------------------- 4447 */ 4448 FlexSlider: function() { 4449 return { 4450 init: function(selector) { 4451 if( __core.getSelector(selector, false, false).length < 1 ){ 4452 return true; 4453 } 4454 4455 __core.isFuncTrue( function() { 4456 return typeof jQuery !== 'undefined' && jQuery().flexslider; 4457 }).then( function(cond) { 4458 if( !cond ) { 4459 return false; 4460 } 4461 4462 __core.initFunction({ class: 'has-plugin-flexslider', event: 'pluginFlexSliderReady' }); 4463 4464 selector = __core.getSelector( selector ); 4465 if( selector.length < 1 ){ 4466 return true; 4467 } 4468 4469 selector.each(function() { 4470 var element = jQuery(this), 4471 elLazy = element.find('.lazy'), 4472 elAnimation = element.attr('data-animation') || 'slide', 4473 elEasing = element.attr('data-easing') || 'swing', 4474 elDirection = element.attr('data-direction') || 'horizontal', 4475 elReverse = element.attr('data-reverse'), 4476 elSlideshow = element.attr('data-slideshow'), 4477 elPause = element.attr('data-pause') || 5000, 4478 elSpeed = element.attr('data-speed') || 600, 4479 elVideo = element.attr('data-video'), 4480 elPagi = element.attr('data-pagi'), 4481 elArrows = element.attr('data-arrows'), 4482 elArrowLeft = element.attr('data-arrow-left') || 'uil uil-angle-left-b', 4483 elArrowRight = element.attr('data-arrow-right') || 'uil uil-angle-right-b', 4484 elThumbs = element.attr('data-thumbs'), 4485 elHover = element.attr('data-hover'), 4486 elSheight = element.attr('data-smooth-height'), 4487 elTouch = element.attr('data-touch'), 4488 elUseCSS = false; 4489 4490 if( elEasing == 'swing' ) { 4491 elEasing = 'swing'; 4492 elUseCSS = true; 4493 } 4494 if( elReverse == 'true' ) { elReverse = true; } else { elReverse = false; } 4495 if( elSlideshow == "false" ) { elSlideshow = false; } else { elSlideshow = true; } 4496 if( !elVideo ) { elVideo = false; } 4497 if( elSheight == 'false' ) { elSheight = false; } else { elSheight = true; } 4498 if( elDirection == 'vertical' ) { elSheight = false; } 4499 if( elPagi == 'false' ) { elPagi = false; } else { elPagi = true; } 4500 if( elThumbs == 'true' ) { elPagi = 'thumbnails'; } else { elPagi = elPagi; } 4501 if( elArrows == 'false' ) { elArrows = false; } else { elArrows = true; } 4502 if( elHover == 'false' ) { elHover = false; } else { elHover = true; } 4503 if( elTouch == 'false' ) { elTouch = false; } else { elTouch = true; } 4504 4505 element.find('.flexslider').flexslider({ 4506 selector: ".slider-wrap > .slide", 4507 animation: elAnimation, 4508 easing: elEasing, 4509 direction: elDirection,
4510 reverse: elReverse, 4511 slideshow: elSlideshow, 4512 slideshowSpeed: Number(elPause), 4513 animationSpeed: Number(elSpeed), 4514 pauseOnHover: elHover, 4515 video: elVideo, 4516 controlNav: elPagi, 4517 directionNav: elArrows, 4518 smoothHeight: elSheight, 4519 useCSS: elUseCSS, 4520 touch: elTouch, 4521 start: function( slider ){ 4522 __modules.animations(); 4523 __modules.lightbox(); 4524 4525 jQuery('.flex-prev').html('<i class="'+ elArrowLeft +'"></i>'); 4526 jQuery('.flex-next').html('<i class="'+ elArrowRight +'"></i>'); 4527 setTimeout( function(){ 4528 if( slider.parents( '.grid-container.has-init-isotope' ).length > 0 ) { 4529 slider.parents( '.grid-container.has-init-isotope' ).isotope('layout'); 4530 } 4531 }, 1200 ); 4532 4533 if( typeof skrollrInstance !== "undefined" ) { 4534 skrollrInstance.refresh(); 4535 } 4536 }, 4537 after: function( slider ){ 4538 if( slider.parents( '.grid-container.has-init-isotope' ).length > 0 && !slider.hasClass('flexslider-grid-relayout') ) { 4539 slider.parents( '.grid-container.has-init-isotope' ).isotope('layout'); 4540 slider.addClass('flexslider-grid-relayout'); 4541 } 4542 4543 jQuery('.menu-item:visible').find('.flexslider .slide').resize(); 4544 } 4545 }); 4546 4547 // jQuery(window).on( 'lazyLoadLoaded', function(){ 4548 // if( elLazy.length == element.find('.lazy.lazy-loaded').length ) { 4549 // lazyLoadInstance.update(); 4550 // setTimeout( function() { 4551 // element.find('.flexslider .slide').resize(); 4552 // }, 500 ); 4553 // } 4554 // }); 4555 }); 4556 }); 4557 } 4558 }; 4559 }(), 4560 // FlexSlider Functions End 4561 4562 /** 4563 * -------------------------------------------------------------------------- 4564 * FullVideo Functions Start 4565 * -------------------------------------------------------------------------- 4566 */ 4567 FullVideo: function() { 4568 return { 4569 init: function(selector) { 4570 if( __core.getSelector(selector, false, false).length < 1 ){ 4571 return true; 4572 } 4573 4574 __core.initFunction({ class: 'has-plugin-html5video', event: 'pluginHtml5VideoReady' }); 4575 4576 selector = __core.getSelector( selector, false, false ); 4577 if( selector.length < 1 ){ 4578 return true; 4579 } 4580 4581 selector.forEach( function(element) { 4582 var elVideo = element.querySelector('video'), 4583 elRatio = element.getAttribute('data-ratio') || '16/9'; 4584 4585 if( !elVideo ) { 4586 return true; 4587 } 4588 4589 elRatio = elRatio.split('/'); 4590 4591 elVideo.style.left = ''; 4592 elVideo.style.top = ''; 4593 4594 var divWidth = element.offsetWidth, 4595 divHeight = element.offsetHeight, 4596 elWidth = ( Number(elRatio[0])*divHeight)/Number(elRatio[1]), 4597 elHeight = divHeight; 4598 4599 if( elWidth < divWidth ) { 4600 elWidth = divWidth; 4601 elHeight = (Number(elRatio[1])*divWidth)/Number(elRatio[0]); 4602 } 4603 4604 elVideo.style.width = elWidth + 'px'; 4605 elVideo.style.height = elHeight + 'px'; 4606 4607 if( elHeight > divHeight ) { 4608 elVideo.style.left = ''; 4609 elVideo.style.top = -( ( elHeight - divHeight )/2 ) + 'px'; 4610 } 4611 4612 if( elWidth > divWidth ) { 4613 elVideo.style.left = -( ( elWidth - divWidth )/2 ) + 'px'; 4614 elVideo.style.top = ''; 4615 } 4616 4617 if( SEMICOLON.Mobile.any() && !element.classList.contains('no-placeholder') ) { 4618 var placeholderImg = elVideo.getAttribute('poster') || elVideo.getAttribute('data-poster'); 4619 4620 if( placeholderImg != '' ) { 4621 element.innerHTML += '<div class="video-placeholder" style="background-image: url('+ placeholderImg +');"></div>'; 4622 } 4623 4624 elVideo.classList.add('d-none'); 4625 } 4626 }); 4627 4628 __core.getVars.resizers.html5video = function() { 4629 __modules.html5Video(); 4630 }; 4631 } 4632 }; 4633 }(), 4634 // FullVideo Functions End 4635 4636 /** 4637 * -------------------------------------------------------------------------- 4638 * YoutubeBG Functions Start 4639 * -------------------------------------------------------------------------- 4640 */ 4641 YoutubeBG: function() { 4642 return { 4643 init: function(selector) { 4644 if( __core.getSelector(selector, false, false).length < 1 ){ 4645 return true; 4646 } 4647 4648 __core.isFuncTrue( function() { 4649 return typeof jQuery !== 'undefined' && jQuery().YTPlayer; 4650 }).then( function(cond) { 4651 if( !cond ) { 4652 return false;
4653 } 4654 4655 __core.initFunction({ class: 'has-plugin-youtubebg', event: 'pluginYoutubeBgVideoReady' }); 4656 4657 selector = __core.getSelector( selector, true, '.mb_YTPlayer,.customjs' ); 4658 if( selector.length < 1 ){ 4659 return true; 4660 } 4661 4662 selector.each( function(){ 4663 var element = jQuery(this), 4664 elVideo = element.attr('data-video'), 4665 elMute = element.attr('data-mute') || true, 4666 elRatio = element.attr('data-ratio') || '16/9', 4667 elQuality = element.attr('data-quality') || 'hd720', 4668 elOpacity = element.attr('data-opacity') || 1, 4669 elContainer = element.attr('data-container') || 'parent', 4670 elOptimize = element.attr('data-optimize') || true, 4671 elLoop = element.attr('data-loop') || true, 4672 elControls = element.attr('data-controls') || false, 4673 elVolume = element.attr('data-volume') || 50, 4674 elStart = element.attr('data-start') || 0, 4675 elStop = element.attr('data-stop') || 0, 4676 elAutoPlay = element.attr('data-autoplay') || true, 4677 elFullScreen = element.attr('data-fullscreen') || false, 4678 elCoverImage = element.attr('data-coverimage') || '', 4679 elPauseOnBlur = element.attr('data-pauseonblur') || true, 4680 elPlayIfVisible = element.attr('data-playifvisible') || false; 4681 4682 if( elMute == 'false' ) { 4683 elMute = false; 4684 } 4685 4686 if( elContainer == 'parent' ) { 4687 var parent = element.parent(); 4688 if( parent.attr('id') ) { 4689 elContainer = '#' + parent.attr('id'); 4690 } else { 4691 var ytPid = 'yt-bg-player-parent-' + Math.floor( Math.random() * 10000 ); 4692 parent.attr( 'id', ytPid ); 4693 elContainer = '#' + ytPid; 4694 } 4695 } 4696 4697 if( elOptimize == 'false' ) { 4698 elOptimize = false; 4699 } 4700 4701 if( elLoop == 'false' ) { 4702 elLoop = false; 4703 } 4704 4705 if( elControls == 'true' ) { 4706 elControls = true; 4707 } 4708 4709 if( elAutoPlay == 'false' ) { 4710 elAutoPlay = false; 4711 } 4712 4713 if( elFullScreen == 'true' ) { 4714 elFullScreen = true; 4715 } 4716 4717 if( elPauseOnBlur == 'true' ) { 4718 elPauseOnBlur = true; 4719 } 4720 4721 if( elPlayIfVisible == 'true' ) { 4722 elPlayIfVisible = true; 4723 } 4724 4725 element.YTPlayer({ 4726 videoURL: elVideo, 4727 mute: elMute, 4728 ratio: elRatio, 4729 quality: elQuality, 4730 opacity: Number(elOpacity), 4731 containment: elContainer, 4732 optimizeDisplay: elOptimize, 4733 loop: elLoop, 4734 vol: Number(elVolume), 4735 startAt: Number(elStart), 4736 stopAt: Number(elStop), 4737 autoPlay: elAutoPlay, 4738 realfullscreen: elFullScreen, 4739 showYTLogo: false, 4740 showControls: false, 4741 coverImage: elCoverImage, 4742 stopMovieOnBlur: elPauseOnBlur, 4743 playOnlyIfVisible: elPlayIfVisible, 4744 }); 4745 }); 4746 }); 4747 } 4748 }; 4749 }(), 4750 // YoutubeBG Functions End 4751 4752 /** 4753 * -------------------------------------------------------------------------- 4754 * Toggle Functions Start 4755 * -------------------------------------------------------------------------- 4756 */ 4757 Toggle: function() { 4758 return { 4759 init: function(selector) { 4760 if( __core.getSelector(selector, false, false).length < 1 ){ 4761 return true; 4762 } 4763 4764 __core.isFuncTrue( function() { 4765 return typeof jQuery !== 'undefined'; 4766 }).then( function(cond) { 4767 if( !cond ) { 4768 return false; 4769 } 4770 4771 __core.initFunction({ class: 'has-plugin-toggles', event: 'pluginTogglesReady' }); 4772 4773 selector = __core.getSelector( selector ); 4774 if( selector.length < 1 ){ 4775 return true; 4776 } 4777 4778 selector.each( function(){ 4779 var element = jQuery(this), 4780 elSpeed = element.attr('data-speed') || 300, 4781 elState = element.attr('data-state'); 4782 4783 if( elState != 'open' ){ 4784 element.children('.toggle-content').hide(); 4785 } else { 4786 element.addClass('toggle-active').children('.toggle-content').slideDown( Number(elSpeed) ); 4787 } 4788 4789 element.children('.toggle-header').off( 'click' ).on( 'click', function(){ 4790 element.toggleClass('toggle-active').children('.toggle-content').slideToggle( Number(elSpeed) ); 4791 return true; 4792 }); 4793 }); 4794 }); 4795 } 4796 }; 4797 }(), 4798 // Toggle Functions End 4799 4800 /** 4801 * -------------------------------------------------------------------------- 4802 * Accordion Functions Start 4803 * -------------------------------------------------------------------------- 4804 */ 4805 Accordion: function() { 4806 return { 4807 init: function(selector) { 4808 if( __core.getSelector(selector, false, false).length < 1 ){ 4809 return true; 4810 } 4811 4812 __core.isFuncTrue( function() { 4813 return typeof jQuery !== 'undefined'; 4814 }).then( function(cond) { 4815 if( !cond ) { 4816 return false;
4817 } 4818 4819 __core.initFunction({ class: 'has-plugin-accordions', event: 'pluginAccordionsReady' }); 4820 4821 selector = __core.getSelector( selector ); 4822 if( selector.length < 1 ){ 4823 return true; 4824 } 4825 4826 selector.each( function(){ 4827 var element = jQuery(this), 4828 elState = element.attr('data-state'), 4829 elActive = element.attr('data-active') || 1, 4830 elActiveClass = element.attr('data-active-class') || '', 4831 elCollapsible = element.attr('data-collapsible') || 'false', 4832 windowHash = location.hash, 4833 accActive; 4834 4835 elActive = Number( elActive ) - 1; 4836 4837 if( typeof windowHash !== 'undefined' && windowHash != '' ) { 4838 accActive = element.find('.accordion-header'+ windowHash); 4839 if( accActive.length > 0 ) { 4840 elActive = accActive.index() / 2; 4841 } 4842 } 4843 4844 element.find('.accordion-content').hide(); 4845 4846 if( elState != 'closed' ) { 4847 element.find('.accordion-header:eq('+ Number(elActive) +')').addClass('accordion-active ' + elActiveClass).next().show(); 4848 } 4849 4850 element.find('.accordion-header').off( 'click' ).on( 'click', function(){ 4851 var clickTarget = jQuery(this); 4852 4853 if( clickTarget.next().is(':hidden') ) { 4854 element.find('.accordion-header').removeClass('accordion-active ' + elActiveClass).next().slideUp("normal"); 4855 clickTarget.toggleClass('accordion-active ' + elActiveClass, true).next().stop(true,true).slideDown("normal", function(){ 4856 if( ( jQuery('body').hasClass('device-sm') || jQuery('body').hasClass('device-xs') ) && element.hasClass('scroll-on-open') ) { 4857 __core.scrollTo((__core.offset(clickTarget).top - __core.getVars.topScrollOffset - 40), 800, 'easeOutQuad'); 4858 } 4859 4860 __core.runContainerModules( clickTarget.next()[0] ); 4861 }); 4862 } else { 4863 if( elCollapsible == 'true' ) { 4864 clickTarget.toggleClass('accordion-active ' + elActiveClass, false).next().stop(true,true).slideUp("normal"); 4865 } 4866 } 4867 4868 return false; 4869 }); 4870 }); 4871 }); 4872 } 4873 }; 4874 }(), 4875 // Accordion Functions End 4876 4877 /** 4878 * -------------------------------------------------------------------------- 4879 * Counter Functions Start 4880 * -------------------------------------------------------------------------- 4881 */ 4882 Counter: function() { 4883 var _run = function(elCounter, elFormat) { 4884 if( elFormat.comma == 'true' ) { 4885 var reFormat = '\\B(?=(\\d{'+ elFormat.places +'})+(?!\\d))', 4886 regExp = new RegExp( reFormat, "g" ); 4887 4888 elCounter.find('span').countTo({ 4889 formatter: function(value, options) { 4890 value = value.toFixed( options.decimals ); 4891 value = value.replace( regExp, elFormat.sep ); 4892 return value; 4893 } 4894 }); 4895 } else { 4896 elCounter.find('span').countTo(); 4897 } 4898 }; 4899 4900 return { 4901 init: function(selector) { 4902 if( __core.getSelector(selector, false, false).length < 1 ){ 4903 return true; 4904 } 4905 4906 __core.isFuncTrue( function() { 4907 return typeof jQuery !== 'undefined' && jQuery().countTo; 4908 }).then( function(cond) { 4909 if( !cond ) { 4910 return false; 4911 } 4912 4913 __core.initFunction({ class: 'has-plugin-counter', event: 'pluginCounterReady' }); 4914 4915 selector = __core.getSelector( selector ); 4916 if( selector.length < 1 ){ 4917 return true; 4918 } 4919 4920 selector.each(function(){ 4921 var element = jQuery(this), 4922 elComma = element.find('span').attr('data-comma'), 4923 elSep = element.find('span').attr('data-sep') || ',', 4924 elPlaces = element.find('span').attr('data-places') || 3; 4925 4926 var elCommaObj = { 4927 comma: elComma, 4928 sep: elSep, 4929 places: Number( elPlaces ) 4930 } 4931 4932 if( element.hasClass('counter-instant') ) { 4933 _run(element, elCommaObj); 4934 return; 4935 } 4936 4937 var observer = new IntersectionObserver( function(entries, observer) { 4938 entries.forEach( function(entry) { 4939 if (entry.isIntersecting) { 4940 _run(element, elCommaObj); 4941 observer.unobserve(entry.target); 4942 } 4943 }); 4944 }, {rootMargin: '0px 0px 50px'}); 4945 4946 observer.observe( element[0] ); 4947 }); 4948 }); 4949 } 4950 }; 4951 }(), 4952 // Counter Functions End 4953 4954 /** 4955 * -------------------------------------------------------------------------- 4956 * Countdown Functions Start 4957 * -------------------------------------------------------------------------- 4958 */ 4959 Countdown: function() { 4960 return { 4961 init: function(selector) { 4962 if( __core.getSelector(selector, false, false).length < 1 ){ 4963 return true; 4964 } 4965 4966 __core.isFuncTrue( function() { 4967 return typeof jQuery !== 'undefined' && typeof moment !== "undefined" && jQuery().countdown; 4968 }).then( function(cond) { 4969 if( !cond ) { 4970 return false;
4971 } 4972 4973 __core.initFunction({ class: 'has-plugin-countdown', event: 'pluginCountdownReady' }); 4974 4975 selector = __core.getSelector( selector ); 4976 if( selector.length < 1 ){ 4977 return true; 4978 } 4979 4980 selector.each( function(){ 4981 var element = jQuery(this), 4982 elFormat = element.attr( 'data-format' ) || 'dHMS', 4983 elSince = element.attr( 'data-since' ), 4984 elYear = element.attr( 'data-year' ), 4985 elMonth = element.attr( 'data-month' ), 4986 elDay = element.attr( 'data-day' ), 4987 elHour = element.attr( 'data-hour' ), 4988 elMin = element.attr( 'data-minute' ), 4989 elSec = element.attr( 'data-second' ), 4990 elRedirect = element.attr( 'data-redirect' ), 4991 dateFormat, setDate; 4992 4993 if( elYear ){ 4994 dateFormat = elYear; 4995 } 4996 4997 if( elMonth && elMonth < 13 ){ 4998 dateFormat = dateFormat +"-"+ ( elMonth < 10 ? '0'+elMonth : elMonth); 4999 } else { 5000 if( elYear ) { 5001 dateFormat = dateFormat +"-01"; 5002 } 5003 } 5004 5005 if( elDay && elDay < 32 ){ 5006 dateFormat = dateFormat +"-"+ ( elDay < 10 ? '0'+elDay : elDay); 5007 } else { 5008 if( elYear ) { 5009 dateFormat = dateFormat +"-01"; 5010 } 5011 } 5012 5013 setDate = dateFormat != '' ? new Date( moment( dateFormat ) ) : new Date(); 5014 5015 if( elHour && elHour < 25 ){ 5016 setDate.setHours( setDate.getHours() + Number( elHour ) ); 5017 } 5018 5019 if( elMin && elMin < 60 ){ 5020 setDate.setMinutes( setDate.getMinutes() + Number( elMin ) ); 5021 } 5022 5023 if( elSec && elSec < 60 ){ 5024 setDate.setSeconds( setDate.getSeconds() + Number( elSec ) ); 5025 } 5026 5027 if( !elRedirect ) { 5028 elRedirect = false; 5029 } 5030 5031 if( elSince == 'true' ) { 5032 element.countdown({ 5033 since: setDate, 5034 format: elFormat, 5035 expiryUrl: elRedirect, 5036 }); 5037 } else { 5038 element.countdown({ 5039 until: setDate, 5040 format: elFormat, 5041 expiryUrl: elRedirect, 5042 }); 5043 } 5044 }); 5045 }); 5046 } 5047 }; 5048 }(), 5049 // Countdown Functions End 5050 5051 /** 5052 * -------------------------------------------------------------------------- 5053 * GoogleMaps Functions Start 5054 * -------------------------------------------------------------------------- 5055 */ 5056 GoogleMaps: function() { 5057 return { 5058 init: function(selector) { 5059 if( __core.getSelector(selector, false, false).length < 1 ){ 5060 return true; 5061 } 5062 5063 if( !__core.getOptions.gmapAPI ) { 5064 console.warn( 'No API Key defined for Google Maps! Please set an API Key in js/functions.js File!' ); 5065 return true; 5066 } 5067 5068 __core.loadJS({file: 'https://maps.google.com/maps/api/js?key='+__core.getOptions.gmapAPI+"&callback=SEMICOLON.Modules.gmap", id: 'canvas-gmapapi-js'}); 5069 __core.isFuncTrue( function() { 5070 return typeof jQuery !== 'undefined' && typeof google !== "undefined" && jQuery().gMap; 5071 }).then( function(cond) { 5072 if( !cond ) { 5073 return false; 5074 } 5075 5076 __core.initFunction({ class: 'has-plugin-gmap', event: 'pluginGmapReady' }); 5077 5078 selector = __core.getSelector( selector ); 5079 if( selector.length < 1 ){ 5080 return true; 5081 } 5082 5083 selector.each( function() { 5084 var element = jQuery(this), 5085 elLat = element.attr( 'data-latitude' ), 5086 elLon = element.attr( 'data-longitude' ), 5087 elAdd = element.attr( 'data-address' ), 5088 elCon = element.attr( 'data-content' ), 5089 elScroll = element.attr( 'data-scrollwheel' ) || true, 5090 elType = element.attr( 'data-maptype' ) || 'ROADMAP', 5091 elZoom = element.attr( 'data-zoom' ) || 12, 5092 elStyles = element.attr( 'data-styles' ), 5093 elMarkers = element.attr( 'data-markers' ), 5094 elIcon = element.attr( 'data-icon' ), 5095 elConPan = element.attr( 'data-control-pan' ) || false, 5096 elConZoom = element.attr( 'data-control-zoom' )|| false, 5097 elConMapT = element.attr( 'data-control-maptype' )|| false, 5098 elConScale = element.attr( 'data-control-scale' )|| false, 5099 elConStreetV = element.attr( 'data-control-streetview' )|| false, 5100 elConOverview = element.attr( 'data-control-overview' )|| false; 5101 5102 if( elAdd ) { 5103 elLat = elLon = false;
5104 } else { 5105 if( !elLat && !elLon ) { 5106 console.log( 'Google Map co-ordinates not entered.' ); 5107 return true; 5108 } 5109 } 5110 5111 if( elStyles ) { elStyles = JSON.parse( elStyles ); } 5112 if( elScroll == 'false' ) { elScroll = false; } 5113 if( elConPan == 'true' ) { elConPan = true; } 5114 if( elConZoom == 'true' ) { elConZoom = true; } 5115 if( elConMapT == 'true' ) { elConMapT = true; } 5116 if( elConScale == 'true' ) { elConScale = true; } 5117 if( elConStreetV == 'true' ) { elConStreetV = true; } 5118 if( elConOverview == 'true' ) { elConOverview = true; } 5119 5120 if( elMarkers ) { 5121 elMarkers = Function( 'return ' + elMarkers )(); 5122 } else { 5123 if( elAdd ) { 5124 elMarkers = [ 5125 { 5126 address: elAdd, 5127 html: elCon ? elCon : elAdd 5128 } 5129 ] 5130 } else { 5131 elMarkers = [ 5132 { 5133 latitude: elLat, 5134 longitude: elLon, 5135 html: elCon ? elCon : false 5136 } 5137 ] 5138 } 5139 } 5140 5141 if( elIcon ) { 5142 elIcon = Function( 'return ' + elIcon )(); 5143 } else { 5144 elIcon = { 5145 image: "https://www.google.com/mapfiles/marker.png", 5146 shadow: "https://www.google.com/mapfiles/shadow50.png", 5147 iconsize: [20, 34], 5148 shadowsize: [37, 34], 5149 iconanchor: [9, 34], 5150 shadowanchor: [19, 34] 5151 }; 5152 } 5153 5154 element.gMap({ 5155 controls: { 5156 panControl: elConPan, 5157 zoomControl: elConZoom, 5158 mapTypeControl: elConMapT, 5159 scaleControl: elConScale, 5160 streetViewControl: elConStreetV, 5161 overviewMapControl: elConOverview 5162 }, 5163 scrollwheel: elScroll, 5164 maptype: elType, 5165 markers: elMarkers, 5166 icon: elIcon, 5167 latitude: elLat, 5168 longitude: elLon, 5169 address: elAdd, 5170 zoom: Number( elZoom ), 5171 styles: elStyles 5172 }); 5173 }); 5174 }); 5175 } 5176 }; 5177 }(), 5178 // GoogleMaps Functions End 5179 5180 /** 5181 * -------------------------------------------------------------------------- 5182 * RoundedSkills Functions Start 5183 * -------------------------------------------------------------------------- 5184 */ 5185 RoundedSkills: function() { 5186 var _run = function(element, properties) { 5187 element.easyPieChart({ 5188 size: properties.size, 5189 animate: properties.speed, 5190 scaleColor: false, 5191 trackColor: properties.trackcolor, 5192 lineWidth: properties.width, 5193 lineCap: 'square', 5194 barColor: properties.color 5195 }); 5196 }; 5197 5198 return { 5199 init: function(selector) { 5200 if( __core.getSelector(selector, false, false).length < 1 ){ 5201 return true; 5202 } 5203 5204 __core.isFuncTrue( function() { 5205 return typeof jQuery !== 'undefined' && jQuery().easyPieChart; 5206 }).then( function(cond) { 5207 if( !cond ) { 5208 return false; 5209 } 5210 5211 __core.initFunction({ class: 'has-plugin-piechart', event: 'pluginRoundedSkillReady' }); 5212 5213 selector = __core.getSelector( selector ); 5214 if( selector.length < 1 ){ 5215 return true; 5216 } 5217 5218 selector.each(function(){ 5219 var element = jQuery(this), 5220 elSize = element.attr('data-size') || 140, 5221 elSpeed = element.attr('data-speed') || 2000, 5222 elWidth = element.attr('data-width') || 4, 5223 elColor = element.attr('data-color') || '#0093BF', 5224 elTrackColor = element.attr('data-trackcolor') || 'rgba(0,0,0,0.04)'; 5225 5226 var properties = { 5227 size: Number( elSize ), 5228 speed: Number( elSpeed ), 5229 width: Number( elWidth ), 5230 color: elColor, 5231 trackcolor: elTrackColor 5232 }; 5233 5234 element.css({ 'width': elSize+'px', 'height': elSize+'px', 'line-height': elSize+'px' }); 5235 5236 if( jQuery('body').hasClass('device-up-lg') ){ 5237 element.animate({opacity:0}
5237, 10); 5238 var observer = new IntersectionObserver( function(entries, observer){ 5239 entries.forEach( function(entry){ 5240 if (entry.isIntersecting) { 5241 if (!element.hasClass('skills-animated')) { 5242 setTimeout( function(){ 5243 element.css({opacity: 1}); 5244 }, 100); 5245 5246 _run(element, properties); 5247 element.addClass('skills-animated'); 5248 } 5249 observer.unobserve( entry.target ); 5250 } 5251 }); 5252 }, {rootMargin: '0px 0px 50px'}); 5253 observer.observe( element[0] ); 5254 } else { 5255 _run(element, properties); 5256 } 5257 }); 5258 }); 5259 } 5260 }; 5261 }(), 5262 // RoundedSkills Functions End 5263 5264 /** 5265 * -------------------------------------------------------------------------- 5266 * Progress Functions Start 5267 * -------------------------------------------------------------------------- 5268 */ 5269 Progress: function() { 5270 return { 5271 init: function(selector) { 5272 if( __core.getSelector(selector, false, false).length < 1 ){ 5273 return true; 5274 } 5275 5276 __core.isFuncTrue( function() { 5277 return typeof jQuery !== 'undefined' && jQuery().countTo; 5278 }).then( function(cond) { 5279 5280 __core.initFunction({ class: 'has-plugin-progress', event: 'pluginProgressReady' }); 5281 5282 selector = __core.getSelector( selector, false ); 5283 if( selector.length < 1 ){ 5284 return true; 5285 } 5286 5287 selector.forEach( function(element) { 5288 var elValue = element.getAttribute('data-percent') || 90, 5289 elSpeed = element.getAttribute('data-speed') || 1200, 5290 elBar = element.querySelector('.skill-progress-percent'); 5291 5292 elSpeed = Number(elSpeed) + 'ms'; 5293 5294 elBar.style.setProperty( '--cnvs-progress-speed', elSpeed ); 5295 5296 var observer = new IntersectionObserver( function(entries, observer){ 5297 entries.forEach( function(entry) { 5298 if (entry.isIntersecting) { 5299 if (!elBar.classList.contains('skill-animated')) { 5300 __modules.counter(element.querySelector('.counter')); 5301 5302 if ( element.classList.contains('skill-progress-vertical') ) { 5303 elBar.style.height = elValue + "%"; 5304 elBar.classList.add('skill-animated'); 5305 } else { 5306 elBar.style.width = elValue + "%"; 5307 elBar.classList.add('skill-animated'); 5308 } 5309 } 5310 5311 observer.unobserve( entry.target ); 5312 } 5313 }); 5314 }, {rootMargin: '0px 0px 50px'}); 5315 5316 observer.observe( elBar ); 5317 }); 5318 }); 5319 } 5320 }; 5321 }(), 5322 // Progress Functions End 5323 5324 /** 5325 * -------------------------------------------------------------------------- 5326 * Twitter Functions Start 5327 * -------------------------------------------------------------------------- 5328 */ 5329 Twitter: function() { 5330 var _build = function(tweet, element, username) { 5331 var elFontClass = element.getAttribute('data-font-class') || 'font-body'; 5332 5333 var status = tweet.text.replace(/((https?|s?ftp|ssh)\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!])/g, function(url) { 5334 return '<a href="'+url+'" target="_blank">'+url+'</a>'; 5335 }).replace(/\B@([_a-z0-9]+)/ig, function(reply) { 5336 return reply.charAt(0)+'<a href="https://twitter.com/'+reply.substring(1)+'" target="_blank">'+reply.substring(1)+'</a>'; 5337 }); 5338 5339 if( element.classList.contains('fslider') ) { 5340 var slide = document.createElement('div'); 5341 slide.classList.add('slide'); 5342 slide.innerHTML += '<p class="mb-3 '+elFontClass+'">'+status+'</p><small class="d-block"><a href="https://twitter.com/'+username+'/statuses/'+tweet.id_str+'" target="_blank">'+_time(tweet.created_at)+'</a></small>'; 5343 element.querySelector('.slider-wrap').append(slide); 5344 } else { 5345 element.innerHTML += '<li><i class="fa-brands fa-x-twitter"></i><div><span>'+status+'</span><small><a href="https://twitter.com/'+username+'/statuses/'+tweet.id_str+'" target="_blank">'+_time(tweet.created_at)+'</a></small></div></li>'; 5346 } 5347 } 5348 5349 var _time = function(time_value) { 5350 var parsed_date = new Date(time_value); 5351 var relative_to = new Date(); 5352 var delta = parseInt((relative_to.getTime() - parsed_date) / 1000); 5353 delta = delta + (relative_to.getTimezoneOffset() * 60); 5354 5355 if (delta < 60) { 5356 return 'less than a minute ago'; 5357 } else if(delta < 120) { 5358 return 'about a minute ago'; 5359 } else if(delta < (60*60)) { 5360 return (parseInt(delta / 60)).toString() + ' minutes ago'; 5361 } else if(delta < (120*60)) { 5362 return 'about an hour ago'; 5363 } else if(delta < (24*60*60)) { 5364 return 'about ' + (parseInt(delta / 3600)).toString() + ' hours ago'; 5365 } else if(delta < (48*60*60)) { 5366 return '1 day ago'; 5367 } else { 5368 return (parseInt(delta / 86400)).toString() + ' days ago'; 5369 } 5370 } 5371 5372 return { 5373 init: function(selector) { 5374 if( __core.getSelector(selector, false, false).length < 1 ){ 5375 return true; 5376 } 5377 5378 __core.initFunction({ class: 'has-plugin-twitter', event: 'pluginTwitterFeedReady' }); 5379 5380 selector = __core.getSelector( selector, false, false ); 5381 if( selector.length < 1 ){ 5382 return true; 5383 } 5384 5385 selector.forEach( function(element) { 5386 var elUser = element.getAttribute('data-username') || 'twitter', 5387 elCount = element.getAttribute('data-count') || 3, 5388 elLoader = element.getAttribute('data-loader') || 'include/twitter/tweets.php', 5389 elFetch = element.getAttribute('data-fetch-message') || 'Fetching Tweets from Twitter...'; 5390 5391 var alert = element.querySelector('.twitter-widget-alert'); 5392 5393 if( !alert ) { 5394 alert = document.createElement('div'); 5395 alert.classList.add( 'alert', 'alert-warning', 'twitter-widget-alert', 'text-center' );
5396 element.prepend(alert); 5397 alert.innerHTML = '<div class="spinner-grow spinner-grow-sm me-2" role="status"><span class="visually-hidden">Loading...</span></div> ' + elFetch; 5398 } 5399 5400 fetch( elLoader + '?username='+ elUser ).then( function(response) { 5401 return response.json(); 5402 }).then( function(tweets) { 5403 if( typeof tweets === 'object' && !tweets.isArray() ) { 5404 return false; 5405 } 5406 5407 alert.remove(); 5408 var i = 0; 5409 tweets?.some( function(tw) { 5410 if( i == Number(elCount) ) { 5411 return; 5412 } 5413 5414 _build(tw, element, elUser); 5415 i++; 5416 }); 5417 5418 if( element.classList.contains('fslider') ) { 5419 var timer = setInterval( function() { 5420 if( element.querySelectorAll('.slide').length > 1 ) { 5421 element.classList.remove('customjs'); 5422 5423 setTimeout( function() { 5424 __modules.flexSlider(); 5425 jQuery(element).find( '.flexslider .slide' ).resize(); 5426 }, 500); 5427 5428 clearInterval(timer); 5429 } 5430 }, 1000); 5431 } 5432 }).catch( function(err) { 5433 console.log(err); 5434 alert.classList.remove( 'alert-warning' ); 5435 alert.classList.add( 'alert-danger' ); 5436 alert.innerHTML = 'Could not fetch Tweets from Twitter API. Please try again later.'; 5437 }); 5438 }); 5439 } 5440 }; 5441 }(), 5442 // Twitter Functions End 5443 5444 /** 5445 * -------------------------------------------------------------------------- 5446 * Flickr Functions Start 5447 * -------------------------------------------------------------------------- 5448 */ 5449 Flickr: function() { 5450 return { 5451 init: function(selector) { 5452 if( __core.getSelector(selector, false, false).length < 1 ){ 5453 return true; 5454 } 5455 5456 __core.isFuncTrue( function() { 5457 return typeof jQuery !== 'undefined' && jQuery().jflickrfeed; 5458 }).then( function(cond) { 5459 if( !cond ) { 5460 return false; 5461 } 5462 5463 __core.initFunction({ class: 'has-plugin-flickr', event: 'pluginFlickrFeedReady' }); 5464 5465 selector = __core.getSelector( selector, true, false ); 5466 if( selector.length < 1 ){ 5467 return true; 5468 } 5469 5470 selector.each(function() { 5471 var element = jQuery(this), 5472 elID = element.attr('data-id'), 5473 elCount = element.attr('data-count') || 9, 5474 elType = element.attr('data-type'), 5475 elTypeGet = 'photos_public.gne'; 5476 5477 if( elType == 'group' ) { elTypeGet = 'groups_pool.gne'; } 5478 5479 element.jflickrfeed({ 5480 feedapi: elTypeGet, 5481 limit: Number(elCount), 5482 qstrings: { 5483 id: elID 5484 }, 5485 itemTemplate: '<a class="grid-item" href="{{image_b}}" title="{{title}}" data-lightbox="gallery-item">' + 5486 '<img src="{{image_s}}" alt="{{title}}" />' + 5487 '</a>' 5488 }, function(data) { 5489 element.removeClass('customjs'); 5490 __core.imagesLoaded(element[0]); 5491 __modules.lightbox(); 5492 5493 element[0].addEventListener( 'CanvasImagesLoaded', function() { 5494 __modules.gridInit(); 5495 __modules.masonryThumbs(); 5496 }); 5497 }); 5498 }); 5499 }); 5500 } 5501 }; 5502 }(), 5503 // Flickr Functions End 5504 5505 /** 5506 * -------------------------------------------------------------------------- 5507 * Instagram Functions Start 5508 * -------------------------------------------------------------------------- 5509 */ 5510 Instagram: function() { 5511 var _get = function(element, loader, limit, fetchAlert) { 5512 var alert = element.closest('.instagram-widget-alert'); 5513 5514 if( !alert ) { 5515 alert = document.createElement('div'); 5516 alert.classList.add( 'alert', 'alert-warning', 'instagram-widget-alert', 'text-center' ); 5517 element.insertAdjacentElement( 'beforebegin', alert ); 5518 alert.innerHTML = '<div class="spinner-grow spinner-grow-sm me-2" role="status"><span class="visually-hidden">Loading...</span></div> ' + fetchAlert; 5519 } 5520 5521 fetch(loader).then( function(response) { 5522 return response.json(); 5523 }).then( function(images) { 5524 if( images.length > 0 ) { 5525 alert.remove(); 5526 for (var i = 0; i < limit; i++) { 5527 if ( i === limit ) 5528 continue; 5529 5530 var photo = images[i], 5531 thumb = photo.media_url; 5532 if( photo.media_type === 'VIDEO' ) { 5533 thumb = photo.thumbnail_url; 5534 } 5535 5536 element.innerHTML += '<a class="grid-item" href="'+ photo.permalink +'" target="_blank"><img src="'+ thumb +'" alt="Image"></a>'; 5537 } 5538 } 5539 5540 element.classList.remove('customjs'); 5541 __core.imagesLoaded(element); 5542 5543 element.addEventListener( 'CanvasImagesLoaded', function() { 5544 __modules.masonryThumbs(); 5545 __modules.lightbox(); 5546 }); 5547 }).catch( function(err) { 5548 console.log(err); 5549 alert.classList.remove( 'alert-warning' ); 5550 alert.classList.add( 'alert-danger' ); 5551 alert.innerHTML = 'Could not fetch Photos from Instagram API. Please try again later.'; 5552 }); 5553 }; 5554 5555 return { 5556 init: function(selector) { 5557 if( __core.getSelector(selector, false, false).length < 1 ){ 5558 return true; 5559 } 5560 5561 __core.initFunction({ class: 'has-plugin-instagram', event: 'pluginInstagramReady' }); 5562 5563 selector = __core.getSelector( selector, false, false ); 5564 if( selector.length < 1 ){ 5565 return true; 5566 } 5567 5568 selector.forEach( function(element) { 5569 var elLimit = element.getAttribute('data-count') || 12, 5570 elLoader = element.getAttribute('data-loader') || 'include/instagram/instagram.php', 5571 elFetch = element.getAttribute('data-fetch-message') || 'Fetching Photos from Instagram...'; 5572 5573 if( Number( elLimit ) > 12 ) { 5574 elLimit = 12; 5575 } 5576 5577 _get(element, elLoader, elLimit, elFetch); 5578 }); 5579 } 5580 }; 5581 }(), 5582 // Instagram Functions End 5583 5584 /** 5585 * -------------------------------------------------------------------------- 5586 * NavTree Functions Start 5587 * -------------------------------------------------------------------------- 5588 */ 5589 NavTree: function() { 5590 return { 5591 init: function(selector) { 5592 if( __core.getSelector(selector, false, false).length < 1 ){ 5593 return true; 5594 } 5595 5596 __core.isFuncTrue( function() { 5597 return typeof jQuery !== 'undefined'; 5598 }).then( function(cond) { 5599 if( !cond ) { 5600 return false;
5601 } 5602 5603 __core.initFunction({ class: 'has-plugin-navtree', event: 'pluginNavTreeReady' }); 5604 5605 selector = __core.getSelector( selector ); 5606 if( selector.length < 1 ){ 5607 return true; 5608 } 5609 5610 selector.each( function(){ 5611 var element = jQuery(this), 5612 elSpeed = element.attr('data-speed') || 250, 5613 elEasing = element.attr('data-easing') || 'swing', 5614 elArrow = element.attr('data-arrow-class') || 'fa-solid fa-angle-right'; 5615 5616 element.find( 'ul li:has(ul)' ).addClass('sub-menu'); 5617 element.find( 'ul li:has(ul) > a' ).filter(':not(:has(.sub-menu-indicator))').append( '<i class="sub-menu-indicator '+ elArrow +'"></i>' ); 5618 5619 if( element.hasClass('on-hover') ){ 5620 element.find( 'ul li:has(ul):not(.active)' ).hover( function(e){ 5621 jQuery(this).children('ul').stop(true, true).slideDown( Number(elSpeed), elEasing); 5622 }, function(){ 5623 jQuery(this).children('ul').delay(250).slideUp( Number(elSpeed), elEasing); 5624 }); 5625 } else { 5626 element.find( 'ul li:has(ul) > a' ).off( 'click' ).on( 'click', function(){ 5627 var childElement = jQuery(this); 5628 5629 element.find( 'ul li' ).not(childElement.parents()).removeClass('active'); 5630 5631 childElement.parent().children('ul').slideToggle( Number(elSpeed), elEasing, function(){ 5632 jQuery(this).find('ul').hide(); 5633 jQuery(this).find('li.active').removeClass('active'); 5634 }); 5635 5636 element.find( 'ul li > ul' ).not(childElement.parent().children('ul')).not(childElement.parents('ul')).slideUp( Number(elSpeed), elEasing ); 5637 childElement.parent('li:has(ul)').toggleClass('active'); 5638 5639 return true; 5640 }); 5641 } 5642 }); 5643 }); 5644 } 5645 }; 5646 }(), 5647 // NavTree Functions End 5648 5649 /** 5650 * -------------------------------------------------------------------------- 5651 * Carousel Functions Start 5652 * -------------------------------------------------------------------------- 5653 */ 5654 Carousel: function() { 5655 return { 5656 init: function(selector) { 5657 if( __core.getSelector(selector, false, false).length < 1 ){ 5658 return true; 5659 } 5660 5661 __core.isFuncTrue( function() { 5662 return typeof jQuery !== 'undefined' && jQuery().owlCarousel; 5663 }).then( function(cond) { 5664 if( !cond ) { 5665 return false; 5666 } 5667 5668 __core.initFunction({ class: 'has-plugin-carousel', event: 'pluginCarouselReady' }); 5669 5670 selector = __core.getSelector( selector ); 5671 if( selector.length < 1 ){ 5672 return true; 5673 } 5674 5675 selector.each( function(){ 5676 var element = jQuery(this), 5677 elItems = element.attr('data-items') || 4, 5678 elItemsXs = element.attr('data-items-xs') || Number( elItems ), 5679 elItemsSm = element.attr('data-items-sm') || Number( elItemsXs ), 5680 elItemsMd = element.attr('data-items-md') || Number( elItemsSm ), 5681 elItemsLg = element.attr('data-items-lg') || Number( elItemsMd ), 5682 elItemsXl = element.attr('data-items-xl') || Number( elItemsLg ), 5683 elItemsXxl = element.attr('data-items-xxl') || Number( elItemsXl ), 5684 elLoop = element.attr('data-loop'), 5685 elAutoPlay = element.attr('data-autoplay'), 5686 elSpeed = element.attr('data-speed') || 250, 5687 elAnimateIn = element.attr('data-animate-in'), 5688 elAnimateOut = element.attr('data-animate-out'), 5689 elAutoWidth = element.attr('data-auto-width'), 5690 elNav = element.attr('data-nav'), 5691 elNavPrev = element.attr('data-nav-prev') || '<i class="uil uil-angle-left-b"></i>', 5692 elNavNext = element.attr('data-nav-next') || '<i class="uil uil-angle-right-b"></i>', 5693 elPagi = element.attr('data-pagi'), 5694 elMargin = element.attr('data-margin') || 20, 5695 elStage = element.attr('data-stage-padding') || 0, 5696 elMerge = element.attr('data-merge'), 5697 elStart = element.attr('data-start') || 0, 5698 elRewind = element.attr('data-rewind'), 5699 elSlideBy = element.attr('data-slideby') || 1, 5700 elCenter = element.attr('data-center'), 5701 elLazy = element.attr('data-lazyload'), 5702 elVideo = element.attr('data-video'), 5703 elRTL = element.attr('data-rtl'), 5704 elAutoPlayTime = 5000, 5705 elAutoPlayHoverP = true; 5706 5707 if( elSlideBy == 'page' ) { 5708 elSlideBy = 'page'; 5709 } else { 5710 elSlideBy = Number(elSlideBy); 5711 } 5712 5713 if( elLoop == 'true' ){ elLoop = true; } else { elLoop = false; } 5714 if( !elAutoPlay ){ 5715 elAutoPlay = false;
5716 elAutoPlayHoverP = false; 5717 } else { 5718 elAutoPlayTime = Number(elAutoPlay); 5719 elAutoPlay = true; 5720 } 5721 if( !elAnimateIn ) { elAnimateIn = false; } 5722 if( !elAnimateOut ) { elAnimateOut = false; } 5723 if( elAutoWidth == 'true' ){ elAutoWidth = true; } else { elAutoWidth = false; } 5724 if( elNav == 'false' ){ elNav = false; } else { elNav = true; } 5725 if( elPagi == 'false' ){ elPagi = false; } else { elPagi = true; } 5726 if( elRewind == 'true' ){ elRewind = true; } else { elRewind = false; } 5727 if( elMerge == 'true' ){ elMerge = true; } else { elMerge = false; } 5728 if( elCenter == 'true' ){ elCenter = true; } else { elCenter = false; } 5729 if( elLazy == 'true' ){ elLazy = true; } else { elLazy = false; } 5730 if( elVideo == 'true' ){ elVideo = true; } else { elVideo = false; } 5731 if( elRTL == 'true' || jQuery('body').hasClass('rtl') ){ elRTL = true; } else { elRTL = false; } 5732 5733 var carousel = element.owlCarousel({ 5734 margin: Number(elMargin), 5735 loop: elLoop, 5736 stagePadding: Number(elStage), 5737 merge: elMerge, 5738 startPosition: Number(elStart), 5739 rewind: elRewind, 5740 slideBy: elSlideBy, 5741 center: elCenter, 5742 lazyLoad: elLazy, 5743 autoWidth: elAutoWidth, 5744 nav: elNav, 5745 navText: [elNavPrev,elNavNext], 5746 autoplay: elAutoPlay, 5747 autoplayTimeout: elAutoPlayTime, 5748 autoplayHoverPause: elAutoPlayHoverP, 5749 dots: elPagi, 5750 smartSpeed: Number(elSpeed), 5751 fluidSpeed: Number(elSpeed), 5752 video: elVideo, 5753 animateIn: elAnimateIn, 5754 animateOut: elAnimateOut, 5755 rtl: elRTL, 5756 responsive:{ 5757 0:{ items: elItemsXs }, 5758 576:{ items: elItemsSm }, 5759 768:{ items: elItemsMd }, 5760 992:{ items: elItemsLg }, 5761 1200:{ items: elItemsXl }, 5762 1400:{ items: elItemsXxl } 5763 }, 5764 onInitialized: function(){ 5765 __base.sliderDimensions(element.parents('.slider-element')[0]); 5766 __core.runContainerModules(element[0]); 5767 5768 if( element.find('.owl-dot').length > 0 ) { 5769 element.addClass('with-carousel-dots'); 5770 } 5771 } 5772 }); 5773 5774 jQuery(window).on( 'lazyLoadLoaded', function(){ 5775 if( element.find('.lazy').length == element.find('.lazy.lazy-loaded').length ) { 5776 lazyLoadInstance.update(); 5777 setTimeout( function(){ 5778 carousel.trigger( 'refresh.owl.carousel' ); 5779 }, 500); 5780 } 5781 }); 5782 }); 5783 }); 5784 } 5785 }; 5786 }(), 5787 // Carousel Functions End 5788 5789 /** 5790 * -------------------------------------------------------------------------- 5791 * MasonryThumbs Functions Start 5792 * -------------------------------------------------------------------------- 5793 */ 5794 MasonryThumbs: function() { 5795 return { 5796 init: function(selector) { 5797 if( __core.getSelector(selector, false, false).length < 1 ){ 5798 return true; 5799 } 5800 5801 __core.isFuncTrue( function() { 5802 return typeof jQuery !== 'undefined' && typeof Isotope !== 'undefined'; 5803 }).then( function(cond) { 5804 if( !cond ) { 5805 return false; 5806 } 5807 5808 __core.initFunction({ class: 'has-plugin-masonrythumbs', event: 'pluginMasonryThumbsReady' }); 5809 5810 selector = __core.getSelector( selector ); 5811 if( selector.length < 1 ){ 5812 return true; 5813 } 5814 5815 selector.each( function() { 5816 var element = jQuery(this), 5817 elChildren = element.children(), 5818 elBig = element.attr('data-big'); 5819 5820 if( elChildren.length < 1 ) { 5821 return false; 5822 } 5823
5824 elChildren.removeClass('grid-item-big').css({ 'width': '' }); 5825 5826 var compStyle = window.getComputedStyle( elChildren.eq(0)[0] ); 5827 var firstElementWidth = Number(compStyle.getPropertyValue('width').split('px')[0]); 5828 5829 if( element.filter('.has-init-isotope').length > 0 ) { 5830 element.isotope({ 5831 masonry: { 5832 columnWidth: firstElementWidth 5833 } 5834 }); 5835 } 5836 5837 if( elBig ) { 5838 elBig = elBig.split(","); 5839 5840 var elBigNum = '', 5841 bigi = ''; 5842 5843 for( bigi = 0; bigi < elBig.length; bigi++ ){ 5844 elBigNum = Number(elBig[bigi]) - 1; 5845 elChildren.eq(elBigNum).addClass('grid-item-big'); 5846 } 5847 } 5848 5849 setTimeout( function() { 5850 element.find('.grid-item-big').css({ width: (firstElementWidth * 2) + 'px' }); 5851 }, 500); 5852 5853 setTimeout( function() { 5854 element.filter('.has-init-isotope').isotope( 'layout' ); 5855 }, 1000); 5856 5857 element[0].addEventListener( 'transitionend', function() { 5858 __modules.readmore(); 5859 }); 5860 }); 5861 5862 __core.getVars.resizers.masonryThumbs = function() { 5863 __modules.masonryThumbs(); 5864 }; 5865 }); 5866 } 5867 }; 5868 }(), 5869 // MasonryThumbs Functions End 5870 5871 /** 5872 * -------------------------------------------------------------------------- 5873 * Notifications Functions Start 5874 * -------------------------------------------------------------------------- 5875 */ 5876 Notifications: function() { 5877 return { 5878 init: function(selector) { 5879 if( __core.getSelector(selector, false, false).length < 1 ){ 5880 return true; 5881 } 5882 5883 __core.isFuncTrue( function() { 5884 return typeof jQuery !== 'undefined' && typeof bootstrap !== "undefined"; 5885 }).then( function(cond) { 5886 if( !cond ) { 5887 return false; 5888 } 5889 5890 __core.initFunction({ class: 'has-plugin-notify', event: 'pluginNotifyReady' }); 5891 5892 selector = __core.getSelector( selector ); 5893 if( selector.length < 1 ){ 5894 return true; 5895 } 5896 5897 var element = selector, 5898 elPosition = element.attr('data-notify-position') || 'top-right', 5899 elType = element.attr('data-notify-type'), 5900 elMsg = element.attr('data-notify-msg') || 'Please set a message!', 5901 elTimeout = element.attr('data-notify-timeout') || 5000, 5902 elClose = element.attr('data-notify-close') || 'true', 5903 elAutoHide = element.attr('data-notify-autohide') || 'true', 5904 elId = 'toast-' + Math.floor( Math.random() * 10000 ), 5905 elTrigger = element.attr('data-notify-trigger') || 'self', 5906 elTarget = element.attr('data-notify-target'), 5907 elCloseHtml = '', 5908 elPosClass, elTypeClass, elCloseClass; 5909 5910 if( jQuery(elTarget).length > 0 && elTrigger == 'self' ) { 5911 var toast = bootstrap.Toast.getOrCreateInstance(jQuery(elTarget).get(0)); 5912 toast.hide(); 5913 5914 jQuery(elTarget).get(0).addEventListener('hidden.bs.toast', function() { 5915 CNVS.Notifications.init( selector ); 5916 }); 5917 } 5918 5919 switch( elType ){ 5920 5921 case 'primary': 5922 elTypeClass = 'text-white bg-primary border-0'; 5923 break; 5924 5925 case 'warning': 5926 elTypeClass = 'text-dark bg-warning border-0'; 5927 break; 5928 5929 case 'error': 5930 elTypeClass = 'text-white bg-danger border-0'; 5931 break; 5932 5933 case 'success': 5934 elTypeClass = 'text-white bg-success border-0'; 5935 break; 5936 5937 case 'info': 5938 elTypeClass = 'bg-info text-dark border-0'; 5939 break; 5940 5941 case 'dark': 5942 elTypeClass = 'text-white bg-dark border-0'; 5943 break; 5944 5945 default: 5946 elTypeClass = ''; 5947 break; 5948 } 5949 5950 switch( elPosition ){ 5951 5952 case 'top-left': 5953 elPosClass = 'top-0 start-0'; 5954 break; 5955 5956 case 'top-center': 5957 elPosClass = 'top-0 start-50 translate-middle-x'; 5958 break; 5959 5960 case 'middle-left': 5961 elPosClass = 'top-50 start-0 translate-middle-y'; 5962 break; 5963 5964 case 'middle-center': 5965 elPosClass = 'top-50 start-50 translate-middle'; 5966 break; 5967 5968 case 'middle-right': 5969 elPosClass = 'top-50 end-0 translate-middle-y'; 5970 break; 5971 5972 case 'bottom-left': 5973 elPosClass = 'bottom-0 start-0'; 5974 break; 5975 5976 case 'bottom-center': 5977 elPosClass = 'bottom-0 start-50 translate-middle-x'; 5978 break; 5979 5980 case 'bottom-right': 5981 elPosClass = 'bottom-0 end-0'; 5982 break; 5983 5984 default: 5985 elPosClass = 'top-0 end-0'; 5986 break; 5987 } 5988 5989 if( elType == 'info' || elType == 'warning' || !elType ) { 5990 elCloseClass = ''; 5991 } else { 5992 elCloseClass = 'btn-close-white'; 5993 } 5994 5995 if( elClose == 'true' ) { 5996 elCloseHtml = '<button type="button" class="btn-close '+ elCloseClass +' btn-sm me-2 mt-2 ms-auto" data-bs-dismiss="toast" aria-label="Close"></button>'; 5997 } 5998 5999 if( elAutoHide != 'true' ) { 6000 elAutoHide = false;
6001 } else { 6002 elAutoHide = true; 6003 } 6004 6005 let elTemplate = '<div class="position-fixed '+ elPosClass +' p-3" style="z-index: 999999;">'+ 6006 '<div id="'+ elId +'" class="toast p-2 hide '+ elTypeClass +'" role="alert" aria-live="assertive" aria-atomic="true">'+ 6007 '<div class="d-flex">'+ 6008 '<div class="toast-body">'+ 6009 elMsg + 6010 '</div>'+ 6011 elCloseHtml + 6012 '</div>'+ 6013 '</div>'; 6014 '</div>'; 6015 6016 if( elTrigger == 'self' ) { 6017 if( !elTarget ) { 6018 element.attr( 'data-notify-target', '#'+elId ); 6019 jQuery('body').append( elTemplate ); 6020 } 6021 } 6022 6023 var toastElList = [].slice.call(document.querySelectorAll('.toast')); 6024 var toastList = toastElList.map( function(toastEl) { 6025 return new bootstrap.Toast(toastEl); 6026 }); 6027 6028 toastList.forEach( function(toast) { 6029 toast.hide(); 6030 }); 6031 6032 var toastElement = element.attr('data-notify-target'), 6033 toastInstance = jQuery(toastElement), 6034 elMsgOld = toastInstance.find('.toast-body'); 6035 6036 if( jQuery(toastElement).length > 0 ) { 6037 var toast = new bootstrap.Toast( toastInstance.get(0) ,{ 6038 delay: Number(elTimeout), 6039 autohide: elAutoHide, 6040 }); 6041 6042 toast.show(); 6043 6044 if( elTrigger == 'self' ) { 6045 toastInstance.get(0).addEventListener('hidden.bs.toast', function() { 6046 toastInstance.parent().remove(); 6047 element.get(0).removeAttribute( 'data-notify-target' ); 6048 }); 6049 } 6050 } 6051 6052 return false; 6053 6054 }); 6055 } 6056 }; 6057 }(), 6058 // Notifications Functions End 6059 6060 /** 6061 * -------------------------------------------------------------------------- 6062 * TextRotator Functions Start 6063 * -------------------------------------------------------------------------- 6064 */ 6065 TextRotator: function() { 6066 return { 6067 init: function(selector) { 6068 if( __core.getSelector(selector, false, false).length < 1 ){ 6069 return true; 6070 } 6071 6072 __core.isFuncTrue( function() { 6073 return typeof jQuery !== 'undefined' && jQuery().Morphext && typeof Typed !== 'undefined'; 6074 }).then( function(cond) { 6075 if( !cond ) { 6076 return false; 6077 } 6078 6079 __core.initFunction({ class: 'has-plugin-textrotator', event: 'pluginTextRotatorReady' }); 6080 6081 selector = __core.getSelector( selector ); 6082 if( selector.length < 1 ){ 6083 return true; 6084 } 6085 6086 selector.each( function(){ 6087 var element = jQuery(this), 6088 elTyped = element.attr('data-typed') || 'false', 6089 elRotator = element.find('.t-rotate'), 6090 elAnimation = element.attr('data-rotate') || 'fade', 6091 elSpeed = element.attr('data-speed') || 1200, 6092 elSep = element.attr('data-separator') || ','; 6093 6094 if( elTyped == 'true' ) { 6095 var elTexts = elRotator.html().split( elSep ), 6096 elLoop = element.attr('data-loop') || 'true', 6097 elShuffle = element.attr('data-shuffle'), 6098 elCur = element.attr('data-cursor') || 'true', 6099 elSpeed = element.attr('data-speed') || 50, 6100 elBackSpeed = element.attr('data-backspeed') || 30, 6101 elBackDelay = element.attr('data-backdelay'); 6102 6103 if( elLoop == 'true' ) { elLoop = true; } else { elLoop = false; } 6104 if( elShuffle == 'true' ) { elShuffle = true; } else { elShuffle = false; } 6105 if( elCur == 'true' ) { elCur = true; } else { elCur = false; } 6106 6107 elRotator.html( '' ).addClass('plugin-typed-init'); 6108 6109 var typed = new Typed( elRotator[0], { 6110 strings: elTexts, 6111 typeSpeed: Number( elSpeed ), 6112 loop: elLoop, 6113 shuffle: elShuffle, 6114 showCursor: elCur, 6115 backSpeed: Number( elBackSpeed ), 6116 backDelay: Number( elBackDelay ) 6117 }); 6118 } else { 6119 var pluginData = elRotator.Morphext({ 6120 animation: elAnimation, 6121 separator: elSep, 6122 speed: Number(elSpeed) 6123 }); 6124 } 6125 }); 6126 }); 6127 } 6128 }; 6129 }(), 6130 // TextRotator Functions End 6131 6132 /** 6133 * -------------------------------------------------------------------------- 6134 * OnePage Functions Start 6135 * -------------------------------------------------------------------------- 6136 */ 6137 OnePage: function() { 6138 var _init = function(selector) { 6139 _hash(); 6140 6141 if( __core.getVars.elLinkScrolls ) {
6142 __core.getVars.elLinkScrolls.forEach( function(el) { 6143 _getSettings( el, 'scrollTo' ); 6144 6145 el.onclick = function(e) { 6146 e.preventDefault(); 6147 6148 _scroller( el, 'scrollTo', true ); 6149 }; 6150 }); 6151 } 6152 6153 if( __core.getVars.elOnePageMenus ) { 6154 __core.getVars.elOnePageMenus.forEach( function(onePageMenu) { 6155 __core.getVars.elOnePageActiveClass = onePageMenu.getAttribute('data-active-class') || 'current'; 6156 __core.getVars.elOnePageParentSelector = onePageMenu.getAttribute('data-parent') || 'li'; 6157 __core.getVars.elOnePageActiveOnClick = onePageMenu.getAttribute('data-onclick-active') || 'false'; 6158 6159 onePageMenu.querySelectorAll('[data-href]').forEach( function(el) { 6160 _getSettings( el, 'onePage' ); 6161 6162 el.onclick = function(e) { 6163 e.preventDefault(); 6164 6165 _scroller( el, 'onePage', true ); 6166 }; 6167 }); 6168 }); 6169 } 6170 }; 6171 6172 var _hash = function() { 6173 if( __core.getOptions.scrollExternalLinks != true ) { 6174 return false; 6175 } 6176 6177 if( document.querySelector('a[data-href="'+ __core.getVars.hash +'"]') || document.querySelector('a[data-scrollto="'+ __core.getVars.hash +'"]') ) { 6178 window.onbeforeunload = function() { 6179 __core.scrollTo(0, 0, false, 'auto'); 6180 }; 6181 6182 __core.scrollTo(0, 0, false, 'auto'); 6183 6184 var section = document.querySelector(__core.getVars.hash); 6185 6186 if( section ) { 6187 var int = setInterval( function() { 6188 var settings = section.getAttribute('data-onepage-settings') && JSON.parse( section.getAttribute('data-onepage-settings') ); 6189 6190 if( settings ) { 6191 _scroll(section, settings, 0); 6192 clearInterval(int); 6193 } 6194 }, 250); 6195 } 6196 } 6197 }; 6198 6199 var _getSection = function(el, type) { 6200 var anchor; 6201 6202 if( type == 'scrollTo' ) { 6203 anchor = el.getAttribute('data-scrollto'); 6204 } else { 6205 anchor = el.getAttribute('data-href'); 6206 } 6207 6208 var section = document.querySelector( anchor ); 6209 6210 return section; 6211 }; 6212 6213 var _getSettings = function(el, type) { 6214 var section = _getSection(el, type); 6215 6216 if( !section ) { 6217 return false; 6218 } 6219 6220 section.removeAttribute('data-onepage-settings'); 6221 6222 var settings = _settings( section, el ); 6223 6224 setTimeout( function() { 6225 if( !section.hasAttribute('data-onepage-settings') ) { 6226 section.setAttribute( 'data-onepage-settings', JSON.stringify( settings ) ); 6227 } 6228 6229 __core.getVars.pageSectionEls = document.querySelectorAll('[data-onepage-settings]'); 6230 }, 1000); 6231 }; 6232 6233 var _scroller = function(el, type, clicker = false) { 6234 var section = _getSection(el, type), 6235 sectionId = section.getAttribute('id'), 6236 settings; 6237 6238 if( !section ) { 6239 return false; 6240 } 6241 6242 if( clicker == true ) { 6243 settings = _settings(section, el, false); 6244 } else { 6245 settings = JSON.parse(section.getAttribute('data-onepage-settings')); 6246 } 6247 6248 if( type != 'scrollTo' && __core.getVars.elOnePageActiveOnClick == 'true' ) { 6249 parent = el.closest('.one-page-menu'); 6250 6251 parent.querySelectorAll(__core.getVars.elOnePageParentSelector).forEach( function(el) { 6252 el.classList.remove( __core.getVars.elOnePageActiveClass ); 6253 }); 6254 6255 parent.querySelector('a[data-href="#' + sectionId + '"]').closest(__core.getVars.elOnePageParentSelector).classList.add( __core.getVars.elOnePageActiveClass ); 6256 } 6257 6258 if( !__core.getVars.elBody.classList.contains('is-expanded-menu') || __core.getVars.elBody.classList.contains('overlay-menu') ) { 6259 __core.getVars.recalls.menureset(); 6260 } 6261 6262 _scroll(section, settings, 250); 6263 }; 6264 6265 var _scroll = function(section, settings, timeout) { 6266 setTimeout( function() { 6267 var sectionOffset = __core.offset(section).top; 6268 6269 if( !settings ) { 6270 return false; 6271 } 6272 6273 __core.scrollTo((sectionOffset - Number(settings.offset)), settings.speed, settings.easing); 6274 }, Number(timeout)); 6275 }; 6276 6277 var _position = function() { 6278 __core.getVars.elOnePageMenus && __core.getVars.elOnePageMenus.forEach( function(el) { 6279 el.querySelectorAll('[data-href]').forEach( function(item) { 6280 item.closest(__core.getVars.elOnePageParentSelector).classList.remove( __core.getVars.elOnePageActiveClass ); 6281 }); 6282 }); 6283 6284 __core.getVars.elOnePageMenus && __core.getVars.elOnePageMenus.forEac
6284h( function(el) { 6285 el.querySelector('[data-href="#' + _current() + '"]')?.closest(__core.getVars.elOnePageParentSelector).classList.add( __core.getVars.elOnePageActiveClass ); 6286 }); 6287 }; 6288 6289 var _current = function() { 6290 var currentOnePageSection; 6291 6292 if( typeof __core.getVars.pageSectionEls === 'undefined' ) { 6293 return true; 6294 } 6295 6296 __core.getVars.pageSectionEls.forEach( function(el) { 6297 var settings = el.getAttribute('data-onepage-settings') && JSON.parse( el.getAttribute('data-onepage-settings') ); 6298 6299 if( settings ) { 6300 var h = __core.offset(el).top - settings.offset - 5, 6301 y = window.scrollY; 6302 6303 if( ( y >= h ) && ( y < h + el.offsetHeight ) && el.getAttribute('id') != currentOnePageSection && el.getAttribute('id') ) { 6304 currentOnePageSection = el.getAttribute('id'); 6305 } 6306 } 6307 }); 6308 6309 return currentOnePageSection; 6310 }; 6311 6312 var _settings = function(section, element, json=true) { 6313 var body = __core.getVars.elBody.classList; 6314 6315 if( typeof section === 'undefined' || element.length < 1 ) { 6316 return true; 6317 } 6318 6319 if( section.hasAttribute('data-onepage-settings') && json ) { 6320 return true; 6321 } 6322 6323 var defaults = { 6324 offset: __core.getVars.topScrollOffset, 6325 speed: 1250, 6326 easing: false 6327 }; 6328 6329 var settings = {}, 6330 parentSettings = {}, 6331 parent = element.closest( '.one-page-menu' ); 6332 6333 parentSettings.offset = parent?.getAttribute( 'data-offset' ) || defaults.offset; 6334 parentSettings.speed = parent?.getAttribute( 'data-speed' ) || defaults.speed; 6335 parentSettings.easing = parent?.getAttribute( 'data-easing' ) || defaults.easing; 6336 6337 var elementSettings = { 6338 offset: element.getAttribute( 'data-offset' ) || parentSettings.offset, 6339 speed: element.getAttribute( 'data-speed' ) || parentSettings.speed, 6340 easing: element.getAttribute( 'data-easing' ) || parentSettings.easing, 6341 }; 6342 6343 var elOffsetXXL = element.getAttribute( 'data-offset-xxl' ), 6344 elOffsetXL = element.getAttribute( 'data-offset-xl' ), 6345 elOffsetLG = element.getAttribute( 'data-offset-lg' ), 6346 elOffsetMD = element.getAttribute( 'data-offset-md' ), 6347 elOffsetSM = element.getAttribute( 'data-offset-sm' ), 6348 elOffsetXS = element.getAttribute( 'data-offset-xs' ); 6349 6350 if( !elOffsetXS ) { 6351 elOffsetXS = Number(elementSettings.offset); 6352 } 6353 6354 if( !elOffsetSM ) { 6355 elOffsetSM = Number(elOffsetXS); 6356 } 6357 6358 if( !elOffsetMD ) { 6359 elOffsetMD = Number(elOffsetSM); 6360 } 6361 6362 if( !elOffsetLG ) { 6363 elOffsetLG = Number(elOffsetMD); 6364 } 6365 6366 if( !elOffsetXL ) { 6367 elOffsetXL = Number(elOffsetLG); 6368 } 6369 6370 if( !elOffsetXXL ) { 6371 elOffsetXXL = Number(elOffsetXL); 6372 } 6373 6374 if( body.contains('device-xs') ) { 6375 elementSettings.offset = elOffsetXS; 6376 } else if( body.contains('device-sm') ) { 6377 elementSettings.offset = elOffsetSM; 6378 } else if( body.contains('device-md') ) { 6379 elementSettings.offset = elOffsetMD; 6380 } else if( body.contains('device-lg') ) { 6381 elementSettings.offset = elOffsetLG; 6382 } else if( body.contains('device-xl') ) { 6383 elementSettings.offset = elOffsetXL; 6384 } else if( body.contains('device-xxl') ) { 6385 elementSettings.offset = elOffsetXXL; 6386 } 6387 6388 settings.offset = Number(elementSettings.offset); 6389 settings.speed = Number(elementSettings.speed); 6390 settings.easing = elementSettings.easing; 6391 6392 return settings; 6393 }; 6394 6395 return { 6396 init: function(selector) { 6397 if( __core.getSelector(selector, false, false).length < 1 ){ 6398 return true; 6399 } 6400 6401 __core.initFunction({ class: 'has-plugin-onepage', event: 'pluginOnePageReady' }); 6402 6403 selector = __core.getSelector( selector, false ); 6404 if( selector.length < 1 ){ 6405 return true; 6406 } 6407 6408 var scrollToLinks = __core.filtered( selector, '[data-scrollto]' ), 6409 onePageLinks = __core.filtered( selector, '.one-page-menu' ); 6410 6411 if( scrollToLinks.length > 0 ) { 6412 __core.getVars.elLinkScrolls = scrollToLinks; 6413 } 6414 6415 if( onePageLinks.length > 0 ) { 6416 __core.getVars.elOnePageMenus = onePageLinks; 6417 } 6418 6419 _init(selector); 6420 _position(); 6421 6422 window.addEventListener('scroll', function(){ 6423 _position(); 6424 }, {passive:true}); 6425 6426 __core.getVars.resizers.onepage = function() { 6427 _init(selector); 6428 _position(); 6429 }; 6430 } 6431 }; 6432 }(), 6433 // OnePage Functions End 6434 6435 /** 6436 * -------------------------------------------------------------------------- 6437 * AjaxForm Functions Start 6438 * -------------------------------------------------------------------------- 6439 */ 6440 AjaxForm: function() { 6441 return { 6442 init: function(selector) { 6443 if( __core.getSelector(selector, false, false).length < 1 ){ 6444 return true; 6445 } 6446 6447 __core.isFuncTrue( function() {
6448 return typeof jQuery !== 'undefined' && jQuery().validate && jQuery().ajaxSubmit; 6449 }).then( function(cond) { 6450 if( !cond ) { 6451 return false; 6452 } 6453 6454 __core.initFunction({ class: 'has-plugin-form', event: 'pluginFormReady' }); 6455 6456 selector = __core.getSelector( selector ); 6457 if( selector.length < 1 ){ 6458 return true; 6459 } 6460 6461 selector.each( function(){ 6462 var element = jQuery(this), 6463 $body = jQuery('body'), 6464 elForm = element.find('form'), 6465 elFormId = elForm.attr('id'), 6466 elAlert = element.attr('data-alert-type'), 6467 elLoader = element.attr('data-loader'), 6468 elResult = element.find('.form-result'), 6469 elRedirect = element.attr('data-redirect'), 6470 defaultBtn, alertType; 6471 6472 if( !elAlert ) { 6473 elAlert = 'notify'; 6474 } 6475 6476 if( elFormId ) { 6477 $body.addClass( elFormId + '-ready' ); 6478 } 6479 6480 element.find('form').validate({ 6481 errorPlacement: function(error, elementItem) { 6482 if( elementItem.parents('.form-group').length > 0 ) { 6483 error.appendTo( elementItem.parents('.form-group') ); 6484 } else { 6485 error.insertAfter( elementItem ); 6486 } 6487 }, 6488 focusCleanup: true, 6489 submitHandler: function(form) { 6490 if( element.hasClass( 'custom-submit' ) ) { 6491 jQuery(form).submit(); 6492 return true; 6493 } 6494 6495 elResult.hide(); 6496 6497 if( elLoader == 'button' ) { 6498 defaultBtn = jQuery(form).find('button'); 6499 defaultBtnText = defaultBtn.html(); 6500 6501 defaultBtn.html('<i class="bi-arrow-repeat icon-spin m-0"></i>'); 6502 } else { 6503 jQuery(form).find('.form-process').fadeIn(); 6504 } 6505 6506 if( elFormId ) { 6507 $body.removeClass( elFormId + '-ready ' + elFormId + '-complete ' + elFormId + '-success ' + elFormId + '-error' ).addClass( elFormId + '-processing' ); 6508 } 6509 6510 jQuery(form).ajaxSubmit({ 6511 target: elResult, 6512 dataType: 'json', 6513 success: function(data) { 6514 if( elLoader == 'button' ) { 6515 defaultBtn.html( defaultBtnText ); 6516 } else { 6517 jQuery(form).find('.form-process').fadeOut(); 6518 } 6519 6520 if( data.alert != 'error' && elRedirect ){ 6521 window.location.replace( elRedirect ); 6522 return true; 6523 } 6524 6525 if( elAlert == 'inline' ) { 6526 if( data.alert == 'error' ) { 6527 alertType = 'alert-danger'; 6528 } else { 6529 alertType = 'alert-success'; 6530 } 6531 6532 elResult.removeClass( 'alert-danger alert-success' ).addClass( 'alert ' + alertType ).html( data.message ).slideDown( 400 ); 6533 } else if( elAlert == 'notify' ) { 6534 elResult.attr( 'data-notify-type', data.alert ).attr( 'data-notify-msg', data.message ).html(''); 6535 __modules.notifications(elResult); 6536 } 6537 6538 if( data.alert != 'error' ) { 6539 jQuery(form).resetForm(); 6540 jQuery(form).find('.btn-group > .btn').removeClass('active'); 6541 6542 if( (typeof tinyMCE != 'undefined') && tinyMCE.activeEditor && !tinyMCE.activeEditor.isHidden() ){ 6543 tinymce.activeEditor.setContent(''); 6544 } 6545 6546 var rangeSlider = jQuery(form).find('.input-range-slider'); 6547 if( rangeSlider.length > 0 ) { 6548 rangeSlider.each( function(){ 6549 var range = jQuery(this).data('ionRangeSlider'); 6550 range.reset(); 6551 }); 6552 } 6553 6554 var ratings = jQuery(form).find('.input-rating'); 6555 if( ratings.length > 0 ) { 6556 ratings.each( function(){ 6557 jQuery(this).rating('reset'); 6558 }); 6559 } 6560 6561 var selectPicker = jQuery(form).find('.selectpicker'); 6562 if( selectPicker.length > 0 ) { 6563 selectPicker.each( function(){ 6564 jQuery(this).selectpicker('val', ''); 6565 jQuery(this).selectpicker('deselectAll'); 6566 }); 6567 } 6568 6569 jQuery(form).find('.input-select2,select[data-selectsplitter-firstselect-selector]').change(); 6570 6571 jQuery(form).trigger( 'formSubmitSuccess', data ); 6572 $body.removeClass( elFormId + '-error' ).addClass( elFormId + '-success' ); 6573 } else { 6574 jQuery(form).trigger( 'formSubmitError', data ); 6575 $body.removeClass( elFormId + '-success' ).addClass( elFormId + '-error' ); 6576 } 6577 6578 if( elFormId ) { 6579 $body.removeClass( elFormId + '-processing' ).addClass( elFormId + '-complete' ); 6580 } 6581 6582 if( jQuery(form).find('.g-recaptcha').children('div').length > 0 ) { 6583 grecaptcha.reset(); 6584 } 6585 } 6586 }); 6587 } 6588 }); 6589 6590 }); 6591 }); 6592 } 6593 }; 6594 }(), 6595 // AjaxForm Functions End 6596 6597 /** 6598 * -------------------------------------------------------------------------- 6599 * Subscribe Functions Start 6600 * -------------------------------------------------------------------------- 6601 */ 6602 Subscribe: function() { 6603 return { 6604 init: function(selector) { 6605 if( __core.getSelector(selector, false, false).length < 1 ){ 6606 return true; 6607 } 6608 6609 __core.isFuncTrue( function() {
6610 return typeof jQuery !== 'undefined' && jQuery().validate && jQuery().ajaxSubmit; 6611 }).then( function(cond) { 6612 if( !cond ) { 6613 return false; 6614 } 6615 6616 __core.initFunction({ class: 'has-plugin-form', event: 'pluginFormReady' }); 6617 6618 selector = __core.getSelector( selector ); 6619 if( selector.length < 1 ){ 6620 return true; 6621 } 6622 6623 selector.each( function(){ 6624 var element = jQuery(this), 6625 elAlert = element.attr('data-alert-type'), 6626 elLoader = element.attr('data-loader'), 6627 elResult = element.find('.widget-subscribe-form-result'), 6628 elRedirect = element.attr('data-redirect'), 6629 defButton, defButtonText, alertType; 6630 6631 element.find('form').validate({ 6632 submitHandler: function(form) { 6633 6634 elResult.hide(); 6635 6636 if( elLoader == 'button' ) { 6637 defButton = jQuery(form).find('button'); 6638 defButtonText = defButton.html(); 6639 6640 defButton.html('<i class="bi-arrow-repeat icon-spin nomargin"></i>'); 6641 } else { 6642 jQuery(form).find('.bi-envelope-plus').removeClass('bi-envelope-plus').addClass('bi-arrow-repeat icon-spin'); 6643 } 6644 6645 jQuery(form).ajaxSubmit({ 6646 target: elResult, 6647 dataType: 'json', 6648 resetForm: true, 6649 success: function(data) { 6650 if( elLoader == 'button' ) { 6651 defButton.html( defButtonText ); 6652 } else { 6653 jQuery(form).find('.bi-arrow-repeat').removeClass('bi-arrow-repeat icon-spin').addClass('bi-envelope-plus'); 6654 } 6655 if( data.alert != 'error' && elRedirect ){ 6656 window.location.replace( elRedirect ); 6657 return true; 6658 } 6659 if( elAlert == 'inline' ) { 6660 if( data.alert == 'error' ) { 6661 alertType = 'alert-danger'; 6662 } else { 6663 alertType = 'alert-success'; 6664 } 6665 6666 elResult.addClass( 'alert ' + alertType ).html( data.message ).slideDown( 400 ); 6667 } else { 6668 elResult.attr( 'data-notify-type', data.alert ).attr( 'data-notify-msg', data.message ).html(''); 6669 __modules.notifications(elResult); 6670 } 6671 } 6672 }); 6673 } 6674 }); 6675 6676 }); 6677 }); 6678 } 6679 }; 6680 }(), 6681 // Subscribe Functions End 6682 6683 /** 6684 * -------------------------------------------------------------------------- 6685 * Conditional Functions Start 6686 * -------------------------------------------------------------------------- 6687 */ 6688 Conditional: function() { 6689 var _eval = function(field, value, conditions, check, target) { 6690 if( ! field || ! conditions ) { 6691 return false; 6692 } 6693 6694 var fulfilled = false; 6695 6696 if( check == 'validate' ) { 6697 if( value ) { 6698 if ( target.getAttribute('aria-invalid') == 'false' ) { 6699 fulfilled = true; 6700 } else { 6701 fulfilled = false; 6702 } 6703 } 6704 } else { 6705 switch( conditions.operator ) { 6706 case '==': 6707 if( value == conditions.value ) { 6708 fulfilled = true; 6709 } 6710 break; 6711 6712 case '!=': 6713 if( value != conditions.value ) { 6714 fulfilled = true; 6715 } 6716 break; 6717 6718 case '>': 6719 if( value > conditions.value ) { 6720 fulfilled = true; 6721 } 6722 break; 6723 6724 case '<': 6725 if( value < conditions.value ) { 6726 fulfilled = true; 6727 } 6728 break; 6729 6730 case '<=': 6731 if( value <= conditions.value ) { 6732 fulfilled = true; 6733 } 6734 break; 6735 6736 case '>=': 6737 if( value >= conditions.value ) { 6738 fulfilled = true; 6739 } 6740 break; 6741 6742 case 'in': 6743 if( conditions.value.includes( value ) ) { 6744 fulfilled = true; 6745 } 6746 break; 6747 6748 default: 6749 fulfilled = false; 6750 break; 6751 } 6752 } 6753 6754 if( fulfilled ) { 6755 field.classList.add('condition-fulfilled'); 6756 field.querySelectorAll('input,select,textarea,button').forEach( function(el) { 6757 el.disabled = false; 6758 }); 6759 } else { 6760 field.classList.remove('condition-fulfilled'); 6761 field.querySelectorAll('input,select,textarea,button').forEach( function(el) { 6762 el.disabled = true; 6763 }); 6764 } 6765 }; 6766 6767 return { 6768 init: function(selector) { 6769 if( __core.getSelector(selector, false, false).length < 1 ){ 6770 return true; 6771 } 6772 6773 __core.initFunction({ class: 'has-plugin-conditional', event: 'pluginConditionalReady' }); 6774 6775 selector = __core.getSelector( selector, false ); 6776 if( selector.length < 1 ){ 6777 return true; 6778 } 6779 6780 selector.forEach( function(el) { 6781 var field = el, 6782 condition = field.getAttribute( 'data-condition' ) || '==', 6783 conditionTarget = field.getAttribute( 'data-condition-target' ), 6784 conditionValue = field.getAttribute( 'data-condition-value' ), 6785 conditionCheck = field.getAttribute( 'data-condition-check' ) || 'value', 6786 target = document.querySelector('[id*="'+conditionTarget+'"]'), 6787 value = target.value, 6788 targetType = target.type, 6789 eventType; 6790 6791 var conditions = { 6792 operator: condition, 6793 field: conditionTarget, 6794 value: conditionValue 6795 } 6796 6797 var targetTag = target.tagName.toLowerCase(); 6798 6799 if( targetType == 'checkbox' || targetTag == 'select' || targetType == 'radio' ) { 6800 eventType = 'change'; 6801 } else { 6802 eventType = 'input'; 6803 } 6804 6805 if( targetType == 'checkbox' ) { 6806 value = target.checked ? target.value : 0; 6807 } 6808 6809 if( targetType == 'radio' ) { 6810 value = target.checked ? target.value : ''; 6811 } 6812 6813 _eval(field, value, conditions, conditionCheck, target); 6814 6815 target.addEventListener( eventType, function() { 6816 if( targetType == 'checkbox' ) { 6817 value = target.checked ? target.value : 0; 6818 } else if( targetType == 'radio' ) { 6819 value = target.checked ? target.value : ''; 6820 } else { 6821 value = target.value; 6822 } 6823 6824 _eval(field, value, conditions, conditionCheck, target); 6825 }); 6826 6827 if( conditionCheck == 'validate' ) { 6828 var mutationObserver = new MutationObserver( function(mutations) { 6829 mutations.forEach( function(mutation) { 6830 _eval(field, value, conditions, conditionCheck, target); 6831 }); 6832 }); 6833 6834 mutationObserver.observe( target, { 6835 attributes: true, 6836 characterData: true, 6837 childList: true, 6838 subtree: true, 6839 attributeOldValue: true, 6840 characterDataOldValue: true 6841 }); 6842 } 6843 }); 6844 } 6845 }; 6846 }(), 6847 // Conditional Functions End 6848 6849 /** 6850 * -------------------------------------------------------------------------- 6851 * ShapeDivider Functions Start 6852 * -------------------------------------------------------------------------- 6853 */ 6854 ShapeDivider: function() { 6855 return { 6856 init: function(selector) { 6857 if( __core.getSelector(selector, false, false).length < 1 ){ 6858 return true; 6859 } 6860 6861 __core.initFunction({ class: 'has-plugin-shapedivider', event: 'pluginShapeDividerReady' }); 6862 6863 selector = __core.getSelector( selector, false ); 6864 if( selector.length < 1 ){ 6865 return true; 6866 } 6867 6868 selector.forEach( function(element) { 6869 var elShape = element.getAttribute('data-shape') || 'valley', 6870 elWidth = element.getAttribute('data-width') || 100, 6871 elHeight = element.getAttribute('data-height') || 100, 6872 elFill = element.getAttribute('data-fill'), 6873 elOut = element.getAttribute('data-outside') || 'false', 6874 elPos = element.getAttribute('data-position') || 'top',
6875 elId = 'shape-divider-' + Math.floor( Math.random() * 10000 ), 6876 shape = '', 6877 width, height, fill, 6878 outside = ''; 6879 6880 if( element.classList.contains('shape-divider-complete') ) { 6881 return true; 6882 } 6883 6884 if( elWidth < 100 ) { 6885 elWidth = 100; 6886 } 6887 6888 width = 'width: calc( '+ Number( elWidth ) +'% + 1.5px );'; 6889 height = 'height: '+ Number( elHeight ) +'px;'; 6890 fill = 'fill: '+elFill+';'; 6891 6892 if( elOut == 'true' ) { 6893 if( elPos == 'bottom' ) { 6894 outside = '#'+ elId +'.shape-divider { bottom: -'+( Number( elHeight ) - 1 ) +'px; } '; 6895 } else { 6896 outside = '#'+ elId +'.shape-divider { top: -'+( Number( elHeight ) - 1 ) +'px; } '; 6897 } 6898 } 6899 6900 var css = outside + '#'+ elId +'.shape-divider svg { '+ width + height +' } #'+ elId +'.shape-divider .shape-divider-fill { '+ fill +' }', 6901 style = document.createElement('style'); 6902 6903 __core.getVars.elHead.appendChild(style); 6904 6905 style.appendChild(document.createTextNode(css)); 6906 6907 element.setAttribute( 'id', elId ); 6908 6909 switch(elShape){ 6910 case 'valley': 6911 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 355" preserveAspectRatio="none"><defs><style>.b{opacity:.5}.c{opacity:.3}</style></defs><path fill="none" d="M999.45 0H0v165.72l379.95 132.46L999.45 0z"></path><path class="b shape-divider-fill" d="M379.95 298.18l28.47 9.92L1000 118.75V0h-.55l-619.5 298.18zM492.04 337.25L1000 252.63V118.75L408.42 308.1l83.62 29.15z"></path><path class="b shape-divider-fill" d="M492.04 337.25L1000 252.63V118.75L408.42 308.1l83.62 29.15z"></path><path class="shape-divider-fill" d="M530.01 350.49l20.22 4.51H1000V252.63l-507.96 84.62 37.97 13.24z"></path><path class="b shape-divider-fill" d="M530.01 350.49l20.22 4.51H1000V252.63l-507.96 84.62 37.97 13.24z"></path><path class="b shape-divider-fill" d="M530.01 350.49l20.22 4.51H1000V252.63l-507.96 84.62 37.97 13.24z"></path><path class="shape-divider-fill" d="M542.94 355h7.29l-20.22-4.51 12.93 4.51z"></path><path class="b shape-divider-fill" d="M542.94 355h7.29l-20.22-4.51 12.93 4.51z"></path><path class="c shape-divider-fill" d="M542.94 355h7.29l-20.22-4.51 12.93 4.51z"></path><path class="b shape-divider-fill" d="M542.94 355h7.29l-20.22-4.51 12.93 4.51z"></path><path class="c shape-divider-fill" d="M379.95 298.18L0 165.72v66.59l353.18 78.75 26.77-12.88z"></path><path class="c shape-divider-fill" d="M353.18 311.06L0 232.31v71.86l288.42 38.06 64.76-31.17z"></path><path class="c shape-divider-fill" d="M353.18 311.06L0 232.31v71.86l288.42 38.06 64.76-31.17z"></path><path class="b shape-divider-fill" d="M380.28 317.11l28.14-9.01-28.47-9.92-26.77 12.88 27.1 6.05z"></path><path class="c shape-divider-fill" d="M380.28 317.11l28.14-9.01-28.47-9.92-26.77 12.88 27.1 6.05z"></path><path class="b shape-divider-fill" d="M479.79 339.29l12.25-2.04-83.62-29.15-28.14 9.01 99.51 22.18z"></path><path class="b shape-divider-fill" d="M479.79 339.29l12.25-2.04-83.62-29.15-28.14 9.01 99.51 22.18z"></path><path class="c shape-divider-fill" d="M479.79 339.29l12.25-2.04-83.62-29.15-28.14 9.01 99.51 22.18z"></path><path class="shape-divider-fill" d="M530.01 350.49l-37.97-13.24-12.25 2.04 50.22 11.2z"></path><path class="b shape-divider-fill" d="M530.01 350.49l-37.97-13.24-12.25 2.04 50.22 11.2z"></path><path class="b shape-divider-fill" d="M530.01 350.49l-37.97-13.24-12.25 2.04 50.22 11.2z"></path><path class="c shape-divider-fill" d="M530.01 350.49l-37.97-13.24-12.25 2.04 50.22 11.2zM288.42 342.23l9.46 1.25 82.4-26.37-27.1-6.05-64.76 31.17z"></path><path class="b shape-divider-fill" d="M288.42 342.23l9.46 1.25 82.4-26.37-27.1-6.05-64.76 31.17z"></path><path class="c shape-divider-fill" d="M288.42 342.23l9.46 1.25 82.4-26.37-27.1-6.05-64.76 31.17z"></path><path class="b shape-divider-fill" d="M380.28 317.11l-82.4 26.37 87.3 11.52h.34l94.27-15.71-99.51-22.18z"></path><path class="c shape-divider-fill" d="M380.28 317.11l-82.4 26.37 87.3 11.52h.34l94.27-15.71-99.51-22.18z"></path><path class="b shape-divider-fill" d="M380.28 317.11l-82.4 26.37 87.3 11.52h.34l94.27-15.71-99.51-22.18z"></path><path class="c shape-divider-fill" d="M380.28 317.11l-82.4 26.37 87.3 11.52h.34l94.27-15.71-99.51-22.18z"></path><path class="shape-divider-fill" d="M479.79 339.29L385.52 355h157.42l-12.93-4.51-50.22-11.2z"></path><path class="b shape-divider-fill" d="M479.79 339.29L385.52 355h157.42l-12.93-4.51-50.22-11.2z"></path><path class="c shape-divider-fill" d="M479.79 339.29L385.52 355h157.42l-12.93-4.51-50.22-11.2z"></path><path class="b shape-divider-fill" d="M479.79 339.29L385.52 355h157.42l-12.93-4.51-50.22-11.2z"></path><path class="c shape-divider-fill" d="M479.79 339.29L385.52 355h157.42l-12.93-4.51-50.22-11.2z"></path><path class="shape-divider-fill" d="M288.42 342.23L0 304.17V355h385.18l-87.3-11.52-9.46-1.25z"></path></svg>'; 6912 break; 6913 6914 case 'valley-2': 6915 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none"><path class="shape-divider-fill" d="M194,99c186.7,0.7,305-78.3,306-97.2c1,18.9,119.3,97.9,306,97.2c114.3-0.3,194,0.3,194,0.3s0-91.7,0-100c0,0,0,0,0-0 L0,0v99.3C0,99.3,79.7,98.7,194,99z"></path></svg>'; 6916 break; 6917 6918 case 'valley-3': 6919 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 140" preserveAspectRatio="none"><path class="shape-divider-fill" d="M1280 0L640 70 0 0v140l640-70 640 70V0z" opacity="0.5"></path><path class="shape-divider-fill" d="M1280 0H0l640 70 640-70z"></path></svg>'; 6920 break; 6921 6922 case 'mountain': 6923 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none"><path class="shape-divider-fill" d="M500,98.9L0,6.1V0h1000v6.1L500,98.9z"></path></svg>'; 6924 break; 6925 6926 case 'mountain-2': 6927 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 140" preserveAspectRatio="none"><path class="shape-divider-fill" d="M640 140L1280 0H0z" opacity="0.5"/><path class="shape-divider-fill" d="M640 98l640-98H0z"/></svg>'; 6928 break; 6929 6930 case 'mountain-3': 6931 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 491.58" preserveAspectRatio="none"><g style="isolation:isolate"><path class="shape-divider-fill" d="M1000 479.4v-87.96L500 0 0 391.46v87.96l500-335.94 500 335.92z" opacity="0.12" mix-blend-mode="overlay"/><path class="shape-divider-fill" d="M1000 487.31v-7.91L500 143.48 0 479.42v7.91l500-297.96 500 297.94z" op
6931acity="0.25" mix-blend-mode="overlay"/><path class="shape-divider-fill" d="M1000 487.31L500 189.37 0 487.33v4.25h1000v-4.27z"/></g></svg>'; 6932 break; 6933 6934 case 'mountain-4': 6935 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none"><path class="shape-divider-fill" d="M738,99l262-93V0H0v5.6L738,99z"></path></svg>'; 6936 break; 6937 6938 case 'mountain-5': 6939 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 140" preserveAspectRatio="none"><path class="shape-divider-fill" d="M978.81 122.25L0 0h1280l-262.1 116.26a73.29 73.29 0 0 1-39.09 5.99z" opacity="0.5"></path><path class="shape-divider-fill" d="M983.19 95.23L0 0h1280l-266 91.52a72.58 72.58 0 0 1-30.81 3.71z"></path></svg>'; 6940 break; 6941 6942 case 'mountains': 6943 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none"><path class="shape-divider-fill" opacity="0.33" d="M473,67.3c-203.9,88.3-263.1-34-320.3,0C66,119.1,0,59.7,0,59.7V0h1000v59.7 c0,0-62.1,26.1-94.9,29.3c-32.8,3.3-62.8-12.3-75.8-22.1C806,49.6,745.3,8.7,694.9,4.7S492.4,59,473,67.3z"></path><path class="shape-divider-fill" opacity="0.66" d="M734,67.3c-45.5,0-77.2-23.2-129.1-39.1c-28.6-8.7-150.3-10.1-254,39.1 s-91.7-34.4-149.2,0C115.7,118.3,0,39.8,0,39.8V0h1000v36.5c0,0-28.2-18.5-92.1-18.5C810.2,18.1,775.7,67.3,734,67.3z"></path><path class="shape-divider-fill" d="M766.1,28.9c-200-57.5-266,65.5-395.1,19.5C242,1.8,242,5.4,184.8,20.6C128,35.8,132.3,44.9,89.9,52.5C28.6,63.7,0,0,0,0 h1000c0,0-9.9,40.9-83.6,48.1S829.6,47,766.1,28.9z"></path></svg>'; 6944 break; 6945 6946 case 'mountains-2': 6947 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 247" preserveAspectRatio="none"><path class="shape-divider-fill" d="M0 200.92v.26l.75-.77-.75.51z"></path><path class="shape-divider-fill" d="M279.29 208.39c0-4.49 74.71-29.88 74.71-29.88l61.71 61.26L550 153.1l134.14 88.17L874.28 50 1000 178.51v-.33L874.28 0 684.14 191.27 550 103.1l-134.29 86.67L354 128.51s-74.71 25.39-74.71 29.88S144.23 52.08 144.23 52.08L.75 200.41l143.48-98.33s135.06 110.8 135.06 106.31z" opacity="0.25" isolation="isolate"></path><path class="shape-divider-fill" d="M1000 178.51L874.28 50 684.14 241.27 550 153.1l-134.29 86.67L354 178.51s-74.71 25.39-74.71 29.88-135.06-106.31-135.06-106.31L.75 200.41l-.75.77V247h1000z"></path><path class="shape-divider-fill" d="M1000 178.51L874.28 50 684.14 241.27 550 153.1l-134.29 86.67L354 178.51s-74.71 25.39-74.71 29.88-135.06-106.31-135.06-106.31L.75 200.41l-.75.77V247h1000z" opacity="0.25" isolation="isolate"></path></svg>'; 6948 break; 6949 6950 case 'mountains-3': 6951 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none"><path class="shape-divider-fill" d="M761.9,44.1L643.1,27.2L333.8,98L0,3.8V0l1000,0v3.9"></path></svg>'; 6952 break; 6953 6954 case 'mountains-4': 6955 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 140" preserveAspectRatio="none"><path class="shape-divider-fill" d="M0 90.72l140-28.28 315.52 24.14L796.48 65.8 1140 104.89l140-14.17V0H0v90.72z" opacity="0.5"></path><path class="shape-divider-fill" d="M0 0v47.44L170 0l626.48 94.89L1110 87.11l170-39.67V0H0z"></path></svg>'; 6956 break; 6957 6958 case 'plataeu': 6959 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 140" preserveAspectRatio="none"><path class="shape-divider-fill" d="M1280 0l-131.81 111.68c-16.47 14-35.47 21-54.71 20.17L173 94a76.85 76.85 0 0 1-36.79-11.46L0 0z"></path></svg>'; 6960 break; 6961 6962 case 'plataeu-2': 6963 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 140" preserveAspectRatio="none"><path class="shape-divider-fill" d="M1093.48 131.85L173 94a76.85 76.85 0 0 1-36.79-11.46L0 0h1280l-131.81 111.68c-16.47 13.96-35.47 20.96-54.71 20.17z" opacity="0.5"></path><path class="shape-divider-fill" d="M1094.44 119L172.7 68.72a74.54 74.54 0 0 1-25.19-5.95L0 0h1280l-133.85 102c-15.84 12.09-33.7 17.95-51.71 17z"></path></svg>'; 6964 break; 6965 6966 case 'hills': 6967 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 140" preserveAspectRatio="none"><path class="shape-divider-fill" d="M156.258 127.903l86.363-18.654 78.684
696713.079L411.441 99.4l94.454 10.303L582.82 93.8l82.664 18.728 76.961-11.39L816.109 71.4l97.602 9.849L997.383 50.4l66.285 14.694 70.793-24.494h79.863L1280 0H0v122.138l60.613 9.965z"/></svg>'; 6968 break; 6969 6970 case 'hills-2': 6971 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 140" preserveAspectRatio="none"><path class="shape-divider-fill" d="M1214.323 66.051h-79.863l-70.793 18.224-66.285-10.933-83.672 22.953-97.601-7.328-73.664 22.125-76.961 8.475-82.664-13.934-76.926 11.832-94.453-7.666-90.137 17.059-78.684-9.731-86.363 13.879-95.644 3.125L0 126.717V0h1280l-.001 35.844z" opacity="0.5"></path><path class="shape-divider-fill" d="M0 0h1280v.006l-70.676 36.578-74.863 4.641-70.793 23.334-66.285-11.678-83.672 29.618-97.602-7.07-63.664 21.421-76.961 12.649-91.664-20.798-77.926 17.66-94.453-7.574-90.137 21.595-78.683-9.884-86.363 16.074-95.645 6.211L0 127.905z"></path></svg>'; 6972 break; 6973 6974 case 'hills-3': 6975 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 140" preserveAspectRatio="none"><path class="shape-divider-fill" d="M156 35.51l95.46 34.84 120.04.24 71.5 33.35 90.09-3.91L640 137.65l102.39-37.17 85.55 10.65 88.11-7.19L992 65.28l73.21 5.31 66.79-22.1 77-.42L1280 0H0l64.8 38.69 91.2-3.18z"/>
6975</svg>'; 6976 break; 6977 6978 case 'hills-4': 6979 shape = '<svg viewBox="0 0 1280 140" preserveAspectRatio="none"><path class="shape-divider-fill" d="M156 35.41l95.46 34.73 120.04.25 71.5 33.24 90.09-3.89L640 137.25l102.39-37.06 85.55 10.61 88.11-7.17L992 65.08l73.21 5.31L1132 48.35l77-.42L1280 0H0l64.8 38.57 91.2-3.16z" opacity="0.5"/><path class="shape-divider-fill" d="M156 28.32l95.46 27.79 120.04.2L443 82.9l90.09-3.11L640 109.8l102.39-29.65 85.55 8.49 88.11-5.74L992 52.07l73.21 4.24L1132 38.68l77-.34L1280 0H0l64.8 30.86 91.2-2.54z"/></svg>'; 6980 break; 6981 6982 case 'cloud': 6983 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 283.5 27.8" preserveAspectRatio="xMidYMax slice"><path class="shape-divider-fill" d="M0 0v6.7c1.9-.8 4.7-1.4 8.5-1 9.5 1.1 11.1 6 11.1 6s2.1-.7 4.3-.2c2.1.5 2.8 2.6 2.8 2.6s.2-.5 1.4-.7c1.2-.2 1.7.2 1.7.2s0-2.1 1.9-2.8c1.9-.7 3.6.7 3.6.7s.7-2.9 3.1-4.1 4.7 0 4.7 0 1.2-.5 2.4 0 1.7 1.4 1.7 1.4h1.4c.7 0 1.2.7 1.2.7s.8-1.8 4-2.2c3.5-.4 5.3 2.4 6.2 4.4.4-.4 1-.7 1.8-.9 2.8-.7 4 .7 4 .7s1.7-5 11.1-6c9.5-1.1 12.3 3.9 12.3 3.9s1.2-4.8 5.7-5.7c4.5-.9 6.8 1.8 6.8 1.8s.6-.6 1.5-.9c.9-.2 1.9-.2 1.9-.2s5.2-6.4 12.6-3.3c7.3 3.1 4.7 9 4.7 9s1.9-.9 4 0 2.8 2.4 2.8 2.4 1.9-1.2 4.5-1.2 4.3 1.2 4.3 1.2.2-1 1.4-1.7 2.1-.7 2.1-.7-.5-3.1 2.1-5.5 5.7-1.4 5.7-1.4 1.5-2.3 4.2-1.1c2.7 1.2 1.7 5.2 1.7 5.2s.3-.1 1.3.5c.5.4.8.8.9 1.1.5-1.4 2.4-5.8 8.4-4 7.1 2.1 3.5 8.9 3.5 8.9s.8-.4 2 0 1.1 1.1 1.1 1.1 1.1-1.1 2.3-1.1 2.1.5 2.1.5 1.9-3.6 6.2-1.2 1.9 6.4 1.9 6.4 2.6-2.4 7.4 0c3.4 1.7 3.9 4.9 3.9 4.9s3.3-6.9 10.4-7.9 11.5 2.6 11.5 2.6.8 0 1.2.2c.4.2.9.9.9.9s4.4-3.1 8.3.2c1.9 1.7 1.5 5 1.5 5s.3-1.1 1.6-1.4c1.3-.3 2.3.2 2.3.2s-.1-1.2.5-1.9 1.9-.9 1.9-.9-4.7-9.3 4.4-13.4c5.6-2.5 9.2.9 9.2.9s5-6.2 15.9-6.2 16.1 8.1 16.1 8.1.7-.2 1.6-.4V0H0z"></path></svg>'; 6984 break; 6985 6986 case 'cloud-2': 6987 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 86" preserveAspectRatio="xMidYMid slice"><path class="shape-divider-fill" d="M1280 0H0v65.2c6.8 0 13.5.9 20.1 2.6 14-21.8 43.1-28 64.8-14 5.6 3.6 10.3 8.3 14 13.9 7.3-1.2 14.8-.6 21.8 1.6 2.1-37.3 34.1-65.8 71.4-63.7 24.3 1.4 46 15.7 56.8 37.6 19-17.6 48.6-16.5 66.3 2.4C323 54 327.4 65 327.7 76.5c.4.2.8.4 1.2.7 3.3 1.9 6.3 4.2 8.9 6.9 15.9-23.8 46.1-33.4 72.8-23.3 11.6-31.9 46.9-48.3 78.8-36.6 9.1 3.3 17.2 8.7 23.8 15.7 6.7-6.6 16.7-8.4 25.4-4.8 29.3-37.4 83.3-44 120.7-14.8 14 11 24.3 26.1 29.4 43.1 4.7.6 9.3 1.8 13.6 3.8 7.8-24.7 34.2-38.3 58.9-30.5 14.4 4.6 25.6 15.7 30.3 30 14.2 1.2 27.7 6.9 38.5 16.2 11.1-35.7 49-55.7 84.7-44.7 14.1 4.4 26.4 13.3 35 25.3 12-5.7 26.1-5.5 37.9.6 3.9-11.6 15.5-18.9 27.7-17.5.2-.3.3-.6.5-.9 23.3-41.4 75.8-56 117.2-32.6 14.1 7.9 25.6 19.7 33.3 33.8 28.8-23.8 71.5-19.8 95.3 9 2.6 3.1 4.9 6.5 6.9 10 3.8-.5 7.6-.8 11.4-.8L1280 0z"/></svg>'; 6988 break; 6989 6990 case 'cloud-3': 6991 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 86" preserveAspectRatio="xMidYMid slice"><path class="shape-divider-fill" d="M833.9 27.5c-5.8 3.2-11 7.3-15.5 12.2-7.1-6.9-17.5-8.8-26.6-5-30.6-39.2-87.3-46.1-126.5-15.5-1.4 1.1-2.8 2.2-4.1 3.4C674.4 33.4 684 48 688.8 64.3c4.7.6 9.3 1.8 13.6 3.8 7.8-24.7 34.2-38.3 58.9-30.5 14.4 4.6 25.6 15.7 30.3 30 14.2 1.2 27.7 6.9 38.5 16.2C840.6 49.6 876 29.5 910.8 38c-20.4-20.3-51.8-24.6-76.9-10.5zM384 43.9c-9 5-16.7 11.9-22.7 20.3 15.4-7.8 33.3-8.7 49.4-2.6 3.7-10.1 9.9-19.1 18.1-26-15.4-2.3-31.2.6-44.8 8.3zm560.2 13.6c2 2.2 3.9 4.5 5.7 6.9 5.6-2.6 11.6-4 17.8-4.1-7.6-2.4-15.6-3.3-23.5-2.8zM178.7 7c29-4.2 57.3 10.8 70.3 37 8.9-8.3 20.7-12.8 32.9-12.5C256.4 1.8 214.7-8.1 178.7 7zm146.5 56.3c1.5 4.5 2.4 9.2 2.5 14 .4.2.8.4 1.2.7 3.3 1.9 6.3 4.2 8.9 6.9 5.8-8.7 13.7-15.7 22.9-20.5-11.1-5.2-23.9-5.6-35.5-1.1zM33.5 54.9c21.6-14.4 50.7-8.5 65 13 .1.2.2.3.3.5 7.3-1.2 14.8-.6 21.8 1.6.6-10.3 3.5-20.4 8.6-29.4.3-.6.7-1.2 1.1-1.8-32.1-17.2-71.9-10.6-96.8 16.1zm1228.9 2.7c2.3 2.9 4.4 5.9 6.2 9.1 3.8-.5 7.6-.8 11.4-.8V48.3c-6.4 1.8-12.4 5-17.6 9.3zM1127.3 11c1.9.9 3.7 1.8 5.6 2.8 14.2 7.9 25.8 19.7 33.5 34 13.9-11.4 31.7-16.9 49.6-15.3-20.5-27.7-57.8-36.8-88.7-21.5z" opacity="0.5"/><path class="shape-divider-fill" d="M0 0v66c6.8 0 13.5.9 20.1 2.6 3.5-5.4 8.1-10.1 13.4-13.6 24.9-26.8 64.7-33.4 96.8-16 10.5-17.4 28.2-29.1 48.3-32 36.1-15.1 77.7-5.2 103.2 24.5 19.7.4 37.1 13.1 43.4 31.8 11.5-4.5 24.4-4.2 35.6 1.1l.4-.2c15.4-21.4 41.5-32.4 67.6-28.6 25-21 62.1-18.8 84.4 5.1 6.7-6.6 16.7-8.4 25.4-4.8 29.2-37.4 83.3-44.1 120.7-14.8l1.8 1.5c37.3-32.9 94.3-29.3 127.2 8 1.2 1.3 2.3 2.7 3.4 4.1 9.1-3.8 19.5-1.9 26.6 5 24.3-26 65-27.3 91-3.1.5.5 1 .9 1.5 1.4 12.8 3.1 24.4 9.9 33.4 19.5 7.9-.5 15.9.4 23.5 2.8 7-.1 13.9 1.5 20.1 4.7 3.9-11.6 15.5-18.9 27.7-17.5.2-.3.3-.6.5-.9 22.1-39.2 70.7-54.7 111.4-35.6 30.8-15.3 68.2-6.2 88.6 21.5 18.3 1.7 35 10.8 46.5 25.1 5.2-4.3 11.1-7.4 17.6-9.3V0H0z"/></svg>'; 6992 break; 6993 6994 case 'wave': 6995 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none"><path class="shape-divider-fill" d="M421.9,6.5c22.6-2.5,51.5,0.4,75.5,5.3c23.6,4.9,70.9,23.5,100.5,35.7c75.8,32.2,133.7,44.5,192.6,49.7c23.6,2.1,48.7,3.5,103.4-2.5c54.7-6,106.2-25.6,106.2-25.6V0H0v30.3c0,0,72,32.6,158.4,30.5c39.2-0.7,92.8-6.7,134-22.4c21.2-8.1,52.2-18.2,79.7-24.2C399.3,7.9,411.6,7.5,421.9,6.5z"></path></svg>'; 6996 break; 6997 6998 case 'wave-2': 6999 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 283.5 27.8" preserveAspectRatio="none"><path class="shape-divider-fill" d="M283.5,9.7c0,0-7.3,4.3-14,4.6c-6.8,0.3-12.6,0-20.9-1.5c-11.3-2-33.1-10.1-44.7-5.7 s-12.1,4.6-18,7.4c-6.6,3.2-20,9.6-36.6,9.3C131.6,23.5,99.5,7.2,86.3,8c-1.4,0.1-6.6,0.8-10.5,2c-3.8,1.2-9.4,3.8-17,4.7 c-3.2,0.4-8.3,1.1-14.2,0.9c-1.5-0.1-6.3-0.4-12-1.6c-5.7-1.2-11-3.1-15.8-3.7C6.5,9.2,0,10.8,0,10.8V0h283.5V9.7z M260.8,11.3 c-0.7-1-2-0.4-4.3-0.4c-2.3,0-6.1-1.2-5.8-1.1c0.3,0.1,3.1,1.5,6,1.9C259.7,12.2,261.4,12.3,260.8,11.3z M242.4,8.6 c0,0-2.4-0.2-5.6-0.9c-3.2-0.8-10.3-2.8-15.1-3.5c-8.2-1.1-15.8,0-15.1,0.1c0.8,0.1,9.6-0.6,17.6,1.1c3.3,0.7,9.3,2.2,12.4,2.7 C239.9,8.7,242.4,8.6,242.4,8.6z M185.2,8.5c1.7-0.7-13.3,4.7-18.5,6.1c-2.1,0.6-6.2,1.6-10,2c-3.9,0.4-8.9,0.4-8.8,0.5 c0,0.2,5.8,0.8,11.2,0c5.4-0.8,5.2-1.1,7.6-1.6C170.5,14.7,183.5,9.2,185.2,8.5z M199.1,6.9c0.2,0-0.8-0.4-4.8,1.1 c-4,1.5-6.7,3.5-6.9,3.7c-0.2,0.1,3.5-1.8,6.6-3C197,7.5,199,6.9,199.1,6.9z M283,6c-0.1,0.1-1.9,1.1-4.8,2.5s-6.9,2.8-6.7,2.7 c0.2,0,3.5-0.6,7.4-2.5C282.8,6.8,283.1,5.9,283,6z M31.3,11.6c0.1-0.2-1.9-0.2-4.5-1.2s-5.4-1.6-7.8-2C15,7.6,7.3,8.5,7.7,8.6 C8,8.7,15.9,8.3,20.2,9.3c2.2,0.5,2.4,0.5,5.7,1.6S31.2,11.9,31.3,11.6z M73,9.2c0.4-0.1,3.5-1.6,8.4-2.6c4.9-1.1,8.9-0.5,8.9-0.8 c0-0.3-1-0.9-6.2-0.3S72.6,9.3,73,9.2z M71.6,6.7C71.8,6.8,75,5.4,77.3,5c2.3-0.3,1.9-0.5,1.9-0.6c0-0.1-1.1-0.2-2.7,0.2 C74.8,5.1,71.4,6.6,71.6,6.7z M93.6,4.4c0.1,0.2,3.5,0.8,5.6,1.8c2.1,1,1.8,0.6,1.9,0.5c0.1-0.1-0.8-0.8-2.4-1.3 C97.1,4.8,93.5,4.2,93.6,4.4z M65.4,11.1c-0.1,0.3,0.3,0.5,1.9-0.2s2.6-1.3,2.2-1.2s-0.9,0.4-2.5,0.8C65.3,10.9,65.5,10.8,65.4,11.1 z M34.5,12.4c-0.2,0,2.1,0.8,3.3,0.9c1.2,0.1,2,0.1,2-0.2c0-0.3-0.1-0.5-1.6-0.4C36.6,12.8,34.7,12.4,34.5,12.4z M152.2,21.1 c-0.1,0.1-2.4-0.3-7.5-0.3c-5,0-13.6-2.4-17.2-3.5c-3.6-1.1,10,3.9,16.5,4.1C150.5,21.6,152.3,21,152.2,21.1z"></path><path class="shape-divider-fill" d="M269.6,18c-0.1-0.1-4.6,0.3-7.2,0c-7.3-0.7-17-3.2-16.
69996-2.9c0.4,0.3,13.7,3.1,17,3.3 C267.7,18.8,269.7,18,269.6,18z"></path><path class="shape-divider-fill" d="M227.4,9.8c-0.2-0.1-4.5-1-9.5-1.2c-5-0.2-12.7,0.6-12.3,0.5c0.3-0.1,5.9-1.8,13.3-1.2 S227.6,9.9,227.4,9.8z"></path><path class="shape-divider-fill" d="M204.5,13.4c-0.1-0.1,2-1,3.2-1.1c1.2-0.1,2,0,2,0.3c0,0.3-0.1,0.5-1.6,0.4 C206.4,12.9,204.6,13.5,204.5,13.4z"></path><path class="shape-divider-fill" d="M201,10.6c0-0.1-4.4,1.2-6.3,2.2c-1.9,0.9-6.2,3.1-6.1,3.1c0.1,0.1,4.2-1.6,6.3-2.6 S201,10.7,201,10.6z"></path><path class="shape-divider-fill" d="M154.5,26.7c-0.1-0.1-4.6,0.3-7.2,0c-7.3-0.7-17-3.2-16.6-2.9c0.4,0.3,13.7,3.1,17,3.3 C152.6,27.5,154.6,26.8,154.5,26.7z"></path><path class="shape-divider-fill" d="M41.9,19.3c0,0,1.2-0.3,2.9-0.1c1.7,0.2,5.8,0.9,8.2,0.7c4.2-0.4,7.4-2.7,7-2.6 c-0.4,0-4.3,2.2-8.6,1.9c-1.8-0.1-5.1-0.5-6.7-0.4S41.9,19.3,41.9,19.3z"></path><path class="shape-divider-fill" d="M75.5,12.6c0.2,0.1,2-0.8,4.3-1.1c2.3-0.2,2.1-0.3,2.1-0.5c0-0.1-1.8-0.4-3.4,0 C76.9,11.5,75.3,12.5,75.5,12.6z"></path><path class="shape-divider-fill" d="M15.6,13.2c0-0.1,4.3,0,6.7,0.5c2.4,0.5,5,1.9,5,2c0,0.1-2.7-0.8-5.1-1.4 C19.9,13.7,15.7,13.3,15.6,13.2z"></path></svg>'; 7000 break; 7001 7002 case 'wave-3': 7003 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1047.1 3.7" preserveAspectRatio="xMidYMin slice"><path class="shape-divider-fill" d="M1047.1,0C557,0,8.9,0,0,0v1.6c0,0,0.6-1.5,2.7-0.3C3.9,2,6.1,4.1,8.3,3.5c0.9-0.2,1.5-1.9,1.5-1.9 s0.6-1.5,2.7-0.3C13.8,2,16,4.1,18.2,3.5c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3C23.6,2,25.9,4.1,28,3.5c0.9-0.2,1.5-1.9,1.5-1.9 c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2 c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3C63,2,65.3,4.1,67.4,3.5 C68.3,3.3,69,1.6,69,1.6s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3 C82.7,2,85,4.1,87.1,3.5c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3C92.6,2,94.8,4.1,97,3.5c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3 c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9 c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2 c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3 c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9 c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2 c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3 c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9 c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2 c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3 c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9 s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2 c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3 c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9 s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2 c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3 c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9 s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2 c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3 c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9 s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2 c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3 c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9 s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2 c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3 c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9 s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2 c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3 c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9 c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2 c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3 c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9 c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2 c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3 c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9 c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2 c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3 c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9 s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2 c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3 c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9 s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2 c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3 c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9 s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2 c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3 c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9 s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2 c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3 c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9 s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2 c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3 c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9 s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2 c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3 c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9 c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9c0,0,0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2 c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.7-0.3 c1.2,0.7,3.5,2.8,5.6,2.2c0.9-0.2,1.5-1.9,1.5-1.9s0.6-1.5,2.6-0.4V0z M2.5,1.2C2.5,1.2,2.5,1.2,2.5,1.2C2.5,1.2,2.5,1.2,2.5,1.2z M2.7,1.4c0.1,0,0.1,0.1,0.1,0.1C2.8,1.4,2.8,1.4,2.7,1.4z"></path></svg>'; 7004 break; 7005 7006 case 'wave-4': 7007 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 140" preserveAspectRatio="none"><path class="shape-divider-fill" d="M0 51.76c36.21-2.25 77.57-3.58 126.42-3.58 320 0 320 57 640 57 271.15 0 312.58-40.91 513.58-53.4V0H0z" opacity="0.3"></path><path class="shape-divider-fill" d="M0 24.31c43.46-5.69 94.56-9.25 158.42-9.25 320 0 320 89.24 640 89.24 256.13 0 307.28-57.16 481.58-80V0H0z" opacity="0.5"></path><path class="shape-divider-fill" d="M0 0v3.4C28.2 1.6 59.4.59 94.42.59c320 0 320 84.3 640 84.3 285 0 316.17-66.85 545.58-81.49V0z"></path></svg>'; 7008 break; 7009 7010 case 'wave-5': 7011 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 140" preserveAspectRatio="none"><path class="shape-divider-fill" d="M0 0v100c20 17.3 40 29.51 80 29.51 51.79 0 74.69-48.57 151.75-48.57 73.72 0 91 54.88 191.56 54.88C543.95 135.8 554 14 665.69 14c109.46 0 98.85 87 188.2 87 70.37 0 69.81-33.73 115.6-33.73 55.85 0 62 39.62 115.6 39.62 58.08 0 57.52-46.59 115-46.59 39.8 0 60 22.48 79.89 39.69V0z"></path></svg>'; 7012 break; 7013 7014 case 'wave-6': 7015 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 140" preserveAspectRatio="none"><path class="shape-divider-fill" d="M504.854,80.066c7.812,0,14.893,0.318,21.41,0.879 c-25.925,22.475-56.093,40.852-102.946,40.852c-20.779,0-37.996-2.349-52.898-6.07C413.517,107.295,434.056,80.066,504.854,80.066z M775.938,51.947c19.145,18.596,39.097,35.051,77.956,35.051c46.907,0,62.299-14.986,80.912-24.98 c-21.357-15.783-46.804-28.348-85.489-28.348C816.829,33.671,794.233,41.411,775.938,51.947z" opacity="0.3"></path><path class="shape-divider-fill" d="M1200.112,46.292c39.804,0,59.986,22.479,79.888,39.69v16.805 c-19.903-10.835-40.084-21.777-79.888-21.777c-72.014,0-78.715,43.559-147.964,43.559c-56.84,0-81.247-35.876-117.342-62.552 c9.309-4.998,19.423-8.749,34.69-8.749c55.846,0,61.99,39.617,115.602,39.617C1143.177,92.887,1142.618,46.292,1200.112,46.292z M80.011,115.488c-40.006,0-60.008-12.206-80.011-29.506v16.806c20.003,10.891,40.005,21.782,80.011,21.782 c80.004,0,78.597-30.407,137.669-30.407c55.971,0,62.526,24.026,126.337,24.026c9.858,0,18.509-0.916,26.404-2.461 c-57.186-14.278-80.177-48.808-138.66-48.808C154.698,66.919,131.801,115.488,80.011,115.488z M526.265,80.945 c56.848,4.902,70.056,28.726,137.193,28.726c54.001,0,73.43-35.237,112.48-57.724C751.06,27.782,727.548,0,665.691,0 C597.381,0,567.086,45.555,526.265,80.945z" opacity="0.5"></path><path class="shape-divider-fill" d="M0,0v85.982c20.003,17.3,40.005,29.506,80.011,29.506c51.791,0,74.688-48.569,151.751-48.569 c58.482,0,81.473,34.531,138.66,48.808c43.096-8.432,63.634-35.662,134.433-35.662c7.812,0,14.893,0.318,21.41,0.879 C567.086,45.555,597.381,0,665.691,0c61.856,0,85.369,27.782,110.246,51.947c18.295-10.536,40.891-18.276,73.378-18.276 c38.685,0,64.132,12.564,85.489,28.348c9.3
701509-4.998,19.423-8.749,34.69-8.749c55.846,0,61.99,39.617,115.602,39.617 c58.08,0,57.521-46.595,115.015-46.595c39.804,0,59.986,22.479,79.888,39.69V0H0z"></path></svg>'; 7016 break; 7017 7018 case 'slant': 7019 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none"><path class="shape-divider-fill" d="M0,6V0h1000v100L0,6z"></path></svg>'; 7020 break; 7021 7022 case 'slant-2': 7023 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2600 131.1" preserveAspectRatio="none"><path class="shape-divider-fill" d="M0 0L2600 0 2600 69.1 0 0z"></path><path class="shape-divider-fill" opacity="0.5" d="M0 0L2600 0 2600 69.1 0 69.1z"></path><path class="shape-divider-fill" opacity="0.25" d="M2600 0L0 0 0 130.1 2600 69.1z"></path></svg>'; 7024 break; 7025 7026 case 'slant-3': 7027 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 140" preserveAspectRatio="none"><path class="shape-divider-fill" d="M1280 140V0H0l1280 140z" opacity="0.5"></path><path class="shape-divider-fill" d="M1280 98V0H0l1280 98z"></path></svg>'; 7028 break; 7029 7030 case 'rounded': 7031 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none"><path class="shape-divider-fill" d="M1000,4.3V0H0v4.3C0.9,23.1,126.7,99.2,500,100S1000,22.7,1000,4.3z"></path></svg>'; 7032 break; 7033 7034 case 'rounded-2': 7035 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none"><path class="shape-divider-fill" d="M0,0c0,0,0,6,0,6.7c0,18,240.2,93.6,615.2,92.6C989.8,98.5,1000,25,1000,6.7c0-0.7,0-6.7,0-6.7H0z"></path></svg>'; 7036 break; 7037 7038 case 'rounded-3': 7039 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 140" preserveAspectRatio="none"><path class="shape-divider-fill" d="M0 0s573.08 140 1280 140V0z"></path></svg>'; 7040 break; 7041 7042 case 'rounded-4': 7043 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 140" preserveAspectRatio="none"><path class="shape-divider-fill" d="M0 0v60s573.09 80 1280 80V0z" opacity="0.3"></path><path class="shape-divider-fill" d="M0 0v30s573.09 110 1280 110V0z" opacity="0.5"></path><path class="shape-divider-fill" d="M0 0s573.09 140 1280 140V0z"></path></svg>'; 7044 break; 7045 7046 case 'rounded-5': 7047 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 140" preserveAspectRatio="none"><path class="shape-divider-fill" d="M0 0v.48C18.62 9.38 297.81 140 639.5 140 993.24 140 1280 0 1280 0z" opacity="0.3"></path><path class="shape-divider-fill" d="M0 .6c14 8.28 176.54 99.8 555.45 119.14C952.41 140 1280 0 1280 0H0z" opacity="0.5"></path><path class="shape-divider-fill" d="M726.29 101.2C1126.36 79.92 1281 0 1281 0H1c.05 0 325.25 122.48 725.29 101.2z"></path></svg>'; 7048 break; 7049 7050 case 'triangle': 7051 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 700 10" preserveAspectRatio="none"><path class="shape-divider-fill" d="M350,10L340,0h20L350,10z"></path></svg>'; 7052 break; 7053 7054 case 'drops': 7055 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 283.5 27.8" preserveAspectRatio="xMidYMax slice"><path class="shape-divider-fill" d="M0 0v1.4c.6.7 1.1 1.4 1.4 2 2 3.8 2.2 6.6 1.8 10.8-.3 3.3-2.4 9.4 0 12.3 1.7 2 3.7 1.4 4.6-.9 1.4-3.8-.7-8.2-.6-12 .1-3.7 3.2-5.5 6.9-4.9 4 .6 4.8 4 4.9 7.4.1 1.8-1.1 7 0 8.5.6.8 1.6 1.2 2.4.5 1.4-1.1.1-5.4.1-6.9.1-3.7.3-8.6 4.1-10.5 5-2.5 6.2 1.6 5.4 5.6-.4 1.7-1 9.2 2.9 6.3 1.5-1.1.7-3.5.5-4.9-.4-2.4-.4-4.3 1-6.5.9-1.4 2.4-3.1 4.2-3 2.4.1 2.7 2.2 4 3.7 1.5 1.8 1.8 2.2 3 .1 1.1-1.9 1.2-2.8 3.6-3.3 1.3-.3 4.8-1.4 5.9-.5 1.5 1.1.6 2.8.4 4.3-.2 1.1-.6 4 1.8 3.4 1.7-.4-.3-4.1.6-5.6 1.3-2.2 5.8-1.4 7 .5 1.3 2.1.5 5.8.1 8.1s-1.2 5-.6 7.4c1.3 5.1 4.4.9 4.3-2.4-.1-4.4-2-8.8-.5-13 .9-2.4 4.6-6.6 7.7-4.5 2.7 1.8.5 7.8.2 10.3-.2 1.7-.8 4.6.2 6.2.9 1.4 2 1.5 2.6-.3.5-1.5-.9-4.5-1-6.1-.2-1.7-.4-3.7.2-5.4 1.8-5.6 3.5 2.4 6.3.6 1.4-.9 4.3-9.4 6.1-3.1.6 2.2-1.3 7.8.7 8.9 4.2 2.3 1.5-7.1 2.2-8 3.1-4 4.7 3.8 6.1 4.1 3.1.7 2.8-7.9 8.1-4.5 1.7 1.1 2.9 3.3 3.2 5.2.4 2.2-1 4.5-.6 6.6 1 4.3 4.4 1.5 4.4
7055-1.7 0-2.7-3-8.3 1.4-9.1 4.4-.9 7.3 3.5 7.8 6.9.3 2-1.5 10.9 1.3 11.3 4.1.6-3.2-15.7 4.8-15.8 4.7-.1 2.8 4.1 3.9 6.6 1 2.4 2.1 1 2.3-.8.3-1.9-.9-3.2 1.3-4.3 5.9-2.9 5.9 5.4 5.5 8.5-.3 2-1.7 8.4 2 8.1 6.9-.5-2.8-16.9 4.8-18.7 4.7-1.2 6.1 3.6 6.3 7.1.1 1.7-1.2 8.1.6 9.1 3.5 2 1.9-7 2-8.4.2-4 1.2-9.6 6.4-9.8 4.7-.2 3.2 4.6 2.7 7.5-.4 2.2 1.3 8.6 3.8 4.4 1.1-1.9-.3-4.1-.3-6 0-1.7.4-3.2 1.3-4.6 1-1.6 2.9-3.5 5.1-2.9 2.5.6 2.3 4.1 4.1 4.9 1.9.8 1.6-.9 2.3-2.1 1.2-2.1 2.1-2.1 4.4-2.4 1.4-.2 3.6-1.5 4.9-.5 2.3 1.7-.7 4.4.1 6.5.6 1.5 2.1 1.7 2.8.3.7-1.4-1.1-3.4-.3-4.8 1.4-2.5 6.2-1.2 7.2 1 2.3 4.8-3.3 12-.2 16.3 3 4.1 3.9-2.8 3.8-4.8-.4-4.3-2.1-8.9 0-13.1 1.3-2.5 5.9-5.7 7.9-2.4 2 3.2-1.3 9.8-.8 13.4.5 4.4 3.5 3.3 2.7-.8-.4-1.9-2.4-10 .6-11.1 3.7-1.4 2.8 7.2 6.5.4 2.2-4.1 4.9-3.1 5.2 1.2.1 1.5-.6 3.1-.4 4.6.2 1.9 1.8 3.7 3.3 1.3 1-1.6-2.6-10.4 2.9-7.3 2.6 1.5 1.6 6.5 4.8 2.7 1.3-1.5 1.7-3.6 4-3.7 2.2-.1 4 2.3 4.8 4.1 1.3 2.9-1.5 8.4.9 10.3 4.2 3.3 3-5.5 2.7-6.9-.6-3.9 1-7.2 5.5-5 4.1 2.1 4.3 7.7 4.1 11.6 0 .8-.6 9.5 2.5 5.2 1.2-1.7-.1-7.7.1-9.6.3-2.9 1.2-5.5 4.3-6.2 4.5-1 7.7 1.5 7.4 5.8-.2 3.5-1.8 7.7-.5 11.1 1 2.7 3.6 2.8 5 .2 1.6-3.1 0-8.3-.4-11.6-.4-4.2-.2-7 1.8-10.8 0 0-.1.1-.1.2-.2.4-.3.7-.4.8v.1c-.1.2-.1.2 0 0v-.1l.4-.8c0-.1.1-.1.1-.2.2-.4.5-.8.8-1.2V0H0zM282.7 3.4z"></path></svg>'; 7056 break; 7057 7058 case 'cliff': 7059 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 279.24" preserveAspectRatio="none"><path class="shape-divider-fill" d="M1000 0S331.54-4.18 0 279.24h1000z" opacity="0.25"></path><path class="shape-divider-fill" d="M1000 279.24s-339.56-44.3-522.95-109.6S132.86 23.76 0 25.15v254.09z"></path></svg>'; 7060 break; 7061 7062 case 'zigzag': 7063 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 5.8" preserveAspectRatio="none"><path class="shape-divider-fill" d="M5.4.4l5.4 5.3L16.5.4l5.4 5.3L27.5.4 33 5.7 38.6.4l5.5 5.4h.1L49.9.4l5.4 5.3L60.9.4l5.5 5.3L72 .4l5.5 5.3L83.1.4l5.4 5.3L94.1.4l5.5 5.4h.2l5.6-5.4 5.5 5.3 5.6-5.3 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.4h.2l5.6-5.4 5.4 5.3L161 .4l5.4 5.3L172 .4l5.5 5.3 5.6-5.3 5.4 5.3 5.7-5.3 5.4 5.4h.2l5.6-5.4 5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.4 5.3 5.6-5.3 5.5 5.4h.2l5.6-5.4 5.5 5.3L261 .4l5.4 5.3L272 .4l5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.4h.1l5.7-5.4 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.4 5.3 5.7-5.3 5.4 5.4h.2l5.6-5.4 5.5 5.3L361 .4l5.5 5.3 5.6-5.3 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.4h.1l5.7-5.4 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.4h.1l5.6-5.4 5.5 5.3L461 .4l5.5 5.3 5.6-5.3 5.4 5.3 5.7-5.3 5.4 5.3 5.6-5.3 5.5 5.4h.2l5.6-5.4 5.5 5.3 5.6-5.3 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.4h.1L550 .4l5.4 5.3L561 .4l5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.4 5.3 5.6-5.3 5.5 5.4h.2l5.6-5.4 5.5 5.3 5.6-5.3 5.4 5.3 5.7-5.3 5.4 5.3 5.6-5.3 5.5 5.4h.2L650 .4l5.5 5.3 5.6-5.3 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.4 5.4h.2l5.6-5.4 5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.4 5.3 5.6-5.3 5.5 5.4h.2L750 .4l5.5 5.3 5.6-5.3 5.4 5.3 5.7-5.3 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.4h.1l5.7-5.4 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.4 5.4h.2L850 .4l5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.4h.2l5.6-5.4 5.4 5.3 5.7-5.3 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.4h.1l5.7-5.4 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.4 5.3 5.6-5.3 5.5 5.4h.2l5.6-5.4 5.5 5.3 5.6-5.3 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.4h.2l5.6-5.4 5.4 5.3 5.7-5.3 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.4 5.4h.2l5.6-5.4 5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.4 5.3 5.6-5.3 5.5 5.4h.2l5.6-5.4 5.5 5.3 5.6-5.3 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.4h.1l5.7-5.4 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.4 5.4h.2l5.6-5.4 5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.4h.2l5.6-5.4 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.4h.1l5.7-5.4 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.4 5.3 5.6-5.3 5.5 5.4h.2l5.6-5.4 5.5 5.3 5.6-5.3 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.4h.2l5.6-5.4 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.4 5.3 5.7-5.3 5.4 5.4h.2l5.6-5.4 5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.4 5.3 5.6-5.3 5.5 5.4h.2l5.6-5.4 5.5 5.3 5.6-5.3 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.4h.1l5.6-5.4 5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.4 5.3 5.7-5.3 5.4 5.4h.2l5.6-5.4 5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.4h.1l5.7-5.4 5.4 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.5 5.4h.1l5.6-5.4 5.5 5.3 5.6-5.3 5.5 5.3 5.6-5.3 5.4 5.3 5.7-5.3 5.4 5.3 5.6-5.3 5.5 5.4V0H-.2v5.8z"></path></svg>'; 7064 break; 7065 7066 case 'illusion': 7067 shape = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 283.5 19.6" preserveAspectRatio="none"><path class="shape-divider-fill" opacity="0.33" d="M0 0L0 18.8 141.8 4.1 283.5 18.8 283.5 0z"></path><path class="shape-divider-fill" opacity="0.33" d="M0 0L0 12.6 141.8 4 283.5 12.6 283.5 0z"></path><path class="shape-divider-fill" opacity="0.33" d="M0 0L0 6.4 141.8 4 283.5 6.4 283.5 0z"></path><path class="shape-divider-fill" d="M0 0L0 1.2 141.8 4 283.5 1.2 283.5 0z"></path></svg>'; 7068 break; 7069 7070 default: 7071 shape = ''; 7072 break; 7073 } 7074 7075 element.innerHTML = shape; 7076 element.querySelector('svg').classList.add( 'op-ts' ); 7077 7078 setTimeout( function() { 7079 element.querySelector('svg').classList.add( 'op-1' ); 7080 }, 500); 7081 7082 element.classList.add('shape-divider-complete'); 7083 }); 7084 } 7085 }; 7086 }(), 7087 // ShapeDivider Functions End 7088 7089 /** 7090 * -------------------------------------------------------------------------- 7091 * StickySidebar Functions Start 7092 * -------------------------------------------------------------------------- 7093 */ 7094 StickySidebar: function() { 7095 return { 7096 init: function(selector) { 7097 if( __core.getSelector(selector, false, false).length < 1 ){ 7098 return true; 7099 } 7100 7101 __core.isFuncTrue( function() { 7102 return typeof jQuery !== 'undefined' && jQuery().scwStickySidebar; 7103 }).then( function(cond) { 7104 if( !cond ) { 7105 return false;
7106 } 7107 7108 __core.initFunction({ class: 'has-plugin-stickysidebar', event: 'pluginStickySidebarReady' }); 7109 7110 selector = __core.getSelector( selector ); 7111 if( selector.length < 1 ){ 7112 return false; 7113 } 7114 7115 selector.each( function(){ 7116 var element = jQuery(this), 7117 elTop = element.attr('data-offset-top') || 110, 7118 elBottom = element.attr('data-offset-bottom') || 50; 7119 7120 element.scwStickySidebar({ 7121 additionalMarginTop: Number(elTop), 7122 additionalMarginBottom: Number(elBottom) 7123 }); 7124 }); 7125 }); 7126 } 7127 }; 7128 }(), 7129 // StickySidebar Functions End 7130 7131 /** 7132 * -------------------------------------------------------------------------- 7133 * Cookies Functions Start 7134 * -------------------------------------------------------------------------- 7135 */ 7136 Cookies: function() { 7137 var _resetPage = function(btn) { 7138 if( !btn.closest('#gdpr-preferences') ) { 7139 return false; 7140 } 7141 7142 setTimeout( function() { 7143 window.location.reload(); 7144 }, 500); 7145 }; 7146 7147 return { 7148 init: function(selector) { 7149 if( __core.getSelector(selector, false, false).length < 1 ){ 7150 return true; 7151 } 7152 7153 __core.initFunction({ class: 'has-plugin-cookie', event: 'pluginCookieReady' }); 7154 7155 selector = __core.getSelector( selector, false ); 7156 if( selector.length < 1 ){ 7157 return true; 7158 } 7159 7160 var cookieBar = document.querySelector('.gdpr-settings'), 7161 elSpeed = cookieBar?.getAttribute('data-speed') || 300, 7162 elExpire = cookieBar?.getAttribute('data-expire') || 30, 7163 elDelay = cookieBar?.getAttribute('data-delay') || 1500, 7164 elPersist = cookieBar?.getAttribute('data-persistent'), 7165 elDirection = 'bottom', 7166 elHeight = cookieBar?.offsetHeight + 100, 7167 elWidth = cookieBar?.offsetWidth + 100, 7168 elSize, 7169 elSettings = document.querySelector('.gdpr-cookie-settings'), 7170 elSwitches = elSettings?.querySelectorAll('[data-cookie-name]'); 7171 7172 if( !cookieBar && !elSettings ) { 7173 return true; 7174 } 7175 7176 if( elPersist == 'true' ) { 7177 __core.cookie.set('__cnvs_cookies_accept', ''); 7178 __core.cookie.remove('__cnvs_cookies_decline'); 7179 } 7180 7181 if( cookieBar ) { 7182 if( cookieBar?.classList.contains('gdpr-settings-sm') && cookieBar?.classList.contains('gdpr-settings-right') ) { 7183 elDirection = 'right'; 7184 } else if( cookieBar?.classList.contains('gdpr-settings-sm') ) { 7185 elDirection = 'left'; 7186 } 7187 7188 if( elDirection == 'left' ) { 7189 elSize = -elWidth; 7190 cookieBar.style.right = 'auto'; 7191 cookieBar.style.marginLeft = '1rem'; 7192 } else if( elDirection == 'right' ) { 7193 elSize = -elWidth; 7194 cookieBar.style.left = 'auto'; 7195 cookieBar.style.marginRight = '1rem'; 7196 } else { 7197 elSize = -elHeight; 7198 } 7199 7200 cookieBar.style[elDirection] = elSize + 'px'; 7201 7202 if( __core.cookie.get('__cnvs_cookies_accept') != '1' ) { 7203 setTimeout( function() { 7204 cookieBar.style.display = 'block'; 7205 cookieBar.style.pointerEvents = 'auto'; 7206 cookieBar.style[elDirection] = 0; 7207 cookieBar.style.opacity = 1; 7208 }, Number( elDelay ) ); 7209 } 7210 } 7211 7212 var gdprAcceptBtn = document.querySelectorAll('.gdpr-accept'), 7213 gdprDeclineBtn = document.querySelectorAll('.gdpr-decline'), 7214 gdprSaveCookies = document.querySelectorAll('.gdpr-save-cookies'); 7215 7216 if( gdprAcceptBtn.length > 0 ) {
7217 gdprAcceptBtn.forEach( function(btn){ 7218 btn.onclick = function(e) { 7219 e.preventDefault(); 7220 7221 if( cookieBar ) { 7222 cookieBar.style[elDirection] = elSize + 'px'; 7223 cookieBar.style.opacity = 0; 7224 cookieBar.ontransitionend = function() { 7225 cookieBar.style.display = 'none'; 7226 cookieBar.style.pointerEvents = 'none'; 7227 }; 7228 } 7229 7230 __core.cookie.set('__cnvs_cookies_accept', '1', elExpire); 7231 __core.cookie.set('__cnvs_cookies_decline', '0', elExpire); 7232 7233 _resetPage(btn); 7234 }; 7235 }); 7236 } 7237 7238 if( gdprDeclineBtn.length > 0 ) { 7239 gdprDeclineBtn.forEach( function(btn){ 7240 btn.onclick = function(e) { 7241 e.preventDefault(); 7242 7243 if( cookieBar ) { 7244 cookieBar.style[elDirection] = elSize + 'px'; 7245 cookieBar.style.opacity = 0; 7246 cookieBar.ontransitionend = function() { 7247 cookieBar.style.display = 'none'; 7248 cookieBar.style.pointerEvents = 'none'; 7249 }; 7250 } 7251 7252 __core.cookie.set('__cnvs_cookies_accept', '0', elExpire); 7253 __core.cookie.set('__cnvs_cookies_decline', '1', elExpire); 7254 7255 _resetPage(btn); 7256 }; 7257 }); 7258 } 7259 7260 var acceptCookies = __core.cookie.get('__cnvs_cookies_accept'), 7261 declineCookies = __core.cookie.get('__cnvs_cookies_decline'), 7262 cookiesAllowed = (acceptCookies || acceptCookies != '0') && (!declineCookies || declineCookies != '1'); 7263 7264 elSwitches?.forEach( function(el) { 7265 var elCookie = '__cnvs_gdpr_' + el.getAttribute('data-cookie-name'), 7266 getCookie = __core.cookie.get(elCookie); 7267 7268 if( typeof getCookie !== 'undefined' && getCookie == '1' && cookiesAllowed ) { 7269 el.checked = true; 7270 } else { 7271 el.checked = false; 7272 } 7273 }); 7274 7275 if( gdprSaveCookies.length > 0 ) { 7276 gdprSaveCookies.forEach( function(btn){ 7277 btn.onclick = function(e) { 7278 e.preventDefault(); 7279 7280 __core.cookie.set('__cnvs_cookies_accept', '1', elExpire); 7281 __core.cookie.set('__cnvs_cookies_decline', '0', elExpire); 7282 7283 elSwitches.forEach( function(el) { 7284 var elCookie = '__cnvs_gdpr_' + el.getAttribute( 'data-cookie-name' ); 7285 7286 if( el.checked == true ) { 7287 __core.cookie.set(elCookie, '1', elExpire); 7288 } else { 7289 __core.cookie.remove(elCookie, ''); 7290 } 7291 }); 7292 7293 if( elSettings.closest( '.mfp-content' ).length > 0 ) { 7294 jQuery$.magnificPopup.close(); 7295 } 7296 7297 _resetPage(btn); 7298 }; 7299 }); 7300 } 7301 7302 document.querySelectorAll('.gdpr-container')?.forEach( function(element) { 7303 var elCookie = '__cnvs_gdpr_' + element.getAttribute('data-cookie-name'), 7304 elContent = element.getAttribute('data-cookie-content'), 7305 elContentAjax = element.getAttribute('data-cookie-content-ajax'), 7306 getCookie = __core.cookie.get(elCookie); 7307 7308 if( typeof getCookie !== 'undefined' && getCookie == '1' && cookiesAllowed ) { 7309 element.classList.add('gdpr-content-active'); 7310 if( elContentAjax ) { 7311 fetch( elContentAjax ).then( function(response) { 7312 return response.text(); 7313 }).then( function(html) { 7314 var domParser = new DOMParser(); 7315 var parsedHTML = domParser.parseFromString(html, 'text/html'); 7316 7317 element?.insertAdjacentHTML('beforeend', parsedHTML.body.innerHTML); 7318 }).catch( function(err) { 7319 console.log(err); 7320 }); 7321 } else { 7322 if( elContent ) { 7323 element.innerHTML += elContent; 7324 } 7325 } 7326 __core.runContainerModules(element); 7327 } else { 7328 element.classList.add('gdpr-content-blocked'); 7329 } 7330 }); 7331 } 7332 }; 7333 }(), 7334 // Cookies Functions End 7335 7336 /** 7337 * -------------------------------------------------------------------------- 7338 * Quantity Functions Start 7339 * -------------------------------------------------------------------------- 7340 */ 7341 Quantity: function() { 7342 return { 7343 init: function(selector) { 7344 if( __core.getSelector(selector, false, false).length < 1 ){ 7345 return true; 7346 } 7347 7348 __core.initFunction({ class: 'has-plugin-quantity', event: 'pluginQuantityReady' }); 7349 7350 selector = __core.getSelector( selector, false ); 7351 if( selector.length < 1 ){ 7352 return true; 7353 } 7354 7355 selector.forEach( function(element) { 7356 var plus = element.querySelector('.plus'), 7357 minus = element.querySelector('.minus'), 7358 input = element.querySelector('.qty'); 7359 7360 var eventChange = new Event("change"); 7361 7362 plus.onclick = function(e) { 7363 e.preventDefault(); 7364 7365 var value = input.value, 7366 step = input.getAttribute('step') || 1, 7367 max = input.getAttribute('max'), 7368 intRegex = /^\d+$/; 7369 7370 if( max && ( Number(value) >= Number( max ) ) ) { 7371 return false;
7372 } 7373 7374 if( intRegex.test( value ) ) { 7375 var valuePlus = Number(value) + Number(step); 7376 input.value = valuePlus; 7377 } else { 7378 input.value = Number(step); 7379 } 7380 7381 input.dispatchEvent(eventChange); 7382 }; 7383 7384 minus.onclick = function(e) { 7385 e.preventDefault(); 7386 7387 var value = input.value, 7388 step = input.getAttribute('step') || 1, 7389 min = input.getAttribute('min'), 7390 intRegex = /^\d+$/; 7391 7392 if( !min || min < 0 ) { 7393 min = 1; 7394 } 7395 7396 if( intRegex.test( value ) ) { 7397 if( Number(value) > Number(min) ) { 7398 var valueMinus = Number(value) - Number(step); 7399 input.value = valueMinus; 7400 } 7401 } else { 7402 input.value = Number(step); 7403 } 7404 7405 input.dispatchEvent(eventChange); 7406 }; 7407 }); 7408 } 7409 }; 7410 }(), 7411 // Quantity Functions End 7412 7413 /** 7414 * -------------------------------------------------------------------------- 7415 * ReadMore Functions Start 7416 * -------------------------------------------------------------------------- 7417 */ 7418 ReadMore: function() { 7419 var _HEXtoRGBA = function(hex, op) { 7420 var c; 7421 7422 if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)){ 7423 c= hex.substring(1).split(''); 7424 if(c.length==3){ 7425 c= [c[0], c[0], c[1], c[1], c[2], c[2]]; 7426 } 7427 c= '0x'+c.join(''); 7428 return 'rgba('+[(c>>16)&255, (c>>8)&255, c&255].join(',')+','+op+')'; 7429 } 7430 7431 console.log('Bad Hex'); 7432 }; 7433 7434 return { 7435 init: function(selector) { 7436 if( __core.getSelector(selector, false, false).length < 1 ){ 7437 return true; 7438 } 7439 7440 __core.initFunction({ class: 'has-plugin-readmore', event: 'pluginReadMoreReady' }); 7441 7442 selector = __core.getSelector( selector, false ); 7443 if( selector.length < 1 ){ 7444 return true; 7445 } 7446 7447 selector.forEach( function(el) { 7448 var element = el, 7449 elSize = element.getAttribute('data-readmore-size') || '10rem', 7450 elSpeed = element.getAttribute('data-readmore-speed') || 500, 7451 elScrollUp = element.getAttribute('data-readmore-scrollup') || 'false', 7452 elTrigger = element.getAttribute('data-readmore-trigger') || '.read-more-trigger', 7453 elTriggerO = element.getAttribute('data-readmore-trigger-open') || 'Read More', 7454 elTriggerC = element.getAttribute('data-readmore-trigger-close') || 'Read Less', 7455 elMask; 7456 7457 element.style.height = ''; 7458 element.classList.remove('read-more-wrap-open'); 7459 7460 var elHeight = element.offsetHeight; 7461 7462 var elTriggerElement = element.querySelector( elTrigger ); 7463 elTriggerElement.classList.remove('d-none'); 7464 var elHeightN = elHeight + elTriggerElement.offsetHeight; 7465 7466 elTriggerElement.innerHTML = elTriggerO; 7467 elSpeed = Number( elSpeed ); 7468 7469 element.classList.add('read-more-wrap'); 7470 element.style.height = elSize; 7471 element.style.transitionDuration = elSpeed + 'ms'; 7472 7473 if( !element.querySelector('.read-more-mask') ) { 7474 element.innerHTML += '<div class="read-more-mask"></div>'; 7475 } 7476 7477 elMask = element.querySelector('.read-more-mask'); 7478 7479 var elMaskD = element.getAttribute('data-readmore-mask') || 'true', 7480 elMaskColor = element.getAttribute('data-readmore-maskcolor') || '#FFF', 7481 elMaskSize = element.getAttribute('data-readmore-masksize') || '100%'; 7482 7483 if( elMaskD == 'true' ) { 7484 elMask.style.height = elMaskSize; 7485 elMask.style.backgroundImage = 'linear-gradient( '+ _HEXtoRGBA( elMaskColor, 0 ) +', '+ _HEXtoRGBA( elMaskColor, 1 ) +' )'; 7486 elMask.classList.add('op-ts', 'op-1'); 7487 } else { 7488 elMask.classList.add('d-none'); 7489 } 7490 7491 var elTriggerEl = element.querySelector(elTrigger); 7492 7493 elTriggerEl.onclick = function(e) { 7494 e.preventDefault(); 7495 7496 if( element.classList.contains('read-more-wrap-open') ) { 7497 element.style.height = elSize; 7498 element.classList.remove('read-more-wrap-open'); 7499 elTriggerEl.innerHTML = elTriggerO; 7500 setTimeout( function() { 7501 if( elScrollUp == 'true' ) { 7502 __core.scrollTo((element.offsetTop - __core.getVars.topScrollOffset), false, false); 7503 } 7504 }, elSpeed ); 7505 if( elMaskD == 'true' ) { 7506 elMask.classList.add('op-ts', 'op-1'); 7507 } 7508 } else { 7509 if( elTriggerC == 'false' ) { 7510 elTriggerEl.classList.add('d-none'); 7511 } 7512 element.style.height = elHeightN + 'px'; 7513 element.style.overflow = ''; 7514 element.classList.add('read-more-wrap-open'); 7515 if( elTriggerEl ) { 7516 elTriggerEl.innerHTML = elTriggerC; 7517 } 7518 if( elMaskD == 'true' ) { 7519 elMask.classList.remove('op-1'); 7520 elMask.classList.add('op-0'); 7521 } 7522 } 7523 7524 elTriggerEl = element.querySelector(elTrigger); 7525 }; 7526 }); 7527 7528 __core.getVars.resizers.readmore = function() { 7529 __modules.readmore(); 7530 }; 7531 } 7532 }; 7533 }(), 7534 // ReadMore Functions End 7535 7536 /** 7537 * -------------------------------------------------------------------------- 7538 * PricingSwitcher Functions Start 7539 * -------------------------------------------------------------------------- 7540 */ 7541 PricingSwitcher: function() { 7542 var _staticValue; 7543 7544 var _switcher = function(check, switcher, pricing, defClass, actClass) { 7545 var value; 7546 7547 if( check.type == 'checkbox' ) { 7548 _staticValue = check.checked; 7549 } else if( check.type == 'radio' ) { 7550 if( check.checked ) { 7551 _staticValue = check.value; 7552 } 7553 } else { 7554 _staticValue = check.value; 7555 } 7556 7557 value = _staticValue; 7558 7559 switcher.querySelectorAll('.pts-switch')?.forEach( function(elem) { 7560 actClass.split(" ").forEach( function(_class) { 7561 elem.classList.remove(_class); 7562 }); 7563 7564 defClass.split(" ").forEach( function(_class) { 7565 elem.classList.add(_class); 7566 }); 7567 }); 7568 7569 pricing.querySelectorAll('.pts-content')?.forEach( function(elem) { 7570 elem.classList.add('d-none'); 7571 }); 7572 7573 if( check.type == 'checkbox' ) { 7574 value = value ? 'true' : 'false'; 7575 } 7576 7577 defClass.split(" ").forEach( function(_class) { 7578 switcher.querySelector('.pts-' + value)?.classList.remove(_class); 7579 }); 7580 7581 actClass.split(" ").forEach( function(_class) { 7582 switcher.querySelector('.pts-' + value)?.classList.add(_class); 7583 }); 7584 7585 pricing.querySelectorAll('.pts-content-' + value).forEach( function(el) { 7586 el.classList.remove('d-none'); 7587 }); 7588 }; 7589 7590 return { 7591 init: function(selector) { 7592 if( __core.getSelector(selector, false, false).length < 1 ){ 7593 return true; 7594 } 7595 7596 __core.initFunction({ class: 'has-plugin-pricing-switcher', event: 'pluginPricingSwitcherReady' }); 7597 7598 selector = __core.getSelector( selector, false ); 7599 if( selector.length < 1 ){ 7600 return true; 7601 } 7602 7603 selector.forEach( function(element) { 7604 var elCheck = element.querySelectorAll('[type="checkbox"], [type="radio"], select'), 7605 elDefClass = element.getAttribute('data-default-class') || 'text-muted op-05', 7606 elActClass = element.getAttribute('data-active-class') || 'fw-bold', 7607 elPricing = document.querySelector( element.getAttribute('data-container') ); 7608 7609 elCheck.forEach( function(el) { 7610 _switcher(el, element, elPricing, elDefClass, elActClass); 7611 7612 el.addEventListener( 'change', function() { 7613 _switcher(el, element, elPricing, elDefClass, elActClass); 7614 }); 7615 }); 7616 }); 7617 } 7618 }; 7619 }(), 7620 // PricingSwitcher Functions End 7621 7622 /** 7623 * -------------------------------------------------------------------------- 7624 * AjaxTrigger Functions Start 7625 * -------------------------------------------------------------------------- 7626 */ 7627 AjaxTrigger: function() { 7628 var _load = function(params) { 7629 fetch(params.loader).then( function(response) { 7630 return response.text(); 7631 }).then( function(html) { 7632 _scripts(params.loadCSS, params.loadJS); 7633 7634 var domParser = new DOMParser(); 7635 var parsedHTML = domParser.parseFromString(html, 'text/html'); 7636 7637 if( params.placement == 'append' ) { 7638 params.container?.insertAdjacentHTML('beforeend', parsedHTML.body.innerHTML); 7639 } else { 7640 params.container?.insertAdjacentHTML('afterbegin', parsedHTML.body.innerHTML); 7641 } 7642 7643 if( params.triggerHide == 'true' ) { 7644 params.trigger.classList.add('d-none'); 7645 } 7646 7647 __core.runContainerModules(params.container); 7648 __core.viewport(); 7649 7650 if( params.triggerDisable == 'true' ) { 7651 setTimeout( function() {
7652 params.trigger.onclick = function(e) { 7653 e.stopPropagation(); 7654 e.preventDefault(); 7655 7656 return false; 7657 }; 7658 }, 1000); 7659 } 7660 }).catch( function(err) { 7661 var errorDIV = document.createElement("div"); 7662 errorDIV.classList.add( 'd-inline-block', 'text-danger', 'me-3' ); 7663 errorDIV.innerText = 'Content Cannot be Loaded!'; 7664 params.container?.prepend( errorDIV, ': ' + err ); 7665 }); 7666 }; 7667 7668 var _scripts = function(loadCSS=false, loadJS=false) { 7669 if( loadCSS ) { 7670 loadCSS = JSON.parse(loadCSS); 7671 if( loadCSS.length > 0 ) { 7672 loadCSS.forEach( function(css) { 7673 __core.loadCSS(css); 7674 }); 7675 } 7676 } 7677 7678 if( loadJS ) { 7679 loadJS = JSON.parse(loadJS); 7680 if( loadJS.length > 0 ) { 7681 loadJS.forEach( function(js) { 7682 __core.loadJS(js); 7683 }); 7684 } 7685 } 7686 }; 7687 7688 return { 7689 init: function(selector) { 7690 if( __core.getSelector(selector, false, false).length < 1 ){ 7691 return true; 7692 } 7693 7694 __core.initFunction({ class: 'has-plugin-ajaxtrigger', event: 'pluginAjaxTriggerReady' }); 7695 7696 selector = __core.getSelector( selector, false ); 7697 if( selector.length < 1 ){ 7698 return true; 7699 } 7700 7701 selector.forEach( function(el) { 7702 var params = { 7703 trigger: el, 7704 loader: el.getAttribute('data-ajax-loader'), 7705 triggerType: el.getAttribute('data-ajax-trigger-type') || 'click', 7706 loadDelay: el.getAttribute('data-ajax-load-delay') || 2222, 7707 container: document.querySelector( el.getAttribute('data-ajax-container') ), 7708 contentPlacement: el.getAttribute('data-ajax-insertion') || 'append', 7709 triggerHide: el.getAttribute('data-ajax-trigger-hide') || 'true', 7710 triggerDisable: el.getAttribute('data-ajax-trigger-disable') || 'true', 7711 loadCSS: el.getAttribute('data-ajax-loadcss') || false, 7712 loadJS: el.getAttribute('data-ajax-loadjs') || false, 7713 } 7714 7715 if( params.triggerType == 'load' ) { 7716 setTimeout( function() { 7717 _load(params); 7718 }, Number(params.loadDelay)); 7719 } else { 7720 params.trigger.onclick = function(e) { 7721 e.preventDefault(); 7722 _load(params); 7723 }; 7724 } 7725 }); 7726 } 7727 }; 7728 }(), 7729 // AjaxTrigger Functions End 7730 7731 /** 7732 * -------------------------------------------------------------------------- 7733 * VideoFacade Functions Start 7734 * -------------------------------------------------------------------------- 7735 */ 7736 VideoFacade: function() { 7737 return { 7738 init: function(selector) { 7739 if( __core.getSelector(selector, false, false).length < 1 ){ 7740 return true; 7741 } 7742 7743 __core.initFunction({ class: 'has-plugin-videofacade', event: 'pluginVideoFacadeReady' }); 7744 7745 selector = __core.getSelector( selector, false ); 7746 7747 selector.forEach( function(element) { 7748 element.onclick = function(e) { 7749 e.preventDefault(); 7750 7751 var videoContent = element.getAttribute('data-video-html'), 7752 videoRatio = element.getAttribute('data-video-ratio') || 'ratio ratio-16x9', 7753 videoPreviewEl = element.querySelector('.video-facade-preview'), 7754 videoContentEl = element.querySelector('.video-facade-content'); 7755 7756 videoPreviewEl.classList.add('d-none'); 7757 videoContentEl.innerHTML += videoContent; 7758 7759 videoRatio.split(" ").forEach( function(ratioClass) { 7760 videoContentEl.classList.add(ratioClass); 7761 }); 7762 }; 7763 }); 7764 } 7765 }; 7766 }(), 7767 // VideoFacade Functions End 7768 7769 /** 7770 * -------------------------------------------------------------------------- 7771 * SchemeToggler Functions Start 7772 * -------------------------------------------------------------------------- 7773 */ 7774 SchemeToggle: function() { 7775 var _toggle = function(element, sibling=false, action=false) { 7776 var bodyClassToggle = element.getAttribute('data-bodyclass-toggle') || 'dark'; 7777 var classAdd = element.getAttribute('data-add-class') || 'scheme-toggler-active'; 7778 var classRemove = element.getAttribute('data-remove-class') || 'scheme-toggler-active'; 7779 var htmlAdd = element.getAttribute('data-add-html'); 7780 var htmlRemove = element.getAttribute('data-remove-html'); 7781 var toggleType = element.getAttribute('data-type') || 'trigger'; 7782 var remember = element.getAttribute('data-remember') || 'false'; 7783 7784 if( __core.contains( bodyClassToggle, __core.getVars.elBody ) ) { 7785 __core.classesFn('add', classAdd, element); 7786 __core.classesFn('remove', classRemove, element); 7787 element.classList.add('body-state-toggled'); 7788 7789 // Set Storage 7790 if( remember == "true" && action ) { 7791 localStorage.setItem('cnvsBodyColorScheme', 'dark'); 7792 } 7793 7794 if( 'checkbox' == toggleType && sibling ) { 7795 element.querySelector('input[type=checkbox]').checked = true; 7796 } else { 7797 if( htmlAdd ) { 7798 element.innerHTML = htmlAdd; 7799 } 7800 } 7801 } else { 7802 __core.classesFn('add', classRemove, element); 7803 __core.classesFn('remove', classAdd, element); 7804 element.classList.remove('body-state-toggled'); 7805 7806 // Remove Storage 7807 if( remember == "true" && action ) {
7808 localStorage.removeItem('cnvsBodyColorScheme'); 7809 } 7810 7811 if( 'checkbox' == toggleType && sibling ) { 7812 element.querySelector('input[type=checkbox]').checked = false; 7813 } else { 7814 if( htmlRemove ) { 7815 element.innerHTML = htmlRemove; 7816 } 7817 } 7818 } 7819 7820 __base.setBSTheme(); 7821 __modules.dataClasses(); 7822 }; 7823 7824 return { 7825 init: function(selector) { 7826 if( __core.getSelector(selector, false, false).length < 1 ){ 7827 return true; 7828 } 7829 7830 __core.initFunction({ class: 'has-plugin-schemetoggler', event: 'pluginSchemeTogglerReady' }); 7831 7832 selector = __core.getSelector( selector, false ); 7833 if( selector.length < 1 ) { 7834 return false; 7835 } 7836 7837 selector.forEach( function(element) { 7838 var bodyClassToggle = element.getAttribute('data-bodyclass-toggle') || 'dark'; 7839 var toggleType = element.getAttribute('data-type') || 'trigger'; 7840 7841 _toggle(element); 7842 7843 if( 'checkbox' == toggleType ) { 7844 var elementCheck = element.querySelector('input[type=checkbox]'); 7845 7846 elementCheck.addEventListener( 'change', function() { 7847 __core.classesFn('toggle', bodyClassToggle, __core.getVars.elBody); 7848 _toggle(element, false, true); 7849 7850 __core.siblings(element, selector).forEach( function(el) { 7851 _toggle(el, true); 7852 }); 7853 }); 7854 } else { 7855 element.onclick = function(e) { 7856 e.preventDefault(); 7857 7858 __core.classesFn('toggle', bodyClassToggle, __core.getVars.elBody); 7859 _toggle(element, false, true); 7860 7861 __core.siblings(element, selector).forEach( function(el) { 7862 _toggle(el, true); 7863 }); 7864 }; 7865 } 7866 }); 7867 } 7868 }; 7869 }(), 7870 // SchemeToggler Functions End 7871 7872 /** 7873 * -------------------------------------------------------------------------- 7874 * Clipboard Functions Start 7875 * -------------------------------------------------------------------------- 7876 */ 7877 Clipboard: function() { 7878 return { 7879 init: function(selector) { 7880 if( __core.getSelector(selector, false, false).length < 1 ){ 7881 return true; 7882 } 7883 7884 __core.isFuncTrue( function() { 7885 return typeof ClipboardJS !== 'undefined'; 7886 }).then( function(cond) { 7887 if( !cond ) { 7888 return false; 7889 } 7890 7891 __core.initFunction({ class: 'has-plugin-clipboard', event: 'pluginClipboardReady' }); 7892 7893 selector = __core.getSelector( selector, false ); 7894 if( selector.length < 1 ){ 7895 return true; 7896 } 7897 7898 var clipboards = [], 7899 count = 0; 7900 7901 selector.forEach( function(el) { 7902 var trigger = el.querySelector('button'), 7903 triggerText = trigger.innerHTML, 7904 copiedtext = trigger.getAttribute('data-copied') || 'Copied', 7905 copiedTimeout = trigger.getAttribute('data-copied-timeout') || 5000; 7906 7907 clipboards[count] = new ClipboardJS( trigger, { 7908 target: function(content) { 7909 return content.closest('.clipboard-copy').querySelector('code'); 7910 } 7911 }); 7912 7913 clipboards[count].on('success', function(e) { 7914 trigger.innerHTML = copiedtext; 7915 trigger.disabled = true; 7916 7917 setTimeout( function() { 7918 trigger.innerHTML = triggerText; 7919 trigger.disabled = false; 7920 }, Number(copiedTimeout)); 7921 }); 7922 7923 count++; 7924 }); 7925 }); 7926 } 7927 }; 7928 }(), 7929 // Clipboard Functions End 7930 7931 /** 7932 * -------------------------------------------------------------------------- 7933 * CodeHighlight Functions Start 7934 * -------------------------------------------------------------------------- 7935 */ 7936 CodeHighlight: function() { 7937 return { 7938 init: function(selector) { 7939 if( __core.getSelector(selector, false, false).length < 1 ){ 7940 return true; 7941 } 7942 7943 __core.loadCSS({ file: 'components/prism.css', id: 'canvas-prism-css', cssFolder: true }); 7944 __core.isFuncTrue( function() { 7945 return typeof Prism !== 'undefined'; 7946 }).then( function(cond) { 7947 if( !cond ) { 7948 return false; 7949 } 7950 7951 __core.initFunction({ class: 'has-plugin-codehighlight', event: 'pluginCodeHighlightReady' }); 7952 7953 selector = __core.getSelector( selector, false ); 7954 if( selector.length < 1 ){ 7955 return true; 7956 } 7957 7958 selector.forEach( function(el) { 7959 Prism.highlightElement( el.querySelector('code') ); 7960 }); 7961 }); 7962 } 7963 }; 7964 }(), 7965 // CodeHighlight Functions End 7966 7967 /** 7968 * -------------------------------------------------------------------------- 7969 * Tips Functions Start 7970 * -------------------------------------------------------------------------- 7971 */ 7972 Tips: function() { 7973 return { 7974 init: function(selector) { 7975 __core.isFuncTrue( function() { 7976 return typeof bootstrap !== 'undefined'; 7977 }).then( function(cond) { 7978 if( !cond ) { 7979 return false;
7980 } 7981 7982 if( typeof cnvsTips === "undefined" || cnvsTips.length < 1 ) { 7983 return false; 7984 } 7985 7986 __core.initFunction({ class: 'has-plugin-tips', event: 'pluginTipsReady' }); 7987 7988 var body = __core.getVars.elBody.classList; 7989 7990 if( body.contains('init-plugin-tips') ) { 7991 return false; 7992 } 7993 7994 var randomIndex = Math.floor(Math.random() * cnvsTips.length); 7995 var randomTip = cnvsTips[randomIndex]; 7996 7997 var tipsEl = document.getElementById('cnvs-tips-element'); 7998 7999 if( !tipsEl ) { 8000 var tipsHTML = '<div class="position-fixed bottom-0 end-0 p-3 text-start" style="z-index: 699;"><div id="cnvs-tips-element" data-notify-trigger="custom" data-notify-target="#cnvs-tips-element" data-notify-timeout="7777" class="toast hide p-3" role="alert" aria-live="assertive" aria-atomic="true" style="--bs-toast-max-width:400px;--bs-toast-bg: rgba(var(--bs-body-bg-rgb),.925);"><div class="toast-header bg-transparent border-0 mb-0 align-items-center pb-1"><h5 id="cnvs-tips-element-title" class="me-auto fs-6 fw-semibold mb-0"></h5><button type="button" class="btn-close me-1" data-bs-dismiss="toast" aria-label="Close"></button></div><div id="cnvs-tips-element-content" class="toast-body small pt-1"></div><a href="#" id="cnvs-tips-element-disable" class="text-muted text-decoration-underline op-06 h-op-08 px-2 pb-2 ms-1 mt-1 d-inline-block" data-cookies="true" style="font-size:.75rem;text-underline-offset:3px;">Disable Random Tips</a></div></div>'; 8001 8002 __core.getVars.elWrapper.insertAdjacentHTML('beforeend', tipsHTML); 8003 tipsEl = document.getElementById('cnvs-tips-element'); 8004 } 8005 8006 var tipsTitle = document.getElementById('cnvs-tips-element-title'); 8007 var tipsContent = document.getElementById('cnvs-tips-element-content'); 8008 var tipsDisable = document.getElementById('cnvs-tips-element-disable'); 8009 var tipsEnable = document.getElementById('cnvs-tips-element-enable'); 8010 8011 tipsTitle.innerHTML = randomTip.title; 8012 tipsContent.innerHTML = randomTip.content; 8013 8014 if( tipsDisable ) { 8015 tipsDisable.onclick = function(e) { 8016 e.preventDefault(); 8017 8018 var tipsToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('cnvs-tips-element')); 8019 tipsToast.hide(); 8020 8021 __core.cookie.set('__cnvs_tips_cookies', 'hide', 1); 8022 }; 8023 } 8024 8025 if( tipsEnable ) { 8026 tipsEnable.onclick = function(e) { 8027 e.preventDefault(); 8028 8029 __core.cookie.remove('__cnvs_tips_cookies'); 8030 window.location.reload(); 8031 }; 8032 } 8033 8034 (function(){ 8035 var enabled = true; 8036 8037 if( __core.cookie.get('__cnvs_tips_cookies' ) == 'hide' ) { 8038 enabled = false; 8039 } 8040 8041 if( enabled ) { 8042 body.add('init-plugin-tips'); 8043 setTimeout(function(){ 8044 __modules.notifications(tipsEl); 8045 }, Math.floor(Math.random() * 5000)); 8046 } 8047 })(); 8048 }); 8049 } 8050 }; 8051 }(), 8052 // Tips Functions End 8053 8054 /** 8055 * -------------------------------------------------------------------------- 8056 * TextSplitter Functions Start 8057 * -------------------------------------------------------------------------- 8058 */ 8059 TextSplitter: function() { 8060 var _getText = function(element) { 8061 return element.textContent || element.innerText; 8062 }; 8063 8064 var _joiner = function(arr, joiner='span', glue=' ') { 8065 return arr.map( function(chunk) { 8066 return '<'+ joiner +'>' + chunk + '</'+ joiner +'>'; 8067 }).join(glue); 8068 }; 8069 8070 var _words = function(element, joiner='span') { 8071 return _joiner(_getText(element).split(' '), joiner, ' '); 8072 }; 8073 8074 var _letters = function(element, joiner='span') { 8075 return _joiner(_getText(element).split(''), joiner, ''); 8076 }; 8077 8078 var _splitter = function(el, type = 'word') { 8079 el.innerHTML = type == 'letter' ? _letters(el) : _words(el); 8080 8081 el.querySelectorAll('span')?.forEach( function(elem, index) { 8082 elem.style.setProperty('--cnvs-split-index', index + 1); 8083 }); 8084 }; 8085 8086 return { 8087 init: function(selector) { 8088 if( __core.getSelector(selector, false, false).length < 1 ){ 8089 return true; 8090 } 8091 8092 selector = __core.getSelector( selector, false ); 8093 if( selector.length < 1 ){ 8094 return true; 8095 } 8096 8097 selector.forEach( function(el) { 8098 var type = el.getAttribute('data-split-type') || 'word'; 8099 8100 _splitter(el, type); 8101 }); 8102 } 8103 }; 8104 }(), 8105 // TextSplitter Functions End 8106 8107 /** 8108 * -------------------------------------------------------------------------- 8109 * MediaActions Functions Start 8110 * -------------------------------------------------------------------------- 8111 */ 8112 MediaActions: function() { 8113 var _pauseEv = ['ended', 'error', 'pause', 'seeking', 'waiting']; 8114 var _playEv = ['play', 'playing', 'timeupdate']; 8115 8116 var _volume = function(mediaEl) { 8117 var mediaWrap = mediaEl.closest('.media-wrap'); 8118 8119 if( mediaEl.volume < 0.1 || mediaEl.muted == true ) { 8120 mediaWrap.classList.add('media-is-muted'); 8121 } else { 8122 mediaWrap.classList.remove('media-is-muted'); 8123 } 8124 }; 8125 8126 var _time = function(duration) { 8127 var minutes = (duration / 60).toFixed(0); 8128 var seconds = (duration % 60).toFixed(0); 8129 8130 return minutes + ':' + (seconds < 10 ? '0' + seconds : seconds); 8131 }; 8132 8133 return { 8134 init: function(selector) { 8135 if( __core.getSelector(selector, false, false).length < 1 ){ 8136 return true; 8137 } 8138 8139 __core.initFunction({ class: 'has-plugin-mediaactions', event: 'pluginMediaActionsReady' }); 8140 8141 selector = __core.getSelector( selector, false ); 8142 if( selector.length < 1 ){ 8143 return true; 8144 } 8145 8146 selector.forEach( function(mediaWrap) { 8147 var mediaEl = mediaWrap.querySelector('video,audio'); 8148 var mediaTrigger = mediaWrap.querySelector('.media-trigger-playback'); 8149 var volumeTrigger = mediaWrap.querySelector('.media-trigger-volume'); 8150 var mediaDuration = mediaWrap.querySelector('.media-duration'); 8151 8152 if( !mediaEl ) { 8153 return true; 8154 } 8155 8156 _pauseEv.forEach( function(_event) { 8157 mediaEl.addEventListener(_event, function(){ 8158 mediaWrap.classList.remove('media-is-playing'); 8159 _volume(mediaEl); 8160 }); 8161 }); 8162 8163 _playEv.forEach( function(_event) { 8164 mediaEl.addEventListener(_event, function(){ 8165 mediaWrap.classList.add('media-is-playing'); 8166 _volume(mediaEl); 8167 8168 if( mediaDuration ) { 8169 mediaDuration.innerHTML = _time(mediaEl.currentTime); 8170 } 8171 }); 8172 }); 8173 8174 mediaEl.addEventListener('volumechange', function(){ 8175 _volume(mediaEl); 8176 }); 8177 8178 var ifLoaded = setInterval( function(){ 8179 if( mediaEl.readyState === 4 ) { 8180 if( mediaDuration ) { 8181 mediaDuration.innerHTML = _time(mediaEl.duration); 8182 } 8183 8184 clearInterval(ifLoaded); 8185 } 8186 }, 1000); 8187 8188 if( mediaTrigger ) {
8189 mediaTrigger.onclick = function(e) { 8190 e.preventDefault(); 8191 8192 if (mediaEl.paused) { 8193 mediaEl.play(); 8194 } else { 8195 mediaEl.pause(); 8196 } 8197 }; 8198 } 8199 8200 if( volumeTrigger ) { 8201 volumeTrigger.onclick = function(e) { 8202 e.preventDefault(); 8203 8204 if (mediaEl.muted) { 8205 mediaEl.muted = false; 8206 } else { 8207 mediaEl.muted = true; 8208 } 8209 }; 8210 } 8211 }); 8212 } 8213 }; 8214 }(), 8215 // MediaActions Functions End 8216 8217 /** 8218 * -------------------------------------------------------------------------- 8219 * ViewportDetect Functions Start 8220 * -------------------------------------------------------------------------- 8221 */ 8222 ViewportDetect: function() { 8223 var _setBSTheme = function(target) { 8224 if( target.classList.contains('dark') ) { 8225 target.setAttribute('data-bs-theme', 'dark'); 8226 } else { 8227 target.removeAttribute('data-bs-theme'); 8228 } 8229 }; 8230 8231 return { 8232 init: function(selector) { 8233 if( __core.getSelector(selector, false, false).length < 1 ){ 8234 return true; 8235 } 8236 8237 __core.initFunction({ class: 'has-plugin-viewportdetect', event: 'pluginViewportDetectReady' }); 8238 8239 selector = __core.getSelector( selector, false ); 8240 if( selector.length < 1 ){ 8241 return true; 8242 } 8243 8244 selector.forEach( function(el) { 8245 var elDelay = el.getAttribute('data-delay') || 0; 8246 var elClass = el.getAttribute('data-viewport-class') || ""; 8247 var elClassOut = el.getAttribute('data-viewport-class-out') || ""; 8248 var elClassTarget = el.getAttribute('data-viewport-class-target'); 8249 var elThreshold = el.getAttribute('data-viewport-threshold') || "0"; 8250 var elRootMargin = el.getAttribute('data-viewport-rootmargin') || "0px"; 8251 8252 elClass = elClass.split(" "); 8253 elClassOut = elClassOut.split(" "); 8254 8255 var hasDark = false; 8256 8257 if( elClass.includes('dark') || elClassOut.includes('dark') ) { 8258 hasDark = true; 8259 } 8260 8261 elClassTarget = elClassTarget ? document.querySelector(elClassTarget) : false; 8262 8263 var observer = new IntersectionObserver( function(el) { 8264 el.forEach( function(entry) { 8265 var elTarget = entry.target; 8266 8267 if( !elClassTarget ) { 8268 elClassTarget = elTarget; 8269 } 8270 8271 if( entry.isIntersecting ) { 8272 setTimeout( function() { 8273 elTarget.classList.add('is-in-viewport'); 8274 8275 elClass.forEach( function(_class) { 8276 _class && elClassTarget.classList.add(_class); 8277 }); 8278 8279 elClassOut.forEach( function(_class) { 8280 _class && elClassTarget.classList.remove(_class); 8281 }); 8282 8283 hasDark && _setBSTheme(elClassTarget); 8284 }, Number(elDelay)); 8285 } else { 8286 elTarget.classList.remove('is-in-viewport'); 8287 8288 elClass.forEach( function(_class) { 8289 _class && elClassTarget.classList.remove(_class); 8290 }); 8291 8292 elClassOut.forEach( function(_class) { 8293 _class && elClassTarget.classList.add(_class); 8294 }); 8295 8296 hasDark && _setBSTheme(elClassTarget); 8297 } 8298 }); 8299 }, { 8300 threshold: parseFloat(elThreshold), 8301 rootMargin: elRootMargin, 8302 }); 8303 8304 observer.observe(el); 8305 }); 8306 } 8307 }; 8308 }(), 8309 // ViewportDetect Functions End 8310 8311 /** 8312 * -------------------------------------------------------------------------- 8313 * ScrollDetect Functions Start 8314 * -------------------------------------------------------------------------- 8315 */ 8316 ScrollDetect: function() { 8317 var _detects = []; 8318 8319 var _percent = function(params) { 8320 var percent = 0, 8321 ratio = 0, 8322 start = 0, 8323 end = 0; 8324 8325 var onScroll = function(params) { 8326 fastdom.measure( function(){ 8327 var position = window.scrollY; 8328 8329 if( position >= params.start && position <= params.end ) { 8330 var startViewScroll = position - params.start; 8331 var offsetScroll = position - params.offset; 8332 percent = (startViewScroll / params.range.full) * 100; 8333 start = (startViewScroll / params.range.start); 8334 8335 if( position > (params.start + params.height) && position < (params.offset) ) { 8336 start = 1; 8337 end = 0; 8338 } else if( position >= (params.offset) ) { 8339 start = 1; 8340 end = (offsetScroll / params.range.end); 8341 } else { 8342 end = 0; 8343 } 8344 8345 ratio = start - end; 8346 } else if( position > params.end ) { 8347 percent = 100; 8348 ratio = 0; 8349 start = end = 1; 8350 } else { 8351 percent = ratio = start = end = 0; 8352 } 8353 8354 if( ratio > 0 ) { 8355 params.elem.classList.add('scroll-detect-inview'); 8356 } else { 8357 params.elem.classList.remove('scroll-detect-inview'); 8358 } 8359 8360 if( start > 0 && start < 1 ) { 8361 params.elem.classList.add('scroll-detect-inview-start'); 8362 } else { 8363 params.elem.classList.remove('scroll-detect-inview-start'); 8364 } 8365 8366 if( end > 0 && end < 1 ) { 8367 params.elem.classList.add('scroll-detect-inview-end'); 8368 } else { 8369 params.elem.classList.remove('scroll-detect-inview-end'); 8370 } 8371 8372 params.elem.style.setProperty('--cnvs-scroll-percent', percent); 8373 params.elem.style.setProperty('--cnvs-scroll-ratio', ratio); 8374 params.elem.style.setProperty('--cnvs-scroll-start', start); 8375 params.elem.style.setProperty('--cnvs-scroll-end', end); 8376 }); 8377 }; 8378 8379 onScroll(params); 8380 }; 8381 8382 var _handle = function() {
8383 _detects.forEach( function(settings) { 8384 _percent(settings); 8385 }); 8386 } 8387 8388 return { 8389 init: function(selector) { 8390 if( __core.getSelector(selector, false, false).length < 1 ){ 8391 return true; 8392 } 8393 8394 __core.isFuncTrue( function() { 8395 return typeof fastdom !== 'undefined'; 8396 }).then( function(cond) { 8397 if( !cond ) { 8398 return false; 8399 } 8400 8401 __core.initFunction({ class: 'has-plugin-scrolldetect', event: 'pluginScrollDetectReady' }); 8402 8403 selector = __core.getSelector( selector, false ); 8404 if( selector.length < 1 ){ 8405 return true; 8406 } 8407 8408 var resizeObserver = new ResizeObserver( function(entries) { 8409 entries.forEach( function(entry) { 8410 if( !doing ) { 8411 var doing = setTimeout( function() { 8412 initParams(selector); 8413 doing = false; 8414 }, 333); 8415 } 8416 }); 8417 }); 8418 8419 var initParams = function(selector) { 8420 _detects = []; 8421 8422 selector.forEach( function(elem) { 8423 var elemWidth = elem.offsetWidth, 8424 elemHeight = elem.offsetHeight, 8425 elemOffset = __core.offset(elem).top, 8426 viewportHeight = __core.getVars.viewport.height, 8427 includeWidth = elem.getAttribute('data-include-width'), 8428 includeHeight = elem.getAttribute('data-include-height'), 8429 includeOffset = elem.getAttribute('data-include-offset'), 8430 scrollOffset = elem.getAttribute('data-scroll-offset'), 8431 parallaxRatio = elem.getAttribute('data-parallax-ratio'), 8432 params = {}; 8433 8434 if( scrollOffset ) { 8435 scrollOffset = scrollOffset.split('%'); 8436 8437 if( scrollOffset.length > 1 ) { 8438 elemOffset = elemOffset + (viewportHeight * Number(scrollOffset[0]) * 0.01); 8439 } else if( scrollOffset.length == 1 && scrollOffset[0] ) { 8440 elemOffset = elemOffset + Number(scrollOffset[0]); 8441 } 8442 } 8443 8444 var scrollStart = elemOffset - viewportHeight, 8445 scrollEnd = elemOffset + elemHeight, 8446 scrollRange = scrollEnd - scrollStart; 8447 8448 params.elem = elem; 8449 params.start = scrollStart; 8450 params.end = scrollEnd; 8451 params.range = { 8452 start: elemHeight, 8453 end: elemHeight, 8454 full: scrollRange, 8455 }; 8456 params.width = elemWidth; 8457 params.height = elemHeight; 8458 params.offset = elemOffset; 8459 8460 if( includeWidth == 'true' || (elem.classList.contains('parallax') && elem.getAttribute('data-parallax-direction') == 'horizontal') ) { 8461 elem.style.setProperty('--cnvs-scroll-width', params.width); 8462 } 8463 8464 if( includeHeight == 'true' || (elem.classList.contains('parallax') && elem.getAttribute('data-parallax-direction') != 'horizontal') ) { 8465 elem.style.setProperty('--cnvs-scroll-height', params.height); 8466 } 8467 8468 if( includeOffset == 'true' ) { 8469 elem.style.setProperty('--cnvs-scroll-offset', params.offset); 8470 } 8471 8472 if( !isNaN(parallaxRatio) ) { 8473 elem.style.setProperty('--cnvs-parallax-ratio', parallaxRatio); 8474 } 8475 8476 _percent(params); 8477 _detects.push(params); 8478 8479 resizeObserver.observe(elem); 8480 }); 8481 }; 8482 8483 initParams(selector); 8484 _handle(); 8485 8486 // var ticking = false; 8487 window.addEventListener("scroll", function(){ 8488 fastdom.mutate( function(){ 8489 _handle(); 8490 }); 8491 // if (!ticking) { 8492 // window.requestAnimationFrame( function(){ 8493 // _handle(); 8494 // ticking = false; 8495 // }); 8496 // ticking = true; 8497 // } 8498 }, {passive: true}); 8499 8500 resizeObserver.observe(document.documentElement); 8501 }); 8502 } 8503 }; 8504 }(), 8505 // ScrollDetect Functions End 8506 8507 /** 8508 * -------------------------------------------------------------------------- 8509 * FontSizer Functions Start 8510 * -------------------------------------------------------------------------- 8511 */ 8512 FontSizer: function() { 8513 return { 8514 init: function(selector) { 8515 if( __core.getSelector(selector, false, false).length < 1 ){ 8516 return true; 8517 } 8518 8519 __core.initFunction({ class: 'has-plugin-fontsizer', event: 'pluginFontSizerReady' }); 8520 8521 selector = __core.getSelector( selector, false ); 8522 if( selector.length < 1 ){ 8523 return true; 8524 } 8525 8526 selector.forEach( function(elem) { 8527 var target = elem.getAttribute('data-target'); 8528 var targetEl = document.querySelector(target); 8529 var step = elem.getAttribute('data-step') || 10; 8530 var min = elem.getAttribute('data-min') || 12; 8531 var max = elem.getAttribute('data-max') || 24; 8532 var defaultSize = Number(document.defaultView.getComputedStyle(targetEl).getPropertyValue('font-size').split('px')[0]); 8533 var percent = defaultSize * Number(step) * .01; 8534 8535 var defaultBtn = elem.querySelector('.font-size-default'); 8536 var minusBtn = elem.querySelector('.font-size-minus'); 8537 var plusBtn = elem.querySelector('.font-size-plus'); 8538 8539 if( defaultBtn ) { 8540 defaultBtn.onclick = function(e) { 8541 e.preventDefault(); 8542 targetEl.style.fontSize = defaultSize + 'px'; 8543 }; 8544 } 8545
8546 if( minusBtn ) { 8547 elem.querySelector('.font-size-minus').onclick = function(e) { 8548 e.preventDefault(); 8549 8550 var current = Number(document.defaultView.getComputedStyle(targetEl).getPropertyValue('font-size').split('px')[0]); 8551 var newSize = current - percent; 8552 if( newSize >= min ) { 8553 targetEl.style.fontSize = newSize + 'px'; 8554 } 8555 }; 8556 } 8557 8558 if( plusBtn ) { 8559 elem.querySelector('.font-size-plus').onclick = function(e) { 8560 e.preventDefault(); 8561 8562 var current = Number(document.defaultView.getComputedStyle(targetEl).getPropertyValue('font-size').split('px')[0]); 8563 var newSize = current + percent; 8564 if( newSize <= max ) { 8565 targetEl.style.fontSize = newSize + 'px'; 8566 } 8567 }; 8568 } 8569 }); 8570 } 8571 }; 8572 }(), 8573 // FontSizer Functions End 8574 8575 /** 8576 * -------------------------------------------------------------------------- 8577 * Hover3D Functions Start 8578 * -------------------------------------------------------------------------- 8579 */ 8580 Hover3D: function() { 8581 return { 8582 init: function(selector) { 8583 if( __core.getSelector(selector, false, false).length < 1 ){ 8584 return true; 8585 } 8586 8587 __core.initFunction({ class: 'has-plugin-hover3d', event: 'pluginHover3DReady' }); 8588 8589 selector = __core.getSelector( selector, false ); 8590 if( selector.length < 1 ){ 8591 return true; 8592 } 8593 8594 selector.forEach( function(el) { 8595 var height = el.clientHeight; 8596 var width = el.clientWidth; 8597 8598 el.addEventListener( 'mousemove', function(e) { 8599 var xVal = e.layerX; 8600 var yVal = e.layerY; 8601 8602 var yRotation = 20 * ((xVal - width / 2) / width); 8603 var xRotation = -20 * ((yVal - height / 2) / height); 8604 8605 var transform = 'perspective(500px) scale(1.1) rotateX(' + xRotation + 'deg) rotateY(' + yRotation + 'deg) rotateZ(0)'; 8606 8607 el.style.transform = transform; 8608 }); 8609 8610 el.addEventListener( 'mouseout', function() { 8611 el.style.transform = 'perspective(500px) scale(1) rotateX(0) rotateY(0) rotateZ(0)'; 8612 }); 8613 8614 el.addEventListener( 'mousedown', function() { 8615 el.style.transform = 'perspective(500px) scale(0.9) rotateX(0) rotateY(0) rotateZ(0)'; 8616 }); 8617 8618 el.addEventListener( 'mouseup', function() { 8619 el.style.transform = 'perspective(500px) scale(1.1) rotateX(0) rotateY(0) rotateZ(0)'; 8620 }); 8621 }); 8622 } 8623 }; 8624 }(), 8625 // Hover3D Functions End 8626 8627 /** 8628 * -------------------------------------------------------------------------- 8629 * Buttons Functions Start 8630 * -------------------------------------------------------------------------- 8631 */ 8632 Buttons: function() { 8633 return { 8634 init: function(selector) { 8635 if( __core.getSelector(selector, false, false).length < 1 ){ 8636 return true; 8637 } 8638 8639 __core.initFunction({ class: 'has-plugin-buttons', event: 'pluginButtonsReady' }); 8640 8641 selector = __core.getSelector( selector, false ); 8642 if( selector.length < 1 ){ 8643 return true; 8644 } 8645 8646 selector.forEach( function(el){ 8647 var text = el.innerHTML; 8648 el.innerHTML = ''; 8649 8650 var inner = document.createElement('div'); 8651 inner.classList.add('button-inner'); 8652 8653 var span = document.createElement('span'); 8654 8655 span.innerHTML = text; 8656 8657 inner.append(span); 8658 8659 var span2 = span.cloneNode(true); 8660 span.after(span2); 8661 8662 el.append(inner); 8663 }); 8664 } 8665 }; 8666 }(), 8667 // Buttons Functions End 8668 8669 /** 8670 * -------------------------------------------------------------------------- 8671 * BSComponents Functions Start 8672 * -------------------------------------------------------------------------- 8673 */ 8674 BSComponents: function() { 8675 return { 8676 init: function(selector) { 8677 if( __core.getSelector(selector, false, false).length < 1 ){ 8678 return true; 8679 } 8680 8681 __core.isFuncTrue( function() { 8682 return typeof bootstrap !== 'undefined'; 8683 }).then( function(cond) { 8684 if( !cond ) { 8685 return false; 8686 } 8687 8688 __core.initFunction({ class: 'has-plugin-bscomponents', event: 'pluginBsComponentsReady' }); 8689 8690 selector = __core.getSelector( selector, false ); 8691 if( selector.length < 1 ){ 8692 return true; 8693 } 8694 8695 var tooltips = [].slice.call(__core.getVars.baseEl.querySelectorAll('[data-bs-toggle="tooltip"]')); 8696 var tooltipList = tooltips.map( function(tooltipEl) { 8697 return new bootstrap.Tooltip(tooltipEl, {container: 'body'}); 8698 }); 8699 8700 var popovers = [].slice.call(__core.getVars.baseEl.querySelectorAll('[data-bs-toggle="popover"]'));
8701 var popoverList = popovers.map( function(popoverEl) { 8702 return new bootstrap.Popover(popoverEl, {container: 'body'}); 8703 }); 8704 8705 var tabs = document.querySelectorAll('[data-bs-toggle="tab"],[data-bs-toggle="pill"]'); 8706 8707 var tabTargetShow = function(target) { 8708 var tabTrigger = new bootstrap.Tab(target); 8709 tabTrigger.show(); 8710 if( __core.getVars.hash && document.querySelector('[data-bs-target="'+__core.getVars.hash+'"]') ) { 8711 setTimeout( function(){ 8712 __core.scrollTo((__core.offset(target).top - __core.getVars.topScrollOffset - 20), 0, false, 'smooth'); 8713 }, 1000); 8714 } 8715 }; 8716 8717 document.querySelectorAll('.canvas-tabs').forEach( function(el) { 8718 var activeTab = el.getAttribute('data-active'); 8719 8720 if( activeTab ) { 8721 activeTab = Number(activeTab) - 1; 8722 tabTargetShow(el.querySelectorAll('[data-bs-target]')[activeTab]); 8723 } 8724 }); 8725 8726 document.querySelectorAll('.tab-hover').forEach( function(el) { 8727 el.querySelectorAll('[data-bs-target]').forEach( function(tab) { 8728 tab.addEventListener( 'mouseenter', function() { 8729 tabTargetShow(tab); 8730 }); 8731 }); 8732 }); 8733 8734 if( __core.getVars.hash && document.querySelector('[data-bs-target="'+__core.getVars.hash+'"]') ) { 8735 tabTargetShow(document.querySelector('[data-bs-target="'+__core.getVars.hash+'"]')); 8736 } 8737
8738 tabs.forEach( function(el) { 8739 el.addEventListener('shown.bs.tab', function(e) { 8740 if( !el.classList.contains('container-modules-loaded') ) { 8741 var tabContent = el.getAttribute('data-bs-target') ? el.getAttribute('data-bs-target') : el.getAttribute('href'); 8742 __core.runContainerModules(document.querySelector(tabContent)); 8743 8744 document.querySelector(tabContent).querySelectorAll('.flexslider').forEach( function(flex) { 8745 setTimeout( function() { 8746 jQuery(flex).find('.slide').resize(); 8747 }, 500); 8748 }); 8749 8750 el.classList.add('container-modules-loaded'); 8751 } 8752 }); 8753 }); 8754 8755 document.querySelectorAll('.style-msg .btn-close').forEach( function(el) { 8756 el.onclick = function(e) { 8757 e.preventDefault(); 8758 8759 el.closest( '.style-msg' ).classList.add('d-none'); 8760 }; 8761 }); 8762 }); 8763 } 8764 }; 8765 }(), 8766 // BSComponents Functions End 8767 }; 8768})));
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.