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