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