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