Advertisement
Guest User

js

a guest
Jun 17th, 2019
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Name:           Theme Base
  3. Written by:     Okler Themes - (http://www.okler.net)
  4. Theme Version:  7.5.0
  5. */
  6.  
  7. // Theme
  8. window.theme = {};
  9.  
  10. // Theme Common Functions
  11. window.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: -80,
  51.         delay: 100,
  52.         duration: '750ms',
  53.         minWindowWidth: 767
  54.     };
  55.  
  56.     PluginAnimate.prototype = {
  57.         initialize: function($el, opts) {
  58.             if ($el.data(instanceName)) {
  59.                 return this;
  60.             }
  61.  
  62.             this.$el = $el;
  63.  
  64.             this
  65.                 .setData()
  66.                 .setOptions(opts)
  67.                 .build();
  68.  
  69.             return this;
  70.         },
  71.  
  72.         setData: function() {
  73.             this.$el.data(instanceName, this);
  74.  
  75.             return this;
  76.         },
  77.  
  78.         setOptions: function(opts) {
  79.             this.options = $.extend(true, {}, PluginAnimate.defaults, opts, {
  80.                 wrapper: this.$el
  81.             });
  82.  
  83.             return this;
  84.         },
  85.  
  86.         build: function() {
  87.             var self = this;
  88.  
  89.             if($('body').hasClass('loading-overlay-showing')) {
  90.                 $(window).on('loading.overlay.ready', function(){
  91.                     self.animate();
  92.                 });
  93.             } else {
  94.                 self.animate();
  95.             }
  96.  
  97.             return this;
  98.         },
  99.  
  100.         animate: function() {
  101.             var self = this,
  102.                 $el = this.options.wrapper,
  103.                 delay = 0,
  104.                 duration = this.options.duration,
  105.                 elTopDistance = $el.offset().top,
  106.                 windowTopDistance = $(window).scrollTop();
  107.  
  108.             $el.addClass('appear-animation animated');
  109.  
  110.             if (!$('html').hasClass('no-csstransitions') && $(window).width() > self.options.minWindowWidth && elTopDistance >= windowTopDistance) {
  111.  
  112.                 $el.appear(function() {
  113.  
  114.                     $el.one('animation:show', function(ev) {
  115.                         delay = ($el.attr('data-appear-animation-delay') ? $el.attr('data-appear-animation-delay') : self.options.delay);
  116.                         duration = ($el.attr('data-appear-animation-duration') ? $el.attr('data-appear-animation-duration') : self.options.duration);
  117.  
  118.                         if (duration != '750ms') {
  119.                             $el.css('animation-duration', duration);
  120.                         }
  121.  
  122.                         $el.css('animation-delay', delay + 'ms');
  123.  
  124.                         $el.addClass($el.attr('data-appear-animation') + ' appear-animation-visible');
  125.                     });
  126.  
  127.                     $el.trigger('animation:show');
  128.  
  129.                 }, {
  130.                     accX: self.options.accX,
  131.                     accY: self.options.accY
  132.                 });
  133.  
  134.             } else {
  135.  
  136.                 $el.addClass('appear-animation-visible');
  137.  
  138.             }
  139.  
  140.             return this;
  141.         }
  142.     };
  143.  
  144.     // expose to scope
  145.     $.extend(theme, {
  146.         PluginAnimate: PluginAnimate
  147.     });
  148.  
  149.     // jquery plugin
  150.     $.fn.themePluginAnimate = function(opts) {
  151.         return this.map(function() {
  152.             var $this = $(this);
  153.  
  154.             if ($this.data(instanceName)) {
  155.                 return $this.data(instanceName);
  156.             } else {
  157.                 return new PluginAnimate($this, opts);
  158.             }
  159.  
  160.         });
  161.     };
  162.  
  163. }).apply(this, [window.theme, jQuery]);
  164.  
  165. // Before / After
  166. (function(theme, $) {
  167.  
  168.     theme = theme || {};
  169.  
  170.     var instanceName = '__beforeafter';
  171.  
  172.     var PluginBeforeAfter = function($el, opts) {
  173.         return this.initialize($el, opts);
  174.     };
  175.  
  176.     PluginBeforeAfter.defaults = {
  177.        
  178.     };
  179.  
  180.     PluginBeforeAfter.prototype = {
  181.         initialize: function($el, opts) {
  182.             this.$el = $el;
  183.  
  184.             this
  185.                 .setData()
  186.                 .setOptions(opts)
  187.                 .build();
  188.  
  189.             return this;
  190.         },
  191.  
  192.         setData: function() {
  193.             this.$el.data(instanceName, this);
  194.  
  195.             return this;
  196.         },
  197.  
  198.         setOptions: function(opts) {
  199.             this.options = $.extend(true, {}, PluginBeforeAfter.defaults, opts, {
  200.                 wrapper: this.$el
  201.             });
  202.  
  203.             return this;
  204.         },
  205.  
  206.         build: function() {
  207.  
  208.             if (!($.isFunction($.fn.twentytwenty))) {
  209.                 return this;
  210.             }
  211.  
  212.             var self = this;
  213.  
  214.             self.options.wrapper
  215.                 .twentytwenty(self.options);
  216.  
  217.             return this;
  218.  
  219.         }
  220.     };
  221.  
  222.     // expose to scope
  223.     $.extend(theme, {
  224.         PluginBeforeAfter: PluginBeforeAfter
  225.     });
  226.  
  227.     // jquery plugin
  228.     $.fn.themePluginBeforeAfter = function(opts) {
  229.         return this.map(function() {
  230.             var $this = $(this);
  231.  
  232.             if ($this.data(instanceName)) {
  233.                 return $this.data(instanceName);
  234.             } else {
  235.                 return new PluginBeforeAfter($this, opts);
  236.             }
  237.  
  238.         });
  239.     }
  240.  
  241. }).apply(this, [window.theme, jQuery]);
  242.  
  243. // Carousel
  244. (function(theme, $) {
  245.  
  246.     theme = theme || {};
  247.  
  248.     var instanceName = '__carousel';
  249.  
  250.     var PluginCarousel = function($el, opts) {
  251.         return this.initialize($el, opts);
  252.     };
  253.  
  254.     PluginCarousel.defaults = {
  255.         loop: true,
  256.         responsive: {
  257.             0: {
  258.                 items: 1
  259.             },
  260.             479: {
  261.                 items: 1
  262.             },
  263.             768: {
  264.                 items: 2
  265.             },
  266.             979: {
  267.                 items: 3
  268.             },
  269.             1199: {
  270.                 items: 4
  271.             }
  272.         },
  273.         navText: []
  274.     };
  275.  
  276.     PluginCarousel.prototype = {
  277.         initialize: function($el, opts) {
  278.             if ($el.data(instanceName)) {
  279.                 return this;
  280.             }
  281.  
  282.             this.$el = $el;
  283.  
  284.             this
  285.                 .setData()
  286.                 .setOptions(opts)
  287.                 .build();
  288.  
  289.             return this;
  290.         },
  291.  
  292.         setData: function() {
  293.             this.$el.data(instanceName, this);
  294.  
  295.             return this;
  296.         },
  297.  
  298.         setOptions: function(opts) {
  299.             this.options = $.extend(true, {}, PluginCarousel.defaults, opts, {
  300.                 wrapper: this.$el
  301.             });
  302.  
  303.             return this;
  304.         },
  305.  
  306.         build: function() {
  307.             if (!($.isFunction($.fn.owlCarousel))) {
  308.                 return this;
  309.             }
  310.  
  311.             var self = this,
  312.                 $el = this.options.wrapper;
  313.  
  314.             // Add Theme Class
  315.             $el.addClass('owl-theme');
  316.  
  317.             // Add Loading
  318.             $el.addClass('owl-loading');
  319.  
  320.             // Force RTL according to HTML dir attribute
  321.             if ($('html').attr('dir') == 'rtl') {
  322.                 this.options = $.extend(true, {}, this.options, {
  323.                     rtl: true
  324.                 });
  325.             }
  326.  
  327.             if (this.options.items == 1) {
  328.                 this.options.responsive = {}
  329.             }
  330.  
  331.             if (this.options.items > 4) {
  332.                 this.options = $.extend(true, {}, this.options, {
  333.                     responsive: {
  334.                         1199: {
  335.                             items: this.options.items
  336.                         }
  337.                     }
  338.                 });
  339.             }
  340.  
  341.             // Auto Height Fixes
  342.             if (this.options.autoHeight) {
  343.                 var itemsHeight = [];
  344.  
  345.                 $el.find('.owl-item').each(function(){
  346.                     if( $(this).hasClass('active') ) {
  347.                         itemsHeight.push( $(this).height() );
  348.                     }
  349.                 });
  350.  
  351.                 $(window).afterResize(function() {
  352.                     $el.find('.owl-stage-outer').height( Math.max.apply(null, itemsHeight) );
  353.                 });
  354.  
  355.                 $(window).on('load', function() {
  356.                     $el.find('.owl-stage-outer').height( Math.max.apply(null, itemsHeight) );
  357.                 });
  358.             }
  359.  
  360.             // Initialize OwlCarousel
  361.             $el.owlCarousel(this.options).addClass('owl-carousel-init');
  362.  
  363.             // Sync
  364.             if ($el.attr('data-sync')) {
  365.                 $el.on('change.owl.carousel', function(event) {
  366.                     if (event.namespace && event.property.name === 'position') {
  367.                         var target = event.relatedTarget.relative(event.property.value, true);
  368.                         $( $el.data('sync') ).owlCarousel('to', target, 300, true);                    
  369.                     }
  370.                 });
  371.             }
  372.  
  373.             // Carousel Center Active Item
  374.             if( $el.hasClass('carousel-center-active-item') ) {
  375.                 var itemsActive    = $el.find('.owl-item.active'),
  376.                     indexCenter    = Math.floor( ($el.find('.owl-item.active').length - 1) / 2 ),
  377.                     itemCenter     = itemsActive.eq(indexCenter);
  378.  
  379.                 itemCenter.addClass('current');
  380.  
  381.                 $el.on('change.owl.carousel', function(event) {
  382.                     $el.find('.owl-item').removeClass('current');
  383.                    
  384.                     setTimeout(function(){
  385.                         var itemsActive    = $el.find('.owl-item.active'),
  386.                             indexCenter    = Math.floor( ($el.find('.owl-item.active').length - 1) / 2 ),
  387.                             itemCenter     = itemsActive.eq(indexCenter);
  388.  
  389.                         itemCenter.addClass('current');
  390.                     }, 100);
  391.                 });
  392.  
  393.                 // Refresh
  394.                 $el.trigger('refresh.owl.carousel');
  395.  
  396.             }
  397.  
  398.             // Remove Loading
  399.             $el.removeClass('owl-loading');
  400.  
  401.             // Remove Height
  402.             $el.css('height', 'auto');
  403.  
  404.             return this;
  405.         }
  406.     };
  407.  
  408.     // expose to scope
  409.     $.extend(theme, {
  410.         PluginCarousel: PluginCarousel
  411.     });
  412.  
  413.     // jquery plugin
  414.     $.fn.themePluginCarousel = function(opts) {
  415.         return this.map(function() {
  416.             var $this = $(this);
  417.  
  418.             if ($this.data(instanceName)) {
  419.                 return $this.data(instanceName);
  420.             } else {
  421.                 return new PluginCarousel($this, opts);
  422.             }
  423.  
  424.         });
  425.     }
  426.  
  427. }).apply(this, [window.theme, jQuery]);
  428.  
  429. // Chart Circular
  430. (function(theme, $) {
  431.  
  432.     theme = theme || {};
  433.  
  434.     var instanceName = '__chartCircular';
  435.  
  436.     var PluginChartCircular = function($el, opts) {
  437.         return this.initialize($el, opts);
  438.     };
  439.  
  440.     PluginChartCircular.defaults = {
  441.         accX: 0,
  442.         accY: -150,
  443.         delay: 1,
  444.         barColor: '#0088CC',
  445.         trackColor: '#f2f2f2',
  446.         scaleColor: false,
  447.         scaleLength: 5,
  448.         lineCap: 'round',
  449.         lineWidth: 13,
  450.         size: 175,
  451.         rotate: 0,
  452.         animate: ({
  453.             duration: 2500,
  454.             enabled: true
  455.         })
  456.     };
  457.  
  458.     PluginChartCircular.prototype = {
  459.         initialize: function($el, opts) {
  460.             if ($el.data(instanceName)) {
  461.                 return this;
  462.             }
  463.  
  464.             this.$el = $el;
  465.  
  466.             this
  467.                 .setData()
  468.                 .setOptions(opts)
  469.                 .build();
  470.  
  471.             return this;
  472.         },
  473.  
  474.         setData: function() {
  475.             this.$el.data(instanceName, this);
  476.  
  477.             return this;
  478.         },
  479.  
  480.         setOptions: function(opts) {
  481.             this.options = $.extend(true, {}, PluginChartCircular.defaults, opts, {
  482.                 wrapper: this.$el
  483.             });
  484.  
  485.             return this;
  486.         },
  487.  
  488.         build: function() {
  489.             if (!($.isFunction($.fn.appear)) || !($.isFunction($.fn.easyPieChart))) {
  490.                 return this;
  491.             }
  492.  
  493.             var self = this,
  494.                 $el = this.options.wrapper,
  495.                 value = ($el.attr('data-percent') ? $el.attr('data-percent') : 0),
  496.                 percentEl = $el.find('.percent');
  497.  
  498.             $.extend(true, self.options, {
  499.                 onStep: function(from, to, currentValue) {
  500.                     percentEl.html(parseInt(currentValue));
  501.                 }
  502.             });
  503.  
  504.             $el.attr('data-percent', 0);
  505.  
  506.             $el.appear(function() {
  507.  
  508.                 $el.easyPieChart(self.options);
  509.  
  510.                 setTimeout(function() {
  511.  
  512.                     $el.data('easyPieChart').update(value);
  513.                     $el.attr('data-percent', value);
  514.  
  515.                 }, self.options.delay);
  516.  
  517.             }, {
  518.                 accX: self.options.accX,
  519.                 accY: self.options.accY
  520.             });
  521.  
  522.             return this;
  523.         }
  524.     };
  525.  
  526.     // expose to scope
  527.     $.extend(theme, {
  528.         PluginChartCircular: PluginChartCircular
  529.     });
  530.  
  531.     // jquery plugin
  532.     $.fn.themePluginChartCircular = function(opts) {
  533.         return this.map(function() {
  534.             var $this = $(this);
  535.  
  536.             if ($this.data(instanceName)) {
  537.                 return $this.data(instanceName);
  538.             } else {
  539.                 return new PluginChartCircular($this, opts);
  540.             }
  541.  
  542.         });
  543.     }
  544.  
  545. }).apply(this, [window.theme, jQuery]);
  546.  
  547. // Countdown
  548. (function(theme, $) {
  549.  
  550.     theme = theme || {};
  551.  
  552.     var instanceName = '__countdown';
  553.  
  554.     var PluginCountdown = function($el, opts) {
  555.         return this.initialize($el, opts);
  556.     };
  557.  
  558.     PluginCountdown.defaults = {
  559.         date: '2030/06/10 12:00:00',
  560.         textDay: 'DAY',
  561.         textHour: 'HRS',
  562.         textMin: 'MIN',
  563.         textSec: 'SEC',
  564.         uppercase: true,
  565.         numberClass: '',
  566.         wrapperClass: '',
  567.         insertHTMLbefore: '',
  568.         insertHTMLafter: ''
  569.     };
  570.  
  571.     PluginCountdown.prototype = {
  572.         initialize: function($el, opts) {
  573.             if ($el.data(instanceName)) {
  574.                 return this;
  575.             }
  576.  
  577.             this.$el = $el;
  578.  
  579.             this
  580.                 .setData()
  581.                 .setOptions(opts)
  582.                 .build();
  583.  
  584.             return this;
  585.         },
  586.  
  587.         setData: function() {
  588.             this.$el.data(instanceName, this);
  589.  
  590.             return this;
  591.         },
  592.  
  593.         setOptions: function(opts) {
  594.             this.options = $.extend(true, {}, PluginCountdown.defaults, opts, {
  595.                 wrapper: this.$el
  596.             });
  597.  
  598.             return this;
  599.         },
  600.  
  601.         build: function() {
  602.             if (!($.isFunction($.fn.countTo))) {
  603.                 return this;
  604.             }
  605.  
  606.             var self = this,
  607.                 $el = this.options.wrapper,
  608.                 numberClass = ( self.options.numberClass ) ? ' ' + self.options.numberClass : '',
  609.                 wrapperClass = ( self.options.wrapperClass ) ? ' ' + self.options.wrapperClass : '';
  610.  
  611.             if( self.options.uppercase ) {
  612.                 $el.countdown(self.options.date).on('update.countdown', function(event) {
  613.                     var $this = $(this).html(event.strftime(self.options.insertHTMLbefore
  614.                         + '<span class="days'+ wrapperClass +'"><span class="'+ numberClass +'">%D</span> '+ self.options.textDay +'<div class="d-inline text-uppercase">%!d</div></span> '
  615.                         + '<span class="hours'+ wrapperClass +'"><span class="'+ numberClass +'">%H</span> '+ self.options.textHour +'</span> '
  616.                         + '<span class="minutes'+ wrapperClass +'"><span class="'+ numberClass +'">%M</span> '+ self.options.textMin +'</span> '
  617.                         + '<span class="seconds'+ wrapperClass +'"><span class="'+ numberClass +'">%S</span> '+ self.options.textSec +'</span> '
  618.                         + self.options.insertHTMLafter
  619.                     ));
  620.                 });
  621.             } else {
  622.                 $el.countdown(self.options.date).on('update.countdown', function(event) {
  623.                     var $this = $(this).html(event.strftime(self.options.insertHTMLbefore
  624.                         + '<span class="days'+ wrapperClass +'"><span class="'+ numberClass +'">%D</span> '+ self.options.textDay +'%!d</span> '
  625.                         + '<span class="hours'+ wrapperClass +'"><span class="'+ numberClass +'">%H</span> '+ self.options.textHour +'</span> '
  626.                         + '<span class="minutes'+ wrapperClass +'"><span class="'+ numberClass +'">%M</span> '+ self.options.textMin +'</span> '
  627.                         + '<span class="seconds'+ wrapperClass +'"><span class="'+ numberClass +'">%S</span> '+ self.options.textSec +'</span> '
  628.                         + self.options.insertHTMLafter
  629.                     ));
  630.                 });
  631.             }
  632.  
  633.             return this;
  634.         }
  635.     };
  636.  
  637.     // expose to scope
  638.     $.extend(theme, {
  639.         PluginCountdown: PluginCountdown
  640.     });
  641.  
  642.     // jquery plugin
  643.     $.fn.themePluginCountdown = function(opts) {
  644.         return this.map(function() {
  645.             var $this = $(this);
  646.  
  647.             if ($this.data(instanceName)) {
  648.                 return $this.data(instanceName);
  649.             } else {
  650.                 return new PluginCountdown($this, opts);
  651.             }
  652.  
  653.         });
  654.     }
  655.  
  656. }).apply(this, [window.theme, jQuery]);
  657.  
  658. // Counter
  659. (function(theme, $) {
  660.  
  661.     theme = theme || {};
  662.  
  663.     var instanceName = '__counter';
  664.  
  665.     var PluginCounter = function($el, opts) {
  666.         return this.initialize($el, opts);
  667.     };
  668.  
  669.     PluginCounter.defaults = {
  670.         accX: 0,
  671.         accY: 0,
  672.         speed: 3000,
  673.         refreshInterval: 100,
  674.         decimals: 0,
  675.         onUpdate: null,
  676.         onComplete: null
  677.     };
  678.  
  679.     PluginCounter.prototype = {
  680.         initialize: function($el, opts) {
  681.             if ($el.data(instanceName)) {
  682.                 return this;
  683.             }
  684.  
  685.             this.$el = $el;
  686.  
  687.             this
  688.                 .setData()
  689.                 .setOptions(opts)
  690.                 .build();
  691.  
  692.             return this;
  693.         },
  694.  
  695.         setData: function() {
  696.             this.$el.data(instanceName, this);
  697.  
  698.             return this;
  699.         },
  700.  
  701.         setOptions: function(opts) {
  702.             this.options = $.extend(true, {}, PluginCounter.defaults, opts, {
  703.                 wrapper: this.$el
  704.             });
  705.  
  706.             return this;
  707.         },
  708.  
  709.         build: function() {
  710.             if (!($.isFunction($.fn.countTo))) {
  711.                 return this;
  712.             }
  713.  
  714.             var self = this,
  715.                 $el = this.options.wrapper;
  716.  
  717.             $.extend(self.options, {
  718.                 onComplete: function() {
  719.                     if ($el.data('append')) {
  720.                         $el.html($el.html() + $el.data('append'));
  721.                     }
  722.  
  723.                     if ($el.data('prepend')) {
  724.                         $el.html($el.data('prepend') + $el.html());
  725.                     }
  726.                 }
  727.             });
  728.  
  729.             $el.appear(function() {
  730.  
  731.                 $el.countTo(self.options);
  732.  
  733.             }, {
  734.                 accX: self.options.accX,
  735.                 accY: self.options.accY
  736.             });
  737.  
  738.             return this;
  739.         }
  740.     };
  741.  
  742.     // expose to scope
  743.     $.extend(theme, {
  744.         PluginCounter: PluginCounter
  745.     });
  746.  
  747.     // jquery plugin
  748.     $.fn.themePluginCounter = function(opts) {
  749.         return this.map(function() {
  750.             var $this = $(this);
  751.  
  752.             if ($this.data(instanceName)) {
  753.                 return $this.data(instanceName);
  754.             } else {
  755.                 return new PluginCounter($this, opts);
  756.             }
  757.  
  758.         });
  759.     }
  760.  
  761. }).apply(this, [window.theme, jQuery]);
  762.  
  763. // Float Element
  764. (function(theme, $) {
  765.  
  766.     'use strict';
  767.  
  768.     theme = theme || {};
  769.  
  770.     var instanceName = '__floatElement';
  771.  
  772.     var PluginFloatElement = function($el, opts) {
  773.         return this.initialize($el, opts);
  774.     };
  775.  
  776.     PluginFloatElement.defaults = {
  777.         startPos: 'top',
  778.         speed: 3,
  779.         horizontal: false,
  780.         transition: false
  781.     };
  782.  
  783.     PluginFloatElement.prototype = {
  784.         initialize: function($el, opts) {
  785.             if ($el.data(instanceName)) {
  786.                 return this;
  787.             }
  788.  
  789.             this.$el = $el;
  790.  
  791.             this
  792.                 .setData()
  793.                 .setOptions(opts)
  794.                 .build();
  795.  
  796.             return this;
  797.         },
  798.  
  799.         setData: function() {
  800.             this.$el.data(instanceName, this);
  801.  
  802.             return this;
  803.         },
  804.  
  805.         setOptions: function(opts) {
  806.             this.options = $.extend(true, {}, PluginFloatElement.defaults, opts, {
  807.                 wrapper: this.$el
  808.             });
  809.  
  810.             return this;
  811.         },
  812.  
  813.         build: function() {
  814.             var self = this,
  815.                 $el = this.options.wrapper,
  816.                 $window = $(window),
  817.                 minus;
  818.  
  819.             if( self.options.style ) {
  820.                 $el.attr('style', self.options.style);
  821.             }
  822.  
  823.             if( $window.width() > 767 ) {
  824.  
  825.                 // Set Start Position
  826.                 if( self.options.startPos == 'none' ) {
  827.                     minus = '';
  828.                 } else if( self.options.startPos == 'top' ) {
  829.                     $el.css({
  830.                         top: 0
  831.                     });
  832.                     minus = '';
  833.                 } else {
  834.                     $el.css({
  835.                         bottom: 0
  836.                     });
  837.                     minus = '-';
  838.                 }
  839.  
  840.                 // Set Transition
  841.                 if( self.options.transition ) {
  842.                     $el.css({
  843.                         transition: 'ease transform 500ms'
  844.                     });
  845.                 }
  846.  
  847.                 // First Load
  848.                 self.movement(minus);  
  849.  
  850.                 // Scroll
  851.                 $window.on('scroll', function(){
  852.                     self.movement(minus);                  
  853.                 });
  854.  
  855.             }
  856.  
  857.             return this;
  858.         },
  859.  
  860.         movement: function(minus) {
  861.             var self = this,
  862.                 $el = this.options.wrapper,
  863.                 $window = $(window),
  864.                 scrollTop = $window.scrollTop(),
  865.                 elementOffset = $el.offset().top,
  866.                 currentElementOffset = (elementOffset - scrollTop);
  867.  
  868.             var scrollPercent = 100 * currentElementOffset / ($window.height());
  869.  
  870.             if( $el.visible( true ) ) {
  871.  
  872.                 if( !self.options.horizontal ) {
  873.  
  874.                     $el.css({
  875.                         transform: 'translate3d(0, '+ minus + scrollPercent / self.options.speed +'%, 0)'
  876.                     });
  877.  
  878.                 } else {
  879.  
  880.                     $el.css({
  881.                         transform: 'translate3d('+ minus + scrollPercent / self.options.speed +'%, '+ minus + scrollPercent / self.options.speed +'%, 0)'
  882.                     });
  883.  
  884.                 }
  885.                
  886.             }
  887.         }
  888.     };
  889.  
  890.     // expose to scope
  891.     $.extend(theme, {
  892.         PluginFloatElement: PluginFloatElement
  893.     });
  894.  
  895.     // jquery plugin
  896.     $.fn.themePluginFloatElement = function(opts) {
  897.         return this.map(function() {
  898.             var $this = $(this);
  899.  
  900.             if ($this.data(instanceName)) {
  901.                 return $this.data(instanceName);
  902.             } else {
  903.                 return new PluginFloatElement($this, opts);
  904.             }
  905.  
  906.         });
  907.     }
  908.  
  909. }).apply(this, [window.theme, jQuery]);
  910.  
  911. // Icon
  912. (function(theme, $) {
  913.  
  914.     'use strict';
  915.  
  916.     theme = theme || {};
  917.  
  918.     var instanceName = '__icon';
  919.  
  920.     var PluginIcon = function($el, opts) {
  921.         return this.initialize($el, opts);
  922.     };
  923.  
  924.     PluginIcon.defaults = {
  925.         color: '#2388ED',
  926.         animated: false,
  927.         delay: 300
  928.     };
  929.  
  930.     PluginIcon.prototype = {
  931.         initialize: function($el, opts) {
  932.             if ($el.data(instanceName)) {
  933.                 return this;
  934.             }
  935.  
  936.             this.$el = $el;
  937.  
  938.             this
  939.                 .setData()
  940.                 .setOptions(opts)
  941.                 .build();
  942.  
  943.             return this;
  944.         },
  945.  
  946.         setData: function() {
  947.             this.$el.data(instanceName, this);
  948.  
  949.             return this;
  950.         },
  951.  
  952.         setOptions: function(opts) {
  953.             this.options = $.extend(true, {}, PluginIcon.defaults, opts, {
  954.                 wrapper: this.$el
  955.             });
  956.  
  957.             return this;
  958.         },
  959.  
  960.         build: function() {
  961.             var self     = this,
  962.                 $el      = this.options.wrapper,
  963.                 color    = self.options.color,
  964.                 elTopDistance = $el.offset().top,
  965.                 windowTopDistance = $(window).scrollTop(),
  966.                 duration = ( self.options.animated && !self.options.strokeBased ) ? 200 : 100;
  967.  
  968.             // Check origin
  969.             if( window.location.origin === 'file://' ) {
  970.                 $el.css('opacity', 1);
  971.                 return;
  972.             }
  973.  
  974.             // Duration
  975.             if( self.options.duration ) {
  976.                 duration = self.options.duration;
  977.             }
  978.  
  979.             // SVG Content
  980.             var SVGContent = $.get({
  981.                 url: $el.attr('src'),
  982.                 success: function(data, status, xhr){
  983.                     var iconWrapper = $('<div class="animated-icon">'+ xhr.responseText +'</div>'),
  984.                         uniqid = 'icon_' + Math.floor(Math.random() * 26) + Date.now();
  985.  
  986.                     iconWrapper.find('svg').attr('id', uniqid);
  987.  
  988.                     if( $el.attr('width') ) {
  989.                         iconWrapper.find('svg')
  990.                             .attr('width', $el.attr('width'))
  991.                             .attr('height', $el.attr('width'));                    
  992.                     }
  993.  
  994.                     $el.replaceWith(iconWrapper);
  995.  
  996.                     $el = iconWrapper;
  997.  
  998.                     var icon = new Vivus(uniqid, {start: 'manual', type: 'sync', selfDestroy: true, duration: duration, onReady: function(obj){
  999.                         var styleElement = document.createElementNS("http://www.w3.org/2000/svg", "style"),
  1000.                             animateStyle = '';
  1001.  
  1002.                         // SVG Fill Based
  1003.                         if( self.options.animated && !self.options.strokeBased || !self.options.animated && color && !self.options.strokeBased ) {
  1004.                             animateStyle = 'stroke-width: 0.1px; fill-opacity: 0; transition: ease fill-opacity 300ms;';
  1005.                            
  1006.                             // Set Style on SVG inside object
  1007.                             styleElement.textContent = '#' + uniqid + ' path, #' + uniqid + ' line, #' + uniqid + ' rect, #' + uniqid + ' circle, #' + uniqid + ' polyline { fill: '+ color +'; stroke: '+ color +'; '+ animateStyle + (self.options.svgStyle ? self.options.svgStyle : "") + ' } .finished path { fill-opacity: 1; }';
  1008.                             obj.el.appendChild(styleElement);
  1009.                         }
  1010.  
  1011.                         // SVG Stroke Based
  1012.                         if( self.options.animated && self.options.strokeBased || !self.options.animated && color && self.options.strokeBased ) {
  1013.  
  1014.                             // Set Style on SVG inside object
  1015.                             styleElement.textContent = '#' + uniqid + ' path, #' + uniqid + ' line, #' + uniqid + ' rect, #' + uniqid + ' circle, #' + uniqid + ' polyline { stroke: '+ color +'; ' + (self.options.svgStyle ? self.options.svgStyle : "") + '}';
  1016.                             obj.el.appendChild(styleElement);
  1017.                         }
  1018.  
  1019.                         $.event.trigger('theme.plugin.icon.svg.ready');
  1020.                     }});
  1021.  
  1022.                     // Isn't animated
  1023.                     if( !self.options.animated ) {
  1024.                         setTimeout(function(){
  1025.                             icon.finish();
  1026.                         }, 10);
  1027.                         $el.css({ opacity: 1 });
  1028.                     }
  1029.  
  1030.                     // Animated
  1031.                     if( self.options.animated && $(window).width() > 767 ) {
  1032.                         // First Load
  1033.                         if( $el.visible( true ) ) {
  1034.                             self.startIconAnimation( icon, $el );
  1035.                         } else if( elTopDistance < windowTopDistance ) {
  1036.                             self.startIconAnimation( icon, $el );
  1037.                         }
  1038.  
  1039.                         // On Scroll
  1040.                         $(window).on('scroll', function(){
  1041.                             if( $el.visible( true ) ) {
  1042.                                 self.startIconAnimation( icon, $el );
  1043.                             }
  1044.                         });
  1045.  
  1046.                     } else {
  1047.                        
  1048.                         $el.css({ opacity: 1 });
  1049.                         icon.finish();
  1050.                        
  1051.                         $(window).on('theme.plugin.icon.svg.ready', function(){
  1052.                             setTimeout(function(){
  1053.                                 icon.el.setAttribute('class', 'finished');
  1054.                                 icon.finish();
  1055.                             }, 300);
  1056.                         });
  1057.                        
  1058.                     }
  1059.  
  1060.                 }
  1061.             });
  1062.  
  1063.             return this;
  1064.         },
  1065.         startIconAnimation: function(icon, $el) {
  1066.             var self = this;
  1067.  
  1068.             // Animate for better performance
  1069.             $({to:0}).animate({to:1}, ((self.options.strokeBased) ? self.options.delay : self.options.delay + 300 ), function() {
  1070.                 $el.css({ opacity: 1 });
  1071.             });
  1072.  
  1073.             $({to:0}).animate({to:1}, self.options.delay, function() {
  1074.                 icon.play(1);
  1075.  
  1076.                 setTimeout(function(){
  1077.                     icon.el.setAttribute('class', 'finished');
  1078.                 }, icon.duration * 5 );
  1079.             });
  1080.         }
  1081.     };
  1082.  
  1083.     // expose to scope
  1084.     $.extend(theme, {
  1085.         PluginIcon: PluginIcon
  1086.     });
  1087.  
  1088.     // jquery plugin
  1089.     $.fn.themePluginIcon = function(opts) {
  1090.         return this.map(function() {
  1091.             var $this = $(this);
  1092.  
  1093.             if ($this.data(instanceName)) {
  1094.                 return $this.data(instanceName);
  1095.             } else {
  1096.                 return new PluginIcon($this, opts);
  1097.             }
  1098.  
  1099.         });
  1100.     };
  1101.  
  1102. }).apply(this, [window.theme, jQuery]);
  1103.  
  1104. // Lazy Load
  1105. (function(theme, $) {
  1106.  
  1107.     theme = theme || {};
  1108.  
  1109.     var instanceName = '__lazyload';
  1110.  
  1111.     var PluginLazyLoad = function($el, opts) {
  1112.         return this.initialize($el, opts);
  1113.     };
  1114.  
  1115.     PluginLazyLoad.defaults = {
  1116.         effect: 'show',
  1117.         appearEffect: '',
  1118.         appear: function(elements_left, settings) {
  1119.            
  1120.         },
  1121.         load: function(elements_left, settings) {
  1122.             $(this).addClass($.trim('lazy-load-loaded ' + settings.appearEffect));
  1123.         }
  1124.     };
  1125.  
  1126.     PluginLazyLoad.prototype = {
  1127.         initialize: function($el, opts) {
  1128.             if ($el.data(instanceName)) {
  1129.                 return this;
  1130.             }
  1131.  
  1132.             this.$el = $el;
  1133.  
  1134.             this
  1135.                 .setData()
  1136.                 .setOptions(opts)
  1137.                 .build();
  1138.  
  1139.             return this;
  1140.         },
  1141.  
  1142.         setData: function() {
  1143.             this.$el.data(instanceName, this);
  1144.  
  1145.             return this;
  1146.         },
  1147.  
  1148.         setOptions: function(opts) {
  1149.             this.options = $.extend(true, {}, PluginLazyLoad.defaults, opts, {
  1150.                 wrapper: this.$el
  1151.             });
  1152.  
  1153.             return this;
  1154.         },
  1155.  
  1156.         build: function() {
  1157.             if (!($.isFunction($.fn.lazyload))) {
  1158.                 return this;
  1159.             }
  1160.  
  1161.             var self = this;
  1162.  
  1163.             self.options.wrapper.lazyload(this.options);
  1164.  
  1165.             return this;
  1166.         }
  1167.     };
  1168.  
  1169.     // expose to scope
  1170.     $.extend(theme, {
  1171.         PluginLazyLoad: PluginLazyLoad
  1172.     });
  1173.  
  1174.     // jquery plugin
  1175.     $.fn.themePluginLazyLoad = function(opts) {
  1176.         return this.map(function() {
  1177.             var $this = $(this);
  1178.  
  1179.             if ($this.data(instanceName)) {
  1180.                 return $this.data(instanceName);
  1181.             } else {
  1182.                 return new PluginLazyLoad($this, opts);
  1183.             }
  1184.  
  1185.         });
  1186.     }
  1187.  
  1188. }).apply(this, [window.theme, jQuery]);
  1189.  
  1190. // Lightbox
  1191. (function(theme, $) {
  1192.  
  1193.     theme = theme || {};
  1194.  
  1195.     var instanceName = '__lightbox';
  1196.  
  1197.     var PluginLightbox = function($el, opts) {
  1198.         return this.initialize($el, opts);
  1199.     };
  1200.  
  1201.     PluginLightbox.defaults = {
  1202.         tClose: 'Close (Esc)', // Alt text on close button
  1203.         tLoading: 'Loading...', // Text that is displayed during loading. Can contain %curr% and %total% keys
  1204.         gallery: {
  1205.             tPrev: 'Previous (Left arrow key)', // Alt text on left arrow
  1206.             tNext: 'Next (Right arrow key)', // Alt text on right arrow
  1207.             tCounter: '%curr% of %total%' // Markup for "1 of 7" counter
  1208.         },
  1209.         image: {
  1210.             tError: '<a href="%url%">The image</a> could not be loaded.' // Error message when image could not be loaded
  1211.         },
  1212.         ajax: {
  1213.             tError: '<a href="%url%">The content</a> could not be loaded.' // Error message when ajax request failed
  1214.         },
  1215.         callbacks: {
  1216.             open: function() {
  1217.                 $('html').addClass('lightbox-opened');
  1218.             },
  1219.             close: function() {
  1220.                 $('html').removeClass('lightbox-opened');
  1221.             }
  1222.         }
  1223.     };
  1224.  
  1225.     PluginLightbox.prototype = {
  1226.         initialize: function($el, opts) {
  1227.             if ($el.data(instanceName)) {
  1228.                 return this;
  1229.             }
  1230.  
  1231.             this.$el = $el;
  1232.  
  1233.             this
  1234.                 .setData()
  1235.                 .setOptions(opts)
  1236.                 .build();
  1237.  
  1238.             return this;
  1239.         },
  1240.  
  1241.         setData: function() {
  1242.             this.$el.data(instanceName, this);
  1243.  
  1244.             return this;
  1245.         },
  1246.  
  1247.         setOptions: function(opts) {
  1248.             this.options = $.extend(true, {}, PluginLightbox.defaults, opts, {
  1249.                 wrapper: this.$el
  1250.             });
  1251.  
  1252.             return this;
  1253.         },
  1254.  
  1255.         build: function() {
  1256.             if (!($.isFunction($.fn.magnificPopup))) {
  1257.                 return this;
  1258.             }
  1259.  
  1260.             this.options.wrapper.magnificPopup(this.options);
  1261.  
  1262.             return this;
  1263.         }
  1264.     };
  1265.  
  1266.     // expose to scope
  1267.     $.extend(theme, {
  1268.         PluginLightbox: PluginLightbox
  1269.     });
  1270.  
  1271.     // jquery plugin
  1272.     $.fn.themePluginLightbox = function(opts) {
  1273.         return this.map(function() {
  1274.             var $this = $(this);
  1275.  
  1276.             if ($this.data(instanceName)) {
  1277.                 return $this.data(instanceName);
  1278.             } else {
  1279.                 return new PluginLightbox($this, opts);
  1280.             }
  1281.  
  1282.         });
  1283.     }
  1284.  
  1285. }).apply(this, [window.theme, jQuery]);
  1286.  
  1287. // Loading Overlay
  1288. (function(theme, $) {
  1289.  
  1290.     'use strict';
  1291.  
  1292.     theme = theme || {};
  1293.  
  1294.     var loadingOverlayTemplate = [
  1295.         '<div class="loading-overlay">',
  1296.             '<div class="bounce-loader"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>',
  1297.         '</div>'
  1298.     ].join('');
  1299.  
  1300.     var LoadingOverlay = function( $wrapper, options ) {
  1301.         return this.initialize( $wrapper, options );
  1302.     };
  1303.  
  1304.     LoadingOverlay.prototype = {
  1305.  
  1306.         options: {
  1307.             css: {},
  1308.             hideDelay: 500
  1309.         },
  1310.  
  1311.         initialize: function( $wrapper, options ) {
  1312.             this.$wrapper = $wrapper;
  1313.  
  1314.             this
  1315.                 .setVars()
  1316.                 .setOptions( options )
  1317.                 .build()
  1318.                 .events();
  1319.  
  1320.             this.$wrapper.data( 'loadingOverlay', this );
  1321.         },
  1322.  
  1323.         setVars: function() {
  1324.             this.$overlay = this.$wrapper.find('.loading-overlay');
  1325.  
  1326.             return this;
  1327.         },
  1328.  
  1329.         setOptions: function( options ) {
  1330.             if ( !this.$overlay.get(0) ) {
  1331.                 this.matchProperties();
  1332.             }
  1333.             this.options     = $.extend( true, {}, this.options, options, theme.fn.getOptions(this.$wrapper.data('plugin-options')) );
  1334.  
  1335.             this.loaderClass = this.getLoaderClass( this.options.css.backgroundColor );
  1336.  
  1337.             return this;
  1338.         },
  1339.  
  1340.         build: function() {
  1341.             if ( !this.$overlay.closest(document.documentElement).get(0) ) {
  1342.                 if ( !this.$cachedOverlay ) {
  1343.                     this.$overlay = $( loadingOverlayTemplate ).clone();
  1344.  
  1345.                     if ( this.options.css ) {
  1346.                         this.$overlay.css( this.options.css );
  1347.                         this.$overlay.find( '.loader' ).addClass( this.loaderClass );
  1348.                     }
  1349.                 } else {
  1350.                     this.$overlay = this.$cachedOverlay.clone();
  1351.                 }
  1352.  
  1353.                 this.$wrapper.append( this.$overlay );
  1354.             }
  1355.  
  1356.             if ( !this.$cachedOverlay ) {
  1357.                 this.$cachedOverlay = this.$overlay.clone();
  1358.             }
  1359.  
  1360.             return this;
  1361.         },
  1362.  
  1363.         events: function() {
  1364.             var _self = this;
  1365.  
  1366.             if ( this.options.startShowing ) {
  1367.                 _self.show();
  1368.             }
  1369.  
  1370.             if ( this.$wrapper.is('body') || this.options.hideOnWindowLoad ) {
  1371.                 $( window ).on( 'load error', function() {
  1372.                     _self.hide();
  1373.                 });
  1374.             }
  1375.  
  1376.             if ( this.options.listenOn ) {
  1377.                 $( this.options.listenOn )
  1378.                     .on( 'loading-overlay:show beforeSend.ic', function( e ) {
  1379.                         e.stopPropagation();
  1380.                         _self.show();
  1381.                     })
  1382.                     .on( 'loading-overlay:hide complete.ic', function( e ) {
  1383.                         e.stopPropagation();
  1384.                         _self.hide();
  1385.                     });
  1386.             }
  1387.  
  1388.             this.$wrapper
  1389.                 .on( 'loading-overlay:show beforeSend.ic', function( e ) {
  1390.                     if ( e.target === _self.$wrapper.get(0) ) {
  1391.                         e.stopPropagation();
  1392.                         _self.show();
  1393.                         return true;
  1394.                     }
  1395.                     return false;
  1396.                 })
  1397.                 .on( 'loading-overlay:hide complete.ic', function( e ) {
  1398.                     if ( e.target === _self.$wrapper.get(0) ) {
  1399.                         e.stopPropagation();
  1400.                         _self.hide();
  1401.                         return true;
  1402.                     }
  1403.                     return false;
  1404.                 });
  1405.  
  1406.             return this;
  1407.         },
  1408.  
  1409.         show: function() {
  1410.             this.build();
  1411.  
  1412.             this.position = this.$wrapper.css( 'position' ).toLowerCase();
  1413.             if ( this.position != 'relative' || this.position != 'absolute' || this.position != 'fixed' ) {
  1414.                 this.$wrapper.css({
  1415.                     position: 'relative'
  1416.                 });
  1417.             }
  1418.             this.$wrapper.addClass( 'loading-overlay-showing' );
  1419.         },
  1420.  
  1421.         hide: function() {
  1422.             var _self = this;
  1423.  
  1424.             setTimeout(function() {
  1425.                 _self.$wrapper.removeClass( 'loading-overlay-showing' );
  1426.                
  1427.                 if ( this.position != 'relative' || this.position != 'absolute' || this.position != 'fixed' ) {
  1428.                     _self.$wrapper.css({ position: '' });
  1429.                 }
  1430.  
  1431.                 $(window).trigger('loading.overlay.ready');
  1432.             }, _self.options.hideDelay);
  1433.         },
  1434.  
  1435.         matchProperties: function() {
  1436.             var i,
  1437.                 l,
  1438.                 properties;
  1439.  
  1440.             properties = [
  1441.                 'backgroundColor',
  1442.                 'borderRadius'
  1443.             ];
  1444.  
  1445.             l = properties.length;
  1446.  
  1447.             for( i = 0; i < l; i++ ) {
  1448.                 var obj = {};
  1449.                 obj[ properties[ i ] ] = this.$wrapper.css( properties[ i ] );
  1450.  
  1451.                 $.extend( this.options.css, obj );
  1452.             }
  1453.         },
  1454.  
  1455.         getLoaderClass: function( backgroundColor ) {
  1456.             if ( !backgroundColor || backgroundColor === 'transparent' || backgroundColor === 'inherit' ) {
  1457.                 return 'black';
  1458.             }
  1459.  
  1460.             var hexColor,
  1461.                 r,
  1462.                 g,
  1463.                 b,
  1464.                 yiq;
  1465.  
  1466.             var colorToHex = function( color ){
  1467.                 var hex,
  1468.                     rgb;
  1469.  
  1470.                 if( color.indexOf('#') >- 1 ){
  1471.                     hex = color.replace('#', '');
  1472.                 } else {
  1473.                     rgb = color.match(/\d+/g);
  1474.                     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);
  1475.                 }
  1476.  
  1477.                 if ( hex.length === 3 ) {
  1478.                     hex = hex + hex;
  1479.                 }
  1480.  
  1481.                 return hex;
  1482.             };
  1483.  
  1484.             hexColor = colorToHex( backgroundColor );
  1485.  
  1486.             r = parseInt( hexColor.substr( 0, 2), 16 );
  1487.             g = parseInt( hexColor.substr( 2, 2), 16 );
  1488.             b = parseInt( hexColor.substr( 4, 2), 16 );
  1489.             yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;
  1490.  
  1491.             return ( yiq >= 128 ) ? 'black' : 'white';
  1492.         }
  1493.  
  1494.     };
  1495.  
  1496.     // expose to scope
  1497.     $.extend(theme, {
  1498.         LoadingOverlay: LoadingOverlay
  1499.     });
  1500.  
  1501.     // expose as a jquery plugin
  1502.     $.fn.loadingOverlay = function( opts ) {
  1503.         return this.each(function() {
  1504.             var $this = $( this );
  1505.  
  1506.             var loadingOverlay = $this.data( 'loadingOverlay' );
  1507.             if ( loadingOverlay ) {
  1508.                 return loadingOverlay;
  1509.             } else {
  1510.                 var options = opts || $this.data( 'loading-overlay-options' ) || {};
  1511.                 return new LoadingOverlay( $this, options );
  1512.             }
  1513.         });
  1514.     }
  1515.  
  1516.     // auto init
  1517.     $('[data-loading-overlay]').loadingOverlay();
  1518.  
  1519. }).apply(this, [window.theme, jQuery]);
  1520.  
  1521. // Masonry
  1522. (function(theme, $) {
  1523.  
  1524.     theme = theme || {};
  1525.  
  1526.     var instanceName = '__masonry';
  1527.  
  1528.     var PluginMasonry = function($el, opts) {
  1529.         return this.initialize($el, opts);
  1530.     };
  1531.  
  1532.     PluginMasonry.defaults = {
  1533.  
  1534.     };
  1535.  
  1536.     PluginMasonry.prototype = {
  1537.         initialize: function($el, opts) {
  1538.             if ($el.data(instanceName)) {
  1539.                 return this;
  1540.             }
  1541.  
  1542.             this.$el = $el;
  1543.  
  1544.             this
  1545.                 .setData()
  1546.                 .setOptions(opts)
  1547.                 .build();
  1548.  
  1549.             return this;
  1550.         },
  1551.  
  1552.         setData: function() {
  1553.             this.$el.data(instanceName, this);
  1554.  
  1555.             return this;
  1556.         },
  1557.  
  1558.         setOptions: function(opts) {
  1559.             this.options = $.extend(true, {}, PluginMasonry.defaults, opts, {
  1560.                 wrapper: this.$el
  1561.             });
  1562.  
  1563.             return this;
  1564.         },
  1565.  
  1566.         build: function() {
  1567.             if (!($.isFunction($.fn.isotope))) {
  1568.                 return this;
  1569.             }
  1570.  
  1571.             var self = this,
  1572.                 $window = $(window);
  1573.  
  1574.             self.$loader = false;
  1575.  
  1576.             if (self.options.wrapper.parents('.masonry-loader').get(0)) {
  1577.                 self.$loader = self.options.wrapper.parents('.masonry-loader');
  1578.                 self.createLoader();
  1579.             }
  1580.  
  1581.             self.options.wrapper.one('layoutComplete', function(event, laidOutItems) {
  1582.                 self.removeLoader();
  1583.             });
  1584.  
  1585.             self.options.wrapper.waitForImages(function() {
  1586.                 self.options.wrapper.isotope(self.options);
  1587.             });
  1588.  
  1589.             // IE10/11 fix
  1590.             if( $('html').hasClass('ie10') || $('html').hasClass('ie11') ) {
  1591.                 var padding = parseInt( self.options.wrapper.children().css('padding-left') ) + parseInt( self.options.wrapper.children().css('padding-right') );
  1592.             }
  1593.  
  1594.             $(window).on('resize', function() {
  1595.                 setTimeout(function() {
  1596.                     self.options.wrapper.isotope('layout');
  1597.                 }, 300);
  1598.             });
  1599.  
  1600.             setTimeout(function() {
  1601.                 self.removeLoader();
  1602.             }, 3000);
  1603.  
  1604.             return this;
  1605.         },
  1606.  
  1607.         createLoader: function() {
  1608.             var self = this;
  1609.  
  1610.             var loaderTemplate = [
  1611.                 '<div class="bounce-loader">',
  1612.                     '<div class="bounce1"></div>',
  1613.                     '<div class="bounce2"></div>',
  1614.                     '<div class="bounce3"></div>',
  1615.                 '</div>'
  1616.             ].join('');
  1617.  
  1618.             self.$loader.append(loaderTemplate);
  1619.  
  1620.             return this;
  1621.         },
  1622.  
  1623.         removeLoader: function() {
  1624.  
  1625.             var self = this;
  1626.  
  1627.             if (self.$loader) {
  1628.  
  1629.                 self.$loader.removeClass('masonry-loader-showing');
  1630.  
  1631.                 setTimeout(function() {
  1632.                     self.$loader.addClass('masonry-loader-loaded');
  1633.                 }, 300);
  1634.  
  1635.             }
  1636.  
  1637.         }
  1638.     };
  1639.  
  1640.     // expose to scope
  1641.     $.extend(theme, {
  1642.         PluginMasonry: PluginMasonry
  1643.     });
  1644.  
  1645.     // jquery plugin
  1646.     $.fn.themePluginMasonry = function(opts) {
  1647.         return this.map(function() {
  1648.             var $this = $(this);
  1649.  
  1650.             if ($this.data(instanceName)) {
  1651.                 return $this.data(instanceName);
  1652.             } else {
  1653.                 return new PluginMasonry($this, opts);
  1654.             }
  1655.  
  1656.         });
  1657.     }
  1658.  
  1659. }).apply(this, [window.theme, jQuery]);
  1660.  
  1661. // Match Height
  1662. (function(theme, $) {
  1663.  
  1664.     theme = theme || {};
  1665.  
  1666.     var instanceName = '__matchHeight';
  1667.  
  1668.     var PluginMatchHeight = function($el, opts) {
  1669.         return this.initialize($el, opts);
  1670.     };
  1671.  
  1672.     PluginMatchHeight.defaults = {
  1673.         byRow: true,
  1674.         property: 'height',
  1675.         target: null,
  1676.         remove: false
  1677.     };
  1678.  
  1679.     PluginMatchHeight.prototype = {
  1680.         initialize: function($el, opts) {
  1681.             if ($el.data(instanceName)) {
  1682.                 return this;
  1683.             }
  1684.  
  1685.             this.$el = $el;
  1686.  
  1687.             this
  1688.                 .setData()
  1689.                 .setOptions(opts)
  1690.                 .build();
  1691.  
  1692.             return this;
  1693.         },
  1694.  
  1695.         setData: function() {
  1696.             this.$el.data(instanceName, this);
  1697.  
  1698.             return this;
  1699.         },
  1700.  
  1701.         setOptions: function(opts) {
  1702.             this.options = $.extend(true, {}, PluginMatchHeight.defaults, opts, {
  1703.                 wrapper: this.$el
  1704.             });
  1705.  
  1706.             return this;
  1707.         },
  1708.  
  1709.         build: function() {
  1710.             if (!($.isFunction($.fn.matchHeight))) {
  1711.                 return this;
  1712.             }
  1713.  
  1714.             var self = this;
  1715.  
  1716.             self.options.wrapper.matchHeight(self.options);
  1717.  
  1718.             return this;
  1719.         }
  1720.  
  1721.     };
  1722.  
  1723.     // expose to scope
  1724.     $.extend(theme, {
  1725.         PluginMatchHeight: PluginMatchHeight
  1726.     });
  1727.  
  1728.     // jquery plugin
  1729.     $.fn.themePluginMatchHeight = function(opts) {
  1730.         return this.map(function() {
  1731.             var $this = $(this);
  1732.  
  1733.             if ($this.data(instanceName)) {
  1734.                 return $this.data(instanceName);
  1735.             } else {
  1736.                 return new PluginMatchHeight($this, opts);
  1737.             }
  1738.  
  1739.         });
  1740.     }
  1741.  
  1742. }).apply(this, [window.theme, jQuery]);
  1743.  
  1744. // Parallax
  1745. (function(theme, $) {
  1746.  
  1747.     theme = theme || {};
  1748.  
  1749.     var instanceName = '__parallax';
  1750.  
  1751.     var PluginParallax = function($el, opts) {
  1752.         return this.initialize($el, opts);
  1753.     };
  1754.  
  1755.     PluginParallax.defaults = {
  1756.         speed: 1.5,
  1757.         horizontalPosition: '50%',
  1758.         offset: 0,
  1759.         parallaxHeight: '180%'
  1760.     };
  1761.  
  1762.     PluginParallax.prototype = {
  1763.         initialize: function($el, opts) {
  1764.             if ($el.data(instanceName)) {
  1765.                 return this;
  1766.             }
  1767.  
  1768.             this.$el = $el;
  1769.  
  1770.             this
  1771.                 .setData()
  1772.                 .setOptions(opts)
  1773.                 .build();
  1774.  
  1775.             return this;
  1776.         },
  1777.  
  1778.         setData: function() {
  1779.             this.$el.data(instanceName, this);
  1780.  
  1781.             return this;
  1782.         },
  1783.  
  1784.         setOptions: function(opts) {
  1785.             this.options = $.extend(true, {}, PluginParallax.defaults, opts, {
  1786.                 wrapper: this.$el
  1787.             });
  1788.  
  1789.             return this;
  1790.         },
  1791.  
  1792.         build: function() {
  1793.             var self = this,
  1794.                 $window = $(window),
  1795.                 offset,
  1796.                 yPos,
  1797.                 bgpos,
  1798.                 background;
  1799.  
  1800.             // Create Parallax Element
  1801.             background = $('<div class="parallax-background"></div>');
  1802.  
  1803.             // Set Style for Parallax Element
  1804.             background.css({
  1805.                 'background-image' : 'url(' + self.options.wrapper.data('image-src') + ')',
  1806.                 'background-size' : 'cover',
  1807.                 'position' : 'absolute',
  1808.                 'top' : 0,
  1809.                 'left' : 0,
  1810.                 'width' : '100%',
  1811.                 'height' : self.options.parallaxHeight
  1812.             });
  1813.  
  1814.             // Add Parallax Element on DOM
  1815.             self.options.wrapper.prepend(background);
  1816.  
  1817.             // Set Overlfow Hidden and Position Relative to Parallax Wrapper
  1818.             self.options.wrapper.css({
  1819.                 'position' : 'relative',
  1820.                 'overflow' : 'hidden'
  1821.             });
  1822.  
  1823.             // Parallax Effect on Scroll & Resize
  1824.             var parallaxEffectOnScrolResize = function() {
  1825.                 $window.on('scroll resize', function() {
  1826.                     offset  = self.options.wrapper.offset();
  1827.                     yPos    = -($window.scrollTop() - (offset.top - 100)) / ((self.options.speed + 2 ));
  1828.                     plxPos  = (yPos < 0) ? Math.abs(yPos) : -Math.abs(yPos);
  1829.                     background.css({
  1830.                         'transform' : 'translate3d(0, '+ ( (plxPos - 50) + (self.options.offset) ) +'px, 0)',
  1831.                         'background-position-x' : self.options.horizontalPosition
  1832.                     });
  1833.                 });
  1834.  
  1835.                 $window.trigger('scroll');
  1836.             }
  1837.  
  1838.             if (!$.browser.mobile) {
  1839.                 parallaxEffectOnScrolResize();
  1840.             } else {
  1841.                 if( self.options.enableOnMobile == true ) {
  1842.                     parallaxEffectOnScrolResize();
  1843.                 } else {
  1844.                     self.options.wrapper.addClass('parallax-disabled');
  1845.                 }
  1846.             }
  1847.  
  1848.             return this;
  1849.         }
  1850.     };
  1851.  
  1852.     // expose to scope
  1853.     $.extend(theme, {
  1854.         PluginParallax: PluginParallax
  1855.     });
  1856.  
  1857.     // jquery plugin
  1858.     $.fn.themePluginParallax = function(opts) {
  1859.         return this.map(function() {
  1860.             var $this = $(this);
  1861.  
  1862.             if ($this.data(instanceName)) {
  1863.                 return $this.data(instanceName);
  1864.             } else {
  1865.                 return new PluginParallax($this, opts);
  1866.             }
  1867.  
  1868.         });
  1869.     }
  1870.  
  1871. }).apply(this, [window.theme, jQuery]);
  1872.  
  1873. // Progress Bar
  1874. (function(theme, $) {
  1875.  
  1876.     theme = theme || {};
  1877.  
  1878.     var instanceName = '__progressBar';
  1879.  
  1880.     var PluginProgressBar = function($el, opts) {
  1881.         return this.initialize($el, opts);
  1882.     };
  1883.  
  1884.     PluginProgressBar.defaults = {
  1885.         accX: 0,
  1886.         accY: -50,
  1887.         delay: 1
  1888.     };
  1889.  
  1890.     PluginProgressBar.prototype = {
  1891.         initialize: function($el, opts) {
  1892.             if ($el.data(instanceName)) {
  1893.                 return this;
  1894.             }
  1895.  
  1896.             this.$el = $el;
  1897.  
  1898.             this
  1899.                 .setData()
  1900.                 .setOptions(opts)
  1901.                 .build();
  1902.  
  1903.             return this;
  1904.         },
  1905.  
  1906.         setData: function() {
  1907.             this.$el.data(instanceName, this);
  1908.  
  1909.             return this;
  1910.         },
  1911.  
  1912.         setOptions: function(opts) {
  1913.             this.options = $.extend(true, {}, PluginProgressBar.defaults, opts, {
  1914.                 wrapper: this.$el
  1915.             });
  1916.  
  1917.             return this;
  1918.         },
  1919.  
  1920.         build: function() {
  1921.             if (!($.isFunction($.fn.appear))) {
  1922.                 return this;
  1923.             }
  1924.  
  1925.             var self = this,
  1926.                 $el = this.options.wrapper,
  1927.                 delay = 1;
  1928.  
  1929.             $el.appear(function() {
  1930.  
  1931.                 delay = ($el.attr('data-appear-animation-delay') ? $el.attr('data-appear-animation-delay') : self.options.delay);
  1932.  
  1933.                 $el.addClass($el.attr('data-appear-animation'));
  1934.  
  1935.                 setTimeout(function() {
  1936.  
  1937.                     $el.animate({
  1938.                         width: $el.attr('data-appear-progress-animation')
  1939.                     }, 1500, 'easeOutQuad', function() {
  1940.                         $el.find('.progress-bar-tooltip').animate({
  1941.                             opacity: 1
  1942.                         }, 500, 'easeOutQuad');
  1943.                     });
  1944.  
  1945.                 }, delay);
  1946.  
  1947.             }, {
  1948.                 accX: self.options.accX,
  1949.                 accY: self.options.accY
  1950.             });
  1951.  
  1952.             return this;
  1953.         }
  1954.     };
  1955.  
  1956.     // expose to scope
  1957.     $.extend(theme, {
  1958.         PluginProgressBar: PluginProgressBar
  1959.     });
  1960.  
  1961.     // jquery plugin
  1962.     $.fn.themePluginProgressBar = function(opts) {
  1963.         return this.map(function() {
  1964.             var $this = $(this);
  1965.  
  1966.             if ($this.data(instanceName)) {
  1967.                 return $this.data(instanceName);
  1968.             } else {
  1969.                 return new PluginProgressBar($this, opts);
  1970.             }
  1971.  
  1972.         });
  1973.     }
  1974.  
  1975. }).apply(this, [window.theme, jQuery]);
  1976.  
  1977. // Revolution Slider
  1978. (function(theme, $) {
  1979.  
  1980.     theme = theme || {};
  1981.  
  1982.     var instanceName = '__revolution';
  1983.  
  1984.     var PluginRevolutionSlider = function($el, opts) {
  1985.         return this.initialize($el, opts);
  1986.     };
  1987.  
  1988.     PluginRevolutionSlider.defaults = {
  1989.         sliderType: 'standard',
  1990.         sliderLayout: 'fullwidth',
  1991.         delay: 9000,
  1992.         gridwidth: 1170,
  1993.         gridheight: 500,
  1994.         spinner: 'spinner3',
  1995.         disableProgressBar: 'on',
  1996.         parallax: {
  1997.             type: 'off',
  1998.             bgparallax: 'off'
  1999.         },
  2000.         navigation: {
  2001.             keyboardNavigation: 'off',
  2002.             keyboard_direction: 'horizontal',
  2003.             mouseScrollNavigation: 'off',
  2004.             onHoverStop: 'off',
  2005.             touch: {
  2006.                 touchenabled: 'on',
  2007.                 swipe_threshold: 75,
  2008.                 swipe_min_touches: 1,
  2009.                 swipe_direction: 'horizontal',
  2010.                 drag_block_vertical: false
  2011.             },
  2012.             arrows: {
  2013.                 enable: true,
  2014.                 hide_onmobile: false,
  2015.                 hide_under: 0,
  2016.                 hide_onleave: true,
  2017.                 hide_delay: 200,
  2018.                 hide_delay_mobile: 1200,
  2019.                 left: {
  2020.                     h_align: 'left',
  2021.                     v_align: 'center',
  2022.                     h_offset: 30,
  2023.                     v_offset: 0
  2024.                 },
  2025.                 right: {
  2026.                     h_align: 'right',
  2027.                     v_align: 'center',
  2028.                     h_offset: 30,
  2029.                     v_offset: 0
  2030.                 }
  2031.             }
  2032.         },
  2033.  
  2034.         /* ADDONS */
  2035.         addOnTypewriter: {
  2036.             enable: false
  2037.         },
  2038.         addOnWhiteboard: {
  2039.             enable: false,
  2040.  
  2041.         },
  2042.         whiteboard: {
  2043.             movehand: {
  2044.                 src: '../vendor/rs-plugin/revolution-addons/whiteboard/assets/images/hand_point_right.png',
  2045.                 width: 400,
  2046.                 height: 1000,
  2047.                 handtype: 'right',
  2048.                 transform: {
  2049.                     transformX: 50,
  2050.                     transformY: 50
  2051.                 },
  2052.                 jittering: {
  2053.                     distance: '80',
  2054.                     distance_horizontal: '100',
  2055.                     repeat: '5',
  2056.                     offset: '10',
  2057.                     offset_horizontal: '0'
  2058.                 },
  2059.                 rotation: {
  2060.                     angle: '10',
  2061.                     repeat: '3'
  2062.                 }
  2063.             },
  2064.             writehand: {
  2065.                 src: '../vendor/rs-plugin/revolution-addons/whiteboard/assets/images/write_right_angle.png',
  2066.                 width: 572,
  2067.                 height: 691,
  2068.                 handtype: 'right',
  2069.                 transform: {
  2070.                     transformX: 50,
  2071.                     transformY: 50
  2072.                 },
  2073.                 jittering: {
  2074.                     distance: '80',
  2075.                     distance_horizontal: '100',
  2076.                     repeat: '5',
  2077.                     offset: '10',
  2078.                     offset_horizontal: '0'
  2079.                 },
  2080.                 rotation:{
  2081.                     angle: '10',
  2082.                     repeat: '3'
  2083.                 }
  2084.             }
  2085.         },
  2086.         addOnParticles: {
  2087.             enable: false
  2088.         },
  2089.         particles: {
  2090.             startSlide: "first",
  2091.             endSlide: "last",
  2092.             zIndex: "1",
  2093.             particles: {
  2094.                 number: {value: 80}, color: {value: "#ffffff"},
  2095.                 shape: {
  2096.                     type: "circle", stroke: {width: 0, color: "#ffffff", opacity: 1},
  2097.                     image: {src: ""}
  2098.                 },
  2099.                 opacity: {value: 0.5, random: true, min: 0.25, anim: {enable: false, speed: 3, opacity_min: 0, sync: false}},
  2100.                 size: {value: 2, random: false, min: 30, anim: {enable: false, speed: 40, size_min: 1, sync: false}},
  2101.                 line_linked: {enable: true, distance: 150, color: "#ffffff", opacity: 0.4, width: 1},
  2102.                 move: {enable: true, speed: 6, direction: "none", random: true, min_speed: 6, straight: false, out_mode: "out"}
  2103.             },
  2104.             interactivity: {
  2105.                 events: {onhover: {enable: false, mode: "repulse"}, onclick: {enable: false, mode: "repulse"}},
  2106.                 modes: {grab: {distance: 400, line_linked: {opacity: 0.5}}, bubble: {distance: 400, size: 40, opacity: 0.4}, repulse: {distance: 200}}
  2107.             }
  2108.         },
  2109.         addOnCountdown: {
  2110.             enable: false,
  2111.             targetdate: new Date().getTime() + 864000000, // http://www.freeformatter.com/epoch-timestamp-to-date-converter.html
  2112.             slidechanges: [{days: 0, hours: 0, minutes: 0, seconds: 0, slide: 2}]
  2113.         },
  2114.         addOnSlicey: {
  2115.             enable: false
  2116.         },
  2117.         addOnFilmstrip: {
  2118.             enable: false
  2119.         },
  2120.         addOnBeforeAfter : {
  2121.             enable: false,
  2122.             options: {
  2123.                 cursor: "move",
  2124.                 carousel: false,
  2125.                 arrowStyles: {
  2126.                     leftIcon: "fa-icon-caret-left",
  2127.                     rightIcon: "fa-icon-caret-right",
  2128.                     topIcon: "fa-icon-caret-up",
  2129.                     bottomIcon: "fa-icon-caret-down",
  2130.                     size: "35",
  2131.                     color: "#ffffff",
  2132.                     spacing: "10",
  2133.                     bgColor: "transparent",
  2134.                     padding: "0",
  2135.                     borderRadius: "0"
  2136.                 },
  2137.                 dividerStyles: {
  2138.                     width: "1",
  2139.                     color: "rgba(255, 255, 255, 0.5)"
  2140.                 }
  2141.             }
  2142.         },
  2143.         addOnPanorama: {
  2144.             enable: false
  2145.         },
  2146.         addOnRevealer: {
  2147.             enable: false,
  2148.         },
  2149.         revealer: {
  2150.             direction: "open_horizontal",
  2151.             color: "#ffffff",
  2152.             duration: "1500",
  2153.             delay: "0",
  2154.             easing: "Power2.easeInOut",
  2155.             overlay_enabled: true,
  2156.             overlay_color: "#000000",
  2157.             overlay_duration: "1500",
  2158.             overlay_delay: "0",
  2159.             overlay_easing: "Power2.easeInOut",
  2160.             spinner: "1",
  2161.             spinnerColor: "#006dd2",
  2162.             spinnerHtml: "<div class='rsaddon-revealer-spinner rsaddon-revealer-spinner-1'><div class='rsaddon-revealer-1'><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><\/div><\/div \/>"
  2163.         },
  2164.         addOnDuotone: {
  2165.             enable: false
  2166.         },
  2167.         addOnBubblemorph: {
  2168.             enable: false
  2169.         },
  2170.         addOnDistortion: {
  2171.             enable: false
  2172.         }
  2173.        
  2174.     };
  2175.  
  2176.     PluginRevolutionSlider.prototype = {
  2177.         initialize: function($el, opts) {
  2178.             if ($el.data(instanceName)) {
  2179.                 return this;
  2180.             }
  2181.  
  2182.             this.$el = $el;
  2183.  
  2184.             this
  2185.                 .setData()
  2186.                 .setOptions(opts)
  2187.                 .build()
  2188.                 .events();
  2189.  
  2190.             return this;
  2191.         },
  2192.  
  2193.         setData: function() {
  2194.             this.$el.data(instanceName, this);
  2195.  
  2196.             return this;
  2197.         },
  2198.  
  2199.         setOptions: function(opts) {
  2200.             this.options = $.extend(true, {}, PluginRevolutionSlider.defaults, opts, {
  2201.                 wrapper: this.$el
  2202.             });
  2203.  
  2204.             return this;
  2205.         },
  2206.  
  2207.         build: function() {
  2208.             if (!($.isFunction($.fn.revolution))) {
  2209.                 return this;
  2210.             }
  2211.  
  2212.             // Single Slider Class
  2213.             if(this.options.wrapper.find('> ul > li').length == 1) {
  2214.                 this.options.wrapper.addClass('slider-single-slide');
  2215.  
  2216.                 // Remove Bullets
  2217.                 // this.options.navigation.bullets.enable = false;
  2218.                 $.extend(this.options.navigation, {
  2219.                     bullets: {
  2220.                         enable: false
  2221.                     }
  2222.                 });
  2223.  
  2224.             }
  2225.  
  2226.             // Full Screen Class
  2227.             if(this.options.sliderLayout == 'fullscreen') {
  2228.                 this.options.wrapper.closest('.slider-container').addClass('fullscreen-slider');
  2229.             }
  2230.            
  2231.             // Initialize Revolution Slider
  2232.             this.options.wrapper.revolution(this.options);
  2233.  
  2234.             // Addon Init - Typewriter
  2235.             if(this.options.addOnTypewriter.enable) {
  2236.                 RsTypewriterAddOn($, this.options.wrapper);
  2237.             }
  2238.  
  2239.             // Addon Init - Whiteboard
  2240.             if(this.options.addOnWhiteboard.enable) {
  2241.                 this.options.wrapper.rsWhiteBoard();
  2242.             }
  2243.  
  2244.             // Addon Init - Particles
  2245.             if(this.options.addOnParticles.enable) {
  2246.                 RsParticlesAddOn(this.options.wrapper);
  2247.             }
  2248.  
  2249.             // Addon Init - Countdown
  2250.             if(this.options.addOnCountdown.enable) {
  2251.                 tp_countdown(this.options.wrapper, this.options.addOnCountdown.targetdate, this.options.addOnCountdown.slidechanges);
  2252.             }
  2253.  
  2254.             // Addon Init - Slicey
  2255.             if(this.options.addOnSlicey.enable) {
  2256.                 this.options.wrapper.revSliderSlicey();
  2257.             }
  2258.  
  2259.             // Addon Init - Filmstrip
  2260.             if(this.options.addOnFilmstrip.enable) {
  2261.                 RsFilmstripAddOn($, this.options.wrapper, '../vendor/rs-plugin/revolution-addons/filmstrip/', false);
  2262.             }
  2263.  
  2264.             // Addon Init - Before After
  2265.             if(this.options.addOnBeforeAfter.enable) {
  2266.                 RevSliderBeforeAfter($, this.options.wrapper, this.options.addOnBeforeAfter.options);
  2267.             }
  2268.  
  2269.             // Addon Init - Panorama
  2270.             if(this.options.addOnPanorama.enable) {
  2271.                 RsAddonPanorama($, this.options.wrapper);
  2272.             }
  2273.  
  2274.             // Addon Init - Revealer
  2275.             if(this.options.addOnRevealer.enable) {
  2276.                 RsRevealerAddOn($, this.options.wrapper, this.options.revealer.spinnerHtml);
  2277.             }
  2278.  
  2279.             // Addon Init - Duotone
  2280.             if(this.options.addOnDuotone.enable) {
  2281.                 RsAddonDuotone($, this.options.wrapper, true, "cubic-bezier(0.645, 0.045, 0.355, 1.000)", "1000");
  2282.             }
  2283.  
  2284.             // Addon Init - Bubblemorph
  2285.             if(this.options.addOnBubblemorph.enable) {
  2286.                 BubbleMorphAddOn($, this.options.wrapper, false);
  2287.             }
  2288.  
  2289.             // Addon Init - Distortion
  2290.             if(this.options.addOnDistortion.enable) {
  2291.                 RsLiquideffectAddOn($, this.options.wrapper);
  2292.             }
  2293.  
  2294.             return this;
  2295.         },
  2296.  
  2297.         events: function() {
  2298.  
  2299.             return this;
  2300.         }
  2301.     };
  2302.  
  2303.     // expose to scope
  2304.     $.extend(theme, {
  2305.         PluginRevolutionSlider: PluginRevolutionSlider
  2306.     });
  2307.  
  2308.     // jquery plugin
  2309.     $.fn.themePluginRevolutionSlider = function(opts) {
  2310.         return this.map(function() {
  2311.             var $this = $(this);
  2312.  
  2313.             if ($this.data(instanceName)) {
  2314.                 return $this.data(instanceName);
  2315.             } else {
  2316.                 return new PluginRevolutionSlider($this, opts);
  2317.             }
  2318.  
  2319.         });
  2320.     }
  2321.  
  2322. }).apply(this, [window.theme, jQuery]);
  2323.  
  2324. // Scroll to Top
  2325. (function(theme, $) {
  2326.  
  2327.     theme = theme || {};
  2328.  
  2329.     $.extend(theme, {
  2330.  
  2331.         PluginScrollToTop: {
  2332.  
  2333.             defaults: {
  2334.                 wrapper: $('body'),
  2335.                 offset: 150,
  2336.                 buttonClass: 'scroll-to-top',
  2337.                 iconClass: 'fas fa-chevron-up',
  2338.                 delay: 1000,
  2339.                 visibleMobile: false,
  2340.                 label: false,
  2341.                 easing: 'easeOutBack'
  2342.             },
  2343.  
  2344.             initialize: function(opts) {
  2345.                 initialized = true;
  2346.  
  2347.                 // Don't initialize if the page has Section Scroll
  2348.                 if( $('body[data-plugin-section-scroll]').get(0) ) {
  2349.                     return;
  2350.                 }
  2351.  
  2352.                 this
  2353.                     .setOptions(opts)
  2354.                     .build()
  2355.                     .events();
  2356.  
  2357.                 return this;
  2358.             },
  2359.  
  2360.             setOptions: function(opts) {
  2361.                 this.options = $.extend(true, {}, this.defaults, opts);
  2362.  
  2363.                 return this;
  2364.             },
  2365.  
  2366.             build: function() {
  2367.                 var self = this,
  2368.                     $el;
  2369.  
  2370.                 // Base HTML Markup
  2371.                 $el = $('<a />')
  2372.                     .addClass(self.options.buttonClass)
  2373.                     .attr({
  2374.                         'href': '#',
  2375.                     })
  2376.                     .append(
  2377.                         $('<i />')
  2378.                         .addClass(self.options.iconClass)
  2379.                 );
  2380.  
  2381.                 // Visible Mobile
  2382.                 if (!self.options.visibleMobile) {
  2383.                     $el.addClass('hidden-mobile');
  2384.                 }
  2385.  
  2386.                 // Label
  2387.                 if (self.options.label) {
  2388.                     $el.append(
  2389.                         $('<span />').html(self.options.label)
  2390.                     );
  2391.                 }
  2392.  
  2393.                 this.options.wrapper.append($el);
  2394.  
  2395.                 this.$el = $el;
  2396.  
  2397.                 return this;
  2398.             },
  2399.  
  2400.             events: function() {
  2401.                 var self = this,
  2402.                     _isScrolling = false;
  2403.  
  2404.                 // Click Element Action
  2405.                 self.$el.on('click', function(e) {
  2406.                     e.preventDefault();
  2407.                     $('body, html').animate({
  2408.                         scrollTop: 0
  2409.                     }, self.options.delay, self.options.easing);
  2410.                     return false;
  2411.                 });
  2412.  
  2413.                 // Show/Hide Button on Window Scroll event.
  2414.                 $(window).scroll(function() {
  2415.  
  2416.                     if (!_isScrolling) {
  2417.  
  2418.                         _isScrolling = true;
  2419.  
  2420.                         if ($(window).scrollTop() > self.options.offset) {
  2421.  
  2422.                             self.$el.stop(true, true).addClass('visible');
  2423.                             _isScrolling = false;
  2424.  
  2425.                         } else {
  2426.  
  2427.                             self.$el.stop(true, true).removeClass('visible');
  2428.                             _isScrolling = false;
  2429.  
  2430.                         }
  2431.  
  2432.                     }
  2433.  
  2434.                 });
  2435.  
  2436.                 return this;
  2437.             }
  2438.  
  2439.         }
  2440.  
  2441.     });
  2442.  
  2443. }).apply(this, [window.theme, jQuery]);
  2444.  
  2445. // Scrollable
  2446. (function(theme, $) {
  2447.  
  2448.     theme = theme || {};
  2449.  
  2450.     var instanceName = '__scrollable';
  2451.  
  2452.     var PluginScrollable = function($el, opts) {
  2453.         return this.initialize($el, opts);
  2454.     };
  2455.  
  2456.     PluginScrollable.updateModals = function() {
  2457.         PluginScrollable.updateBootstrapModal();
  2458.     };
  2459.  
  2460.     PluginScrollable.updateBootstrapModal = function() {
  2461.         var updateBoostrapModal;
  2462.  
  2463.         updateBoostrapModal = typeof $.fn.modal !== 'undefined';
  2464.         updateBoostrapModal = updateBoostrapModal && typeof $.fn.modal.Constructor !== 'undefined';
  2465.         updateBoostrapModal = updateBoostrapModal && typeof $.fn.modal.Constructor.prototype !== 'undefined';
  2466.         updateBoostrapModal = updateBoostrapModal && typeof $.fn.modal.Constructor.prototype.enforceFocus !== 'undefined';
  2467.  
  2468.         if ( !updateBoostrapModal ) {
  2469.             return false;
  2470.         }
  2471.  
  2472.         var originalFocus = $.fn.modal.Constructor.prototype.enforceFocus;
  2473.         $.fn.modal.Constructor.prototype.enforceFocus = function() {
  2474.             originalFocus.apply( this );
  2475.  
  2476.             var $scrollable = this.$element.find('.scrollable');
  2477.             if ( $scrollable ) {
  2478.                 if ( $.isFunction($.fn['themePluginScrollable'])  ) {
  2479.                     $scrollable.themePluginScrollable();
  2480.                 }
  2481.  
  2482.                 if ( $.isFunction($.fn['nanoScroller']) ) {
  2483.                     $scrollable.nanoScroller();
  2484.                 }
  2485.             }
  2486.         };
  2487.     };
  2488.  
  2489.     PluginScrollable.defaults = {
  2490.         contentClass: 'scrollable-content',
  2491.         paneClass: 'scrollable-pane',
  2492.         sliderClass: 'scrollable-slider',
  2493.         alwaysVisible: true,
  2494.         preventPageScrolling: true
  2495.     };
  2496.  
  2497.     PluginScrollable.prototype = {
  2498.         initialize: function($el, opts) {
  2499.             if ( $el.data( instanceName ) ) {
  2500.                 return this;
  2501.             }
  2502.  
  2503.             this.$el = $el;
  2504.  
  2505.             this
  2506.                 .setData()
  2507.                 .setOptions(opts)
  2508.                 .build();
  2509.  
  2510.             return this;
  2511.         },
  2512.  
  2513.         setData: function() {
  2514.             this.$el.data(instanceName, this);
  2515.  
  2516.             return this;
  2517.         },
  2518.  
  2519.         setOptions: function(opts) {
  2520.             this.options = $.extend(true, {}, PluginScrollable.defaults, opts, {
  2521.                 wrapper: this.$el
  2522.             });
  2523.  
  2524.             return this;
  2525.         },
  2526.  
  2527.         build: function() {
  2528.             this.options.wrapper.nanoScroller(this.options);
  2529.  
  2530.             return this;
  2531.         }
  2532.     };
  2533.  
  2534.     // expose to scope
  2535.     $.extend(theme, {
  2536.         PluginScrollable: PluginScrollable
  2537.     });
  2538.  
  2539.     // jquery plugin
  2540.     $.fn.themePluginScrollable = function(opts) {
  2541.         return this.each(function() {
  2542.             var $this = $(this);
  2543.  
  2544.             if ($this.data(instanceName)) {
  2545.                 return $this.data(instanceName);
  2546.             } else {
  2547.                 return new PluginScrollable($this, opts);
  2548.             }
  2549.  
  2550.         });
  2551.     };
  2552.  
  2553.     $(function() {
  2554.         PluginScrollable.updateModals();
  2555.     });
  2556.  
  2557. }).apply(this, [window.theme, jQuery]);
  2558.  
  2559. // Section Scroll
  2560. (function(theme, $) {
  2561.  
  2562.     theme = theme || {};
  2563.  
  2564.     var instanceName = '__sectionScroll';
  2565.  
  2566.     var PluginSectionScroll = function($el, opts) {
  2567.         return this.initialize($el, opts);
  2568.     };
  2569.  
  2570.     PluginSectionScroll.defaults = {
  2571.         targetClass: '.section',
  2572.         dotsNav: true,
  2573.         changeHeaderLogo: true,
  2574.         headerLogoDark: 'img/logo-default-slim.png',
  2575.         headerLogoLight: 'img/logo-default-slim-dark.png'
  2576.     };
  2577.  
  2578.     PluginSectionScroll.prototype = {
  2579.         initialize: function($el, opts) {
  2580.             if ($el.data(instanceName)) {
  2581.                 return this;
  2582.             }
  2583.  
  2584.             this.$el = $el;
  2585.  
  2586.             this
  2587.                 .setData()
  2588.                 .setOptions(opts)
  2589.                 .build()
  2590.                 .events();
  2591.  
  2592.             return this;
  2593.         },
  2594.  
  2595.         setData: function() {
  2596.             this.$el.data(instanceName, this);
  2597.  
  2598.             return this;
  2599.         },
  2600.  
  2601.         setOptions: function(opts) {
  2602.             this.options = $.extend(true, {}, PluginSectionScroll.defaults, opts, {
  2603.                 wrapper: this.$el
  2604.             });
  2605.  
  2606.             return this;
  2607.         },
  2608.  
  2609.         build: function() {
  2610.             var self = this,
  2611.                 $el = this.options.wrapper;
  2612.  
  2613.             // Check type of header and change the target for header (by change header color purpose)
  2614.             if( $('html').hasClass('side-header-overlay-full-screen') ) {
  2615.                 self.$header = $('.sticky-wrapper');
  2616.             } else {
  2617.                 self.$header = $('#header');
  2618.             }
  2619.  
  2620.             // Turn the section full height or not depeding on the content size
  2621.             self.updateSectionsHeight();
  2622.  
  2623.             // Wrap all sections in a section wrapper
  2624.             $( this.options.targetClass ).wrap('<div class="section-wrapper"></div>');
  2625.  
  2626.             // Set the section wrapper height
  2627.             $('.section-wrapper').each(function(){
  2628.                 $(this).height( $(this).find('.section-scroll').outerHeight() );
  2629.             });
  2630.  
  2631.             // Add active class to the first section on page load
  2632.             $('.section-wrapper').first().addClass('active');
  2633.            
  2634.             var flag = false,
  2635.                 scrollableFlag = false,
  2636.                 touchDirection = '',
  2637.                 touchstartY = 0,
  2638.                 touchendY = 0;
  2639.  
  2640.             $(window).on('touchstart', function(event) {
  2641.                 touchstartY = event.changedTouches[0].screenY;
  2642.             });
  2643.  
  2644.             var wheelEvent = 'onwheel' in document ? 'wheel' : document.onmousewheel !== undefined ? 'mousewheel' : 'DOMMouseScroll';
  2645.             if( $(window).width() < 992 && $('html').hasClass('touch') ) {
  2646.                 wheelEvent = 'onwheel' in document ? 'wheel touchend' : document.onmousewheel !== undefined ? 'mousewheel touchend' : 'DOMMouseScroll touchend';
  2647.             }
  2648.  
  2649.             $(window).on(wheelEvent, function(e){
  2650.                 if( $(window).width() < 992 && $('html').hasClass('touch') ) {
  2651.                     if( $(e.target).closest('.section-scroll-dots-navigation').get(0) || $(e.target).closest('.header-body').get(0) || $(e.target).closest('.owl-carousel').get(0) ) {
  2652.                         return;
  2653.                     }
  2654.                 }
  2655.  
  2656.                 // Side Header Overlay Full Screen
  2657.                 if( $('html.side-header-overlay-full-screen.side-header-hide').get(0) ) {
  2658.                     return;
  2659.                 }
  2660.  
  2661.                 var wheelDirection = e.originalEvent.wheelDelta == undefined ? e.originalEvent.deltaY > 0 : e.originalEvent.wheelDelta < 0;
  2662.                 if( $(window).width() < 992 && $('html').hasClass('touch') ) {
  2663.                     touchendY = event.changedTouches[0].screenY;
  2664.                    
  2665.                     if( touchendY <= touchstartY ) {
  2666.                         touchDirection = 'up';
  2667.                     }
  2668.  
  2669.                     if( touchendY >= touchstartY ) {
  2670.                         touchDirection = 'down';
  2671.                     }
  2672.  
  2673.                     if( touchendY == touchstartY ) {
  2674.                         return;
  2675.                     }
  2676.                 }
  2677.  
  2678.                 var $currentSection = $('.section-wrapper').eq( self.getCurrentIndex() ).find('.section-scroll'),
  2679.                     $nextSection = self.getNextSection(wheelDirection, touchDirection),
  2680.                     nextSectionOffsetTop;
  2681.  
  2682.                 // If is the last section, then change the offsetTop value
  2683.                 if( self.getCurrentIndex() == $('.section-wrapper').length - 1 ) {
  2684.                     nextSectionOffsetTop = $(document).height();
  2685.                 } else {
  2686.                     nextSectionOffsetTop = $nextSection.offset().top;
  2687.                 }
  2688.  
  2689.                 if( $(window).width() < 992 && $('html').hasClass('touch') ) {
  2690.                     setTimeout(function(){
  2691.                         if( $('.section-wrapper').eq( self.getCurrentIndex() ).find('.section-scroll').hasClass('section-scroll-scrollable') ) {
  2692.                             $('html').removeClass('overflow-hidden');
  2693.                         } else {
  2694.                             $('html').addClass('overflow-hidden');
  2695.                         }
  2696.                     }, 1200);
  2697.                 }
  2698.  
  2699.                 // For non full height sections
  2700.                 if( $currentSection.hasClass('section-scroll-scrollable') ) {
  2701.                     if( !flag && !scrollableFlag ) {
  2702.  
  2703.                         // Scroll Direction
  2704.                         if(wheelDirection || touchDirection == 'up') {
  2705.                             if( ( $(window).scrollTop() + $(window).height() ) >= nextSectionOffsetTop ) {
  2706.                                 flag = true;
  2707.                                 setTimeout(function(){
  2708.                                     $(window).trigger('section.scroll.change.header.color');
  2709.  
  2710.                                     setTimeout(function(){
  2711.                                         flag = false;
  2712.                                     }, 500);
  2713.                                 }, 1000);
  2714.  
  2715.                                 if( self.getCurrentIndex() == ( $('.section-wrapper').length - 1 )  ) {
  2716.                                     return false;
  2717.                                 }
  2718.  
  2719.                                 // Move to the next section
  2720.                                 self.moveTo( $currentSection.offset().top + $currentSection.outerHeight() );
  2721.  
  2722.                                 // Change Section Active Class
  2723.                                 self.changeSectionActiveState( $nextSection );
  2724.  
  2725.                                 self.$header.css({
  2726.                                     opacity: 0,
  2727.                                     transition: 'ease opacity 500ms'
  2728.                                 });
  2729.                             }
  2730.  
  2731.                             if( !$('html').hasClass('touch') ) {
  2732.                                 for( var i = 1; i < 100; i++ ) {
  2733.                                     $('body, html').scrollTop( $(window).scrollTop() + 1 );
  2734.  
  2735.                                     if( ( $(window).scrollTop() + $(window).height() ) >= nextSectionOffsetTop ) {
  2736.                                         scrollableFlag = true;
  2737.                                         setTimeout(function(){
  2738.                                             $(window).trigger('section.scroll.change.header.color');
  2739.                                             scrollableFlag = false;
  2740.                                         }, 500);
  2741.                                         break;
  2742.                                     }
  2743.                                 }
  2744.                             }
  2745.                         } else {
  2746.                             if( $(window).scrollTop() <= $currentSection.offset().top ) {
  2747.                                 flag = true;
  2748.                                 setTimeout(function(){
  2749.                                     $(window).trigger('section.scroll.change.header.color');
  2750.  
  2751.                                     setTimeout(function(){
  2752.                                         flag = false;
  2753.                                     }, 500);
  2754.                                 }, 1000);
  2755.  
  2756.                                 if( self.getCurrentIndex() == 0  ) {
  2757.                                     return false;
  2758.                                 }
  2759.  
  2760.                                 // Move to the next section
  2761.                                 self.moveTo( $currentSection.offset().top - $(window).height() );
  2762.  
  2763.                                 // Change Section Active Class
  2764.                                 self.changeSectionActiveState( $nextSection );
  2765.  
  2766.                                 self.$header.css({
  2767.                                     opacity: 0,
  2768.                                     transition: 'ease opacity 500ms'
  2769.                                 });
  2770.                             }
  2771.  
  2772.                             if( !$('html').hasClass('touch') ) {
  2773.                                 for( var i = 1; i < 100; i++ ) {
  2774.                                     $('body, html').scrollTop( $(window).scrollTop() - 1 );
  2775.  
  2776.                                     if( $(window).scrollTop() <= $currentSection.offset().top ) {
  2777.                                         scrollableFlag = true;
  2778.                                         setTimeout(function(){
  2779.                                             $(window).trigger('section.scroll.change.header.color');
  2780.                                             scrollableFlag = false;
  2781.                                         }, 500);
  2782.                                         break;
  2783.                                     }
  2784.                                 }
  2785.                             }
  2786.                         }
  2787.  
  2788.                         // Change Dots Active Class
  2789.                         self.changeDotsActiveState();
  2790.  
  2791.                         return;
  2792.  
  2793.                     }
  2794.                 }
  2795.  
  2796.                 // For full height sections
  2797.                 if( !flag && !scrollableFlag ) {
  2798.                     if(wheelDirection || touchDirection == 'up') {
  2799.                         if( self.getCurrentIndex() == ( $('.section-wrapper').length - 1 )  ) {
  2800.                             return false;
  2801.                         }
  2802.  
  2803.                         // Change Section Active Class
  2804.                         self.changeSectionActiveState( $nextSection );
  2805.  
  2806.                         setTimeout(function(){
  2807.                             // Move to the next section
  2808.                             self.moveTo( $nextSection.offset().top );
  2809.  
  2810.                         }, 150);
  2811.                     } else {
  2812.                         if( self.getCurrentIndex() == 0  ) {
  2813.                             return false;
  2814.                         }
  2815.  
  2816.                         // Change Section Active Class
  2817.                         self.changeSectionActiveState( $nextSection );
  2818.  
  2819.                         if( $nextSection.height() > $(window).height() ) {
  2820.                             // Move to the next section
  2821.                             self.moveTo( $currentSection.offset().top - $(window).height() );
  2822.                         } else {
  2823.                             setTimeout(function(){
  2824.                                 // Move to the next section
  2825.                                 self.moveTo( $nextSection.offset().top );
  2826.  
  2827.                             }, 150);
  2828.                         }
  2829.                     }
  2830.  
  2831.                     // Change Dots Active Class
  2832.                     self.changeDotsActiveState();
  2833.  
  2834.                     self.$header.css({
  2835.                         opacity: 0,
  2836.                         transition: 'ease opacity 500ms'
  2837.                     });
  2838.  
  2839.                     // Style next section
  2840.                     $nextSection.css({
  2841.                         position: 'relative',
  2842.                         opacity: 1,
  2843.                         'z-index': 1,
  2844.                         transform: 'translate3d(0,0,0) scale(1)'
  2845.                     });
  2846.  
  2847.                     // Style previous section
  2848.                     $currentSection.css({
  2849.                         position: 'fixed',
  2850.                         width: '100%',
  2851.                         top: 0,
  2852.                         left: 0,
  2853.                         opacity: 0,
  2854.                         'z-index': 0,
  2855.                         transform: 'translate3d(0,0,-10px) scale(0.7)',
  2856.                         transition: 'ease transform 600ms, ease opacity 600ms',
  2857.                     });
  2858.  
  2859.                     setTimeout(function(){
  2860.                         $currentSection.css({
  2861.                             position: 'relative',
  2862.                             opacity: 1,
  2863.                             transform: 'translate3d(0,0,-10px) scale(1)'
  2864.                         });
  2865.  
  2866.                         $(window).trigger('section.scroll.change.header.color');
  2867.  
  2868.                         setTimeout(function(){
  2869.                             flag = false;
  2870.                         }, 500);
  2871.                     }, 1000);
  2872.  
  2873.                     flag = true;
  2874.  
  2875.                 }
  2876.  
  2877.                 return;
  2878.             });
  2879.  
  2880.             // Dots Navigation
  2881.             if( this.options.dotsNav ) {
  2882.                 self.dotsNavigation();
  2883.             }
  2884.  
  2885.             // First Load
  2886.             setTimeout(function(){
  2887.                 if( $(window.location.hash).get(0) ) {
  2888.                     self.moveTo( $(window.location.hash).parent().offset().top );
  2889.  
  2890.                     self.changeSectionActiveState( $(window.location.hash) );
  2891.  
  2892.                     // Change Dots Active Class
  2893.                     self.changeDotsActiveState();
  2894.  
  2895.                     self.updateHash( true );
  2896.                 } else {
  2897.                     var hash  = window.location.hash,
  2898.                         index = hash.replace('#','');
  2899.  
  2900.                     if( !hash ) {
  2901.                         index = 1;
  2902.                     }
  2903.  
  2904.                     self.moveTo( $('.section-wrapper').eq( index - 1 ).offset().top );
  2905.  
  2906.                     self.changeSectionActiveState( $('.section-wrapper').eq( index - 1 ).find('.section-scroll') );
  2907.  
  2908.                     // Change Dots Active Class
  2909.                     self.changeDotsActiveState();
  2910.  
  2911.                     self.updateHash( true );
  2912.                 }
  2913.  
  2914.                 $(window).trigger('section.scroll.ready');
  2915.             }, 500);
  2916.  
  2917.             return this;
  2918.         },
  2919.  
  2920.         updateSectionsHeight: function() {
  2921.             var self = this;
  2922.  
  2923.             $('.section-scroll').css({ height: '' });
  2924.  
  2925.             $('.section-scroll').each(function(){
  2926.                 if( $(this).outerHeight() < ( $(window).height() + 3 ) ) {
  2927.                     $(this).css({ height: '100vh' });      
  2928.                 } else {
  2929.                     $(this).addClass('section-scroll-scrollable');
  2930.                 }
  2931.             });
  2932.  
  2933.             // Set the section wrapper height
  2934.             $('.section-wrapper').each(function(){
  2935.                 $(this).height( $(this).find('.section-scroll').outerHeight() );
  2936.             });
  2937.  
  2938.             return this;
  2939.         },
  2940.  
  2941.         updateHash: function( first_load ){
  2942.             var self = this;
  2943.  
  2944.             if( !window.location.hash ) {
  2945.                 window.location.hash = 1;
  2946.             } else {
  2947.                 if(!first_load) {
  2948.                     var $section = $('.section-wrapper').eq( self.getCurrentIndex() ).find('.section-scroll'),
  2949.                         section_id = $section.attr('id') ? $section.attr('id') : $section.parent().index() + 1;
  2950.  
  2951.                     window.location.hash = section_id;
  2952.                 }
  2953.             }
  2954.  
  2955.             return this;
  2956.         },
  2957.  
  2958.         getCurrentIndex: function() {
  2959.             var self = this,
  2960.                 currentIndex = 0;
  2961.  
  2962.             currentIndex = $('.section-wrapper.active').index();
  2963.  
  2964.             return currentIndex;
  2965.         },
  2966.  
  2967.         moveTo: function( $scrollTopValue, first_load ) {
  2968.             var self = this;
  2969.  
  2970.             $('body, html').animate({
  2971.                 scrollTop: $scrollTopValue
  2972.             }, 1000, 'easeOutQuint');
  2973.  
  2974.             setTimeout(function(){
  2975.                 self.updateHash();
  2976.             }, 500);
  2977.  
  2978.             return this;
  2979.         },
  2980.  
  2981.         getNextSection: function(wheelDirection, touchDirection) {
  2982.             var self = this,
  2983.                 $nextSection = '';
  2984.  
  2985.             // Scroll Direction
  2986.             if(wheelDirection || touchDirection == 'up') {
  2987.                 $nextSection = $('.section-wrapper').eq( self.getCurrentIndex() + 1 ).find('.section-scroll');
  2988.             } else {
  2989.                 $nextSection = $('.section-wrapper').eq( self.getCurrentIndex() - 1 ).find('.section-scroll');
  2990.             }
  2991.  
  2992.             return $nextSection;
  2993.         },
  2994.  
  2995.         changeSectionActiveState: function( $nextSection ) {
  2996.             var self = this;
  2997.  
  2998.             $('.section-wrapper').removeClass('active');
  2999.             $nextSection.parent().addClass('active');
  3000.  
  3001.             return this;
  3002.         },
  3003.  
  3004.         changeDotsActiveState: function() {
  3005.             var self = this;
  3006.  
  3007.             $('.section-scroll-dots-navigation > ul > li').removeClass('active');
  3008.             $('.section-scroll-dots-navigation > ul > li').eq( self.getCurrentIndex() ).addClass('active');
  3009.  
  3010.             return this;
  3011.         },
  3012.  
  3013.         dotsNavigation: function() {
  3014.             var self = this;
  3015.  
  3016.             var dotsNav = $('<div class="section-scroll-dots-navigation"><ul class="list list-unstyled"></ul></div>'),
  3017.                 currentSectionIndex = self.getCurrentIndex();
  3018.  
  3019.             if( self.options.dotsClass ) {
  3020.                 dotsNav.addClass( self.options.dotsClass );
  3021.             }
  3022.  
  3023.             for( var i = 0; i < $('.section-scroll').length; i++ ) {
  3024.                 var title = $('.section-wrapper').eq( i ).find('.section-scroll').data('section-scroll-title');
  3025.  
  3026.                 dotsNav.find('> ul').append( '<li'+ ( ( currentSectionIndex == i ) ? ' class="active"' : '' ) +'><a href="#'+ i +'" data-nav-id="'+ i +'"><span>'+ title +'</span></a></li>' );
  3027.             }
  3028.  
  3029.             $('.body').append( dotsNav );
  3030.  
  3031.             dotsNav.find('a[data-nav-id]').on('click touchstart', function(e){
  3032.                 e.preventDefault();
  3033.                 var $this = $(this);
  3034.  
  3035.                 $('.section-scroll').css({
  3036.                     opacity: 0,
  3037.                     transition: 'ease opacity 300ms'
  3038.                 });
  3039.  
  3040.                 self.$header.css({
  3041.                     opacity: 0,
  3042.                     transition: 'ease opacity 500ms'
  3043.                 });
  3044.  
  3045.                 setTimeout(function(){
  3046.                     self.moveTo( $('.section-wrapper').eq( $this.data('nav-id') ).offset().top )
  3047.  
  3048.                     $('.section-wrapper').removeClass('active');
  3049.                     $('.section-wrapper').eq( $this.data('nav-id') ).addClass('active');
  3050.  
  3051.                     $('.section-wrapper').eq( self.getCurrentIndex() ).find('.section-scroll').css({
  3052.                         opacity: 1
  3053.                     });
  3054.  
  3055.                     setTimeout(function(){
  3056.                         $('.section-scroll').css({ opacity: 1 });
  3057.  
  3058.                         $(window).trigger('section.scroll.change.header.color');
  3059.                     }, 500);
  3060.  
  3061.                     self.changeDotsActiveState();
  3062.                 }, 500);
  3063.             });
  3064.  
  3065.             return this;
  3066.         },
  3067.  
  3068.         events: function() {
  3069.             var self = this;
  3070.  
  3071.             $(window).on('section.scroll.ready', function(){
  3072.                 $(window).scrollTop(0);
  3073.             });
  3074.  
  3075.             $(window).on('section.scroll.change.header.color', function(){
  3076.                 var headerColor = $('.section-wrapper').eq( self.getCurrentIndex() ).find('.section-scroll').data('section-scroll-header-color');
  3077.                
  3078.                 $('#header .header-nav').removeClass('header-nav-light-text header-nav-dark-text').addClass('header-nav-' + headerColor + '-text');
  3079.                 $('#header .header-nav-features').removeClass('header-nav-features-dark header-nav-features-light').addClass('header-nav-features-' + headerColor);
  3080.                 $('#header .header-social-icons').removeClass('social-icons-icon-dark social-icons-icon-light').addClass('social-icons-icon-' + headerColor);
  3081.  
  3082.                 // Change Logo
  3083.                 if( self.options.changeHeaderLogo && headerColor != undefined ) {
  3084.                     if( headerColor == 'light' ) {
  3085.                         $('#header .header-logo img').attr('src', self.options.headerLogoLight);
  3086.                     } else if( headerColor == 'dark' ) {
  3087.                         $('#header .header-logo img').attr('src', self.options.headerLogoDark);
  3088.                     }
  3089.                 }
  3090.  
  3091.                 self.$header.css({
  3092.                     opacity: 1
  3093.                 });
  3094.             });
  3095.  
  3096.             $(document).ready(function(){
  3097.                 $(window).afterResize(function(){
  3098.                     self.updateSectionsHeight();
  3099.                 });
  3100.             });
  3101.  
  3102.             return this;
  3103.         }
  3104.     };
  3105.  
  3106.     // expose to scope
  3107.     $.extend(theme, {
  3108.         PluginSectionScroll: PluginSectionScroll
  3109.     });
  3110.  
  3111.     // jquery plugin
  3112.     $.fn.themePluginSectionScroll = function(opts) {
  3113.         return this.map(function() {
  3114.             var $this = $(this);
  3115.  
  3116.             if ($this.data(instanceName)) {
  3117.                 return $this.data(instanceName);
  3118.             } else {
  3119.                 return new PluginSectionScroll($this, opts);
  3120.             }
  3121.  
  3122.         });
  3123.     };
  3124.  
  3125. }).apply(this, [window.theme, jQuery]);
  3126.  
  3127. // Sort
  3128. (function(theme, $) {
  3129.  
  3130.     theme = theme || {};
  3131.  
  3132.     var instanceName = '__sort';
  3133.  
  3134.     var PluginSort = function($el, opts) {
  3135.         return this.initialize($el, opts);
  3136.     };
  3137.  
  3138.     PluginSort.defaults = {
  3139.         useHash: true,
  3140.         itemSelector: '.isotope-item',
  3141.         layoutMode: 'masonry',
  3142.         filter: '*',
  3143.         hiddenStyle: {
  3144.             opacity: 0
  3145.         },
  3146.         visibleStyle: {
  3147.             opacity: 1
  3148.         },
  3149.         stagger: 30,
  3150.         isOriginLeft: ($('html').attr('dir') == 'rtl' ? false : true)
  3151.     };
  3152.  
  3153.     PluginSort.prototype = {
  3154.         initialize: function($el, opts) {
  3155.             if ($el.data(instanceName)) {
  3156.                 return this;
  3157.             }
  3158.  
  3159.             this.$el = $el;
  3160.  
  3161.             this
  3162.                 .setData()
  3163.                 .setOptions(opts)
  3164.                 .build();
  3165.  
  3166.             return this;
  3167.         },
  3168.  
  3169.         setData: function() {
  3170.             this.$el.data(instanceName, this);
  3171.  
  3172.             return this;
  3173.         },
  3174.  
  3175.         setOptions: function(opts) {
  3176.             this.options = $.extend(true, {}, PluginSort.defaults, opts, {
  3177.                 wrapper: this.$el
  3178.             });
  3179.  
  3180.             return this;
  3181.         },
  3182.  
  3183.         build: function() {
  3184.             if (!($.isFunction($.fn.isotope))) {
  3185.                 return this;
  3186.             }
  3187.  
  3188.             var self = this,
  3189.                 $source = this.options.wrapper,
  3190.                 $destination = $('.sort-destination[data-sort-id="' + $source.attr('data-sort-id') + '"]'),
  3191.                 $window = $(window);
  3192.  
  3193.             if ($destination.get(0)) {
  3194.  
  3195.                 self.$source = $source;
  3196.                 self.$destination = $destination;
  3197.                 self.$loader = false;
  3198.  
  3199.                 self.setParagraphHeight($destination);
  3200.  
  3201.                 if (self.$destination.parents('.sort-destination-loader').get(0)) {
  3202.                     self.$loader = self.$destination.parents('.sort-destination-loader');
  3203.                     self.createLoader();
  3204.                 }
  3205.  
  3206.                 $destination.attr('data-filter', '*');
  3207.  
  3208.                 $destination.one('layoutComplete', function(event, laidOutItems) {
  3209.                     self.removeLoader();
  3210.                 });
  3211.  
  3212.                 // IE10/11 fix
  3213.                 if( $('html').hasClass('ie10') || $('html').hasClass('ie11') ) {
  3214.                     var padding = parseInt( self.options.wrapper.children().css('padding-left') ) + parseInt( self.options.wrapper.children().css('padding-right') );
  3215.                 }
  3216.  
  3217.                 $destination.waitForImages(function() {
  3218.                     $destination.isotope(self.options);
  3219.                     self.events();
  3220.                 });
  3221.  
  3222.  
  3223.                 setTimeout(function() {
  3224.                     self.removeLoader();
  3225.                 }, 3000);
  3226.  
  3227.             }
  3228.  
  3229.             return this;
  3230.         },
  3231.  
  3232.         events: function() {
  3233.             var self = this,
  3234.                 filter = null,
  3235.                 $window = $(window);
  3236.  
  3237.             self.$source.find('a').click(function(e) {
  3238.                 e.preventDefault();
  3239.  
  3240.                 filter = $(this).parent().data('option-value');
  3241.  
  3242.                 self.setFilter(filter);
  3243.  
  3244.                 if (e.originalEvent) {
  3245.                     self.$source.trigger('filtered');
  3246.                 }
  3247.  
  3248.                 return this;
  3249.             });
  3250.  
  3251.             self.$destination.trigger('filtered');
  3252.             self.$source.trigger('filtered');
  3253.  
  3254.             if (self.options.useHash) {
  3255.                 self.hashEvents();
  3256.             }
  3257.  
  3258.             $window.on('resize', function() {
  3259.                 setTimeout(function() {
  3260.                     self.$destination.isotope('layout');
  3261.                 }, 300);
  3262.             });
  3263.  
  3264.             setTimeout(function() {
  3265.                 $window.trigger('resize');
  3266.             }, 300);
  3267.  
  3268.             return this;
  3269.         },
  3270.  
  3271.         setFilter: function(filter) {
  3272.             var self = this,
  3273.                 page = false,
  3274.                 currentFilter = filter;
  3275.  
  3276.             self.$source.find('.active').removeClass('active');
  3277.             self.$source.find('li[data-option-value="' + filter + '"], li[data-option-value="' + filter + '"] > a').addClass('active');
  3278.  
  3279.             self.options.filter = currentFilter;
  3280.  
  3281.             if (self.$destination.attr('data-current-page')) {
  3282.                 currentFilter = currentFilter + '[data-page-rel=' + self.$destination.attr('data-current-page') + ']';
  3283.             }
  3284.  
  3285.             self.$destination.attr('data-filter', filter).isotope({
  3286.                 filter: currentFilter
  3287.             }).one('arrangeComplete', function( event, filteredItems ) {
  3288.                
  3289.                 if (self.options.useHash) {
  3290.                     if (window.location.hash != '' || self.options.filter.replace('.', '') != '*') {
  3291.                         window.location.hash = self.options.filter.replace('.', '');
  3292.                     }
  3293.                 }
  3294.                
  3295.                 $(window).trigger('scroll');
  3296.  
  3297.             }).trigger('filtered');
  3298.  
  3299.             return this;
  3300.         },
  3301.  
  3302.         hashEvents: function() {
  3303.             var self = this,
  3304.                 hash = null,
  3305.                 hashFilter = null,
  3306.                 initHashFilter = '.' + location.hash.replace('#', '');
  3307.  
  3308.             if (initHashFilter != '.' && initHashFilter != '.*') {
  3309.                 self.setFilter(initHashFilter);
  3310.             }
  3311.  
  3312.             $(window).on('hashchange', function(e) {
  3313.  
  3314.                 hashFilter = '.' + location.hash.replace('#', '');
  3315.                 hash = (hashFilter == '.' || hashFilter == '.*' ? '*' : hashFilter);
  3316.  
  3317.                 self.setFilter(hash);
  3318.  
  3319.             });
  3320.  
  3321.             return this;
  3322.         },
  3323.  
  3324.         setParagraphHeight: function() {
  3325.             var self = this,
  3326.                 minParagraphHeight = 0,
  3327.                 paragraphs = $('span.thumb-info-caption p', self.$destination);
  3328.  
  3329.             paragraphs.each(function() {
  3330.                 if ($(this).height() > minParagraphHeight) {
  3331.                     minParagraphHeight = ($(this).height() + 10);
  3332.                 }
  3333.             });
  3334.  
  3335.             paragraphs.height(minParagraphHeight);
  3336.  
  3337.             return this;
  3338.         },
  3339.  
  3340.         createLoader: function() {
  3341.             var self = this;
  3342.  
  3343.             var loaderTemplate = [
  3344.                 '<div class="bounce-loader">',
  3345.                     '<div class="bounce1"></div>',
  3346.                     '<div class="bounce2"></div>',
  3347.                     '<div class="bounce3"></div>',
  3348.                 '</div>'
  3349.             ].join('');
  3350.  
  3351.             self.$loader.append(loaderTemplate);
  3352.  
  3353.             return this;
  3354.         },
  3355.  
  3356.         removeLoader: function() {
  3357.  
  3358.             var self = this;
  3359.  
  3360.             if (self.$loader) {
  3361.  
  3362.                 self.$loader.removeClass('sort-destination-loader-showing');
  3363.  
  3364.                 setTimeout(function() {
  3365.                     self.$loader.addClass('sort-destination-loader-loaded');
  3366.                 }, 300);
  3367.  
  3368.             }
  3369.  
  3370.         }
  3371.  
  3372.     };
  3373.  
  3374.     // expose to scope
  3375.     $.extend(theme, {
  3376.         PluginSort: PluginSort
  3377.     });
  3378.  
  3379.     // jquery plugin
  3380.     $.fn.themePluginSort = function(opts) {
  3381.         return this.map(function() {
  3382.             var $this = $(this);
  3383.  
  3384.             if ($this.data(instanceName)) {
  3385.                 return $this.data(instanceName);
  3386.             } else {
  3387.                 return new PluginSort($this, opts);
  3388.             }
  3389.  
  3390.         });
  3391.     }
  3392.  
  3393. }).apply(this, [window.theme, jQuery]);
  3394.  
  3395. // Star Rating
  3396. (function(theme, $) {
  3397.  
  3398.     theme = theme || {};
  3399.  
  3400.     var instanceName = '__starrating';
  3401.  
  3402.     var PluginStarRating = function($el, opts) {
  3403.         return this.initialize($el, opts);
  3404.     };
  3405.  
  3406.     PluginStarRating.defaults = {
  3407.         theme: 'krajee-fas',
  3408.         color: 'primary',
  3409.         showClear: false,
  3410.         showCaption: false
  3411.     };
  3412.  
  3413.     PluginStarRating.prototype = {
  3414.         initialize: function($el, opts) {
  3415.             this.$el = $el;
  3416.  
  3417.             this
  3418.                 .setData()
  3419.                 .setOptions(opts)
  3420.                 .build();
  3421.  
  3422.             return this;
  3423.         },
  3424.  
  3425.         setData: function() {
  3426.             this.$el.data(instanceName, this);
  3427.  
  3428.             return this;
  3429.         },
  3430.  
  3431.         setOptions: function(opts) {
  3432.             this.options = $.extend(true, {}, PluginStarRating.defaults, opts, {
  3433.                 wrapper: this.$el
  3434.             });
  3435.  
  3436.             return this;
  3437.         },
  3438.  
  3439.         build: function() {
  3440.  
  3441.             if (!($.isFunction($.fn.rating))) {
  3442.                 return this;
  3443.             }
  3444.  
  3445.             var self = this;
  3446.  
  3447.             self.options.wrapper
  3448.                 .rating(self.options);
  3449.  
  3450.             self.options.wrapper.parents('.rating-container')
  3451.                 .addClass('rating-' + self.options.color);
  3452.  
  3453.             return this;
  3454.  
  3455.         }
  3456.     };
  3457.  
  3458.     // expose to scope
  3459.     $.extend(theme, {
  3460.         PluginStarRating: PluginStarRating
  3461.     });
  3462.  
  3463.     // jquery plugin
  3464.     $.fn.themePluginStarRating = function(opts) {
  3465.         return this.map(function() {
  3466.             var $this = $(this);
  3467.  
  3468.             if ($this.data(instanceName)) {
  3469.                 return $this.data(instanceName);
  3470.             } else {
  3471.                 return new PluginStarRating($this, opts);
  3472.             }
  3473.  
  3474.         });
  3475.     }
  3476.  
  3477. }).apply(this, [window.theme, jQuery]);
  3478.  
  3479. // Sticky
  3480. (function(theme, $) {
  3481.    
  3482.     theme = theme || {};
  3483.    
  3484.     var instanceName = '__sticky';
  3485.  
  3486.     var PluginSticky = function($el, opts) {
  3487.         return this.initialize($el, opts);
  3488.     };
  3489.  
  3490.     PluginSticky.defaults = {
  3491.         minWidth: 991,
  3492.         activeClass: 'sticky-active'
  3493.     };
  3494.  
  3495.     PluginSticky.prototype = {
  3496.         initialize: function($el, opts) {
  3497.             if ( $el.data( instanceName ) ) {
  3498.                 return this;
  3499.             }
  3500.  
  3501.             this.$el = $el;
  3502.  
  3503.             this
  3504.                 .setData()
  3505.                 .setOptions(opts)
  3506.                 .build()
  3507.                 .events();
  3508.  
  3509.             return this;
  3510.         },
  3511.  
  3512.         setData: function() {
  3513.             this.$el.data(instanceName, this);
  3514.  
  3515.             return this;
  3516.         },
  3517.  
  3518.         setOptions: function(opts) {
  3519.             this.options = $.extend(true, {}, PluginSticky.defaults, opts, {
  3520.                 wrapper: this.$el
  3521.             });
  3522.  
  3523.             return this;
  3524.         },
  3525.  
  3526.         build: function() {
  3527.             if (!($.isFunction($.fn.pin))) {
  3528.                 return this;
  3529.             }
  3530.  
  3531.             var self = this,
  3532.                 $window = $(window);
  3533.            
  3534.             self.options.wrapper.pin(self.options);
  3535.  
  3536.             if( self.options.wrapper.hasClass('sticky-wrapper-transparent') ) {
  3537.                 self.options.wrapper.parent().addClass('position-absolute w-100');
  3538.             }
  3539.  
  3540.             $window.afterResize(function() {
  3541.                 self.options.wrapper.removeAttr('style').removeData('pin');
  3542.                 self.options.wrapper.pin(self.options);
  3543.                 $window.trigger('scroll');
  3544.             });
  3545.  
  3546.             // Change Logo Src
  3547.             if( self.options.wrapper.find('img').attr('data-change-src') ) {
  3548.                 var $logo      = self.options.wrapper.find('img'),
  3549.                     logoSrc    = $logo.attr('src'),
  3550.                     logoNewSrc = $logo.attr('data-change-src');
  3551.  
  3552.                 self.changeLogoSrc = function(activate) {
  3553.                     if(activate) {
  3554.                         $logo.attr('src', logoNewSrc);
  3555.                     } else {
  3556.                         $logo.attr('src', logoSrc);
  3557.                     }
  3558.                 }
  3559.             }
  3560.            
  3561.             return this;
  3562.         },
  3563.  
  3564.         events: function() {
  3565.             var self = this,
  3566.                 $window = $(window),
  3567.                 $logo = self.options.wrapper.find('img'),
  3568.                 sticky_activate_flag = true,
  3569.                 sticky_deactivate_flag = false,
  3570.                 class_to_check = ( self.options.wrapper.hasClass('sticky-wrapper-effect-1') ) ? 'sticky-effect-active' : 'sticky-active';
  3571.  
  3572.             $window.on('scroll sticky.effect.active', function(){
  3573.                 if( self.options.wrapper.hasClass( class_to_check ) ) {    
  3574.                     if( sticky_activate_flag ) {           
  3575.                         if( $logo.attr('data-change-src') ) {
  3576.                             self.changeLogoSrc(true);
  3577.                         }
  3578.  
  3579.                         sticky_activate_flag = false;
  3580.                         sticky_deactivate_flag = true;
  3581.                     }
  3582.                 } else {   
  3583.                     if( sticky_deactivate_flag ) {             
  3584.                         if( $logo.attr('data-change-src') ) {
  3585.                             self.changeLogoSrc(false);
  3586.                         }
  3587.  
  3588.                         sticky_deactivate_flag = false;
  3589.                         sticky_activate_flag = true;
  3590.                     }
  3591.                 }
  3592.             });
  3593.  
  3594.             var is_backing = false;
  3595.             if( self.options.stickyStartEffectAt ) {
  3596.  
  3597.                 // First Load
  3598.                 if( self.options.stickyStartEffectAt < $window.scrollTop() ) {
  3599.                     self.options.wrapper.addClass('sticky-effect-active');
  3600.  
  3601.                     $window.trigger('sticky.effect.active');
  3602.                 }
  3603.  
  3604.                 $window.on('scroll', function(){
  3605.                     if( self.options.stickyStartEffectAt < $window.scrollTop() ) { 
  3606.                         self.options.wrapper.addClass('sticky-effect-active');
  3607.                         is_backing = true;
  3608.  
  3609.                         $window.trigger('sticky.effect.active');
  3610.                     } else {   
  3611.                         if( is_backing ) {
  3612.                             self.options.wrapper.find('.sticky-body').addClass('position-fixed');
  3613.                             is_backing = false;
  3614.                         }
  3615.  
  3616.                         if( $window.scrollTop() == 0 ) {
  3617.                             self.options.wrapper.find('.sticky-body').removeClass('position-fixed');
  3618.                         }
  3619.  
  3620.                         self.options.wrapper.removeClass('sticky-effect-active');
  3621.                     }
  3622.                 });
  3623.             }
  3624.         }
  3625.     };
  3626.  
  3627.     // expose to scope
  3628.     $.extend(theme, {
  3629.         PluginSticky: PluginSticky
  3630.     });
  3631.  
  3632.     // jquery plugin
  3633.     $.fn.themePluginSticky = function(opts) {
  3634.         return this.map(function() {
  3635.             var $this = $(this);
  3636.  
  3637.             if ($this.data(instanceName)) {
  3638.                 return $this.data(instanceName);
  3639.             } else {
  3640.                 return new PluginSticky($this, opts);
  3641.             }
  3642.            
  3643.         });
  3644.     }
  3645.  
  3646. }).apply(this, [ window.theme, jQuery ]);
  3647.  
  3648. // Toggle
  3649. (function(theme, $) {
  3650.  
  3651.     theme = theme || {};
  3652.  
  3653.     var instanceName = '__toggle';
  3654.  
  3655.     var PluginToggle = function($el, opts) {
  3656.         return this.initialize($el, opts);
  3657.     };
  3658.  
  3659.     PluginToggle.defaults = {
  3660.         duration: 350,
  3661.         isAccordion: false
  3662.     };
  3663.  
  3664.     PluginToggle.prototype = {
  3665.         initialize: function($el, opts) {
  3666.             if ($el.data(instanceName)) {
  3667.                 return this;
  3668.             }
  3669.  
  3670.             this.$el = $el;
  3671.  
  3672.             this
  3673.                 .setData()
  3674.                 .setOptions(opts)
  3675.                 .build();
  3676.  
  3677.             return this;
  3678.         },
  3679.  
  3680.         setData: function() {
  3681.             this.$el.data(instanceName, this);
  3682.  
  3683.             return this;
  3684.         },
  3685.  
  3686.         setOptions: function(opts) {
  3687.             this.options = $.extend(true, {}, PluginToggle.defaults, opts, {
  3688.                 wrapper: this.$el
  3689.             });
  3690.  
  3691.             return this;
  3692.         },
  3693.  
  3694.         build: function() {
  3695.             var self = this,
  3696.                 $wrapper = this.options.wrapper,
  3697.                 $items = $wrapper.find('> .toggle'),
  3698.                 $el = null;
  3699.  
  3700.             $items.each(function() {
  3701.                 $el = $(this);
  3702.  
  3703.                 if ($el.hasClass('active')) {
  3704.                     $el.find('> p').addClass('preview-active');
  3705.                     $el.find('> .toggle-content').slideDown(self.options.duration);
  3706.                 }
  3707.  
  3708.                 self.events($el);
  3709.             });
  3710.  
  3711.             if (self.options.isAccordion) {
  3712.                 self.options.duration = self.options.duration / 2;
  3713.             }
  3714.  
  3715.             return this;
  3716.         },
  3717.  
  3718.         events: function($el) {
  3719.             var self = this,
  3720.                 previewParCurrentHeight = 0,
  3721.                 previewParAnimateHeight = 0,
  3722.                 toggleContent = null;
  3723.  
  3724.             $el.find('> label').click(function(e) {
  3725.  
  3726.                 var $this = $(this),
  3727.                     parentSection = $this.parent(),
  3728.                     parentWrapper = $this.parents('.toggle'),
  3729.                     previewPar = null,
  3730.                     closeElement = null;
  3731.  
  3732.                 if (self.options.isAccordion && typeof(e.originalEvent) != 'undefined') {
  3733.                     closeElement = parentWrapper.find('.toggle.active > label');
  3734.  
  3735.                     if (closeElement[0] == $this[0]) {
  3736.                         return;
  3737.                     }
  3738.                 }
  3739.  
  3740.                 parentSection.toggleClass('active');
  3741.  
  3742.                 // Preview Paragraph
  3743.                 if (parentSection.find('> p').get(0)) {
  3744.  
  3745.                     previewPar = parentSection.find('> p');
  3746.                     previewParCurrentHeight = previewPar.css('height');
  3747.                     previewPar.css('height', 'auto');
  3748.                     previewParAnimateHeight = previewPar.css('height');
  3749.                     previewPar.css('height', previewParCurrentHeight);
  3750.  
  3751.                 }
  3752.  
  3753.                 // Content
  3754.                 toggleContent = parentSection.find('> .toggle-content');
  3755.  
  3756.                 if (parentSection.hasClass('active')) {
  3757.  
  3758.                     $(previewPar).animate({
  3759.                         height: previewParAnimateHeight
  3760.                     }, self.options.duration, function() {
  3761.                         $(this).addClass('preview-active');
  3762.                     });
  3763.  
  3764.                     toggleContent.slideDown(self.options.duration, function() {
  3765.                         if (closeElement) {
  3766.                             closeElement.trigger('click');
  3767.                         }
  3768.                     });
  3769.  
  3770.                 } else {
  3771.  
  3772.                     $(previewPar).animate({
  3773.                         height: 0
  3774.                     }, self.options.duration, function() {
  3775.                         $(this).removeClass('preview-active');
  3776.                     });
  3777.  
  3778.                     toggleContent.slideUp(self.options.duration);
  3779.  
  3780.                 }
  3781.  
  3782.             });
  3783.         }
  3784.     };
  3785.  
  3786.     // expose to scope
  3787.     $.extend(theme, {
  3788.         PluginToggle: PluginToggle
  3789.     });
  3790.  
  3791.     // jquery plugin
  3792.     $.fn.themePluginToggle = function(opts) {
  3793.         return this.map(function() {
  3794.             var $this = $(this);
  3795.  
  3796.             if ($this.data(instanceName)) {
  3797.                 return $this.data(instanceName);
  3798.             } else {
  3799.                 return new PluginToggle($this, opts);
  3800.             }
  3801.  
  3802.         });
  3803.     }
  3804.  
  3805. }).apply(this, [window.theme, jQuery]);
  3806.  
  3807. // Tweets
  3808. (function(theme, $) {
  3809.  
  3810.     theme = theme || {};
  3811.  
  3812.     var instanceName = '__tweets';
  3813.  
  3814.     var PluginTweets = function($el, opts) {
  3815.         return this.initialize($el, opts);
  3816.     };
  3817.  
  3818.     PluginTweets.defaults = {
  3819.         username: null,
  3820.         count: 2,
  3821.         URL: 'php/twitter-feed.php',
  3822.         iconColor: false
  3823.     };
  3824.  
  3825.     PluginTweets.prototype = {
  3826.         initialize: function($el, opts) {
  3827.             if ($el.data(instanceName)) {
  3828.                 return this;
  3829.             }
  3830.  
  3831.             this.$el = $el;
  3832.  
  3833.             this
  3834.                 .setData()
  3835.                 .setOptions(opts)
  3836.                 .build();
  3837.  
  3838.             return this;
  3839.         },
  3840.  
  3841.         setData: function() {
  3842.             this.$el.data(instanceName, this);
  3843.  
  3844.             return this;
  3845.         },
  3846.  
  3847.         setOptions: function(opts) {
  3848.             this.options = $.extend(true, {}, PluginTweets.defaults, opts, {
  3849.                 wrapper: this.$el
  3850.             });
  3851.  
  3852.             return this;
  3853.         },
  3854.  
  3855.         build: function() {
  3856.             if (this.options.username == null || this.options.username == '') {
  3857.                 return this;
  3858.             }
  3859.  
  3860.             var self = this,
  3861.                 $wrapper = this.options.wrapper;
  3862.  
  3863.             $.ajax({
  3864.                 type: 'GET',
  3865.                 data: {
  3866.                     twitter_screen_name: self.options.username,
  3867.                     tweets_to_display: self.options.count,
  3868.                     icon_color: self.options.iconColor
  3869.                 },
  3870.                 url: self.options.URL,
  3871.             }).done(function(html) {
  3872.                 $wrapper.html(html).find('a').attr('target','_blank');
  3873.             });
  3874.  
  3875.             return this;
  3876.         }
  3877.     };
  3878.  
  3879.     // expose to scope
  3880.     $.extend(theme, {
  3881.         PluginTweets: PluginTweets
  3882.     });
  3883.  
  3884.     // jquery plugin
  3885.     $.fn.themePluginTweets = function(opts) {
  3886.         return this.map(function() {
  3887.             var $this = $(this);
  3888.  
  3889.             if ($this.data(instanceName)) {
  3890.                 return $this.data(instanceName);
  3891.             } else {
  3892.                 return new PluginTweets($this, opts);
  3893.             }
  3894.  
  3895.         });
  3896.     }
  3897.  
  3898. }).apply(this, [window.theme, jQuery]);
  3899.  
  3900. // Validation
  3901. (function(theme, $) {
  3902.  
  3903.     theme = theme || {};
  3904.  
  3905.     $.extend(theme, {
  3906.  
  3907.         PluginValidation: {
  3908.  
  3909.             defaults: {
  3910.                 formClass: 'needs-validation',
  3911.                 validator: {
  3912.                     highlight: function(element) {
  3913.                         $(element)
  3914.                             .addClass('is-invalid')
  3915.                             .removeClass('is-valid')
  3916.                             .parent()
  3917.                             .removeClass('has-success')
  3918.                             .addClass('has-danger');
  3919.                     },
  3920.                     success: function(label, element) {
  3921.                         $(element)
  3922.                             .removeClass('is-invalid')
  3923.                             .addClass('is-valid')
  3924.                             .parent()
  3925.                             .removeClass('has-danger')
  3926.                             .addClass('has-success')
  3927.                             .find('label.error')
  3928.                             .remove();
  3929.                     },
  3930.                     errorPlacement: function(error, element) {
  3931.                         if (element.attr('type') == 'radio' || element.attr('type') == 'checkbox') {
  3932.                             error.appendTo(element.parent().parent());
  3933.                         } else {
  3934.                             error.insertAfter(element);
  3935.                         }
  3936.                     }
  3937.                 },
  3938.                 validateCaptchaURL: 'php/contact-form-verify-captcha.php',
  3939.                 refreshCaptchaURL: 'php/contact-form-refresh-captcha.php'
  3940.             },
  3941.  
  3942.             initialize: function(opts) {
  3943.                 initialized = true;
  3944.  
  3945.                 this
  3946.                     .setOptions(opts)
  3947.                     .build();
  3948.  
  3949.                 return this;
  3950.             },
  3951.  
  3952.             setOptions: function(opts) {
  3953.                 this.options = $.extend(true, {}, this.defaults, opts);
  3954.  
  3955.                 return this;
  3956.             },
  3957.  
  3958.             build: function() {
  3959.                 var self = this;
  3960.  
  3961.                 if (!($.isFunction($.validator))) {
  3962.                     return this;
  3963.                 }
  3964.  
  3965.                 self.addMethods();
  3966.                 self.setMessageGroups();
  3967.  
  3968.                 $.validator.setDefaults(self.options.validator);
  3969.  
  3970.                 $('.' + self.options.formClass).validate();
  3971.  
  3972.                 return this;
  3973.             },
  3974.  
  3975.             addMethods: function() {
  3976.                 var self = this;
  3977.  
  3978.                 $.validator.addMethod('captcha', function(value, element, params) {
  3979.                     var captchaValid = false;
  3980.  
  3981.                     $.ajax({
  3982.                         url: self.options.validateCaptchaURL,
  3983.                         type: 'POST',
  3984.                         async: false,
  3985.                         dataType: 'json',
  3986.                         data: {
  3987.                             captcha: $.trim(value)
  3988.                         },
  3989.                         success: function(data) {
  3990.                             if (data.response == 'success') {
  3991.                                 captchaValid = true;
  3992.                             }
  3993.                         }
  3994.                     });
  3995.  
  3996.                     if (captchaValid) {
  3997.                         return true;
  3998.                     }
  3999.  
  4000.                 }, '');
  4001.  
  4002.                 // Refresh Captcha
  4003.                 $('#refreshCaptcha').on('click', function(e) {
  4004.                     e.preventDefault();
  4005.                     $.get(self.options.refreshCaptchaURL, function(url) {
  4006.                         $('#captcha-image').attr('src', url);
  4007.                     });                
  4008.                 });
  4009.  
  4010.             },
  4011.  
  4012.             setMessageGroups: function() {
  4013.  
  4014.                 $('.checkbox-group[data-msg-required], .radio-group[data-msg-required]').each(function() {
  4015.                     var message = $(this).data('msg-required');
  4016.                     $(this).find('input').attr('data-msg-required', message);
  4017.                 });
  4018.  
  4019.             }
  4020.  
  4021.         }
  4022.  
  4023.     });
  4024.  
  4025. }).apply(this, [window.theme, jQuery]);
  4026.  
  4027. // Video Background
  4028. (function(theme, $) {
  4029.  
  4030.     theme = theme || {};
  4031.  
  4032.     var instanceName = '__videobackground';
  4033.  
  4034.     var PluginVideoBackground = function($el, opts) {
  4035.         return this.initialize($el, opts);
  4036.     };
  4037.  
  4038.     PluginVideoBackground.defaults = {
  4039.         overlay: false,
  4040.         volume: 1,
  4041.         playbackRate: 1,
  4042.         muted: true,
  4043.         loop: true,
  4044.         autoplay: true,
  4045.         position: '50% 50%',
  4046.         posterType: 'detect'
  4047.     };
  4048.  
  4049.     PluginVideoBackground.prototype = {
  4050.         initialize: function($el, opts) {
  4051.             this.$el = $el;
  4052.  
  4053.             this
  4054.                 .setData()
  4055.                 .setOptions(opts)
  4056.                 .build();
  4057.  
  4058.             return this;
  4059.         },
  4060.  
  4061.         setData: function() {
  4062.             this.$el.data(instanceName, this);
  4063.  
  4064.             return this;
  4065.         },
  4066.  
  4067.         setOptions: function(opts) {
  4068.             this.options = $.extend(true, {}, PluginVideoBackground.defaults, opts, {
  4069.                 path: this.$el.data('video-path'),
  4070.                 wrapper: this.$el
  4071.             });
  4072.  
  4073.             return this;
  4074.         },
  4075.  
  4076.         build: function() {
  4077.  
  4078.             if (!($.isFunction($.fn.vide)) || (!this.options.path)) {
  4079.                 return this;
  4080.             }
  4081.  
  4082.             if (this.options.overlay) {
  4083.  
  4084.                 var overlayClass = this.options.overlayClass;
  4085.  
  4086.                 this.options.wrapper.prepend(
  4087.                     $('<div />').addClass(overlayClass)
  4088.                 );
  4089.             }
  4090.  
  4091.             this.options.wrapper
  4092.                 .vide(this.options.path, this.options)
  4093.                 .first().css('z-index', 0);
  4094.  
  4095.             return this;
  4096.         }
  4097.     };
  4098.  
  4099.     // expose to scope
  4100.     $.extend(theme, {
  4101.         PluginVideoBackground: PluginVideoBackground
  4102.     });
  4103.  
  4104.     // jquery plugin
  4105.     $.fn.themePluginVideoBackground = function(opts) {
  4106.         return this.map(function() {
  4107.             var $this = $(this);
  4108.  
  4109.             if ($this.data(instanceName)) {
  4110.                 return $this.data(instanceName);
  4111.             } else {
  4112.                 return new PluginVideoBackground($this, opts);
  4113.             }
  4114.  
  4115.         });
  4116.     }
  4117.  
  4118. }).apply(this, [window.theme, jQuery]);
  4119.  
  4120. // Account
  4121. (function(theme, $) {
  4122.  
  4123.     theme = theme || {};
  4124.  
  4125.     var initialized = false;
  4126.  
  4127.     $.extend(theme, {
  4128.  
  4129.         Account: {
  4130.  
  4131.             defaults: {
  4132.                 wrapper: $('#headerAccount')
  4133.             },
  4134.  
  4135.             initialize: function($wrapper, opts) {
  4136.                 if (initialized) {
  4137.                     return this;
  4138.                 }
  4139.  
  4140.                 initialized = true;
  4141.                 this.$wrapper = ($wrapper || this.defaults.wrapper);
  4142.  
  4143.                 this
  4144.                     .setOptions(opts)
  4145.                     .events();
  4146.  
  4147.                 return this;
  4148.             },
  4149.  
  4150.             setOptions: function(opts) {
  4151.                 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options')));
  4152.  
  4153.                 return this;
  4154.             },
  4155.  
  4156.             events: function() {
  4157.                 var self = this;
  4158.  
  4159.                 $(window).on('load', function(){
  4160.                     $(document).ready(function(){
  4161.                         setTimeout(function(){
  4162.  
  4163.                             self.$wrapper.find('input').on('focus', function() {
  4164.                                 self.$wrapper.addClass('open');
  4165.  
  4166.                                 $(document).mouseup(function(e) {
  4167.                                     if (!self.$wrapper.is(e.target) && self.$wrapper.has(e.target).length === 0) {
  4168.                                         self.$wrapper.removeClass('open');
  4169.                                     }
  4170.                                 });
  4171.                             });
  4172.  
  4173.                         }, 1500);
  4174.                     });
  4175.                 });
  4176.  
  4177.                 $('#headerSignUp').on('click', function(e) {
  4178.                     e.preventDefault();
  4179.                     self.$wrapper.addClass('signup').removeClass('signin').removeClass('recover');
  4180.                     self.$wrapper.find('.signup-form input:first').focus();
  4181.                 });
  4182.  
  4183.                 $('#headerSignIn').on('click', function(e) {
  4184.                     e.preventDefault();
  4185.                     self.$wrapper.addClass('signin').removeClass('signup').removeClass('recover');
  4186.                     self.$wrapper.find('.signin-form input:first').focus();
  4187.                 });
  4188.  
  4189.                 $('#headerRecover').on('click', function(e) {
  4190.                     e.preventDefault();
  4191.                     self.$wrapper.addClass('recover').removeClass('signup').removeClass('signin');
  4192.                     self.$wrapper.find('.recover-form input:first').focus();
  4193.                 });
  4194.  
  4195.                 $('#headerRecoverCancel').on('click', function(e) {
  4196.                     e.preventDefault();
  4197.                     self.$wrapper.addClass('signin').removeClass('signup').removeClass('recover');
  4198.                     self.$wrapper.find('.signin-form input:first').focus();
  4199.                 });
  4200.             }
  4201.  
  4202.         }
  4203.  
  4204.     });
  4205.  
  4206. }).apply(this, [window.theme, jQuery]);
  4207.  
  4208. // Nav
  4209. (function(theme, $) {
  4210.  
  4211.     theme = theme || {};
  4212.  
  4213.     var initialized = false;
  4214.  
  4215.     $.extend(theme, {
  4216.  
  4217.         Nav: {
  4218.  
  4219.             defaults: {
  4220.                 wrapper: $('#mainNav'),
  4221.                 scrollDelay: 600,
  4222.                 scrollAnimation: 'easeOutQuad'
  4223.             },
  4224.  
  4225.             initialize: function($wrapper, opts) {
  4226.                 if (initialized) {
  4227.                     return this;
  4228.                 }
  4229.  
  4230.                 initialized = true;
  4231.                 this.$wrapper = ($wrapper || this.defaults.wrapper);
  4232.  
  4233.                 this
  4234.                     .setOptions(opts)
  4235.                     .build()
  4236.                     .events();
  4237.  
  4238.                 return this;
  4239.             },
  4240.  
  4241.             setOptions: function(opts) {
  4242.                 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options')));
  4243.  
  4244.                 return this;
  4245.             },
  4246.  
  4247.             build: function() {
  4248.                 var self = this,
  4249.                     $html = $('html'),
  4250.                     $header = $('#header'),
  4251.                     $headerNavMain = $('#header .header-nav-main'),
  4252.                     thumbInfoPreview;
  4253.  
  4254.                 // Preview Thumbs
  4255.                 self.$wrapper.find('a[data-thumb-preview]').each(function() {
  4256.                     thumbInfoPreview = $('<span />').addClass('thumb-info thumb-info-preview')
  4257.                                             .append($('<span />').addClass('thumb-info-wrapper')
  4258.                                                 .append($('<span />').addClass('thumb-info-image').css('background-image', 'url(' + $(this).data('thumb-preview') + ')')
  4259.                                            )
  4260.                                        );
  4261.  
  4262.                     $(this).append(thumbInfoPreview);
  4263.                 });
  4264.  
  4265.                 // Side Header / Side Header Hamburguer Sidebar (Reverse Dropdown)
  4266.                 if($html.hasClass('side-header') || $html.hasClass('side-header-hamburguer-sidebar')) {
  4267.                    
  4268.                     // Side Header Right / Side Header Hamburguer Sidebar Right
  4269.                     if($html.hasClass('side-header-right') || $html.hasClass('side-header-hamburguer-sidebar-right')) {
  4270.                         if(!$html.hasClass('side-header-right-no-reverse')) {
  4271.                             $header.find('.dropdown-submenu').addClass('dropdown-reverse');
  4272.                         }
  4273.                     }
  4274.  
  4275.                 } else {
  4276.                    
  4277.                     // Reverse
  4278.                     self.checkReverse = function() {
  4279.                         self.$wrapper.find('.dropdown, .dropdown-submenu').removeClass('dropdown-reverse');
  4280.  
  4281.                         self.$wrapper.find('.dropdown:not(.manual):not(.dropdown-mega), .dropdown-submenu:not(.manual)').each(function() {
  4282.                             if(!$(this).find('.dropdown-menu').visible( false, true, 'horizontal' )  ) {
  4283.                                 $(this).addClass('dropdown-reverse');
  4284.                             }
  4285.                         });
  4286.                     }
  4287.  
  4288.                     self.checkReverse();
  4289.  
  4290.                     $(window).on('resize', function() {
  4291.                         self.checkReverse();
  4292.                     });
  4293.  
  4294.                 }
  4295.  
  4296.                 // Clone Items
  4297.                 if($headerNavMain.hasClass('header-nav-main-clone-items')) {
  4298.  
  4299.                     $headerNavMain.find('nav > ul > li > a').each(function(){
  4300.                         var parent = $(this).parent(),
  4301.                             clone  = $(this).clone(),
  4302.                             clone2 = $(this).clone(),
  4303.                             wrapper = $('<span class="wrapper-items-cloned"></span>');
  4304.  
  4305.                         // Config Classes
  4306.                         $(this).addClass('item-original');
  4307.                         clone2.addClass('item-two');
  4308.  
  4309.                         // Insert on DOM
  4310.                         parent.prepend(wrapper);
  4311.                         wrapper.append(clone).append(clone2);
  4312.                     });
  4313.  
  4314.                 }
  4315.  
  4316.                 // Floating
  4317.                 if($('#header.header-floating-icons').get(0) && $(window).width() > 991) {
  4318.  
  4319.                     var menuFloatingAnim = {
  4320.                         $menuFloating: $('#header.header-floating-icons .header-container > .header-row'),
  4321.  
  4322.                         build: function() {
  4323.                             var self = this;
  4324.  
  4325.                             self.init();
  4326.                         },
  4327.                         init: function(){
  4328.                             var self  = this,
  4329.                                 divisor = 0;
  4330.  
  4331.                             $(window).scroll(function() {
  4332.                                 var scrollPercent = 100 * $(window).scrollTop() / ($(document).height() - $(window).height()),
  4333.                                     st = $(this).scrollTop();
  4334.  
  4335.                                 divisor = $(document).height() / $(window).height();
  4336.  
  4337.                                 self.$menuFloating.find('.header-column > .header-row').css({
  4338.                                     transform : 'translateY( calc('+ scrollPercent +'vh - '+ st / divisor +'px) )'
  4339.                                 });
  4340.                             });
  4341.                         }
  4342.                     }
  4343.  
  4344.                     menuFloatingAnim.build();
  4345.  
  4346.                 }
  4347.  
  4348.                 // Slide
  4349.                 if($('.header-nav-links-vertical-slide').get(0)) {
  4350.                     var slideNavigation = {
  4351.                         $mainNav: $('#mainNav'),
  4352.                         $mainNavItem: $('#mainNav li'),
  4353.  
  4354.                         build: function(){
  4355.                             var self = this;
  4356.  
  4357.                             self.menuNav();
  4358.                         },
  4359.                         menuNav: function(){
  4360.                             var self = this;
  4361.  
  4362.                             self.$mainNavItem.on('click', function(e){
  4363.                                 var currentMenuItem     = $(this),
  4364.                                     currentMenu         = $(this).parent(),
  4365.                                     nextMenu            = $(this).find('ul').first(),
  4366.                                     prevMenu            = $(this).closest('.next-menu'),
  4367.                                     isSubMenu           = currentMenuItem.hasClass('dropdown') || currentMenuItem.hasClass('dropdown-submenu'),
  4368.                                     isBack              = currentMenuItem.hasClass('back-button'),
  4369.                                     nextMenuHeightDiff  = ( ( nextMenu.find('> li').length * nextMenu.find('> li').outerHeight() ) - nextMenu.outerHeight() ),
  4370.                                     prevMenuHeightDiff  = ( ( prevMenu.find('> li').length * prevMenu.find('> li').outerHeight() ) - prevMenu.outerHeight() );
  4371.  
  4372.                                 if( isSubMenu ) {
  4373.                                     currentMenu.addClass('next-menu');
  4374.                                     nextMenu.addClass('visible');
  4375.                                     currentMenu.css({
  4376.                                         overflow: 'visible',
  4377.                                         'overflow-y': 'visible'
  4378.                                     });
  4379.                                    
  4380.                                     if( nextMenuHeightDiff > 0 ) {
  4381.                                         nextMenu.css({
  4382.                                             overflow: 'hidden',
  4383.                                             'overflow-y': 'scroll'
  4384.                                         });
  4385.                                     }
  4386.  
  4387.                                     for( i = 0; i < nextMenu.find('> li').length; i++ ) {
  4388.                                         if( nextMenu.outerHeight() < ($('.header-row-side-header').outerHeight() - 100) ) {
  4389.                                             nextMenu.css({
  4390.                                                 height: nextMenu.outerHeight() + nextMenu.find('> li').outerHeight()
  4391.                                             });
  4392.                                         }
  4393.                                     }
  4394.  
  4395.                                     nextMenu.css({
  4396.                                         'padding-top': nextMenuHeightDiff + 'px'
  4397.                                     });
  4398.                                 }
  4399.  
  4400.                                 if( isBack ) {
  4401.                                     currentMenu.parent().parent().removeClass('next-menu');
  4402.                                     currentMenu.removeClass('visible');
  4403.  
  4404.                                     if( prevMenuHeightDiff > 0 ) {
  4405.                                         prevMenu.css({
  4406.                                             overflow: 'hidden',
  4407.                                             'overflow-y': 'scroll'
  4408.                                         });
  4409.                                     }
  4410.                                 }
  4411.  
  4412.                                 e.stopPropagation();
  4413.                             });
  4414.                         }
  4415.                     }
  4416.  
  4417.                     $(window).trigger('resize');
  4418.                    
  4419.                     if( $(window).width() > 991 ) {
  4420.                         slideNavigation.build();
  4421.                     }
  4422.  
  4423.                     $(document).ready(function(){
  4424.                         $(window).afterResize(function(){
  4425.                             if( $(window).width() > 991 ) {
  4426.                                 slideNavigation.build();
  4427.                             }
  4428.                         });
  4429.                     });
  4430.                 }
  4431.  
  4432.                 // Header Nav Main Mobile Dark
  4433.                 if($('.header-nav-main-mobile-dark').get(0)) {
  4434.                     $('#header:not(.header-transparent-dark-bottom-border):not(.header-transparent-light-bottom-border)').addClass('header-no-border-bottom');
  4435.                 }
  4436.                
  4437.                 return this;
  4438.             },
  4439.  
  4440.             events: function() {
  4441.                 var self    = this,
  4442.                     $html   = $('html'),
  4443.                     $header = $('#header'),
  4444.                     $window = $(window),
  4445.                     headerBodyHeight = $('.header-body').outerHeight();
  4446.  
  4447.                 $header.find('a[href="#"]').on('click', function(e) {
  4448.                     e.preventDefault();
  4449.                 });
  4450.  
  4451.                 // Mobile Arrows
  4452.                 $header.find('.dropdown-toggle, .dropdown-submenu > a')
  4453.                     .append('<i class="fas fa-chevron-down"></i>');
  4454.                
  4455.                 $header.find('.dropdown-toggle[href="#"], .dropdown-submenu a[href="#"], .dropdown-toggle[href!="#"] .fa-chevron-down, .dropdown-submenu a[href!="#"] .fa-chevron-down').on('click', function(e) {
  4456.                     e.preventDefault();
  4457.                     if ($window.width() < 992) {
  4458.                         $(this).closest('li').toggleClass('open');
  4459.  
  4460.                         // Adjust Header Body Height
  4461.                         var height = ( $header.hasClass('header-effect-shrink') && $html.hasClass('sticky-header-active') ) ? theme.StickyHeader.options.stickyHeaderContainerHeight : headerBodyHeight;
  4462.                         $('.header-body').animate({
  4463.                             height: ($('.header-nav-main nav').outerHeight(true) + height) + 10
  4464.                         }, 0);
  4465.                     }
  4466.                 });
  4467.  
  4468.                 $header.find('li a.active').addClass('current-page-active');
  4469.  
  4470.                 // Add Open Class
  4471.                 $header.find('.header-nav-click-to-open .dropdown-toggle[href="#"], .header-nav-click-to-open .dropdown-submenu a[href="#"], .header-nav-click-to-open .dropdown-toggle > i').on('click', function(e) {
  4472.                     e.preventDefault();
  4473.                     e.stopPropagation();
  4474.                     if ($window.width() > 991) {
  4475.  
  4476.                         $header.find('li a.active').removeClass('active');
  4477.  
  4478.                         if( $(this).prop('tagName') == 'I' ) {
  4479.                             $(this).parent().addClass('active');
  4480.                         } else {
  4481.                             $(this).addClass('active');
  4482.                         }
  4483.  
  4484.                         if (!$(this).closest('li').hasClass('open')) {
  4485.  
  4486.                             var $li = $(this).closest('li'),
  4487.                                 isSub = false;
  4488.  
  4489.                             if ( $(this).parent().hasClass('dropdown-submenu') ) {
  4490.                                 isSub = true;
  4491.                             }
  4492.  
  4493.                             $(this).closest('.dropdown-menu').find('.dropdown-submenu.open').removeClass('open');
  4494.                             $(this).parent('.dropdown').parent().find('.dropdown.open').removeClass('open');
  4495.  
  4496.                             if (!isSub) {
  4497.                                 $(this).parent().find('.dropdown-submenu.open').removeClass('open');
  4498.                             }
  4499.  
  4500.                             $li.addClass('open');
  4501.  
  4502.                             $(document).off('click.nav-click-to-open').on('click.nav-click-to-open', function (e) {
  4503.                                 if (!$li.is(e.target) && $li.has(e.target).length === 0) {
  4504.                                     $li.removeClass('open');
  4505.                                     $li.parents('.open').removeClass('open');
  4506.                                     $header.find('li a.active').removeClass('active');
  4507.                                     $header.find('li a.current-page-active').addClass('active');
  4508.                                 }
  4509.                             });
  4510.  
  4511.                         } else {
  4512.                             $(this).closest('li').removeClass('open');
  4513.                             $header.find('li a.active').removeClass('active');
  4514.                             $header.find('li a.current-page-active').addClass('active');
  4515.                         }
  4516.  
  4517.                         $window.trigger({
  4518.                             type: 'resize',
  4519.                             from: 'header-nav-click-to-open'
  4520.                         });
  4521.                     }
  4522.                 });
  4523.  
  4524.                 // Collapse Nav
  4525.                 $header.find('[data-collapse-nav]').on('click', function(e) {
  4526.                     $(this).parents('.collapse').removeClass('show');
  4527.                 });
  4528.  
  4529.                 // Top Features
  4530.                 $header.find('.header-nav-features-toggle').on('click', function(e) {
  4531.                     e.preventDefault();
  4532.  
  4533.                     var $toggleParent = $(this).parent();
  4534.  
  4535.                     if (!$(this).siblings('.header-nav-features-dropdown').hasClass('show')) {
  4536.  
  4537.                         var $dropdown = $(this).siblings('.header-nav-features-dropdown');
  4538.  
  4539.                         $('.header-nav-features-dropdown.show').removeClass('show');
  4540.  
  4541.                         $dropdown.addClass('show');
  4542.  
  4543.                         $(document).off('click.header-nav-features-toggle').on('click.header-nav-features-toggle', function (e) {
  4544.                             if (!$toggleParent.is(e.target) && $toggleParent.has(e.target).length === 0) {
  4545.                                 $('.header-nav-features-dropdown.show').removeClass('show');
  4546.                             }
  4547.                         });
  4548.  
  4549.                         if ($(this).attr('data-focus')) {
  4550.                             $('#' + $(this).attr('data-focus')).focus();
  4551.                         }
  4552.  
  4553.                     } else {
  4554.                         $(this).siblings('.header-nav-features-dropdown').removeClass('show');
  4555.                     }
  4556.                 });
  4557.  
  4558.                 // Hamburguer Menu
  4559.                 var $hamburguerMenuBtn = $('.hamburguer-btn:not(.side-panel-toggle)'),
  4560.                     $hamburguerSideHeader = $('#header.side-header, #header.side-header-overlay-full-screen');
  4561.                
  4562.                 $hamburguerMenuBtn.on('click', function(){
  4563.                     if($(this).attr('data-set-active') != 'false') {
  4564.                         $(this).toggleClass('active');
  4565.                     }
  4566.                     $hamburguerSideHeader.toggleClass('side-header-hide');
  4567.                     $html.toggleClass('side-header-hide');
  4568.  
  4569.                     $window.trigger('resize');
  4570.                 });
  4571.  
  4572.                 $('.hamburguer-close:not(.side-panel-toggle)').on('click', function(){
  4573.                     $('.hamburguer-btn:not(.hamburguer-btn-side-header-mobile-show)').trigger('click');
  4574.                 });            
  4575.                
  4576.                 // Set Header Body Height when open mobile menu
  4577.                 $('.header-nav-main nav').on('show.bs.collapse', function () {
  4578.                     $(this).removeClass('closed');
  4579.  
  4580.                     // Add Mobile Menu Opened Class
  4581.                     $('html').addClass('mobile-menu-opened');
  4582.  
  4583.                     $('.header-body').animate({
  4584.                         height: ($('.header-body').outerHeight() + $('.header-nav-main nav').outerHeight(true)) + 10
  4585.                     });
  4586.  
  4587.                     // Header Below Slider / Header Bottom Slider - Scroll to menu position
  4588.                     if( $('#header').is('.header-bottom-slider, .header-below-slider') && !$('html').hasClass('sticky-header-active') ) {
  4589.                         self.scrollToTarget( $('#header'), 0 );
  4590.                     }
  4591.                 });
  4592.  
  4593.                 // Set Header Body Height when collapse mobile menu
  4594.                 $('.header-nav-main nav').on('hide.bs.collapse', function () {
  4595.                     $(this).addClass('closed');
  4596.  
  4597.                     // Remove Mobile Menu Opened Class
  4598.                     $('html').removeClass('mobile-menu-opened');
  4599.  
  4600.                     $('.header-body').animate({
  4601.                         height: ($('.header-body').outerHeight() - $('.header-nav-main nav').outerHeight(true))
  4602.                     }, function(){
  4603.                         $(this).height('auto');
  4604.                     });
  4605.                 });
  4606.  
  4607.                 // Header Effect Shrink - Adjust header body height on mobile
  4608.                 $window.on('stickyHeader.activate', function(){
  4609.                     if( $window.width() < 992 && $header.hasClass('header-effect-shrink') ) {
  4610.                         if( $('.header-btn-collapse-nav').attr('aria-expanded') == 'true' ) {
  4611.                             $('.header-body').animate({
  4612.                                 height: ( $('.header-nav-main nav').outerHeight(true) + theme.StickyHeader.options.stickyHeaderContainerHeight ) + ( ($('.header-nav-bar').get(0)) ? $('.header-nav-bar').outerHeight() : 0 )
  4613.                             });
  4614.                         }
  4615.                     }
  4616.                 });
  4617.  
  4618.                 $window.on('stickyHeader.deactivate', function(){
  4619.                     if( $window.width() < 992 && $header.hasClass('header-effect-shrink') ) {
  4620.                         if( $('.header-btn-collapse-nav').attr('aria-expanded') == 'true' ) {
  4621.                             $('.header-body').animate({
  4622.                                 height: headerBodyHeight + $('.header-nav-main nav').outerHeight(true) + 10
  4623.                             });
  4624.                         }
  4625.                     }
  4626.                 });
  4627.  
  4628.                 // Remove Open Class on Resize     
  4629.                 $window.on('resize.removeOpen', function(e) {
  4630.                     if( e.from == 'header-nav-click-to-open' ) {
  4631.                         return;
  4632.                     }
  4633.                    
  4634.                     setTimeout(function() {
  4635.                         if( $window.width() > 991 ) {
  4636.                             $header.find('.dropdown.open').removeClass('open');
  4637.                         }
  4638.                     }, 100);
  4639.                 });
  4640.  
  4641.                 // Side Header - Change value of initial header body height
  4642.                 $(document).ready(function(){
  4643.                     if( $window.width() > 991 ) {
  4644.                         var flag = false;
  4645.                        
  4646.                         $window.on('resize', function(e) {
  4647.                             if( e.from == 'header-nav-click-to-open' ) {
  4648.                                 return;
  4649.                             }
  4650.  
  4651.                             $header.find('.dropdown.open').removeClass('open');
  4652.  
  4653.                             if( $window.width() < 992 && flag == false ) {
  4654.                                 headerBodyHeight = $('.header-body').outerHeight();
  4655.                                 flag = true;
  4656.  
  4657.                                 setTimeout(function(){
  4658.                                     flag = false;
  4659.                                 }, 500);
  4660.                             }
  4661.                         });
  4662.                     }
  4663.                 });
  4664.  
  4665.                 // Side Header - Set header height on mobile
  4666.                 if( $html.hasClass('side-header') ) {
  4667.                     if( $window.width() < 992 ) {
  4668.                         $header.css({
  4669.                             height: $('.header-body .header-container').outerHeight() + (parseInt( $('.header-body').css('border-top-width') ) + parseInt( $('.header-body').css('border-bottom-width') ))
  4670.                         });
  4671.                     }
  4672.  
  4673.                     $(document).ready(function(){
  4674.                         $window.afterResize(function(){
  4675.                             if( $window.width() < 992 ) {
  4676.                                 $header.css({
  4677.                                     height: $('.header-body .header-container').outerHeight() + (parseInt( $('.header-body').css('border-top-width') ) + parseInt( $('.header-body').css('border-bottom-width') ))
  4678.                                 });
  4679.                             } else {
  4680.                                 $header.css({
  4681.                                     height: ''
  4682.                                 });
  4683.                             }
  4684.                         });
  4685.                     });
  4686.                 }
  4687.  
  4688.                 // Anchors Position
  4689.                 $('[data-hash]').each(function() {
  4690.  
  4691.                     var target = $(this).attr('href'),
  4692.                         offset = ($(this).is("[data-hash-offset]") ? $(this).data('hash-offset') : 0);
  4693.  
  4694.                     if($(target).get(0)) {
  4695.                         $(this).on('click', function(e) {
  4696.                             e.preventDefault();
  4697.  
  4698.                             if( !$(e.target).is('i') ) {
  4699.  
  4700.                                 // Close Collapse if open
  4701.                                 $(this).parents('.collapse.show').collapse('hide');
  4702.  
  4703.                                 // Close Side Header
  4704.                                 $hamburguerSideHeader.addClass('side-header-hide');
  4705.                                 $html.addClass('side-header-hide');
  4706.                                
  4707.                                 $window.trigger('resize');
  4708.  
  4709.                                 self.scrollToTarget(target, offset);
  4710.                                
  4711.                             }
  4712.  
  4713.                             return;
  4714.                         });
  4715.                     }
  4716.  
  4717.                 });
  4718.  
  4719.                 // Floating
  4720.                 if($('#header.header-floating-icons').get(0)) {
  4721.  
  4722.                     $('#header.header-floating-icons [data-hash]').off().each(function() {
  4723.  
  4724.                         var target = $(this).attr('href'),
  4725.                             offset = ($(this).is("[data-hash-offset]") ? $(this).data('hash-offset') : 0);
  4726.  
  4727.                         if($(target).get(0)) {
  4728.                             $(this).on('click', function(e) {
  4729.                                 e.preventDefault();
  4730.  
  4731.                                     $('html, body').animate({
  4732.                                         scrollTop: $(target).offset().top - offset
  4733.                                     }, 600, 'easeOutQuad', function() {
  4734.  
  4735.                                     });
  4736.  
  4737.                                 return;
  4738.                             });
  4739.                         }
  4740.  
  4741.                     });
  4742.  
  4743.                 }
  4744.  
  4745.                 // Side Panel Toggle
  4746.                 if( $('.side-panel-toggle').get(0) ) {
  4747.                     var init_html_class = $('html').attr('class');
  4748.  
  4749.                     $('.side-panel-toggle').on('click', function(e){
  4750.                         var extra_class = $(this).data('extra-class'),
  4751.                             delay       = ( extra_class ) ? 100 : 0;
  4752.  
  4753.                         e.preventDefault();
  4754.  
  4755.                         if( $(this).hasClass('active') ) {
  4756.                             $('html').removeClass('side-panel-open');
  4757.                             $('.hamburguer-btn.side-panel-toggle:not(.side-panel-close)').removeClass('active');
  4758.                             return false;
  4759.                         }
  4760.  
  4761.                         if( extra_class ) {
  4762.                             $('.side-panel-wrapper').css('transition','none');
  4763.                             $('html')
  4764.                                 .removeClass()
  4765.                                 .addClass( init_html_class )
  4766.                                 .addClass( extra_class );
  4767.                         }
  4768.  
  4769.                         setTimeout(function(){
  4770.                             $('.side-panel-wrapper').css('transition','');
  4771.                             $('html').toggleClass('side-panel-open');
  4772.                         }, delay);
  4773.                     });
  4774.  
  4775.                     $(document).on('click', function(e){
  4776.                         if( !$(e.target).closest('.side-panel-wrapper').get(0) && !$(e.target).hasClass('side-panel-toggle') ) {
  4777.                             $('.hamburguer-btn.side-panel-toggle:not(.side-panel-close)').removeClass('active');
  4778.                             $('html').removeClass('side-panel-open');
  4779.                         }
  4780.                     });
  4781.                 }
  4782.  
  4783.                 return this;
  4784.             },
  4785.  
  4786.             scrollToTarget: function(target, offset) {
  4787.                 var self = this;
  4788.  
  4789.                 $('body').addClass('scrolling');
  4790.  
  4791.                 $('html, body').animate({
  4792.                     scrollTop: $(target).offset().top - offset
  4793.                 }, self.options.scrollDelay, self.options.scrollAnimation, function() {
  4794.                     $('body').removeClass('scrolling');
  4795.                 });
  4796.  
  4797.                 return this;
  4798.  
  4799.             }
  4800.  
  4801.         }
  4802.  
  4803.     });
  4804.  
  4805. }).apply(this, [window.theme, jQuery]);
  4806.  
  4807.  
  4808. // Newsletter
  4809. (function(theme, $) {
  4810.  
  4811.     theme = theme || {};
  4812.  
  4813.     var initialized = false;
  4814.  
  4815.     $.extend(theme, {
  4816.  
  4817.         Newsletter: {
  4818.  
  4819.             defaults: {
  4820.                 wrapper: $('#newsletterForm')
  4821.             },
  4822.  
  4823.             initialize: function($wrapper, opts) {
  4824.                 if (initialized) {
  4825.                     return this;
  4826.                 }
  4827.  
  4828.                 initialized = true;
  4829.                 this.$wrapper = ($wrapper || this.defaults.wrapper);
  4830.  
  4831.                 this
  4832.                     .setOptions(opts)
  4833.                     .build();
  4834.  
  4835.                 return this;
  4836.             },
  4837.  
  4838.             setOptions: function(opts) {
  4839.                 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options')));
  4840.  
  4841.                 return this;
  4842.             },
  4843.  
  4844.             build: function() {
  4845.                 if (!($.isFunction($.fn.validate))) {
  4846.                     return this;
  4847.                 }
  4848.  
  4849.                 var self = this,
  4850.                     $email = self.$wrapper.find('#newsletterEmail'),
  4851.                     $success = $('#newsletterSuccess'),
  4852.                     $error = $('#newsletterError');
  4853.  
  4854.                 self.$wrapper.validate({
  4855.                     submitHandler: function(form) {
  4856.  
  4857.                         $.ajax({
  4858.                             type: 'POST',
  4859.                             url: self.$wrapper.attr('action'),
  4860.                             data: {
  4861.                                 'email': $email.val()
  4862.                             },
  4863.                             dataType: 'json',
  4864.                             success: function(data) {
  4865.                                 if (data.response == 'success') {
  4866.  
  4867.                                     $success.removeClass('d-none');
  4868.                                     $error.addClass('d-none');
  4869.  
  4870.                                     $email
  4871.                                         .val('')
  4872.                                         .blur()
  4873.                                         .closest('.control-group')
  4874.                                         .removeClass('success')
  4875.                                         .removeClass('error');
  4876.  
  4877.                                 } else {
  4878.  
  4879.                                     $error.html(data.message);
  4880.                                     $error.removeClass('d-none');
  4881.                                     $success.addClass('d-none');
  4882.  
  4883.                                     $email
  4884.                                         .blur()
  4885.                                         .closest('.control-group')
  4886.                                         .removeClass('success')
  4887.                                         .addClass('error');
  4888.  
  4889.                                 }
  4890.                             }
  4891.                         });
  4892.  
  4893.                     },
  4894.                     rules: {
  4895.                         newsletterEmail: {
  4896.                             required: true,
  4897.                             email: true
  4898.                         }
  4899.                     },
  4900.                     errorPlacement: function(error, element) {
  4901.  
  4902.                     }
  4903.                 });
  4904.  
  4905.                 return this;
  4906.             }
  4907.  
  4908.         }
  4909.  
  4910.     });
  4911.  
  4912. }).apply(this, [window.theme, jQuery]);
  4913.  
  4914. // Search
  4915. (function(theme, $) {
  4916.  
  4917.     theme = theme || {};
  4918.  
  4919.     var initialized = false;
  4920.  
  4921.     $.extend(theme, {
  4922.  
  4923.         Search: {
  4924.  
  4925.             defaults: {
  4926.                 wrapper: $('#searchForm')
  4927.             },
  4928.  
  4929.             initialize: function($wrapper, opts) {
  4930.                 if (initialized) {
  4931.                     return this;
  4932.                 }
  4933.  
  4934.                 initialized = true;
  4935.                 this.$wrapper = ($wrapper || this.defaults.wrapper);
  4936.  
  4937.                 this
  4938.                     .setOptions(opts)
  4939.                     .build();
  4940.  
  4941.                 return this;
  4942.             },
  4943.  
  4944.             setOptions: function(opts) {
  4945.                 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options')));
  4946.  
  4947.                 return this;
  4948.             },
  4949.  
  4950.             build: function() {
  4951.                 if (!($.isFunction($.fn.validate))) {
  4952.                     return this;
  4953.                 }
  4954.  
  4955.                 this.$wrapper.validate({
  4956.                     errorPlacement: function(error, element) {}
  4957.                 });
  4958.  
  4959.                 // Search Reveal
  4960.                 $('.header-nav-features-search-reveal').each(function() {
  4961.  
  4962.                     var $el = $(this)
  4963.                         $header = $('#header'),
  4964.                         $html = $('htmnl');
  4965.  
  4966.                     $el.find('.header-nav-features-search-show-icon').on('click', function() {
  4967.                         $el.addClass('show');
  4968.                         $header.addClass('search-show');
  4969.                         $html.addClass('search-show');
  4970.                         $('#headerSearch').focus();
  4971.                     });
  4972.  
  4973.                     $el.find('.header-nav-features-search-hide-icon').on('click', function() {
  4974.                         $el.removeClass('show');
  4975.                         $header.removeClass('search-show');
  4976.                         $html.removeClass('search-show');
  4977.                     });
  4978.  
  4979.                 });
  4980.  
  4981.                 return this;
  4982.             }
  4983.  
  4984.         }
  4985.  
  4986.     });
  4987.  
  4988. }).apply(this, [window.theme, jQuery]);
  4989.  
  4990. // Sticky Header
  4991. (function(theme, $) {
  4992.  
  4993.     theme = theme || {};
  4994.  
  4995.     var initialized = false;
  4996.  
  4997.     $.extend(theme, {
  4998.  
  4999.         StickyHeader: {
  5000.  
  5001.             defaults: {
  5002.                 wrapper: $('#header'),
  5003.                 headerBody: $('#header .header-body'),
  5004.                 stickyEnabled: true,
  5005.                 stickyEnableOnBoxed: true,
  5006.                 stickyEnableOnMobile: true,
  5007.                 stickyStartAt: 0,
  5008.                 stickyStartAtElement: false,
  5009.                 stickySetTop: 0,
  5010.                 stickyEffect: '',
  5011.                 stickyHeaderContainerHeight: false,
  5012.                 stickyChangeLogo: false,
  5013.                 stickyChangeLogoWrapper: true
  5014.             },
  5015.  
  5016.             initialize: function($wrapper, opts) {
  5017.                 if (initialized) {
  5018.                     return this;
  5019.                 }
  5020.  
  5021.                 initialized = true;
  5022.                 this.$wrapper = ($wrapper || this.defaults.wrapper);
  5023.  
  5024.                 this
  5025.                     .setOptions(opts)
  5026.                     .build()
  5027.                     .events();
  5028.  
  5029.                 return this;
  5030.             },
  5031.  
  5032.             setOptions: function(opts) {
  5033.                 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options')));
  5034.  
  5035.                 return this;
  5036.             },
  5037.  
  5038.             build: function() {
  5039.                 if (!this.options.stickyEnableOnBoxed && $('html').hasClass('boxed') || $('html').hasClass('side-header-hamburguer-sidebar') || !this.options.stickyEnabled) {
  5040.                     return this;
  5041.                 }
  5042.  
  5043.                 var self = this,
  5044.                     $html = $('html'),
  5045.                     $window = $(window),
  5046.                     sideHeader = $html.hasClass('side-header'),
  5047.                     initialHeaderTopHeight = self.options.wrapper.find('.header-top').outerHeight(),
  5048.                     initialHeaderContainerHeight = self.options.wrapper.find('.header-container').outerHeight(),
  5049.                     minHeight;
  5050.  
  5051.                 // HTML Classes
  5052.                 $html.addClass('sticky-header-enabled');
  5053.  
  5054.                 if (parseInt(self.options.stickySetTop) < 0) {
  5055.                     $html.addClass('sticky-header-negative');
  5056.                 }
  5057.  
  5058.                 // Set Start At
  5059.                 if(self.options.stickyStartAtElement) {
  5060.  
  5061.                     var $stickyStartAtElement = $(self.options.stickyStartAtElement);
  5062.  
  5063.                     $(window).on('scroll resize', function() {
  5064.                         self.options.stickyStartAt = $stickyStartAtElement.offset().top;
  5065.                     });
  5066.  
  5067.                     $(window).trigger('resize');
  5068.                 }
  5069.  
  5070.                 // Define Min Height value
  5071.                 if( self.options.wrapper.find('.header-top').get(0) ) {
  5072.                     minHeight = ( initialHeaderTopHeight + initialHeaderContainerHeight );
  5073.                 } else {
  5074.                     minHeight = initialHeaderContainerHeight;
  5075.                 }
  5076.  
  5077.                 // Set Wrapper Min-Height
  5078.                 if( !sideHeader ) {
  5079.                     if( !$('.header-logo-sticky-change').get(0) ) {
  5080.                         self.options.wrapper.css('height', self.options.headerBody.outerHeight());
  5081.                     } else {
  5082.                         $window.on('stickyChangeLogo.loaded', function(){
  5083.                             self.options.wrapper.css('height', self.options.headerBody.outerHeight());
  5084.                         });
  5085.                     }
  5086.  
  5087.                     if( self.options.stickyEffect == 'shrink' ) {
  5088.                        
  5089.                         // Prevent wrong visualization of header when reload on middle of page
  5090.                         $(document).ready(function(){
  5091.                             if( $window.scrollTop() >= self.options.stickyStartAt ) {
  5092.                                 self.options.wrapper.find('.header-container').on('transitionend webkitTransitionEnd oTransitionEnd', function(){
  5093.                                     self.options.headerBody.css('position', 'fixed');
  5094.                                 });
  5095.                             } else {
  5096.                                 self.options.headerBody.css('position', 'fixed');
  5097.                             }
  5098.                         });
  5099.  
  5100.                         self.options.wrapper.find('.header-container').css('height', initialHeaderContainerHeight);
  5101.                         self.options.wrapper.find('.header-top').css('height', initialHeaderTopHeight);
  5102.                     }
  5103.                 }
  5104.  
  5105.                 // Sticky Header Container Height
  5106.                 if( self.options.stickyHeaderContainerHeight ) {
  5107.                     self.options.wrapper.find('.header-container').css('height', self.options.wrapper.find('.header-container').outerHeight());
  5108.                 }
  5109.  
  5110.                 // Boxed
  5111.                 if($html.hasClass('boxed') && self.options.stickyEffect == 'shrink') {
  5112.                     if( (parseInt(self.options.stickyStartAt) == 0) && $window.width() > 991) {
  5113.                         self.options.stickyStartAt = 30;
  5114.                     }
  5115.  
  5116.                     // Set Header Body Position Absolute
  5117.                     self.options.headerBody.css('position','absolute');
  5118.  
  5119.                     // Set position absolute because top margin from boxed layout
  5120.                     $window.on('scroll', function(){
  5121.                         if( $window.scrollTop() > $('.body').offset().top ) {
  5122.                             self.options.headerBody.css({
  5123.                                 'position' : 'fixed',
  5124.                                 'top' : 0
  5125.                             });                            
  5126.                         } else {
  5127.                             self.options.headerBody.css({
  5128.                                 'position' : 'absolute',
  5129.                                 'top' : 0
  5130.                             });
  5131.                         }
  5132.                     });
  5133.                 }
  5134.  
  5135.                 // Check Sticky Header / Flags prevent multiple runs at same time
  5136.                 var activate_flag   = true,
  5137.                     deactivate_flag = false;
  5138.  
  5139.                 self.checkStickyHeader = function() {
  5140.                     if( $window.width() > 991 && $html.hasClass('side-header') ) {
  5141.                         $html.removeClass('sticky-header-active');
  5142.                         activate_flag = true;
  5143.                         return;
  5144.                     }
  5145.  
  5146.                     if ($window.scrollTop() >= parseInt(self.options.stickyStartAt)) {
  5147.                         if( activate_flag ) {
  5148.                             self.activateStickyHeader();
  5149.                             activate_flag = false;
  5150.                             deactivate_flag = true;
  5151.                         }
  5152.                     } else {
  5153.                         if( deactivate_flag ) {
  5154.                             self.deactivateStickyHeader();
  5155.                             deactivate_flag = false;
  5156.                             activate_flag = true;
  5157.                         }
  5158.                     }
  5159.                 };
  5160.                
  5161.                 // Activate Sticky Header
  5162.                 self.activateStickyHeader = function() {
  5163.  
  5164.                     if ($window.width() < 992) {
  5165.                         if (!self.options.stickyEnableOnMobile) {
  5166.                             self.deactivateStickyHeader();
  5167.                             return;
  5168.                         }
  5169.                     } else {
  5170.                         if (sideHeader) {
  5171.                             self.deactivateStickyHeader();
  5172.                             return;
  5173.                         }
  5174.                     }
  5175.  
  5176.                     $html.addClass('sticky-header-active');
  5177.  
  5178.                     // Sticky Effect - Reveal
  5179.                     if( self.options.stickyEffect == 'reveal' ) {
  5180.  
  5181.                         self.options.headerBody.css('top','-' + self.options.stickyStartAt + 'px');
  5182.  
  5183.                         self.options.headerBody.animate({
  5184.                             top: self.options.stickySetTop
  5185.                         }, 400, function() {});
  5186.  
  5187.                     }
  5188.  
  5189.                     // Sticky Effect - Shrink
  5190.                     if( self.options.stickyEffect == 'shrink' ) {
  5191.  
  5192.                         // If Header Top
  5193.                         if( self.options.wrapper.find('.header-top').get(0) ) {
  5194.                             self.options.wrapper.find('.header-top').css({
  5195.                                 height: 0,
  5196.                                 'min-height': 0,
  5197.                                 overflow: 'hidden'
  5198.                             });
  5199.                         }
  5200.  
  5201.                         // Header Container
  5202.                         if( self.options.stickyHeaderContainerHeight ) {
  5203.                             self.options.wrapper.find('.header-container').css({
  5204.                                 height: self.options.stickyHeaderContainerHeight,
  5205.                                 'min-height': 0
  5206.                             });
  5207.                         } else {
  5208.                             self.options.wrapper.find('.header-container').css({
  5209.                                 height: (initialHeaderContainerHeight / 3) * 2, // two third of container height
  5210.                                 'min-height': 0
  5211.                             });
  5212.  
  5213.                             var y = initialHeaderContainerHeight - ((initialHeaderContainerHeight / 3) * 2);
  5214.                             $('.main').css({
  5215.                                 transform: 'translate3d(0, -'+ y +'px, 0)',
  5216.                                 transition: 'ease transform 300ms'
  5217.                             });
  5218.  
  5219.                             if($html.hasClass('boxed')) {
  5220.                                 self.options.headerBody.css('position','fixed');
  5221.                             }
  5222.                         }
  5223.  
  5224.                     }
  5225.  
  5226.                     self.options.headerBody.css('top', self.options.stickySetTop);
  5227.  
  5228.                     if (self.options.stickyChangeLogo) {
  5229.                         self.changeLogo(true);
  5230.                     }
  5231.  
  5232.                     // Set Elements Style
  5233.                     $('[data-sticky-header-style]').each(function() {
  5234.                         var $el = $(this),
  5235.                             css = theme.fn.getOptions($el.data('sticky-header-style-active')),
  5236.                             opts = theme.fn.getOptions($el.data('sticky-header-style'));
  5237.  
  5238.                         if( $window.width() > opts.minResolution ) {
  5239.                             $el.css(css);
  5240.                         }
  5241.                     });
  5242.  
  5243.                     $.event.trigger({
  5244.                         type: 'stickyHeader.activate'
  5245.                     });
  5246.                 };
  5247.  
  5248.                 // Deactivate Sticky Header
  5249.                 self.deactivateStickyHeader = function() {
  5250.  
  5251.                     $html.removeClass('sticky-header-active');
  5252.  
  5253.                     // Sticky Effect - Shrink
  5254.                     if( self.options.stickyEffect == 'shrink' ) {
  5255.  
  5256.                         // Boxed Layout
  5257.                         if( $html.hasClass('boxed') ) {
  5258.  
  5259.                             // Set Header Body Position Absolute
  5260.                             self.options.headerBody.css('position','absolute');
  5261.  
  5262.                             if( $window.scrollTop() > $('.body').offset().top ) {
  5263.                                 // Set Header Body Position Fixed
  5264.                                 self.options.headerBody.css('position','fixed');                               
  5265.                             }
  5266.  
  5267.                         } else {
  5268.                             // Set Header Body Position Fixed
  5269.                             self.options.headerBody.css('position','fixed');
  5270.                         }
  5271.  
  5272.                         // If Header Top
  5273.                         if( self.options.wrapper.find('.header-top').get(0) ) {
  5274.                             self.options.wrapper.find('.header-top').css({
  5275.                                 height: initialHeaderTopHeight,
  5276.                                 overflow: 'visible'
  5277.                             });
  5278.                         }
  5279.  
  5280.                         // Header Container
  5281.                         self.options.wrapper.find('.header-container').css({
  5282.                             height: initialHeaderContainerHeight
  5283.                         });
  5284.  
  5285.                     }
  5286.  
  5287.                     self.options.headerBody.css('top', 0);
  5288.  
  5289.                     if (self.options.stickyChangeLogo) {
  5290.                         self.changeLogo(false);
  5291.                     }
  5292.  
  5293.                     // Set Elements Style
  5294.                     $('[data-sticky-header-style]').each(function() {
  5295.                         var $el = $(this),
  5296.                             css = theme.fn.getOptions($el.data('sticky-header-style-deactive')),
  5297.                             opts = theme.fn.getOptions($el.data('sticky-header-style'));
  5298.  
  5299.                         if( $window.width() > opts.minResolution ) {
  5300.                             $el.css(css);
  5301.                         }
  5302.                     });
  5303.  
  5304.                     $.event.trigger({
  5305.                         type: 'stickyHeader.deactivate'
  5306.                     });
  5307.                 };
  5308.  
  5309.                 // Always Sticky
  5310.                 if (parseInt(self.options.stickyStartAt) <= 0) {
  5311.                     self.activateStickyHeader();
  5312.                 }
  5313.  
  5314.                 // Notice Top Bar
  5315.                 if ($('.notice-top-bar').get(0)) {
  5316.                     self.options.stickyStartAt = $('.notice-top-bar').outerHeight();
  5317.                 }
  5318.  
  5319.                 // Set Logo
  5320.                 if (self.options.stickyChangeLogo) {
  5321.  
  5322.                     var $logoWrapper = self.options.wrapper.find('.header-logo'),
  5323.                         $logo = $logoWrapper.find('img'),
  5324.                         logoWidth = $logo.attr('width'),
  5325.                         logoHeight = $logo.attr('height'),
  5326.                         logoSmallTop = parseInt($logo.attr('data-sticky-top') ? $logo.attr('data-sticky-top') : 0),
  5327.                         logoSmallWidth = parseInt($logo.attr('data-sticky-width') ? $logo.attr('data-sticky-width') : 'auto'),
  5328.                         logoSmallHeight = parseInt($logo.attr('data-sticky-height') ? $logo.attr('data-sticky-height') : 'auto');
  5329.  
  5330.                     if (self.options.stickyChangeLogoWrapper) {
  5331.                         $logoWrapper.css({
  5332.                             'width': $logo.outerWidth(true),
  5333.                             'height': $logo.outerHeight(true)
  5334.                         });
  5335.                     }
  5336.  
  5337.                     self.changeLogo = function(activate) {
  5338.                         if(activate) {
  5339.                            
  5340.                             $logo.css({
  5341.                                 'top': logoSmallTop,
  5342.                                 'width': logoSmallWidth,
  5343.                                 'height': logoSmallHeight
  5344.                             });
  5345.  
  5346.                         } else {
  5347.                            
  5348.                             $logo.css({
  5349.                                 'top': 0,
  5350.                                 'width': logoWidth,
  5351.                                 'height': logoHeight
  5352.                             });
  5353.  
  5354.                         }
  5355.                     }
  5356.  
  5357.                     $.event.trigger({
  5358.                         type: 'stickyChangeLogo.loaded'
  5359.                     });
  5360.  
  5361.                 }
  5362.  
  5363.                 // Side Header
  5364.                 var headerBodyHeight,
  5365.                     flag = false;
  5366.  
  5367.                 self.checkSideHeader = function() {
  5368.                     if($window.width() < 992 && flag == false) {
  5369.                         headerBodyHeight = self.options.headerBody.height();
  5370.                         flag = true;
  5371.                     }
  5372.  
  5373.                     if(self.options.stickyStartAt == 0 && sideHeader) {
  5374.                         self.options.wrapper.css('min-height', 0);
  5375.                     }
  5376.  
  5377.                     if(self.options.stickyStartAt > 0 && sideHeader && $window.width() < 992) {
  5378.                         self.options.wrapper.css('min-height', headerBodyHeight);
  5379.                     }
  5380.                 }
  5381.  
  5382.                 return this;
  5383.             },
  5384.  
  5385.             events: function() {
  5386.                 var self = this;
  5387.  
  5388.                 if (!this.options.stickyEnableOnBoxed && $('body').hasClass('boxed') || $('html').hasClass('side-header-hamburguer-sidebar') || !this.options.stickyEnabled) {
  5389.                     return this;
  5390.                 }
  5391.  
  5392.                 if (!self.options.alwaysStickyEnabled) {
  5393.                     $(window).on('scroll resize', function() {
  5394.                         self.checkStickyHeader();
  5395.                     });
  5396.                 } else {
  5397.                     self.activateStickyHeader();
  5398.                 }
  5399.  
  5400.                 $(window).on('load resize', function(){
  5401.                     self.checkSideHeader();
  5402.                 });
  5403.  
  5404.                 return this;
  5405.             }
  5406.  
  5407.         }
  5408.  
  5409.     });
  5410.  
  5411. }).apply(this, [window.theme, jQuery]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement