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