1 2// Theme 3window.theme = {}; 4 5// Theme Common Functions 6window.theme.fn = { 7 8 getOptions: function(opts) { 9 10 if (typeof(opts) == 'object') { 11 12 return opts; 13 14 } else if (typeof(opts) == 'string') { 15 16 try { 17 return JSON.parse(opts.replace(/'/g, '"').replace(';', '')); 18 } catch (e) { 19 return {}; 20 } 21 22 } else { 23 24 return {}; 25 26 } 27 28 }, 29 30 execPluginFunction: function(functionName, context) { 31 var args = Array.prototype.slice.call(arguments, 2); 32 var namespaces = functionName.split("."); 33 var func = namespaces.pop(); 34 35 for (var i = 0; i < namespaces.length; i++) { 36 context = context[namespaces[i]]; 37 } 38 39 return context[func].apply(context, args); 40 }, 41 42 intObs: function(selector, functionName, intObsOptions, alwaysObserve) { 43 var $el = document.querySelectorAll(selector); 44 var intersectionObserverOptions = { 45 rootMargin: '0px 0px 200px 0px' 46 } 47 48 if (Object.keys(intObsOptions).length) { 49 intersectionObserverOptions = $.extend(intersectionObserverOptions, intObsOptions); 50 } 51 52 var observer = new IntersectionObserver(function(entries) { 53 for (var i = 0; i < entries.length; i++) { 54 var entry = entries[i]; 55 56 if (entry.intersectionRatio > 0) { 57 if (typeof functionName === 'string') { 58 var func = Function('return ' + functionName)(); 59 } else { 60 var callback = functionName; 61 62 callback.call($(entry.target)); 63 } 64 65 // Unobserve 66 if (!alwaysObserve) { 67 observer.unobserve(entry.target); 68 } 69 70 } 71 } 72 }, intersectionObserverOptions); 73 74 $($el).each(function() { 75 observer.observe($(this)[0]); 76 }); 77 }, 78 79 intObsInit: function(selector, functionName) { 80 var $el = document.querySelectorAll(selector); 81 var intersectionObserverOptions = { 82 rootMargin: '200px' 83 } 84 85 var observer = new IntersectionObserver(function(entries) { 86 for (var i = 0; i < entries.length; i++) { 87 var entry = entries[i]; 88 if (entry.intersectionRatio > 0) { 89 90 var $this = $(entry.target), 91 opts; 92 93 var pluginOptions = theme.fn.getOptions($this.data('plugin-options')); 94 if (pluginOptions) 95 opts = pluginOptions; 96 97 theme.fn.execPluginFunction(functionName, $this, opts); 98 99 // Unobserve 100 observer.unobserve(entry.target); 101 } 102 } 103 }, intersectionObserverOptions); 104 105 $($el).each(function() { 106 observer.observe($(this)[0]); 107 }); 108 }, 109 110 dynIntObsInit: function(selector, functionName, pluginDefaults) { 111 var $el = document.querySelectorAll(selector); 112 113 $($el).each(function() { 114 var $this = $(this), 115 opts; 116 117 var pluginOptions = theme.fn.getOptions($this.data('plugin-options')); 118 if (pluginOptions) 119 opts = pluginOptions; 120 121 var mergedPluginDefaults = theme.fn.mergeOptions(pluginDefaults, opts) 122 123 var intersectionObserverOptions = { 124 rootMargin: theme.fn.getRootMargin(functionName, mergedPluginDefaults), 125 threshold: 0 126 } 127 128 if (!mergedPluginDefaults.forceInit) { 129 130 var observer = new IntersectionObserver(function(entries) { 131 for (var i = 0; i < entries.length; i++) { 132 var entry = entries[i]; 133 134 if (entry.intersectionRatio > 0) { 135 theme.fn.execPluginFunction(functionName, $this, mergedPluginDefaults); 136 137 // Unobserve 138 observer.unobserve(entry.target); 139 } 140 } 141 }, intersectionObserverOptions); 142 143 observer.observe($this[0]); 144 145 } else { 146 theme.fn.execPluginFunction(functionName, $this, mergedPluginDefaults); 147 } 148 }); 149 }, 150 151 getRootMargin: function(plugin, pluginDefaults) { 152 switch (plugin) { 153 case 'themePluginCounter': 154 return pluginDefaults.accY ? '0px 0px ' + pluginDefaults.accY + 'px 0px' : '0px 0px 200px 0px'; 155 break; 156 157 case 'themePluginAnimate': 158 return pluginDefaults.accY ? '0px 0px ' + pluginDefaults.accY + 'px 0px' : '0px 0px 200px 0px'; 159 break; 160 161 case 'themePluginIcon': 162 return pluginDefaults.accY ? '0px 0px ' + pluginDefaults.accY + 'px 0px' : '0px 0px 200px 0px'; 163 break; 164 165 case 'themePluginRandomImages': 166 return pluginDefaults.accY ? '0px 0px ' + pluginDefaults.accY + 'px 0px' : '0px 0px 200px 0px'; 167 break; 168 169 default: 170 return '0px 0px 200px 0px'; 171 break; 172 } 173 }, 174 175 mergeOptions: function(obj1, obj2) { 176 var obj3 = {}; 177 178 for (var attrname in obj1) { 179 obj3[attrname] = obj1[attrname]; 180 } 181 for (var attrname in obj2) { 182 obj3[attrname] = obj2[attrname]; 183 } 184 185 return obj3; 186 }, 187 188 execOnceTroughEvent: function($el, event, callback) { 189 var self = this, 190 dataName = self.formatDataName(event); 191 192 $($el).on(event, function() { 193 if (!$(this).data(dataName)) { 194 195 // Exec Callback Function 196 callback.call($(this)); 197 198 // Add data name 199 $(this).data(dataName, true); 200 201 // Unbind event 202 $(this).off(event); 203 } 204 }); 205 206 return this; 207 }, 208 209 execOnceTroughWindowEvent: function($el, event, callback) { 210 var self = this, 211 dataName = self.formatDataName(event); 212 213 $($el).on(event, function() { 214 if (!$(this).data(dataName)) { 215 216 // Exec Callback Function 217 callback(); 218 219 // Add data name 220 $(this).data(dataName, true); 221 222 // Unbind event 223 $(this).off(event); 224 } 225 }); 226 227 return this; 228 }, 229 230 formatDataName: function(name) { 231 name = name.replace('.', ''); 232 return name; 233 }, 234 235 isElementInView: function($el) { 236 var rect = $el[0].getBoundingClientRect(); 237 238 return ( 239 rect.top <= (window.innerHeight / 3) 240 ); 241 }, 242 243 getScripts: function(arr, path) { 244 var _arr = $.map(arr, function(scr) { 245 return $.getScript((path || "") + scr); 246 }); 247 248 _arr.push($.Deferred(function(deferred) { 249 $(deferred.resolve); 250 })); 251 252 return $.when.apply($, _arr); 253 }, 254 255 showErrorMessage: function(title, content) { 256 257 $('.modalThemeErrorMessage').remove(); 258 $('body').append('<div class="modal fade" id="modalThemeErrorMessage" aria-hidden="true" tabindex="-1"><div class="modal-dialog modal-dialog-centered"><div class="modal-content"><div class="modal-header"><h5 class="modal-title">' + title + '</h5><button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button></div><div class="modal-body">' + content + '</div><div class="modal-footer"><button type="button" class="btn btn-primary" data-bs-dismiss="modal">Close</button></div></div></div></div>'); 259 260 var modalThemeErrorMessage = document.getElementById('modalThemeErrorMessage'); 261 var modalThemeErrorMessage = bootstrap.Modal.getOrCreateInstance(modalThemeErrorMessage); 262 modalThemeErrorMessage.show(); 263 264 } 265 266}; 267 268(function($) { 269 270 /*
271 Local Environment Warning 272 */ 273 try { 274 if ("file://" === location.origin) { 275 if ($('[data-icon]').length || $('iframe').length) { 276 277 theme.fn.showErrorMessage('Local Environment Warning', 'SVG Objects, Icons, YouTube and Vimeo Videos might not show correctly on local environment. For better result, please preview on a server.'); 278 279 } 280 } 281 } catch (e) {} 282 283 /* 284 Browser Selector 285 */ 286 $.extend({ 287 288 browserSelector: function() { 289 290 // jQuery.browser.mobile (http://detectmobilebrowser.com/) 291 (function(a){(jQuery.browser=jQuery.browser||{}).mobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))})(navigator.userAgent||navigator.vendor||window.opera); 292 293 // Touch 294 var hasTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints; 295 296 var u = navigator.userAgent, 297 ua = u.toLowerCase(), 298 is = function (t) { 299 return ua.indexOf(t) > -1; 300 }, 301 g = 'gecko', 302 w = 'webkit', 303 s = 'safari', 304 o = 'opera', 305 h = document.documentElement, 306 b = [(!(/opera|webtv/i.test(ua)) && /msie\s(\d)/.test(ua)) ? ('ie ie' + parseFloat(navigator.appVersion.split("MSIE")[1])) : is('firefox/2') ? g + ' ff2' : is('firefox/3.5') ? g + ' ff3 ff3_5' : is('firefox/3') ? g + ' ff3' : is('gecko/') ? g : is('opera') ? o + (/version\/(\d+)/.test(ua) ? ' ' + o + RegExp.jQuery1 : (/opera(\s|\/)(\d+)/.test(ua) ? ' ' + o + RegExp.jQuery2 : '')) : is('konqueror') ? 'konqueror' : is('chrome') ? w + ' chrome' : is('iron') ? w + ' iron' : is('applewebkit/') ? w + ' ' + s + (/version\/(\d+)/.test(ua) ? ' ' + s + RegExp.jQuery1 : '') : is('mozilla/') ? g : '', is('j2me') ? 'mobile' : is('iphone') ? 'iphone' : is('ipod') ? 'ipod' : is('mac') ? 'mac' : is('darwin') ? 'mac' : is('webtv') ? 'webtv' : is('win') ? 'win' : is('freebsd') ? 'freebsd' : (is('x11') || is('linux')) ? 'linux' : '', 'js']; 307 308 c = b.join(' '); 309 310 if ($.browser.mobile) { 311 c += ' mobile'; 312 } 313 314 if (hasTouch) { 315 c += ' touch'; 316 } 317 318 h.className += ' ' + c; 319 320 // Edge Detect 321 var isEdge = /Edge/.test(navigator.userAgent); 322 323 if(isEdge) { 324 $('html').removeClass('chrome').addClass('edge'); 325 } 326 327 // Dark and Boxed Compatibility 328 if($('body').hasClass('dark')) { 329 $('html').addClass('dark'); 330 } 331 332 if($('body').hasClass('boxed')) { 333 $('html').addClass('boxed'); 334 } 335 336 } 337 338 }); 339 340 $.browserSelector(); 341 342 /* 343 Browser Workarounds 344 */ 345 if (/iPad|iPhone|iPod/.test(navigator.platform)) { 346
347 // iPad/Iphone/iPod Hover Workaround 348 $(document).ready(function($) { 349 $('.thumb-info').attr('onclick', 'return true'); 350 }); 351 } 352 353 /* 354 Tabs 355 */ 356 if( $('a[data-bs-toggle="tab"]').length ) { 357 $('a[data-bs-toggle="tab"]').on('shown.bs.tab', function (e) { 358 var $tabPane = $($(e.target).attr('href')); 359 360 // Carousel Refresh 361 if($tabPane.length) { 362 $tabPane.find('.owl-carousel').trigger('refresh.owl.carousel'); 363 } 364 365 // Change Active Class 366 $(this).parents('.nav-tabs').find('.active').removeClass('active'); 367 $(this).addClass('active').parent().addClass('active'); 368 }); 369 370 if( window.location.hash ) { 371 $(window).on('load', function(){ 372 if( window.location.hash !== '*' && $( window.location.hash ).get(0) ) { 373 new bootstrap.Tab( $('a.nav-link[href="'+ window.location.hash +'"]:not([data-hash])')[0] ).show(); 374 } 375 }); 376 } 377 } 378 379 /* 380 On Load Scroll 381 */ 382 if( !$('html').hasClass('disable-onload-scroll') && window.location.hash && !['#*'].includes( window.location.hash ) ) { 383 384 window.scrollTo(0, 0); 385 386 $(window).on('load', function() { 387 setTimeout(function() { 388 389 var target = window.location.hash, 390 offset = ( $(window).width() < 768 ) ? 180 : 90; 391 392 if (!$(target).length) { 393 return; 394 } 395 396 if ( $("a[href$='" + window.location.hash + "']").is('[data-hash-offset]') ) { 397 offset = parseInt( $("a[href$='" + window.location.hash + "']").first().attr('data-hash-offset') ); 398 } else if ( $("html").is('[data-hash-offset]') ) { 399 offset = parseInt( $("html").attr('data-hash-offset') ); 400 } 401 402 if (isNaN(offset)) { 403 offset = 0; 404 } 405 406 $('body').addClass('scrolling'); 407 408 $('html, body').animate({ 409 scrollTop: $(target).offset().top - offset 410 }, 600, 'easeOutQuad', function() { 411 $('body').removeClass('scrolling'); 412 }); 413 414 }, 1); 415 }); 416 } 417 418 /* 419 * Text Rotator 420 */ 421 $.fn.extend({ 422 textRotator: function(options) { 423 424 var defaults = { 425 fadeSpeed: 500, 426 pauseSpeed: 100, 427 child: null 428 }; 429 430 var options = $.extend(defaults, options); 431 432 return this.each(function() { 433 var o = options; 434 var obj = $(this); 435 var items = $(obj.children(), obj); 436 items.each(function() { 437 $(this).hide(); 438 }) 439 if (!o.child) { 440 var next = $(obj).children(':first'); 441 } else { 442 var next = o.child; 443 } 444 $(next).fadeIn(o.fadeSpeed, function() { 445 $(next).delay(o.pauseSpeed).fadeOut(o.fadeSpeed, function() { 446 var next = $(this).next(); 447 if (next.length == 0) { 448 next = $(obj).children(':first'); 449 } 450 $(obj).textRotator({ 451 child: next, 452 fadeSpeed: o.fadeSpeed, 453 pauseSpeed: o.pauseSpeed 454 }); 455 }) 456 }); 457 }); 458 } 459 }); 460 461 /* 462 * Notice Top bar 463 */ 464 var $noticeTopBar = { 465 $wrapper: $('.notice-top-bar'), 466 $closeBtn: $('.notice-top-bar-close'), 467 $header: $('#header'), 468 $body: $('.body'), 469 init: function() { 470 var self = this; 471 472 if( !$.cookie('portoNoticeTopBarClose') ) { 473 self 474 .build() 475 .events(); 476 } else { 477 self.$wrapper.parent().prepend( '<!-- Notice Top Bar removed by cookie -->' ); 478 self.$wrapper.remove(); 479 } 480 481 return this; 482 }, 483 build: function(){ 484 var self = this; 485 486 $(window).on('load', function(){ 487 setTimeout(function(){ 488 self.$body.css({ 489 'margin-top': self.$wrapper.outerHeight(), 490 'transition': 'ease margin 300ms' 491 }); 492 493 $('#noticeTopBarContent').textRotator({ 494 fadeSpeed: 500, 495 pauseSpeed: 5000 496 }); 497 498 if( ['absolute', 'fixed'].includes( self.$header.css('position') ) ) { 499 self.$header.css({ 500 'top': self.$wrapper.outerHeight(), 501 'transition': 'ease top 300ms' 502 }); 503 } 504 505 $(window).trigger('notice.top.bar.opened'); 506 507 }, 1000); 508 }); 509 510 return this; 511 }, 512 events: function() { 513 var self = this; 514 515 self.$closeBtn.on('click', function(e){ 516 e.preventDefault(); 517 518 self.$body.animate({ 519 'margin-top': 0, 520 }, 300, function(){ 521 self.$wrapper.remove(); 522 self.saveCookie(); 523 }); 524 525 if( ['absolute', 'fixed'].includes( self.$header.css('position') ) ) { 526 self.$header.animate({ 527 top: 0 528 }, 300); 529 } 530 531 // When header has shrink effect 532 if( self.$header.hasClass('header-effect-shrink') ) { 533 self.$header.find('.header-body').animate({ 534 top: 0 535 }, 300); 536 } 537 538 $(window).trigger('notice.top.bar.closed'); 539 }); 540 541 return this; 542 }, 543 checkCookie: function(){ 544 var self = this; 545 546 if( $.cookie('portoNoticeTopBarClose') ) { 547 return true; 548 } else { 549 return false; 550 } 551 552 return this; 553 }, 554 saveCookie: function() { 555 var self = this; 556 557 $.cookie('portoNoticeTopBarClose', true); 558 559 return this; 560 } 561 } 562 563 if( $('.notice-top-bar').length ) {
564 $noticeTopBar.init(); 565 } 566 567 /* 568 * Image Hotspots 569 */ 570 if( $('.image-hotspot').length ) { 571 $('.image-hotspot') 572 .append('<span class="ring"></span>') 573 .append('<span class="circle"></span>'); 574 } 575 576 /* 577 * Reading Progress 578 */ 579 if( $('.progress-reading').length ) { 580 581 function updateScrollProgress() { 582 var pixels = $(document).scrollTop() 583 pageHeight = $(document).height() - $(window).height() 584 progress = 100 * pixels / pageHeight; 585 586 $('.progress-reading .progress-bar').width(parseInt(progress) + "%"); 587 } 588 589 $(document).on('scroll ready', function() { 590 updateScrollProgress(); 591 }); 592 593 $(document).ready(function(){ 594 $(window).afterResize(function() { 595 updateScrollProgress(); 596 }); 597 }); 598 599 } 600 601 /* 602 * Page Transition 603 */ 604 if( $('body[data-plugin-page-transition]').length ) { 605 606 var link_click = false; 607 608 $(document).on('click', 'a', function(e){ 609 link_click = $(this); 610 }); 611 612 $(window).on("beforeunload", function(e) { 613 if( typeof link_click === 'object' ) { 614 var href = link_click.attr('href'); 615 616 if( href.indexOf('mailto:') != 0 && href.indexOf('tel:') != 0 && !link_click.data('rm-from-transition') ) { 617 $('body').addClass('page-transition-active'); 618 } 619 } 620 }); 621 622 $(window).on("pageshow", function(e){ 623 if( e.persisted || e.originalEvent.persisted) { 624 if( $('html').hasClass('safari') ) { 625 window.location.reload(); 626 } 627 628 $('body').removeClass('page-transition-active'); 629 } 630 }); 631 } 632 633 /* 634 * Clone Element 635 */ 636 if( $('[data-clone-element]').length ) { 637 638 $('[data-clone-element]').each(function() { 639 640 var $el = $(this), 641 content = $el.html(), 642 qty = $el.attr('data-clone-element'); 643 644 for (var i = 0; i < qty; i++) { 645 $el.html($el.html() + content); 646 } 647 648 }); 649 650 } 651 652 /* 653 * Thumb Info Floating Caption 654 */ 655 $('.thumb-info-floating-caption').each(function() { 656 657 $(this) 658 .addClass('thumb-info-floating-element-wrapper') 659 .append( '<span class="thumb-info-floating-element thumb-info-floating-caption-title d-none">'+ $(this).data('title') +'</span>' ); 660 661 if( $(this).data('type') ) { 662 $('.thumb-info-floating-caption-title', $(this)) 663 .append( '<div class="thumb-info-floating-caption-type">'+ $(this).data('type') +'</div>' ) 664 .css({ 665 'padding-bottom' : 22 666 }); 667 } 668 669 if( $(this).hasClass('thumb-info-floating-caption-clean') ) { 670 $('.thumb-info-floating-element', $(this)).addClass('bg-transparent'); 671 } 672 673 }); 674 675 /* 676 * Thumb Info Floating Element 677 */ 678 if( $('.thumb-info-floating-element-wrapper').length ) { 679 680 if (typeof gsap !== 'undefined') { 681 682 $('.thumb-info-floating-element-wrapper').on('mouseenter', function(e){ 683 684 if(!$(this).data('offset')) { 685 $(this).data('offset', 0); 686 } 687 688 var offset = parseInt($(this).data('offset')); 689 690 $('.thumb-info-floating-element-clone').remove(); 691 692 $('.thumb-info-floating-element', $(this)).clone().addClass('thumb-info-floating-element-clone p-fixed p-events-none').attr('style', 'transform: scale(0.1);').removeClass('d-none').appendTo('body'); 693 694 $('.thumb-info-floating-element-clone').css({ 695 left: e.clientX + (offset), 696 top: e.clientY + (offset) 697 }).fadeIn(300); 698 699 gsap.to('.thumb-info-floating-element-clone', 0.5, { 700 css: { 701 scaleX: 1, 702 scaleY: 1 703 } 704 }); 705 706 $(document).off('mousemove').on('mousemove', function(e){ 707 708 gsap.to('.thumb-info-floating-element-clone', 0.5, { 709 css: { 710 left: e.clientX + (offset), 711 top: e.clientY + (offset) 712 } 713 }); 714 715 }); 716 717 }).on('mouseout', function(){ 718 719 gsap.to('.thumb-info-floating-element-clone', 0.5, { 720 css: { 721 scaleX: 0.5, 722 scaleY: 0.5, 723 opacity: 0 724 } 725 }); 726 727 }); 728 729 } else { 730 theme.fn.showErrorMessage('Failed to Load File', 'Failed to load: GSAP - Include the following file(s): (vendor/gsap/gsap.min.js)'); 731 } 732 733 } 734 735 /* 736 * Thumb Info Direction Aware 737 */ 738 $(window).on('load', function() { 739 $('.thumb-info-wrapper-direction-aware').each( function() { 740 $(this).hoverdir({ 741 speed : 300, 742 easing : 'ease', 743 hoverDelay : 0, 744 inverse : false,
745 hoverElem: '.thumb-info-wrapper-overlay' 746 }); 747 }); 748 }); 749 750 /* 751 * Thumb Info Container Full 752 */ 753 $('.thumb-info-container-full-img').each(function() { 754 755 var $container = $(this); 756 757 $('[data-full-width-img-src]', $container).each(function() { 758 var uniqueId = 'img' + Math.floor(Math.random() * 10000); 759 $(this).attr('data-rel', uniqueId); 760 761 $container.append('<div style="background-image: url(' + $(this).attr('data-full-width-img-src') + ');" id="' + uniqueId + '" class="thumb-info-container-full-img-large opacity-0"></div>'); 762 }); 763 764 $('.thumb-info', $container).on('mouseenter', function(e){ 765 $('.thumb-info-container-full-img-large').removeClass('active'); 766 $('#' + $(this).attr('data-rel')).addClass('active'); 767 }); 768 769 }); 770 771 /* 772 * Toggle Text Click 773 */ 774 $('[data-toggle-text-click]').on('click', function () { 775 $(this).text(function(i, text){ 776 return text === $(this).attr('data-toggle-text-click') ? $(this).attr('data-toggle-text-click-alt') : $(this).attr('data-toggle-text-click'); 777 }); 778 }); 779 780 /* 781 * Toggle Class 782 */ 783 $('[data-toggle-class]').on('click', function (e) { 784 e.preventDefault(); 785 786 $(this).toggleClass( $(this).data('toggle-class') ); 787 }); 788 789 /* 790 * Shape Divider Aspect Ratio 791 */ 792 if( $('.shape-divider').length ) { 793 aspectRatioSVG(); 794 $(window).on('resize', function(){ 795 aspectRatioSVG(); 796 }); 797 } 798 799 /* 800 * Shape Divider Animated 801 */ 802 if( $('.shape-divider-horizontal-animation').length ) { 803 theme.fn.intObs('.shape-divider-horizontal-animation', function(){ 804 for( var i = 0; i <= 1; i++ ) { 805 var svgClone = $(this).find('svg:nth-child(1)').clone(); 806 807 $(this).append( svgClone ) 808 } 809 810 $(this).addClass('start'); 811 }, {}); 812 } 813 814 /* 815 * Shape Divider - SVG Aspect Ratio 816 */ 817 function aspectRatioSVG() { 818 if( $(window).width() < 1950 ) { 819 $('.shape-divider svg[preserveAspectRatio]').each(function(){ 820 if( !$(this).parent().hasClass('shape-divider-horizontal-animation') ) { 821 $(this).attr('preserveAspectRatio', 'xMinYMin'); 822 } else { 823 $(this).attr('preserveAspectRatio', 'none'); 824 } 825 }); 826 } else { 827 $('.shape-divider svg[preserveAspectRatio]').each(function(){ 828 $(this).attr('preserveAspectRatio', 'none'); 829 }); 830 } 831 } 832 833 /* 834 * Content Switcher 835 */ 836 $('[data-content-switcher]').on('change', function(e, v) { 837 var switcherRel = ($(this).is(':checked') ? '1' : '2' ), 838 switcherId = $(this).attr('data-content-switcher-content-id'); 839 840 $('[data-content-switcher-id=' + switcherId + ']').addClass('initialized').removeClass('active'); 841 842 var $activeEl = $('[data-content-switcher-id=' + switcherId + '][data-content-switcher-rel=' + switcherRel + ']'); 843 844 $activeEl.addClass('active'); 845 846 $activeEl.parent().css('height', $activeEl.height()); 847 }); 848 849 $('[data-content-switcher]').trigger('change'); 850 851 /* 852 * Dynamic Height 853 */ 854 var $window = $(window); 855 $window.on('resize dynamic.height.resize', function(){ 856 $('[data-dynamic-height]').each(function(){ 857 var $this = $(this), 858 values = JSON.parse($this.data('dynamic-height').replace(/'/g,'"').replace(';','')) 859 860 // XS 861 if( $window.width() < 576 ) { 862 $this.height( values[4] ); 863 } 864 865 // SM 866 if( $window.width() > 575 && $window.width() < 768 ) { 867 $this.height( values[3] ); 868 } 869 870 // MD 871 if( $window.width() > 767 && $window.width() < 992 ) { 872 $this.height( values[2] ); 873 } 874 875 // LG 876 if( $window.width() > 991 && $window.width() < 1200 ) { 877 $this.height( values[1] ); 878 } 879 880 // XS 881 if( $window.width() > 1199 ) { 882 $this.height( values[0] ); 883 } 884 }); 885 }); 886 887 // Mobile First Load 888 if( $window.width() < 992 ) { 889 $window.trigger('dynamic.height.resize'); 890 } 891 892 /* 893 * Video - Trigger Play 894 */ 895 if( $('[data-trigger-play-video]').length ) { 896 theme.fn.execOnceTroughEvent( '[data-trigger-play-video]', 'mouseover.trigger.play.video', function(){ 897 var $video = $( $(this).data('trigger-play-video') ); 898 899 $(this).on('click', function(e){ 900 e.preventDefault(); 901 902 if( $(this).data('trigger-play-video-remove') == 'yes' ) { 903 $(this).animate({ 904 opacity: 0 905 }, 300, function(){ 906 $video[0].play(); 907 908 $(this).remove(); 909 });
910 } else { 911 setTimeout(function(){ 912 $video[0].play(); 913 },300); 914 } 915 }); 916 }); 917 } 918 919 /* 920 * Video - Auto Play 921 */ 922 if( $('video[data-auto-play]').length ) { 923 $(window).on('load', function(){ 924 $('video[data-auto-play]').each(function(){ 925 var $video = $(this); 926 927 setTimeout(function(){ 928 if( $( '#' + $video.attr('id') ).length ) { 929 if( $( '[data-trigger-play-video="#' + $video.attr('id') + '"]' ).data('trigger-play-video-remove') == 'yes' ) { 930 $( '[data-trigger-play-video="#' + $video.attr('id') + '"]' ).animate({ 931 opacity: 0 932 }, 300, function(){ 933 $video[0].play(); 934 935 $( '[data-trigger-play-video="#' + $video.attr('id') + '"]' ).remove(); 936 }); 937 } else { 938 setTimeout(function(){ 939 $video[0].play(); 940 },300); 941 } 942 } 943 }, 100); 944 945 }); 946 }); 947 } 948 949 /* 950 * Remove min height after the load of page 951 */ 952 if( $('[data-remove-min-height]').length ) { 953 $(window).on('load', function(){ 954 $('[data-remove-min-height]').each(function(){ 955 $(this).css({ 956 'min-height': 0 957 }); 958 }); 959 }); 960 } 961 962 /* 963 * Lazy Load Background Images (with lazySizes plugin) 964 */ 965 document.addEventListener('lazybeforeunveil', function(e){ 966 var bg = e.target.getAttribute('data-bg-src'); 967 if(bg) { 968 e.target.style.backgroundImage = 'url(' + bg + ')'; 969 } 970 }); 971 972 /* 973 * Title Border 974 */ 975 if($('[data-title-border]').length) { 976 977 var $pageHeaderTitleBorder = $('<span class="page-header-title-border"></span>'), 978 $pageHeaderTitle = $('[data-title-border]'), 979 $window = $(window); 980 981 $pageHeaderTitle.before($pageHeaderTitleBorder); 982 983 var setPageHeaderTitleBorderWidth = function() { 984 $pageHeaderTitleBorder.width($pageHeaderTitle.width()); 985 } 986 987 $window.afterResize(function(){ 988 setPageHeaderTitleBorderWidth(); 989 }); 990 991 setPageHeaderTitleBorderWidth(); 992 993 $pageHeaderTitleBorder.addClass('visible'); 994 } 995 996 /* 997 * Footer Reveal 998 */ 999 (function($) { 1000 var $footerReveal = { 1001 $wrapper: $('.footer-reveal'), 1002 init: function() { 1003 var self = this; 1004 1005 self.build(); 1006 self.events(); 1007 }, 1008 build: function() { 1009 var self = this, 1010 footer_height = self.$wrapper.outerHeight(true), 1011 window_height = ( $(window).height() - $('.header-body').height() ); 1012 1013 if( footer_height > window_height ) { 1014 $('#footer').removeClass('footer-reveal'); 1015 $('body').css('margin-bottom', 0); 1016 } else { 1017 $('#footer').addClass('footer-reveal'); 1018 $('body').css('margin-bottom', footer_height); 1019 } 1020 1021 }, 1022 events: function() { 1023 var self = this, 1024 $window = $(window); 1025 1026 $window.on('load', function(){ 1027 $window.afterResize(function(){ 1028 self.build(); 1029 }); 1030 }); 1031 } 1032 } 1033 1034 if( $('.footer-reveal').length ) { 1035 $footerReveal.init(); 1036 } 1037 })(jQuery); 1038 1039 /* 1040 * Re-Init Plugin 1041 */ 1042 if( $('[data-reinit-plugin]').length ) { 1043 $('[data-reinit-plugin]').on('click', function(e) { 1044 e.preventDefault(); 1045 1046 var pluginInstance = $(this).data('reinit-plugin'), 1047 pluginFunction = $(this).data('reinit-plugin-function'), 1048 pluginElement = $(this).data('reinit-plugin-element'), 1049 pluginOptions = theme.fn.getOptions($(this).data('reinit-plugin-options')); 1050 1051 $( pluginElement ).data( pluginInstance ).destroy(); 1052 1053 setTimeout(function(){ 1054 theme.fn.execPluginFunction(pluginFunction, $( pluginElement ), pluginOptions); 1055 }, 1000); 1056 1057 }); 1058 } 1059 1060 /* 1061 * Simple Copy To Clipboard 1062 */ 1063 if( $('[data-copy-to-clipboard]').length ) { 1064 theme.fn.intObs( '[data-copy-to-clipboard]', function(){ 1065 var $this = $(this); 1066
1067 $this.wrap( '<div class="copy-to-clipboard-wrapper position-relative"></div>' ); 1068 1069 var $copyButton = $('<a href="#" class="btn btn-primary btn-px-2 py-1 text-0 position-absolute top-8 right-8">COPY</a>'); 1070 $this.parent().prepend( $copyButton ); 1071 1072 $copyButton.on('click', function(e){ 1073 e.preventDefault(); 1074 1075 var $btn = $(this), 1076 $temp = $('<textarea class="d-block opacity-0" style="height: 0;">'); 1077 1078 $btn.parent().append( $temp ); 1079 1080 $temp.val( $this.text() ); 1081 1082 $temp[0].select(); 1083 $temp[0].setSelectionRange(0, 99999); 1084 1085 document.execCommand("copy"); 1086 1087 $btn.addClass('copied'); 1088 setTimeout(function(){ 1089 $btn.removeClass('copied'); 1090 }, 1000); 1091 1092 $temp.remove(); 1093 }); 1094 }, { 1095 rootMargin: '0px 0px 0px 0px' 1096 } ); 1097 } 1098 1099 /* 1100 * Marquee 1101 */ 1102 if( $('.marquee').length && $.isFunction($.fn.marquee) ) { 1103 $('.marquee').marquee({ 1104 duration: 5000, 1105 gap: 0, 1106 delayBeforeStart: 0, 1107 direction: 'left', 1108 duplicated: true 1109 }); 1110 } 1111 1112 /* 1113 * Style Switcher Open Loader Button 1114 */ 1115 if( $('.style-switcher-open-loader').length ) { 1116 1117 $('.style-switcher-open-loader').on('click', function(e){ 1118 e.preventDefault(); 1119 1120 var $this = $(this); 1121 1122 // Add Spinner to icon 1123 $this.addClass('style-switcher-open-loader-loading'); 1124 1125 var basePath = $(this).data('base-path'), 1126 skinSrc = $(this).data('skin-src'); 1127 1128 var script1 = document.createElement("script"); 1129 script1.src = basePath + "master/style-switcher/style.switcher.localstorage.js"; 1130 1131 var script2 = document.createElement("script"); 1132 script2.src = basePath + "master/style-switcher/style.switcher.js"; 1133 script2.id = "styleSwitcherScript"; 1134 script2.setAttribute('data-base-path', basePath); 1135 script2.setAttribute('data-skin-src', skinSrc); 1136 1137 script2.onload = function() { 1138 setTimeout(function(){ 1139 // Trigger a click to open the style switcher sidebar 1140 function checkIfReady() { 1141 if( !$('.style-switcher-open').length ) { 1142 window.setTimeout(checkIfReady, 100); 1143 } else { 1144 $('.style-switcher-open').trigger('click'); 1145 } 1146 } 1147 checkIfReady(); 1148 1149 }, 500); 1150 } 1151 1152 document.body.appendChild(script1); 1153 document.body.appendChild(script2); 1154 1155 }); 1156 1157 } 1158 1159 })(jQuery); 1160 1161// Animate 1162(function(theme, $) { 1163 1164 theme = theme || {}; 1165 1166 var instanceName = '__animate'; 1167 1168 var PluginAnimate = function($el, opts) { 1169 return this.initialize($el, opts); 1170 }; 1171 1172 PluginAnimate.defaults = { 1173 accX: 0, 1174 accY: -80, 1175 delay: 100, 1176 duration: '750ms', 1177 minWindowWidth: 767, 1178 forceAnimation: false, 1179 flagClassOnly: false 1180 }; 1181 1182 PluginAnimate.prototype = { 1183 initialize: function($el, opts) { 1184 if ($el.data(instanceName)) { 1185 return this; 1186 } 1187 1188 this.$el = $el; 1189 1190 this 1191 .setData() 1192 .setOptions(opts) 1193 .build(); 1194 1195 return this; 1196 }, 1197 1198 setData: function() { 1199 this.$el.data(instanceName, this); 1200 1201 return this; 1202 }, 1203 1204 setOptions: function(opts) { 1205 this.options = $.extend(true, {}, PluginAnimate.defaults, opts, { 1206 wrapper: this.$el 1207 }); 1208 1209 return this; 1210 }, 1211 1212 build: function() { 1213 var self = this; 1214 1215 // Flag Class Only 1216 // - Useful for simple animations like hightlight 1217 // - Less process and memory 1218 if( self.options.flagClassOnly ) { 1219 var delay = self.options.wrapper.attr('data-appear-animation-delay') ? self.options.wrapper.attr('data-appear-animation-delay') : self.options.delay; 1220 1221 self.options.wrapper.css({ 1222 'animation-delay': delay + 'ms', 1223 'transition-delay': delay + 'ms' 1224 }); 1225 self.options.wrapper.addClass( self.options.wrapper.attr('data-appear-animation') ); 1226 1227 return this; 1228 } 1229 1230 if($('body').hasClass('loading-overlay-showing')) { 1231 $(window).on('loading.overlay.ready', function(){ 1232 self.animate(); 1233 }); 1234 } else { 1235 self.animate(); 1236 } 1237 1238 return this; 1239 }, 1240 1241 animate: function() { 1242 var self = this, 1243 $el = this.options.wrapper,
1244 delay = 0, 1245 duration = this.options.duration, 1246 elTopDistance = $el.offset().top, 1247 windowTopDistance = $(window).scrollTop(); 1248 1249 // If has appear animation elements inside a SVG. 1250 // Intersection Observer API do not check elements inside SVG's, so we need initialize trough top parent SVG 1251 if( $el.data('appear-animation-svg') ) { 1252 $el.find('[data-appear-animation]').each(function(){ 1253 var $this = $(this), 1254 opts; 1255 1256 var pluginOptions = theme.fn.getOptions($this.data('plugin-options')); 1257 if (pluginOptions) 1258 opts = pluginOptions; 1259 1260 $this.themePluginAnimate(opts); 1261 }); 1262 1263 return this; 1264 } 1265 1266 // No animation at the first load of page. This is good for performance 1267 if( self.options.firstLoadNoAnim ) { 1268 $el.removeClass('appear-animation'); 1269 1270 // Inside Carousel 1271 if( $el.closest('.owl-carousel').get(0) ) { 1272 setTimeout(function(){ 1273 $el.closest('.owl-carousel').on('change.owl.carousel', function(){ 1274 self.options.firstLoadNoAnim = false; 1275 $el.removeData('__animate'); 1276 $el.themePluginAnimate( self.options ); 1277 }); 1278 }, 500); 1279 } 1280 1281 return this; 1282 } 1283 1284 $el.addClass('appear-animation animated'); 1285 1286 if (!$('html').hasClass('no-csstransitions') && $(window).width() > self.options.minWindowWidth && elTopDistance >= windowTopDistance || self.options.forceAnimation == true) { 1287 delay = ($el.attr('data-appear-animation-delay') ? $el.attr('data-appear-animation-delay') : self.options.delay); 1288 duration = ($el.attr('data-appear-animation-duration') ? $el.attr('data-appear-animation-duration') : self.options.duration); 1289 1290 if (duration != '750ms') { 1291 $el.css('animation-duration', duration); 1292 } 1293 1294 $el.css('animation-delay', delay + 'ms'); 1295 $el.addClass($el.attr('data-appear-animation') + ' appear-animation-visible'); 1296 1297 $el.trigger('animation:show'); 1298 1299 } else { 1300 $el.addClass('appear-animation-visible'); 1301 } 1302 1303 return this; 1304 } 1305 }; 1306 1307 // expose to scope 1308 $.extend(theme, { 1309 PluginAnimate: PluginAnimate 1310 }); 1311 1312 // jquery plugin 1313 $.fn.themePluginAnimate = function(opts) { 1314 return this.map(function() { 1315 var $this = $(this); 1316 1317 if ($this.data(instanceName)) { 1318 return $this.data(instanceName); 1319 } else { 1320 return new PluginAnimate($this, opts); 1321 } 1322 1323 }); 1324 }; 1325 1326}).apply(this, [window.theme, jQuery]); 1327 1328// Animated Content 1329(function(theme, $) { 1330 1331 theme = theme || {}; 1332 1333 var instanceName = '__animatedContent'; 1334 1335 var PluginAnimatedContent = function($el, opts) { 1336 return this.initialize($el, opts); 1337 }; 1338 1339 PluginAnimatedContent.defaults = { 1340 contentType: 'letter', 1341 animationName: 'fadeIn', 1342 animationSpeed: 50, 1343 startDelay: 500, 1344 minWindowWidth: 768, 1345 letterClass: '', 1346 wordClass: '', 1347 wrapperClass: '' 1348 }; 1349 1350 PluginAnimatedContent.prototype = { 1351 initialize: function($el, opts) { 1352 if ($el.data(instanceName)) { 1353 return this; 1354 } 1355 1356 var self = this; 1357 1358 this.$el = $el; 1359 this.initialText = $el.text(); 1360 1361 this 1362 .setData() 1363 .setOptions(opts) 1364 .build() 1365 .events(); 1366 1367 return this; 1368 }, 1369 1370 setData: function() { 1371 this.$el.data(instanceName, this); 1372 1373 return this; 1374 }, 1375 1376 setOptions: function(opts) { 1377 this.options = $.extend(true, {}, PluginAnimatedContent.defaults, opts, { 1378 wrapper: this.$el 1379 }); 1380 1381 return this; 1382 }, 1383 1384 build: function() { 1385 var self = this; 1386 1387 if( $(window).width() < self.options.minWindowWidth ) { 1388 return this; 1389 } 1390 1391 if( self.options.firstLoadNoAnim ) { 1392 self.$el.css({ 1393 visibility: 'visible' 1394 }); 1395 1396 // Inside Carousel 1397 if( self.$el.closest('.owl-carousel').get(0) ) { 1398 setTimeout(function(){ 1399 self.$el.closest('.owl-carousel').on('change.owl.carousel', function(){ 1400 self.options.firstLoadNoAnim = false; 1401 self.build(); 1402 }); 1403 }, 500); 1404 } 1405 1406 return this; 1407 } 1408 1409 // Set Min Height to avoid flicking issues 1410 self.setMinHeight(); 1411 1412 // Letter 1413 if( self.options.contentType == 'letter' ) { 1414 1415 self.$el.addClass('initialized'); 1416 1417 var letters = self.$el.text().split(''); 1418 1419 self.$el.text(''); 1420 1421 // Type Writer 1422 if( self.options.animationName == 'typeWriter' ) { 1423 self.$el.append( '<span class="letters-wrapper"></span><span class="typeWriter"></pre>' ); 1424 1425 var index = 0; 1426 1427 setTimeout(function(){ 1428 1429 var timeout = function(){ 1430 var st = setTimeout(function(){ 1431 var letter = letters[index]; 1432 1433 self.$el.find('.letters-wrapper').append( '<span class="letter '+ ( self.options.letterClass ? self.options.letterClass + ' ' : '' ) +'">' + letter + '</span>' ); 1434 1435 index++; 1436 timeout(); 1437 }, self.options.animationSpeed); 1438 1439 if( index >= letters.length ) { 1440 clearTimeout(st); 1441 } 1442 }; 1443 timeout(); 1444 1445 }, self.options.startDelay); 1446 1447 // Class Animation 1448 } else { 1449 setTimeout(function(){ 1450 for( var i = 0; i < letters.length; i++ ) { 1451 var letter = letters[i]; 1452 1453 self.$el.append( '<span class="animated-letters-wrapper ' + self.options.wrapperClass + '"><span class="animated-letters-item letter '+ ( self.options.letterClass ? self.options.letterClass + ' ' : '' ) + self.options.animationName +' animated" style="animation-delay: '+ ( i * self.options.animationSpeed ) +'ms;">' + ( letter == ' ' ? ' ' : letter ) + '</span></span>' ); 1454 1455 } 1456 }, self.options.startDelay); 1457 } 1458 1459 // Words 1460 } else if( self.options.contentType == 'word' ) { 1461 1462 var words = self.$el.text().split(" "),
1463 delay = self.options.startDelay; 1464 1465 self.$el.empty(); 1466 1467 $.each(words, function(i, v) { 1468 self.$el.append( $('<span class="animated-words-wrapper ' + self.options.wrapperClass + '">').html('<span class="animated-words-item ' + self.options.wordClass + ' appear-animation" data-appear-animation="' + self.options.animationName + '" data-appear-animation-delay="' + delay + '">' + v + ' </span>') ); 1469 delay = delay + self.options.animationSpeed; 1470 }); 1471 1472 if ($.isFunction($.fn['themePluginAnimate']) && $('.animated-words-item[data-appear-animation]').length) { 1473 theme.fn.dynIntObsInit( '.animated-words-item[data-appear-animation]', 'themePluginAnimate', theme.PluginAnimate.defaults ); 1474 } 1475 1476 self.$el.addClass('initialized'); 1477 1478 } 1479 1480 return this; 1481 }, 1482 1483 setMinHeight: function() { 1484 var self = this; 1485 1486 // if it's inside carousel 1487 if( self.$el.closest('.owl-carousel').get(0) ) { 1488 self.$el.closest('.owl-carousel').addClass('d-block'); 1489 self.$el.css( 'min-height', self.$el.height() ); 1490 self.$el.closest('.owl-carousel').removeClass('d-block'); 1491 } else { 1492 self.$el.css( 'min-height', self.$el.height() ); 1493 } 1494 1495 return this; 1496 }, 1497 1498 destroy: function() { 1499 var self = this; 1500 1501 self.$el 1502 .html( self.initialText ) 1503 .css( 'min-height', '' ); 1504 1505 return this; 1506 }, 1507 1508 events: function() { 1509 var self = this; 1510 1511 // Destroy 1512 self.$el.on('animated.letters.destroy', function(){ 1513 self.destroy(); 1514 }); 1515 1516 // Initialize 1517 self.$el.on('animated.letters.initialize', function(){ 1518 self.build(); 1519 }); 1520 1521 return this; 1522 } 1523 }; 1524 1525 // expose to scope 1526 $.extend(theme, { 1527 PluginAnimatedContent: PluginAnimatedContent 1528 }); 1529 1530 // jquery plugin 1531 $.fn.themePluginAnimatedContent = function(opts) { 1532 return this.map(function() { 1533 var $this = $(this); 1534 1535 if ($this.data(instanceName)) { 1536 return $this.data(instanceName); 1537 } else { 1538 return new PluginAnimatedContent($this, opts); 1539 } 1540 1541 }); 1542 } 1543 1544}).apply(this, [window.theme, jQuery]); 1545 1546// Before / After 1547(function(theme, $) { 1548 1549 theme = theme || {}; 1550 1551 var instanceName = '__beforeafter'; 1552 1553 var PluginBeforeAfter = function($el, opts) { 1554 return this.initialize($el, opts); 1555 }; 1556 1557 PluginBeforeAfter.defaults = { 1558 forceInit: true, 1559 default_offset_pct: 0.5, 1560 orientation: 'horizontal', 1561 before_label: 'Before', 1562 after_label: 'After', 1563 no_overlay: false, 1564 move_slider_on_hover: false, 1565 move_with_handle_only: true, 1566 click_to_move: false 1567 }; 1568 1569 PluginBeforeAfter.prototype = { 1570 initialize: function($el, opts) { 1571 this.$el = $el; 1572 1573 this 1574 .setData() 1575 .setOptions(opts) 1576 .build(); 1577 1578 return this; 1579 }, 1580 1581 setData: function() { 1582 this.$el.data(instanceName, this); 1583 1584 return this; 1585 }, 1586 1587 setOptions: function(opts) { 1588 this.options = $.extend(true, {}, PluginBeforeAfter.defaults, opts, { 1589 wrapper: this.$el 1590 }); 1591 1592 return this; 1593 }, 1594 1595 build: function() { 1596 1597 if ($.isFunction($.fn.twentytwenty)) { 1598 1599 var self = this; 1600 1601 self.options.wrapper.waitForImages(function() { 1602 self.options.wrapper.twentytwenty(self.options); 1603 }); 1604 1605 } else { 1606 1607 theme.fn.showErrorMessage('Failed to Load File', 'Failed to load: twentytwenty - Include the following file(s): (vendor/twentytwenty/css/twentytwenty.css, vendor/twentytwenty/js/jquery.event.move.js, vendor/twentytwenty/js/jquery.twentytwenty.js)'); 1608 1609 } 1610 1611 return this; 1612 1613 } 1614 }; 1615 1616 // expose to scope 1617 $.extend(theme, { 1618 PluginBeforeAfter: PluginBeforeAfter 1619 }); 1620 1621 // jquery plugin 1622 $.fn.themePluginBeforeAfter = function(opts) { 1623 return this.map(function() { 1624 var $this = $(this); 1625 1626 if ($this.data(instanceName)) { 1627 return $this.data(instanceName); 1628 } else { 1629 return new PluginBeforeAfter($this, opts); 1630 } 1631 1632 }); 1633 } 1634 1635}).apply(this, [window.theme, jQuery]); 1636 1637// Carousel Light 1638(function(theme, $) { 1639 1640 theme = theme || {}; 1641 1642 var instanceName = '__carouselLight'; 1643 1644 var PluginCarouselLight = function($el, opts) { 1645 return this.initialize($el, opts); 1646 }; 1647 1648 PluginCarouselLight.defaults = { 1649 autoplay: true, 1650 autoplayTimeout: 7000, 1651 disableAutoPlayOnClick: true 1652 }; 1653 1654 PluginCarouselLight.prototype = { 1655 initialize: function($el, opts) { 1656 if ($el.data(instanceName)) { 1657 return this; 1658 } 1659 1660 this.$el = $el; 1661 this.clickFlag = true; 1662 1663 this 1664 .setData() 1665 .setOptions(opts) 1666 .build() 1667 .owlNav() 1668 .owlDots() 1669 .autoPlay() 1670 .events(); 1671 1672 return this; 1673 }, 1674 1675 setData: function() { 1676 this.$el.data(instanceName, this); 1677 1678 return this; 1679 }, 1680 1681 setOptions: function(opts) { 1682 this.options = $.extend(true, {}, PluginCarouselLight.defaults, opts, { 1683 wrapper: this.$el 1684 }); 1685 1686 return this; 1687 }, 1688 1689 build: function() { 1690 var self = this; 1691 1692 self.$el 1693 .css('opacity', 1) 1694 .find('.owl-item:first-child') 1695 .addClass('active'); 1696 1697 self.$el.trigger('initialized.owl.carousel'); 1698 1699 // Carousel Navigate By ID and item index 1700 self.carouselNavigate(); 1701 1702 return this; 1703 }, 1704 1705 changeSlide: function( $nextSlide ) { 1706 var self = this, 1707 $prevSlide = self.$el.find('.owl-item.active'); 1708 1709 self.$el.find('.owl-item.active').addClass('removing'); 1710 1711 $prevSlide 1712 .removeClass('fadeIn') 1713 .addClass( 'fadeOut animated' ); 1714 1715 setTimeout(function(){ 1716 setTimeout(function(){ 1717 $prevSlide.removeClass('active'); 1718 }, 400); 1719 1720 $nextSlide 1721 .addClass('active') 1722 .removeClass('fadeOut') 1723 .addClass( 'fadeIn animated' ); 1724 1725 }, 200); 1726 1727 // Dots 1728 self.$el 1729 .find('.owl-dot') 1730 .removeClass('active') 1731 .eq( $nextSlide.index() ) 1732 .addClass('active'); 1733 1734 self.$el.trigger({ 1735 type: 'change.owl.carousel', 1736 nextSlideIndex: $nextSlide.index(), 1737 prevSlideIndex: $prevSlide.index() 1738 }); 1739 1740 setTimeout(function(){ 1741 self.$el.trigger({ 1742 type: 'changed.owl.carousel', 1743 nextSlideIndex: $nextSlide.index(), 1744 prevSlideIndex: $prevSlide.index() 1745 }); 1746 }, 500); 1747 }, 1748 1749 owlNav: function() { 1750 var self = this, 1751 $owlNext = self.$el.find('.owl-next'), 1752 $owlPrev = self.$el.find('.owl-prev'); 1753 1754 $owlPrev.on('click', function(e){
1755 e.preventDefault(); 1756 1757 if( self.options.disableAutoPlayOnClick ) { 1758 window.clearInterval(self.autoPlayInterval); 1759 } 1760 1761 if( self.avoidMultipleClicks() ) { 1762 return false; 1763 } 1764 1765 self.owlPrev(); 1766 }); 1767 1768 $owlNext.on('click', function(e){ 1769 e.preventDefault(); 1770 1771 if( self.options.disableAutoPlayOnClick ) { 1772 window.clearInterval(self.autoPlayInterval); 1773 } 1774 1775 if( self.avoidMultipleClicks() ) { 1776 return false; 1777 } 1778 1779 self.owlNext(); 1780 }); 1781 1782 return this; 1783 }, 1784 1785 owlDots: function(){ 1786 var self = this, 1787 $owlDot = self.$el.find('.owl-dot'); 1788 1789 $owlDot.on('click', function(e){ 1790 $this = $(this); 1791 1792 e.preventDefault(); 1793 1794 if( self.options.disableAutoPlayOnClick ) { 1795 window.clearInterval(self.autoPlayInterval); 1796 } 1797 1798 if( self.avoidMultipleClicks() ) { 1799 return false; 1800 } 1801 1802 var dotIndex = $(this).index(); 1803 1804 // Do nothing if respective dot slide is active/showing 1805 if( $this.hasClass('active') ) { 1806 return false; 1807 } 1808 1809 self.changeSlide( self.$el.find('.owl-item').eq( dotIndex ) ); 1810 }); 1811 1812 return this; 1813 }, 1814 1815 owlPrev: function() { 1816 var self = this; 1817 1818 if( self.$el.find('.owl-item.active').prev().get(0) ) { 1819 self.changeSlide( self.$el.find('.owl-item.active').prev() ); 1820 } else { 1821 self.changeSlide( self.$el.find('.owl-item:last-child') ); 1822 } 1823 }, 1824 1825 owlNext: function() { 1826 var self = this; 1827 1828 if( self.$el.find('.owl-item.active').next().get(0) ) { 1829 self.changeSlide( self.$el.find('.owl-item.active').next() ); 1830 } else { 1831 self.changeSlide( self.$el.find('.owl-item').eq(0) ); 1832 } 1833 }, 1834 1835 avoidMultipleClicks: function() { 1836 var self = this; 1837 1838 if( !self.clickFlag ) { 1839 return true; 1840 } 1841 1842 if( self.clickFlag ) { 1843 self.clickFlag = false; 1844 setTimeout(function(){ 1845 self.clickFlag = true; 1846 }, 1000); 1847 } 1848 1849 return false; 1850 }, 1851 1852 autoPlay: function(){ 1853 var self = this, 1854 $el = this.options.wrapper; 1855 1856 if( self.options.autoplay ) { 1857 self.autoPlayInterval = window.setInterval(function() { 1858 self.owlNext(); 1859 }, self.options.autoplayTimeout); 1860 } 1861 1862 return this; 1863 }, 1864 1865 carouselNavigate: function() { 1866 var self = this, 1867 $el = this.options.wrapper, 1868 $carousel = $el; 1869 1870 if( $('[data-carousel-navigate]').get(0) ) { 1871 $('[data-carousel-navigate-id="#'+ $el.attr('id') +'"]').each(function(){ 1872 var $this = $(this), 1873 hasCarousel = $( $this.data('carousel-navigate-id') ).get(0), 1874 toIndex = $this.data('carousel-navigate-to'); 1875 1876 if( hasCarousel ) { 1877 1878 $this.on('click', function(){ 1879 1880 if( self.options.disableAutoPlayOnClick ) { 1881 window.clearInterval(self.autoPlayInterval); 1882 } 1883 1884 self.changeSlide( self.$el.find('.owl-item').eq( parseInt(toIndex) - 1 ) ); 1885 }); 1886 1887 } 1888 }); 1889 1890 $el.on('change.owl.carousel', function(e){ 1891 $('[data-carousel-navigate-id="#'+ $el.attr('id') +'"]').removeClass('active'); 1892 }); 1893 1894 $el.on('changed.owl.carousel', function(e){ 1895 $('[data-carousel-navigate-id="#'+ $el.attr('id') +'"][data-carousel-navigate-to="'+ ( e.nextSlideIndex + 1 ) +'"]').addClass('active'); 1896 }); 1897 } 1898 1899 return this; 1900 }, 1901 1902 events: function() { 1903 var self = this; 1904 1905 self.$el.on('change.owl.carousel', function(event) { 1906 1907 // Hide elements inside carousel 1908 self.$el.find('[data-appear-animation]:not(.background-image-wrapper), [data-plugin-animated-letters]').addClass('invisible'); 1909 1910 // Animated Letters 1911 self.$el.find('[data-plugin-animated-letters]').trigger('animated.letters.destroy'); 1912 1913 // Remove "d-none" class before show the element. This is useful when using background images inside a carousel. Like ken burns effect 1914 self.$el.find('.owl-item:not(.active) [data-carousel-onchange-show]').removeClass('d-none'); 1915 1916 }); 1917 1918 self.$el.on('changed.owl.carousel', function(event) { 1919 setTimeout(function(){ 1920 1921 // Appear Animation 1922 if( self.$el.find('.owl-item.cloned [data-appear-animation]').get(0) ) { 1923 self.$el.find('.owl-item.cloned [data-appear-animation]').each(function() { 1924 var $this = $(this), 1925 opts; 1926 1927 var pluginOptions = theme.fn.getOptions($this.data('plugin-options')); 1928 if (pluginOptions) 1929 opts = pluginOptions; 1930 1931 $this.themePluginAnimate(opts); 1932 });
1933 } 1934 1935 // Show elements inside carousel 1936 self.$el.find('.owl-item.active [data-appear-animation]:not(.background-image-wrapper), [data-plugin-animated-letters]').removeClass('invisible'); 1937 1938 // Animated Letters 1939 self.$el.find('.owl-item.active [data-plugin-animated-letters]').trigger('animated.letters.initialize'); 1940 1941 // Background Video 1942 self.$el.find('.owl-item.cloned.active [data-plugin-video-background]').trigger('video.background.initialize'); 1943 1944 }, 500); 1945 1946 }); 1947 } 1948 }; 1949 1950 // expose to scope 1951 $.extend(theme, { 1952 PluginCarouselLight: PluginCarouselLight 1953 }); 1954 1955 // jquery plugin 1956 $.fn.themePluginCarouselLight = function(opts) { 1957 return this.map(function() { 1958 var $this = $(this); 1959 1960 if ($this.data(instanceName)) { 1961 return $this.data(instanceName); 1962 } else { 1963 return new PluginCarouselLight($this, opts); 1964 } 1965 1966 }); 1967 }; 1968 1969}).apply(this, [window.theme, jQuery]); 1970 1971// Carousel 1972(function(theme, $) { 1973 1974 theme = theme || {}; 1975 1976 var instanceName = '__carousel'; 1977 1978 var PluginCarousel = function($el, opts) { 1979 return this.initialize($el, opts); 1980 }; 1981 1982 PluginCarousel.defaults = { 1983 loop: true, 1984 responsive: { 1985 0: { 1986 items: 1 1987 }, 1988 479: { 1989 items: 1 1990 }, 1991 768: { 1992 items: 2 1993 }, 1994 979: { 1995 items: 3 1996 }, 1997 1199: { 1998 items: 4 1999 } 2000 }, 2001 navText: [], 2002 refresh: false 2003 }; 2004 2005 PluginCarousel.prototype = { 2006 initialize: function($el, opts) { 2007 if ($el.data(instanceName)) { 2008 return this; 2009 } 2010 2011 this.$el = $el; 2012 2013 // If has data-icon inside, initialize only after icons get rendered 2014 // Prevent flicking issues 2015 if( $el.find('[data-icon]').get(0) ) { 2016 var self = this; 2017 2018 $(window).on('icon.rendered', function(){ 2019 if ($el.data(instanceName)) { 2020 return this; 2021 } 2022 2023 setTimeout(function(){ 2024 self 2025 .setData() 2026 .setOptions(opts) 2027 .build(); 2028 }, 1000); 2029 }); 2030 2031 return this; 2032 } 2033 2034 this 2035 .setData() 2036 .setOptions(opts) 2037 .build(); 2038 2039 return this; 2040 }, 2041 2042 setData: function() { 2043 this.$el.data(instanceName, this); 2044 2045 return this; 2046 }, 2047 2048 setOptions: function(opts) { 2049 this.options = $.extend(true, {}, PluginCarousel.defaults, opts, { 2050 wrapper: this.$el 2051 }); 2052 2053 return this; 2054 }, 2055 2056 build: function() { 2057 if (!($.isFunction($.fn.owlCarousel))) { 2058 return this; 2059 } 2060 2061 var self = this, 2062 $el = this.options.wrapper; 2063 2064 // Add Theme Class 2065 $el.addClass('owl-theme'); 2066 2067 // Add Loading 2068 $el.addClass('owl-loading'); 2069 2070 // Force RTL according to HTML dir attribute 2071 if ($('html').attr('dir') == 'rtl') { 2072 this.options = $.extend(true, {}, this.options, { 2073 rtl: true 2074 }); 2075 } 2076 2077 if (this.options.items == 1) { 2078 this.options.responsive = {} 2079 } 2080 2081 if (this.options.items > 4) { 2082 this.options = $.extend(true, {}, this.options, { 2083 responsive: { 2084 1199: { 2085 items: this.options.items 2086 } 2087 } 2088 }); 2089 } 2090 2091 // Auto Height Fixes 2092 if (this.options.autoHeight) { 2093 var itemsHeight = []; 2094 2095 $el.find('.owl-item').each(function(){ 2096 if( $(this).hasClass('active') ) { 2097 itemsHeight.push( $(this).height() ); 2098 } 2099 }); 2100 2101 $(window).afterResize(function() { 2102 $el.find('.owl-stage-outer').height( Math.max.apply(null, itemsHeight) ); 2103 }); 2104 2105 $(window).on('load', function() { 2106 $el.find('.owl-stage-outer').height( Math.max.apply(null, itemsHeight) ); 2107 }); 2108 } 2109 2110 // Initialize OwlCarousel 2111 $el.owlCarousel(this.options).addClass('owl-carousel-init animated fadeIn'); 2112 2113 // Remove "animated fadeIn" class to prevent conflicts 2114 setTimeout(function(){ 2115 $el.removeClass('animated fadeIn'); 2116 }, 1000); 2117 2118 // Owl Carousel Wrapper 2119 if( $el.closest('.owl-carousel-wrapper').get(0) ) { 2120 setTimeout(function(){ 2121 $el.closest('.owl-carousel-wrapper').css({ 2122 height: '' 2123 }); 2124 }, 500); 2125 } 2126 2127 // Owl Carousel Loader 2128 if( $el.prev().hasClass('owl-carousel-loader') ) { 2129 $el.prev().remove(); 2130 } 2131
2132 // Nav Offset 2133 self.navigationOffsets(); 2134 2135 // Nav Outside 2136 if( $el.hasClass('nav-outside') ) { 2137 $(window).on('owl.carousel.nav.outside', function(){ 2138 if( $(window).width() < 992 ) { 2139 self.options.stagePadding = 40; 2140 $el.addClass('stage-margin'); 2141 } else { 2142 self.options.stagePadding = 0; 2143 $el.removeClass('stage-margin'); 2144 } 2145 2146 $el.owlCarousel('destroy').owlCarousel( self.options ); 2147 2148 // Nav Offset 2149 self.navigationOffsets(); 2150 }); 2151 2152 // Window Resize 2153 $(window).on('load', function(){ 2154 $(window).afterResize(function(){ 2155 $(window).trigger('owl.carousel.nav.outside'); 2156 }); 2157 }); 2158 2159 // First Load 2160 $(window).trigger('owl.carousel.nav.outside'); 2161 } 2162 2163 // Nav style 5 (SVG Arrows) 2164 if( $el.hasClass('nav-svg-arrows-1') ) { 2165 var svg_arrow = '' + 2166 '<svg version="1.1" viewBox="0 0 15.698 8.706" width="17" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' + 2167 '<polygon stroke="#212121" stroke-width="0.1" fill="#212121" points="11.354,0 10.646,0.706 13.786,3.853 0,3.853 0,4.853 13.786,4.853 10.646,8 11.354,8.706 15.698,4.353 "/>' + 2168 '</svg>'; 2169 2170 $el.find('.owl-next, .owl-prev').append( svg_arrow ); 2171 } 2172 2173 // Sync 2174 if( $el.attr('data-sync') ) { 2175 $el.on('change.owl.carousel', function(event) { 2176 if (event.namespace && event.property.name === 'position') { 2177 var target = event.relatedTarget.relative(event.property.value, true); 2178 $( $el.data('sync') ).owlCarousel('to', target, 300, true); 2179 } 2180 }); 2181 } 2182 2183 // Carousel Center Active Item 2184 if( $el.hasClass('carousel-center-active-item') ) { 2185 var itemsActive = $el.find('.owl-item.active'), 2186 indexCenter = Math.floor( ($el.find('.owl-item.active').length - 1) / 2 ),
2187 itemCenter = itemsActive.eq(indexCenter); 2188 2189 itemCenter.addClass('current'); 2190 2191 $el.on('change.owl.carousel', function(event) { 2192 $el.find('.owl-item').removeClass('current'); 2193 2194 setTimeout(function(){ 2195 var itemsActive = $el.find('.owl-item.active'), 2196 indexCenter = Math.floor( ($el.find('.owl-item.active').length - 1) / 2 ), 2197 itemCenter = itemsActive.eq(indexCenter); 2198 2199 itemCenter.addClass('current'); 2200 }, 100); 2201 }); 2202 2203 // Refresh 2204 $el.trigger('refresh.owl.carousel'); 2205 2206 } 2207 2208 // AnimateIn / AnimateOut Fix 2209 if( self.options.animateIn || self.options.animateOut ) { 2210 $el.on('change.owl.carousel', function(event) { 2211 2212 // Hide elements inside carousel 2213 $el.find('[data-appear-animation], [data-plugin-animated-letters]').addClass('d-none'); 2214 2215 // Animated Letters 2216 $el.find('[data-plugin-animated-letters]').trigger('animated.letters.destroy'); 2217 2218 // Remove "d-none" class before show the element. This is useful when using background images inside a carousel. Like ken burns effect 2219 $el.find('.owl-item:not(.active) [data-carousel-onchange-show]').removeClass('d-none'); 2220 2221 }); 2222 2223 $el.on('changed.owl.carousel', function(event) { 2224 setTimeout(function(){ 2225 2226 // Appear Animation 2227 $el.find('[data-appear-animation]').each(function() { 2228 var $this = $(this), 2229 opts; 2230 2231 var pluginOptions = theme.fn.getOptions($this.data('plugin-options')); 2232 if (pluginOptions) 2233 opts = pluginOptions; 2234 2235 $this.themePluginAnimate(opts); 2236 }); 2237 2238 // Show elements inside carousel 2239 $el.find('.owl-item.active [data-appear-animation], [data-plugin-animated-letters]').removeClass('d-none'); 2240 2241 // Animated Letters 2242 $el.find('.owl-item.active [data-plugin-animated-letters]').trigger('animated.letters.initialize'); 2243 2244 // Background Video 2245 $el.find('.owl-item.cloned.active [data-plugin-video-background]').trigger('video.background.initialize'); 2246 2247 }, 10); 2248 2249 }); 2250 } 2251 2252 // data-icon inside carousel 2253 if( $el.find('[data-icon]').length ) { 2254 $el.on('change.owl.carousel drag.owl.carousel', function(){ 2255 $el.find('.owl-item.cloned [data-icon]').each(function(){ 2256 var $this = $(this), 2257 opts; 2258 2259 var pluginOptions = theme.fn.getOptions($this.data('plugin-options')); 2260 if (pluginOptions) 2261 opts = pluginOptions; 2262 2263 $this.themePluginIcon(opts); 2264 }); 2265 }); 2266 } 2267 2268 // Render Background Videos inside carousel. Just a trigger on window is sufficient to render 2269 if( $el.find('[data-plugin-video-background]').get(0) ) { 2270 $(window).resize(); 2271 } 2272 2273 // Remove Loading 2274 $el.removeClass('owl-loading'); 2275 2276 // Remove Height 2277 $el.css('height', 'auto'); 2278 2279 // Carousel Navigate By ID and item index 2280 self.carouselNavigate(); 2281 2282 // Refresh Carousel 2283 if( self.options.refresh ) { 2284 $el.owlCarousel('refresh'); 2285 } 2286 2287 return this; 2288 }, 2289 2290 navigationOffsets: function() { 2291 var self = this, 2292 $el = this.options.wrapper, 2293 navHasTransform = $el.find('.owl-nav').css('transform') == 'none' ? false : true, 2294 dotsHasTransform = $el.find('.owl-dots').css('transform') == 'none' ? false : true; 2295 2296 // ************* NAV ***************** 2297 // Nav Offset - Horizontal 2298 if( self.options.navHorizontalOffset && !self.options.navVerticalOffset ) { 2299 if( !navHasTransform ) { 2300 $el.find('.owl-nav').css({ 2301 transform: 'translate3d('+ self.options.navHorizontalOffset +', 0, 0)' 2302 }); 2303 } else { 2304 $el.find('.owl-nav').css({ 2305 left: self.options.navHorizontalOffset 2306 }); 2307 } 2308 } 2309 2310 // Nav Offset - Vertical 2311 if( self.options.navVerticalOffset && !self.options.navHorizontalOffset ) { 2312 if( !navHasTransform ) { 2313 $el.find('.owl-nav').css({ 2314 transform: 'translate3d(0, '+ self.options.navVerticalOffset +', 0)' 2315 }); 2316 } else { 2317 $el.find('.owl-nav').css({ 2318 top: 'calc( 50% - '+ self.options.navVerticalOffset +' )' 2319 });
2320 } 2321 } 2322 2323 // Nav Offset - Horizontal & Vertical 2324 if( self.options.navVerticalOffset && self.options.navHorizontalOffset ) { 2325 if( !navHasTransform ) { 2326 $el.find('.owl-nav').css({ 2327 transform: 'translate3d('+ self.options.navHorizontalOffset +', '+ self.options.navVerticalOffset +', 0)' 2328 }); 2329 } else { 2330 $el.find('.owl-nav').css({ 2331 top: 'calc( 50% - '+ self.options.navVerticalOffset +' )', 2332 left: self.options.navHorizontalOffset 2333 }); 2334 } 2335 } 2336 2337 // ********** DOTS ********************* 2338 // Dots Offset - Horizontal 2339 if( self.options.dotsHorizontalOffset && !self.options.dotsVerticalOffset ) { 2340 $el.find('.owl-dots').css({ 2341 transform: 'translate3d('+ self.options.dotsHorizontalOffset +', 0, 0)' 2342 }); 2343 } 2344 2345 // Dots Offset - Vertical 2346 if( self.options.dotsVerticalOffset && !self.options.dotsHorizontalOffset ) { 2347 if( !dotsHasTransform ) { 2348 $el.find('.owl-dots').css({ 2349 transform: 'translate3d(0, '+ self.options.dotsVerticalOffset +', 0)' 2350 }); 2351 } else { 2352 $el.find('.owl-dots').css({ 2353 top: 'calc( 50% - '+ self.options.dotsVerticalOffset +' )' 2354 }); 2355 } 2356 } 2357 2358 // Dots Offset - Horizontal & Vertical 2359 if( self.options.dotsVerticalOffset && self.options.dotsHorizontalOffset ) { 2360 $el.find('.owl-dots').css({ 2361 transform: 'translate3d('+ self.options.dotsHorizontalOffset +', '+ self.options.dotsVerticalOffset +', 0)' 2362 }); 2363 } 2364 2365 return this; 2366 }, 2367 2368 carouselNavigate: function() { 2369 var self = this, 2370 $el = this.options.wrapper, 2371 $carousel = $el.data('owl.carousel'); 2372 2373 if( $('[data-carousel-navigate]').get(0) ) { 2374 $('[data-carousel-navigate-id="#'+ $el.attr('id') +'"]').each(function(){ 2375 var $this = $(this), 2376 hasCarousel = $( $this.data('carousel-navigate-id') ).get(0), 2377 toIndex = $this.data('carousel-navigate-to'); 2378 2379 if( hasCarousel ) { 2380 2381 $this.on('click', function(){ 2382 $carousel.to( parseInt(toIndex) - 1 ); 2383 }); 2384 2385 } 2386 }); 2387 2388 $el.on('change.owl.carousel', function(){ 2389 $('[data-carousel-navigate-id="#'+ $el.attr('id') +'"]').removeClass('active'); 2390 }); 2391 2392 $el.on('changed.owl.carousel', function(e){ 2393 $('[data-carousel-navigate-id="#'+ $el.attr('id') +'"][data-carousel-navigate-to="'+ ( e.item.index + 1 ) +'"]').addClass('active'); 2394 }); 2395 } 2396 2397 return this; 2398 } 2399 }; 2400 2401 // expose to scope 2402 $.extend(theme, { 2403 PluginCarousel: PluginCarousel 2404 }); 2405 2406 // jquery plugin 2407 $.fn.themePluginCarousel = function(opts) { 2408 return this.map(function() { 2409 var $this = $(this); 2410 2411 if ($this.data(instanceName)) { 2412 return $this.data(instanceName); 2413 } else { 2414 return new PluginCarousel($this, opts); 2415 } 2416 2417 }); 2418 } 2419 2420}).apply(this, [window.theme, jQuery]); 2421 2422// Chart Circular 2423(function(theme, $) { 2424 2425 theme = theme || {}; 2426 2427 var instanceName = '__chartCircular'; 2428 2429 var PluginChartCircular = function($el, opts) { 2430 return this.initialize($el, opts); 2431 }; 2432 2433 PluginChartCircular.defaults = { 2434 accX: 0, 2435 accY: -150, 2436 delay: 1, 2437 barColor: '#0088CC', 2438 trackColor: '#f2f2f2', 2439 scaleColor: false, 2440 scaleLength: 5, 2441 lineCap: 'round', 2442 lineWidth: 13, 2443 size: 175, 2444 rotate: 0, 2445 animate: ({ 2446 duration: 2500, 2447 enabled: true 2448 }) 2449 }; 2450 2451 PluginChartCircular.prototype = { 2452 initialize: function($el, opts) { 2453 if ($el.data(instanceName)) { 2454 return this; 2455 } 2456 2457 this.$el = $el; 2458 2459 this 2460 .setData() 2461 .setOptions(opts) 2462 .build(); 2463 2464 return this; 2465 }, 2466 2467 setData: function() { 2468 this.$el.data(instanceName, this); 2469 2470 return this; 2471 }, 2472 2473 setOptions: function(opts) { 2474 this.options = $.extend(true, {}, PluginChartCircular.defaults, opts, { 2475 wrapper: this.$el 2476 }); 2477 2478 return this; 2479 }, 2480 2481 build: function() { 2482 if (!($.isFunction($.fn.easyPieChart))) { 2483 return this; 2484 } 2485 2486 var self = this, 2487 $el = this.options.wrapper, 2488 value = ($el.attr('data-percent') ? $el.attr('data-percent') : 0), 2489 percentEl = $el.find('.percent'); 2490 2491 $.extend(true, self.options, { 2492 onStep: function(from, to, currentValue) { 2493 percentEl.html(parseInt(currentValue)); 2494 } 2495 }); 2496 2497 $el.attr('data-percent', 0); 2498 2499 $el.easyPieChart(self.options); 2500 2501 setTimeout(function() { 2502 2503 $el.data('easyPieChart').update(value); 2504 $el.attr('data-percent', value); 2505 2506 }, self.options.delay); 2507 2508 return this; 2509 } 2510 }; 2511 2512 // expose to scope 2513 $.extend(theme, { 2514 PluginChartCircular: PluginChartCircular 2515 }); 2516 2517 // jquery plugin 2518 $.fn.themePluginChartCircular = function(opts) { 2519 return this.map(function() { 2520 var $this = $(this); 2521 2522 if ($this.data(instanceName)) { 2523 return $this.data(instanceName); 2524 } else { 2525 return new PluginChartCircular($this, opts); 2526 } 2527 2528 }); 2529 } 2530 2531}).apply(this, [window.theme, jQuery]); 2532 2533// Countdown 2534(function(theme, $) { 2535 2536 theme = theme || {}; 2537 2538 var instanceName = '__countdown'; 2539 2540 var PluginCountdown = function($el, opts) { 2541 return this.initialize($el, opts); 2542 }; 2543 2544 PluginCountdown.defaults = { 2545 date: '2030/06/10 12:00:00', 2546 textDay: 'DAYS', 2547 textHour: 'HRS', 2548 textMin: 'MIN', 2549 textSec: 'SEC', 2550 uppercase: true, 2551 numberClass: '', 2552 wrapperClass: '', 2553 insertHTMLbefore: '', 2554 insertHTMLafter: '' 2555 }; 2556 2557 PluginCountdown.prototype = { 2558 initialize: function($el, opts) { 2559 if ($el.data(instanceName)) { 2560 return this; 2561 } 2562 2563 this.$el = $el; 2564 2565 this 2566 .setData() 2567 .setOptions(opts) 2568 .build(); 2569 2570 return this; 2571 }, 2572 2573 setData: function() { 2574 this.$el.data(instanceName, this); 2575 2576 return this; 2577 }, 2578 2579 setOptions: function(opts) { 2580 this.options = $.extend(true, {}, PluginCountdown.defaults, opts, { 2581 wrapper: this.$el 2582 }); 2583 2584 return this; 2585 }, 2586 2587 build: function() { 2588 if (!($.isFunction($.fn.countTo))) { 2589 return this; 2590 } 2591 2592 var self = this, 2593 $el = this.options.wrapper, 2594 numberClass = ( self.options.numberClass ) ? ' ' + self.options.numberClass : '', 2595 wrapperClass = ( self.options.wrapperClass ) ? ' ' + self.options.wrapperClass : ''; 2596 2597 if( self.options.uppercase ) { 2598 $el.countdown(self.options.date).on('update.countdown', function(event) { 2599 var $this = $(this).html(event.strftime(self.options.insertHTMLbefore 2600 + '<span class="days'+ wrapperClass +'"><span class="'+ numberClass +'">%D</span> '+ self.options.textDay +'</span> ' 2601 + '<span class="hours'+ wrapperClass +'"><span class="'+ numberClass +'">%H</span> '+ self.options.textHour +'</span> ' 2602 + '<span class="minutes'+ wrapperClass +'"><span class="'+ numberClass +'">%M</span> '+ self.options.textMin +'</span> ' 2603 + '<span class="seconds'+ wrapperClass +'"><span class="'+ numberClass +'">%S</span> '+ self.options.textSec +'</span> ' 2604 + self.options.insertHTMLafter 2605 )); 2606 }); 2607 } else { 2608 $el.countdown(self.options.date).on('update.countdown', function(event) { 2609 var $this = $(this).html(event.strftime(self.options.insertHTMLbefore 2610 + '<span class="days'+ wrapperClass +'"><span class="'+ numberClass +'">%D</span> '+ self.options.textDay +'</span> ' 2611 + '<span class="hours'+ wrapperClass +'"><span class="'+ numberClass +'">%H</span> '+ self.options.textHour +'</span> ' 2612 + '<span class="minutes'+ wrapperClass +'"><span class="'+ numberClass +'">%M</span> '+ self.options.textMin +'</span> ' 2613 + '<span class="seconds'+ wrapperClass +'"><span class="'+ numberClass +'">%S</span> '+ self.options.textSec +'</span> ' 2614 + self.options.insertHTMLafter 2615 )); 2616 }); 2617 } 2618 2619 return this; 2620 } 2621 }; 2622 2623 // expose to scope 2624 $.extend(theme, { 2625 PluginCountdown: PluginCountdown 2626 }); 2627 2628 // jquery plugin 2629 $.fn.themePluginCountdown = function(opts) { 2630 return this.map(function() { 2631 var $this = $(this); 2632 2633 if ($this.data(instanceName)) { 2634 return $this.data(instanceName); 2635 } else { 2636 return new PluginCountdown($this, opts); 2637 } 2638 2639 }); 2640 } 2641 2642}).apply(this, [window.theme, jQuery]); 2643 2644// Counter 2645(function(theme, $) { 2646 2647 theme = theme || {}; 2648 2649 var instanceName = '__counter'; 2650 2651 var PluginCounter = function($el, opts) { 2652 return this.initialize($el, opts); 2653 }; 2654 2655 PluginCounter.defaults = { 2656 accX: 0, 2657 accY: 0, 2658 appendWrapper: false, 2659 prependWrapper: false, 2660 speed: 3000, 2661 refreshInterval: 100, 2662 decimals: 0, 2663 comma: false, 2664 onUpdate: null, 2665 onComplete: null 2666 } 2667 2668 PluginCounter.prototype = { 2669 initialize: function($el, opts) { 2670 if ($el.data(instanceName)) { 2671 return this; 2672 } 2673 2674 this.$el = $el; 2675 2676 this 2677 .setData() 2678 .setOptions(opts) 2679 .build(); 2680 2681 return this; 2682 }, 2683 2684 setData: function() { 2685 this.$el.data(instanceName, this); 2686 2687 return this; 2688 }, 2689 2690 setOptions: function(opts) { 2691 this.options = $.extend(true, {}, PluginCounter.defaults, opts, { 2692 wrapper: this.$el 2693 }); 2694 2695 return this; 2696 }, 2697 2698 build: function() { 2699 if (!($.isFunction($.fn.countTo))) { 2700 return this; 2701 } 2702 2703 var self = this, 2704 $el = this.options.wrapper; 2705 2706 if (self.options.comma) { 2707 self.options.formatter = function(value, settings) { 2708 return value.toFixed(settings.decimals).toString().replace('.',','); 2709 } 2710 } 2711 2712 $.extend(self.options, { 2713 onComplete: function() { 2714 2715 if ($el.data('append')) { 2716 if( self.options.appendWrapper ) { 2717 var appendWrapper = $( self.options.appendWrapper ); 2718 2719 appendWrapper.append( $el.data('append') ); 2720 2721 $el.html( $el.html() + appendWrapper[0].outerHTML ); 2722 } else { 2723 $el.html($el.html() + $el.data('append')); 2724 } 2725 } 2726 2727 if ($el.data('prepend')) { 2728 if( self.options.prependWrapper ) { 2729 var prependWrapper = $( self.options.prependWrapper ); 2730 2731 prependWrapper.append( $el.data('prepend') ); 2732 2733 $el.html( $el.html() + prependWrapper[0].outerHTML ); 2734 } else { 2735 $el.html($el.data('prepend') + $el.html()); 2736 } 2737 } 2738 } 2739 }); 2740 2741 $el.countTo(self.options); 2742 2743 return this; 2744 } 2745 }; 2746 2747 // expose to scope 2748 $.extend(theme, { 2749 PluginCounter: PluginCounter 2750 }); 2751 2752 // jquery plugin 2753 $.fn.themePluginCounter = function(opts) { 2754 return this.map(function() { 2755 var $this = $(this); 2756 2757 if ($this.data(instanceName)) { 2758 return $this.data(instanceName); 2759 } else { 2760 return new PluginCounter($this, opts); 2761 } 2762 2763 }); 2764 } 2765 2766}).apply(this, [window.theme, jQuery]); 2767 2768// CursorEffect 2769(function(theme, $) { 2770 2771 theme = theme || {}; 2772 2773 var instanceName = '__cursorEffect'; 2774 2775 var PluginCursorEffect = function($el, opts) { 2776 return this.initialize($el, opts); 2777 }; 2778 2779 PluginCursorEffect.defaults = { 2780 2781 } 2782 2783 PluginCursorEffect.prototype = { 2784 initialize: function($el, opts) { 2785 if ($el.data(instanceName)) { 2786 return this; 2787 } 2788 2789 this.$el = $el; 2790 2791 this 2792 .setData() 2793 .setOptions(opts) 2794 .build() 2795 .events(); 2796 2797 return this; 2798 }, 2799 2800 setData: function() { 2801 this.$el.data(instanceName, this); 2802 2803 return this; 2804 }, 2805 2806 setOptions: function(opts) { 2807 this.options = $.extend(true, {}, PluginCursorEffect.defaults, opts, { 2808 wrapper: this.$el 2809 }); 2810 2811 return this; 2812 }, 2813 2814 build: function() { 2815 var self = this; 2816 2817 // Global Variables for cursor position 2818 self.clientX = -100; 2819 self.clientY = -100; 2820 2821 // Hide Mouse Cursor 2822 if( self.options.hideMouseCursor ) { 2823 self.$el.addClass('hide-mouse-cursor'); 2824 } 2825 2826 // Creates the cursor wrapper node 2827 var cursorOuter = document.createElement('DIV'); 2828 cursorOuter.className = 'cursor-outer'; 2829 2830 // Creates the cursor inner node 2831 var cursorInner = document.createElement('DIV'); 2832 cursorInner.className = 'cursor-inner'; 2833 2834 // Custom Cursor Outer Color 2835 if( self.options.cursorOuterColor ) { 2836 cursorOuter.style = 'border-color: ' + self.options.cursorOuterColor + ';'; 2837 } 2838 2839 // Custom Cursor Inner Color 2840 if( self.options.cursorInnerColor ) { 2841 cursorInner.style = 'background-color: ' + self.options.cursorInnerColor + ';'; 2842 } 2843 2844 // Size 2845 if( self.options.size ) { 2846 switch ( self.options.size ) { 2847 case 'small': 2848 self.$el.addClass( 'cursor-effect-size-small' ); 2849 break; 2850 2851 case 'big': 2852 self.$el.addClass( 'cursor-effect-size-big' ); 2853 break; 2854 } 2855 } 2856 2857 // Style 2858 if( self.options.style ) { 2859 self.$el.addClass( self.options.style ); 2860 } 2861 2862 // Prepend cursor wrapper node to the body 2863 document.body.prepend( cursorOuter ); 2864 2865 // Prepend cursor inner node to the body 2866 document.body.prepend( cursorInner ); 2867 2868 // Loop for render 2869 var render = function() { 2870 cursorOuter.style.transform = 'translate('+ self.clientX +'px, '+ self.clientY +'px)'; 2871 cursorInner.style.transform = 'translate('+ self.clientX +'px, '+ self.clientY +'px)'; 2872 2873 self.loopInside = requestAnimationFrame(render); 2874 } 2875 self.loop = requestAnimationFrame(render); 2876 2877 return this; 2878 }, 2879 2880 events: function() { 2881 var self = this, 2882 $cursorOuter = $('.cursor-outer'), 2883 $cursorInner = $('.cursor-inner'); 2884
2885 var initialCursorOuterBox = $cursorOuter[0].getBoundingClientRect(), 2886 initialCursorOuterRadius = $cursorOuter.css('border-radius'); 2887 2888 // Update Cursor Position 2889 document.addEventListener('mousemove', function(e){ 2890 if( !self.isStuck ) { 2891 self.clientX = e.clientX - 20; 2892 self.clientY = e.clientY - 20; 2893 } 2894 2895 $cursorOuter.removeClass('opacity-0'); 2896 }); 2897 2898 self.isStuck = false; 2899 $('[data-cursor-effect-hover]').on('mouseenter', function(e){ 2900 2901 // Identify Event With Hover Class 2902 $cursorOuter.addClass('cursor-outer-hover'); 2903 $cursorInner.addClass('cursor-inner-hover'); 2904 2905 // Hover Color 2906 var hoverColor = $(this).data('cursor-effect-hover-color'); 2907 $cursorOuter.addClass( 'cursor-color-' + hoverColor ); 2908 $cursorInner.addClass( 'cursor-color-' + hoverColor ); 2909 2910 // Effect Types 2911 switch ( $(this).data('cursor-effect-hover') ) { 2912 case 'fit': 2913 var thisBox = $(this)[0].getBoundingClientRect(); 2914 2915 self.clientX = thisBox.x; 2916 self.clientY = thisBox.y; 2917 2918 $cursorOuter.css({ 2919 width: thisBox.width, 2920 height: thisBox.height, 2921 'border-radius': $(this).css('border-radius') 2922 }).addClass('cursor-outer-fit'); 2923 2924 $cursorInner.addClass('opacity-0'); 2925 2926 self.isStuck = true; 2927 break; 2928 2929 case 'plus': 2930 $cursorInner.addClass('cursor-inner-plus'); 2931 break; 2932 } 2933 }); 2934 2935 $('[data-cursor-effect-hover]').on('mouseleave', function(){ 2936 2937 // Identify Event With Hover Class 2938 $cursorOuter.removeClass('cursor-outer-hover'); 2939 $cursorInner.removeClass('cursor-inner-hover'); 2940 2941 // Remove Color Class 2942 var hoverColor = $(this).data('cursor-effect-hover-color'); 2943 $cursorOuter.removeClass( 'cursor-color-' + hoverColor ); 2944 $cursorInner.removeClass( 'cursor-color-' + hoverColor ); 2945 2946 // Effect Types 2947 switch ( $(this).data('cursor-effect-hover') ) { 2948 case 'fit': 2949 $cursorOuter.css({ 2950 width: initialCursorOuterBox.width, 2951 height: initialCursorOuterBox.height, 2952 'border-radius': initialCursorOuterRadius 2953 }).removeClass('cursor-outer-fit'); 2954 2955 $cursorInner.removeClass('opacity-0'); 2956 2957 self.isStuck = false; 2958 break; 2959 2960 case 'plus': 2961 $cursorInner.removeClass('cursor-inner-plus'); 2962 break; 2963 } 2964 }); 2965 2966 $(window).on('scroll', function(){ 2967 if( $cursorOuter.hasClass('cursor-outer-fit') ) { 2968 $cursorOuter.addClass('opacity-0').removeClass('cursor-outer-fit'); 2969 } 2970 }); 2971 2972 return this; 2973 }, 2974 2975 destroy: function() { 2976 var self = this; 2977 2978 self.$el.removeClass('hide-mouse-cursor cursor-effect-size-small cursor-effect-size-big cursor-effect-style-square'); 2979 2980 cancelAnimationFrame( self.loop ); 2981 cancelAnimationFrame( self.loopInside ); 2982 2983 document.querySelector('.cursor-outer').remove(); 2984 document.querySelector('.cursor-inner').remove(); 2985 2986 self.$el.removeData( instanceName, self ); 2987 } 2988 }; 2989 2990 // expose to scope 2991 $.extend(theme, { 2992 PluginCursorEffect: PluginCursorEffect 2993 }); 2994 2995 // jquery plugin 2996 $.fn.themePluginCursorEffect = function(opts) { 2997 return this.map(function() { 2998 var $this = $(this); 2999 3000 if ($this.data(instanceName)) { 3001 return $this.data(instanceName); 3002 } else { 3003 return new PluginCursorEffect($this, opts); 3004 } 3005 3006 }); 3007 } 3008 3009}).apply(this, [window.theme, jQuery]); 3010 3011// Float Element 3012(function(theme, $) { 3013 3014 'use strict'; 3015 3016 theme = theme || {}; 3017 3018 var instanceName = '__floatElement'; 3019 3020 var PluginFloatElement = function($el, opts) { 3021 return this.initialize($el, opts); 3022 }; 3023 3024 PluginFloatElement.defaults = { 3025 startPos: 'top', 3026 speed: 3, 3027 horizontal: false, 3028 isInsideSVG: false, 3029 transition: false, 3030 transitionDelay: 0, 3031 transitionDuration: 500 3032 }; 3033 3034 PluginFloatElement.prototype = { 3035 initialize: function($el, opts) { 3036 if ($el.data(instanceName)) { 3037 return this; 3038 } 3039 3040 this.$el = $el; 3041 3042 this 3043 .setData() 3044 .setOptions(opts) 3045 .build(); 3046 3047 return this; 3048 }, 3049 3050 setData: function() { 3051 this.$el.data(instanceName, this); 3052 3053 return this; 3054 }, 3055 3056 setOptions: function(opts) { 3057 this.options = $.extend(true, {}, PluginFloatElement.defaults, opts, { 3058 wrapper: this.$el 3059 }); 3060 3061 return this; 3062 }, 3063 3064 build: function() { 3065 var self = this, 3066 $el = this.options.wrapper, 3067 $window = $(window), 3068 minus; 3069 3070 // If has floating elements inside a SVG. 3071 // Intersection Observer API do not check elements inside SVG's, so we need initialize trough top parent SVG 3072 if( $el.data('plugin-float-element-svg') ) { 3073 $el.find('[data-plugin-float-element]').each(function(){ 3074 var $this = $(this), 3075 opts; 3076 3077 var pluginOptions = theme.fn.getOptions($this.data('plugin-options')); 3078 if (pluginOptions) 3079 opts = pluginOptions; 3080 3081 $this.themePluginFloatElement(opts); 3082 }); 3083 3084 return this; 3085 } 3086 3087 if( self.options.style ) { 3088 $el.attr('style', self.options.style); 3089 } 3090 3091 if( $window.width() > 767 ) { 3092 3093 // Set Start Position 3094 if( self.options.startPos == 'none' ) { 3095 minus = ''; 3096 } else if( self.options.startPos == 'top' ) { 3097 $el.css({ 3098 top: 0 3099 });
3100 minus = ''; 3101 } else { 3102 $el.css({ 3103 bottom: 0 3104 }); 3105 minus = '-'; 3106 } 3107 3108 // Set Transition 3109 if( self.options.transition ) { 3110 $el.css({ 3111 transition: 'ease-out transform '+ self.options.transitionDuration +'ms ' + self.options.transitionDelay + 'ms' 3112 }); 3113 } 3114 3115 // First Load 3116 self.movement(minus); 3117 3118 // Scroll 3119 $window.on('scroll', function(){ 3120 self.movement(minus); 3121 }); 3122 3123 } 3124 3125 return this; 3126 }, 3127 3128 movement: function(minus) { 3129 var self = this, 3130 $el = this.options.wrapper, 3131 $window = $(window), 3132 scrollTop = $window.scrollTop(), 3133 elementOffset = $el.offset().top, 3134 currentElementOffset = (elementOffset - scrollTop), 3135 factor = ( self.options.isInsideSVG ) ? 2 : 100; 3136 3137 var scrollPercent = factor * currentElementOffset / ($window.height()); 3138 3139 if( $el.visible( true ) ) { 3140 3141 if( !self.options.horizontal ) { 3142 3143 $el.css({ 3144 transform: 'translate3d(0, '+ minus + scrollPercent / self.options.speed +'%, 0)' 3145 }); 3146 3147 } else { 3148 3149 $el.css({ 3150 transform: 'translate3d('+ minus + scrollPercent / self.options.speed +'%, 0, 0)' 3151 }); 3152 3153 } 3154 3155 } 3156 3157 } 3158 }; 3159 3160 // expose to scope 3161 $.extend(theme, { 3162 PluginFloatElement: PluginFloatElement 3163 }); 3164 3165 // jquery plugin 3166 $.fn.themePluginFloatElement = function(opts) { 3167 return this.map(function() { 3168 var $this = $(this); 3169 3170 if ($this.data(instanceName)) { 3171 return $this.data(instanceName); 3172 } else { 3173 return new PluginFloatElement($this, opts); 3174 } 3175 3176 }); 3177 } 3178 3179}).apply(this, [window.theme, jQuery]); 3180 3181// GDPR 3182(function(theme, $) { 3183 3184 theme = theme || {}; 3185 3186 var instanceName = '__gdpr'; 3187 3188 var PluginGDPR = function($el, opts) { 3189 return this.initialize($el, opts); 3190 }; 3191 3192 PluginGDPR.defaults = { 3193 cookieBarShowDelay: 3000 3194 }; 3195 3196 PluginGDPR.prototype = { 3197 initialize: function($el, opts) { 3198 var self = this; 3199 3200 this.$el = $el; 3201 3202 this 3203 .setData() 3204 .setOptions(opts) 3205 .build() 3206 .events(); 3207 3208 return this; 3209 }, 3210 3211 setData: function() { 3212 this.$el.data(instanceName, this); 3213 3214 return this; 3215 }, 3216 3217 setOptions: function(opts) { 3218 this.options = $.extend(true, {}, PluginGDPR.defaults, opts, { 3219 wrapper: this.$el 3220 }); 3221 3222 return this; 3223 }, 3224 3225 build: function() { 3226 var self = this; 3227 3228 // Show 3229 if( !$.cookie( 'porto-privacy-bar' ) ) { 3230 setTimeout(function(){ 3231 self.options.wrapper.addClass('show'); 3232 }, self.options.cookieBarShowDelay); 3233 } 3234 3235 // If already has preferences cookie, check inputs according preferences cookie data 3236 if( $.cookie( 'porto-gdpr-preferences' ) ) { 3237 var preferencesArr = $.cookie( 'porto-gdpr-preferences' ).split(','); 3238 3239 for( var i = 0; i < preferencesArr.length; i++ ) { 3240 if( $('input[value="'+ preferencesArr[i] +'"]').get(0) ) { 3241 if( $('input[value="'+ preferencesArr[i] +'"]').is(':checkbox') ) { 3242 $('input[value="'+ preferencesArr[i] +'"]').prop('checked', true); 3243 } 3244 } 3245 } 3246 } 3247 3248 return this; 3249 3250 }, 3251 3252 events: function() { 3253 var self = this; 3254 3255 // Agree Trigger 3256 self.options.wrapper.find('.gdpr-agree-trigger').on('click', function(e){ 3257 e.preventDefault(); 3258 3259 $('.gdpr-preferences-form').find('.gdpr-input').each(function(){ 3260 if( $(this).is(':checkbox') || $(this).is(':hidden') ) { 3261 $(this).prop('checked', true); 3262 } 3263 }); 3264 3265 $('.gdpr-preferences-form').trigger('submit').removeClass('show'); 3266 3267 self.removeCookieBar(); 3268 }); 3269 3270 // Preferences Trigger 3271 self.options.wrapper.find('.gdpr-preferences-trigger').on('click', function(e){ 3272 e.preventDefault(); 3273 3274 $('.gdpr-preferences-popup').addClass('show'); 3275 }); 3276 3277 // Close Popup Button 3278 $('.gdpr-close-popup').on('click', function(e){ 3279 e.preventDefault(); 3280 3281 $('.gdpr-preferences-popup').removeClass('show'); 3282 }); 3283 3284 // Close Popup When Click Outside of popup area 3285 $('.gdpr-preferences-popup').on('click', function(e){
3286 if( !$(e.target).closest('.gdpr-preferences-popup-content').get(0) ) { 3287 $('.gdpr-preferences-popup').removeClass('show'); 3288 } 3289 }); 3290 3291 // Preference Form 3292 $('.gdpr-preferences-form').on('submit', function(e){ 3293 e.preventDefault(); 3294 3295 var $this = $(this); 3296 3297 // Save Preferences Button 3298 $this.find('button[type="submit"]').text( 'SAVING...' ); 3299 3300 // Form Data 3301 var formData = []; 3302 $this.find('.gdpr-input').each(function(){ 3303 if( $(this).is(':checkbox') && $(this).is(':checked') || $(this).is(':hidden') ) { 3304 formData.push( $(this).val() ); 3305 } 3306 }); 3307 3308 $.cookie( 'porto-privacy-bar', true ); 3309 3310 setTimeout(function(){ 3311 $this.find('button[type="submit"]').text( 'SAVED!' ).removeClass('btn-primary').addClass('btn-success'); 3312 3313 setTimeout(function(){ 3314 $('.gdpr-preferences-popup').removeClass('show'); 3315 self.removeCookieBar(); 3316 3317 $this.find('button[type="submit"]').text( 'SAVE PREFERENCES' ).removeClass('btn-success').addClass('btn-primary'); 3318 3319 if( $.cookie( 'porto-gdpr-preferences' ) ) { 3320 3321 $.cookie( 'porto-gdpr-preferences', formData ); 3322 location.reload(); 3323 3324 } else { 3325 3326 $.cookie( 'porto-gdpr-preferences', formData ); 3327 3328 if ($.isFunction($.fn['themePluginGDPRWrapper']) && $('[data-plugin-gdpr-wrapper]').length) { 3329 3330 $(function() { 3331 $('[data-plugin-gdpr-wrapper]:not(.manual)').each(function() { 3332 var $this = $(this), 3333 opts; 3334 3335 $this.removeData('__gdprwrapper'); 3336 3337 var pluginOptions = theme.fn.getOptions($this.data('plugin-options')); 3338 if (pluginOptions) 3339 opts = pluginOptions; 3340 3341 $this.themePluginGDPRWrapper(opts); 3342 }); 3343 });
3344 3345 } 3346 3347 } 3348 3349 }, 500); 3350 }, 1000); 3351 }); 3352 3353 // Remove/Reset Cookies 3354 $('.gdpr-reset-cookies').on('click', function(e){ 3355 e.preventDefault(); 3356 3357 self.clearCookies(); 3358 3359 location.reload(); 3360 }); 3361 3362 // Open Preferences 3363 $('.gdpr-open-preferences').on('click', function(e){ 3364 e.preventDefault(); 3365 3366 $('.gdpr-preferences-popup').toggleClass('show'); 3367 }); 3368 3369 return this; 3370 }, 3371 3372 removeCookieBar: function() { 3373 var self = this; 3374 3375 self.options.wrapper.addClass('removing').on('transitionend', function(){ 3376 setTimeout(function(){ 3377 self.options.wrapper.removeClass('show removing'); 3378 }, 500); 3379 }); 3380 3381 return this; 3382 }, 3383 3384 clearCookies: function() { 3385 var self = this; 3386 3387 $.removeCookie( 'porto-privacy-bar' ); 3388 $.removeCookie( 'porto-gdpr-preferences' ); 3389 3390 return this; 3391 } 3392 }; 3393 3394 // expose to scope 3395 $.extend(theme, { 3396 PluginGDPR: PluginGDPR 3397 }); 3398 3399 // jquery plugin 3400 $.fn.themePluginGDPR = function(opts) { 3401 return this.map(function() { 3402 var $this = $(this); 3403 3404 if ($this.data(instanceName)) { 3405 return $this.data(instanceName); 3406 } else { 3407 return new PluginGDPR($this, opts); 3408 } 3409 3410 }); 3411 } 3412 3413}).apply(this, [window.theme, jQuery]); 3414 3415// GDPR Wrapper 3416(function(theme, $) { 3417 3418 theme = theme || {}; 3419 3420 var instanceName = '__gdprwrapper'; 3421 3422 var PluginGDPRWrapper = function($el, opts) { 3423 return this.initialize($el, opts); 3424 }; 3425 3426 PluginGDPRWrapper.defaults = { 3427 3428 }; 3429 3430 PluginGDPRWrapper.prototype = { 3431 initialize: function($el, opts) { 3432 var self = this; 3433 3434 this.$el = $el; 3435 3436 this 3437 .setData() 3438 .setOptions(opts) 3439 .build(); 3440 3441 return this; 3442 }, 3443 3444 setData: function() { 3445 this.$el.data(instanceName, this); 3446 3447 return this; 3448 }, 3449 3450 setOptions: function(opts) { 3451 this.options = $.extend(true, {}, PluginGDPRWrapper.defaults, opts, { 3452 wrapper: this.$el 3453 }); 3454 3455 return this; 3456 }, 3457 3458 build: function() { 3459 var self = this; 3460 3461 if( $.cookie( 'porto-gdpr-preferences' ) && $.cookie( 'porto-gdpr-preferences' ).indexOf( self.options.checkCookie ) != -1 ) { 3462 3463 $.ajax({
3464 url: self.options.ajaxURL, 3465 cache: false, 3466 complete: function(data) { 3467 3468 setTimeout(function() { 3469 3470 self.options.wrapper.html(data.responseText).addClass('show'); 3471 3472 }, 1000); 3473 3474 } 3475 }); 3476 3477 } else { 3478 self.options.wrapper.addClass('show'); 3479 } 3480 3481 return this; 3482 3483 } 3484 }; 3485 3486 // expose to scope 3487 $.extend(theme, { 3488 PluginGDPRWrapper: PluginGDPRWrapper 3489 }); 3490 3491 // jquery plugin 3492 $.fn.themePluginGDPRWrapper = function(opts) { 3493 return this.map(function() { 3494 var $this = $(this); 3495 3496 if ($this.data(instanceName)) { 3497 return $this.data(instanceName); 3498 } else { 3499 return new PluginGDPRWrapper($this, opts); 3500 } 3501 3502 }); 3503 } 3504 3505}).apply(this, [window.theme, jQuery]); 3506 3507// Hover Effect 3508(function(theme, $) { 3509 3510 theme = theme || {}; 3511 3512 var instanceName = '__hoverEffect'; 3513 3514 var PluginHoverEffect = function($el, opts) { 3515 return this.initialize($el, opts); 3516 }; 3517 3518 PluginHoverEffect.defaults = { 3519 effect: 'magnetic', 3520 magneticMx: 0.15, 3521 magneticMy: 0.3, 3522 magneticDeg: 12, 3523 selector: '.thumb-info, .hover-effect-3d-wrapper', 3524 sensitivity: 20 3525 }; 3526 3527 PluginHoverEffect.prototype = { 3528 initialize: function($el, opts) { 3529 if ($el.data(instanceName)) { 3530 return this; 3531 } 3532 3533 this.$el = $el; 3534 3535 this 3536 .setData() 3537 .setOptions(opts) 3538 .build(); 3539 3540 return this; 3541 }, 3542 3543 setData: function() { 3544 this.$el.data(instanceName, this); 3545 3546 return this; 3547 }, 3548 3549 setOptions: function(opts) { 3550 this.options = $.extend(true, {}, PluginHoverEffect.defaults, opts, { 3551 wrapper: this.$el 3552 }); 3553 3554 return this; 3555 }, 3556 3557 build: function() { 3558 var self = this; 3559 3560 if(self.$el.hasClass('hover-effect-3d')) { 3561 self.options.effect = '3d'; 3562 } 3563 3564 // Magnetic 3565 if(self.options.effect == 'magnetic') { 3566 self.magnetic(); 3567 } 3568 3569 // 3d 3570 if(self.options.effect == '3d') { 3571 self.hover3d(); 3572 } 3573 3574 return this; 3575 }, 3576 3577 magnetic: function() { 3578 var self = this; 3579 3580 self.$el.mousemove(function(e) { 3581 3582 const pos = this.getBoundingClientRect(); 3583 const mx = e.clientX - pos.left - pos.width/2; 3584 const my = e.clientY - pos.top - pos.height/2; 3585 3586 this.style.transform = 'translate('+ mx * self.options.magneticMx +'px, '+ my * self.options.magneticMx +'px)'; 3587 3588 }); 3589 3590 self.$el.mouseleave(function(e) { 3591 3592 this.style.transform = 'translate3d(0px, 0px, 0px)'; 3593 3594 }); 3595 3596 return this; 3597 3598 }, 3599 3600 hover3d: function() { 3601 var self = this; 3602 3603 if ($.isFunction($.fn['hover3d'])) { 3604 3605 self.$el.hover3d({ 3606 selector: self.options.selector, 3607 sensitivity: self.options.sensitivity 3608 }); 3609 3610 } 3611 3612 return this; 3613 3614 } 3615 }; 3616 3617 // expose to scope 3618 $.extend(theme, { 3619 PluginHoverEffect: PluginHoverEffect 3620 }); 3621 3622 // jquery plugin 3623 $.fn.themePluginHoverEffect = function(opts) { 3624 return this.map(function() { 3625 var $this = $(this); 3626 3627 if ($this.data(instanceName)) { 3628 return $this.data(instanceName); 3629 } else { 3630 return new PluginHoverEffect($this, opts); 3631 } 3632 3633 }); 3634 }; 3635 3636}).apply(this, [window.theme, jQuery]); 3637 3638// Icon 3639(function(theme, $) { 3640 3641 'use strict'; 3642 3643 theme = theme || {}; 3644 3645 var instanceName = '__icon'; 3646 3647 var PluginIcon = function($el, opts) { 3648 return this.initialize($el, opts); 3649 }; 3650 3651 PluginIcon.defaults = { 3652 color: '#2388ED', 3653 animated: false, 3654 delay: 300, 3655 onlySVG: false, 3656 removeClassAfterInit: false, 3657 fadeIn: true, 3658 accY: 0 3659 }; 3660 3661 PluginIcon.prototype = { 3662 initialize: function($el, opts) { 3663 if ($el.data(instanceName)) { 3664 return this; 3665 } 3666 3667 this.$el = $el; 3668 3669 this 3670 .setData() 3671 .setOptions(opts) 3672 .build(); 3673 3674 return this; 3675 }, 3676 3677 setData: function() { 3678 this.$el.data(instanceName, this); 3679 3680 return this; 3681 }, 3682 3683 setOptions: function(opts) { 3684 this.options = $.extend(true, {}, PluginIcon.defaults, opts, { 3685 wrapper: this.$el 3686 }); 3687 3688 return this; 3689 }, 3690 3691 build: function() { 3692 var self = this, 3693 $el = this.options.wrapper, 3694 color = self.options.color, 3695 elTopDistance = $el.offset().top, 3696 windowTopDistance = $(window).scrollTop(), 3697 duration = ( self.options.animated && !self.options.strokeBased ) ? 200 : 100; 3698 3699 // Check origin 3700 if( window.location.protocol === 'file:' ) { 3701 $el.css({ 3702 opacity: 1, 3703 width: $el.attr('width') 3704 }); 3705 3706 if( self.options.extraClass ) { 3707 $el.addClass( self.options.extraClass ); 3708 } 3709 3710 if( self.options.extraClass.indexOf('-color-light') > 0 ) { 3711 $el.css({ 3712 filter: 'invert(1)' 3713 });
3714 } 3715 3716 $(window).trigger('icon.rendered'); 3717 return; 3718 } 3719 3720 // Duration 3721 if( self.options.duration ) { 3722 duration = self.options.duration; 3723 } 3724 3725 // SVG Content 3726 var SVGContent = $.get({ 3727 url: $el.attr('src'), 3728 success: function(data, status, xhr){ 3729 var iconWrapper = self.options.fadeIn ? $('<div class="animated-icon animated fadeIn">'+ xhr.responseText +'</div>') : $('<div class="animated-icon animated">'+ xhr.responseText +'</div>'), 3730 uniqid = 'icon_' + Math.floor(Math.random() * 26) + Date.now(); 3731 3732 // Add ID 3733 iconWrapper.find('svg').attr('id', uniqid); 3734 3735 // Identify with filename 3736 iconWrapper.find('svg').attr('data-filename', $el.attr('src').split(/(\\|\/)/g).pop()); 3737 3738 if( $el.attr('width') ) { 3739 iconWrapper.find('svg') 3740 .attr('width', $el.attr('width')) 3741 .attr('height', $el.attr('width')); 3742 } 3743 3744 if( $el.attr('height') ) { 3745 iconWrapper.find('svg') 3746 .attr('height', $el.attr('height')); 3747 } 3748 3749 if( self.options.svgViewBox ) { 3750 iconWrapper.find('svg') 3751 .attr('viewBox', self.options.svgViewBox); 3752 } 3753 3754 $el.replaceWith(iconWrapper); 3755 3756 if( self.options.extraClass ) { 3757 iconWrapper.addClass( self.options.extraClass ); 3758 } 3759 3760 if( self.options.removeClassAfterInit ) { 3761 iconWrapper.removeClass(self.options.removeClassAfterInit); 3762 } 3763 3764 if( self.options.onlySVG ) { 3765 $(window).trigger('icon.rendered'); 3766 return this; 3767 } 3768 3769 $el = iconWrapper; 3770 3771 var icon = new Vivus(uniqid, {start: 'manual', type: 'sync', selfDestroy: true, duration: duration, onReady: function(obj){ 3772 var styleElement = document.createElementNS("http://www.w3.org/2000/svg", "style"), 3773 animateStyle = ''; 3774 3775 // SVG Fill Based 3776 if( self.options.animated && !self.options.strokeBased || !self.options.animated && color && !self.options.strokeBased ) { 3777 animateStyle = 'stroke-width: 0.1px; fill-opacity: 0; transition: ease fill-opacity 300ms;'; 3778 3779 // Set Style on SVG inside object 3780 styleElement.textContent = '#' + uniqid + ' path, #' + uniqid + ' line, #' + uniqid + ' rect, #' + uniqid + ' circle, #' + uniqid + ' polyline { fill: '+ color +'; stroke: '+ color +'; '+ animateStyle + (self.options.svgStyle ? self.options.svgStyle : "") + ' } .finished path { fill-opacity: 1; }'; 3781 obj.el.appendChild(styleElement); 3782 } 3783 3784 // SVG Stroke Based 3785 if( self.options.animated && self.options.strokeBased || !self.options.animated && color && self.options.strokeBased ) { 3786 3787 // Set Style on SVG inside object 3788 styleElement.textContent = '#' + uniqid + ' path, #' + uniqid + ' line, #' + uniqid + ' rect, #' + uniqid + ' circle, #' + uniqid + ' polyline { stroke: '+ color +'; ' + (self.options.svgStyle ? self.options.svgStyle : "") + '}'; 3789 obj.el.appendChild(styleElement); 3790 } 3791 3792 $.event.trigger('theme.plugin.icon.svg.ready'); 3793 }}); 3794 3795 // Isn't animated 3796 if( !self.options.animated ) { 3797 setTimeout(function(){ 3798 icon.finish(); 3799 }, 10); 3800 $el.css({ opacity: 1 }); 3801 } 3802 3803 // Animated 3804 if( self.options.animated && $(window).width() > 767 ) { 3805 3806 // First Load 3807 if( $el.visible( true ) ) { 3808 self.startIconAnimation( icon, $el ); 3809 } else if( elTopDistance < windowTopDistance ) { 3810 self.startIconAnimation( icon, $el ); 3811 } 3812 3813 // On Scroll 3814 $(window).on('scroll', function(){ 3815 if( $el.visible( true ) ) { 3816 self.startIconAnimation( icon, $el ); 3817 } 3818 }); 3819 3820 } else { 3821 3822 $el.css({ opacity: 1 }); 3823 icon.finish(); 3824 3825 $(window).on('theme.plugin.icon.svg.ready', function(){ 3826 setTimeout(function(){ 3827 icon.el.setAttribute('class', 'finished'); 3828 icon.finish(); 3829 }, 300); 3830 }); 3831 3832 } 3833 3834 $(window).trigger('icon.rendered'); 3835 } 3836 }); 3837 3838 return this; 3839 }, 3840 3841 startIconAnimation: function(icon, $el) { 3842 var self = this; 3843 3844 // Animate for better performance 3845 $({to:0}).animate({to:1}, ((self.options.strokeBased) ? self.options.delay : self.options.delay + 300 ), function() { 3846 $el.css({ opacity: 1 }); 3847 }); 3848 3849 $({to:0}).animate({to:1}, self.options.delay, function() { 3850 icon.play(1); 3851 3852 setTimeout(function(){ 3853 icon.el.setAttribute('class', 'finished'); 3854 }, icon.duration * 5 ); 3855 }); 3856 } 3857 }; 3858 3859 // expose to scope 3860 $.extend(theme, { 3861 PluginIcon: PluginIcon 3862 }); 3863 3864 // jquery plugin 3865 $.fn.themePluginIcon = function(opts) { 3866 return this.map(function() { 3867 var $this = $(this); 3868 3869 if ($this.data(instanceName)) { 3870 return $this.data(instanceName); 3871 } else { 3872 return new PluginIcon($this, opts); 3873 } 3874 3875 }); 3876 }; 3877 3878}).apply(this, [window.theme, jQuery]); 3879 3880// In Viewport Style 3881(function(theme, $) { 3882 3883 theme = theme || {}; 3884 3885 var instanceName = '__inviewportstyle'; 3886 3887 var PluginInViewportStyle = function($el, opts) { 3888 return this.initialize($el, opts); 3889 }; 3890 3891 PluginInViewportStyle.defaults = { 3892 viewport: window, 3893 threshold: [0], 3894 modTop: '-200px', 3895 modBottom: '-200px', 3896 style: {'transition': 'all 1s ease-in-out'}, 3897 styleIn: '', 3898 styleOut: '', 3899 classIn: '', 3900 classOut: '' 3901 }; 3902 3903 PluginInViewportStyle.prototype = { 3904 initialize: function($el, opts) { 3905 if ($el.data(instanceName)) { 3906 return this; 3907 } 3908 3909 this.$el = $el; 3910 3911 this 3912 .setData() 3913 .setOptions(opts) 3914 .build(); 3915 3916 return this; 3917 }, 3918 3919 setData: function() { 3920 this.$el.data(instanceName, this); 3921 3922 return this; 3923 }, 3924 3925 setOptions: function(opts) { 3926 this.options = $.extend(true, {}, PluginInViewportStyle.defaults, opts, {}); 3927 3928 return this; 3929 }, 3930 3931 build: function() { 3932 var self = this, 3933 el = self.$el.get(0); 3934 3935 self.$el.css(self.options.style); 3936 3937 if (typeof window.IntersectionObserver === 'function') { 3938 const un = observeElementInViewport.observeElementInViewport( 3939 el, function() { 3940 self.$el.css(self.options.styleIn); 3941 self.$el 3942 .addClass(self.options.classIn) 3943 .removeClass(self.options.classOut); 3944 }, function() { 3945 self.$el.css(self.options.styleOut); 3946 self.$el 3947 .addClass(self.options.classOut) 3948 .removeClass(self.options.classIn); 3949 }, { 3950 viewport: self.options.viewport, 3951 threshold: self.options.threshold, 3952 modTop: self.options.modTop, 3953 modBottom: self.options.modBottom 3954 } 3955 ) 3956 }; 3957 3958 return this; 3959 } 3960 }; 3961 3962 // expose to scope 3963 $.extend(theme, { 3964 PluginInViewportStyle: PluginInViewportStyle 3965 }); 3966 3967 // jquery plugin 3968 $.fn.themePluginInViewportStyle = function(opts) { 3969 return this.map(function() { 3970 var $this = $(this); 3971 3972 if ($this.data(instanceName)) { 3973 return $this.data(instanceName); 3974 } else { 3975 return new PluginInViewportStyle($this, opts); 3976 } 3977 3978 }); 3979 } 3980 3981}).apply(this, [window.theme, jQuery]); 3982 3983// Lightbox 3984(function(theme, $) { 3985 3986 theme = theme || {}; 3987 3988 var instanceName = '__lightbox'; 3989 3990 var PluginLightbox = function($el, opts) { 3991 return this.initialize($el, opts); 3992 }; 3993 3994 PluginLightbox.defaults = { 3995 tClose: 'Close (Esc)', // Alt text on close button 3996 tLoading: 'Loading...', // Text that is displayed during loading. Can contain %curr% and %total% keys 3997 gallery: { 3998 tPrev: 'Previous (Left arrow key)', // Alt text on left arrow 3999 tNext: 'Next (Right arrow key)', // Alt text on right arrow 4000 tCounter: '%curr% of %total%' // Markup for "1 of 7" counter 4001 }, 4002 image: { 4003 tError: '<a href="%url%">The image</a> could not be loaded.' // Error message when image could not be loaded 4004 }, 4005 ajax: { 4006 tError: '<a href="%url%">The content</a> could not be loaded.' // Error message when ajax request failed 4007 }, 4008 callbacks: { 4009 open: function() { 4010 $('html').addClass('lightbox-opened'); 4011 }, 4012 close: function() { 4013 $('html').removeClass('lightbox-opened'); 4014 } 4015 } 4016 }; 4017 4018 PluginLightbox.prototype = { 4019 initialize: function($el, opts) { 4020 if ($el.data(instanceName)) { 4021 return this; 4022 } 4023 4024 this.$el = $el; 4025 4026 this 4027 .setData() 4028 .setOptions(opts) 4029 .build(); 4030 4031 return this; 4032 }, 4033 4034 setData: function() { 4035 this.$el.data(instanceName, this); 4036 4037 return this; 4038 }, 4039 4040 setOptions: function(opts) { 4041 this.options = $.extend(true, {}, PluginLightbox.defaults, opts, { 4042 wrapper: this.$el 4043 }); 4044 4045 return this; 4046 }, 4047 4048 build: function() { 4049 if (!($.isFunction($.fn.magnificPopup))) { 4050 return this; 4051 } 4052 4053 this.options.wrapper.magnificPopup(this.options); 4054 4055 return this; 4056 } 4057 }; 4058 4059 // expose to scope 4060 $.extend(theme, { 4061 PluginLightbox: PluginLightbox 4062 }); 4063 4064 // jquery plugin 4065 $.fn.themePluginLightbox = function(opts) { 4066 return this.map(function() { 4067 var $this = $(this); 4068 4069 if ($this.data(instanceName)) { 4070 return $this.data(instanceName); 4071 } else { 4072 return new PluginLightbox($this, opts); 4073 } 4074 4075 }); 4076 } 4077 4078}).apply(this, [window.theme, jQuery]); 4079 4080// Loading Overlay 4081(function(theme, $) { 4082 4083 'use strict'; 4084 4085 theme = theme || {}; 4086 4087 // Default 4088 var loadingOverlayDefaultTemplate = [ 4089 '<div class="loading-overlay">', 4090 '<div class="bounce-loader"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>', 4091 '</div>' 4092 ].join(''); 4093 4094 // Percentage 4095 var loadingOverlayPercentageTemplate = [ 4096 '<div class="loading-overlay loading-overlay-percentage">', 4097 '<div class="page-loader-progress-wrapper"><span class="page-loader-progress">0</span><span class="page-loader-progress-symbol">%</span></div>', 4098 '</div>' 4099 ].join(''); 4100 4101 // Cubes 4102 var loadingOverlayCubesTemplate = [ 4103 '<div class="loading-overlay">', 4104 '<div class="bounce-loader"><div class="cssload-thecube"><div class="cssload-cube cssload-c1"></div><div class="cssload-cube cssload-c2"></div><div class="cssload-cube cssload-c4"></div><div class="cssload-cube cssload-c3"></div></div></div>', 4105 '</div>' 4106 ].join(''); 4107 4108 // Cube Progress 4109 var loadingOverlayCubeProgressTemplate = [ 4110 '<div class="loading-overlay">', 4111 '<div class="bounce-loader"><span class="cssload-cube-progress"><span class="cssload-cube-progress-inner"></span></span></div>', 4112 '</div>' 4113 ].join(''); 4114 4115 // Float Rings 4116 var loadingOverlayFloatRingsTemplate = [ 4117 '<div class="loading-overlay">', 4118 '<div class="bounce-loader"><div class="cssload-float-rings-loader"><div class="cssload-float-rings-inner cssload-one"></div><div class="cssload-float-rings-inner cssload-two"></div><div class="cssload-float-rings-inner cssload-three"></div></div></div>', 4119 '</div>' 4120 ].join(''); 4121 4122 // Floating Bars 4123 var loadingOverlayFloatBarsTemplate = [ 4124 '<div class="loading-overlay">', 4125 '<div class="bounce-loader"><div class="cssload-float-bars-container"><ul class="cssload-float-bars-flex-container"><li><span class="cssload-float-bars-loading"></span></li></div></div></div>', 4126 '</div>' 4127 ].join(''); 4128 4129 // Speeding Wheel 4130 var loadingOverlaySpeedingWheelTemplate = [ 4131 '<div class="loading-overlay">', 4132 '<div class="bounce-loader"><div class="cssload-speeding-wheel-container"><div class="cssload-speeding-wheel"></div></div></div>', 4133 '</div>' 4134 ].join(''); 4135 4136 // Zenith 4137 var loadingOverlayZenithTemplate = [ 4138 '<div class="loading-overlay">', 4139 '<div class="bounce-loader"><div class="cssload-zenith-container"><div class="cssload-zenith"></div></div></div>', 4140 '</div>' 4141 ].join(''); 4142 4143 // Spinning Square 4144 var loadingOverlaySpinningSquareTemplate = [ 4145 '<div class="loading-overlay">', 4146 '<div class="bounce-loader"><div class="cssload-spinning-square-loading"></div></div>', 4147 '</div>' 4148 ].join(''); 4149 4150 // Pulse
4151 var loadingOverlayPulseTemplate = [ 4152 '<div class="loading-overlay">', 4153 '<div class="bounce-loader"><div class="wrapper-pulse"><div class="cssload-pulse-loader"></div></div></div>', 4154 '</div>' 4155 ].join(''); 4156 4157 var LoadingOverlay = function( $wrapper, options, noInheritOptions ) { 4158 return this.initialize( $wrapper, options, noInheritOptions ); 4159 }; 4160 4161 LoadingOverlay.prototype = { 4162 4163 options: { 4164 css: {}, 4165 hideDelay: 500, 4166 progressMinTimeout: 0, 4167 effect: 'default' 4168 }, 4169 4170 initialize: function( $wrapper, options, noInheritOptions ) { 4171 this.$wrapper = $wrapper; 4172 4173 this 4174 .setVars() 4175 .setOptions( options, noInheritOptions ) 4176 .build() 4177 .events() 4178 .dynamicShowHideEvents(); 4179 4180 this.$wrapper.data( 'loadingOverlay', this ); 4181 }, 4182 4183 setVars: function() { 4184 this.$overlay = this.$wrapper.find('.loading-overlay'); 4185 this.pageStatus = null; 4186 this.progress = null; 4187 this.animationInterval = 33; 4188 4189 return this; 4190 }, 4191 4192 setOptions: function( options, noInheritOptions ) { 4193 if ( !this.$overlay.get(0) ) { 4194 this.matchProperties(); 4195 } 4196 4197 if( noInheritOptions ) { 4198 this.options = $.extend( true, {}, this.options, options ); 4199 } else { 4200 this.options = $.extend( true, {}, this.options, options, theme.fn.getOptions(this.$wrapper.data('plugin-options')) ); 4201 } 4202 4203 this.loaderClass = this.getLoaderClass( this.options.css.backgroundColor ); 4204 4205 return this; 4206 }, 4207 4208 build: function() { 4209 var _self = this; 4210 4211 if ( !this.$overlay.closest(document.documentElement).get(0) ) { 4212 if ( !this.$cachedOverlay ) { 4213 4214 switch ( _self.options.effect ) { 4215 case 'percentageProgress1': 4216 this.$overlay = $( loadingOverlayPercentageTemplate ).clone(); 4217 break; 4218 4219 case 'percentageProgress2': 4220 this.$overlay = $( loadingOverlayPercentageTemplate ).clone(); 4221 this.$overlay 4222 .addClass('loading-overlay-percentage-effect-2') 4223 .prepend('<div class="loading-overlay-background-layer"></div>'); 4224 break; 4225 4226 case 'cubes': 4227 this.$overlay = $( loadingOverlayCubesTemplate ).clone(); 4228 break; 4229 4230 case 'cubeProgress': 4231 this.$overlay = $( loadingOverlayCubeProgressTemplate ).clone(); 4232 break; 4233 4234 case 'floatRings': 4235 this.$overlay = $( loadingOverlayFloatRingsTemplate ).clone(); 4236 break; 4237 4238 case 'floatBars': 4239 this.$overlay = $( loadingOverlayFloatBarsTemplate ).clone(); 4240 break; 4241 4242 case 'speedingWheel': 4243 this.$overlay = $( loadingOverlaySpeedingWheelTemplate ).clone(); 4244 break; 4245 4246 case 'zenith': 4247 this.$overlay = $( loadingOverlayZenithTemplate ).clone(); 4248 break; 4249 4250 case 'spinningSquare': 4251 this.$overlay = $( loadingOverlaySpinningSquareTemplate ).clone(); 4252 break; 4253 4254 case 'pulse': 4255 this.$overlay = $( loadingOverlayPulseTemplate ).clone(); 4256 break; 4257 4258 case 'default': 4259 default: 4260 this.$overlay = $( loadingOverlayDefaultTemplate ).clone(); 4261 break; 4262 } 4263 4264 if ( this.options.css ) { 4265 this.$overlay.css( this.options.css ); 4266 this.$overlay.find( '.loader' ).addClass( this.loaderClass ); 4267 } 4268 } else { 4269 this.$overlay = this.$cachedOverlay.clone(); 4270 } 4271 4272 this.$wrapper.prepend( this.$overlay ); 4273 } 4274 4275 if ( !this.$cachedOverlay ) { 4276 this.$cachedOverlay = this.$overlay.clone(); 4277 } 4278 4279 if( ['percentageProgress1', 'percentageProgress2'].includes(_self.options.effect) ) { 4280 _self.updateProgress(); 4281 4282 if( _self.options.isDynamicHideShow ) { 4283 setTimeout(function(){ 4284 _self.progress = 'complete'; 4285 4286 $('.page-loader-progress').text(100); 4287 4288 if( ['percentageProgress2'].includes(_self.options.effect) ) { 4289 $('.loading-overlay-background-layer').css({ 4290 width: '100%' 4291 }); 4292 } 4293 }, 2800); 4294 } 4295 } 4296 4297 return this; 4298 }, 4299 4300 events: function() { 4301 var _self = this; 4302 4303 if ( this.options.startShowing ) { 4304 _self.show(); 4305 } 4306 4307 if ( this.$wrapper.is('body') || this.options.hideOnWindowLoad ) { 4308 $( window ).on( 'load error', function() { 4309 setTimeout(function(){ 4310 _self.hide(); 4311 }, _self.options.progressMinTimeout); 4312 }); 4313 } 4314 4315 if ( this.options.listenOn ) { 4316 $( this.options.listenOn ) 4317 .on( 'loading-overlay:show beforeSend.ic', function( e ) { 4318 e.stopPropagation(); 4319 _self.show(); 4320 }) 4321 .on( 'loading-overlay:hide complete.ic', function( e ) { 4322 e.stopPropagation(); 4323 _self.hide(); 4324 });
4325 } 4326 4327 this.$wrapper 4328 .on( 'loading-overlay:show beforeSend.ic', function( e ) { 4329 if ( e.target === _self.$wrapper.get(0) ) { 4330 e.stopPropagation(); 4331 _self.show(); 4332 return true; 4333 } 4334 return false; 4335 }) 4336 .on( 'loading-overlay:hide complete.ic', function( e ) { 4337 if ( e.target === _self.$wrapper.get(0) ) { 4338 e.stopPropagation(); 4339 _self.hide(); 4340 return true; 4341 } 4342 return false; 4343 }); 4344 4345 if( ['percentageProgress1', 'percentageProgress2'].includes(_self.options.effect) ) { 4346 $(window).on('load', function(){ 4347 setTimeout(function(){ 4348 _self.pageStatus = "complete"; 4349 4350 $('.page-loader-progress').text(100); 4351 4352 if( ['percentageProgress2'].includes(_self.options.effect) ) { 4353 $('.loading-overlay-background-layer').css({ 4354 width: '100%' 4355 }); 4356 } 4357 }, _self.options.progressMinTimeout); 4358 }); 4359 } 4360 4361 return this; 4362 }, 4363 4364 show: function() { 4365 this.build(); 4366 4367 this.position = this.$wrapper.css( 'position' ).toLowerCase(); 4368 if ( this.position != 'relative' || this.position != 'absolute' || this.position != 'fixed' ) { 4369 this.$wrapper.css({ 4370 position: 'relative' 4371 }); 4372 } 4373 this.$wrapper.addClass( 'loading-overlay-showing' ); 4374 }, 4375 4376 hide: function() { 4377 var _self = this; 4378 4379 setTimeout(function() { 4380 _self.$wrapper.removeClass( 'loading-overlay-showing' ); 4381 4382 if ( this.position != 'relative' || this.position != 'absolute' || this.position != 'fixed' ) { 4383 _self.$wrapper.css({ position: '' }); 4384 } 4385 4386 $(window).trigger('loading.overlay.ready'); 4387 }, _self.options.hideDelay); 4388 }, 4389 4390 updateProgress: function() { 4391 var _self = this; 4392 4393 var render = function() { 4394 if(_self.pageStatus == "complete"){ 4395 $('.page-loader-progress').text(100); 4396 setTimeout(function(){ 4397 $('.page-loader-progress').addClass('d-none'); 4398 }, 700); 4399 } 4400 else{ 4401 if(_self.progress == null){ 4402 _self.progress = 1; 4403 } 4404 4405 _self.progress = _self.progress + 1; 4406 if(_self.progress >= 0 && _self.progress <= 30){ 4407 _self.animationInterval += 1; 4408 $('.page-loader-progress').text(_self.progress); 4409 } 4410 else if(_self.progress > 30 && _self.progress <= 60){ 4411 _self.animationInterval += 2; 4412 $('.page-loader-progress').text(_self.progress); 4413 } 4414 else if(_self.progress > 60 && _self.progress <= 80){ 4415 _self.animationInterval += 40; 4416 $('.page-loader-progress').text(_self.progress); 4417 } 4418 else if(_self.progress > 80 && _self.progress <= 90){ 4419 _self.animationInterval += 80; 4420 $('.page-loader-progress').text(_self.progress); 4421 } 4422 else if(_self.progress > 90 && _self.progress <= 95){ 4423 _self.animationInterval += 150; 4424 $('.page-loader-progress').text(_self.progress); 4425 } 4426 else if(_self.progress > 95 && _self.progress <= 99){ 4427 _self.animationInterval += 400; 4428 $('.page-loader-progress').text(_self.progress); 4429 } 4430 else if(_self.progress >= 100){ 4431 $('.page-loader-progress').text(99); 4432 } 4433 4434 if( ['percentageProgress2'].includes(_self.options.effect) ) { 4435 $('.loading-overlay-background-layer').css({ 4436 width: _self.progress + '%' 4437 }); 4438 } 4439 4440 self.loopInside = setTimeout(render, _self.animationInterval); 4441 } 4442 4443 } 4444 render(); 4445 4446 return this; 4447 }, 4448 4449 matchProperties: function() { 4450 var i, 4451 l, 4452 properties; 4453 4454 properties = [ 4455 'backgroundColor', 4456 'borderRadius' 4457 ]; 4458 4459 l = properties.length; 4460 4461 for( i = 0; i < l; i++ ) { 4462 var obj = {}; 4463 obj[ properties[ i ] ] = this.$wrapper.css( properties[ i ] ); 4464 4465 $.extend( this.options.css, obj ); 4466 } 4467 }, 4468 4469 getLoaderClass: function( backgroundColor ) { 4470 if ( !backgroundColor || backgroundColor === 'transparent' || backgroundColor === 'inherit' ) { 4471 return 'black'; 4472 } 4473 4474 var hexColor, 4475 r, 4476 g, 4477 b, 4478 yiq; 4479
4480 var colorToHex = function( color ){ 4481 var hex, 4482 rgb; 4483 4484 if( color.indexOf('#') >- 1 ){ 4485 hex = color.replace('#', ''); 4486 } else { 4487 rgb = color.match(/\d+/g); 4488 hex = ('0' + parseInt(rgb[0], 10).toString(16)).slice(-2) + ('0' + parseInt(rgb[1], 10).toString(16)).slice(-2) + ('0' + parseInt(rgb[2], 10).toString(16)).slice(-2); 4489 } 4490 4491 if ( hex.length === 3 ) { 4492 hex = hex + hex; 4493 } 4494 4495 return hex; 4496 }; 4497 4498 hexColor = colorToHex( backgroundColor ); 4499 4500 r = parseInt( hexColor.substr( 0, 2), 16 ); 4501 g = parseInt( hexColor.substr( 2, 2), 16 ); 4502 b = parseInt( hexColor.substr( 4, 2), 16 ); 4503 yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000; 4504 4505 return ( yiq >= 128 ) ? 'black' : 'white'; 4506 }, 4507 4508 dynamicShowHide: function( effect ) { 4509 var _self = this; 4510 4511 // Remove Loading Overlay Data 4512 $('body').removeData('loadingOverlay'); 4513 4514 // Remove Html Of Loading Overlay 4515 $('.loading-overlay').remove(); 4516 4517 if( effect == '' ) { 4518 return this; 4519 } 4520 4521 // Initialize New Loading Overlay (second parameter is to NO inherit data-plugin-options) 4522 $('body').loadingOverlay({ 4523 effect: effect ? effect : 'pulse', 4524 isDynamicHideShow: true 4525 }, true); 4526 4527 // Show Loading Overlay Loader 4528 $('body').data('loadingOverlay').show(); 4529 4530 // Hide Loading Overlay Loader 4531 setTimeout(function(){ 4532 $('body').data('loadingOverlay').hide(); 4533 }, 3000); 4534 4535 return this; 4536 }, 4537 4538 dynamicShowHideEvents: function() { 4539 var _self = this; 4540 4541 // Button 4542 $(document).off('click.loading-overlay-button').on('click.loading-overlay-button', '.loading-overlay-button', function(e){ 4543 e.preventDefault(); 4544 4545 _self.dynamicShowHide( $(this).data('effect') ); 4546 }); 4547 4548 // Select 4549 $(document).off('change.loading-overlay-select').on('change.loading-overlay-select', '.loading-overlay-select', function(){ 4550 _self.dynamicShowHide( $(this).val() ); 4551 }); 4552 4553 return this; 4554 } 4555 4556 }; 4557 4558 // expose to scope 4559 $.extend(theme, { 4560 LoadingOverlay: LoadingOverlay 4561 }); 4562 4563 // expose as a jquery plugin 4564 $.fn.loadingOverlay = function( opts, noInheritOptions ) { 4565 return this.each(function() { 4566 var $this = $( this ); 4567 4568 var loadingOverlay = $this.data( 'loadingOverlay' ); 4569 if ( loadingOverlay ) { 4570 return loadingOverlay; 4571 } else { 4572 var options = opts || $this.data( 'loading-overlay-options' ) || {}; 4573 return new LoadingOverlay( $this, options, noInheritOptions ); 4574 } 4575 }); 4576 } 4577 4578 // auto init 4579 $('[data-loading-overlay]').loadingOverlay(); 4580 4581}).apply(this, [window.theme, jQuery]); 4582 4583// Masonry 4584(function(theme, $) { 4585 4586 theme = theme || {}; 4587 4588 var instanceName = '__masonry'; 4589 4590 var PluginMasonry = function($el, opts) { 4591 return this.initialize($el, opts); 4592 }; 4593 4594 PluginMasonry.defaults = { 4595 4596 }; 4597 4598 PluginMasonry.prototype = { 4599 initialize: function($el, opts) { 4600 if ($el.data(instanceName)) { 4601 return this; 4602 } 4603 4604 this.$el = $el; 4605 4606 this 4607 .setData() 4608 .setOptions(opts) 4609 .build(); 4610 4611 return this; 4612 }, 4613 4614 setData: function() { 4615 this.$el.data(instanceName, this); 4616 4617 return this; 4618 }, 4619 4620 setOptions: function(opts) { 4621 this.options = $.extend(true, {}, PluginMasonry.defaults, opts, { 4622 wrapper: this.$el 4623 }); 4624 4625 return this; 4626 }, 4627 4628 build: function() { 4629 if (!($.isFunction($.fn.isotope))) { 4630 return this; 4631 } 4632 4633 var self = this, 4634 $window = $(window); 4635 4636 self.$loader = false; 4637 4638 if (self.options.wrapper.parents('.masonry-loader').get(0)) { 4639 self.$loader = self.options.wrapper.parents('.masonry-loader'); 4640 self.createLoader(); 4641 } 4642 4643 self.options.wrapper.one('layoutComplete', function(event, laidOutItems) { 4644 self.removeLoader(); 4645 }); 4646 4647 self.options.wrapper.waitForImages(function() { 4648 self.options.wrapper.isotope(self.options); 4649 }); 4650 4651 $(window).on('resize', function() { 4652 setTimeout(function() { 4653 self.options.wrapper.isotope('layout'); 4654 }, 300); 4655 }); 4656 4657 setTimeout(function() { 4658 self.removeLoader(); 4659 }, 3000); 4660 4661 return this; 4662 }, 4663 4664 createLoader: function() { 4665 var self = this; 4666 4667 var loaderTemplate = [ 4668 '<div class="bounce-loader">', 4669 '<div class="bounce1"></div>', 4670 '<div class="bounce2"></div>', 4671 '<div class="bounce3"></div>', 4672 '</div>' 4673 ].join(''); 4674 4675 self.$loader.append(loaderTemplate); 4676 4677 return this; 4678 }, 4679 4680 removeLoader: function() { 4681 4682 var self = this; 4683 4684 if (self.$loader) { 4685 4686 self.$loader.removeClass('masonry-loader-showing'); 4687 4688 setTimeout(function() { 4689 self.$loader.addClass('masonry-loader-loaded'); 4690 }, 300); 4691 4692 } 4693 4694 } 4695 }; 4696 4697 // expose to scope 4698 $.extend(theme, { 4699 PluginMasonry: PluginMasonry 4700 }); 4701 4702 // jquery plugin 4703 $.fn.themePluginMasonry = function(opts) { 4704 return this.map(function() { 4705 var $this = $(this); 4706 4707 if ($this.data(instanceName)) { 4708 return $this.data(instanceName); 4709 } else { 4710 return new PluginMasonry($this, opts); 4711 } 4712 4713 }); 4714 } 4715 4716}).apply(this, [window.theme, jQuery]); 4717 4718// Match Height 4719(function(theme, $) { 4720 4721 theme = theme || {}; 4722 4723 var instanceName = '__matchHeight'; 4724 4725 var PluginMatchHeight = function($el, opts) { 4726 return this.initialize($el, opts); 4727 }; 4728 4729 PluginMatchHeight.defaults = { 4730 byRow: true, 4731 property: 'height', 4732 target: null, 4733 remove: false 4734 }; 4735 4736 PluginMatchHeight.prototype = { 4737 initialize: function($el, opts) { 4738 if ($el.data(instanceName)) { 4739 return this; 4740 } 4741 4742 this.$el = $el; 4743 4744 this 4745 .setData() 4746 .setOptions(opts) 4747 .build(); 4748 4749 return this; 4750 }, 4751 4752 setData: function() { 4753 this.$el.data(instanceName, this); 4754 4755 return this; 4756 }, 4757 4758 setOptions: function(opts) { 4759 this.options = $.extend(true, {}, PluginMatchHeight.defaults, opts, { 4760 wrapper: this.$el 4761 }); 4762 4763 return this; 4764 }, 4765 4766 build: function() { 4767 if (!($.isFunction($.fn.matchHeight))) { 4768 return this; 4769 } 4770 4771 var self = this; 4772 4773 self.options.wrapper.matchHeight(self.options); 4774 4775 return this; 4776 } 4777 4778 }; 4779 4780 // expose to scope 4781 $.extend(theme, { 4782 PluginMatchHeight: PluginMatchHeight 4783 }); 4784 4785 // jquery plugin 4786 $.fn.themePluginMatchHeight = function(opts) { 4787 return this.map(function() { 4788 var $this = $(this); 4789 4790 if ($this.data(instanceName)) { 4791 return $this.data(instanceName); 4792 } else { 4793 return new PluginMatchHeight($this, opts); 4794 } 4795 4796 }); 4797 } 4798 4799}).apply(this, [window.theme, jQuery]); 4800 4801// Parallax 4802(function(theme, $) { 4803 4804 theme = theme || {}; 4805 4806 var instanceName = '__parallax'; 4807 4808 var PluginParallax = function($el, opts) { 4809 return this.initialize($el, opts); 4810 }; 4811 4812 PluginParallax.defaults = { 4813 speed: 1.5, 4814 horizontalPosition: '50%', 4815 offset: 0, 4816 parallaxDirection: 'top', 4817 parallaxHeight: '180%', 4818 parallaxScale: false, 4819 parallaxScaleInvert: false, 4820 scrollableParallax: false, 4821 scrollableParallaxMinWidth: 991, 4822 startOffset: 7, 4823 transitionDuration: '200ms', 4824 cssProperty: 'width', 4825 cssValueStart: 40, 4826 cssValueEnd: 100, 4827 cssValueUnit: 'vw', 4828 mouseParallax: false 4829 }; 4830 4831 PluginParallax.prototype = { 4832 initialize: function($el, opts) { 4833 if ($el.data(instanceName)) { 4834 return this; 4835 } 4836 4837 this.$el = $el; 4838 4839 this 4840 .setData() 4841 .setOptions(opts) 4842 .build(); 4843 4844 return this; 4845 }, 4846 4847 setData: function() { 4848 this.$el.data(instanceName, this); 4849 4850 return this; 4851 }, 4852 4853 setOptions: function(opts) { 4854 this.options = $.extend(true, {}, PluginParallax.defaults, opts, { 4855 wrapper: this.$el 4856 }); 4857 4858 return this; 4859 }, 4860 4861 build: function() { 4862 var self = this, 4863 $window = $(window), 4864 offset, 4865 yPos, 4866 bgpos, 4867 background, 4868 rotateY; 4869 4870 // Mouse Parallax 4871 if( self.options.mouseParallax ) { 4872 4873 $window.mousemove(function(e) { 4874 4875 $('.parallax-mouse-object', self.options.wrapper).each(function() { 4876 4877 var moving_value = $( this ).attr('data-value'); 4878 var x = (e.clientX * moving_value) / 250; 4879 var y = (e.clientY * moving_value) / 250; 4880 4881 $( this ).css('transform', 'translateX(' + x + 'px) translateY(' + y + 'px)'); 4882 }); 4883 4884 }); 4885 4886 return this; 4887 4888 } 4889 4890 // Scrollable 4891 if( self.options.scrollableParallax && $(window).width() > self.options.scrollableParallaxMinWidth ) { 4892 var $scrollableWrapper = self.options.wrapper.find('.scrollable-parallax-wrapper'); 4893 4894 if( $scrollableWrapper.get(0) ) { 4895 4896 var progress = ( $(window).scrollTop() > ( self.options.wrapper.offset().top + $(window).outerHeight() ) ) ? self.options.cssValueEnd : self.options.cssValueStart, 4897 cssValueUnit = self.options.cssValueUnit ? self.options.cssValueUnit : ''; 4898 4899 $scrollableWrapper.css({ 4900 'background-image' : 'url(' + self.options.wrapper.data('image-src') + ')', 4901 'background-size' : 'cover', 4902 'background-position' : 'center', 4903 'background-attachment' : 'fixed', 4904 'transition' : 'ease '+ self.options.cssProperty +' '+ self.options.transitionDuration, 4905 'width' : progress + '%' 4906 });
4907 4908 $(window).on('scroll', function(e){ 4909 if( self.options.wrapper.visible( true ) ) { 4910 var $window = $(window), 4911 scrollTop = $window.scrollTop(), 4912 elementOffset = self.options.wrapper.offset().top, 4913 currentElementOffset = (elementOffset - scrollTop); 4914 4915 var scrollPercent = Math.abs( +( currentElementOffset - $window.height() ) / (self.options.startOffset ? self.options.startOffset : 7) ); 4916 4917 // Increment progress value according scroll position 4918 if( scrollPercent <= self.options.cssValueEnd && progress <= self.options.cssValueEnd ) { 4919 progress = self.options.cssValueStart + scrollPercent; 4920 } 4921 4922 // Adjust CSS end value 4923 if( progress > self.options.cssValueEnd ) { 4924 progress = self.options.cssValueEnd; 4925 } 4926 4927 // Adjust CSS start value 4928 if( progress < self.options.cssValueStart ) { 4929 progress = self.options.cssValueStart; 4930 } 4931 4932 var styles = {} 4933 styles[self.options.cssProperty] = progress + cssValueUnit; 4934 4935 $scrollableWrapper.css(styles); 4936 } 4937 }); 4938 4939 } 4940 4941 return; 4942 } 4943 4944 // Create Parallax Element 4945 if( self.options.fadeIn ) { 4946 background = $('<div class="parallax-background fadeIn animated"></div>'); 4947 } else { 4948 background = $('<div class="parallax-background"></div>'); 4949 } 4950 4951 // Set Style for Parallax Element 4952 background.css({ 4953 'background-image' : 'url(' + self.options.wrapper.data('image-src') + ')', 4954 'background-size' : 'cover', 4955 'position' : 'absolute', 4956 'top' : 0, 4957 'left' : 0, 4958 'width' : '100%', 4959 'height' : self.options.parallaxHeight 4960 }); 4961 4962 if( self.options.parallaxScale ) { 4963 background.css({ 4964 'transition' : 'transform 500ms ease-out' 4965 }); 4966 } 4967 4968 // Add Parallax Element on DOM 4969 self.options.wrapper.prepend(background); 4970 4971 // Set Overlfow Hidden and Position Relative to Parallax Wrapper 4972 self.options.wrapper.css({ 4973 'position' : 'relative', 4974 'overflow' : 'hidden' 4975 }); 4976 4977 // Parallax Effect on Scroll & Resize 4978 var parallaxEffectOnScrolResize = function() { 4979 $window.on('scroll resize', function() { 4980 offset = self.options.wrapper.offset(); 4981 yPos = -($window.scrollTop() - (offset.top - 100)) / ((self.options.speed + 2 )); 4982 plxPos = (yPos < 0) ? Math.abs(yPos) : -Math.abs(yPos); 4983 rotateY = ( $('html[dir="rtl"]').get(0) ) ? ' rotateY(180deg)' : ''; // RTL 4984 4985 if( !self.options.parallaxScale ) { 4986 4987 if( self.options.parallaxDirection == 'bottom' ) { 4988 self.options.offset = 250; 4989 } 4990 4991 var y = ( (plxPos - 50) + (self.options.offset) ); 4992 if( self.options.parallaxDirection == 'bottom' ) { 4993 y = ( y < 0 ) ? Math.abs( y ) : -Math.abs( y ); 4994 } 4995 4996 background.css({ 4997 'transform' : 'translate3d(0, '+ y +'px, 0)' + rotateY, 4998 'background-position-x' : self.options.horizontalPosition 4999 }); 5000 5001 } else { 5002 5003 var scrollTop = $window.scrollTop(), 5004 elementOffset = self.options.wrapper.offset().top, 5005 currentElementOffset = (elementOffset - scrollTop), 5006 scrollPercent = Math.abs( +( currentElementOffset - $window.height() ) / (self.options.startOffset ? self.options.startOffset : 7) ); 5007 5008 scrollPercent = parseInt((scrollPercent >= 100) ? 100 : scrollPercent); 5009 5010 var currentScale = (scrollPercent / 100) * 50; 5011 5012 if ( !self.options.parallaxScaleInvert ) { 5013 background.css({ 5014 'transform' : 'scale(1.' + String(currentScale).padStart(2, '0') + ', 1.' + String(currentScale).padStart(2, '0') + ')' 5015 }); 5016 } else { 5017 background.css({ 5018 'transform' : 'scale(1.' + String(50 - currentScale).padStart(2, '0') + ', 1.' + String(50 - currentScale).padStart(2, '0') + ')' 5019 }); 5020 } 5021 5022 } 5023 }); 5024 5025 $window.trigger('scroll'); 5026 } 5027 5028 if (!$.browser.mobile) { 5029 parallaxEffectOnScrolResize(); 5030 } else { 5031 if( self.options.enableOnMobile == true ) { 5032 parallaxEffectOnScrolResize(); 5033 } else { 5034 self.options.wrapper.addClass('parallax-disabled'); 5035 } 5036 } 5037 5038 return this; 5039 } 5040 }; 5041 5042 // expose to scope 5043 $.extend(theme, { 5044 PluginParallax: PluginParallax 5045 }); 5046 5047 // jquery plugin 5048 $.fn.themePluginParallax = function(opts) { 5049 return this.map(function() { 5050 var $this = $(this); 5051 5052 if ($this.data(instanceName)) { 5053 return $this.data(instanceName); 5054 } else { 5055 return new PluginParallax($this, opts); 5056 } 5057 5058 }); 5059 } 5060 5061}).apply(this, [window.theme, jQuery]); 5062 5063// Progress Bar 5064(function(theme, $) { 5065 5066 theme = theme || {}; 5067 5068 var instanceName = '__progressBar'; 5069 5070 var PluginProgressBar = function($el, opts) { 5071 return this.initialize($el, opts); 5072 }; 5073 5074 PluginProgressBar.defaults = { 5075 accX: 0, 5076 accY: -50, 5077 delay: 1 5078 }; 5079 5080 PluginProgressBar.prototype = { 5081 initialize: function($el, opts) { 5082 if ($el.data(instanceName)) { 5083 return this; 5084 } 5085 5086 this.$el = $el; 5087 5088 this 5089 .setData() 5090 .setOptions(opts) 5091 .build(); 5092 5093 return this; 5094 }, 5095 5096 setData: function() { 5097 this.$el.data(instanceName, this); 5098 5099 return this; 5100 }, 5101 5102 setOptions: function(opts) { 5103 this.options = $.extend(true, {}, PluginProgressBar.defaults, opts, { 5104 wrapper: this.$el 5105 }); 5106 5107 return this; 5108 }, 5109 5110 build: function() { 5111 var self = this, 5112 $el = this.options.wrapper,
5113 delay = 1; 5114 5115 delay = ($el.attr('data-appear-animation-delay') ? $el.attr('data-appear-animation-delay') : self.options.delay); 5116 5117 $el.addClass($el.attr('data-appear-animation')); 5118 5119 setTimeout(function() { 5120 5121 $el.animate({ 5122 width: $el.attr('data-appear-progress-animation') 5123 }, 1500, 'easeOutQuad', function() { 5124 $el.find('.progress-bar-tooltip').animate({ 5125 opacity: 1 5126 }, 500, 'easeOutQuad'); 5127 }); 5128 5129 }, delay); 5130 5131 return this; 5132 } 5133 }; 5134 5135 // expose to scope 5136 $.extend(theme, { 5137 PluginProgressBar: PluginProgressBar 5138 }); 5139 5140 // jquery plugin 5141 $.fn.themePluginProgressBar = function(opts) { 5142 return this.map(function() { 5143 var $this = $(this); 5144 5145 if ($this.data(instanceName)) { 5146 return $this.data(instanceName); 5147 } else { 5148 return new PluginProgressBar($this, opts); 5149 } 5150 5151 }); 5152 } 5153 5154}).apply(this, [window.theme, jQuery]); 5155 5156// Random Images 5157(function(theme, $) { 5158 5159 theme = theme || {}; 5160 5161 var instanceName = '__randomimages'; 5162 5163 var PluginRandomImages = function($el, opts) { 5164 return this.initialize($el, opts); 5165 }; 5166 5167 PluginRandomImages.defaults = { 5168 minWindowWidth: 0, 5169 random: true, 5170 imagesListURL: null, 5171 lightboxImagesListURL: null, 5172 delay: null, 5173 animateIn: 'fadeIn', 5174 animateOut: 'fadeOut',
5175 stopAtImageIndex: false, // The value shoudl be the index value of array with images as string. Eg: '2' 5176 stopAfterFewSeconds: false, // The value should be in mili-seconds. Eg: 10000 = 10 seconds 5177 stopAfterXTimes: false, 5178 accY: 0 5179 }; 5180 5181 PluginRandomImages.prototype = { 5182 initialize: function($el, opts) { 5183 this.$el = $el; 5184 this.st = ''; 5185 this.times = 0; 5186 this.perImageIndex = 0; 5187 5188 if( $el.is('img') && typeof opts.imagesListURL == 'undefined' ) { 5189 return false; 5190 } 5191 5192 this 5193 .setData() 5194 .setOptions(opts) 5195 .build(); 5196 5197 return this; 5198 }, 5199 5200 setData: function() { 5201 this.$el.data(instanceName, this); 5202 5203 return this; 5204 }, 5205 5206 setOptions: function(opts) { 5207 this.options = $.extend(true, {}, PluginRandomImages.defaults, opts, { 5208 wrapper: this.$el 5209 }); 5210 5211 return this; 5212 }, 5213 5214 build: function() { 5215 var self = this; 5216 5217 // Control the screens size we want to have the plugin working 5218 if( $(window).width() < self.options.minWindowWidth ) { 5219 return false; 5220 } 5221 5222 // Check if is single image or wrapper with images inside 5223 if( self.$el.is('img') ) { 5224 5225 // Check it's inside a lightbox 5226 self.isInsideLightbox = self.$el.closest('.lightbox').length ? true : false; 5227 5228 // Push the initial image to lightbox list/array 5229 if( self.isInsideLightbox && self.options.lightboxImagesListURL ) { 5230 self.options.lightboxImagesListURL.push( self.$el.closest('.lightbox').attr('href') ); 5231 } 5232 5233 // Push the current image src to the array 5234 self.options.imagesListURL.push( self.$el.attr('src') ); 5235 5236 // Start with lastIndex as the first image loaded on the page 5237 self.lastIndex = self.options.imagesListURL.length - 1; 5238 5239 // Identify the last random image element (if has more than one on the page) 5240 if( self.options.random == false ) { 5241 $('.plugin-random-images').each(function(i){ 5242 if( i == $('.plugin-random-images').length - 1 ) { 5243 $(this).addClass('the-last'); 5244 } 5245 }); 5246 } 5247 5248 // Start the recursive timeout 5249 setTimeout(function(){ 5250 self.recursiveTimeout( 5251 self.perImageTag, 5252 self.options.delay == null ? 3000 : self.options.delay 5253 ); 5254 }, self.options.delay == null ? 300 : self.options.delay / 3); 5255 5256 } else { 5257 5258 // Start the recursive timeout 5259 setTimeout( self.recursiveTimeout( 5260 self.perWrapper, 5261 self.options.delay ? self.options.delay : getPerWrapperHighDelay(), 5262 false 5263 ), 300); 5264 5265 } 5266 5267 // Stop After Few Seconds 5268 if( self.options.stopAfterFewSeconds ) { 5269 setTimeout(function(){ 5270 clearTimeout(self.st); 5271 }, self.options.stopAfterFewSeconds); 5272 } 5273 5274 return this; 5275 5276 }, 5277 5278 perImageTag: function() { 5279 var self = this; 5280 5281 // Generate a random index to make the images rotate randomly 5282 var index = self.options.random ? Math.floor(Math.random() * self.options.imagesListURL.length) : self.lastIndex; 5283 5284 // Avoid repeat the same image 5285 if( self.lastIndex !== '' && self.lastIndex == index ) { 5286 if( self.options.random ) { 5287 while( index == self.lastIndex ) { 5288 index = Math.floor(Math.random() * self.options.imagesListURL.length); 5289 } 5290 } else { 5291 index = index - 1; 5292 if( index == -1 ) { 5293 index = self.options.imagesListURL.length - 1; 5294 } 5295 } 5296 } 5297 5298 // Turn the image ready for animations 5299 self.$el.addClass('animated'); 5300 5301 // Remove the entrance animation class and add the out animation class 5302 self.$el.removeClass( self.options.animateIn ).addClass( self.options.animateOut ); 5303 5304 // Change the image src and add the class for entrance animation 5305 setTimeout( function(){ 5306 self.$el.attr('src', self.options.imagesListURL[index]).removeClass( self.options.animateOut ).addClass(self.options.animateIn); 5307 5308 if( self.isInsideLightbox && self.options.lightboxImagesListURL ) { 5309 self.$el.closest('.lightbox').attr('href', self.options.lightboxImagesListURL[index]); 5310 } 5311 }, 1000); 5312 5313 // Save the last index for future checks 5314 self.lastIndex = index; 5315 5316 // Increment the times var 5317 self.times++; 5318 5319 // Save the index for stopAtImageIndex option 5320 self.perImageIndex = index; 5321 5322 return this; 5323 }, 5324 5325 // Iterate the imaes loop and get the higher value 5326 getPerWrapperHighDelay: function() { 5327 var self = this, 5328 $wrapper = self.$el,
5329 delay = 0; 5330 5331 $wrapper.find('img').each(function(){ 5332 var $image = $(this); 5333 5334 if( $image.data('rimage-delay') && parseInt( $image.data('rimage-delay') ) > delay ) { 5335 delay = parseInt( $image.data('rimage-delay') ); 5336 } 5337 }); 5338 5339 return delay; 5340 }, 5341 5342 perWrapper: function() { 5343 var self = this, 5344 $wrapper = self.$el; 5345 5346 // Turns the imageLlistURL into an array 5347 self.options.imagesListURL = []; 5348 5349 // Find all images inside the element wrapper and push their sources to image list array 5350 $wrapper.find('img').each(function(){ 5351 var $image = $(this); 5352 self.options.imagesListURL.push( $image.attr('src') ); 5353 }); 5354 5355 // Shuffle the images list array (random effect) 5356 self.options.imagesListURL = self.shuffle( self.options.imagesListURL ); 5357 5358 // Iterate over each image and make some checks like delay for each image, animations, etc... 5359 $wrapper.find('img').each(function(index){ 5360 var $image = $(this), 5361 animateIn = $image.data('rimage-animate-in') ? $image.data('rimage-animate-in') : self.options.animateIn, 5362 animateOut = $image.data('rimage-animate-out') ? $image.data('rimage-animate-out') : self.options.animateOut, 5363 delay = $image.data('rimage-delay') ? $image.data('rimage-delay') : 2000; 5364 5365 $image.addClass('animated'); 5366 5367 setTimeout( function(){ 5368 $image.removeClass( animateIn ).addClass( animateOut ); 5369 }, delay / 2); 5370 5371 setTimeout( function(){ 5372 $image.attr('src', self.options.imagesListURL[index]).removeClass( animateOut ).addClass(animateIn); 5373 }, delay); 5374 5375 }); 5376 5377 // Increment the times variable 5378 self.times++; 5379 5380 return this; 5381 }, 5382 5383 recursiveTimeout: function(callback, delay) { 5384 var self = this; 5385 5386 var timeout = function() { 5387 5388 if( callback !== null ) { 5389 callback.call(self); 5390 } 5391 5392 // Recursive 5393 self.st = setTimeout(timeout, delay == null ? 1000 : delay); 5394 5395 if( self.options.random == false ) { 5396 if( self.$el.hasClass('the-last') ) { 5397 $('.plugin-random-images').trigger('rimages.start'); 5398 } else { 5399 clearTimeout(self.st); 5400 } 5401 } 5402 5403 // Stop At Image Index 5404 if( self.options.stopAtImageIndex && parseInt(self.options.stopAtImageIndex) == self.perImageIndex ) { 5405 clearTimeout(self.st); 5406 } 5407 5408 // Stop After X Timers 5409 if( self.options.stopAfterXTimes == self.times ) { 5410 clearTimeout(self.st); 5411 } 5412 } 5413 timeout(); 5414 5415 self.$el.on('rimages.start', function(){ 5416 clearTimeout(self.st); 5417 self.st = setTimeout(timeout, delay == null ? 1000 : delay); 5418 }); 5419 5420 }, 5421 5422 shuffle: function( array ) { 5423 for (var i = array.length - 1; i > 0; i--) { 5424 var j = Math.floor(Math.random() * (i + 1)); 5425 var temp = array[i]; 5426 array[i] = array[j]; 5427 array[j] = temp; 5428 } 5429 5430 return array; 5431 } 5432 5433 }; 5434 5435 // expose to scope 5436 $.extend(theme, { 5437 PluginRandomImages: PluginRandomImages 5438 }); 5439 5440 // jquery plugin 5441 $.fn.themePluginRandomImages = function(opts) { 5442 return this.map(function() { 5443 var $this = $(this); 5444 5445 if ($this.data(instanceName)) { 5446 return $this.data(instanceName); 5447 } else { 5448 return new PluginRandomImages($this, opts); 5449 } 5450 5451 }); 5452 } 5453 5454}).apply(this, [window.theme, jQuery]); 5455 5456// Read More 5457(function(theme, $) { 5458 5459 theme = theme || {}; 5460 5461 var instanceName = '__readmore'; 5462 5463 var PluginReadMore = function($el, opts) { 5464 return this.initialize($el, opts); 5465 }; 5466 5467 PluginReadMore.defaults = { 5468 buttonOpenLabel: 'Read More <i class="fas fa-chevron-down text-2 ms-1"></i>', 5469 buttonCloseLabel: 'Read Less <i class="fas fa-chevron-up text-2 ms-1"></i>', 5470 enableToggle: true, 5471 maxHeight: 110, 5472 overlayColor: '#FFF', 5473 overlayHeight: 100, 5474 startOpened: false, 5475 align: 'left' 5476 }; 5477 5478 PluginReadMore.prototype = { 5479 initialize: function($el, opts) { 5480 var self = this; 5481 5482 this.$el = $el; 5483 5484 this 5485 .setData() 5486 .setOptions(opts) 5487 .build() 5488 .events(); 5489 5490 if( self.options.startOpened ) { 5491 self.options.wrapper.find('.readmore-button-wrapper > a').trigger('click'); 5492 } 5493 5494 return this; 5495 }, 5496 5497 setData: function() { 5498 this.$el.data(instanceName, this); 5499 5500 return this; 5501 }, 5502 5503 setOptions: function(opts) { 5504 this.options = $.extend(true, {}, PluginReadMore.defaults, opts, { 5505 wrapper: this.$el 5506 }); 5507 5508 return this; 5509 }, 5510 5511 build: function() { 5512 var self = this; 5513 5514 self.options.wrapper.addClass('position-relative'); 5515 5516 // Overlay 5517 self.options.wrapper.append( '<div class="readmore-overlay"></div>' ); 5518 5519 // Check if is Safari 5520 var backgroundCssValue = 'linear-gradient(180deg, rgba(2, 0, 36, 0) 0%, '+ self.options.overlayColor +' 100%)'; 5521 if( $('html').hasClass('safari') ) { 5522 backgroundCssValue = '-webkit-linear-gradient(top, rgba(2, 0, 36, 0) 0%, '+ self.options.overlayColor +' 100%)' 5523 } 5524 5525 self.options.wrapper.find('.readmore-overlay').css({ 5526 background: backgroundCssValue, 5527 position: 'absolute', 5528 bottom: 0, 5529 left: 0, 5530 width: '100%', 5531 height: self.options.overlayHeight, 5532 'z-index': 1 5533 }); 5534 5535 // Read More Button 5536 self.options.wrapper.find('.readmore-button-wrapper').removeClass('d-none').css({ 5537 position: 'absolute', 5538 bottom: 0, 5539 left: 0, 5540 width: '100%', 5541 'z-index': 2 5542 }); 5543 5544 // Button Label 5545 self.options.wrapper.find('.readmore-button-wrapper > a').html( self.options.buttonOpenLabel ); 5546 5547 self.options.wrapper.css({ 5548 'height': self.options.maxHeight, 5549 'overflow-y': 'hidden' 5550 }); 5551 5552 // Alignment 5553 switch ( self.options.align ) { 5554 case 'center': 5555 self.options.wrapper.find('.readmore-button-wrapper').addClass('text-center'); 5556 break; 5557 5558 case 'right': 5559 self.options.wrapper.find('.readmore-button-wrapper').addClass('text-end'); 5560 break; 5561 5562 case 'left': 5563 default: 5564 self.options.wrapper.find('.readmore-button-wrapper').addClass('text-start'); 5565 break; 5566 } 5567 5568 return this; 5569 5570 }, 5571 5572 events: function() { 5573 var self = this; 5574 5575 // Read More 5576 self.readMore = function() { 5577 self.options.wrapper.find('.readmore-button-wrapper > a:not(.readless)').on('click', function(e){
5578 e.preventDefault(); 5579 5580 var $this = $(this); 5581 5582 setTimeout(function(){ 5583 self.options.wrapper.animate({ 5584 'height': self.options.wrapper[0].scrollHeight 5585 }, function(){ 5586 if( !self.options.enableToggle ) { 5587 $this.fadeOut(); 5588 } 5589 5590 $this.html( self.options.buttonCloseLabel ).addClass('readless').off('click'); 5591 5592 self.readLess(); 5593 5594 self.options.wrapper.find('.readmore-overlay').fadeOut(); 5595 self.options.wrapper.css({ 5596 'max-height': 'none', 5597 'overflow': 'visible' 5598 }); 5599 5600 self.options.wrapper.find('.readmore-button-wrapper').animate({ 5601 bottom: -20 5602 }); 5603 }); 5604 }, 200); 5605 }); 5606 } 5607 5608 // Read Less 5609 self.readLess = function() { 5610 self.options.wrapper.find('.readmore-button-wrapper > a.readless').on('click', function(e){ 5611 e.preventDefault(); 5612 5613 var $this = $(this); 5614 5615 // Button 5616 self.options.wrapper.find('.readmore-button-wrapper').animate({ 5617 bottom: 0 5618 }); 5619 5620 // Overlay 5621 self.options.wrapper.find('.readmore-overlay').fadeIn(); 5622 5623 setTimeout(function(){ 5624 self.options.wrapper.height(self.options.wrapper[0].scrollHeight).animate({ 5625 'height': self.options.maxHeight 5626 }, function(){ 5627 $this.html( self.options.buttonOpenLabel ).removeClass('readless').off('click'); 5628 5629 self.readMore(); 5630 5631 self.options.wrapper.css({ 5632 'overflow': 'hidden' 5633 }); 5634 }); 5635 }, 200); 5636 }); 5637 } 5638 5639 // First Load 5640 self.readMore(); 5641 5642 return this; 5643 } 5644 }; 5645 5646 // expose to scope 5647 $.extend(theme, { 5648 PluginReadMore: PluginReadMore 5649 }); 5650 5651 // jquery plugin 5652 $.fn.themePluginReadMore = function(opts) { 5653 return this.map(function() { 5654 var $this = $(this); 5655 5656 if ($this.data(instanceName)) { 5657 return $this.data(instanceName); 5658 } else { 5659 return new PluginReadMore($this, opts); 5660 } 5661 5662 }); 5663 } 5664 5665}).apply(this, [window.theme, jQuery]); 5666 5667// Revolution Slider 5668(function(theme, $) { 5669 5670 theme = theme || {}; 5671 5672 var instanceName = '__revolution'; 5673 5674 var PluginRevolutionSlider = function($el, opts) { 5675 return this.initialize($el, opts); 5676 }; 5677 5678 PluginRevolutionSlider.defaults = { 5679 sliderType: 'standard', 5680 sliderLayout: 'fullwidth', 5681 delay: 9000, 5682 gridwidth: 1170, 5683 gridheight: 500, 5684 spinner: 'spinner3', 5685 disableProgressBar: 'on', 5686 parallax: { 5687 type: 'off', 5688 bgparallax: 'off' 5689 }, 5690 navigation: { 5691 keyboardNavigation: 'off', 5692 keyboard_direction: 'horizontal', 5693 mouseScrollNavigation: 'off', 5694 onHoverStop: 'off', 5695 touch: { 5696 touchenabled: 'on', 5697 swipe_threshold: 75, 5698 swipe_min_touches: 1, 5699 swipe_direction: 'horizontal', 5700 drag_block_vertical: false 5701 }, 5702 arrows: { 5703 enable: true, 5704 hide_onmobile: false, 5705 hide_under: 0, 5706 hide_onleave: true, 5707 hide_delay: 200, 5708 hide_delay_mobile: 1200, 5709 left: { 5710 h_align: 'left', 5711 v_align: 'center', 5712 h_offset: 30, 5713 v_offset: 0 5714 }, 5715 right: { 5716 h_align: 'right', 5717 v_align: 'center', 5718 h_offset: 30, 5719 v_offset: 0 5720 } 5721 } 5722 }, 5723 5724 /* ADDONS */ 5725 addOnTypewriter: { 5726 enable: false 5727 }, 5728 addOnWhiteboard: { 5729 enable: false, 5730 5731 }, 5732 whiteboard: { 5733 movehand: { 5734 src: '../vendor/rs-plugin/revolution-addons/whiteboard/assets/images/hand_point_right.png', 5735 width: 400, 5736 height: 1000, 5737 handtype: 'right', 5738 transform: { 5739 transformX: 50, 5740 transformY: 50 5741 }, 5742 jittering: { 5743 distance: '80', 5744 distance_horizontal: '100', 5745 repeat: '5', 5746 offset: '10', 5747 offset_horizontal: '0' 5748 }, 5749 rotation: { 5750 angle: '10', 5751 repeat: '3' 5752 } 5753 }, 5754 writehand: { 5755 src: '../vendor/rs-plugin/revolution-addons/whiteboard/assets/images/write_right_angle.png', 5756 width: 572, 5757 height: 691, 5758 handtype: 'right', 5759 transform: { 5760 transformX: 50, 5761 transformY: 50 5762 }, 5763 jittering: { 5764 distance: '80', 5765 distance_horizontal: '100', 5766 repeat: '5', 5767 offset: '10', 5768 offset_horizontal: '0' 5769 }, 5770 rotation:{ 5771 angle: '10', 5772 repeat: '3' 5773 } 5774 } 5775 }, 5776 addOnParticles: { 5777 enable: false 5778 }, 5779 particles: { 5780 startSlide: "first", 5781 endSlide: "last", 5782 zIndex: "1", 5783 particles: { 5784 number: {value: 80}, color: {value: "#ffffff"}, 5785 shape: { 5786 type: "circle", stroke: {width: 0, color: "#ffffff", opacity: 1}, 5787 image: {src: ""} 5788 }, 5789 opacity: {value: 0.5, random: true, min: 0.25, anim: {enable: false, speed: 3, opacity_min: 0, sync: false}}, 5790 size: {value: 2, random: false, min: 30, anim: {enable: false, speed: 40, size_min: 1, sync: false}}, 5791 line_linked: {enable: true, distance: 150, color: "#ffffff", opacity: 0.4, width: 1},
5792 move: {enable: true, speed: 6, direction: "none", random: true, min_speed: 6, straight: false, out_mode: "out"} 5793 }, 5794 interactivity: { 5795 events: {onhover: {enable: false, mode: "repulse"}, onclick: {enable: false, mode: "repulse"}}, 5796 modes: {grab: {distance: 400, line_linked: {opacity: 0.5}}, bubble: {distance: 400, size: 40, opacity: 0.4}, repulse: {distance: 200}} 5797 } 5798 }, 5799 addOnCountdown: { 5800 enable: false, 5801 targetdate: new Date().getTime() + 864000000, // http://www.freeformatter.com/epoch-timestamp-to-date-converter.html 5802 slidechanges: [{days: 0, hours: 0, minutes: 0, seconds: 0, slide: 2}] 5803 }, 5804 addOnSlicey: { 5805 enable: false 5806 }, 5807 addOnFilmstrip: { 5808 enable: false 5809 }, 5810 addOnBeforeAfter : { 5811 enable: false, 5812 options: { 5813 cursor: "move", 5814 carousel: false, 5815 arrowStyles: { 5816 leftIcon: "fa-icon-caret-left", 5817 rightIcon: "fa-icon-caret-right", 5818 topIcon: "fa-icon-caret-up", 5819 bottomIcon: "fa-icon-caret-down", 5820 size: "35", 5821 color: "#ffffff", 5822 spacing: "10", 5823 bgColor: "transparent", 5824 padding: "0", 5825 borderRadius: "0" 5826 }, 5827 dividerStyles: { 5828 width: "1", 5829 color: "rgba(255, 255, 255, 0.5)" 5830 } 5831 } 5832 }, 5833 addOnPanorama: { 5834 enable: false 5835 }, 5836 addOnRevealer: { 5837 enable: false, 5838 }, 5839 revealer: { 5840 direction: "open_horizontal", 5841 color: "#ffffff", 5842 duration: "1500", 5843 delay: "0", 5844 easing: "Power2.easeInOut", 5845 overlay_enabled: true, 5846 overlay_color: "#000000", 5847 overlay_duration: "1500", 5848 overlay_delay: "0", 5849 overlay_easing: "Power2.easeInOut", 5850 spinner: "1", 5851 spinnerColor: "#006dd2", 5852 spinnerHtml: "<div class='rsaddon-revealer-spinner rsaddon-revealer-spinner-1'><div class='rsaddon-revealer-1'><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><\/div><\/div \/>" 5853 }, 5854 addOnDuotone: { 5855 enable: false 5856 }, 5857 addOnBubblemorph: { 5858 enable: false 5859 }, 5860 addOnDistortion: { 5861 enable: false 5862 } 5863 5864 }; 5865 5866 PluginRevolutionSlider.prototype = { 5867 initialize: function($el, opts) { 5868 if ($el.data(instanceName)) { 5869 return this; 5870 } 5871 5872 this.$el = $el; 5873 5874 this 5875 .setData() 5876 .setOptions(opts) 5877 .build() 5878 .events(); 5879 5880 return this; 5881 }, 5882 5883 setData: function() { 5884 this.$el.data(instanceName, this); 5885 5886 return this; 5887 }, 5888 5889 setOptions: function(opts) { 5890 this.options = $.extend(true, {}, PluginRevolutionSlider.defaults, opts, { 5891 wrapper: this.$el 5892 }); 5893 5894 return this; 5895 }, 5896 5897 build: function() { 5898 if (!($.isFunction($.fn.revolution))) { 5899 return this; 5900 } 5901 5902 // Single Slider Class 5903 if(this.options.wrapper.find('> ul > li').length == 1) { 5904 this.options.wrapper.addClass('slider-single-slide'); 5905 5906 // Remove Bullets 5907 // this.options.navigation.bullets.enable = false; 5908 $.extend(this.options.navigation, { 5909 bullets: { 5910 enable: false 5911 } 5912 }); 5913 5914 } 5915 5916 // Full Screen Class 5917 if(this.options.sliderLayout == 'fullscreen') { 5918 this.options.wrapper.closest('.slider-container').addClass('fullscreen-slider'); 5919 } 5920 5921 // Initialize Revolution Slider 5922 this.options.wrapper.revolution(this.options); 5923 5924 // Addon Init - Typewriter 5925 if(this.options.addOnTypewriter.enable) { 5926 RsTypewriterAddOn($, this.options.wrapper); 5927 } 5928 5929 // Addon Init - Whiteboard 5930 if(this.options.addOnWhiteboard.enable) { 5931 this.options.wrapper.rsWhiteBoard(); 5932 } 5933 5934 // Addon Init - Particles 5935 if(this.options.addOnParticles.enable) { 5936 RsParticlesAddOn(this.options.wrapper); 5937 } 5938 5939 // Addon Init - Countdown 5940 if(this.options.addOnCountdown.enable) { 5941 tp_countdown(this.options.wrapper, this.options.addOnCountdown.targetdate, this.options.addOnCountdown.slidechanges); 5942 } 5943 5944 // Addon Init - Slicey 5945 if(this.options.addOnSlicey.enable) { 5946 this.options.wrapper.revSliderSlicey(); 5947 } 5948 5949 // Addon Init - Filmstrip 5950 if(this.options.addOnFilmstrip.enable) { 5951 RsFilmstripAddOn($, this.options.wrapper, '../vendor/rs-plugin/revolution-addons/filmstrip/', false); 5952 } 5953 5954 // Addon Init - Before After
5955 if(this.options.addOnBeforeAfter.enable) { 5956 RevSliderBeforeAfter($, this.options.wrapper, this.options.addOnBeforeAfter.options); 5957 } 5958 5959 // Addon Init - Panorama 5960 if(this.options.addOnPanorama.enable) { 5961 RsAddonPanorama($, this.options.wrapper); 5962 } 5963 5964 // Addon Init - Revealer 5965 if(this.options.addOnRevealer.enable) { 5966 RsRevealerAddOn($, this.options.wrapper, this.options.revealer.spinnerHtml); 5967 } 5968 5969 // Addon Init - Duotone 5970 if(this.options.addOnDuotone.enable) { 5971 RsAddonDuotone($, this.options.wrapper, true, "cubic-bezier(0.645, 0.045, 0.355, 1.000)", "1000"); 5972 } 5973 5974 // Addon Init - Bubblemorph 5975 if(this.options.addOnBubblemorph.enable) { 5976 BubbleMorphAddOn($, this.options.wrapper, false); 5977 } 5978 5979 // Addon Init - Distortion 5980 if(this.options.addOnDistortion.enable) { 5981 RsLiquideffectAddOn($, this.options.wrapper); 5982 } 5983 5984 return this; 5985 }, 5986 5987 events: function() { 5988 5989 return this; 5990 } 5991 }; 5992 5993 // expose to scope 5994 $.extend(theme, { 5995 PluginRevolutionSlider: PluginRevolutionSlider 5996 }); 5997 5998 // jquery plugin 5999 $.fn.themePluginRevolutionSlider = function(opts) { 6000 return this.map(function() { 6001 var $this = $(this); 6002 6003 if ($this.data(instanceName)) { 6004 return $this.data(instanceName); 6005 } else { 6006 return new PluginRevolutionSlider($this, opts); 6007 } 6008 6009 }); 6010 } 6011 6012}).apply(this, [window.theme, jQuery]); 6013 6014// Scroll Spy 6015(function(theme, $) { 6016 6017 theme = theme || {}; 6018 6019 var instanceName = '__scrollSpy'; 6020 6021 var PluginScrollSpy = function($el, opts) { 6022 return this.initialize($el, opts); 6023 }; 6024 6025 PluginScrollSpy.defaults = { 6026 target: '#header' 6027 }; 6028 6029 PluginScrollSpy.prototype = { 6030 initialize: function($el, opts) { 6031 6032 if( document.querySelector( opts.target ) == null ) { 6033 return false; 6034 } 6035 6036 this.$el = $el; 6037 6038 this 6039 .setData() 6040 .setOptions(opts); 6041 6042 this.build(); 6043 6044 return this; 6045 }, 6046 6047 setData: function() { 6048 this.$el.data(instanceName, this); 6049 6050 return this; 6051 }, 6052 6053 setOptions: function(opts) { 6054 this.options = $.extend(true, {}, PluginScrollSpy.defaults, opts, { 6055 wrapper: this.$el 6056 }); 6057 6058 return this; 6059 }, 6060 6061 build: function() { 6062 var self = this, 6063 target = document.querySelector( self.options.target ) != null ? document.querySelector( self.options.target ) : false, 6064 navItems = target == '#header' || target == '.wrapper-spy' ? target.querySelectorAll('.header-nav .nav > li a') : target.querySelectorAll('.nav > li a'); 6065 6066 // Get all section ID's 6067 var sectionIDs = Object.keys(navItems).map(function(key, index) { 6068 return navItems[key].hash; 6069 }); 6070 6071 // Remove empty values from sectionIDs array 6072 sectionIDs = sectionIDs.filter(function(value){ 6073 return value != ''; 6074 }); 6075 6076 // Store in a global variable 6077 self.sectionIDs = sectionIDs; 6078 6079 for( var i = 0; i < sectionIDs.length; i++ ) { 6080 6081 // Default Root Margin 6082 var rootMargin = '-20% 0px -79.9% 0px'; 6083 6084 // Spy Offset 6085 if( $( sectionIDs[i] ).data('spy-offset') ) { 6086 var rootMarginOffset = $( sectionIDs[i] ).data('spy-offset'), 6087 isNegativeOffset = parseInt( rootMarginOffset ) < 0 ? true : false; 6088 6089 // Mount a new rootMargin based on offset value 6090 rootMargin = rootMargin.split(' ').map(function(element, index){ 6091 if( element.indexOf('%') > 0 ) { 6092 var valueToInt = parseInt( element.replace('%','') ), 6093 newValue = 0; 6094 6095 switch ( index ) { 6096 case 0: 6097 if( isNegativeOffset ) { 6098 newValue = valueToInt - rootMarginOffset; 6099 } else { 6100 newValue = Math.abs(valueToInt) + rootMarginOffset; 6101 } 6102 break; 6103 6104 case 2: 6105 if( isNegativeOffset ) { 6106 newValue = valueToInt + rootMarginOffset; 6107 } else { 6108 newValue = Math.abs(valueToInt) - rootMarginOffset; 6109 } 6110 break; 6111 6112 } 6113 6114 if( isNegativeOffset ) { 6115 newValue = newValue + '%'; 6116 } else { 6117 newValue = '-' + newValue + '%'; 6118 } 6119 6120 return newValue; 6121 } else { 6122 return element; 6123 } 6124 }).join(' '); 6125 } 6126 6127 var selector = sectionIDs[i], 6128 callback = function() { 6129 var $section = $(this); 6130 6131 if( target == '#header' || target == '.wrapper-spy' ) { 6132 $('#header .header-nav .nav > li a').removeClass('active'); 6133 $('#header .header-nav .nav > li a[href="#'+ $section[0].id +'"]').addClass('active'); 6134 } else { 6135 $( target ).find('.nav > li a').removeClass('active'); 6136 $( target ).find('.nav > li a[href="#'+ $section[0].id +'"]').addClass('active'); 6137 } 6138 6139 } 6140 6141 this.scrollSpyIntObs( selector, callback, { 6142 rootMargin: rootMargin, 6143 threshold: 0 6144 }, true, i, true); 6145 6146 } 6147 6148 return this; 6149 6150 }, 6151 6152 scrollSpyIntObs: function(selector, functionName, intObsOptions, al
6152waysObserve, index, firstLoad) { 6153 var self = this; 6154 6155 var $el = document.querySelectorAll( selector ); 6156 var intersectionObserverOptions = { 6157 rootMargin: '0px 0px 200px 0px' 6158 } 6159 6160 if( Object.keys(intObsOptions).length ) { 6161 intersectionObserverOptions = $.extend(intersectionObserverOptions, intObsOptions); 6162 } 6163 6164 var observer = new IntersectionObserver(function(entries) { 6165 6166 for(var i=0; i < entries.length; i++) { 6167 var entry = entries[i]; 6168 6169 if (entry.intersectionRatio > 0 ) { 6170 if( typeof functionName === 'string' ) { 6171 var func = Function( 'return ' + functionName )(); 6172 } else { 6173 var callback = functionName; 6174 6175 callback.call( $(entry.target) ); 6176 } 6177 6178 // Unobserve 6179 if( !alwaysObserve ) { 6180 observer.unobserve(entry.target); 6181 } 6182 6183 } else { 6184 if( firstLoad == false ) { 6185 if( index == self.sectionIDs.length - 1 ) { 6186 $('#header .header-nav .nav > li a').removeClass('active'); 6187 $('#header .header-nav .nav > li a[href="#'+ entry.target.id +'"]').parent().prev().find('a').addClass('active'); 6188 } 6189 } 6190 firstLoad = false; 6191 6192 } 6193 } 6194 }, intersectionObserverOptions); 6195 6196 $( $el ).each(function(){ 6197 observer.observe( $(this)[0] ); 6198 }); 6199 6200 return this; 6201 } 6202 }; 6203 6204 // expose to scope 6205 $.extend(theme, { 6206 PluginScrollSpy: PluginScrollSpy 6207 }); 6208 6209 // jquery plugin 6210 $.fn.themePluginScrollSpy = function(opts) { 6211 return this.map(function() { 6212 var $this = $(this); 6213 6214 if ($this.data(instanceName)) { 6215 return $this.data(instanceName); 6216 } else { 6217 return new PluginScrollSpy($this, opts); 6218 } 6219 6220 }); 6221 } 6222 6223}).apply(this, [window.theme, jQuery]); 6224 6225// Scroll to Top 6226(function(theme, $) { 6227 6228 theme = theme || {}; 6229 6230 $.extend(theme, { 6231 6232 PluginScrollToTop: { 6233 6234 defaults: { 6235 wrapper: $('body'), 6236 offset: 150, 6237 buttonClass: 'scroll-to-top', 6238 buttonAriaLabel: 'Scroll To Top', 6239 iconClass: 'fas fa-chevron-up', 6240 delay: 1000, 6241 visibleMobile: false, 6242 label: false, 6243 easing: 'easeOutBack' 6244 }, 6245 6246 initialize: function(opts) { 6247 initialized = true; 6248 6249 // Don't initialize if the page has Section Scroll 6250 if( $('body[data-plugin-section-scroll]').get(0) ) { 6251 return; 6252 } 6253 6254 this 6255 .setOptions(opts) 6256 .build() 6257 .events(); 6258 6259 return this; 6260 }, 6261 6262 setOptions: function(opts) { 6263 this.options = $.extend(true, {}, this.defaults, opts); 6264 6265 return this; 6266 }, 6267 6268 build: function() { 6269 var self = this, 6270 $el; 6271 6272 // Base HTML Markup 6273 $el = $('<a />') 6274 .addClass(self.options.buttonClass) 6275 .attr({ 6276 'href': '#', 6277 'aria-label': self.options.buttonAriaLabel 6278 }) 6279 .append( 6280 $('<i />') 6281 .addClass(self.options.iconClass) 6282 ); 6283 6284 // Visible Mobile 6285 if (!self.options.visibleMobile) { 6286 $el.addClass('hidden-mobile'); 6287 } 6288 6289 // Label 6290 if (self.options.label) { 6291 $el.append( 6292 $('<span />').html(self.options.label) 6293 ); 6294 } 6295 6296 this.options.wrapper.append($el); 6297 6298 this.$el = $el; 6299 6300 return this; 6301 }, 6302 6303 events: function() { 6304 var self = this, 6305 _isScrolling = false; 6306 6307 // Click Element Action 6308 self.$el.on('click', function(e) { 6309 e.preventDefault(); 6310 $('html').animate({ 6311 scrollTop: 0 6312 }, self.options.delay, self.options.easing); 6313 return false; 6314 }); 6315 6316 // Show/Hide Button on Window Scroll event. 6317 $(window).scroll(function() { 6318 6319 if (!_isScrolling) { 6320 6321 _isScrolling = true; 6322 6323 if ($(window).scrollTop() > self.options.offset) { 6324 6325 self.$el.stop(true, true).addClass('visible'); 6326 _isScrolling = false; 6327 6328 } else { 6329 6330 self.$el.stop(true, true).removeClass('visible'); 6331 _isScrolling = false; 6332 6333 } 6334 6335 } 6336 6337 }); 6338 6339 return this; 6340 } 6341 6342 } 6343 6344 }); 6345 6346}).apply(this, [window.theme, jQuery]); 6347 6348// Scrollable 6349(function(theme, $) { 6350 6351 theme = theme || {}; 6352 6353 var instanceName = '__scrollable'; 6354 6355 var PluginScrollable = function($el, opts) { 6356 return this.initialize($el, opts); 6357 }; 6358 6359 PluginScrollable.updateModals = function() { 6360 PluginScrollable.updateBootstrapModal(); 6361 }; 6362 6363 PluginScrollable.updateBootstrapModal = function() { 6364 var updateBoostrapModal; 6365 6366 updateBoostrapModal = typeof $.fn.modal !== 'undefined'; 6367 updateBoostrapModal = updateBoostrapModal && typeof $.fn.modal.Constructor !== 'undefined'; 6368 updateBoostrapModal = updateBoostrapModal && typeof $.fn.modal.Constructor.prototype !== 'undefined'; 6369 updateBoostrapModal = updateBoostrapModal && typeof $.fn.modal.Constructor.prototype.enforceFocus !== 'undefined'; 6370 6371 if ( !updateBoostrapModal ) { 6372 return false; 6373 } 6374 6375 var originalFocus = $.fn.modal.Constructor.prototype.enforceFocus; 6376 $.fn.modal.Constructor.prototype.enforceFocus = function() { 6377 originalFocus.apply( this ); 6378 6379 var $scrollable = this.$element.find('.scrollable'); 6380 if ( $scrollable ) { 6381 if ( $.isFunction($.fn['themePluginScrollable']) ) { 6382 $scrollable.themePluginScrollable(); 6383 } 6384 6385 if ( $.isFunction($.fn['nanoScroller']) ) { 6386 $scrollable.nanoScroller(); 6387 } 6388 } 6389 }; 6390 }; 6391 6392 PluginScrollable.defaults = { 6393 contentClass: 'scrollable-content', 6394 paneClass: 'scrollable-pane', 6395 sliderClass: 'scrollable-slider', 6396 alwaysVisible: true, 6397 preventPageScrolling: true 6398 }; 6399 6400 PluginScrollable.prototype = { 6401 initialize: function($el, opts) { 6402 if ( $el.data( instanceName ) ) { 6403 return this; 6404 } 6405 6406 this.$el = $el; 6407 6408 this 6409 .setData() 6410 .setOptions(opts) 6411 .build(); 6412 6413 return this; 6414 }, 6415 6416 setData: function() { 6417 this.$el.data(instanceName, this); 6418 6419 return this; 6420 }, 6421 6422 setOptions: function(opts) { 6423 this.options = $.extend(true, {}, PluginScrollable.defaults, opts, { 6424 wrapper: this.$el 6425 }); 6426 6427 return this; 6428 }, 6429 6430 build: function() { 6431 this.options.wrapper.nanoScroller(this.options); 6432 6433 return this; 6434 } 6435 }; 6436 6437 // expose to scope 6438 $.extend(theme, { 6439 PluginScrollable: PluginScrollable 6440 }); 6441 6442 // jquery plugin 6443 $.fn.themePluginScrollable = function(opts) { 6444 return this.each(function() { 6445 var $this = $(this); 6446 6447 if ($this.data(instanceName)) { 6448 return $this.data(instanceName); 6449 } else { 6450 return new PluginScrollable($this, opts); 6451 } 6452 6453 }); 6454 }; 6455 6456 $(function() { 6457 PluginScrollable.updateModals(); 6458 }); 6459 6460}).apply(this, [window.theme, jQuery]); 6461 6462// Section Scroll 6463(function(theme, $) { 6464 6465 theme = theme || {}; 6466 6467 var instanceName = '__sectionScroll'; 6468 6469 var PluginSectionScroll = function($el, opts) { 6470 return this.initialize($el, opts); 6471 }; 6472 6473 PluginSectionScroll.defaults = { 6474 targetClass: '.section', 6475 dotsNav: true, 6476 changeHeaderLogo: true, 6477 headerLogoDark: 'img/logo-default-slim.png',
6478 headerLogoLight: 'img/logo-default-slim-dark.png' 6479 }; 6480 6481 PluginSectionScroll.prototype = { 6482 initialize: function($el, opts) { 6483 if ($el.data(instanceName)) { 6484 return this; 6485 } 6486 6487 this.$el = $el; 6488 6489 this 6490 .setData() 6491 .setOptions(opts) 6492 .build() 6493 .events(); 6494 6495 return this; 6496 }, 6497 6498 setData: function() { 6499 this.$el.data(instanceName, this); 6500 6501 return this; 6502 }, 6503 6504 setOptions: function(opts) { 6505 this.options = $.extend(true, {}, PluginSectionScroll.defaults, opts, { 6506 wrapper: this.$el 6507 }); 6508 6509 return this; 6510 }, 6511 6512 build: function() { 6513 var self = this, 6514 $el = this.options.wrapper; 6515 6516 // Check type of header and change the target for header (by change header color purpose) 6517 if( $('html').hasClass('side-header-overlay-full-screen') ) { 6518 self.$header = $('.sticky-wrapper'); 6519 } else { 6520 self.$header = $('#header'); 6521 } 6522 6523 // Turn the section full height or not depeding on the content size 6524 self.updateSectionsHeight(); 6525 6526 // Wrap all sections in a section wrapper 6527 $( this.options.targetClass ).wrap('<div class="section-wrapper"></div>'); 6528 6529 // Set the section wrapper height 6530 $('.section-wrapper').each(function(){ 6531 $(this).height( $(this).find('.section-scroll').outerHeight() ); 6532 }); 6533 6534 // Add active class to the first section on page load 6535 $('.section-wrapper').first().addClass('active'); 6536 6537 var flag = false, 6538 scrollableFlag = false, 6539 touchDirection = '', 6540 touchstartY = 0, 6541 touchendY = 0; 6542 6543 $(window).on('touchstart', function(event) { 6544 touchstartY = event.changedTouches[0].screenY; 6545 }); 6546 6547 var wheelEvent = 'onwheel' in document ? 'wheel' : document.onmousewheel !== undefined ? 'mousewheel' : 'DOMMouseScroll'; 6548 if( $(window).width() < 992 && $('html').hasClass('touch') ) { 6549 wheelEvent = 'onwheel' in document ? 'wheel touchend' : document.onmousewheel !== undefined ? 'mousewheel touchend' : 'DOMMouseScroll touchend'; 6550 } 6551 6552 if( $(window).width() < 992 ) { 6553 $('html').removeClass('overflow-hidden'); 6554 $(window).on('scroll', function(){ 6555 6556 var index = 0; 6557 $('.section-scroll').each(function(){ 6558 if( $(this).offset().top <= $(window).scrollTop() + 50 ) { 6559 var $currentSection2 = $('.section-wrapper').eq( index ).find('.section-scroll'); 6560 6561 $('.section-scroll-dots-navigation > ul > li').removeClass('active'); 6562 $('.section-scroll-dots-navigation > ul > li').eq( index ).addClass('active'); 6563 6564 $(window).trigger({ 6565 type: 'section.scroll.mobile.change.header.color', 6566 currentSection: $currentSection2 6567 }); 6568 } 6569 6570 index++; 6571 }); 6572 6573 }); 6574 6575 $(window).on('section.scroll.mobile.change.header.color', function(e){ 6576 if( typeof e.currentSection == 'undefined' ) { 6577 return; 6578 } 6579 6580 var $currentSection = e.currentSection, 6581 headerColor = $currentSection.data('section-scroll-header-color'); 6582 6583 $('#header .header-nav').removeClass('header-nav-light-text header-nav-dark-text').addClass('header-nav-' + headerColor + '-text'); 6584 $('#header .header-nav-features').removeClass('header-nav-features-dark header-nav-features-light').addClass('header-nav-features-' + headerColor); 6585 $('#header .header-social-icons').removeClass('social-icons-icon-dark social-icons-icon-light').addClass('social-icons-icon-' + headerColor); 6586 6587 // Change Logo 6588 if( self.options.changeHeaderLogo && headerColor != undefined ) { 6589 if( headerColor == 'light' ) { 6590 $('#header .header-logo img').attr('src', self.options.headerLogoLight); 6591 } else if( headerColor == 'dark' ) { 6592 $('#header .header-logo img').attr('src', self.options.headerLogoDark); 6593 } 6594 } 6595 6596 self.$header.css({ 6597 opacity: 1 6598 }); 6599 6600 }); 6601 } 6602 6603 $(window).on(wheelEvent, function(e){
6604 if( $(window).width() < 992 ) { 6605 return; 6606 } 6607 6608 if( $(window).width() < 992 && $('html').hasClass('touch') ) { 6609 if( $(e.target).closest('.section-scroll-dots-navigation').get(0) || $(e.target).closest('.header-body').get(0) || $(e.target).closest('.owl-carousel').get(0) ) { 6610 return; 6611 } 6612 } 6613 6614 // Side Header Overlay Full Screen 6615 if( $('html.side-header-overlay-full-screen.side-header-hide').get(0) ) { 6616 return; 6617 } 6618 6619 var wheelDirection = e.originalEvent.wheelDelta == undefined ? e.originalEvent.deltaY > 0 : e.originalEvent.wheelDelta < 0; 6620 if( $(window).width() < 992 && $('html').hasClass('touch') ) { 6621 touchendY = event.changedTouches[0].screenY; 6622 6623 if( touchendY <= touchstartY ) { 6624 touchDirection = 'up'; 6625 } 6626 6627 if( touchendY >= touchstartY ) { 6628 touchDirection = 'down'; 6629 } 6630 6631 if( touchendY == touchstartY ) { 6632 return; 6633 } 6634 } 6635 6636 var $currentSection = $('.section-wrapper').eq( self.getCurrentIndex() ).find('.section-scroll'), 6637 $nextSection = self.getNextSection(wheelDirection, touchDirection), 6638 nextSectionOffsetTop; 6639 6640 // If is the last section, then change the offsetTop value 6641 if( self.getCurrentIndex() == $('.section-wrapper').length - 1 ) { 6642 nextSectionOffsetTop = $(document).height(); 6643 } else { 6644 nextSectionOffsetTop = $nextSection.offset().top; 6645 } 6646 6647 if( $(window).width() < 992 && $('html').hasClass('touch') ) { 6648 setTimeout(function(){ 6649 if( $('.section-wrapper').eq( self.getCurrentIndex() ).find('.section-scroll').hasClass('section-scroll-scrollable') ) { 6650 $('html').removeClass('overflow-hidden'); 6651 } else { 6652 $('html').addClass('overflow-hidden'); 6653 } 6654 }, 1200); 6655 } 6656 6657 // For non full height sections 6658 if( $currentSection.hasClass('section-scroll-scrollable') ) { 6659 if( !flag && !scrollableFlag ) { 6660 6661 // Scroll Direction 6662 if(wheelDirection || touchDirection == 'up') { 6663 if( ( $(window).scrollTop() + $(window).height() ) >= nextSectionOffsetTop ) { 6664 flag = true; 6665 setTimeout(function(){ 6666 $(window).trigger('section.scroll.change.header.color'); 6667 6668 setTimeout(function(){ 6669 flag = false; 6670 }, 500); 6671 }, 1000); 6672 6673 if( self.getCurrentIndex() == ( $('.section-wrapper').length - 1 ) ) { 6674 return false; 6675 } 6676 6677 // Move to the next section 6678 self.moveTo( $currentSection.offset().top + $currentSection.outerHeight() ); 6679 6680 // Change Section Active Class 6681 self.changeSectionActiveState( $nextSection ); 6682 6683 self.$header.css({ 6684 opacity: 0, 6685 transition: 'ease opacity 500ms' 6686 }); 6687 } 6688 6689 if( !$('html').hasClass('touch') ) { 6690 for( var i = 1; i < 100; i++ ) { 6691 $('body, html').scrollTop( $(window).scrollTop() + 1 ); 6692 6693 if( ( $(window).scrollTop() + $(window).height() ) >= nextSectionOffsetTop ) { 6694 scrollableFlag = true; 6695 setTimeout(function(){ 6696 $(window).trigger('section.scroll.change.header.color'); 6697 scrollableFlag = false; 6698 }, 500); 6699 break; 6700 } 6701 } 6702 } 6703 } else { 6704 if( $(window).scrollTop() <= $currentSection.offset().top ) { 6705 flag = true; 6706 setTimeout(function(){ 6707 $(window).trigger('section.scroll.change.header.color'); 6708 6709 setTimeout(function(){ 6710 flag = false; 6711 }, 500); 6712 }, 1000); 6713 6714 if( self.getCurrentIndex() == 0 ) { 6715 return false; 6716 } 6717 6718 // Move to the next section 6719 self.moveTo( $currentSection.offset().top - $(window).height() ); 6720 6721 // Change Section Active Class 6722 self.changeSectionActiveState( $nextSection ); 6723 6724 self.$header.css({ 6725 opacity: 0, 6726 transition: 'ease opacity 500ms' 6727 }); 6728 } 6729 6730 if( !$('html').hasClass('touch') ) { 6731 for( var i = 1; i < 100; i++ ) { 6732 $('body, html').scrollTop( $(window).scrollTop() - 1 ); 6733 6734 if( $(window).scrollTop() <= $currentSection.offset().top ) { 6735 scrollableFlag = true; 6736 setTimeout(function(){ 6737 $(window).trigger('section.scroll.change.header.color'); 6738 scrollableFlag = false; 6739 }, 500); 6740 break; 6741 } 6742 } 6743 } 6744 } 6745 6746 // Change Dots Active Class 6747 self.changeDotsActiveState(); 6748 6749 return; 6750 6751 } 6752 } 6753 6754 // For full height sections 6755 if( !flag && !scrollableFlag ) { 6756 if(wheelDirection || touchDirection == 'up') { 6757 if( self.getCurrentIndex() == ( $('.section-wrapper').length - 1 ) ) { 6758 return false; 6759 } 6760 6761 // Change Section Active Class 6762 self.changeSectionActiveState( $nextSection ); 6763 6764 setTimeout(function(){ 6765 // Move to the next section 6766 self.moveTo( $nextSection.offset().top ); 6767 6768 }, 150); 6769 } else { 6770 if( self.getCurrentIndex() == 0 ) { 6771 return false; 6772 } 6773 6774 // Change Section Active Class 6775 self.changeSectionActiveState( $nextSection ); 6776 6777 if( $nextSection.height() > $(window).height() ) { 6778 // Move to the next section 6779 self.moveTo( $currentSection.offset().top - $(window).height() ); 6780 } else { 6781 setTimeout(function(){ 6782 // Move to the next section 6783 self.moveTo( $nextSection.offset().top ); 6784 6785 }, 150); 6786 } 6787 } 6788 6789 // Change Dots Active Class 6790 self.changeDotsActiveState(); 6791 6792 self.$header.css({ 6793 opacity: 0, 6794 transition: 'ease opacity 500ms' 6795 }); 6796 6797 // Style next section 6798 $nextSection.css({ 6799 position: 'relative', 6800 opacity: 1, 6801 'z-index': 1,
6802 transform: 'translate3d(0,0,0) scale(1)' 6803 }); 6804 6805 // Style previous section 6806 $currentSection.css({ 6807 position: 'fixed', 6808 width: '100%', 6809 top: 0, 6810 left: 0, 6811 opacity: 0, 6812 'z-index': 0, 6813 transform: 'translate3d(0,0,-10px) scale(0.7)', 6814 transition: 'ease transform 600ms, ease opacity 600ms', 6815 }); 6816 6817 setTimeout(function(){ 6818 $currentSection.css({ 6819 position: 'relative', 6820 opacity: 1, 6821 transform: 'translate3d(0,0,-10px) scale(1)' 6822 }); 6823 6824 $(window).trigger('section.scroll.change.header.color'); 6825 6826 setTimeout(function(){ 6827 flag = false; 6828 }, 500); 6829 }, 1000); 6830 6831 flag = true; 6832 6833 } 6834 6835 return; 6836 }); 6837 6838 // Dots Navigation 6839 if( this.options.dotsNav ) { 6840 self.dotsNavigation(); 6841 } 6842 6843 // First Load 6844 setTimeout(function(){ 6845 if( $(window.location.hash).get(0) ) { 6846 self.moveTo( $(window.location.hash).parent().offset().top ); 6847 6848 self.changeSectionActiveState( $(window.location.hash) ); 6849 6850 // Change Dots Active Class 6851 self.changeDotsActiveState(); 6852 6853 self.updateHash( true ); 6854 } else { 6855 var hash = window.location.hash, 6856 index = hash.replace('#',''); 6857 6858 if( !hash ) { 6859 index = 1; 6860 } 6861 6862 self.moveTo( $('.section-wrapper').eq( index - 1 ).offset().top ); 6863 6864 self.changeSectionActiveState( $('.section-wrapper').eq( index - 1 ).find('.section-scroll') ); 6865 6866 // Change Dots Active Class 6867 self.changeDotsActiveState(); 6868 6869 self.updateHash( true ); 6870 } 6871 6872 $(window).trigger('section.scroll.ready'); 6873 $(window).trigger('section.scroll.change.header.color'); 6874 }, 500); 6875 6876 return this; 6877 }, 6878 6879 updateSectionsHeight: function() { 6880 var self = this; 6881 6882 $('.section-scroll').css({ height: '' }); 6883 6884 $('.section-scroll').each(function(){ 6885 if( $(this).outerHeight() < ( $(window).height() + 3 ) ) { 6886 $(this).css({ height: '100vh' }); 6887 } else { 6888 $(this).addClass('section-scroll-scrollable'); 6889 } 6890 }); 6891 6892 // Set the section wrapper height 6893 $('.section-wrapper').each(function(){ 6894 $(this).height( $(this).find('.section-scroll').outerHeight() ); 6895 }); 6896 6897 return this; 6898 }, 6899 6900 updateHash: function( first_load ){ 6901 var self = this; 6902 6903 if( !window.location.hash ) { 6904 window.location.hash = 1; 6905 } else { 6906 if(!first_load) { 6907 var $section = $('.section-wrapper').eq( self.getCurrentIndex() ).find('.section-scroll'), 6908 section_id = $section.attr('id') ? $section.attr('id') : $section.parent().index() + 1; 6909 6910 window.location.hash = section_id; 6911 } 6912 } 6913 6914 return this; 6915 }, 6916 6917 getCurrentIndex: function() { 6918 var self = this, 6919 currentIndex = 0; 6920 6921 currentIndex = $('.section-wrapper.active').index(); 6922 6923 return currentIndex; 6924 }, 6925 6926 moveTo: function( $scrollTopValue, first_load ) { 6927 var self = this; 6928 6929 $('body, html').animate({ 6930 scrollTop: $scrollTopValue 6931 }, 1000, 'easeOutQuint'); 6932 6933 setTimeout(function(){ 6934 self.updateHash(); 6935 }, 500); 6936 6937 return this; 6938 }, 6939 6940 getNextSection: function(wheelDirection, touchDirection) { 6941 var self = this, 6942 $nextSection = ''; 6943 6944 // Scroll Direction 6945 if(wheelDirection || touchDirection == 'up') { 6946 $nextSection = $('.section-wrapper').eq( self.getCurrentIndex() + 1 ).find('.section-scroll'); 6947 } else { 6948 $nextSection = $('.section-wrapper').eq( self.getCurrentIndex() - 1 ).find('.section-scroll'); 6949 } 6950 6951 return $nextSection; 6952 }, 6953 6954 changeSectionActiveState: function( $nextSection ) { 6955 var self = this; 6956 6957 $('.section-wrapper').removeClass('active'); 6958 $nextSection.parent().addClass('active'); 6959 6960 return this; 6961 }, 6962 6963 changeDotsActiveState: function() { 6964 var self = this; 6965 6966 $('.section-scroll-dots-navigation > ul > li').removeClass('active'); 6967 $('.section-scroll-dots-navigation > ul > li').eq( self.getCurrentIndex() ).addClass('active'); 6968 6969 return this; 6970 }, 6971 6972 dotsNavigation: function() { 6973 var self = this; 6974
6975 var dotsNav = $('<div class="section-scroll-dots-navigation"><ul class="list list-unstyled"></ul></div>'), 6976 currentSectionIndex = self.getCurrentIndex(); 6977 6978 if( self.options.dotsClass ) { 6979 dotsNav.addClass( self.options.dotsClass ); 6980 } 6981 6982 for( var i = 0; i < $('.section-scroll').length; i++ ) { 6983 var title = $('.section-wrapper').eq( i ).find('.section-scroll').data('section-scroll-title'); 6984 6985 dotsNav.find('> ul').append( '<li'+ ( ( currentSectionIndex == i ) ? ' class="active"' : '' ) +'><a href="#'+ i +'" data-nav-id="'+ i +'"><span>'+ title +'</span></a></li>' ); 6986 } 6987 6988 $('.body').append( dotsNav ); 6989 6990 dotsNav.find('a[data-nav-id]').on('click touchstart', function(e){ 6991 e.preventDefault(); 6992 var $this = $(this); 6993 6994 $('.section-scroll').css({ 6995 opacity: 0, 6996 transition: 'ease opacity 300ms' 6997 }); 6998 6999 self.$header.css({ 7000 opacity: 0, 7001 transition: 'ease opacity 500ms' 7002 }); 7003 7004 setTimeout(function(){ 7005 self.moveTo( $('.section-wrapper').eq( $this.data('nav-id') ).offset().top ) 7006 7007 $('.section-wrapper').removeClass('active'); 7008 $('.section-wrapper').eq( $this.data('nav-id') ).addClass('active'); 7009 7010 $('.section-wrapper').eq( self.getCurrentIndex() ).find('.section-scroll').css({ 7011 opacity: 1 7012 }); 7013 7014 setTimeout(function(){ 7015 $('.section-scroll').css({ opacity: 1 }); 7016 7017 $(window).trigger('section.scroll.change.header.color'); 7018 }, 500); 7019 7020 if( $(window).width() > 991 ) { 7021 self.changeDotsActiveState(); 7022 } 7023 }, 500); 7024 }); 7025 7026 return this; 7027 }, 7028 7029 events: function() { 7030 var self = this; 7031 7032 $(window).on('section.scroll.ready', function(){ 7033 $(window).scrollTop(0); 7034 }); 7035 7036 $(window).on('section.scroll.change.header.color', function(){ 7037 var headerColor = $('.section-wrapper').eq( self.getCurrentIndex() ).find('.section-scroll').data('section-scroll-header-color'); 7038 7039 $('#header .header-nav').removeClass('header-nav-light-text header-nav-dark-text').addClass('header-nav-' + headerColor + '-text'); 7040 $('#header .header-nav-features').removeClass('header-nav-features-dark header-nav-features-light').addClass('header-nav-features-' + headerColor); 7041 $('#header .header-social-icons').removeClass('social-icons-icon-dark social-icons-icon-light').addClass('social-icons-icon-' + headerColor); 7042 7043 // Change Logo 7044 if( self.options.changeHeaderLogo && headerColor != undefined ) { 7045 if( headerColor == 'light' ) { 7046 $('#header .header-logo img').attr('src', self.options.headerLogoLight); 7047 } else if( headerColor == 'dark' ) { 7048 $('#header .header-logo img').attr('src', self.options.headerLogoDark); 7049 } 7050 } 7051 7052 self.$header.css({ 7053 opacity: 1 7054 }); 7055 }); 7056 7057 $(document).ready(function(){ 7058 $(window).afterResize(function(){ 7059 self.updateSectionsHeight(); 7060 7061 if( $(window).width() < 992 ) { 7062 $('html').removeClass('overflow-hidden'); 7063 } 7064 }); 7065 }); 7066 7067 return this; 7068 } 7069 }; 7070 7071 // expose to scope 7072 $.extend(theme, { 7073 PluginSectionScroll: PluginSectionScroll 7074 }); 7075 7076 // jquery plugin 7077 $.fn.themePluginSectionScroll = function(opts) { 7078 return this.map(function() { 7079 var $this = $(this); 7080 7081 if ($this.data(instanceName)) { 7082 return $this.data(instanceName); 7083 } else { 7084 return new PluginSectionScroll($this, opts); 7085 } 7086 7087 }); 7088 }; 7089 7090}).apply(this, [window.theme, jQuery]); 7091 7092// Sort 7093(function(theme, $) { 7094 7095 theme = theme || {}; 7096 7097 var instanceName = '__sort'; 7098 7099 var PluginSort = function($el, opts) { 7100 return this.initialize($el, opts); 7101 }; 7102 7103 PluginSort.defaults = { 7104 useHash: true, 7105 itemSelector: '.isotope-item', 7106 layoutMode: 'masonry', 7107 filter: '*', 7108 filterFieldId: false, 7109 filterFieldText: '', 7110 hiddenStyle: { 7111 opacity: 0 7112 }, 7113 visibleStyle: { 7114 opacity: 1 7115 }, 7116 stagger: 30, 7117 isOriginLeft: ($('html').attr('dir') == 'rtl' ? false : true) 7118 }; 7119 7120 PluginSort.prototype = { 7121 initialize: function($el, opts) { 7122 if ($el.data(instanceName)) { 7123 return this; 7124 } 7125 7126 this.$el = $el; 7127 7128 this 7129 .setData() 7130 .setOptions(opts) 7131 .build(); 7132 7133 return this; 7134 }, 7135 7136 setData: function() { 7137 this.$el.data(instanceName, this); 7138 7139 return this; 7140 }, 7141 7142 setOptions: function(opts) { 7143 this.options = $.extend(true, {}, PluginSort.defaults, opts, { 7144 wrapper: this.$el 7145 }); 7146 7147 return this; 7148 }, 7149 7150 build: function() { 7151 if (!($.isFunction($.fn.isotope))) { 7152 return this; 7153 } 7154 7155 var self = this, 7156 $source = this.options.wrapper, 7157 $destination = $('.sort-destination[data-sort-id="' + $source.attr('data-sort-id') + '"]'), 7158 $window = $(window); 7159 7160 if ($destination.get(0)) { 7161 7162 self.$source = $source; 7163 self.$destination = $destination; 7164 self.$loader = false; 7165 7166 self.setParagraphHeight($destination); 7167
7168 if (self.$destination.parents('.sort-destination-loader').get(0)) { 7169 self.$loader = self.$destination.parents('.sort-destination-loader'); 7170 self.createLoader(); 7171 } 7172 7173 $destination.attr('data-filter', '*'); 7174 7175 $destination.one('layoutComplete', function(event, laidOutItems) { 7176 self.removeLoader(); 7177 7178 // If has data-plugin-sticky on the page we need recalculate sticky position 7179 if( $('[data-plugin-sticky]').length ) { 7180 setTimeout(function(){ 7181 $('[data-plugin-sticky]').each(function(){ 7182 $(this).data('__sticky').build(); 7183 $(window).trigger('resize'); 7184 }); 7185 }, 500); 7186 } 7187 }); 7188 7189 if ( $('#' + self.options.filterFieldId).length ) { 7190 7191 var $filterField = $('#' + self.options.filterFieldId); 7192 7193 $filterField.keyup(function() { 7194 self.options.filterFieldText = $(this).val(); 7195 self.setFilter(self.options.filter); 7196 }); 7197 7198 } 7199 7200 $destination.waitForImages(function() { 7201 $destination.isotope(self.options); 7202 self.events(); 7203 }); 7204 7205 setTimeout(function() { 7206 self.removeLoader(); 7207 }, 3000); 7208 7209 } 7210 7211 return this; 7212 }, 7213 7214 events: function() { 7215 var self = this, 7216 filter = null, 7217 $window = $(window); 7218 7219 self.$source.find('a').click(function(e) { 7220 e.preventDefault(); 7221 7222 filter = $(this).parent().data('option-value'); 7223 7224 self.setFilter(filter); 7225 7226 if (e.originalEvent) { 7227 self.$source.trigger('filtered'); 7228 } 7229 7230 return this; 7231 }); 7232 7233 self.$destination.trigger('filtered'); 7234 self.$source.trigger('filtered'); 7235 7236 if (self.options.useHash) { 7237 self.hashEvents(); 7238 } 7239 7240 $window.on('resize sort.resize', function() { 7241 setTimeout(function() { 7242 self.$destination.isotope('layout'); 7243 }, 300); 7244 }); 7245 7246 setTimeout(function() { 7247 $window.trigger('sort.resize'); 7248 }, 300); 7249 7250 return this; 7251 }, 7252 7253 setFilter: function(filter) { 7254 var self = this, 7255 page = false, 7256 currentFilter = filter; 7257 7258 self.$source.find('.active').removeClass('active'); 7259 self.$source.find('li[data-option-value="' + filter + '"], li[data-option-value="' + filter + '"] > a').addClass('active'); 7260 7261 self.options.filter = currentFilter; 7262 7263 if (self.$destination.attr('data-current-page')) { 7264 currentFilter = currentFilter + '[data-page-rel=' + self.$destination.attr('data-current-page') + ']'; 7265 } 7266 7267 if (self.options.filterFieldText != '') { 7268 currentFilter = currentFilter + '[data-sort-search*=' + self.options.filterFieldText.toLowerCase() + ']'; 7269 } 7270 7271 self.$destination.attr('data-filter', filter).isotope({ 7272 filter: currentFilter 7273 }).one('arrangeComplete', function( event, filteredItems ) { 7274 7275 if (self.options.useHash) { 7276 if (window.location.hash != '' || self.options.filter.replace('.', '') != '*') { 7277 window.location.hash = self.options.filter.replace('.', ''); 7278 } 7279 } 7280 7281 $(window).trigger('scroll'); 7282 7283 }).trigger('filtered'); 7284 7285 return this; 7286 }, 7287 7288 hashEvents: function() { 7289 var self = this, 7290 hash = null, 7291 hashFilter = null, 7292 initHashFilter = '.' + location.hash.replace('#', ''); 7293 7294 // Check if has scroll to section trough URL hash and prevent the sort plugin from show nothing 7295 if( $(location.hash).length ) { 7296 initHashFilter = '.'; 7297 } 7298 7299 if (initHashFilter != '.' && initHashFilter != '.*') { 7300 self.setFilter(initHashFilter); 7301 } 7302 7303 $(window).on('hashchange', function(e) { 7304 7305 hashFilter = '.' + location.hash.replace('#', ''); 7306 hash = (hashFilter == '.' || hashFilter == '.*' ? '*' : hashFilter); 7307 7308 self.setFilter(hash); 7309 7310 }); 7311 7312 return this; 7313 }, 7314 7315 setParagraphHeight: function() { 7316 var self = this, 7317 minParagraphHeight = 0, 7318 paragraphs = $('span.thumb-info-caption p', self.$destination); 7319 7320 paragraphs.each(function() { 7321 if ($(this).height() > minParagraphHeight) { 7322 minParagraphHeight = ($(this).height() + 10);
7323 } 7324 }); 7325 7326 paragraphs.height(minParagraphHeight); 7327 7328 return this; 7329 }, 7330 7331 createLoader: function() { 7332 var self = this; 7333 7334 var loaderTemplate = [ 7335 '<div class="bounce-loader">', 7336 '<div class="bounce1"></div>', 7337 '<div class="bounce2"></div>', 7338 '<div class="bounce3"></div>', 7339 '</div>' 7340 ].join(''); 7341 7342 self.$loader.append(loaderTemplate); 7343 7344 return this; 7345 }, 7346 7347 removeLoader: function() { 7348 7349 var self = this; 7350 7351 if (self.$loader) { 7352 7353 self.$loader.removeClass('sort-destination-loader-showing'); 7354 7355 setTimeout(function() { 7356 self.$loader.addClass('sort-destination-loader-loaded'); 7357 }, 300); 7358 7359 } 7360 7361 } 7362 7363 }; 7364 7365 // expose to scope 7366 $.extend(theme, { 7367 PluginSort: PluginSort 7368 }); 7369 7370 // jquery plugin 7371 $.fn.themePluginSort = function(opts) { 7372 return this.map(function() { 7373 var $this = $(this); 7374 7375 if ($this.data(instanceName)) { 7376 return $this.data(instanceName); 7377 } else { 7378 return new PluginSort($this, opts); 7379 } 7380 7381 }); 7382 } 7383 7384}).apply(this, [window.theme, jQuery]); 7385 7386// Star Rating 7387(function(theme, $) { 7388 7389 theme = theme || {}; 7390 7391 var instanceName = '__starrating'; 7392 7393 var PluginStarRating = function($el, opts) { 7394 return this.initialize($el, opts); 7395 }; 7396 7397 PluginStarRating.defaults = { 7398 theme: 'krajee-fas', 7399 color: 'primary', 7400 showClear: false, 7401 showCaption: false 7402 }; 7403 7404 PluginStarRating.prototype = { 7405 initialize: function($el, opts) { 7406 this.$el = $el; 7407 7408 this 7409 .setData() 7410 .setOptions(opts) 7411 .build(); 7412 7413 return this; 7414 }, 7415 7416 setData: function() { 7417 this.$el.data(instanceName, this); 7418 7419 return this; 7420 }, 7421 7422 setOptions: function(opts) { 7423 this.options = $.extend(true, {}, PluginStarRating.defaults, opts, { 7424 wrapper: this.$el 7425 }); 7426 7427 return this; 7428 }, 7429 7430 build: function() { 7431 7432 if (!($.isFunction($.fn.rating))) { 7433 return this; 7434 } 7435 7436 var self = this; 7437 7438 self.options.wrapper 7439 .rating(self.options); 7440 7441 self.options.wrapper.parents('.rating-container') 7442 .addClass('rating-' + self.options.color); 7443 7444 if( self.options.extraClass ) { 7445 self.options.wrapper.parents('.rating-container') 7446 .addClass(self.options.extraClass); 7447 } 7448 7449 return this; 7450 7451 } 7452 }; 7453 7454 // expose to scope 7455 $.extend(theme, { 7456 PluginStarRating: PluginStarRating 7457 }); 7458 7459 // jquery plugin 7460 $.fn.themePluginStarRating = function(opts) { 7461 return this.map(function() { 7462 var $this = $(this); 7463 7464 if ($this.data(instanceName)) { 7465 return $this.data(instanceName); 7466 } else { 7467 return new PluginStarRating($this, opts); 7468 } 7469 7470 }); 7471 } 7472 7473}).apply(this, [window.theme, jQuery]); 7474 7475// Sticky 7476(function(theme, $) { 7477 7478 theme = theme || {}; 7479 7480 var instanceName = '__sticky'; 7481 7482 var PluginSticky = function($el, opts) { 7483 return this.initialize($el, opts); 7484 }; 7485 7486 PluginSticky.defaults = { 7487 minWidth: 991, 7488 activeClass: 'sticky-active' 7489 }; 7490 7491 PluginSticky.prototype = { 7492 initialize: function($el, opts) { 7493 if ( $el.data( instanceName ) ) { 7494 return this; 7495 } 7496 7497 this.$el = $el; 7498 7499 this 7500 .setData() 7501 .setOptions(opts) 7502 .build() 7503 .events(); 7504 7505 return this; 7506 }, 7507 7508 setData: function() { 7509 this.$el.data(instanceName, this); 7510 7511 return this; 7512 }, 7513 7514 setOptions: function(opts) { 7515 this.options = $.extend(true, {}, PluginSticky.defaults, opts, { 7516 wrapper: this.$el 7517 }); 7518 7519 return this; 7520 }, 7521 7522 build: function() { 7523 if (!($.isFunction($.fn.pin))) { 7524 return this; 7525 } 7526 7527 var self = this, 7528 $window = $(window); 7529 7530 self.options.wrapper.pin(self.options); 7531 7532 if( self.options.wrapper.hasClass('sticky-wrapper-transparent') ) { 7533 self.options.wrapper.parent().addClass('position-absolute w-100'); 7534 } 7535 7536 $window.afterResize(function() { 7537 self.options.wrapper.removeAttr('style').removeData('pin'); 7538 self.options.wrapper.pin(self.options); 7539 $window.trigger('scroll'); 7540 }); 7541 7542 // Change Logo Src 7543 if( self.options.wrapper.find('img').attr('data-change-src') ) { 7544 var $logo = self.options.wrapper.find('img'), 7545 logoSrc = $logo.attr('src'), 7546 logoNewSrc = $logo.attr('data-change-src'); 7547 7548 self.changeLogoSrc = function(activate) { 7549 if(activate) { 7550 $logo.attr('src', logoNewSrc); 7551 } else { 7552 $logo.attr('src', logoSrc); 7553 } 7554 } 7555 } 7556 7557 return this; 7558 }, 7559 7560 events: function() { 7561 var self = this, 7562 $window = $(window), 7563 $logo = self.options.wrapper.find('img'), 7564 sticky_activate_flag = true, 7565 sticky_deactivate_flag = false, 7566 class_to_check = ( self.options.wrapper.hasClass('sticky-wrapper-effect-1') ) ? 'sticky-effect-active' : 'sticky-active'; 7567 7568 $window.on('scroll sticky.effect.active', function(){ 7569 if( self.options.wrapper.hasClass( class_to_check ) ) { 7570 if( sticky_activate_flag ) { 7571 if( $logo.attr('data-change-src') ) { 7572 self.changeLogoSrc(true); 7573 } 7574 7575 sticky_activate_flag = false; 7576 sticky_deactivate_flag = true; 7577 } 7578 } else { 7579 if( sticky_deactivate_flag ) { 7580 if( $logo.attr('data-change-src') ) { 7581 self.changeLogoSrc(false); 7582 } 7583 7584 sticky_deactivate_flag = false; 7585 sticky_activate_flag = true; 7586 } 7587 } 7588 }); 7589 7590 var is_backing = false; 7591 if( self.options.stickyStartEffectAt ) { 7592 7593 // First Load 7594 if( self.options.stickyStartEffectAt < $window.scrollTop() ) { 7595 self.options.wrapper.addClass('sticky-effect-active'); 7596 7597 $window.trigger('sticky.effect.active'); 7598 } 7599 7600 $window.on('scroll', function(){ 7601 if( self.options.stickyStartEffectAt < $window.scrollTop() ) { 7602 self.options.wrapper.addClass('sticky-effect-active'); 7603 is_backing = true; 7604 7605 $window.trigger('sticky.effect.active'); 7606 } else { 7607 if( is_backing ) { 7608 self.options.wrapper.find('.sticky-body').addClass('position-fixed'); 7609 is_backing = false; 7610 } 7611 7612 if( $window.scrollTop() == 0 ) { 7613 self.options.wrapper.find('.sticky-body').removeClass('position-fixed'); 7614 } 7615 7616 self.options.wrapper.removeClass('sticky-effect-active'); 7617 } 7618 }); 7619 } 7620 7621 // Refresh Sticky Plugin if click in a data-toggle="collapse" 7622 if( $('[data-bs-toggle="collapse"]').get(0) ) { 7623 7624 $('[data-bs-toggle="collapse"]').on('click', function(){ 7625 setTimeout(function(){ 7626 self.build(); 7627 $(window).trigger('scroll'); 7628 }, 1000); 7629 }); 7630 7631 } 7632 } 7633 }; 7634 7635 // expose to scope 7636 $.extend(theme, { 7637 PluginSticky: PluginSticky 7638 }); 7639 7640 // jquery plugin 7641 $.fn.themePluginSticky = function(opts) { 7642 return this.map(function() { 7643 var $this = $(this); 7644 7645 if ($this.data(instanceName)) { 7646 return $this.data(instanceName); 7647 } else { 7648 return new PluginSticky($this, opts); 7649 } 7650 7651 }); 7652 } 7653 7654}).apply(this, [ window.theme, jQuery ]); 7655 7656// Toggle 7657(function(theme, $) { 7658 7659 theme = theme || {}; 7660 7661 var instanceName = '__toggle'; 7662 7663 var PluginToggle = function($el, opts) { 7664 return this.initialize($el, opts); 7665 }; 7666 7667 PluginToggle.defaults = { 7668 duration: 350, 7669 isAccordion: false 7670 }; 7671 7672 PluginToggle.prototype = { 7673 initialize: function($el, opts) { 7674 if ($el.data(instanceName)) { 7675 return this; 7676 } 7677 7678 this.$el = $el; 7679 7680 this 7681 .setData() 7682 .setOptions(opts) 7683 .build(); 7684 7685 return this; 7686 }, 7687 7688 setData: function() { 7689 this.$el.data(instanceName, this); 7690 7691 return this; 7692 }, 7693 7694 setOptions: function(opts) { 7695 this.options = $.extend(true, {}, PluginToggle.defaults, opts, { 7696 wrapper: this.$el 7697 }); 7698 7699 return this; 7700 }, 7701 7702 build: function() { 7703 var self = this, 7704 $wrapper = this.options.wrapper, 7705 $items = $wrapper.find('> .toggle'), 7706 $el = null; 7707 7708 $items.each(function() { 7709 $el = $(this); 7710 7711 if ($el.hasClass('active')) { 7712 $el.find('> p').addClass('preview-active'); 7713 $el.find('> .toggle-content').slideDown(self.options.duration); 7714 } 7715 7716 self.events($el); 7717 }); 7718 7719 if (self.options.isAccordion) { 7720 self.options.duration = self.options.duration / 2; 7721 } 7722 7723 return this; 7724 }, 7725 7726 events: function($el) { 7727 var self = this, 7728 previewParCurrentHeight = 0, 7729 previewParAnimateHeight = 0, 7730 toggleContent = null; 7731 7732 $el.find('> label, > .toggle-title').click(function(e) { 7733 7734 var $this = $(this), 7735 parentSection = $this.parent(), 7736 parentWrapper = $this.parents('.toggle'), 7737 previewPar = null, 7738 closeElement = null; 7739 7740 if (self.options.isAccordion && typeof(e.originalEvent) != 'undefined') { 7741 closeElement = parentWrapper.find('.toggle.active > label, .toggle.active > .toggle-title'); 7742 7743 if (closeElement[0] == $this[0]) { 7744 return; 7745 } 7746 } 7747 7748 parentSection.toggleClass('active'); 7749 7750 // Preview Paragraph 7751 if (parentSection.find('> p').get(0)) { 7752 7753 previewPar = parentSection.find('> p'); 7754 previewParCurrentHeight = previewPar.css('height'); 7755 previewPar.css('height', 'auto'); 7756 previewParAnimateHeight = previewPar.css('height'); 7757 previewPar.css('height', previewParCurrentHeight); 7758 7759 } 7760 7761 // Content 7762 toggleContent = parentSection.find('> .toggle-content'); 7763 7764 if (parentSection.hasClass('active')) { 7765 7766 $(previewPar).animate({ 7767 height: previewParAnimateHeight 7768 }, self.options.duration, function() { 7769 $(this).addClass('preview-active'); 7770 });
7771 7772 toggleContent.slideDown(self.options.duration, function() { 7773 if (closeElement) { 7774 closeElement.trigger('click'); 7775 } 7776 }); 7777 7778 } else { 7779 7780 $(previewPar).animate({ 7781 height: 0 7782 }, self.options.duration, function() { 7783 $(this).removeClass('preview-active'); 7784 }); 7785 7786 toggleContent.slideUp(self.options.duration); 7787 7788 } 7789 7790 }); 7791 } 7792 }; 7793 7794 // expose to scope 7795 $.extend(theme, { 7796 PluginToggle: PluginToggle 7797 }); 7798 7799 // jquery plugin 7800 $.fn.themePluginToggle = function(opts) { 7801 return this.map(function() { 7802 var $this = $(this); 7803 7804 if ($this.data(instanceName)) { 7805 return $this.data(instanceName); 7806 } else { 7807 return new PluginToggle($this, opts); 7808 } 7809 7810 }); 7811 } 7812 7813}).apply(this, [window.theme, jQuery]); 7814 7815// Validation 7816(function(theme, $) { 7817 7818 theme = theme || {}; 7819 7820 $.extend(theme, { 7821 7822 PluginValidation: { 7823 7824 defaults: { 7825 formClass: 'needs-validation', 7826 validator: { 7827 highlight: function(element) { 7828 $(element) 7829 .addClass('is-invalid') 7830 .removeClass('is-valid') 7831 .parent() 7832 .removeClass('has-success') 7833 .addClass('has-danger'); 7834 }, 7835 success: function(label, element) { 7836 $(element) 7837 .removeClass('is-invalid') 7838 .addClass('is-valid') 7839 .parent() 7840 .removeClass('has-danger') 7841 .addClass('has-success') 7842 .find('label.error') 7843 .remove(); 7844 }, 7845 errorPlacement: function(error, element) { 7846 if (element.attr('type') == 'radio' || element.attr('type') == 'checkbox') { 7847 error.appendTo(element.parent().parent()); 7848 } else { 7849 error.insertAfter(element); 7850 } 7851 } 7852 } 7853 }, 7854 7855 initialize: function(opts) { 7856 initialized = true; 7857 7858 this 7859 .setOptions(opts) 7860 .build(); 7861 7862 return this; 7863 }, 7864 7865 setOptions: function(opts) { 7866 this.options = $.extend(true, {}, this.defaults, opts); 7867 7868 return this; 7869 }, 7870 7871 build: function() { 7872 var self = this; 7873 7874 if (!($.isFunction($.validator))) { 7875 return this; 7876 } 7877 7878 self.setMessageGroups(); 7879 7880 $.validator.setDefaults(self.options.validator); 7881 7882 $('.' + self.options.formClass).validate(); 7883 7884 return this; 7885 }, 7886 7887 setMessageGroups: function() { 7888 7889 $('.checkbox-group[data-msg-required], .radio-group[data-msg-required]').each(function() { 7890 var message = $(this).data('msg-required'); 7891 $(this).find('input').attr('data-msg-required', message); 7892 }); 7893 7894 } 7895 7896 } 7897 7898 }); 7899 7900}).apply(this, [window.theme, jQuery]); 7901 7902// Video Background 7903(function(theme, $) { 7904 7905 theme = theme || {}; 7906 7907 var instanceName = '__videobackground'; 7908 7909 var PluginVideoBackground = function($el, opts) { 7910 return this.initialize($el, opts); 7911 }; 7912 7913 PluginVideoBackground.defaults = { 7914 overlay: false, 7915 volume: 1, 7916 playbackRate: 1, 7917 muted: true, 7918 loop: true, 7919 autoplay: true, 7920 position: '50% 50%', 7921 posterType: 'detect', 7922 className: 'vide-video-wrapper' 7923 }; 7924 7925 PluginVideoBackground.prototype = { 7926 initialize: function($el, opts) { 7927 this.$el = $el; 7928 7929 this 7930 .setData() 7931 .setOptions(opts) 7932 .build() 7933 .events(); 7934 7935 return this; 7936 }, 7937 7938 setData: function() { 7939 this.$el.data(instanceName, this); 7940 7941 return this; 7942 }, 7943 7944 setOptions: function(opts) { 7945 this.options = $.extend(true, {}, PluginVideoBackground.defaults, opts, { 7946 path: this.$el.data('video-path'), 7947 wrapper: this.$el 7948 }); 7949 7950 return this; 7951 }, 7952 7953 build: function() { 7954 var self = this; 7955 7956 if (!($.isFunction($.fn.vide)) || (!this.options.path)) { 7957 return this; 7958 } 7959 7960 if (this.options.overlay) { 7961 7962 var overlayClass = this.options.overlayClass; 7963 7964 this.options.wrapper.prepend( 7965 $('<div />').addClass(overlayClass) 7966 ); 7967 } 7968 7969 this.options.wrapper 7970 .vide(this.options.path, this.options) 7971 .first() 7972 .css('z-index', 0); 7973 7974 // Change Poster 7975 self.changePoster(); 7976 7977 // Initialize Vide inside a carousel 7978 if( self.options.wrapper.closest('.owl-carousel').get(0) ) { 7979 self.options.wrapper.closest('.owl-carousel').on('initialized.owl.carousel', function(){ 7980 $('.owl-item.cloned')
7981 .find('[data-plugin-video-background] .vide-video-wrapper') 7982 .remove(); 7983 7984 $('.owl-item.cloned') 7985 .find('[data-plugin-video-background]') 7986 .vide(self.options.path, self.options) 7987 .first() 7988 .css('z-index', 0); 7989 7990 self.changePoster( self.options.wrapper.closest('.owl-carousel') ); 7991 }); 7992 } 7993 7994 // Play Video Button 7995 var $playButton = self.options.wrapper.find('.video-background-play'); 7996 7997 if( $playButton.get(0) ) { 7998 var $playWrapper = self.options.wrapper.find('.video-background-play-wrapper'); 7999 8000 self.options.wrapper.find('.video-background-play').on('click', function(e){ 8001 e.preventDefault(); 8002 8003 if( $playWrapper.get(0) ) { 8004 $playWrapper.animate({ 8005 opacity: 0 8006 }, 300, function(){ 8007 $playWrapper.parent().height( $playWrapper.outerHeight() ); 8008 $playWrapper.remove(); 8009 }); 8010 } else { 8011 $playButton.animate({ 8012 opacity: 0 8013 }, 300, function(){ 8014 $playButton.remove(); 8015 }); 8016 } 8017 8018 setTimeout(function(){ 8019 self.options.wrapper.find('video')[0].play(); 8020 }, 500) 8021 }); 8022 } 8023 8024 $(window).trigger('vide.video.inserted.on.dom'); 8025 8026 return this; 8027 }, 8028 8029 changePoster: function( $carousel ) { 8030 var self = this; 8031 8032 // If it's inside carousel 8033 if( $carousel && self.options.changePoster ) { 8034 $carousel.find('.owl-item [data-plugin-video-background] .vide-video-wrapper').css({ 8035 'background-image': 'url(' + self.options.changePoster + ')' 8036 }); 8037 8038 return this; 8039 } 8040 8041 if( self.options.changePoster ) { 8042 self.options.wrapper.find('.vide-video-wrapper').css({ 8043 'background-image': 'url(' + self.options.changePoster + ')' 8044 }); 8045 } 8046 8047 return this; 8048 }, 8049 8050 events: function() { 8051 var self = this; 8052 8053 // Initialize 8054 self.options.wrapper.on('video.background.initialize', function(){ 8055 self.build(); 8056 }); 8057 8058 return this; 8059 } 8060 }; 8061 8062 // expose to scope 8063 $.extend(theme, { 8064 PluginVideoBackground: PluginVideoBackground 8065 }); 8066 8067 // jquery plugin 8068 $.fn.themePluginVideoBackground = function(opts) { 8069 return this.map(function() { 8070 var $this = $(this); 8071 8072 if ($this.data(instanceName)) { 8073 return $this.data(instanceName); 8074 } else { 8075 return new PluginVideoBackground($this, opts); 8076 } 8077 8078 }); 8079 } 8080 8081}).apply(this, [window.theme, jQuery]); 8082 8083// Account 8084(function(theme, $) { 8085 8086 theme = theme || {}; 8087 8088 var initialized = false; 8089 8090 $.extend(theme, { 8091 8092 Account: { 8093 8094 defaults: { 8095 wrapper: $('#headerAccount') 8096 }, 8097 8098 initialize: function($wrapper, opts) { 8099 if (initialized) { 8100 return this; 8101 } 8102 8103 initialized = true; 8104 this.$wrapper = ($wrapper || this.defaults.wrapper); 8105 8106 this 8107 .setOptions(opts) 8108 .events(); 8109 8110 return this; 8111 }, 8112 8113 setOptions: function(opts) { 8114 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options'))); 8115 8116 return this; 8117 }, 8118 8119 events: function() { 8120 var self = this; 8121 8122 $(window).on('load', function(){ 8123 $(document).ready(function(){ 8124 setTimeout(function(){ 8125 8126 self.$wrapper.find('input').on('focus', function() { 8127 self.$wrapper.addClass('open'); 8128 8129 $(document).mouseup(function(e) { 8130 if (!self.$wrapper.is(e.target) && self.$wrapper.has(e.target).length === 0) { 8131 self.$wrapper.removeClass('open'); 8132 } 8133 });
8134 }); 8135 8136 }, 1500); 8137 }); 8138 }); 8139 8140 $('#headerSignUp').on('click', function(e) { 8141 e.preventDefault(); 8142 self.$wrapper.addClass('signup').removeClass('signin').removeClass('recover'); 8143 self.$wrapper.find('.signup-form input:first').focus(); 8144 }); 8145 8146 $('#headerSignIn').on('click', function(e) { 8147 e.preventDefault(); 8148 self.$wrapper.addClass('signin').removeClass('signup').removeClass('recover'); 8149 self.$wrapper.find('.signin-form input:first').focus(); 8150 }); 8151 8152 $('#headerRecover').on('click', function(e) { 8153 e.preventDefault(); 8154 self.$wrapper.addClass('recover').removeClass('signup').removeClass('signin'); 8155 self.$wrapper.find('.recover-form input:first').focus(); 8156 }); 8157 8158 $('#headerRecoverCancel').on('click', function(e) { 8159 e.preventDefault(); 8160 self.$wrapper.addClass('signin').removeClass('signup').removeClass('recover'); 8161 self.$wrapper.find('.signin-form input:first').focus(); 8162 }); 8163 } 8164 8165 } 8166 8167 }); 8168 8169}).apply(this, [window.theme, jQuery]); 8170 8171// Nav 8172(function(theme, $) { 8173 8174 theme = theme || {}; 8175 8176 var initialized = false; 8177 8178 $.extend(theme, { 8179 8180 Nav: { 8181 8182 defaults: { 8183 wrapper: $('#mainNav'), 8184 scrollDelay: 600, 8185 scrollAnimation: 'easeOutQuad' 8186 }, 8187 8188 initialize: function($wrapper, opts) { 8189 if (initialized) { 8190 return this; 8191 } 8192 8193 initialized = true; 8194 this.$wrapper = ($wrapper || this.defaults.wrapper); 8195 8196 this 8197 .setOptions(opts) 8198 .build() 8199 .events(); 8200 8201 return this; 8202 }, 8203 8204 setOptions: function(opts) { 8205 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options'))); 8206 8207 return this; 8208 }, 8209 8210 build: function() { 8211 var self = this, 8212 $html = $('html'), 8213 $header = $('#header'), 8214 $headerNavMain = $('#header .header-nav-main'), 8215 thumbInfoPreview; 8216 8217 // Preview Thumbs 8218 if( self.$wrapper.find('a[data-thumb-preview]').length ) { 8219 self.$wrapper.find('a[data-thumb-preview]').each(function() { 8220 thumbInfoPreview = $('<span />').addClass('thumb-info thumb-info-preview') 8221 .append($('<span />').addClass('thumb-info-wrapper') 8222 .append($('<span />').addClass('thumb-info-image').css('background-image', 'url(' + $(this).data('thumb-preview') + ')') 8223 ) 8224 ); 8225 8226 $(this).append(thumbInfoPreview); 8227 }); 8228 } 8229 8230 // Side Header / Side Header Hamburguer Sidebar (Reverse Dropdown) 8231 if($html.hasClass('side-header') || $html.hasClass('side-header-hamburguer-sidebar')) { 8232 8233 // Side Header Right / Side Header Hamburguer Sidebar Right 8234 if($html.hasClass('side-header-right') || $html.hasClass('side-header-hamburguer-sidebar-right')) { 8235 if(!$html.hasClass('side-header-right-no-reverse')) { 8236 $header.find('.dropdown-submenu').addClass('dropdown-reverse'); 8237 } 8238 } 8239 8240 } else { 8241 8242 // Reverse 8243 var checkReverseFlag = false; 8244 self.checkReverse = function() { 8245 if( !checkReverseFlag ) { 8246 self.$wrapper.find('.dropdown, .dropdown-submenu').removeClass('dropdown-reverse'); 8247 8248 self.$wrapper.find('.dropdown:not(.manual):not(.dropdown-mega), .dropdown-submenu:not(.manual)').each(function() { 8249 if(!$(this).find('.dropdown-menu').visible( false, true, 'horizontal' ) ) { 8250 $(this).addClass('dropdown-reverse'); 8251 } 8252 }); 8253 8254 checkReverseFlag = true; 8255 } 8256 } 8257 8258 $(window).on('resize', function(){ 8259 checkReverseFlag = false; 8260 }); 8261 8262 $header.on('mouseover', function(){ 8263 self.checkReverse(); 8264 }); 8265 8266 } 8267 8268 // Clone Items 8269 if($headerNavMain.hasClass('header-nav-main-clone-items')) { 8270 8271 $headerNavMain.find('nav > ul > li > a').each(function(){ 8272 var parent = $(this).parent(), 8273 clone = $(this).clone(), 8274 clone2 = $(this).clone(), 8275 wrapper = $('<span class="wrapper-items-cloned"></span>'); 8276 8277 // Config Classes 8278 $(this).addClass('item-original'); 8279 clone2.addClass('item-two'); 8280 8281 // Insert on DOM
8282 parent.prepend(wrapper); 8283 wrapper.append(clone).append(clone2); 8284 }); 8285 8286 } 8287 8288 // Floating 8289 if($('#header.header-floating-icons').length && $(window).width() > 991) { 8290 8291 var menuFloatingAnim = { 8292 $menuFloating: $('#header.header-floating-icons .header-container > .header-row'), 8293 8294 build: function() { 8295 var self = this; 8296 8297 self.init(); 8298 }, 8299 init: function(){ 8300 var self = this, 8301 divisor = 0; 8302 8303 $(window).scroll(function() { 8304 var scrollPercent = 100 * $(window).scrollTop() / ($(document).height() - $(window).height()), 8305 st = $(this).scrollTop(); 8306 8307 divisor = $(document).height() / $(window).height(); 8308 8309 self.$menuFloating.find('.header-column > .header-row').css({ 8310 transform : 'translateY( calc('+ scrollPercent +'vh - '+ st / divisor +'px) )' 8311 }); 8312 }); 8313 } 8314 } 8315 8316 menuFloatingAnim.build(); 8317 8318 } 8319 8320 // Slide 8321 if($('.header-nav-links-vertical-slide').length) { 8322 var slideNavigation = { 8323 $mainNav: $('#mainNav'), 8324 $mainNavItem: $('#mainNav li'), 8325 8326 build: function(){ 8327 var self = this; 8328 8329 self.menuNav(); 8330 }, 8331 menuNav: function(){ 8332 var self = this; 8333 8334 self.$mainNavItem.on('click', function(e){ 8335 var currentMenuItem = $(this), 8336 currentMenu = $(this).parent(), 8337 nextMenu = $(this).find('ul').first(), 8338 prevMenu = $(this).closest('.next-menu'), 8339 isSubMenu = currentMenuItem.hasClass('dropdown') || currentMenuItem.hasClass('dropdown-submenu'), 8340 isBack = currentMenuItem.hasClass('back-button'), 8341 nextMenuHeightDiff = ( ( nextMenu.find('> li').length * nextMenu.find('> li').outerHeight() ) - nextMenu.outerHeight() ), 8342 prevMenuHeightDiff = ( ( prevMenu.find('> li').length * prevMenu.find('> li').outerHeight() ) - prevMenu.outerHeight() ); 8343 8344 if( isSubMenu ) { 8345 currentMenu.addClass('next-menu'); 8346 nextMenu.addClass('visible'); 8347 currentMenu.css({ 8348 overflow: 'visible', 8349 'overflow-y': 'visible' 8350 }); 8351 8352 if( nextMenuHeightDiff > 0 ) { 8353 nextMenu.css({ 8354 overflow: 'hidden', 8355 'overflow-y': 'scroll' 8356 }); 8357 } 8358 8359 for( i = 0; i < nextMenu.find('> li').length; i++ ) { 8360 if( nextMenu.outerHeight() < ($('.header-row-side-header').outerHeight() - 100) ) { 8361 nextMenu.css({ 8362 height: nextMenu.outerHeight() + nextMenu.find('> li').outerHeight() 8363 }); 8364 } 8365 } 8366 8367 nextMenu.css({ 8368 'padding-top': nextMenuHeightDiff + 'px' 8369 }); 8370 } 8371 8372 if( isBack ) { 8373 currentMenu.parent().parent().removeClass('next-menu'); 8374 currentMenu.removeClass('visible'); 8375 8376 if( prevMenuHeightDiff > 0 ) { 8377 prevMenu.css({ 8378 overflow: 'hidden', 8379 'overflow-y': 'scroll' 8380 }); 8381 } 8382 } 8383 8384 e.stopPropagation(); 8385 }); 8386 } 8387 } 8388 8389 $(window).trigger('resize'); 8390 8391 if( $(window).width() > 991 ) { 8392 slideNavigation.build(); 8393 } 8394 8395 $(document).ready(function(){ 8396 $(window).afterResize(function(){ 8397 if( $(window).width() > 991 ) { 8398 slideNavigation.build(); 8399 } 8400 }); 8401 }); 8402 } 8403 8404 // Header Nav Main Mobile Dark 8405 if($('.header-nav-main-mobile-dark').length) { 8406 $('#header:not(.header-transparent-dark-bottom-border):not(.header-transparent-light-bottom-border)').addClass('header-no-border-bottom'); 8407 } 8408 8409 // Keyboard Navigation / Accessibility 8410 if( $(window).width() > 991 ) { 8411 var focusFlag = false; 8412 $header.find('.header-nav-main nav > ul > li > a').on('focus', function(){ 8413 8414 if( $(window).width() > 991 ) { 8415 if( !focusFlag ) { 8416 focusFlag = true; 8417 $(this).trigger('blur'); 8418 8419 self.focusMenuWithChildren();
8420 } 8421 } 8422 8423 }); 8424 } 8425 8426 return this; 8427 }, 8428 8429 focusMenuWithChildren: function() { 8430 // Get all the link elements within the primary menu. 8431 var links, i, len, 8432 menu = document.querySelector( 'html:not(.side-header):not(.side-header-hamburguer-sidebar):not(.side-header-overlay-full-screen) .header-nav-main > nav' ); 8433 8434 if ( ! menu ) { 8435 return false; 8436 } 8437 8438 links = menu.getElementsByTagName( 'a' ); 8439 8440 // Each time a menu link is focused or blurred, toggle focus. 8441 for ( i = 0, len = links.length; i < len; i++ ) { 8442 links[i].addEventListener( 'focus', toggleFocus, true ); 8443 links[i].addEventListener( 'blur', toggleFocus, true ); 8444 } 8445 8446 //Sets or removes the .focus class on an element. 8447 function toggleFocus() { 8448 var self = this; 8449 8450 // Move up through the ancestors of the current link until we hit .primary-menu. 8451 while ( -1 === self.className.indexOf( 'header-nav-main' ) ) { 8452 // On li elements toggle the class .focus. 8453 if ( 'li' === self.tagName.toLowerCase() ) { 8454 if ( -1 !== self.className.indexOf( 'accessibility-open' ) ) { 8455 self.className = self.className.replace( ' accessibility-open', '' ); 8456 } else { 8457 self.className += ' accessibility-open'; 8458 } 8459 } 8460 self = self.parentElement; 8461 } 8462 } 8463 }, 8464 8465 events: function() { 8466 var self = this, 8467 $html = $('html'), 8468 $header = $('#header'), 8469 $window = $(window), 8470 headerBodyHeight = $('.header-body').outerHeight(); 8471 8472 if( $header.hasClass('header') ) { 8473 $header = $('.header'); 8474 } 8475 8476 $header.find('a[href="#"]').on('click', function(e) { 8477 e.preventDefault(); 8478 }); 8479 8480 // Mobile Arrows 8481 if( $html.hasClass('side-header-hamburguer-sidebar') ) { 8482 $header.find('.dropdown-toggle, .dropdown-submenu > a') 8483 .append('<i class="fas fa-chevron-down fa-chevron-right"></i>'); 8484 } else { 8485 $header.find('.dropdown-toggle, .dropdown-submenu > a') 8486 .append('<i class="fas fa-chevron-down"></i>'); 8487 } 8488 8489 $header.find('.dropdown-toggle[href="#"], .dropdown-submenu a[href="#"], .dropdown-toggle[href!="#"] .fa-chevron-down, .dropdown-submenu a[href!="#"] .fa-chevron-down').on('click', function(e) { 8490 e.preventDefault(); 8491 if ($window.width() < 992) { 8492 $(this).closest('li').toggleClass('open'); 8493 8494 // Adjust Header Body Height 8495 var height = ( $header.hasClass('header-effect-shrink') && $html.hasClass('sticky-header-active') ) ? theme.StickyHeader.options.stickyHeaderContainerHeight : headerBodyHeight; 8496 $('.header-body').animate({ 8497 height: ($('.header-nav-main nav').outerHeight(true) + height) + 10 8498 }, 0); 8499 } 8500 }); 8501 8502 $header.find('li a.active').addClass('current-page-active'); 8503 8504 // Add Open Class 8505 $header.find('.header-nav-click-to-open .dropdown-toggle[href="#"], .header-nav-click-to-open .dropdown-submenu a[href="#"], .header-nav-click-to-open .dropdown-toggle > i').on('click', function(e) { 8506 if( !$('html').hasClass('side-header-hamburguer-sidebar') && $window.width() > 991 ) { 8507 e.preventDefault(); 8508 e.stopPropagation(); 8509 } 8510 8511 if ($window.width() > 991) { 8512 e.preventDefault(); 8513 e.stopPropagation(); 8514 8515 $header.find('li a.active').removeClass('active'); 8516 8517 if( $(this).prop('tagName') == 'I' ) { 8518 $(this).parent().addClass('active'); 8519 } else { 8520 $(this).addClass('active'); 8521 } 8522 8523 if (!$(this).closest('li').hasClass('open')) { 8524 8525 var $li = $(this).closest('li'), 8526 isSub = false; 8527 8528 if( $(this).prop('tagName') == 'I' ) { 8529 $('#header .dropdown.open').removeClass('open'); 8530 $('#header .dropdown-menu .dropdown-submenu.open').removeClass('open'); 8531 } 8532 8533 if ( $(this).parent().hasClass('dropdown-submenu') ) { 8534 isSub = true; 8535 } 8536 8537 $(this).closest('.dropdown-menu').find('.dropdown-submenu.open').removeClass('open'); 8538 $(this).parent('.dropdown').parent().find('.dropdown.open').removeClass('open'); 8539 8540 if (!isSub) { 8541 $(this).parent().find('.dropdown-submenu.open').removeClass('open'); 8542 } 8543 8544 $li.addClass('open'); 8545
8546 $(document).off('click.nav-click-to-open').on('click.nav-click-to-open', function (e) { 8547 if (!$li.is(e.target) && $li.has(e.target).length === 0) { 8548 $li.removeClass('open'); 8549 $li.parents('.open').removeClass('open'); 8550 $header.find('li a.active').removeClass('active'); 8551 $header.find('li a.current-page-active').addClass('active'); 8552 } 8553 }); 8554 8555 } else { 8556 $(this).closest('li').removeClass('open'); 8557 $header.find('li a.active').removeClass('active'); 8558 $header.find('li a.current-page-active').addClass('active'); 8559 } 8560 8561 $window.trigger({ 8562 type: 'resize', 8563 from: 'header-nav-click-to-open' 8564 }); 8565 } 8566 }); 8567 8568 // Collapse Nav 8569 $header.find('[data-collapse-nav]').on('click', function(e) { 8570 $(this).parents('.collapse').removeClass('show'); 8571 }); 8572 8573 // Top Features 8574 $header.find('.header-nav-features-toggle').on('click', function(e) { 8575 e.preventDefault(); 8576 8577 var $toggleParent = $(this).parent(); 8578 8579 if (!$(this).siblings('.header-nav-features-dropdown').hasClass('show')) { 8580 8581 var $dropdown = $(this).siblings('.header-nav-features-dropdown'); 8582 8583 $('.header-nav-features-dropdown.show').removeClass('show'); 8584 8585 $dropdown.addClass('show'); 8586 8587 $(document).off('click.header-nav-features-toggle').on('click.header-nav-features-toggle', function (e) { 8588 if (!$toggleParent.is(e.target) && $toggleParent.has(e.target).length === 0) { 8589 $('.header-nav-features-dropdown.show').removeClass('show'); 8590 } 8591 }); 8592 8593 if ($(this).attr('data-focus')) { 8594 $('#' + $(this).attr('data-focus')).focus(); 8595 } 8596 8597 } else { 8598 $(this).siblings('.header-nav-features-dropdown').removeClass('show'); 8599 } 8600 }); 8601 8602 // Hamburguer Menu 8603 var $hamburguerMenuBtn = $('.hamburguer-btn:not(.side-panel-toggle)'), 8604 $hamburguerSideHeader = $('#header.side-header, #header.side-header-overlay-full-screen'); 8605 8606 $hamburguerMenuBtn.on('click', function(){ 8607 if($(this).attr('data-set-active') != 'false') { 8608 $(this).toggleClass('active'); 8609 } 8610 $hamburguerSideHeader.toggleClass('side-header-hide'); 8611 $html.toggleClass('side-header-hide'); 8612 8613 $window.trigger('resize'); 8614 }); 8615 8616 // Toggle Side Header 8617 $('.toggle-side-header').on('click', function(){ 8618 $('.hamburguer-btn-side-header.active').trigger('click'); 8619 }); 8620 8621 $('.hamburguer-close:not(.side-panel-toggle)').on('click', function(){ 8622 $('.hamburguer-btn:not(.hamburguer-btn-side-header-mobile-show)').trigger('click'); 8623 }); 8624 8625 // Set Header Body Height when open mobile menu 8626 $('.header-nav-main nav').on('show.bs.collapse', function () { 8627 $(this).removeClass('closed'); 8628 8629 // Add Mobile Menu Opened Class 8630 $('html').addClass('mobile-menu-opened'); 8631 8632 $('.header-body').animate({ 8633 height: ($('.header-body').outerHeight() + $('.header-nav-main nav').outerHeight(true)) + 10 8634 }); 8635 8636 // Header Below Slider / Header Bottom Slider - Scroll to menu position 8637 if( $('#header').is('.header-bottom-slider, .header-below-slider') && !$('html').hasClass('sticky-header-active') ) { 8638 self.scrollToTarget( $('#header'), 0 ); 8639 } 8640 }); 8641 8642 // Set Header Body Height when collapse mobile menu 8643 $('.header-nav-main nav').on('hide.bs.collapse', function () { 8644 $(this).addClass('closed'); 8645 8646 // Remove Mobile Menu Opened Class 8647 $('html').removeClass('mobile-menu-opened'); 8648 8649 $('.header-body').animate({ 8650 height: ($('.header-body').outerHeight() - $('.header-nav-main nav').outerHeight(true)) 8651 }, function(){ 8652 $(this).height('auto'); 8653 }); 8654 }); 8655 8656 // Header Effect Shrink - Adjust header body height on mobile 8657 $window.on('stickyHeader.activate', function(){ 8658 if( $window.width() < 992 && $header.hasClass('header-effect-shrink') ) { 8659 if( $('.header-btn-collapse-nav').attr('aria-expanded') == 'true' ) { 8660 $('.header-body').animate({ 8661 height: ( $('.header-nav-main nav').outerHeight(true) + theme.StickyHeader.options.stickyHeaderContainerHeight ) + ( ($('.header-nav-bar').length) ? $('.header-nav-bar').outerHeight() : 0 ) 8662 });
8663 } 8664 } 8665 }); 8666 8667 $window.on('stickyHeader.deactivate', function(){ 8668 if( $window.width() < 992 && $header.hasClass('header-effect-shrink') ) { 8669 if( $('.header-btn-collapse-nav').attr('aria-expanded') == 'true' ) { 8670 $('.header-body').animate({ 8671 height: headerBodyHeight + $('.header-nav-main nav').outerHeight(true) + 10 8672 }); 8673 } 8674 } 8675 }); 8676 8677 // Remove Open Class on Resize 8678 $window.on('resize.removeOpen', function(e) { 8679 if( e.from == 'header-nav-click-to-open' ) { 8680 return; 8681 } 8682 8683 setTimeout(function() { 8684 if( $window.width() > 991 ) { 8685 $header.find('.dropdown.open').removeClass('open'); 8686 } 8687 }, 100); 8688 }); 8689 8690 // Side Header - Change value of initial header body height 8691 $(document).ready(function(){ 8692 if( $window.width() > 991 ) { 8693 var flag = false; 8694 8695 $window.on('resize', function(e) { 8696 if( e.from == 'header-nav-click-to-open' ) { 8697 return; 8698 } 8699 8700 $header.find('.dropdown.open').removeClass('open'); 8701 8702 if( $window.width() < 992 && flag == false ) { 8703 headerBodyHeight = $('.header-body').outerHeight(); 8704 flag = true; 8705 8706 setTimeout(function(){ 8707 flag = false; 8708 }, 500); 8709 } 8710 }); 8711 } 8712 }); 8713 8714 // Side Header - Set header height on mobile 8715 if( $html.hasClass('side-header') ) { 8716 if( $window.width() < 992 ) { 8717 $header.css({ 8718 height: $('.header-body .header-container').outerHeight() + (parseInt( $('.header-body').css('border-top-width') ) + parseInt( $('.header-body').css('border-bottom-width') )) 8719 }); 8720 } 8721 8722 $(document).ready(function(){ 8723 $window.afterResize(function(){ 8724 if( $window.width() < 992 ) { 8725 $header.css({ 8726 height: $('.header-body .header-container').outerHeight() + (parseInt( $('.header-body').css('border-top-width') ) + parseInt( $('.header-body').css('border-bottom-width') )) 8727 });
8728 } else { 8729 $header.css({ 8730 height: '' 8731 }); 8732 } 8733 }); 8734 }); 8735 } 8736 8737 // Anchors Position 8738 if( $('[data-hash]').length ) { 8739 $('[data-hash]').on('mouseover', function(){ 8740 var $this = $(this); 8741 8742 if( !$this.data('__dataHashBinded') ) { 8743 var target = $this.attr('href'), 8744 offset = ($this.is("[data-hash-offset]") ? $this.data('hash-offset') : 0), 8745 delay = ($this.is("[data-hash-delay]") ? $this.data('hash-delay') : 0), 8746 force = ($this.is("[data-hash-force]") ? true : false), 8747 windowWidth = $(window).width(); 8748 8749 // Hash Offset SM 8750 if ($this.is("[data-hash-offset-sm]") && windowWidth > 576) { 8751 offset = $this.data('hash-offset-sm'); 8752 } 8753 8754 // Hash Offset MD 8755 if ($this.is("[data-hash-offset-md]") && windowWidth > 768) { 8756 offset = $this.data('hash-offset-md'); 8757 } 8758 8759 // Hash Offset LG 8760 if ($this.is("[data-hash-offset-lg]") && windowWidth > 992) { 8761 offset = $this.data('hash-offset-lg'); 8762 } 8763 8764 // Hash Offset XL 8765 if ($this.is("[data-hash-offset-xl]") && windowWidth > 1200) { 8766 offset = $this.data('hash-offset-xl'); 8767 } 8768 8769 // Hash Offset XXL 8770 if ($this.is("[data-hash-offset-xxl]") && windowWidth > 1400) { 8771 offset = $this.data('hash-offset-xxl'); 8772 } 8773 8774 if( !$(target).length ) { 8775 target = target.split('#'); 8776 target = '#'+target[1]; 8777 } 8778 8779 if( target.indexOf('#') != -1 && $(target).length) { 8780 $this.on('click', function(e) { 8781 e.preventDefault(); 8782 8783 if( !$(e.target).is('i') || force ) { 8784 8785 setTimeout(function(){ 8786 8787 // Close Collapse if open 8788 $this.parents('.collapse.show').collapse('hide'); 8789 8790 // Close Side Header 8791 $hamburguerSideHeader.addClass('side-header-hide'); 8792 $html.addClass('side-header-hide'); 8793 8794 $window.trigger('resize'); 8795 8796 self.scrollToTarget(target, offset); 8797 8798 // Data Hash Trigger Click 8799 if( $this.data('hash-trigger-click') ) { 8800 8801 var $clickTarget = $( $this.data('hash-trigger-click') ), 8802 clickDelay = $this.data('hash-trigger-click-delay') ? $this.data('hash-trigger-click-delay') : 0; 8803 8804 if( $clickTarget.length ) { 8805 8806 setTimeout(function(){ 8807 // If is a "Tabs" plugin link 8808 if( $clickTarget.closest('.nav-tabs').length ) { 8809 new bootstrap.Tab( $clickTarget[0] ).show(); 8810 } else { 8811 $clickTarget.trigger('click'); 8812 } 8813 8814 }, clickDelay); 8815 } 8816 8817 } 8818 8819 }, delay); 8820 8821 } 8822 8823 return; 8824 });
8825 } 8826 8827 $(this).data('__dataHashBinded', true); 8828 } 8829 }); 8830 } 8831 8832 // Floating 8833 if($('#header.header-floating-icons').length) { 8834 8835 $('#header.header-floating-icons [data-hash]').off().each(function() { 8836 8837 var target = $(this).attr('href'), 8838 offset = ($(this).is("[data-hash-offset]") ? $(this).data('hash-offset') : 0); 8839 8840 if($(target).length) { 8841 $(this).on('click', function(e) { 8842 e.preventDefault(); 8843 8844 $('html, body').animate({ 8845 scrollTop: $(target).offset().top - offset 8846 }, 600, 'easeOutQuad', function() { 8847 8848 }); 8849 8850 return; 8851 }); 8852 } 8853 8854 }); 8855 8856 } 8857 8858 // Side Panel Toggle 8859 if( $('.side-panel-toggle').length ) { 8860 var init_html_class = $('html').attr('class'); 8861 8862 $('.side-panel-toggle').on('click', function(e){ 8863 var extra_class = $(this).data('extra-class'), 8864 delay = ( extra_class ) ? 100 : 0, 8865 isActive = $(this).data('is-active') ? $(this).data('is-active') : false; 8866 8867 e.preventDefault(); 8868 8869 if( isActive ) { 8870 $('html').removeClass('side-panel-open'); 8871 $(this).data('is-active', false); 8872 return false; 8873 } 8874 8875 if( extra_class ) { 8876 $('.side-panel-wrapper').css('transition','none'); 8877 $('html') 8878 .removeClass() 8879 .addClass( init_html_class ) 8880 .addClass( extra_class ); 8881 } 8882 setTimeout(function(){ 8883 $('.side-panel-wrapper').css('transition',''); 8884 $('html').toggleClass('side-panel-open'); 8885 }, delay); 8886 8887 $(this).data('is-active', true); 8888 }); 8889 8890 $(document).on('click', function(e){ 8891 if( !$(e.target).closest('.side-panel-wrapper').length && !$(e.target).hasClass('side-panel-toggle') ) { 8892 $('.hamburguer-btn.side-panel-toggle:not(.side-panel-close)').removeClass('active'); 8893 $('html').removeClass('side-panel-open'); 8894 $('.side-panel-toggle').data('is-active', false); 8895 } 8896 }); 8897 } 8898 8899 return this; 8900 }, 8901 8902 scrollToTarget: function(target, offset) { 8903 var self = this, 8904 targetPosition = $(target).offset().top; 8905 8906 $('body').addClass('scrolling'); 8907 8908 $('html, body').animate({ 8909 scrollTop: $(target).offset().top - offset 8910 }, self.options.scrollDelay, self.options.scrollAnimation, function() { 8911 $('body').removeClass('scrolling'); 8912 8913 // If by some reason the scroll finishes in a wrong position, this code will run the scrollToTarget() again until get the correct position 8914 // We need do it just one time to prevent infinite recursive loop at scrollToTarget() function 8915 if( $(target).offset().top != targetPosition) { 8916 $('html, body').animate({ 8917 scrollTop: $(target).offset().top - offset 8918 }, 1, self.options.scrollAnimation, function() {}); 8919 } 8920 }); 8921 8922 return this; 8923 8924 } 8925 8926 } 8927 8928 }); 8929 8930}).apply(this, [window.theme, jQuery]); 8931 8932 8933// Newsletter 8934(function(theme, $) { 8935 8936 theme = theme || {}; 8937 8938 var initialized = false; 8939 8940 $.extend(theme, { 8941 8942 Newsletter: { 8943 8944 defaults: { 8945 wrapper: $('#newsletterForm') 8946 }, 8947 8948 initialize: function($wrapper, opts) { 8949 if (initialized) { 8950 return this; 8951 } 8952 8953 initialized = true; 8954 this.$wrapper = ($wrapper || this.defaults.wrapper); 8955 8956 this 8957 .setOptions(opts) 8958 .build(); 8959 8960 return this; 8961 }, 8962 8963 setOptions: function(opts) { 8964 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options'))); 8965 8966 return this; 8967 }, 8968 8969 build: function() { 8970 if (!($.isFunction($.fn.validate))) { 8971 return this; 8972 } 8973 8974 var self = this, 8975 $email = self.$wrapper.find('#newsletterEmail'), 8976 $success = $('#newsletterSuccess'), 8977 $error = $('#newsletterError'); 8978 8979 self.$wrapper.validate({ 8980 submitHandler: function(form) { 8981 8982 $.ajax({
8983 type: 'POST', 8984 url: self.$wrapper.attr('action'), 8985 data: { 8986 'email': $email.val() 8987 }, 8988 dataType: 'json', 8989 success: function(data) { 8990 if (data.response == 'success') { 8991 8992 $success.removeClass('d-none'); 8993 $error.addClass('d-none'); 8994 8995 $email 8996 .val('') 8997 .blur() 8998 .closest('.control-group') 8999 .removeClass('success') 9000 .removeClass('error'); 9001 9002 } else { 9003 9004 $error.html(data.message); 9005 $error.removeClass('d-none'); 9006 $success.addClass('d-none'); 9007 9008 $email 9009 .blur() 9010 .closest('.control-group') 9011 .removeClass('success') 9012 .addClass('error'); 9013 9014 } 9015 } 9016 }); 9017 9018 }, 9019 rules: { 9020 newsletterEmail: { 9021 required: true, 9022 email: true 9023 } 9024 }, 9025 errorPlacement: function(error, element) { 9026 9027 } 9028 }); 9029 9030 return this; 9031 } 9032 9033 } 9034 9035 }); 9036 9037}).apply(this, [window.theme, jQuery]); 9038 9039// Search 9040(function(theme, $) { 9041 9042 theme = theme || {}; 9043 9044 var initialized = false; 9045 9046 $.extend(theme, { 9047 9048 Search: { 9049 9050 defaults: { 9051 wrapper: $('#searchForm') 9052 }, 9053 9054 initialize: function($wrapper, opts) { 9055 if (initialized) { 9056 return this; 9057 } 9058 9059 initialized = true; 9060 this.$wrapper = ($wrapper || this.defaults.wrapper); 9061 9062 this 9063 .setOptions(opts) 9064 .build(); 9065 9066 return this; 9067 }, 9068 9069 setOptions: function(opts) { 9070 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options'))); 9071 9072 return this; 9073 }, 9074 9075 build: function() { 9076 if (!($.isFunction($.fn.validate))) { 9077 return this; 9078 } 9079 9080 this.$wrapper.validate({ 9081 errorPlacement: function(error, element) {} 9082 }); 9083 9084 // Search Reveal 9085 theme.fn.execOnceTroughEvent( '#header', 'mouseover.search.reveal', function(){ 9086 $('.header-nav-features-search-reveal').each(function() { 9087 var $el = $(this), 9088 $header = $('#header'), 9089 $html = $('html'); 9090 9091 $el.find('.header-nav-features-search-show-icon').on('click', function() { 9092 $el.addClass('show'); 9093 $header.addClass('search-show'); 9094 $html.addClass('search-show'); 9095 $('#headerSearch').focus(); 9096 }); 9097 9098 $el.find('.header-nav-features-search-hide-icon').on('click', function() { 9099 $el.removeClass('show'); 9100 $header.removeClass('search-show'); 9101 $html.removeClass('search-show'); 9102 }); 9103 }); 9104 } ); 9105 9106 return this; 9107 } 9108 9109 } 9110 9111 }); 9112 9113}).apply(this, [window.theme, jQuery]); 9114 9115// Sticky Header 9116(function(theme, $) { 9117 9118 theme = theme || {}; 9119 9120 var initialized = false; 9121 9122 $.extend(theme, { 9123 9124 StickyHeader: { 9125 9126 defaults: { 9127 wrapper: $('#header'), 9128 headerBody: $('#header .header-body'), 9129 stickyEnabled: true, 9130 stickyEnableOnBoxed: true, 9131 stickyEnableOnMobile: false, 9132 stickyStartAt: 0, 9133 stickyStartAtElement: false, 9134 stickySetTop: 0, 9135 stickyEffect: '', 9136 stickyHeaderContainerHeight: false, 9137 stickyChangeLogo: false, 9138 stickyChangeLogoWrapper: true, 9139 stickyForce: false, 9140 stickyScrollUp: false, 9141 stickyScrollValue: 0 9142 }, 9143 9144 initialize: function($wrapper, opts) { 9145 if (initialized) { 9146 return this; 9147 } 9148 9149 initialized = true; 9150 this.$wrapper = ($wrapper || this.defaults.wrapper); 9151 9152 if( this.$wrapper.hasClass('header') ) { 9153 this.$wrapper = $('.header[data-plugin-options]'); 9154 } 9155 9156 this 9157 .setOptions(opts) 9158 .build() 9159 .events(); 9160 9161 return this; 9162 }, 9163 9164 setOptions: function(opts) { 9165 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options'))); 9166 return this; 9167 }, 9168 9169 build: function() { 9170 if( $(window).width() < 992 && this.options.stickyEnableOnMobile == false ) { 9171 $('html').addClass('sticky-header-mobile-disabled'); 9172 return this; 9173 } 9174 9175 if (!this.options.stickyEnableOnBoxed && $('html').hasClass('boxed') || $('html').hasClass('side-header-hamburguer-sidebar') && !this.options.stickyForce || !this.options.stickyEnabled) { 9176 return this; 9177 } 9178 9179 var self = this; 9180 9181 if( self.options.wrapper.hasClass('header') ) { 9182 self.options.wrapper = $('.header'); 9183 self.options.headerBody = $('.header .header-body'); 9184 } 9185 9186 var $html = $('html'), 9187 $window = $(window), 9188 sideHeader = $html.hasClass('side-header'), 9189 initialHeaderTopHeight = self.options.wrapper.find('.header-top').outerHeight(), 9190 initialHeaderContainerHeight = self.options.wrapper.find('.header-container').outerHeight(), 9191 minHeight; 9192 9193 // HTML Classes 9194 $html.addClass('sticky-header-enabled'); 9195 9196 if (parseInt(self.options.stickySetTop) < 0) { 9197 $html.addClass('sticky-header-negative'); 9198 } 9199 9200 if (self.options.stickyScrollUp) { 9201 $html.addClass('sticky-header-scroll-direction'); 9202 } 9203 9204 // Notice Top Bar First Load 9205 if( $('.notice-top-bar').get(0) ) { 9206 if (parseInt(self.options.stickySetTop) == 1 || self.options.stickyEffect == 'shrink') { 9207 $('.body').on('transitionend webkitTransitionEnd oTransitionEnd', function () { 9208 setTimeout(function(){ 9209 if( !$html.hasClass('sticky-header-active') ) { 9210 self.options.headerBody.animate({ 9211 top: $('.notice-top-bar').outerHeight() 9212 }, 300, function(){ 9213 if( $html.hasClass('sticky-header-active') ) { 9214 self.options.headerBody.css('top', 0); 9215 } 9216 }); 9217 } 9218 }, 0); 9219 });
9220 } 9221 } 9222 9223 // Set Start At 9224 if(self.options.stickyStartAtElement) { 9225 9226 var $stickyStartAtElement = $(self.options.stickyStartAtElement); 9227 9228 $(window).on('scroll resize sticky.header.resize', function() { 9229 self.options.stickyStartAt = $stickyStartAtElement.offset().top; 9230 }); 9231 9232 $(window).trigger('sticky.header.resize'); 9233 } 9234 9235 // Define Min Height value 9236 if( self.options.wrapper.find('.header-top').get(0) ) { 9237 minHeight = ( initialHeaderTopHeight + initialHeaderContainerHeight ); 9238 } else { 9239 minHeight = initialHeaderContainerHeight; 9240 } 9241 9242 // Set Wrapper Min-Height 9243 if( !sideHeader ) { 9244 if( !$('.header-logo-sticky-change').get(0) ) { 9245 self.options.wrapper.css('height', self.options.headerBody.outerHeight()); 9246 } else { 9247 $window.on('stickyChangeLogo.loaded', function(){ 9248 self.options.wrapper.css('height', self.options.headerBody.outerHeight()); 9249 }); 9250 } 9251 9252 if( self.options.stickyEffect == 'shrink' ) { 9253 9254 // Prevent wrong visualization of header when reload on middle of page 9255 $(document).ready(function(){ 9256 if( $window.scrollTop() >= self.options.stickyStartAt ) { 9257 self.options.wrapper.find('.header-container').on('transitionend webkitTransitionEnd oTransitionEnd', function(){ 9258 self.options.headerBody.css('position', 'fixed'); 9259 });
9260 } else { 9261 if( !$html.hasClass('boxed') ) { 9262 self.options.headerBody.css('position', 'fixed'); 9263 } 9264 } 9265 }); 9266 9267 self.options.wrapper.find('.header-container').css('height', initialHeaderContainerHeight); 9268 self.options.wrapper.find('.header-top').css('height', initialHeaderTopHeight); 9269 } 9270 } 9271 9272 // Sticky Header Container Height 9273 if( self.options.stickyHeaderContainerHeight ) { 9274 self.options.wrapper.find('.header-container').css('height', self.options.wrapper.find('.header-container').outerHeight()); 9275 } 9276 9277 // Boxed 9278 if($html.hasClass('boxed') && self.options.stickyEffect == 'shrink') { 9279 self.boxedLayout(); 9280 } 9281 9282 // Check Sticky Header / Flags prevent multiple runs at same time 9283 var activate_flag = true, 9284 deactivate_flag = false, 9285 initialStickyStartAt = self.options.stickyStartAt; 9286 9287 self.checkStickyHeader = function() { 9288 9289 // Notice Top Bar 9290 var $noticeTopBar = $('.notice-top-bar'); 9291 if ( $noticeTopBar.get(0) ) { 9292 self.options.stickyStartAt = ( $noticeTopBar.data('sticky-start-at') ) ? $noticeTopBar.data('sticky-start-at') : $('.notice-top-bar').outerHeight(); 9293 } else { 9294 if( $html.hasClass('boxed') ) { 9295 self.options.stickyStartAt = initialStickyStartAt + 25; 9296 } else { 9297 self.options.stickyStartAt = initialStickyStartAt; 9298 } 9299 } 9300 9301 if( $window.width() > 991 && $html.hasClass('side-header') ) { 9302 $html.removeClass('sticky-header-active'); 9303 activate_flag = true; 9304 return; 9305 } 9306 9307 if ($window.scrollTop() >= parseInt(self.options.stickyStartAt)) { 9308 if( activate_flag ) { 9309 self.activateStickyHeader(); 9310 activate_flag = false; 9311 deactivate_flag = true; 9312 } 9313 } else { 9314 if( deactivate_flag ) { 9315 self.deactivateStickyHeader(); 9316 deactivate_flag = false; 9317 activate_flag = true; 9318 } 9319 } 9320 9321 // Scroll Up 9322 if (self.options.stickyScrollUp) { 9323 9324 // Get the new Value 9325 self.options.stickyScrollNewValue = window.pageYOffset; 9326 9327 //Subtract the two and conclude 9328 if(self.options.stickyScrollValue - self.options.stickyScrollNewValue < 0){ 9329 $html.removeClass('sticky-header-scroll-up').addClass('sticky-header-scroll-down'); 9330 } else if(self.options.stickyScrollValue - self.options.stickyScrollNewValue > 0){ 9331 $html.removeClass('sticky-header-scroll-down').addClass('sticky-header-scroll-up'); 9332 } 9333 9334 // Update the old value 9335 self.options.stickyScrollValue = self.options.stickyScrollNewValue; 9336 9337 } 9338 }; 9339 9340 // Activate Sticky Header 9341 self.activateStickyHeader = function() { 9342 if ($window.width() < 992) { 9343 if (self.options.stickyEnableOnMobile == false) { 9344 self.deactivateStickyHeader(); 9345 self.options.headerBody.css({ 9346 position: 'relative' 9347 }); 9348 return false; 9349 } 9350 } else { 9351 if (sideHeader) { 9352 self.deactivateStickyHeader(); 9353 return; 9354 } 9355 } 9356 9357 $html.addClass('sticky-header-active'); 9358 9359 // Sticky Effect - Reveal 9360 if( self.options.stickyEffect == 'reveal' ) { 9361 9362 self.options.headerBody.css('top','-' + self.options.stickyStartAt + 'px'); 9363 9364 self.options.headerBody.animate({ 9365 top: self.options.stickySetTop 9366 }, 400, function() {}); 9367 9368 } 9369 9370 // Sticky Effect - Shrink 9371 if( self.options.stickyEffect == 'shrink' ) { 9372 9373 // If Header Top 9374 if( self.options.wrapper.find('.header-top').get(0) ) { 9375 self.options.wrapper.find('.header-top').css({ 9376 height: 0, 9377 'min-height': 0, 9378 overflow: 'hidden' 9379 }); 9380 } 9381 9382 // Header Container 9383 if( self.options.stickyHeaderContainerHeight ) { 9384 self.options.wrapper.find('.header-container').css({ 9385 height: self.options.stickyHeaderContainerHeight, 9386 'min-height': 0 9387 }); 9388 } else { 9389 self.options.wrapper.find('.header-container').css({ 9390 height: (initialHeaderContainerHeight / 3) * 2, // two third of container height 9391 'min-height': 0 9392 });
9393 9394 var y = initialHeaderContainerHeight - ((initialHeaderContainerHeight / 3) * 2); 9395 $('.main').css({ 9396 transform: 'translate3d(0, -'+ y +'px, 0)', 9397 transition: 'ease transform 300ms' 9398 }).addClass('has-sticky-header-transform'); 9399 9400 if($html.hasClass('boxed')) { 9401 self.options.headerBody.css('position','fixed'); 9402 } 9403 } 9404 9405 } 9406 9407 self.options.headerBody.css('top', self.options.stickySetTop); 9408 9409 if (self.options.stickyChangeLogo) { 9410 self.changeLogo(true); 9411 } 9412 9413 // Set Elements Style 9414 if( $('[data-sticky-header-style]').length ) { 9415 $('[data-sticky-header-style]').each(function() { 9416 var $el = $(this), 9417 css = theme.fn.getOptions($el.data('sticky-header-style-active')), 9418 opts = theme.fn.getOptions($el.data('sticky-header-style')); 9419 9420 if( $window.width() > opts.minResolution ) { 9421 $el.css(css); 9422 } 9423 }); 9424 } 9425 9426 $.event.trigger({ 9427 type: 'stickyHeader.activate' 9428 }); 9429 }; 9430 9431 // Deactivate Sticky Header 9432 self.deactivateStickyHeader = function() { 9433 $html.removeClass('sticky-header-active'); 9434 9435 if ( $(window).width() < 992 && self.options.stickyEnableOnMobile == false) { 9436 return false; 9437 } 9438 9439 // Sticky Effect - Shrink 9440 if( self.options.stickyEffect == 'shrink' ) { 9441 9442 // Boxed Layout 9443 if( $html.hasClass('boxed') ) { 9444 9445 // Set Header Body Position Absolute 9446 self.options.headerBody.css('position','absolute'); 9447 9448 if( $window.scrollTop() > $('.body').offset().top ) { 9449 // Set Header Body Position Fixed 9450 self.options.headerBody.css('position','fixed'); 9451 } 9452 9453 } else { 9454 // Set Header Body Position Fixed 9455 self.options.headerBody.css('position','fixed'); 9456 } 9457 9458 // If Header Top 9459 if( self.options.wrapper.find('.header-top').get(0) ) { 9460 self.options.wrapper.find('.header-top').css({ 9461 height: initialHeaderTopHeight, 9462 overflow: 'visible' 9463 }); 9464 9465 // Fix [data-icon] issue when first load is on middle of the page 9466 if( self.options.wrapper.find('.header-top [data-icon]').length ) { 9467 theme.fn.intObsInit( '.header-top [data-icon]:not(.svg-inline--fa)', 'themePluginIcon' ); 9468 } 9469 } 9470 9471 // Header Container 9472 self.options.wrapper.find('.header-container').css({ 9473 height: initialHeaderContainerHeight 9474 }); 9475 9476 } 9477 9478 self.options.headerBody.css('top', 0); 9479 9480 if (self.options.stickyChangeLogo) { 9481 self.changeLogo(false); 9482 } 9483 9484 // Set Elements Style 9485 if( $('[data-sticky-header-style]').length ) { 9486 $('[data-sticky-header-style]').each(function() { 9487 var $el = $(this), 9488 css = theme.fn.getOptions($el.data('sticky-header-style-deactive')), 9489 opts = theme.fn.getOptions($el.data('sticky-header-style')); 9490 9491 if( $window.width() > opts.minResolution ) { 9492 $el.css(css); 9493 } 9494 }); 9495 } 9496 9497 $.event.trigger({ 9498 type: 'stickyHeader.deactivate' 9499 }); 9500 }; 9501 9502 // Always Sticky 9503 if (parseInt(self.options.stickyStartAt) <= 0) { 9504 self.activateStickyHeader(); 9505 } 9506 9507 // Set Logo 9508 if (self.options.stickyChangeLogo) { 9509 9510 var $logoWrapper = self.options.wrapper.find('.header-logo'), 9511 $logo = $logoWrapper.find('img'), 9512 logoWidth = $logo.attr('width'), 9513 logoHeight = $logo.attr('height'), 9514 logoSmallTop = parseInt($logo.attr('data-sticky-top') ? $logo.attr('data-sticky-top') : 0), 9515 logoSmallWidth = parseInt($logo.attr('data-sticky-width') ? $logo.attr('data-sticky-width') : 'auto'), 9516 logoSmallHeight = parseInt($logo.attr('data-sticky-height') ? $logo.attr('data-sticky-height') : 'auto'); 9517 9518 if (self.options.stickyChangeLogoWrapper) { 9519 $logoWrapper.css({ 9520 'width': $logo.outerWidth(true), 9521 'height': $logo.outerHeight(true) 9522 }); 9523 } 9524 9525 self.changeLogo = function(activate) { 9526 if(activate) { 9527 9528 $logo.css({ 9529 'top': logoSmallTop, 9530 'width': logoSmallWidth, 9531 'height': logoSmallHeight 9532 });
9533 9534 } else { 9535 9536 $logo.css({ 9537 'top': 0, 9538 'width': logoWidth, 9539 'height': logoHeight 9540 }); 9541 9542 } 9543 } 9544 9545 $.event.trigger({ 9546 type: 'stickyChangeLogo.loaded' 9547 }); 9548 9549 } 9550 9551 // Side Header 9552 var headerBodyHeight, 9553 flag = false; 9554 9555 self.checkSideHeader = function() { 9556 if($window.width() < 992 && flag == false) { 9557 headerBodyHeight = self.options.headerBody.height(); 9558 flag = true; 9559 } 9560 9561 if(self.options.stickyStartAt == 0 && sideHeader) { 9562 self.options.wrapper.css('min-height', 0); 9563 } 9564 9565 if(self.options.stickyStartAt > 0 && sideHeader && $window.width() < 992) { 9566 self.options.wrapper.css('min-height', headerBodyHeight); 9567 } 9568 } 9569 9570 return this; 9571 }, 9572 9573 events: function() { 9574 var self = this; 9575 9576 if( $(window).width() < 992 && this.options.stickyEnableOnMobile == false ) { 9577 return this; 9578 } 9579 9580 if (!this.options.stickyEnableOnBoxed && $('body').hasClass('boxed') || $('html').hasClass('side-header-hamburguer-sidebar') && !this.options.stickyForce || !this.options.stickyEnabled) { 9581 return this; 9582 } 9583 9584 if (!self.options.alwaysStickyEnabled) { 9585 $(window).on('scroll resize', function() { 9586 if ( $(window).width() < 992 && self.options.stickyEnableOnMobile == false) { 9587 self.options.headerBody.css({ 9588 position: '' 9589 }); 9590 9591 if( self.options.stickyEffect == 'shrink' ) { 9592 self.options.wrapper.find('.header-top').css({ 9593 height: '' 9594 });
9595 } 9596 9597 self.deactivateStickyHeader(); 9598 } else { 9599 self.checkStickyHeader(); 9600 } 9601 }); 9602 } else { 9603 self.activateStickyHeader(); 9604 } 9605 9606 $(window).on('load resize', function(){ 9607 self.checkSideHeader(); 9608 }); 9609 9610 $(window).on('layout.boxed', function(){ 9611 self.boxedLayout(); 9612 }); 9613 9614 return this; 9615 }, 9616 9617 boxedLayout: function(){ 9618 var self = this, 9619 $window = $(window); 9620 9621 if($('html').hasClass('boxed') && self.options.stickyEffect == 'shrink') { 9622 if( (parseInt(self.options.stickyStartAt) == 0) && $window.width() > 991) { 9623 self.options.stickyStartAt = 30; 9624 } 9625 9626 // Set Header Body Position Absolute 9627 self.options.headerBody.css({ 9628 position: 'absolute', 9629 top: 0 9630 }); 9631 9632 // Set position absolute because top margin from boxed layout 9633 $window.on('scroll', function(){ 9634 if( $window.scrollTop() > $('.body').offset().top ) { 9635 self.options.headerBody.css({ 9636 'position' : 'fixed', 9637 'top' : 0 9638 }); 9639 } else { 9640 self.options.headerBody.css({ 9641 'position' : 'absolute', 9642 'top' : 0 9643 }); 9644 } 9645 }); 9646 } 9647 9648 return this; 9649 } 9650 9651 } 9652 9653 }); 9654 9655}).apply(this, [window.theme, jQuery]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.