1/* 2Name: Theme Base 3Written by: Okler Themes - (http://www.okler.net) 4Theme Version: 5.7.1 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}; 36 37// Animate 38(function(theme, $) { 39 40 theme = theme || {}; 41 42 var instanceName = '__animate'; 43 44 var PluginAnimate = function($el, opts) { 45 return this.initialize($el, opts); 46 }; 47 48 PluginAnimate.defaults = { 49 accX: 0, 50 accY: -150, 51 delay: 1, 52 duration: '1s' 53 }; 54 55 PluginAnimate.prototype = { 56 initialize: function($el, opts) { 57 if ($el.data(instanceName)) { 58 return this; 59 } 60 61 this.$el = $el; 62 63 this 64 .setData() 65 .setOptions(opts) 66 .build(); 67 68 return this; 69 }, 70 71 setData: function() { 72 this.$el.data(instanceName, this); 73 74 return this; 75 }, 76 77 setOptions: function(opts) { 78 this.options = $.extend(true, {}, PluginAnimate.defaults, opts, { 79 wrapper: this.$el 80 }); 81 82 return this; 83 }, 84 85 build: function() { 86 var self = this, 87 $el = this.options.wrapper, 88 delay = 0, 89 duration = '1s'; 90 91 $el.addClass('appear-animation animated'); 92 93 if (!$('html').hasClass('no-csstransitions') && $(window).width() > 767) { 94 95 $el.appear(function() { 96 97 $el.one('animation:show', function(ev) { 98 delay = ($el.attr('data-appear-animation-delay') ? $el.attr('data-appear-animation-delay') : self.options.delay); 99 duration = ($el.attr('data-appear-animation-duration') ? $el.attr('data-appear-animation-duration') : self.options.duration); 100 101 if (duration != '1s') { 102 $el.css('animation-duration', duration); 103 } 104 105 setTimeout(function() { 106 $el.addClass($el.attr('data-appear-animation') + ' appear-animation-visible'); 107 }, delay); 108 }); 109 110 $el.trigger('animation:show'); 111 112 }, { 113 accX: self.options.accX, 114 accY: self.options.accY 115 }); 116 117 } else { 118 119 $el.addClass('appear-animation-visible'); 120 121 } 122 123 return this; 124 } 125 }; 126 127 // expose to scope 128 $.extend(theme, { 129 PluginAnimate: PluginAnimate 130 }); 131 132 // jquery plugin 133 $.fn.themePluginAnimate = function(opts) { 134 return this.map(function() { 135 var $this = $(this); 136 137 if ($this.data(instanceName)) { 138 return $this.data(instanceName); 139 } else { 140 return new PluginAnimate($this, opts); 141 } 142 143 }); 144 }; 145 146}).apply(this, [window.theme, jQuery]); 147 148// Carousel 149(function(theme, $) { 150 151 theme = theme || {}; 152 153 var instanceName = '__carousel'; 154 155 var PluginCarousel = function($el, opts) { 156 return this.initialize($el, opts); 157 }; 158 159 PluginCarousel.defaults = { 160 loop: true, 161 responsive: { 162 0: { 163 items: 1 164 }, 165 479: { 166 items: 1 167 }, 168 768: { 169 items: 2 170 }, 171 979: { 172 items: 3 173 }, 174 1199: { 175 items: 4 176 } 177 }, 178 navText: [] 179 }; 180 181 PluginCarousel.prototype = { 182 initialize: function($el, opts) { 183 if ($el.data(instanceName)) { 184 return this; 185 } 186 187 this.$el = $el; 188 189 this 190 .setData() 191 .setOptions(opts) 192 .build(); 193 194 return this; 195 }, 196 197 setData: function() { 198 this.$el.data(instanceName, this); 199 200 return this; 201 }, 202 203 setOptions: function(opts) { 204 this.options = $.extend(true, {}, PluginCarousel.defaults, opts, { 205 wrapper: this.$el 206 }); 207 208 return this; 209 }, 210 211 build: function() { 212 if (!($.isFunction($.fn.owlCarousel))) { 213 return this; 214 } 215 216 var self = this, 217 $el = this.options.wrapper; 218 219 // Add Theme Class 220 $el.addClass('owl-theme'); 221 222 // Force RTL according to HTML dir attribute 223 if ($('html').attr('dir') == 'rtl') { 224 this.options = $.extend(true, {}, this.options, { 225 rtl: true 226 }); 227 } 228 229 if (this.options.items == 1) { 230 this.options.responsive = {} 231 } 232 233 if (this.options.items > 4) { 234 this.options = $.extend(true, {}, this.options, { 235 responsive: { 236 1199: { 237 items: this.options.items 238 } 239 } 240 }); 241 } 242 243 // Auto Height Fixes 244 if (this.options.autoHeight) { 245 var itemsHeight = []; 246 247 $el.find('.owl-item').each(function(){ 248 if( $(this).hasClass('active') ) { 249 itemsHeight.push( $(this).height() ); 250 } 251 }); 252 253 $(window).afterResize(function() { 254 $el.find('.owl-stage-outer').height( Math.max.apply(null, itemsHeight) ); 255 }); 256 257 $(window).on('load', function() { 258 $el.find('.owl-stage-outer').height( Math.max.apply(null, itemsHeight) ); 259 }); 260 } 261 262 // Initialize OwlCarousel
263 $el.owlCarousel(this.options).addClass('owl-carousel-init'); 264 265 return this; 266 } 267 }; 268 269 // expose to scope 270 $.extend(theme, { 271 PluginCarousel: PluginCarousel 272 }); 273 274 // jquery plugin 275 $.fn.themePluginCarousel = function(opts) { 276 return this.map(function() { 277 var $this = $(this); 278 279 if ($this.data(instanceName)) { 280 return $this.data(instanceName); 281 } else { 282 return new PluginCarousel($this, opts); 283 } 284 285 }); 286 } 287 288}).apply(this, [window.theme, jQuery]); 289 290// Chart Circular 291(function(theme, $) { 292 293 theme = theme || {}; 294 295 var instanceName = '__chartCircular'; 296 297 var PluginChartCircular = function($el, opts) { 298 return this.initialize($el, opts); 299 }; 300 301 PluginChartCircular.defaults = { 302 accX: 0, 303 accY: -150, 304 delay: 1, 305 barColor: '#0088CC', 306 trackColor: '#f2f2f2', 307 scaleColor: false, 308 scaleLength: 5, 309 lineCap: 'round', 310 lineWidth: 13, 311 size: 175, 312 rotate: 0, 313 animate: ({ 314 duration: 2500, 315 enabled: true 316 }) 317 }; 318 319 PluginChartCircular.prototype = { 320 initialize: function($el, opts) { 321 if ($el.data(instanceName)) { 322 return this; 323 } 324 325 this.$el = $el; 326 327 this 328 .setData() 329 .setOptions(opts) 330 .build(); 331 332 return this; 333 }, 334 335 setData: function() { 336 this.$el.data(instanceName, this); 337 338 return this; 339 }, 340 341 setOptions: function(opts) { 342 this.options = $.extend(true, {}, PluginChartCircular.defaults, opts, { 343 wrapper: this.$el 344 }); 345 346 return this; 347 }, 348 349 build: function() { 350 if (!($.isFunction($.fn.appear)) || !($.isFunction($.fn.easyPieChart))) { 351 return this; 352 } 353 354 var self = this, 355 $el = this.options.wrapper, 356 value = ($el.attr('data-percent') ? $el.attr('data-percent') : 0), 357 percentEl = $el.find('.percent'); 358 359 $.extend(true, self.options, { 360 onStep: function(from, to, currentValue) { 361 percentEl.html(parseInt(currentValue)); 362 } 363 }); 364 365 $el.attr('data-percent', 0); 366 367 $el.appear(function() { 368 369 $el.easyPieChart(self.options); 370 371 setTimeout(function() { 372 373 $el.data('easyPieChart').update(value); 374 $el.attr('data-percent', value); 375 376 }, self.options.delay); 377 378 }, { 379 accX: self.options.accX, 380 accY: self.options.accY 381 }); 382 383 return this; 384 } 385 }; 386 387 // expose to scope 388 $.extend(theme, { 389 PluginChartCircular: PluginChartCircular 390 }); 391 392 // jquery plugin 393 $.fn.themePluginChartCircular = function(opts) { 394 return this.map(function() { 395 var $this = $(this); 396 397 if ($this.data(instanceName)) { 398 return $this.data(instanceName); 399 } else { 400 return new PluginChartCircular($this, opts); 401 } 402 403 }); 404 } 405 406}).apply(this, [window.theme, jQuery]); 407 408// Counter 409(function(theme, $) { 410 411 theme = theme || {}; 412 413 var instanceName = '__counter'; 414 415 var PluginCounter = function($el, opts) { 416 return this.initialize($el, opts); 417 }; 418 419 PluginCounter.defaults = { 420 accX: 0, 421 accY: 0, 422 speed: 3000, 423 refreshInterval: 100, 424 decimals: 0, 425 onUpdate: null, 426 onComplete: null 427 }; 428 429 PluginCounter.prototype = { 430 initialize: function($el, opts) { 431 if ($el.data(instanceName)) { 432 return this; 433 } 434 435 this.$el = $el; 436 437 this 438 .setData() 439 .setOptions(opts) 440 .build(); 441 442 return this; 443 }, 444 445 setData: function() { 446 this.$el.data(instanceName, this); 447 448 return this; 449 }, 450 451 setOptions: function(opts) { 452 this.options = $.extend(true, {}, PluginCounter.defaults, opts, { 453 wrapper: this.$el 454 }); 455 456 return this; 457 }, 458 459 build: function() { 460 if (!($.isFunction($.fn.countTo))) { 461 return this; 462 } 463 464 var self = this, 465 $el = this.options.wrapper; 466 467 $.extend(self.options, { 468 onComplete: function() { 469 if ($el.data('append')) { 470 $el.html($el.html() + $el.data('append')); 471 } 472 473 if ($el.data('prepend')) { 474 $el.html($el.data('prepend') + $el.html()); 475 } 476 } 477 }); 478 479 $el.appear(function() { 480 481 $el.countTo(self.options); 482 483 }, { 484 accX: self.options.accX, 485 accY: self.options.accY 486 }); 487 488 return this; 489 } 490 }; 491 492 // expose to scope 493 $.extend(theme, { 494 PluginCounter: PluginCounter 495 }); 496 497 // jquery plugin 498 $.fn.themePluginCounter = function(opts) { 499 return this.map(function() { 500 var $this = $(this); 501 502 if ($this.data(instanceName)) { 503 return $this.data(instanceName); 504 } else { 505 return new PluginCounter($this, opts); 506 } 507 508 }); 509 } 510 511}).apply(this, [window.theme, jQuery]); 512 513// Lazy Load 514(function(theme, $) { 515 516 theme = theme || {}; 517 518 var instanceName = '__lazyload'; 519 520 var PluginLazyLoad = function($el, opts) { 521 return this.initialize($el, opts); 522 }; 523 524 PluginLazyLoad.defaults = { 525 effect: 'show', 526 appearEffect: '', 527 appear: function(elements_left, settings) { 528 529 }, 530 load: function(elements_left, settings) { 531 $(this).addClass($.trim('lazy-load-loaded ' + settings.appearEffect)); 532 } 533 }; 534 535 PluginLazyLoad.prototype = { 536 initialize: function($el, opts) { 537 if ($el.data(instanceName)) { 538 return this; 539 } 540 541 this.$el = $el; 542 543 this 544 .setData() 545 .setOptions(opts) 546 .build(); 547 548 return this; 549 }, 550 551 setData: function() { 552 this.$el.data(instanceName, this); 553 554 return this; 555 }, 556 557 setOptions: function(opts) { 558 this.options = $.extend(true, {}, PluginLazyLoad.defaults, opts, { 559 wrapper: this.$el 560 }); 561 562 return this; 563 }, 564 565 build: function() { 566 if (!($.isFunction($.fn.lazyload))) { 567 return this; 568 } 569 570 var self = this; 571 572 self.options.wrapper.lazyload(this.options); 573 574 return this; 575 } 576 }; 577 578 // expose to scope 579 $.extend(theme, { 580 PluginLazyLoad: PluginLazyLoad 581 }); 582 583 // jquery plugin 584 $.fn.themePluginLazyLoad = function(opts) { 585 return this.map(function() { 586 var $this = $(this); 587 588 if ($this.data(instanceName)) { 589 return $this.data(instanceName); 590 } else { 591 return new PluginLazyLoad($this, opts); 592 } 593 594 }); 595 } 596 597}).apply(this, [window.theme, jQuery]); 598 599// Lightbox 600(function(theme, $) { 601 602 theme = theme || {}; 603 604 var instanceName = '__lightbox'; 605 606 var PluginLightbox = function($el, opts) { 607 return this.initialize($el, opts); 608 }; 609 610 PluginLightbox.defaults = { 611 tClose: 'Close (Esc)', // Alt text on close button 612 tLoading: 'Loading...', // Text that is displayed during loading. Can contain %curr% and %total% keys 613 gallery: { 614 tPrev: 'Previous (Left arrow key)', // Alt text on left arrow 615 tNext: 'Next (Right arrow key)', // Alt text on right arrow 616 tCounter: '%curr% of %total%' // Markup for "1 of 7" counter 617 }, 618 image: { 619 tError: '<a href="%url%">The image</a> could not be loaded.' // Error message when image could not be loaded 620 }, 621 ajax: { 622 tError: '<a href="%url%">The content</a> could not be loaded.' // Error message when ajax request failed 623 }, 624 callbacks: { 625 open: function() { 626 $('html').addClass('lightbox-opened'); 627 }, 628 close: function() { 629 $('html').removeClass('lightbox-opened'); 630 } 631 } 632 }; 633 634 PluginLightbox.prototype = { 635 initialize: function($el, opts) { 636 if ($el.data(instanceName)) { 637 return this; 638 } 639 640 this.$el = $el; 641 642 this 643 .setData() 644 .setOptions(opts) 645 .build(); 646 647 return this; 648 }, 649 650 setData: function() { 651 this.$el.data(instanceName, this); 652 653 return this; 654 }, 655 656 setOptions: function(opts) { 657 this.options = $.extend(true, {}, PluginLightbox.defaults, opts, { 658 wrapper: this.$el 659 }); 660 661 return this; 662 }, 663 664 build: function() { 665 if (!($.isFunction($.fn.magnificPopup))) { 666 return this; 667 } 668 669 this.options.wrapper.magnificPopup(this.options); 670 671 return this; 672 } 673 }; 674 675 // expose to scope 676 $.extend(theme, { 677 PluginLightbox: PluginLightbox 678 }); 679 680 // jquery plugin 681 $.fn.themePluginLightbox = function(opts) { 682 return this.map(function() { 683 var $this = $(this); 684 685 if ($this.data(instanceName)) { 686 return $this.data(instanceName); 687 } else { 688 return new PluginLightbox($this, opts); 689 } 690 691 }); 692 } 693 694}).apply(this, [window.theme, jQuery]); 695 696// Loading Overlay 697(function(theme, $) { 698 699 'use strict'; 700 701 theme = theme || {}; 702 703 var loadingOverlayTemplate = [ 704 '<div class="loading-overlay">', 705 '<div class="bounce-loader"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>', 706 '</div>' 707 ].join(''); 708 709 var LoadingOverlay = function( $wrapper, options ) { 710 return this.initialize( $wrapper, options ); 711 }; 712 713 LoadingOverlay.prototype = { 714 715 options: { 716 css: {} 717 }, 718 719 initialize: function( $wrapper, options ) { 720 this.$wrapper = $wrapper; 721 722 this 723 .setVars() 724 .setOptions( options ) 725 .build() 726 .events(); 727 728 this.$wrapper.data( 'loadingOverlay', this ); 729 }, 730 731 setVars: function() {
732 this.$overlay = this.$wrapper.find('.loading-overlay'); 733 734 return this; 735 }, 736 737 setOptions: function( options ) { 738 if ( !this.$overlay.get(0) ) { 739 this.matchProperties(); 740 } 741 this.options = $.extend( true, {}, this.options, options ); 742 this.loaderClass = this.getLoaderClass( this.options.css.backgroundColor ); 743 744 return this; 745 }, 746 747 build: function() { 748 if ( !this.$overlay.closest(document.documentElement).get(0) ) { 749 if ( !this.$cachedOverlay ) { 750 this.$overlay = $( loadingOverlayTemplate ).clone(); 751 752 if ( this.options.css ) { 753 this.$overlay.css( this.options.css ); 754 this.$overlay.find( '.loader' ).addClass( this.loaderClass ); 755 } 756 } else { 757 this.$overlay = this.$cachedOverlay.clone(); 758 } 759 760 this.$wrapper.append( this.$overlay ); 761 } 762 763 if ( !this.$cachedOverlay ) { 764 this.$cachedOverlay = this.$overlay.clone(); 765 } 766 767 return this; 768 }, 769 770 events: function() { 771 var _self = this; 772 773 if ( this.options.startShowing ) { 774 _self.show(); 775 } 776 777 if ( this.$wrapper.is('body') || this.options.hideOnWindowLoad ) { 778 $( window ).on( 'load error', function() { 779 _self.hide(); 780 }); 781 } 782 783 if ( this.options.listenOn ) { 784 $( this.options.listenOn ) 785 .on( 'loading-overlay:show beforeSend.ic', function( e ) { 786 e.stopPropagation(); 787 _self.show(); 788 }) 789 .on( 'loading-overlay:hide complete.ic', function( e ) { 790 e.stopPropagation(); 791 _self.hide(); 792 }); 793 } 794 795 this.$wrapper 796 .on( 'loading-overlay:show beforeSend.ic', function( e ) { 797 if ( e.target === _self.$wrapper.get(0) ) { 798 e.stopPropagation(); 799 _self.show(); 800 return true; 801 } 802 return false; 803 }) 804 .on( 'loading-overlay:hide complete.ic', function( e ) { 805 if ( e.target === _self.$wrapper.get(0) ) { 806 e.stopPropagation(); 807 _self.hide(); 808 return true; 809 } 810 return false; 811 }); 812 813 return this; 814 }, 815 816 show: function() { 817 this.build(); 818 819 this.position = this.$wrapper.css( 'position' ).toLowerCase(); 820 if ( this.position != 'relative' || this.position != 'absolute' || this.position != 'fixed' ) { 821 this.$wrapper.css({ 822 position: 'relative' 823 }); 824 } 825 this.$wrapper.addClass( 'loading-overlay-showing' ); 826 }, 827 828 hide: function() { 829 var _self = this; 830 831 this.$wrapper.removeClass( 'loading-overlay-showing' ); 832 setTimeout(function() { 833 if ( this.position != 'relative' || this.position != 'absolute' || this.position != 'fixed' ) { 834 _self.$wrapper.css({ position: '' }); 835 } 836 }, 500); 837 }, 838 839 matchProperties: function() { 840 var i, 841 l, 842 properties; 843 844 properties = [ 845 'backgroundColor', 846 'borderRadius' 847 ]; 848 849 l = properties.length; 850 851 for( i = 0; i < l; i++ ) { 852 var obj = {}; 853 obj[ properties[ i ] ] = this.$wrapper.css( properties[ i ] ); 854 855 $.extend( this.options.css, obj ); 856 } 857 }, 858 859 getLoaderClass: function( backgroundColor ) { 860 if ( !backgroundColor || backgroundColor === 'transparent' || backgroundColor === 'inherit' ) { 861 return 'black'; 862 } 863 864 var hexColor, 865 r, 866 g, 867 b, 868 yiq; 869 870 var colorToHex = function( color ){ 871 var hex, 872 rgb; 873 874 if( color.indexOf('#') >- 1 ){ 875 hex = color.replace('#', ''); 876 } else { 877 rgb = color.match(/\d+/g); 878 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); 879 } 880 881 if ( hex.length === 3 ) { 882 hex = hex + hex; 883 } 884 885 return hex; 886 }; 887 888 hexColor = colorToHex( backgroundColor ); 889 890 r = parseInt( hexColor.substr( 0, 2), 16 ); 891 g = parseInt( hexColor.substr( 2, 2), 16 ); 892 b = parseInt( hexColor.substr( 4, 2), 16 ); 893 yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000; 894 895 return ( yiq >= 128 ) ? 'black' : 'white'; 896 } 897 898 }; 899 900 // expose to scope 901 $.extend(theme, { 902 LoadingOverlay: LoadingOverlay 903 }); 904 905 // expose as a jquery plugin 906 $.fn.loadingOverlay = function( opts ) { 907 return this.each(function() { 908 var $this = $( this ); 909 910 var loadingOverlay = $this.data( 'loadingOverlay' ); 911 if ( loadingOverlay ) { 912 return loadingOverlay; 913 } else { 914 var options = opts || $this.data( 'loading-overlay-options' ) || {}; 915 return new LoadingOverlay( $this, options ); 916 } 917 }); 918 } 919 920 // auto init 921 $('[data-loading-overlay]').loadingOverlay(); 922 923}).apply(this, [window.theme, jQuery]); 924 925// Masonry 926(function(theme, $) { 927 928 theme = theme || {}; 929 930 var instanceName = '__masonry'; 931 932 var PluginMasonry = function($el, opts) { 933 return this.initialize($el, opts); 934 }; 935 936 PluginMasonry.defaults = { 937 itemSelector: 'li' 938 }; 939 940 PluginMasonry.prototype = { 941 initialize: function($el, opts) { 942 if ($el.data(instanceName)) { 943 return this; 944 } 945 946 this.$el = $el; 947 948 this 949 .setData() 950 .setOptions(opts) 951 .build(); 952 953 return this; 954 }, 955 956 setData: function() { 957 this.$el.data(instanceName, this); 958 959 return this; 960 }, 961 962 setOptions: function(opts) { 963 this.options = $.extend(true, {}, PluginMasonry.defaults, opts, { 964 wrapper: this.$el 965 }); 966 967 return this; 968 }, 969 970 build: function() { 971 if (!($.isFunction($.fn.isotope))) { 972 return this; 973 } 974 975 var self = this, 976 $window = $(window); 977 978 self.$loader = false;
979 980 if (self.options.wrapper.parents('.masonry-loader').get(0)) { 981 self.$loader = self.options.wrapper.parents('.masonry-loader'); 982 self.createLoader(); 983 } 984 985 self.options.wrapper.one('layoutComplete', function(event, laidOutItems) { 986 self.removeLoader(); 987 }); 988 989 self.options.wrapper.waitForImages(function() { 990 self.options.wrapper.isotope(this.options); 991 }); 992 993 setTimeout(function() { 994 self.removeLoader(); 995 }, 3000); 996 997 return this; 998 }, 999 1000 createLoader: function() { 1001 var self = this; 1002 1003 var loaderTemplate = [ 1004 '<div class="bounce-loader">', 1005 '<div class="bounce1"></div>', 1006 '<div class="bounce2"></div>', 1007 '<div class="bounce3"></div>', 1008 '</div>' 1009 ].join(''); 1010 1011 self.$loader.append(loaderTemplate); 1012 1013 return this; 1014 }, 1015 1016 removeLoader: function() { 1017 1018 var self = this; 1019 1020 if (self.$loader) { 1021 1022 self.$loader.removeClass('masonry-loader-showing'); 1023 1024 setTimeout(function() { 1025 self.$loader.addClass('masonry-loader-loaded'); 1026 }, 300); 1027 1028 } 1029 1030 } 1031 }; 1032 1033 // expose to scope 1034 $.extend(theme, { 1035 PluginMasonry: PluginMasonry 1036 }); 1037 1038 // jquery plugin 1039 $.fn.themePluginMasonry = function(opts) { 1040 return this.map(function() { 1041 var $this = $(this); 1042 1043 if ($this.data(instanceName)) { 1044 return $this.data(instanceName); 1045 } else { 1046 return new PluginMasonry($this, opts); 1047 } 1048 1049 }); 1050 } 1051 1052}).apply(this, [window.theme, jQuery]); 1053 1054// Match Height 1055(function(theme, $) { 1056 1057 theme = theme || {}; 1058 1059 var instanceName = '__matchHeight'; 1060 1061 var PluginMatchHeight = function($el, opts) { 1062 return this.initialize($el, opts); 1063 }; 1064 1065 PluginMatchHeight.defaults = { 1066 byRow: true, 1067 property: 'height', 1068 target: null, 1069 remove: false 1070 }; 1071 1072 PluginMatchHeight.prototype = { 1073 initialize: function($el, opts) { 1074 if ($el.data(instanceName)) { 1075 return this; 1076 } 1077 1078 this.$el = $el; 1079 1080 this 1081 .setData() 1082 .setOptions(opts) 1083 .build(); 1084 1085 return this; 1086 }, 1087 1088 setData: function() { 1089 this.$el.data(instanceName, this); 1090 1091 return this; 1092 }, 1093 1094 setOptions: function(opts) { 1095 this.options = $.extend(true, {}, PluginMatchHeight.defaults, opts, { 1096 wrapper: this.$el 1097 }); 1098 1099 return this; 1100 }, 1101 1102 build: function() { 1103 if (!($.isFunction($.fn.matchHeight))) { 1104 return this; 1105 } 1106 1107 var self = this; 1108 1109 self.options.wrapper.matchHeight(self.options); 1110 1111 return this; 1112 } 1113 1114 }; 1115 1116 // expose to scope 1117 $.extend(theme, { 1118 PluginMatchHeight: PluginMatchHeight 1119 }); 1120 1121 // jquery plugin 1122 $.fn.themePluginMatchHeight = function(opts) { 1123 return this.map(function() { 1124 var $this = $(this); 1125 1126 if ($this.data(instanceName)) { 1127 return $this.data(instanceName); 1128 } else { 1129 return new PluginMatchHeight($this, opts); 1130 } 1131 1132 }); 1133 } 1134 1135}).apply(this, [window.theme, jQuery]); 1136 1137// Parallax 1138(function(theme, $) { 1139 1140 theme = theme || {}; 1141 1142 var instanceName = '__parallax'; 1143 1144 var PluginParallax = function($el, opts) { 1145 return this.initialize($el, opts); 1146 }; 1147 1148 PluginParallax.defaults = { 1149 speed: 1.5, 1150 horizontalPosition: '50%', 1151 offset: 0 1152 }; 1153 1154 PluginParallax.prototype = { 1155 initialize: function($el, opts) { 1156 if ($el.data(instanceName)) { 1157 return this; 1158 } 1159 1160 this.$el = $el; 1161 1162 this 1163 .setData() 1164 .setOptions(opts) 1165 .build(); 1166 1167 return this; 1168 }, 1169 1170 setData: function() { 1171 this.$el.data(instanceName, this); 1172 1173 return this; 1174 }, 1175 1176 setOptions: function(opts) { 1177 this.options = $.extend(true, {}, PluginParallax.defaults, opts, { 1178 wrapper: this.$el 1179 }); 1180 1181 return this; 1182 }, 1183 1184 build: function() { 1185 var self = this, 1186 $window = $(window), 1187 offset, 1188 yPos, 1189 bgpos; 1190 1191 self.options.wrapper.css('background-image', 'url(' + self.options.wrapper.data('image-src') + ')'); 1192 1193 if (!$.browser.mobile) { 1194 1195 $window.on('scroll resize', function() { 1196 offset = self.options.wrapper.offset(); 1197 yPos = -($window.scrollTop() - offset.top) / self.options.speed + (self.options.offset); 1198 bgpos = self.options.horizontalPosition + ' ' + yPos + 'px'; 1199 self.options.wrapper.css('background-position', bgpos); 1200 }); 1201 1202 $window.trigger('scroll'); 1203 1204 } else { 1205 self.options.wrapper.addClass('parallax-disabled'); 1206 } 1207 1208 return this; 1209 } 1210 }; 1211 1212 // expose to scope 1213 $.extend(theme, { 1214 PluginParallax: PluginParallax 1215 }); 1216 1217 // jquery plugin 1218 $.fn.themePluginParallax = function(opts) { 1219 return this.map(function() { 1220 var $this = $(this); 1221 1222 if ($this.data(instanceName)) { 1223 return $this.data(instanceName); 1224 } else { 1225 return new PluginParallax($this, opts); 1226 } 1227 1228 }); 1229 } 1230 1231}).apply(this, [window.theme, jQuery]); 1232 1233// Progress Bar 1234(function(theme, $) { 1235 1236 theme = theme || {}; 1237 1238 var instanceName = '__progressBar'; 1239 1240 var PluginProgressBar = function($el, opts) { 1241 return this.initialize($el, opts); 1242 }; 1243 1244 PluginProgressBar.defaults = { 1245 accX: 0, 1246 accY: -50, 1247 delay: 1 1248 }; 1249 1250 PluginProgressBar.prototype = { 1251 initialize: function($el, opts) { 1252 if ($el.data(instanceName)) { 1253 return this; 1254 } 1255 1256 this.$el = $el; 1257 1258 this 1259 .setData() 1260 .setOptions(opts) 1261 .build(); 1262 1263 return this; 1264 }, 1265 1266 setData: function() { 1267 this.$el.data(instanceName, this); 1268 1269 return this; 1270 }, 1271 1272 setOptions: function(opts) { 1273 this.options = $.extend(true, {}, PluginProgressBar.defaults, opts, { 1274 wrapper: this.$el 1275 }); 1276 1277 return this; 1278 }, 1279 1280 build: function() { 1281 if (!($.isFunction($.fn.appear))) { 1282 return this; 1283 } 1284 1285 var self = this, 1286 $el = this.options.wrapper,
1287 delay = 1; 1288 1289 $el.appear(function() { 1290 1291 delay = ($el.attr('data-appear-animation-delay') ? $el.attr('data-appear-animation-delay') : self.options.delay); 1292 1293 $el.addClass($el.attr('data-appear-animation')); 1294 1295 setTimeout(function() { 1296 1297 $el.animate({ 1298 width: $el.attr('data-appear-progress-animation') 1299 }, 1500, 'easeOutQuad', function() { 1300 $el.find('.progress-bar-tooltip').animate({ 1301 opacity: 1 1302 }, 500, 'easeOutQuad'); 1303 }); 1304 1305 }, delay); 1306 1307 }, { 1308 accX: self.options.accX, 1309 accY: self.options.accY 1310 }); 1311 1312 return this; 1313 } 1314 }; 1315 1316 // expose to scope 1317 $.extend(theme, { 1318 PluginProgressBar: PluginProgressBar 1319 }); 1320 1321 // jquery plugin 1322 $.fn.themePluginProgressBar = function(opts) { 1323 return this.map(function() { 1324 var $this = $(this); 1325 1326 if ($this.data(instanceName)) { 1327 return $this.data(instanceName); 1328 } else { 1329 return new PluginProgressBar($this, opts); 1330 } 1331 1332 }); 1333 } 1334 1335}).apply(this, [window.theme, jQuery]); 1336 1337// Revolution Slider 1338(function(theme, $) { 1339 1340 theme = theme || {}; 1341 1342 var instanceName = '__revolution'; 1343 1344 var PluginRevolutionSlider = function($el, opts) { 1345 return this.initialize($el, opts); 1346 }; 1347 1348 PluginRevolutionSlider.defaults = { 1349 sliderType: 'standard', 1350 sliderLayout: 'fullwidth', 1351 delay: 9000, 1352 gridwidth: 1170, 1353 gridheight: 500, 1354 spinner: 'spinner3', 1355 disableProgressBar: 'on', 1356 parallax: { 1357 type: 'off', 1358 bgparallax: 'off' 1359 }, 1360 navigation: { 1361 keyboardNavigation: 'off', 1362 keyboard_direction: 'horizontal', 1363 mouseScrollNavigation: 'off', 1364 onHoverStop: 'off', 1365 touch: { 1366 touchenabled: 'on', 1367 swipe_threshold: 75, 1368 swipe_min_touches: 1, 1369 swipe_direction: 'horizontal', 1370 drag_block_vertical: false 1371 }, 1372 arrows: { 1373 enable: true, 1374 hide_onmobile: false, 1375 hide_under: 0, 1376 hide_onleave: true, 1377 hide_delay: 200, 1378 hide_delay_mobile: 1200, 1379 left: { 1380 h_align: 'left', 1381 v_align: 'center', 1382 h_offset: 30, 1383 v_offset: 0 1384 }, 1385 right: { 1386 h_align: 'right', 1387 v_align: 'center', 1388 h_offset: 30, 1389 v_offset: 0 1390 } 1391 } 1392 } 1393 }; 1394 1395 PluginRevolutionSlider.prototype = { 1396 initialize: function($el, opts) { 1397 if ($el.data(instanceName)) { 1398 return this; 1399 } 1400 1401 this.$el = $el; 1402 1403 this 1404 .setData() 1405 .setOptions(opts) 1406 .build() 1407 .events(); 1408 1409 return this; 1410 }, 1411 1412 setData: function() { 1413 this.$el.data(instanceName, this); 1414 1415 return this; 1416 }, 1417 1418 setOptions: function(opts) { 1419 this.options = $.extend(true, {}, PluginRevolutionSlider.defaults, opts, { 1420 wrapper: this.$el 1421 }); 1422 1423 return this; 1424 }, 1425 1426 build: function() { 1427 if (!($.isFunction($.fn.revolution))) { 1428 return this; 1429 } 1430 1431 // Single Slider Class 1432 if(this.options.wrapper.find('> ul > li').length == 1) { 1433 this.options.wrapper.addClass('slider-single-slide'); 1434 } 1435 1436 this.options.wrapper.revolution(this.options); 1437 1438 return this; 1439 }, 1440 1441 events: function() { 1442 1443 return this; 1444 } 1445 }; 1446 1447 // expose to scope 1448 $.extend(theme, { 1449 PluginRevolutionSlider: PluginRevolutionSlider 1450 }); 1451 1452 // jquery plugin 1453 $.fn.themePluginRevolutionSlider = function(opts) { 1454 return this.map(function() { 1455 var $this = $(this); 1456 1457 if ($this.data(instanceName)) { 1458 return $this.data(instanceName); 1459 } else { 1460 return new PluginRevolutionSlider($this, opts); 1461 } 1462 1463 }); 1464 } 1465 1466}).apply(this, [window.theme, jQuery]); 1467 1468// Scroll to Top 1469(function(theme, $) { 1470 1471 theme = theme || {}; 1472 1473 $.extend(theme, { 1474 1475 PluginScrollToTop: { 1476 1477 defaults: { 1478 wrapper: $('body'), 1479 offset: 150, 1480 buttonClass: 'scroll-to-top', 1481 iconClass: 'fa fa-chevron-up', 1482 delay: 1000, 1483 visibleMobile: false, 1484 label: false, 1485 easing: 'easeOutBack' 1486 }, 1487 1488 initialize: function(opts) { 1489 initialized = true; 1490 1491 this 1492 .setOptions(opts) 1493 .build() 1494 .events(); 1495 1496 return this; 1497 }, 1498 1499 setOptions: function(opts) { 1500 this.options = $.extend(true, {}, this.defaults, opts); 1501 1502 return this; 1503 }, 1504 1505 build: function() { 1506 var self = this, 1507 $el; 1508 1509 // Base HTML Markup 1510 $el = $('<a />') 1511 .addClass(self.options.buttonClass) 1512 .attr({ 1513 'href': '#', 1514 }) 1515 .append( 1516 $('<i />') 1517 .addClass(self.options.iconClass) 1518 ); 1519 1520 // Visible Mobile 1521 if (!self.options.visibleMobile) { 1522 $el.addClass('hidden-mobile'); 1523 } 1524 1525 // Label 1526 if (self.options.label) { 1527 $el.append( 1528 $('<span />').html(self.options.label) 1529 ); 1530 } 1531 1532 this.options.wrapper.append($el); 1533 1534 this.$el = $el; 1535 1536 return this; 1537 }, 1538 1539 events: function() { 1540 var self = this, 1541 _isScrolling = false;
1542 1543 // Click Element Action 1544 self.$el.on('click', function(e) { 1545 e.preventDefault(); 1546 $('body, html').animate({ 1547 scrollTop: 0 1548 }, self.options.delay, self.options.easing); 1549 return false; 1550 }); 1551 1552 // Show/Hide Button on Window Scroll event. 1553 $(window).scroll(function() { 1554 1555 if (!_isScrolling) { 1556 1557 _isScrolling = true; 1558 1559 if ($(window).scrollTop() > self.options.offset) { 1560 1561 self.$el.stop(true, true).addClass('visible'); 1562 _isScrolling = false; 1563 1564 } else { 1565 1566 self.$el.stop(true, true).removeClass('visible'); 1567 _isScrolling = false; 1568 1569 } 1570 1571 } 1572 1573 }); 1574 1575 return this; 1576 } 1577 1578 } 1579 1580 }); 1581 1582}).apply(this, [window.theme, jQuery]); 1583 1584// Sort 1585(function(theme, $) { 1586 1587 theme = theme || {}; 1588 1589 var instanceName = '__sort'; 1590 1591 var PluginSort = function($el, opts) { 1592 return this.initialize($el, opts); 1593 }; 1594 1595 PluginSort.defaults = { 1596 useHash: true, 1597 itemSelector: '.isotope-item', 1598 layoutMode: 'masonry', 1599 filter: '*', 1600 hiddenStyle: { 1601 opacity: 0 1602 }, 1603 visibleStyle: { 1604 opacity: 1 1605 }, 1606 stagger: 30, 1607 isOriginLeft: ($('html').attr('dir') == 'rtl' ? false : true) 1608 }; 1609 1610 PluginSort.prototype = { 1611 initialize: function($el, opts) { 1612 if ($el.data(instanceName)) { 1613 return this; 1614 } 1615 1616 this.$el = $el; 1617 1618 this 1619 .setData() 1620 .setOptions(opts) 1621 .build(); 1622 1623 return this; 1624 }, 1625 1626 setData: function() { 1627 this.$el.data(instanceName, this); 1628 1629 return this; 1630 }, 1631 1632 setOptions: function(opts) { 1633 this.options = $.extend(true, {}, PluginSort.defaults, opts, { 1634 wrapper: this.$el 1635 }); 1636 1637 return this; 1638 }, 1639 1640 build: function() { 1641 if (!($.isFunction($.fn.isotope))) { 1642 return this; 1643 } 1644 1645 var self = this, 1646 $source = this.options.wrapper, 1647 $destination = $('.sort-destination[data-sort-id="' + $source.attr('data-sort-id') + '"]'), 1648 $window = $(window); 1649 1650 if ($destination.get(0)) { 1651 1652 self.$source = $source; 1653 self.$destination = $destination; 1654 self.$loader = false;
1655 1656 self.setParagraphHeight($destination); 1657 1658 if (self.$destination.parents('.sort-destination-loader').get(0)) { 1659 self.$loader = self.$destination.parents('.sort-destination-loader'); 1660 self.createLoader(); 1661 } 1662 1663 $destination.attr('data-filter', '*'); 1664 1665 $destination.one('layoutComplete', function(event, laidOutItems) { 1666 self.removeLoader(); 1667 }); 1668 1669 $destination.waitForImages(function() { 1670 $destination.isotope(self.options); 1671 self.events(); 1672 }); 1673 1674 setTimeout(function() { 1675 self.removeLoader(); 1676 }, 3000); 1677 1678 } 1679 1680 return this; 1681 }, 1682 1683 events: function() { 1684 var self = this, 1685 filter = null, 1686 $window = $(window); 1687 1688 self.$source.find('a').click(function(e) { 1689 e.preventDefault(); 1690 1691 filter = $(this).parent().data('option-value'); 1692 1693 self.setFilter(filter); 1694 1695 if (e.originalEvent) { 1696 self.$source.trigger('filtered'); 1697 } 1698 1699 return this; 1700 }); 1701 1702 self.$destination.trigger('filtered'); 1703 self.$source.trigger('filtered'); 1704 1705 if (self.options.useHash) { 1706 self.hashEvents(); 1707 } 1708 1709 $window.on('resize', function() { 1710 setTimeout(function() { 1711 self.$destination.isotope('layout'); 1712 }, 300); 1713 }); 1714 1715 setTimeout(function() { 1716 $window.trigger('resize'); 1717 }, 300); 1718 1719 return this; 1720 }, 1721 1722 setFilter: function(filter) { 1723 var self = this, 1724 page = false, 1725 currentFilter = filter; 1726 1727 self.$source.find('li.active').removeClass('active'); 1728 self.$source.find('li[data-option-value="' + filter + '"]').addClass('active'); 1729 1730 self.options.filter = currentFilter; 1731 1732 if (self.$destination.attr('data-current-page')) { 1733 currentFilter = currentFilter + '[data-page-rel=' + self.$destination.attr('data-current-page') + ']'; 1734 } 1735 1736 self.$destination.attr('data-filter', filter).isotope({ 1737 filter: currentFilter 1738 }).one('arrangeComplete', function( event, filteredItems ) { 1739 1740 if (self.options.useHash) { 1741 if (window.location.hash != '' || self.options.filter.replace('.', '') != '*') { 1742 window.location.hash = self.options.filter.replace('.', ''); 1743 } 1744 } 1745 1746 $(window).trigger('scroll'); 1747 1748 }).trigger('filtered'); 1749 1750 return this; 1751 }, 1752 1753 hashEvents: function() { 1754 var self = this, 1755 hash = null, 1756 hashFilter = null, 1757 initHashFilter = '.' + location.hash.replace('#', ''); 1758 1759 if (initHashFilter != '.' && initHashFilter != '.*') { 1760 self.setFilter(initHashFilter); 1761 } 1762 1763 $(window).on('hashchange', function(e) { 1764 1765 hashFilter = '.' + location.hash.replace('#', ''); 1766 hash = (hashFilter == '.' || hashFilter == '.*' ? '*' : hashFilter); 1767 1768 self.setFilter(hash); 1769 1770 }); 1771 1772 return this; 1773 }, 1774 1775 setParagraphHeight: function() { 1776 var self = this, 1777 minParagraphHeight = 0, 1778 paragraphs = $('span.thumb-info-caption p', self.$destination); 1779 1780 paragraphs.each(function() { 1781 if ($(this).height() > minParagraphHeight) { 1782 minParagraphHeight = ($(this).height() + 10); 1783 } 1784 }); 1785 1786 paragraphs.height(minParagraphHeight); 1787 1788 return this; 1789 }, 1790 1791 createLoader: function() { 1792 var self = this; 1793 1794 var loaderTemplate = [ 1795 '<div class="bounce-loader">', 1796 '<div class="bounce1"></div>', 1797 '<div class="bounce2"></div>', 1798 '<div class="bounce3"></div>', 1799 '</div>' 1800 ].join(''); 1801 1802 self.$loader.append(loaderTemplate); 1803 1804 return this; 1805 }, 1806 1807 removeLoader: function() { 1808 1809 var self = this; 1810 1811 if (self.$loader) { 1812 1813 self.$loader.removeClass('sort-destination-loader-showing'); 1814 1815 setTimeout(function() { 1816 self.$loader.addClass('sort-destination-loader-loaded'); 1817 }, 300); 1818 1819 } 1820 1821 } 1822 1823 }; 1824 1825 // expose to scope 1826 $.extend(theme, { 1827 PluginSort: PluginSort 1828 }); 1829 1830 // jquery plugin 1831 $.fn.themePluginSort = function(opts) { 1832 return this.map(function() { 1833 var $this = $(this); 1834 1835 if ($this.data(instanceName)) { 1836 return $this.data(instanceName); 1837 } else { 1838 return new PluginSort($this, opts); 1839 } 1840 1841 }); 1842 } 1843 1844}).apply(this, [window.theme, jQuery]); 1845 1846// Sticky 1847(function(theme, $) { 1848 1849 theme = theme || {}; 1850 1851 var instanceName = '__sticky'; 1852 1853 var PluginSticky = function($el, opts) { 1854 return this.initialize($el, opts); 1855 }; 1856 1857 PluginSticky.defaults = { 1858 minWidth: 991, 1859 activeClass: 'sticky-active' 1860 }; 1861 1862 PluginSticky.prototype = { 1863 initialize: function($el, opts) { 1864 if ( $el.data( instanceName ) ) { 1865 return this; 1866 } 1867 1868 this.$el = $el; 1869 1870 this 1871 .setData() 1872 .setOptions(opts) 1873 .build(); 1874 1875 return this; 1876 }, 1877 1878 setData: function() { 1879 this.$el.data(instanceName, this); 1880 1881 return this; 1882 }, 1883 1884 setOptions: function(opts) { 1885 this.options = $.extend(true, {}, PluginSticky.defaults, opts, { 1886 wrapper: this.$el 1887 }); 1888 1889 return this; 1890 }, 1891 1892 build: function() { 1893 if (!($.isFunction($.fn.pin))) { 1894 return this; 1895 } 1896 1897 var self = this, 1898 $window = $(window); 1899 1900 self.options.wrapper.pin(self.options); 1901 1902 $window.afterResize(function() { 1903 self.options.wrapper.removeAttr('style').removeData('pin'); 1904 self.options.wrapper.pin(self.options); 1905 $window.trigger('scroll'); 1906 }); 1907 1908 return this; 1909 } 1910 }; 1911 1912 // expose to scope 1913 $.extend(theme, { 1914 PluginSticky: PluginSticky 1915 }); 1916 1917 // jquery plugin 1918 $.fn.themePluginSticky = function(opts) { 1919 return this.map(function() { 1920 var $this = $(this); 1921 1922 if ($this.data(instanceName)) { 1923 return $this.data(instanceName); 1924 } else { 1925 return new PluginSticky($this, opts); 1926 } 1927 1928 }); 1929 } 1930 1931}).apply(this, [ window.theme, jQuery ]); 1932 1933// Toggle 1934(function(theme, $) { 1935 1936 theme = theme || {}; 1937 1938 var instanceName = '__toggle'; 1939 1940 var PluginToggle = function($el, opts) { 1941 return this.initialize($el, opts); 1942 }; 1943 1944 PluginToggle.defaults = { 1945 duration: 350, 1946 isAccordion: false 1947 }; 1948 1949 PluginToggle.prototype = { 1950 initialize: function($el, opts) { 1951 if ($el.data(instanceName)) { 1952 return this; 1953 } 1954 1955 this.$el = $el; 1956 1957 this 1958 .setData() 1959 .setOptions(opts) 1960 .build(); 1961 1962 return this; 1963 }, 1964 1965 setData: function() { 1966 this.$el.data(instanceName, this); 1967 1968 return this; 1969 }, 1970 1971 setOptions: function(opts) { 1972 this.options = $.extend(true, {}, PluginToggle.defaults, opts, { 1973 wrapper: this.$el 1974 }); 1975 1976 return this; 1977 }, 1978 1979 build: function() { 1980 var self = this, 1981 $wrapper = this.options.wrapper, 1982 $items = $wrapper.find('.toggle'), 1983 $el = null; 1984 1985 $items.each(function() { 1986 $el = $(this); 1987 1988 if ($el.hasClass('active')) { 1989 $el.find('> p').addClass('preview-active'); 1990 $el.find('> .toggle-content').slideDown(self.options.duration); 1991 } 1992 1993 self.events($el); 1994 }); 1995 1996 if (self.options.isAccordion) { 1997 self.options.duration = self.options.duration / 2; 1998 } 1999 2000 return this; 2001 }, 2002 2003 events: function($el) { 2004 var self = this, 2005 previewParCurrentHeight = 0, 2006 previewParAnimateHeight = 0, 2007 toggleContent = null; 2008 2009 $el.find('> label').click(function(e) { 2010 2011 var $this = $(this), 2012 parentSection = $this.parent(), 2013 parentWrapper = $this.parents('.toggle'), 2014 previewPar = null, 2015 closeElement = null; 2016 2017 if (self.options.isAccordion && typeof(e.originalEvent) != 'undefined') { 2018 closeElement = parentWrapper.find('.toggle.active > label'); 2019 2020 if (closeElement[0] == $this[0]) { 2021 return; 2022 } 2023 } 2024 2025 parentSection.toggleClass('active'); 2026 2027 // Preview Paragraph 2028 if (parentSection.find('> p').get(0)) { 2029 2030 previewPar = parentSection.find('> p'); 2031 previewParCurrentHeight = previewPar.css('height'); 2032 previewPar.css('height', 'auto'); 2033 previewParAnimateHeight = previewPar.css('height'); 2034 previewPar.css('height', previewParCurrentHeight); 2035 2036 } 2037 2038 // Content 2039 toggleContent = parentSection.find('> .toggle-content'); 2040 2041 if (parentSection.hasClass('active')) { 2042 2043 $(previewPar).animate({ 2044 height: previewParAnimateHeight 2045 }, self.options.duration, function() { 2046 $(this).addClass('preview-active'); 2047 }); 2048 2049 toggleContent.slideDown(self.options.duration, function() { 2050 if (closeElement) { 2051 closeElement.trigger('click'); 2052 } 2053 }); 2054 2055 } else { 2056 2057 $(previewPar).animate({ 2058 height: 0 2059 }, self.options.duration, function() { 2060 $(this).removeClass('preview-active'); 2061 }); 2062 2063 toggleContent.slideUp(self.options.duration); 2064 2065 } 2066 2067 }); 2068 } 2069 }; 2070 2071 // expose to scope 2072 $.extend(theme, { 2073 PluginToggle: PluginToggle 2074 }); 2075 2076 // jquery plugin 2077 $.fn.themePluginToggle = function(opts) { 2078 return this.map(function() { 2079 var $this = $(this); 2080 2081 if ($this.data(instanceName)) { 2082 return $this.data(instanceName); 2083 } else { 2084 return new PluginToggle($this, opts); 2085 } 2086 2087 }); 2088 } 2089 2090}).apply(this, [window.theme, jQuery]); 2091 2092// Tweets 2093(function(theme, $) { 2094 2095 theme = theme || {}; 2096 2097 var instanceName = '__tweets'; 2098 2099 var PluginTweets = function($el, opts) { 2100 return this.initialize($el, opts); 2101 }; 2102 2103 PluginTweets.defaults = { 2104 username: null, 2105 count: 2, 2106 URL: 'php/twitter-feed.php' 2107 }; 2108 2109 PluginTweets.prototype = { 2110 initialize: function($el, opts) { 2111 if ($el.data(instanceName)) { 2112 return this; 2113 } 2114 2115 this.$el = $el; 2116 2117 this 2118 .setData() 2119 .setOptions(opts) 2120 .build(); 2121 2122 return this; 2123 }, 2124 2125 setData: function() { 2126 this.$el.data(instanceName, this); 2127 2128 return this; 2129 }, 2130 2131 setOptions: function(opts) { 2132 this.options = $.extend(true, {}, PluginTweets.defaults, opts, { 2133 wrapper: this.$el 2134 }); 2135 2136 return this; 2137 }, 2138 2139 build: function() { 2140 if (this.options.username == null || this.options.username == '') { 2141 return this; 2142 } 2143 2144 var self = this, 2145 $wrapper = this.options.wrapper; 2146 2147 $.ajax({ 2148 type: 'GET', 2149 data: { 2150 twitter_screen_name: self.options.username, 2151 tweets_to_display: self.options.count 2152 }, 2153 url: self.options.URL, 2154 }).done(function(html) { 2155 $wrapper.html(html).find('a').attr('target','_blank'); 2156 }); 2157 2158 return this; 2159 } 2160 }; 2161 2162 // expose to scope 2163 $.extend(theme, { 2164 PluginTweets: PluginTweets 2165 }); 2166 2167 // jquery plugin 2168 $.fn.themePluginTweets = function(opts) { 2169 return this.map(function() { 2170 var $this = $(this); 2171 2172 if ($this.data(instanceName)) { 2173 return $this.data(instanceName); 2174 } else { 2175 return new PluginTweets($this, opts); 2176 } 2177 2178 }); 2179 } 2180 2181}).apply(this, [window.theme, jQuery]); 2182 2183// Validation 2184(function(theme, $) { 2185 2186 theme = theme || {}; 2187 2188 $.extend(theme, { 2189 2190 PluginValidation: { 2191 2192 defaults: { 2193 validator: { 2194 highlight: function(element) { 2195 $(element) 2196 .parent() 2197 .removeClass('has-success') 2198 .addClass('has-error'); 2199 }, 2200 success: function(element) { 2201 $(element) 2202 .parent() 2203 .removeClass('has-error') 2204 .addClass('has-success') 2205 .find('label.error') 2206 .remove(); 2207 }, 2208 errorPlacement: function(error, element) { 2209 if (element.attr('type') == 'radio' || element.attr('type') == 'checkbox') { 2210 error.appendTo(element.parent().parent()); 2211 } else { 2212 error.insertAfter(element); 2213 } 2214 } 2215 }, 2216 validateCaptchaURL: 'php/contact-form-verify-captcha.php', 2217 refreshCaptchaURL: 'php/contact-form-refresh-captcha.php' 2218 }, 2219 2220 initialize: function(opts) { 2221 initialized = true; 2222 2223 this 2224 .setOptions(opts) 2225 .build(); 2226 2227 return this; 2228 }, 2229 2230 setOptions: function(opts) { 2231 this.options = $.extend(true, {}, this.defaults, opts); 2232 2233 return this; 2234 }, 2235 2236 build: function() { 2237 var self = this; 2238 2239 if (!($.isFunction($.validator))) { 2240 return this; 2241 } 2242 2243 self.addMethods(); 2244 self.setMessageGroups(); 2245 2246 $.validator.setDefaults(self.options.validator); 2247 2248 return this; 2249 }, 2250 2251 addMethods: function() { 2252 var self = this; 2253 2254 $.validator.addMethod('captcha', function(value, element, params) { 2255 var captchaValid = false;
2256 2257 $.ajax({ 2258 url: self.options.validateCaptchaURL, 2259 type: 'POST', 2260 async: false, 2261 dataType: 'json', 2262 data: { 2263 captcha: $.trim(value) 2264 }, 2265 success: function(data) { 2266 if (data.response == 'success') { 2267 captchaValid = true; 2268 } 2269 } 2270 }); 2271 2272 if (captchaValid) { 2273 return true; 2274 } 2275 2276 }, ''); 2277 2278 // Refresh Captcha 2279 $('#refreshCaptcha').on('click', function(e) { 2280 e.preventDefault(); 2281 $.get(self.options.refreshCaptchaURL, function(url) { 2282 $('#captcha-image').attr('src', url); 2283 }); 2284 }); 2285 2286 }, 2287 2288 setMessageGroups: function() { 2289 2290 $('.checkbox-group[data-msg-required], .radio-group[data-msg-required]').each(function() { 2291 var message = $(this).data('msg-required'); 2292 $(this).find('input').attr('data-msg-required', message); 2293 }); 2294 2295 } 2296 2297 } 2298 2299 }); 2300 2301}).apply(this, [window.theme, jQuery]); 2302 2303// Video Background 2304(function(theme, $) { 2305 2306 theme = theme || {}; 2307 2308 var instanceName = '__videobackground'; 2309 2310 var PluginVideoBackground = function($el, opts) { 2311 return this.initialize($el, opts); 2312 }; 2313 2314 PluginVideoBackground.defaults = { 2315 overlay: true, 2316 volume: 1, 2317 playbackRate: 1, 2318 muted: true, 2319 loop: true, 2320 autoplay: true, 2321 position: '50% 50%', 2322 posterType: 'detect' 2323 }; 2324 2325 PluginVideoBackground.prototype = { 2326 initialize: function($el, opts) { 2327 this.$el = $el; 2328 2329 this 2330 .setData() 2331 .setOptions(opts) 2332 .build(); 2333 2334 return this; 2335 }, 2336 2337 setData: function() { 2338 this.$el.data(instanceName, this); 2339 2340 return this; 2341 }, 2342 2343 setOptions: function(opts) { 2344 this.options = $.extend(true, {}, PluginVideoBackground.defaults, opts, { 2345 path: this.$el.data('video-path'), 2346 wrapper: this.$el 2347 }); 2348 2349 return this; 2350 }, 2351 2352 build: function() { 2353 2354 if (!($.isFunction($.fn.vide)) || (!this.options.path)) { 2355 return this; 2356 } 2357 2358 if (this.options.overlay) { 2359 this.options.wrapper.prepend( 2360 $('<div />').addClass('video-overlay') 2361 ); 2362 } 2363 2364 this.options.wrapper.vide(this.options.path, this.options); 2365 2366 return this; 2367 } 2368 }; 2369 2370 // expose to scope 2371 $.extend(theme, { 2372 PluginVideoBackground: PluginVideoBackground 2373 }); 2374 2375 // jquery plugin 2376 $.fn.themePluginVideoBackground = function(opts) { 2377 return this.map(function() { 2378 var $this = $(this); 2379 2380 if ($this.data(instanceName)) { 2381 return $this.data(instanceName); 2382 } else { 2383 return new PluginVideoBackground($this, opts); 2384 } 2385 2386 }); 2387 } 2388 2389}).apply(this, [window.theme, jQuery]); 2390 2391// Word Rotate 2392(function(theme, $) { 2393 2394 theme = theme || {}; 2395 2396 var instanceName = '__wordRotate'; 2397 2398 var PluginWordRotate = function($el, opts) { 2399 return this.initialize($el, opts); 2400 }; 2401 2402 PluginWordRotate.defaults = { 2403 delay: 2000, 2404 animDelay: 300 2405 }; 2406 2407 PluginWordRotate.prototype = { 2408 initialize: function($el, opts) { 2409 if ( $el.data( instanceName ) ) { 2410 return this; 2411 } 2412 2413 this.$el = $el; 2414 2415 this 2416 .setData() 2417 .setOptions(opts) 2418 .build(); 2419 2420 return this; 2421 }, 2422 2423 setData: function() { 2424 this.$el.data(instanceName, this); 2425 2426 return this; 2427 }, 2428 2429 setOptions: function(opts) { 2430 this.options = $.extend(true, {}, PluginWordRotate.defaults, opts, { 2431 wrapper: this.$el 2432 }); 2433 2434 return this; 2435 }, 2436 2437 build: function() { 2438 var self = this, 2439 $el = this.options.wrapper, 2440 itemsWrapper = $el.find(".word-rotate-items"), 2441 items = itemsWrapper.find("> span"), 2442 firstItem = items.eq(0), 2443 firstItemClone = firstItem.clone(), 2444 currentItem = 1, 2445 currentTop = 0, 2446 itemWidth = 0; 2447 2448 itemsWrapper 2449 .width(firstItem.width() + "px") 2450 .append(firstItemClone); 2451 2452 $el 2453 .addClass("active"); 2454 2455 setInterval(function() { 2456 2457 currentTop = (currentItem * $el.height()); 2458 currentItem++; 2459 2460 if(currentItem <= items.length) { 2461 itemWidth = items.eq(currentItem-1).width(); 2462 } else { 2463 itemWidth = items.eq(0).width(); 2464 } 2465 2466 itemsWrapper.animate({ 2467 top: -(currentTop) + "px", 2468 width: itemWidth + "px" 2469 }, self.options.animDelay, "easeOutQuad", function() { 2470 2471 if(currentItem > items.length) { 2472 2473 itemsWrapper.css("top", 0); 2474 currentItem = 1; 2475 2476 } 2477 2478 }); 2479 2480 }, self.options.delay); 2481 2482 return this; 2483 } 2484 }; 2485 2486 // expose to scope 2487 $.extend(theme, { 2488 PluginWordRotate: PluginWordRotate 2489 }); 2490 2491 // jquery plugin 2492 $.fn.themePluginWordRotate = function(opts) { 2493 return this.map(function() { 2494 var $this = $(this); 2495 2496 if ($this.data(instanceName)) { 2497 return $this.data(instanceName); 2498 } else { 2499 return new PluginWordRotate($this, opts); 2500 } 2501 2502 }); 2503 } 2504 2505}).apply(this, [ window.theme, jQuery ]); 2506 2507// Account 2508(function(theme, $) { 2509 2510 theme = theme || {}; 2511 2512 var initialized = false;
2513 2514 $.extend(theme, { 2515 2516 Account: { 2517 2518 defaults: { 2519 wrapper: $('#headerAccount') 2520 }, 2521 2522 initialize: function($wrapper, opts) { 2523 if (initialized) { 2524 return this; 2525 } 2526 2527 initialized = true; 2528 this.$wrapper = ($wrapper || this.defaults.wrapper); 2529 2530 this 2531 .setOptions(opts) 2532 .events(); 2533 2534 return this; 2535 }, 2536 2537 setOptions: function(opts) { 2538 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options'))); 2539 2540 return this; 2541 }, 2542 2543 events: function() { 2544 var self = this; 2545 2546 self.$wrapper.find('input').on('focus', function() { 2547 self.$wrapper.addClass('open'); 2548 2549 $(document).mouseup(function(e) { 2550 if (!self.$wrapper.is(e.target) && self.$wrapper.has(e.target).length === 0) { 2551 self.$wrapper.removeClass('open'); 2552 } 2553 }); 2554 }); 2555 2556 $('#headerSignUp').on('click', function(e) { 2557 e.preventDefault(); 2558 self.$wrapper.addClass('signup').removeClass('signin').removeClass('recover'); 2559 self.$wrapper.find('.signup-form input:first').focus(); 2560 }); 2561 2562 $('#headerSignIn').on('click', function(e) { 2563 e.preventDefault(); 2564 self.$wrapper.addClass('signin').removeClass('signup').removeClass('recover'); 2565 self.$wrapper.find('.signin-form input:first').focus(); 2566 }); 2567 2568 $('#headerRecover').on('click', function(e) { 2569 e.preventDefault(); 2570 self.$wrapper.addClass('recover').removeClass('signup').removeClass('signin'); 2571 self.$wrapper.find('.recover-form input:first').focus(); 2572 }); 2573 2574 $('#headerRecoverCancel').on('click', function(e) { 2575 e.preventDefault(); 2576 self.$wrapper.addClass('signin').removeClass('signup').removeClass('recover'); 2577 self.$wrapper.find('.signin-form input:first').focus(); 2578 }); 2579 } 2580 2581 } 2582 2583 }); 2584 2585}).apply(this, [window.theme, jQuery]); 2586 2587// Nav 2588(function(theme, $) { 2589 2590 theme = theme || {}; 2591 2592 var initialized = false; 2593 2594 $.extend(theme, { 2595 2596 Nav: { 2597 2598 defaults: { 2599 wrapper: $('#mainNav'), 2600 scrollDelay: 600, 2601 scrollAnimation: 'easeOutQuad' 2602 }, 2603 2604 initialize: function($wrapper, opts) { 2605 if (initialized) { 2606 return this; 2607 } 2608 2609 initialized = true; 2610 this.$wrapper = ($wrapper || this.defaults.wrapper); 2611 2612 this 2613 .setOptions(opts) 2614 .build() 2615 .events(); 2616 2617 return this; 2618 }, 2619 2620 setOptions: function(opts) { 2621 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options'))); 2622 2623 return this; 2624 }, 2625 2626 build: function() { 2627 var self = this, 2628 $html = $('html'), 2629 $header = $('#header'), 2630 thumbInfoPreview; 2631 2632 // Add Arrows 2633 $header.find('.dropdown-toggle, .dropdown-submenu > a').append($('<i />').addClass('fa fa-caret-down')); 2634 2635 // Preview Thumbs 2636 self.$wrapper.find('a[data-thumb-preview]').each(function() { 2637 thumbInfoPreview = $('<span />').addClass('thumb-info thumb-info-preview') 2638 .append($('<span />').addClass('thumb-info-wrapper') 2639 .append($('<span />').addClass('thumb-info-image').css('background-image', 'url(' + $(this).data('thumb-preview') + ')') 2640 ) 2641 ); 2642 2643 $(this).append(thumbInfoPreview); 2644 }); 2645 2646 // Side Header Right (Reverse Dropdown) 2647 if($html.hasClass('side-header-right')) { 2648 $header.find('.dropdown').addClass('dropdown-reverse'); 2649 } 2650 2651 return this; 2652 }, 2653 2654 events: function() { 2655 var self = this, 2656 $header = $('#header'), 2657 $window = $(window); 2658 2659 $header.find('a[href="#"]').on('click', function(e) { 2660 e.preventDefault(); 2661 }); 2662 2663 // Mobile Arrows 2664 $header.find('.dropdown-toggle[href="#"], .dropdown-submenu a[href="#"], .dropdown-toggle[href!="#"] .fa-caret-down, .dropdown-submenu a[href!="#"] .fa-caret-down').on('click', function(e) { 2665 e.preventDefault(); 2666 if ($window.width() < 992) { 2667 $(this).closest('li').toggleClass('opened'); 2668 } 2669 }); 2670 2671 // Touch Devices with normal resolutions 2672 if('ontouchstart' in document.documentElement) { 2673 $header.find('.dropdown-toggle:not([href="#"]), .dropdown-submenu > a:not([href="#"])') 2674 .on('touchstart click', function(e) { 2675 if($window.width() > 991) { 2676 2677 e.stopPropagation(); 2678 e.preventDefault(); 2679 2680 if(e.handled !== true) { 2681 2682 var li = $(this).closest('li'); 2683 2684 if(li.hasClass('tapped')) { 2685 location.href = $(this).attr('href'); 2686 } 2687 2688 li.addClass('tapped'); 2689 2690 e.handled = true; 2691 } else { 2692 return false;
2693 } 2694 2695 return false; 2696 2697 } 2698 }) 2699 .on('blur', function(e) { 2700 $(this).closest('li').removeClass('tapped'); 2701 }); 2702 2703 } 2704 2705 // Collapse Nav 2706 $header.find('[data-collapse-nav]').on('click', function(e) { 2707 $(this).parents('.collapse').removeClass('in'); 2708 }); 2709 2710 // Anchors Position 2711 $('[data-hash]').each(function() { 2712 2713 var target = $(this).attr('href'), 2714 offset = ($(this).is("[data-hash-offset]") ? $(this).data('hash-offset') : 0); 2715 2716 if($(target).get(0)) { 2717 $(this).on('click', function(e) { 2718 e.preventDefault(); 2719 2720 // Close Collapse if Opened 2721 $(this).parents('.collapse.in').removeClass('in'); 2722 2723 self.scrollToTarget(target, offset); 2724 2725 return; 2726 }); 2727 } 2728 2729 }); 2730 2731 return this; 2732 }, 2733 2734 scrollToTarget: function(target, offset) { 2735 var self = this; 2736 2737 $('body').addClass('scrolling'); 2738 2739 $('html, body').animate({ 2740 scrollTop: $(target).offset().top - offset 2741 }, self.options.scrollDelay, self.options.scrollAnimation, function() { 2742 $('body').removeClass('scrolling'); 2743 }); 2744 2745 return this; 2746 2747 } 2748 2749 } 2750 2751 }); 2752 2753}).apply(this, [window.theme, jQuery]); 2754 2755// Newsletter 2756(function(theme, $) { 2757 2758 theme = theme || {}; 2759 2760 var initialized = false; 2761 2762 $.extend(theme, { 2763 2764 Newsletter: { 2765 2766 defaults: { 2767 wrapper: $('#newsletterForm') 2768 }, 2769 2770 initialize: function($wrapper, opts) { 2771 if (initialized) { 2772 return this; 2773 } 2774 2775 initialized = true; 2776 this.$wrapper = ($wrapper || this.defaults.wrapper); 2777 2778 this 2779 .setOptions(opts) 2780 .build(); 2781 2782 return this; 2783 }, 2784 2785 setOptions: function(opts) { 2786 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options'))); 2787 2788 return this; 2789 }, 2790 2791 build: function() { 2792 if (!($.isFunction($.fn.validate))) { 2793 return this; 2794 } 2795 2796 var self = this, 2797 $email = self.$wrapper.find('#newsletterEmail'), 2798 $success = $('#newsletterSuccess'), 2799 $error = $('#newsletterError'); 2800 2801 self.$wrapper.validate({ 2802 submitHandler: function(form) { 2803 2804 $.ajax({ 2805 type: 'POST', 2806 url: self.$wrapper.attr('action'), 2807 data: { 2808 'email': $email.val() 2809 }, 2810 dataType: 'json', 2811 success: function(data) { 2812 if (data.response == 'success') { 2813 2814 $success.removeClass('hidden'); 2815 $error.addClass('hidden'); 2816 2817 $email 2818 .val('') 2819 .blur() 2820 .closest('.control-group') 2821 .removeClass('success') 2822 .removeClass('error'); 2823 2824 } else { 2825 2826 $error.html(data.message); 2827 $error.removeClass('hidden'); 2828 $success.addClass('hidden'); 2829 2830 $email 2831 .blur() 2832 .closest('.control-group') 2833 .removeClass('success') 2834 .addClass('error'); 2835 2836 } 2837 } 2838 }); 2839 2840 }, 2841 rules: { 2842 newsletterEmail: { 2843 required: true, 2844 email: true 2845 } 2846 }, 2847 errorPlacement: function(error, element) { 2848 2849 } 2850 }); 2851 2852 return this; 2853 } 2854 2855 } 2856 2857 }); 2858 2859}).apply(this, [window.theme, jQuery]); 2860 2861// Search 2862(function(theme, $) { 2863 2864 theme = theme || {}; 2865 2866 var initialized = false; 2867 2868 $.extend(theme, { 2869 2870 Search: { 2871 2872 defaults: { 2873 wrapper: $('#searchForm') 2874 }, 2875 2876 initialize: function($wrapper, opts) { 2877 if (initialized) { 2878 return this; 2879 } 2880 2881 initialized = true; 2882 this.$wrapper = ($wrapper || this.defaults.wrapper); 2883 2884 this 2885 .setOptions(opts) 2886 .build(); 2887 2888 return this; 2889 }, 2890 2891 setOptions: function(opts) { 2892 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options'))); 2893 2894 return this; 2895 }, 2896 2897 build: function() { 2898 if (!($.isFunction($.fn.validate))) { 2899 return this; 2900 } 2901 2902 this.$wrapper.validate({ 2903 errorPlacement: function(error, element) {} 2904 }); 2905 2906 return this; 2907 } 2908 2909 } 2910 2911 }); 2912 2913}).apply(this, [window.theme, jQuery]); 2914 2915// Sticky Header 2916(function(theme, $) { 2917 2918 theme = theme || {}; 2919 2920 var initialized = false; 2921 2922 $.extend(theme, { 2923 2924 StickyHeader: { 2925 2926 defaults: { 2927 wrapper: $('#header'), 2928 headerBody: $('#header .header-body'), 2929 stickyEnabled: true, 2930 stickyEnableOnBoxed: true, 2931 stickyEnableOnMobile: true, 2932 stickyStartAt: 0, 2933 stickyStartAtElement: false, 2934 stickySetTop: 0, 2935 stickyChangeLogo: false, 2936 stickyChangeLogoWrapper: true 2937 }, 2938 2939 initialize: function($wrapper, opts) { 2940 if (initialized) { 2941 return this; 2942 } 2943 2944 initialized = true; 2945 this.$wrapper = ($wrapper || this.defaults.wrapper); 2946 2947 this 2948 .setOptions(opts) 2949 .build() 2950 .events(); 2951 2952 return this; 2953 }, 2954 2955 setOptions: function(opts) { 2956 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options'))); 2957 2958 return this; 2959 }, 2960 2961 build: function() { 2962 if (!this.options.stickyEnableOnBoxed && $('html').hasClass('boxed') || !this.options.stickyEnabled) { 2963 return this; 2964 } 2965 2966 var self = this, 2967 $html = $('html'), 2968 $window = $(window), 2969 sideHeader = $html.hasClass('side-header'); 2970 2971 // HTML Classes 2972 $html.addClass('sticky-header-enabled'); 2973 2974 if (parseInt(self.options.stickySetTop) < 0) { 2975 $html.addClass('sticky-header-negative'); 2976 } 2977 2978 // Set Start At 2979 if(self.options.stickyStartAtElement) { 2980 2981 var $stickyStartAtElement = $(self.options.stickyStartAtElement); 2982 2983 $(window).on('scroll resize', function() { 2984 self.options.stickyStartAt = $stickyStartAtElement.offset().top; 2985 }); 2986 2987 $(window).trigger('resize'); 2988 } 2989 2990 // Boxed 2991 if($html.hasClass('boxed') && (parseInt(self.options.stickyStartAt) == 0) && $window.width() > 991) { 2992 self.options.stickyStartAt = 30; 2993 } 2994 2995 // Set Wrapper Min-Height 2996 self.options.wrapper.css('min-height', self.options.wrapper.height()); 2997 2998 // Check Sticky Header 2999 self.checkStickyHeader = function() { 3000 if ($window.scrollTop() >= parseInt(self.options.stickyStartAt)) { 3001 self.activateStickyHeader(); 3002 } else { 3003 self.deactivateStickyHeader(); 3004 } 3005 }; 3006 3007 // Activate Sticky Header 3008 self.activateStickyHeader = function() { 3009 3010 if ($window.width() < 992) { 3011 if (!self.options.stickyEnableOnMobile) { 3012 self.deactivateStickyHeader(); 3013 return; 3014 } 3015 } else { 3016 if (sideHeader) { 3017 self.deactivateStickyHeader(); 3018 return; 3019 } 3020 } 3021 3022 $html.addClass('sticky-header-active'); 3023 3024 self.options.headerBody.css('top', self.options.stickySetTop); 3025 3026 if (self.options.stickyChangeLogo) { 3027 self.changeLogo(true); 3028 } 3029 3030 $.event.trigger({ 3031 type: 'stickyHeader.activate' 3032 }); 3033 }; 3034 3035 // Deactivate Sticky Header 3036 self.deactivateStickyHeader = function() { 3037 3038 $html.removeClass('sticky-header-active'); 3039 3040 self.options.headerBody.css('top', 0); 3041 3042 if (self.options.stickyChangeLogo) { 3043 self.changeLogo(false); 3044 } 3045 3046 $.event.trigger({ 3047 type: 'stickyHeader.deactivate' 3048 }); 3049 }; 3050 3051 // Always Sticky 3052 if (parseInt(self.options.stickyStartAt) <= 0) { 3053 self.activateStickyHeader(); 3054 } 3055 3056 // Set Logo 3057 if (self.options.stickyChangeLogo) { 3058 3059 var $logoWrapper = self.options.wrapper.find('.header-logo'), 3060 $logo = $logoWrapper.find('img'), 3061 logoWidth = $logo.attr('width'), 3062 logoHeight = $logo.attr('height'), 3063 logoSmallTop = parseInt($logo.attr('data-sticky-top') ? $logo.attr('data-sticky-top') : 0), 3064 logoSmallWidth = parseInt($logo.attr('data-sticky-width') ? $logo.attr('data-sticky-width') : 'auto'),
3065 logoSmallHeight = parseInt($logo.attr('data-sticky-height') ? $logo.attr('data-sticky-height') : 'auto'); 3066 3067 if (self.options.stickyChangeLogoWrapper) { 3068 $logoWrapper.css({ 3069 'width': $logo.outerWidth(true), 3070 'height': $logo.outerHeight(true) 3071 }); 3072 } 3073 3074 self.changeLogo = function(activate) { 3075 if(activate) { 3076 $logo.css({ 3077 'top': logoSmallTop, 3078 'width': logoSmallWidth, 3079 'height': logoSmallHeight 3080 }); 3081 } else { 3082 $logo.css({ 3083 'top': 0, 3084 'width': logoWidth, 3085 'height': logoHeight 3086 }); 3087 } 3088 } 3089 3090 } 3091 3092 return this; 3093 }, 3094 3095 events: function() { 3096 var self = this; 3097 3098 if (!this.options.stickyEnableOnBoxed && $('body').hasClass('boxed') || !this.options.stickyEnabled) { 3099 return this; 3100 } 3101 3102 if (!self.options.alwaysStickyEnabled) { 3103 $(window).on('scroll resize', function() { 3104 self.checkStickyHeader(); 3105 }); 3106 } else { 3107 self.activateStickyHeader(); 3108 } 3109 3110 return this; 3111 } 3112 3113 } 3114 3115 }); 3116 3117}).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.