· 4 years ago · Mar 22, 2021, 04:18 PM
1/*
2Name: Theme Base
3Written by: Okler Themes - (http://www.okler.net)
4Theme Version: 8.3.0
5*/
6
7// Theme
8window.theme = {};
9
10// Theme Common Functions
11window.theme.fn = {
12
13 getOptions: function(opts) {
14
15 if (typeof(opts) == 'object') {
16
17 return opts;
18
19 } else if (typeof(opts) == 'string') {
20
21 try {
22 return JSON.parse(opts.replace(/'/g,'"').replace(';',''));
23 } catch(e) {
24 return {};
25 }
26
27 } else {
28
29 return {};
30
31 }
32
33 },
34
35 execPluginFunction: function( functionName, context ) {
36 var args = Array.prototype.slice.call(arguments, 2);
37 var namespaces = functionName.split(".");
38 var func = namespaces.pop();
39
40 for(var i = 0; i < namespaces.length; i++) {
41 context = context[namespaces[i]];
42 }
43
44 return context[func].apply(context, args);
45 },
46
47 intObs: function(selector, functionName, intObsOptions, alwaysObserve) {
48 var $el = document.querySelectorAll( selector );
49 var intersectionObserverOptions = {
50 rootMargin: '0px 0px 200px 0px'
51 }
52
53 if( intObsOptions.length ) {
54 $.extend(intersectionObserverOptions, intObsOptions);
55 }
56
57 var observer = new IntersectionObserver(function(entries) {
58 for(var i=0; i < entries.length; i++) {
59 var entry = entries[i];
60
61 if (entry.intersectionRatio > 0 ) {
62 if( typeof functionName === 'string' ) {
63 var func = Function( 'return ' + functionName )();
64 } else {
65 var callback = functionName;
66
67 callback.call( $(entry.target) );
68 }
69
70 // Unobserve
71 if( !alwaysObserve ) {
72 observer.unobserve(entry.target);
73 }
74
75 }
76 }
77 }, intersectionObserverOptions);
78
79 $( $el ).each(function(){
80 observer.observe( $(this)[0] );
81 });
82 },
83
84 intObsInit: function(selector, functionName) {
85 var $el = document.querySelectorAll( selector );
86 var intersectionObserverOptions = {
87 rootMargin: '200px'
88 }
89
90 var observer = new IntersectionObserver(function(entries) {
91 for(var i=0; i < entries.length; i++) {
92 var entry = entries[i];
93 if (entry.intersectionRatio > 0) {
94
95 var $this = $(entry.target),
96 opts;
97
98 var pluginOptions = theme.fn.getOptions($this.data('plugin-options'));
99 if (pluginOptions)
100 opts = pluginOptions;
101
102 theme.fn.execPluginFunction(functionName, $this, opts);
103
104 // Unobserve
105 observer.unobserve(entry.target);
106 }
107 }
108 }, intersectionObserverOptions);
109
110 $( $el ).each(function(){
111 observer.observe( $(this)[0] );
112 });
113 },
114
115 dynIntObsInit: function(selector, functionName, pluginDefaults) {
116 var $el = document.querySelectorAll( selector );
117
118 $( $el ).each(function(){
119 var $this = $(this),
120 opts;
121
122 var pluginOptions = theme.fn.getOptions($this.data('plugin-options'));
123 if (pluginOptions)
124 opts = pluginOptions;
125
126 var mergedPluginDefaults = theme.fn.mergeOptions( pluginDefaults, opts )
127
128 var intersectionObserverOptions = {
129 rootMargin: theme.fn.getRootMargin( functionName, mergedPluginDefaults ),
130 threshold: 0
131 }
132
133 var observer = new IntersectionObserver(function(entries) {
134 for(var i=0; i < entries.length; i++) {
135 var entry = entries[i];
136
137 if (entry.intersectionRatio > 0) {
138 theme.fn.execPluginFunction(functionName, $this, mergedPluginDefaults);
139
140 // Unobserve
141 observer.unobserve(entry.target);
142 }
143 }
144 }, intersectionObserverOptions);
145
146 observer.observe( $this[0] );
147 });
148 },
149
150 getRootMargin: function(plugin, pluginDefaults) {
151 switch ( plugin ) {
152 case 'themePluginCounter':
153 return pluginDefaults.accY ? '0px 0px ' + pluginDefaults.accY + 'px 0px' : '0px 0px 200px 0px';
154 break;
155
156 case 'themePluginAnimate':
157 return pluginDefaults.accY ? '0px 0px ' + pluginDefaults.accY + 'px 0px' : '0px 0px 200px 0px';
158 break;
159
160 default:
161 return '0px 0px 200px 0px';
162 break;
163 }
164 },
165
166 mergeOptions: function(obj1, obj2){
167 var obj3 = {};
168
169 for (var attrname in obj1) { obj3[attrname] = obj1[attrname]; }
170 for (var attrname in obj2) { obj3[attrname] = obj2[attrname]; }
171
172 return obj3;
173 },
174
175 execOnceTroughEvent: function( $el, event, callback ) {
176 var self = this,
177 dataName = self.formatDataName( event );
178
179 $($el).on(event, function(){
180 if(!$(this).data(dataName) ) {
181
182 // Exec Callback Function
183 callback.call($(this));
184
185 // Add data name
186 $(this).data( dataName, true );
187
188 // Unbind event
189 $(this).off( event );
190 }
191 });
192
193 return this;
194 },
195
196 execOnceTroughWindowEvent: function( $el, event, callback ) {
197 var self = this,
198 dataName = self.formatDataName( event );
199
200 $($el).on(event, function(){
201 if(!$(this).data(dataName) ) {
202
203 // Exec Callback Function
204 callback();
205
206 // Add data name
207 $(this).data( dataName, true );
208
209 // Unbind event
210 $(this).off( event );
211 }
212 });
213
214 return this;
215 },
216
217 formatDataName: function( name ) {
218 name = name.replace('.', '');
219 return name;
220 },
221
222 isElementInView: function( $el ) {
223 var rect = $el[0].getBoundingClientRect();
224
225 return (
226 rect.top <= ( window.innerHeight / 3 )
227 );
228 }
229
230};
231
232/**
233 * Copyright 2016 Google Inc. All Rights Reserved.
234 *
235 * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.
236 *
237 * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
238 *
239 */
240!function(){"use strict";if("object"==typeof window)if("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype)"isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get:function(){return this.intersectionRatio>0}});else{var t=function(t){for(var e=window.document,o=i(e);o;)o=i(e=o.ownerDocument);return e}(),e=[],o=null,n=null;s.prototype.THROTTLE_TIMEOUT=100,s.prototype.POLL_INTERVAL=null,s.prototype.USE_MUTATION_OBSERVER=!0,s._setupCrossOriginUpdater=function(){return o||(o=function(t,o){n=t&&o?l(t,o):{top:0,bottom:0,left:0,right:0,width:0,height:0},e.forEach(function(t){t._checkForIntersections()})}),o},s._resetCrossOriginUpdater=function(){o=null,n=null},s.prototype.observe=function(t){if(!this._observationTargets.some(function(e){return e.element==t})){if(!t||1!=t.nodeType)throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:t,entry:null}),this._monitorIntersections(t.ownerDocument),this._checkForIntersections()}},s.prototype.unobserve=function(t){this._observationTargets=this._observationTargets.filter(function(e){return e.element!=t}),this._unmonitorIntersections(t.ownerDocument),0==this._observationTargets.length&&this._unregisterInstance()},s.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorAllIntersections(),this._unregisterInstance()},s.prototype.takeRecords=function(){var t=this._queuedEntries.slice();return this._queuedEntries=[],t},s.prototype._initThresholds=function(t){var e=t||[0];return Array.isArray(e)||(e=[e]),e.sort().filter(function(t,e,o){if("number"!=typeof t||isNaN(t)||t<0||t>1)throw new Error("threshold must be a number between 0 and 1 inclusively");return t!==o[e-1]})},s.prototype._parseRootMargin=function(t){var e=(t||"0px").split(/\s+/).map(function(t){var e=/^(-?\d*\.?\d+)(px|%)$/.exec(t);if(!e)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(e[1]),unit:e[2]}});return e[1]=e[1]||e[0],e[2]=e[2]||e[0],e[3]=e[3]||e[1],e},s.prototype._monitorIntersections=function(e){var o=e.defaultView;if(o&&-1==this._monitoringDocuments.indexOf(e)){var n=this._checkForIntersections,r=null,s=null;this.POLL_INTERVAL?r=o.setInterval(n,this.POLL_INTERVAL):(h(o,"resize",n,!0),h(e,"scroll",n,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in o&&(s=new o.MutationObserver(n)).observe(e,{attributes:!0,childList:!0,characterData:!0,subtree:!0})),this._monitoringDocuments.push(e),this._monitoringUnsubscribes.push(function(){var t=e.defaultView;t&&(r&&t.clearInterval(r),c(t,"resize",n,!0)),c(e,"scroll",n,!0),s&&s.disconnect()});var u=this.root&&(this.root.ownerDocument||this.root)||t;if(e!=u){var a=i(e);a&&this._monitorIntersections(a.ownerDocument)}}},s.prototype._unmonitorIntersections=function(e){var o=this._monitoringDocuments.indexOf(e);if(-1!=o){var n=this.root&&(this.root.ownerDocument||this.root)||t;if(!this._observationTargets.some(function(t){var o=t.element.ownerDocument;if(o==e)return!0;for(;o&&o!=n;){var r=i(o);if((o=r&&r.ownerDocument)==e)return!0}return!1})){var r=this._monitoringUnsubscribes[o];if(this._monitoringDocuments.splice(o,1),this._monitoringUnsubscribes.splice(o,1),r(),e!=n){var s=i(e);s&&this._unmonitorIntersections(s.ownerDocument)}}}},s.prototype._unmonitorAllIntersections=function(){var t=this._monitoringUnsubscribes.slice(0);this._monitoringDocuments.length=0,this._monitoringUnsubscribes.length=0;for(var e=0;e<t.length;e++)t[e]()},s.prototype._checkForIntersections=function(){if(this.root||!o||n){var t=this._rootIsInDom(),e=t?this._getRootRect():{top:0,bottom:0,left:0,right:0,width:0,height:0};this._observationTargets.forEach(function(n){var i=n.element,s=u(i),h=this._rootContainsTarget(i),c=n.entry,a=t&&h&&this._computeTargetAndRootIntersection(i,s,e),l=null;this._rootContainsTarget(i)?o&&!this.root||(l=e):l={top:0,bottom:0,left:0,right:0,width:0,height:0};var f=n.entry=new r({time:window.performance&&performance.now&&performance.now(),target:i,boundingClientRect:s,rootBounds:l,intersectionRect:a});c?t&&h?this._hasCrossedThreshold(c,f)&&this._queuedEntries.push(f):c&&c.isIntersecting&&this._queuedEntries.push(f):this._queuedEntries.push(f)},this),this._queuedEntries.length&&this._callback(this.takeRecords(),this)}},s.prototype._computeTargetAndRootIntersection=function(e,i,r){if("none"!=window.getComputedStyle(e).display){for(var s,h,c,a,f,d,g,m,v=i,_=p(e),b=!1;!b&&_;){var w=null,y=1==_.nodeType?window.getComputedStyle(_):{};if("none"==y.display)return null;if(_==this.root||9==_.nodeType)if(b=!0,_==this.root||_==t)o&&!this.root?!n||0==n.width&&0==n.height?(_=null,w=null,v=null):w=n:w=r;else{var I=p(_),E=I&&u(I),T=I&&this._computeTargetAndRootIntersection(I,E,r);E&&T?(_=I,w=l(E,T)):(_=null,v=null)}else{var R=_.ownerDocument;_!=R.body&&_!=R.documentElement&&"visible"!=y.overflow&&(w=u(_))}if(w&&(s=w,h=v,c=void 0,a=void 0,f=void 0,d=void 0,g=void 0,m=void 0,c=Math.max(s.top,h.top),a=Math.min(s.bottom,h.bottom),f=Math.max(s.left,h.left),d=Math.min(s.right,h.right),m=a-c,v=(g=d-f)>=0&&m>=0&&{top:c,bottom:a,left:f,right:d,width:g,height:m}||null),!v)break;_=_&&p(_)}return v}},s.prototype._getRootRect=function(){var e;if(this.root&&!d(this.root))e=u(this.root);else{var o=d(this.root)?this.root:t,n=o.documentElement,i=o.body;e={top:0,left:0,right:n.clientWidth||i.clientWidth,width:n.clientWidth||i.clientWidth,bottom:n.clientHeight||i.clientHeight,height:n.clientHeight||i.clientHeight}}return this._expandRectByRootMargin(e)},s.prototype._expandRectByRootMargin=function(t){var e=this._rootMarginValues.map(function(e,o){return"px"==e.unit?e.value:e.value*(o%2?t.width:t.height)/100}),o={top:t.top-e[0],right:t.right+e[1],bottom:t.bottom+e[2],left:t.left-e[3]};return o.width=o.right-o.left,o.height=o.bottom-o.top,o},s.prototype._hasCrossedThreshold=function(t,e){var o=t&&t.isIntersecting?t.intersectionRatio||0:-1,n=e.isIntersecting?e.intersectionRatio||0:-1;if(o!==n)for(var i=0;i<this.thresholds.length;i++){var r=this.thresholds[i];if(r==o||r==n||r<o!=r<n)return!0}},s.prototype._rootIsInDom=function(){return!this.root||f(t,this.root)},s.prototype._rootContainsTarget=function(e){var o=this.root&&(this.root.ownerDocument||this.root)||t;return f(o,e)&&(!this.root||o==e.ownerDocument)},s.prototype._registerInstance=function(){e.indexOf(this)<0&&e.push(this)},s.prototype._unregisterInstance=function(){var t=e.indexOf(this);-1!=t&&e.splice(t,1)},window.IntersectionObserver=s,window.IntersectionObserverEntry=r}function i(t){try{return t.defaultView&&t.defaultView.frameElement||null}catch(t){return null}}function r(t){this.time=t.time,this.target=t.target,this.rootBounds=a(t.rootBounds),this.boundingClientRect=a(t.boundingClientRect),this.intersectionRect=a(t.intersectionRect||{top:0,bottom:0,left:0,right:0,width:0,height:0}),this.isIntersecting=!!t.intersectionRect;var e=this.boundingClientRect,o=e.width*e.height,n=this.intersectionRect,i=n.width*n.height;this.intersectionRatio=o?Number((i/o).toFixed(4)):this.isIntersecting?1:0}function s(t,e){var o,n,i,r=e||{};if("function"!=typeof t)throw new Error("callback must be a function");if(r.root&&1!=r.root.nodeType&&9!=r.root.nodeType)throw new Error("root must be a Document or Element");this._checkForIntersections=(o=this._checkForIntersections.bind(this),n=this.THROTTLE_TIMEOUT,i=null,function(){i||(i=setTimeout(function(){o(),i=null},n))}),this._callback=t,this._observationTargets=[],this._queuedEntries=[],this._rootMarginValues=this._parseRootMargin(r.rootMargin),this.thresholds=this._initThresholds(r.threshold),this.root=r.root||null,this.rootMargin=this._rootMarginValues.map(function(t){return t.value+t.unit}).join(" "),this._monitoringDocuments=[],this._monitoringUnsubscribes=[]}function h(t,e,o,n){"function"==typeof t.addEventListener?t.addEventListener(e,o,n||!1):"function"==typeof t.attachEvent&&t.attachEvent("on"+e,o)}function c(t,e,o,n){"function"==typeof t.removeEventListener?t.removeEventListener(e,o,n||!1):"function"==typeof t.detatchEvent&&t.detatchEvent("on"+e,o)}function u(t){var e;try{e=t.getBoundingClientRect()}catch(t){}return e?(e.width&&e.height||(e={top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.right-e.left,height:e.bottom-e.top}),e):{top:0,bottom:0,left:0,right:0,width:0,height:0}}function a(t){return!t||"x"in t?t:{top:t.top,y:t.top,bottom:t.bottom,left:t.left,x:t.left,right:t.right,width:t.width,height:t.height}}function l(t,e){var o=e.top-t.top,n=e.left-t.left;return{top:o,left:n,height:e.height,width:e.width,bottom:o+e.height,right:n+e.width}}function f(t,e){for(var o=e;o;){if(o==t)return!0;o=p(o)}return!1}function p(e){var o=e.parentNode;return 9==e.nodeType&&e!=t?i(e):(o&&o.assignedSlot&&(o=o.assignedSlot.parentNode),o&&11==o.nodeType&&o.host?o.host:o)}function d(t){return t&&9===t.nodeType}}();
241
242/*
243Plugin Name: BrowserSelector
244Written by: Okler Themes - (http://www.okler.net)
245Theme Version: 8.0.0
246*/
247
248(function($) {
249 $.extend({
250
251 browserSelector: function() {
252
253 // jQuery.browser.mobile (http://detectmobilebrowser.com/)
254 (function(a){(jQuery.browser=jQuery.browser||{}).mobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))})(navigator.userAgent||navigator.vendor||window.opera);
255
256 // Touch
257 var hasTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints;
258
259 var u = navigator.userAgent,
260 ua = u.toLowerCase(),
261 is = function (t) {
262 return ua.indexOf(t) > -1;
263 },
264 g = 'gecko',
265 w = 'webkit',
266 s = 'safari',
267 o = 'opera',
268 h = document.documentElement,
269 b = [(!(/opera|webtv/i.test(ua)) && /msie\s(\d)/.test(ua)) ? ('ie ie' + parseFloat(navigator.appVersion.split("MSIE")[1])) : is('firefox/2') ? g + ' ff2' : is('firefox/3.5') ? g + ' ff3 ff3_5' : is('firefox/3') ? g + ' ff3' : is('gecko/') ? g : is('opera') ? o + (/version\/(\d+)/.test(ua) ? ' ' + o + RegExp.jQuery1 : (/opera(\s|\/)(\d+)/.test(ua) ? ' ' + o + RegExp.jQuery2 : '')) : is('konqueror') ? 'konqueror' : is('chrome') ? w + ' chrome' : is('iron') ? w + ' iron' : is('applewebkit/') ? w + ' ' + s + (/version\/(\d+)/.test(ua) ? ' ' + s + RegExp.jQuery1 : '') : is('mozilla/') ? g : '', is('j2me') ? 'mobile' : is('iphone') ? 'iphone' : is('ipod') ? 'ipod' : is('mac') ? 'mac' : is('darwin') ? 'mac' : is('webtv') ? 'webtv' : is('win') ? 'win' : is('freebsd') ? 'freebsd' : (is('x11') || is('linux')) ? 'linux' : '', 'js'];
270
271 c = b.join(' ');
272
273 if ($.browser.mobile) {
274 c += ' mobile';
275 }
276
277 if (hasTouch) {
278 c += ' touch';
279 }
280
281 h.className += ' ' + c;
282
283 // Edge Detect
284 var isEdge = /Edge/.test(navigator.userAgent);
285
286 if(isEdge) {
287 $('html').removeClass('chrome').addClass('edge');
288 }
289
290 // IE11 Detect
291 var isIE11 = !(window.ActiveXObject) && "ActiveXObject" in window;
292
293 if (isIE11) {
294 $('html').removeClass('gecko').addClass('ie ie11');
295 return;
296 }
297
298 // Dark and Boxed Compatibility
299 if($('body').hasClass('dark')) {
300 $('html').addClass('dark');
301 }
302
303 if($('body').hasClass('boxed')) {
304 $('html').addClass('boxed');
305 }
306
307 }
308
309 });
310
311 $.browserSelector();
312
313 /*
314 Global Variable For Screen Size
315 */
316 theme.globalWindowWidth = $(window).width();
317 var globalWindowWidth = $(window).width();
318 window.onresize = function() {
319 theme.globalWindowWidth = $(window).width();
320 }
321
322 /*
323 Browser Workarounds
324 */
325 if (/iPad|iPhone|iPod/.test(navigator.platform)) {
326
327 // iPad/Iphone/iPod Hover Workaround
328 $(document).ready(function($) {
329 $('.thumb-info').attr('onclick', 'return true');
330 });
331 }
332
333 /*
334 Tooltip and Popover
335 */
336 if( $('[data-toggle="tooltip"]').length ) {
337 $('[data-toggle="tooltip"]').tooltip();
338 }
339 if( $('[data-toggle="popover"]').length ) {
340 $('[data-toggle="popover"]').popover();
341 }
342
343 /*
344 Tabs
345 */
346 if( $('a[data-toggle="tab"]').length ) {
347 $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
348 $(this).parents('.nav-tabs').find('.active').removeClass('active');
349 $(this).addClass('active').parent().addClass('active');
350 });
351 }
352
353 if( window.location.hash ) {
354 $(window).on('load', function(){
355 if( $( window.location.hash ).get(0) ) {
356 $('a.nav-link[href="'+ window.location.hash +'"]:not([data-hash])').trigger('click');
357 }
358 });
359 }
360
361 /*
362 On Load Scroll
363 */
364 if( !$('html').hasClass('disable-onload-scroll') && window.location.hash && !['#*'].includes( window.location.hash ) ) {
365
366 window.scrollTo(0, 0);
367
368 $(window).on('load', function() {
369 setTimeout(function() {
370
371 var target = window.location.hash,
372 offset = ( $(window).width() < 768 ) ? 180 : 90;
373
374 if (!$(target).length) {
375 return;
376 }
377
378 if ( $("a[href$='" + window.location.hash + "']").is('[data-hash-offset]') ) {
379 offset = parseInt( $("a[href$='" + window.location.hash + "']").first().attr('data-hash-offset') );
380 } else if ( $("html").is('[data-hash-offset]') ) {
381 offset = parseInt( $("html").attr('data-hash-offset') );
382 }
383
384 $('body').addClass('scrolling');
385
386 $('html, body').animate({
387 scrollTop: $(target).offset().top - offset
388 }, 600, 'easeOutQuad', function() {
389 $('body').removeClass('scrolling');
390 });
391
392 }, 1);
393 });
394 }
395
396 /*
397 * Text Rotator
398 */
399 $.fn.extend({
400 textRotator: function(options) {
401
402 var defaults = {
403 fadeSpeed: 500,
404 pauseSpeed: 100,
405 child: null
406 };
407
408 var options = $.extend(defaults, options);
409
410 return this.each(function() {
411 var o = options;
412 var obj = $(this);
413 var items = $(obj.children(), obj);
414 items.each(function() {
415 $(this).hide();
416 })
417 if (!o.child) {
418 var next = $(obj).children(':first');
419 } else {
420 var next = o.child;
421 }
422 $(next).fadeIn(o.fadeSpeed, function() {
423 $(next).delay(o.pauseSpeed).fadeOut(o.fadeSpeed, function() {
424 var next = $(this).next();
425 if (next.length == 0) {
426 next = $(obj).children(':first');
427 }
428 $(obj).textRotator({
429 child: next,
430 fadeSpeed: o.fadeSpeed,
431 pauseSpeed: o.pauseSpeed
432 });
433 })
434 });
435 });
436 }
437 });
438
439 /*
440 * Notice Top bar
441 */
442 var $noticeTopBar = {
443 $wrapper: $('.notice-top-bar'),
444 $closeBtn: $('.notice-top-bar-close'),
445 $header: $('#header'),
446 $body: $('.body'),
447 init: function() {
448 var self = this;
449
450 if( !$.cookie('portoNoticeTopBarClose') ) {
451 self
452 .build()
453 .events();
454 } else {
455 self.$wrapper.parent().prepend( '<!-- Notice Top Bar removed by cookie -->' );
456 self.$wrapper.remove();
457 }
458
459 return this;
460 },
461 build: function(){
462 var self = this;
463
464 $(window).on('load', function(){
465 setTimeout(function(){
466 self.$body.css({
467 'margin-top': self.$wrapper.outerHeight(),
468 'transition': 'ease margin 300ms'
469 });
470
471 $('#noticeTopBarContent').textRotator({
472 fadeSpeed: 500,
473 pauseSpeed: 5000
474 });
475
476 if( ['absolute', 'fixed'].includes( self.$header.css('position') ) ) {
477 self.$header.css({
478 'top': self.$wrapper.outerHeight(),
479 'transition': 'ease top 300ms'
480 });
481 }
482
483 $(window).trigger('notice.top.bar.opened');
484
485 }, 1000);
486 });
487
488 return this;
489 },
490 events: function() {
491 var self = this;
492
493 self.$closeBtn.on('click', function(e){
494 e.preventDefault();
495
496 self.$body.animate({
497 'margin-top': 0,
498 }, 300, function(){
499 self.$wrapper.remove();
500 self.saveCookie();
501 });
502
503 if( ['absolute', 'fixed'].includes( self.$header.css('position') ) ) {
504 self.$header.animate({
505 top: 0
506 }, 300);
507 }
508
509 // When header has shrink effect
510 if( self.$header.hasClass('header-effect-shrink') ) {
511 self.$header.find('.header-body').animate({
512 top: 0
513 }, 300);
514 }
515
516 $(window).trigger('notice.top.bar.closed');
517 });
518
519 return this;
520 },
521 checkCookie: function(){
522 var self = this;
523
524 if( $.cookie('portoNoticeTopBarClose') ) {
525 return true;
526 } else {
527 return false;
528 }
529
530 return this;
531 },
532 saveCookie: function() {
533 var self = this;
534
535 $.cookie('portoNoticeTopBarClose', true);
536
537 return this;
538 }
539 }
540
541 if( $('.notice-top-bar').length ) {
542 $noticeTopBar.init();
543 }
544
545 /*
546 * Theme Switcher
547 */
548 if( $('.close-theme-switcher-bar').length ) {
549 $('.close-theme-switcher-bar').on('click', function(){
550 $(this).closest('.header-top').css({
551 height: 0,
552 'min-height': 0,
553 overflow: 'hidden'
554 })
555 });
556 }
557
558 /*
559 * Recommended Themes
560 */
561 if($('.recommend-themes').length && $('#demos').length) {
562 $(window).on('scroll', function(e) {
563 if ($(window).scrollTop() + 1 >= $('#demos').offset().top) {
564 $('.recommend-themes').addClass('active');
565 } else {
566 $('.recommend-themes').removeClass('active');
567 }
568 });
569 }
570
571 /*
572 * Tab
573 */
574 if( $('a[data-toggle="tab"]').length ) {
575 $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
576 var $tabPane = $($(e.target).attr('href'));
577
578 if($tabPane.length) {
579
580 // Carousel Refresh
581 $tabPane.find('.owl-carousel').trigger('refresh.owl.carousel');
582 }
583 });
584 }
585
586 /*
587 * Image Hotspots
588 */
589 if( $('.image-hotspot').length ) {
590 $('.image-hotspot')
591 .append('<span class="ring"></span>')
592 .append('<span class="circle"></span>');
593 }
594
595 /*
596 * Page Transition
597 */
598 if( $('body[data-plugin-page-transition]').length ) {
599
600 var link_click = false;
601
602 $(document).on('click', 'a', function(e){
603 link_click = $(this);
604 });
605
606 $(window).on("beforeunload", function(e) {
607 if( typeof link_click === 'object' ) {
608 var href = link_click.attr('href');
609
610 if( href.indexOf('mailto:') != 0 && href.indexOf('tel:') != 0 && !link_click.data('rm-from-transition') ) {
611 $('body').addClass('page-transition-active');
612 }
613 }
614 });
615
616 $(window).on("pageshow", function(e){
617 if( e.persisted ) {
618 if( $('html').hasClass('safari') ) {
619 window.location.reload();
620 }
621
622 $('body').removeClass('page-transition-active');
623 }
624 });
625 }
626
627 /*
628 * Thumb Info Floating Caption
629 */
630 if( $('.thumb-info-floating-caption').length ) {
631
632 $('.thumb-info-floating-caption').on('mouseenter', function(){
633 if( !$('.thumb-info-floating-caption-title').length ) {
634 $('.body').append( '<div class="thumb-info-floating-caption-title">'+ $(this).data('title') +'</div>' );
635
636 if( $(this).data('type') ) {
637 $('.thumb-info-floating-caption-title')
638 .append( '<div class="thumb-info-floating-caption-type">'+ $(this).data('type') +'</div>' )
639 .css({
640 'padding-bottom' : 22
641 });
642 }
643
644 if( $(this).hasClass('thumb-info-floating-caption-clean') ) {
645 $('.thumb-info-floating-caption-title').addClass('bg-transparent');
646 }
647 }
648 }).on('mouseout', function(){
649 $('.thumb-info-floating-caption-title').remove();
650 });
651
652 $(document).on('mousemove', function(e){
653 $('.thumb-info-floating-caption-title').css({
654 position: 'fixed',
655 left: e.clientX - 20,
656 top: e.clientY + 20
657 });
658 });
659
660 }
661
662 /*
663 * Toggle Text Click
664 */
665 $('[data-toggle-text-click]').on('click', function () {
666 $(this).text(function(i, text){
667 return text === $(this).attr('data-toggle-text-click') ? $(this).attr('data-toggle-text-click-alt') : $(this).attr('data-toggle-text-click');
668 });
669 });
670
671 /*
672 * Shape Divider Aspect Ratio
673 */
674 if( $('.shape-divider').length ) {
675 aspectRatioSVG();
676 $(window).on('resize', function(){
677 aspectRatioSVG();
678 });
679 }
680
681 /*
682 * Shape Divider Animated
683 */
684 if( $('.shape-divider-horizontal-animation').length ) {
685 theme.fn.intObs('.shape-divider-horizontal-animation', function(){
686 for( var i = 0; i <= 1; i++ ) {
687 var svgClone = $(this).find('svg:nth-child(1)').clone();
688
689 $(this).append( svgClone )
690 }
691
692 $(this).addClass('start');
693 }, {});
694 }
695
696 /*
697 * Toggle Class
698 */
699 $('[data-porto-toggle-class]').on('click', function (e) {
700 e.preventDefault();
701
702 $(this).toggleClass( $(this).data('porto-toggle-class') );
703 });
704
705 /*
706 * Dynamic Height
707 */
708 var $window = $(window);
709 $window.on('resize dynamic.height.resize', function(){
710 $('[data-dynamic-height]').each(function(){
711 var $this = $(this),
712 values = JSON.parse($this.data('dynamic-height').replace(/'/g,'"').replace(';',''))
713
714 // XS
715 if( $window.width() < 576 ) {
716 $this.height( values[4] );
717 }
718
719 // SM
720 if( $window.width() > 575 && $window.width() < 768 ) {
721 $this.height( values[3] );
722 }
723
724 // MD
725 if( $window.width() > 767 && $window.width() < 992 ) {
726 $this.height( values[2] );
727 }
728
729 // LG
730 if( $window.width() > 991 && $window.width() < 1200 ) {
731 $this.height( values[1] );
732 }
733
734 // XS
735 if( $window.width() > 1199 ) {
736 $this.height( values[0] );
737 }
738 });
739 });
740
741 // Mobile First Load
742 if( $window.width() < 992 ) {
743 $window.trigger('dynamic.height.resize');
744 }
745
746 /*
747 * Style Switcher Open Loader Button
748 */
749 if( $('.style-switcher-open-loader').length ) {
750 /*
751 var swTooltip = localStorage.getItem('porto-style-switcher-tooltip');
752 if( !swTooltip ) {
753 setTimeout(function(){
754 $('.style-switcher-open-loader .style-switcher-tooltip').addClass('active');
755
756 setTimeout(function(){
757 $('.style-switcher-open-loader .style-switcher-tooltip').removeClass('active');
758 }, 5000);
759 }, 3000);
760 }
761 */
762
763 $('.style-switcher-open-loader').on('click', function(e){
764 e.preventDefault();
765
766 var $this = $(this);
767
768 // Add Spinner to icon
769 $this.addClass('style-switcher-open-loader-loading');
770
771 var basePath = $(this).data('base-path'),
772 skinSrc = $(this).data('skin-src');
773
774 var script1 = document.createElement("script");
775 script1.src = basePath + "master/style-switcher/style.switcher.localstorage.js";
776
777 var script2 = document.createElement("script");
778 script2.src = basePath + "master/style-switcher/style.switcher.js";
779 script2.id = "styleSwitcherScript";
780 script2.setAttribute('data-base-path', basePath);
781 script2.setAttribute('data-skin-src', skinSrc);
782
783 script2.onload = function() {
784 setTimeout(function(){
785 // Remove spinner from icon
786 $this.removeClass('style-switcher-open-loader-loading');
787
788 // Trigger a click to open the style switcher sidebar
789 $('.style-switcher-open').trigger('click');
790 }, 1000);
791 }
792
793 setTimeout(function(){
794 document.body.appendChild(script1);
795 document.body.appendChild(script2);
796 }, 500);
797
798 $('.style-switcher-open-loader .style-switcher-tooltip').removeClass('active');
799
800 /*
801 localStorage.setItem('porto-style-switcher-tooltip', true);
802 */
803 });
804 }
805
806 /* Video - Trigger Play */
807 if( $('[data-trigger-play-video]').length ) {
808 theme.fn.execOnceTroughEvent( '[data-trigger-play-video]', 'mouseover.trigger.play.video', function(){
809 var $video = $( $(this).data('trigger-play-video') );
810
811 $(this).on('click', function(e){
812 e.preventDefault();
813
814 if( $(this).data('trigger-play-video-remove') == 'yes' ) {
815 $(this).animate({
816 opacity: 0
817 }, 300, function(){
818 $video[0].play();
819
820 $(this).remove();
821 });
822 } else {
823 setTimeout(function(){
824 $video[0].play();
825 },300);
826 }
827 });
828 });
829 }
830
831 /* Video - Custom Auto Play */
832 if( $('video[data-auto-play]').length ) {
833 $(window).on('load', function(){
834 $('video[data-auto-play]').each(function(){
835 var $video = $(this);
836
837 setTimeout(function(){
838 if( $( '#' + $video.attr('id') ).length ) {
839 if( $( '[data-trigger-play-video="#' + $video.attr('id') + '"]' ).data('trigger-play-video-remove') == 'yes' ) {
840 $( '[data-trigger-play-video="#' + $video.attr('id') + '"]' ).animate({
841 opacity: 0
842 }, 300, function(){
843 $video[0].play();
844
845 $( '[data-trigger-play-video="#' + $video.attr('id') + '"]' ).remove();
846 });
847 } else {
848 setTimeout(function(){
849 $video[0].play();
850 },300);
851 }
852 }
853 }, 100);
854
855 });
856 });
857 }
858})(jQuery);
859
860/*
861* Scroll and Focus
862*/
863function scrollAndFocus($this, scrollTarget, focusTarget, scrollOffset, scrollAgain) {
864 (function($) {
865
866 $('body').addClass('scrolling');
867
868 // if it's inside a header menu
869 if( $($this).closest('#mainNav').length ) {
870 $($this).parents('.collapse.show').collapse('hide');
871 }
872
873 $('html, body').animate({
874 scrollTop: $(scrollTarget).offset().top - (scrollOffset ? scrollOffset : 0)
875 }, 300, function() {
876 $('body').removeClass('scrolling');
877
878 setTimeout(function(){
879 $(focusTarget).focus();
880 }, 500);
881
882 if( scrollAgain ) {
883 $('html, body').animate({
884 scrollTop: $(scrollTarget).offset().top - (scrollOffset ? scrollOffset : 0)
885 });
886 }
887 });
888 })(jQuery);
889}
890
891/*
892* Shape Divider - SVG Aspect Ratio
893*/
894function aspectRatioSVG() {
895 if( $(window).width() < 1950 ) {
896 $('.shape-divider svg[preserveAspectRatio]').each(function(){
897 if( !$(this).parent().hasClass('shape-divider-horizontal-animation') ) {
898 $(this).attr('preserveAspectRatio', 'xMinYMin');
899 } else {
900 $(this).attr('preserveAspectRatio', 'none');
901 }
902 });
903 } else {
904 $('.shape-divider svg[preserveAspectRatio]').each(function(){
905 $(this).attr('preserveAspectRatio', 'none');
906 });
907 }
908}
909
910/*
911* Remove min height after the load of page
912*/
913if( $('[data-remove-min-height]').length ) {
914 $(window).on('load', function(){
915 $('[data-remove-min-height]').each(function(){
916 $(this).css({
917 'min-height': 0
918 });
919 });
920 });
921}
922
923/*
924* Lazy Load Background Images (with lazySizes plugin)
925*/
926document.addEventListener('lazybeforeunveil', function(e){
927 var bg = e.target.getAttribute('data-bg-src');
928 if(bg){
929 e.target.style.backgroundImage = 'url(' + bg + ')';
930 }
931});
932
933(function (factory) {
934 if (typeof define === 'function' && define.amd) {
935 // AMD
936 define(['jquery'], factory);
937 } else if (typeof exports === 'object') {
938 // CommonJS
939 factory(require('jquery'));
940 } else {
941 // Browser globals
942 factory(jQuery);
943 }
944}(function ($) {
945 var CountTo = function (element, options) {
946 this.$element = $(element);
947 this.options = $.extend({}, CountTo.DEFAULTS, this.dataOptions(), options);
948 this.init();
949 };
950
951 CountTo.DEFAULTS = {
952 from: 0, // the number the element should start at
953 to: 0, // the number the element should end at
954 speed: 1000, // how long it should take to count between the target numbers
955 refreshInterval: 100, // how often the element should be updated
956 decimals: 0, // the number of decimal places to show
957 formatter: formatter, // handler for formatting the value before rendering
958 onUpdate: null, // callback method for every time the element is updated
959 onComplete: null // callback method for when the element finishes updating
960 };
961
962 CountTo.prototype.init = function () {
963 this.value = this.options.from;
964 this.loops = Math.ceil(this.options.speed / this.options.refreshInterval);
965 this.loopCount = 0;
966 this.increment = (this.options.to - this.options.from) / this.loops;
967 };
968
969 CountTo.prototype.dataOptions = function () {
970 var options = {
971 from: this.$element.data('from'),
972 to: this.$element.data('to'),
973 speed: this.$element.data('speed'),
974 refreshInterval: this.$element.data('refresh-interval'),
975 decimals: this.$element.data('decimals')
976 };
977
978 var keys = Object.keys(options);
979
980 for (var i in keys) {
981 var key = keys[i];
982
983 if (typeof(options[key]) === 'undefined') {
984 delete options[key];
985 }
986 }
987
988 return options;
989 };
990
991 CountTo.prototype.update = function () {
992 this.value += this.increment;
993 this.loopCount++;
994
995 this.render();
996
997 if (typeof(this.options.onUpdate) == 'function') {
998 this.options.onUpdate.call(this.$element, this.value);
999 }
1000
1001 if (this.loopCount >= this.loops) {
1002 clearInterval(this.interval);
1003 this.value = this.options.to;
1004
1005 if (typeof(this.options.onComplete) == 'function') {
1006 this.options.onComplete.call(this.$element, this.value);
1007 }
1008 }
1009 };
1010
1011 CountTo.prototype.render = function () {
1012 var formattedValue = this.options.formatter.call(this.$element, this.value, this.options);
1013 this.$element.text(formattedValue);
1014 };
1015
1016 CountTo.prototype.restart = function () {
1017 this.stop();
1018 this.init();
1019 this.start();
1020 };
1021
1022 CountTo.prototype.start = function () {
1023 this.stop();
1024 this.render();
1025 this.interval = setInterval(this.update.bind(this), this.options.refreshInterval);
1026 };
1027
1028 CountTo.prototype.stop = function () {
1029 if (this.interval) {
1030 clearInterval(this.interval);
1031 }
1032 };
1033
1034 CountTo.prototype.toggle = function () {
1035 if (this.interval) {
1036 this.stop();
1037 } else {
1038 this.start();
1039 }
1040 };
1041
1042 function formatter(value, options) {
1043 return value.toFixed(options.decimals);
1044 }
1045
1046 $.fn.countTo = function (option) {
1047 return this.each(function () {
1048 var $this = $(this);
1049 var data = $this.data('countTo');
1050 var init = !data || typeof(option) === 'object';
1051 var options = typeof(option) === 'object' ? option : {};
1052 var method = typeof(option) === 'string' ? option : 'start';
1053
1054 if (init) {
1055 if (data) data.stop();
1056 $this.data('countTo', data = new CountTo(this, options));
1057 }
1058
1059 data[method].call(data);
1060 });
1061 };
1062}));
1063
1064
1065(function($){
1066
1067 /**
1068 * Copyright 2012, Digital Fusion
1069 * Licensed under the MIT license.
1070 * http://teamdf.com/jquery-plugins/license/
1071 *
1072 * @author Sam Sehnert
1073 * @desc A small plugin that checks whether elements are within
1074 * the user visible viewport of a web browser.
1075 * only accounts for vertical position, not horizontal.
1076 */
1077 $.fn.visible = function(partial,hidden,direction,container){
1078
1079 if (this.length < 1)
1080 return;
1081
1082 var $t = this.length > 1 ? this.eq(0) : this,
1083 isContained = typeof container !== 'undefined' && container !== null,
1084 $w = isContained ? $(container) : $(window),
1085 wPosition = isContained ? $w.position() : 0,
1086 t = $t.get(0),
1087 vpWidth = $w.outerWidth(),
1088 vpHeight = $w.outerHeight(),
1089 direction = (direction) ? direction : 'both',
1090 clientSize = hidden === true ? t.offsetWidth * t.offsetHeight : true;
1091
1092 if (typeof t.getBoundingClientRect === 'function'){
1093
1094 // Use this native browser method, if available.
1095 var rec = t.getBoundingClientRect(),
1096 tViz = isContained ?
1097 rec.top - wPosition.top >= 0 && rec.top < vpHeight + wPosition.top :
1098 rec.top >= 0 && rec.top < vpHeight,
1099 bViz = isContained ?
1100 rec.bottom - wPosition.top > 0 && rec.bottom <= vpHeight + wPosition.top :
1101 rec.bottom > 0 && rec.bottom <= vpHeight,
1102 lViz = isContained ?
1103 rec.left - wPosition.left >= 0 && rec.left < vpWidth + wPosition.left :
1104 rec.left >= 0 && rec.left < vpWidth,
1105 rViz = isContained ?
1106 rec.right - wPosition.left > 0 && rec.right < vpWidth + wPosition.left :
1107 rec.right > 0 && rec.right <= vpWidth,
1108 vVisible = partial ? tViz || bViz : tViz && bViz,
1109 hVisible = partial ? lViz || rViz : lViz && rViz;
1110
1111 if(direction === 'both')
1112 return clientSize && vVisible && hVisible;
1113 else if(direction === 'vertical')
1114 return clientSize && vVisible;
1115 else if(direction === 'horizontal')
1116 return clientSize && hVisible;
1117 } else {
1118
1119 var viewTop = isContained ? 0 : wPosition,
1120 viewBottom = viewTop + vpHeight,
1121 viewLeft = $w.scrollLeft(),
1122 viewRight = viewLeft + vpWidth,
1123 position = $t.position(),
1124 _top = position.top,
1125 _bottom = _top + $t.height(),
1126 _left = position.left,
1127 _right = _left + $t.width(),
1128 compareTop = partial === true ? _bottom : _top,
1129 compareBottom = partial === true ? _top : _bottom,
1130 compareLeft = partial === true ? _right : _left,
1131 compareRight = partial === true ? _left : _right;
1132
1133 if(direction === 'both')
1134 return !!clientSize && ((compareBottom <= viewBottom) && (compareTop >= viewTop)) && ((compareRight <= viewRight) && (compareLeft >= viewLeft));
1135 else if(direction === 'vertical')
1136 return !!clientSize && ((compareBottom <= viewBottom) && (compareTop >= viewTop));
1137 else if(direction === 'horizontal')
1138 return !!clientSize && ((compareRight <= viewRight) && (compareLeft >= viewLeft));
1139 }
1140 };
1141
1142})(jQuery);
1143
1144
1145/**
1146* jquery-match-height 0.7.2 by @liabru
1147* http://brm.io/jquery-match-height/
1148* License: MIT
1149*/
1150
1151;(function(factory) { // eslint-disable-line no-extra-semi
1152 'use strict';
1153 if (typeof define === 'function' && define.amd) {
1154 // AMD
1155 define(['jquery'], factory);
1156 } else if (typeof module !== 'undefined' && module.exports) {
1157 // CommonJS
1158 module.exports = factory(require('jquery'));
1159 } else {
1160 // Global
1161 factory(jQuery);
1162 }
1163})(function($) {
1164 /*
1165 * internal
1166 */
1167
1168 var _previousResizeWidth = -1,
1169 _updateTimeout = -1;
1170
1171 /*
1172 * _parse
1173 * value parse utility function
1174 */
1175
1176 var _parse = function(value) {
1177 // parse value and convert NaN to 0
1178 return parseFloat(value) || 0;
1179 };
1180
1181 /*
1182 * _rows
1183 * utility function returns array of jQuery selections representing each row
1184 * (as displayed after float wrapping applied by browser)
1185 */
1186
1187 var _rows = function(elements) {
1188 var tolerance = 1,
1189 $elements = $(elements),
1190 lastTop = null,
1191 rows = [];
1192
1193 // group elements by their top position
1194 $elements.each(function(){
1195 var $that = $(this),
1196 top = $that.offset().top - _parse($that.css('margin-top')),
1197 lastRow = rows.length > 0 ? rows[rows.length - 1] : null;
1198
1199 if (lastRow === null) {
1200 // first item on the row, so just push it
1201 rows.push($that);
1202 } else {
1203 // if the row top is the same, add to the row group
1204 if (Math.floor(Math.abs(lastTop - top)) <= tolerance) {
1205 rows[rows.length - 1] = lastRow.add($that);
1206 } else {
1207 // otherwise start a new row group
1208 rows.push($that);
1209 }
1210 }
1211
1212 // keep track of the last row top
1213 lastTop = top;
1214 });
1215
1216 return rows;
1217 };
1218
1219 /*
1220 * _parseOptions
1221 * handle plugin options
1222 */
1223
1224 var _parseOptions = function(options) {
1225 var opts = {
1226 byRow: true,
1227 property: 'height',
1228 target: null,
1229 remove: false
1230 };
1231
1232 if (typeof options === 'object') {
1233 return $.extend(opts, options);
1234 }
1235
1236 if (typeof options === 'boolean') {
1237 opts.byRow = options;
1238 } else if (options === 'remove') {
1239 opts.remove = true;
1240 }
1241
1242 return opts;
1243 };
1244
1245 /*
1246 * matchHeight
1247 * plugin definition
1248 */
1249
1250 var matchHeight = $.fn.matchHeight = function(options) {
1251 var opts = _parseOptions(options);
1252
1253 // handle remove
1254 if (opts.remove) {
1255 var that = this;
1256
1257 // remove fixed height from all selected elements
1258 this.css(opts.property, '');
1259
1260 // remove selected elements from all groups
1261 $.each(matchHeight._groups, function(key, group) {
1262 group.elements = group.elements.not(that);
1263 });
1264
1265 // TODO: cleanup empty groups
1266
1267 return this;
1268 }
1269
1270 if (this.length <= 1 && !opts.target) {
1271 return this;
1272 }
1273
1274 // keep track of this group so we can re-apply later on load and resize events
1275 matchHeight._groups.push({
1276 elements: this,
1277 options: opts
1278 });
1279
1280 // match each element's height to the tallest element in the selection
1281 matchHeight._apply(this, opts);
1282
1283 return this;
1284 };
1285
1286 /*
1287 * plugin global options
1288 */
1289
1290 matchHeight.version = '0.7.2';
1291 matchHeight._groups = [];
1292 matchHeight._throttle = 80;
1293 matchHeight._maintainScroll = false;
1294 matchHeight._beforeUpdate = null;
1295 matchHeight._afterUpdate = null;
1296 matchHeight._rows = _rows;
1297 matchHeight._parse = _parse;
1298 matchHeight._parseOptions = _parseOptions;
1299
1300 /*
1301 * matchHeight._apply
1302 * apply matchHeight to given elements
1303 */
1304
1305 matchHeight._apply = function(elements, options) {
1306 var opts = _parseOptions(options),
1307 $elements = $(elements),
1308 rows = [$elements];
1309
1310 // take note of scroll position
1311 var scrollTop = $(window).scrollTop(),
1312 htmlHeight = $('html').outerHeight(true);
1313
1314 // get hidden parents
1315 var $hiddenParents = $elements.parents().filter(':hidden');
1316
1317 // cache the original inline style
1318 $hiddenParents.each(function() {
1319 var $that = $(this);
1320 $that.data('style-cache', $that.attr('style'));
1321 });
1322
1323 // temporarily must force hidden parents visible
1324 $hiddenParents.css('display', 'block');
1325
1326 // get rows if using byRow, otherwise assume one row
1327 if (opts.byRow && !opts.target) {
1328
1329 // must first force an arbitrary equal height so floating elements break evenly
1330 $elements.each(function() {
1331 var $that = $(this),
1332 display = $that.css('display');
1333
1334 // temporarily force a usable display value
1335 if (display !== 'inline-block' && display !== 'flex' && display !== 'inline-flex') {
1336 display = 'block';
1337 }
1338
1339 // cache the original inline style
1340 $that.data('style-cache', $that.attr('style'));
1341
1342 $that.css({
1343 'display': display,
1344 'padding-top': '0',
1345 'padding-bottom': '0',
1346 'margin-top': '0',
1347 'margin-bottom': '0',
1348 'border-top-width': '0',
1349 'border-bottom-width': '0',
1350 'height': '100px',
1351 'overflow': 'hidden'
1352 });
1353 });
1354
1355 // get the array of rows (based on element top position)
1356 rows = _rows($elements);
1357
1358 // revert original inline styles
1359 $elements.each(function() {
1360 var $that = $(this);
1361 $that.attr('style', $that.data('style-cache') || '');
1362 });
1363 }
1364
1365 $.each(rows, function(key, row) {
1366 var $row = $(row),
1367 targetHeight = 0;
1368
1369 if (!opts.target) {
1370 // skip apply to rows with only one item
1371 if (opts.byRow && $row.length <= 1) {
1372 $row.css(opts.property, '');
1373 return;
1374 }
1375
1376 // iterate the row and find the max height
1377 $row.each(function(){
1378 var $that = $(this),
1379 style = $that.attr('style'),
1380 display = $that.css('display');
1381
1382 // temporarily force a usable display value
1383 if (display !== 'inline-block' && display !== 'flex' && display !== 'inline-flex') {
1384 display = 'block';
1385 }
1386
1387 // ensure we get the correct actual height (and not a previously set height value)
1388 var css = { 'display': display };
1389 css[opts.property] = '';
1390 $that.css(css);
1391
1392 // find the max height (including padding, but not margin)
1393 if ($that.outerHeight(false) > targetHeight) {
1394 targetHeight = $that.outerHeight(false);
1395 }
1396
1397 // revert styles
1398 if (style) {
1399 $that.attr('style', style);
1400 } else {
1401 $that.css('display', '');
1402 }
1403 });
1404 } else {
1405 // if target set, use the height of the target element
1406 targetHeight = opts.target.outerHeight(false);
1407 }
1408
1409 // iterate the row and apply the height to all elements
1410 $row.each(function(){
1411 var $that = $(this),
1412 verticalPadding = 0;
1413
1414 // don't apply to a target
1415 if (opts.target && $that.is(opts.target)) {
1416 return;
1417 }
1418
1419 // handle padding and border correctly (required when not using border-box)
1420 if ($that.css('box-sizing') !== 'border-box') {
1421 verticalPadding += _parse($that.css('border-top-width')) + _parse($that.css('border-bottom-width'));
1422 verticalPadding += _parse($that.css('padding-top')) + _parse($that.css('padding-bottom'));
1423 }
1424
1425 // set the height (accounting for padding and border)
1426 $that.css(opts.property, (targetHeight - verticalPadding) + 'px');
1427 });
1428 });
1429
1430 // revert hidden parents
1431 $hiddenParents.each(function() {
1432 var $that = $(this);
1433 $that.attr('style', $that.data('style-cache') || null);
1434 });
1435
1436 // restore scroll position if enabled
1437 if (matchHeight._maintainScroll) {
1438 $(window).scrollTop((scrollTop / htmlHeight) * $('html').outerHeight(true));
1439 }
1440
1441 return this;
1442 };
1443
1444 /*
1445 * matchHeight._applyDataApi
1446 * applies matchHeight to all elements with a data-match-height attribute
1447 */
1448
1449 matchHeight._applyDataApi = function() {
1450 var groups = {};
1451
1452 // generate groups by their groupId set by elements using data-match-height
1453 $('[data-match-height], [data-mh]').each(function() {
1454 var $this = $(this),
1455 groupId = $this.attr('data-mh') || $this.attr('data-match-height');
1456
1457 if (groupId in groups) {
1458 groups[groupId] = groups[groupId].add($this);
1459 } else {
1460 groups[groupId] = $this;
1461 }
1462 });
1463
1464 // apply matchHeight to each group
1465 $.each(groups, function() {
1466 this.matchHeight(true);
1467 });
1468 };
1469
1470 /*
1471 * matchHeight._update
1472 * updates matchHeight on all current groups with their correct options
1473 */
1474
1475 var _update = function(event) {
1476 if (matchHeight._beforeUpdate) {
1477 matchHeight._beforeUpdate(event, matchHeight._groups);
1478 }
1479
1480 $.each(matchHeight._groups, function() {
1481 matchHeight._apply(this.elements, this.options);
1482 });
1483
1484 if (matchHeight._afterUpdate) {
1485 matchHeight._afterUpdate(event, matchHeight._groups);
1486 }
1487 };
1488
1489 matchHeight._update = function(throttle, event) {
1490 // prevent update if fired from a resize event
1491 // where the viewport width hasn't actually changed
1492 // fixes an event looping bug in IE8
1493 if (event && event.type === 'resize') {
1494 var windowWidth = $(window).width();
1495 if (windowWidth === _previousResizeWidth) {
1496 return;
1497 }
1498 _previousResizeWidth = windowWidth;
1499 }
1500
1501 // throttle updates
1502 if (!throttle) {
1503 _update(event);
1504 } else if (_updateTimeout === -1) {
1505 _updateTimeout = setTimeout(function() {
1506 _update(event);
1507 _updateTimeout = -1;
1508 }, matchHeight._throttle);
1509 }
1510 };
1511
1512 /*
1513 * bind events
1514 */
1515
1516 // apply on DOM ready event
1517 $(matchHeight._applyDataApi);
1518
1519 // use on or bind where supported
1520 var on = $.fn.on ? 'on' : 'bind';
1521
1522 // update heights on load and resize events
1523 $(window)[on]('load', function(event) {
1524 matchHeight._update(false, event);
1525 });
1526
1527 // throttled update heights on resize events
1528 $(window)[on]('resize orientationchange', function(event) {
1529 matchHeight._update(true, event);
1530 });
1531
1532});
1533
1534
1535/*! waitForImages jQuery Plugin - v2.4.0 - 2018-02-13
1536* https://github.com/alexanderdickson/waitForImages
1537* Copyright (c) 2018 Alex Dickson; Licensed MIT */
1538;(function (factory) {
1539 if (typeof define === 'function' && define.amd) {
1540 // AMD. Register as an anonymous module.
1541 define(['jquery'], factory);
1542 } else if (typeof exports === 'object') {
1543 // CommonJS / nodejs module
1544 module.exports = factory(require('jquery'));
1545 } else {
1546 // Browser globals
1547 factory(jQuery);
1548 }
1549}(function ($) {
1550 // Namespace all events.
1551 var eventNamespace = 'waitForImages';
1552
1553 // Is srcset supported by this browser?
1554 var hasSrcset = (function(img) {
1555 return img.srcset && img.sizes;
1556 })(new Image());
1557
1558 // CSS properties which contain references to images.
1559 $.waitForImages = {
1560 hasImageProperties: [
1561 'backgroundImage',
1562 'listStyleImage',
1563 'borderImage',
1564 'borderCornerImage',
1565 'cursor'
1566 ],
1567 hasImageAttributes: ['srcset']
1568 };
1569
1570 // Custom selector to find all `img` elements with a valid `src` attribute.
1571 $.expr.pseudos['has-src'] = function (obj) {
1572 // Ensure we are dealing with an `img` element with a valid
1573 // `src` attribute.
1574 return $(obj).is('img[src][src!=""]');
1575 };
1576
1577 // Custom selector to find images which are not already cached by the
1578 // browser.
1579 $.expr.pseudos.uncached = function (obj) {
1580 // Ensure we are dealing with an `img` element with a valid
1581 // `src` attribute.
1582 if (!$(obj).is(':has-src')) {
1583 return false;
1584 }
1585
1586 return !obj.complete;
1587 };
1588
1589 $.fn.waitForImages = function () {
1590
1591 var allImgsLength = 0;
1592 var allImgsLoaded = 0;
1593 var deferred = $.Deferred();
1594 var originalCollection = this;
1595 var allImgs = [];
1596
1597 // CSS properties which may contain an image.
1598 var hasImgProperties = $.waitForImages.hasImageProperties || [];
1599 // Element attributes which may contain an image.
1600 var hasImageAttributes = $.waitForImages.hasImageAttributes || [];
1601 // To match `url()` references.
1602 // Spec: http://www.w3.org/TR/CSS2/syndata.html#value-def-uri
1603 var matchUrl = /url\(\s*(['"]?)(.*?)\1\s*\)/g;
1604
1605 var finishedCallback;
1606 var eachCallback;
1607 var waitForAll;
1608
1609 // Handle options object (if passed).
1610 if ($.isPlainObject(arguments[0])) {
1611
1612 waitForAll = arguments[0].waitForAll;
1613 eachCallback = arguments[0].each;
1614 finishedCallback = arguments[0].finished;
1615
1616 } else {
1617
1618 // Handle if using deferred object and only one param was passed in.
1619 if (arguments.length === 1 && $.type(arguments[0]) === 'boolean') {
1620 waitForAll = arguments[0];
1621 } else {
1622 finishedCallback = arguments[0];
1623 eachCallback = arguments[1];
1624 waitForAll = arguments[2];
1625 }
1626
1627 }
1628
1629 // Handle missing callbacks.
1630 finishedCallback = finishedCallback || $.noop;
1631 eachCallback = eachCallback || $.noop;
1632
1633 // Convert waitForAll to Boolean.
1634 waitForAll = !! waitForAll;
1635
1636 // Ensure callbacks are functions.
1637 if (!$.isFunction(finishedCallback) || !$.isFunction(eachCallback)) {
1638 throw new TypeError('An invalid callback was supplied.');
1639 }
1640
1641 this.each(function () {
1642 // Build a list of all imgs, dependent on what images will
1643 // be considered.
1644 var obj = $(this);
1645
1646 if (waitForAll) {
1647
1648 // Get all elements (including the original), as any one of
1649 // them could have a background image.
1650 obj.find('*').addBack().each(function () {
1651 var element = $(this);
1652
1653 // If an `img` element, add it. But keep iterating in
1654 // case it has a background image too.
1655 if (element.is('img:has-src') &&
1656 !element.is('[srcset]')) {
1657 allImgs.push({
1658 src: element.attr('src'),
1659 element: element[0]
1660 });
1661 }
1662
1663 $.each(hasImgProperties, function (i, property) {
1664 var propertyValue = element.css(property);
1665 var match;
1666
1667 // If it doesn't contain this property, skip.
1668 if (!propertyValue) {
1669 return true;
1670 }
1671
1672 // Get all url() of this element.
1673 while (match = matchUrl.exec(propertyValue)) {
1674 allImgs.push({
1675 src: match[2],
1676 element: element[0]
1677 });
1678 }
1679 });
1680
1681 $.each(hasImageAttributes, function (i, attribute) {
1682 var attributeValue = element.attr(attribute);
1683 var attributeValues;
1684
1685 // If it doesn't contain this property, skip.
1686 if (!attributeValue) {
1687 return true;
1688 }
1689
1690 allImgs.push({
1691 src: element.attr('src'),
1692 srcset: element.attr('srcset'),
1693 element: element[0]
1694 });
1695 });
1696 });
1697 } else {
1698 // For images only, the task is simpler.
1699 obj.find('img:has-src')
1700 .each(function () {
1701 allImgs.push({
1702 src: this.src,
1703 element: this
1704 });
1705 });
1706 }
1707 });
1708
1709 allImgsLength = allImgs.length;
1710 allImgsLoaded = 0;
1711
1712 // If no images found, don't bother.
1713 if (allImgsLength === 0) {
1714 finishedCallback.call(originalCollection);
1715 deferred.resolveWith(originalCollection);
1716 }
1717
1718 // Now that we've found all imgs in all elements in this,
1719 // load them and attach callbacks.
1720 $.each(allImgs, function (i, img) {
1721
1722 var image = new Image();
1723 var events =
1724 'load.' + eventNamespace + ' error.' + eventNamespace;
1725
1726 // Handle the image loading and error with the same callback.
1727 $(image).one(events, function me (event) {
1728 // If an error occurred with loading the image, set the
1729 // third argument accordingly.
1730 var eachArguments = [
1731 allImgsLoaded,
1732 allImgsLength,
1733 event.type == 'load'
1734 ];
1735 allImgsLoaded++;
1736
1737 eachCallback.apply(img.element, eachArguments);
1738 deferred.notifyWith(img.element, eachArguments);
1739
1740 // Unbind the event listeners. I use this in addition to
1741 // `one` as one of those events won't be called (either
1742 // 'load' or 'error' will be called).
1743 $(this).off(events, me);
1744
1745 if (allImgsLoaded == allImgsLength) {
1746 finishedCallback.call(originalCollection[0]);
1747 deferred.resolveWith(originalCollection[0]);
1748 return false;
1749 }
1750
1751 });
1752
1753 if (hasSrcset && img.srcset) {
1754 image.srcset = img.srcset;
1755 image.sizes = img.sizes;
1756 }
1757 image.src = img.src;
1758 });
1759
1760 return deferred.promise();
1761
1762 };
1763}));
1764
1765
1766/* jQuery-FontSpy.js v3.0.0
1767 * https://github.com/patrickmarabeas/jQuery-FontSpy.js
1768 *
1769 * Copyright 2013, Patrick Marabeas http://pulse-dev.com
1770 * Released under the MIT license
1771 * http://opensource.org/licenses/mit-license.php
1772 *
1773 * Date: 02/11/2015
1774 */
1775
1776(function( w, $ ) {
1777
1778 fontSpy = function ( fontName, conf ) {
1779 var $html = $('html'),
1780 $body = $('body'),
1781 fontFamilyName = fontName;
1782
1783 // Throw error if fontName is not a string or not is left as an empty string
1784 if (typeof fontFamilyName !== 'string' || fontFamilyName === '') {
1785 throw 'A valid fontName is required. fontName must be a string and must not be an empty string.';
1786 }
1787
1788 var defaults = {
1789 font: fontFamilyName,
1790 fontClass: fontFamilyName.toLowerCase().replace( /\s/g, '' ),
1791 success: function() {},
1792 failure: function() {},
1793 testFont: 'Courier New',
1794 testString: 'QW@HhsXJ',
1795 glyphs: '',
1796 delay: 50,
1797 timeOut: 1000,
1798 callback: $.noop
1799 };
1800
1801 var config = $.extend( defaults, conf );
1802
1803 var $tester = $('<span>' + config.testString+config.glyphs + '</span>')
1804 .css('position', 'absolute')
1805 .css('top', '-9999px')
1806 .css('left', '-9999px')
1807 .css('visibility', 'hidden')
1808 .css('fontFamily', config.testFont)
1809 .css('fontSize', '250px');
1810
1811 $body.append($tester);
1812
1813 var fallbackFontWidth = $tester.outerWidth();
1814
1815 $tester.css('fontFamily', config.font + ',' + config.testFont);
1816
1817 var failure = function () {
1818 $html.addClass("no-"+config.fontClass);
1819 if( config && config.failure ) {
1820 config.failure();
1821 }
1822 config.callback(new Error('FontSpy timeout'));
1823 $tester.remove();
1824 };
1825
1826 var success = function () {
1827 config.callback();
1828 $html.addClass(config.fontClass);
1829 if( config && config.success ) {
1830 config.success();
1831 }
1832 $tester.remove();
1833 };
1834
1835 var retry = function () {
1836 setTimeout(checkFont, config.delay);
1837 config.timeOut = config.timeOut - config.delay;
1838 };
1839
1840 var checkFont = function () {
1841 var loadedFontWidth = $tester.outerWidth();
1842
1843 if (fallbackFontWidth !== loadedFontWidth){
1844 success();
1845 } else if(config.timeOut < 0) {
1846 failure();
1847 } else {
1848 retry();
1849 }
1850 }
1851
1852 checkFont();
1853 }
1854 })( this, jQuery );
1855
1856
1857/*
1858Plugin Name: jQuery.pin
1859https://github.com/webpop/jquery.pin
1860Licensed under the terms of the MIT license.
1861*/
1862(function ($) {
1863 "use strict";
1864 $.fn.pin = function (options) {
1865 var scrollY = 0, elements = [], disabled = false, $window = $(window);
1866
1867 options = options || {};
1868
1869 var recalculateLimits = function () {
1870 for (var i=0, len=elements.length; i<len; i++) {
1871 var $this = elements[i];
1872
1873 if (options.minWidth && $window.width() <= options.minWidth) {
1874 if ($this.parent().is(".pin-wrapper")) { $this.unwrap(); }
1875 $this.css({width: "", left: "", top: "", position: ""});
1876 if (options.activeClass) { $this.removeClass(options.activeClass); }
1877 disabled = true;
1878 continue;
1879 } else {
1880 disabled = false;
1881 }
1882
1883 var $container = options.containerSelector ? $this.closest(options.containerSelector) : $(document.body);
1884 var offset = $this.offset();
1885 var containerOffset = $container.offset();
1886 var parentOffset = $this.parent().offset();
1887
1888 if (!$this.parent().is(".pin-wrapper")) {
1889 $this.wrap("<div class='pin-wrapper'>");
1890 }
1891
1892 var pad = $.extend({
1893 top: 0,
1894 bottom: 0
1895 }, options.padding || {});
1896
1897 $this.data("pin", {
1898 pad: pad,
1899 from: (options.containerSelector ? containerOffset.top : offset.top) - pad.top,
1900 to: containerOffset.top + $container.height() - $this.outerHeight() - pad.bottom,
1901 end: containerOffset.top + $container.height(),
1902 parentTop: parentOffset.top
1903 });
1904
1905 $this.css({width: $this.outerWidth()});
1906 $this.parent().css("height", $this.outerHeight());
1907 }
1908 };
1909
1910 var onScroll = function () {
1911 if (disabled) { return; }
1912
1913 scrollY = $window.scrollTop();
1914
1915 var elmts = [];
1916 for (var i=0, len=elements.length; i<len; i++) {
1917 var $this = $(elements[i]),
1918 data = $this.data("pin");
1919
1920 if (!data) { // Removed element
1921 continue;
1922 }
1923
1924 elmts.push($this);
1925
1926 var from = data.from - data.pad.bottom,
1927 to = data.to - data.pad.top;
1928
1929 if (from + $this.outerHeight() > data.end) {
1930 $this.css('position', '');
1931 continue;
1932 }
1933
1934 if (from < scrollY && to > scrollY) {
1935 !($this.css("position") == "fixed") && $this.css({
1936 left: $this.offset().left,
1937 top: data.pad.top
1938 }).css("position", "fixed");
1939 if (options.activeClass) { $this.addClass(options.activeClass); }
1940 } else if (scrollY >= to) {
1941 $this.css({
1942 left: "",
1943 top: to - data.parentTop + data.pad.top
1944 }).css("position", "absolute");
1945 if (options.activeClass) { $this.addClass(options.activeClass); }
1946 } else {
1947 $this.css({position: "", top: "", left: ""});
1948 if (options.activeClass) { $this.removeClass(options.activeClass); }
1949 }
1950 }
1951 elements = elmts;
1952 };
1953
1954 var update = function () { recalculateLimits(); onScroll(); };
1955
1956 this.each(function () {
1957 var $this = $(this),
1958 data = $(this).data('pin') || {};
1959
1960 if (data && data.update) { return; }
1961 elements.push($this);
1962 $("img", this).one("load", recalculateLimits);
1963 data.update = update;
1964 $(this).data('pin', data);
1965 });
1966
1967 $window.scroll(onScroll);
1968 $window.resize(function () { recalculateLimits(); });
1969 recalculateLimits();
1970
1971 $window.on('load', update);
1972
1973 return this;
1974 };
1975})(jQuery);
1976
1977
1978( function( $ ) {
1979 "use strict";
1980
1981 // Define default settings
1982 var defaults = {
1983 action: function() {},
1984 runOnLoad: false,
1985 duration: 500
1986 };
1987
1988 // Define global variables
1989 var settings = defaults,
1990 running = false,
1991 start;
1992
1993 var methods = {};
1994
1995 // Initial plugin configuration
1996 methods.init = function() {
1997
1998 // Allocate passed arguments to settings based on type
1999 for( var i = 0; i <= arguments.length; i++ ) {
2000 var arg = arguments[i];
2001 switch ( typeof arg ) {
2002 case "function":
2003 settings.action = arg;
2004 break;
2005 case "boolean":
2006 settings.runOnLoad = arg;
2007 break;
2008 case "number":
2009 settings.duration = arg;
2010 break;
2011 }
2012 }
2013
2014 // Process each matching jQuery object
2015 return this.each(function() {
2016
2017 if( settings.runOnLoad ) { settings.action(); }
2018
2019 $(this).resize( function() {
2020
2021 methods.timedAction.call( this );
2022
2023 } );
2024
2025 } );
2026 };
2027
2028 methods.timedAction = function( code, millisec ) {
2029
2030 var doAction = function() {
2031 var remaining = settings.duration;
2032
2033 if( running ) {
2034 var elapse = new Date() - start;
2035 remaining = settings.duration - elapse;
2036 if( remaining <= 0 ) {
2037 // Clear timeout and reset running variable
2038 clearTimeout(running);
2039 running = false;
2040 // Perform user defined function
2041 settings.action();
2042
2043 return;
2044 }
2045 }
2046 wait( remaining );
2047 };
2048
2049 var wait = function( time ) {
2050 running = setTimeout( doAction, time );
2051 };
2052
2053 // Define new action starting time
2054 start = new Date();
2055
2056 // Define runtime settings if function is run directly
2057 if( typeof millisec === 'number' ) { settings.duration = millisec; }
2058 if( typeof code === 'function' ) { settings.action = code; }
2059
2060 // Only run timed loop if not already running
2061 if( !running ) { doAction(); }
2062
2063 };
2064
2065
2066 $.fn.afterResize = function( method ) {
2067
2068 if( methods[method] ) {
2069 return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ) );
2070 } else {
2071 return methods.init.apply( this, arguments );
2072 }
2073
2074 };
2075
2076})(jQuery);
2077
2078
2079/*
2080Plugin Name: Animated Headlines
2081Written by: Codyhouse - (https://codyhouse.co/demo/animated-headlines/index.html)
2082*/
2083jQuery(document).ready(function($) {
2084 //set animation timing
2085 var animationDelay = 2500,
2086 //loading bar effect
2087 barAnimationDelay = 3800,
2088 barWaiting = barAnimationDelay - 3000, //3000 is the duration of the transition on the loading bar - set in the scss/css file
2089 //letters effect
2090 lettersDelay = 50,
2091 //type effect
2092 typeLettersDelay = 150,
2093 selectionDuration = 500,
2094 typeAnimationDelay = selectionDuration + 800,
2095 //clip effect
2096 revealDuration = 600,
2097 revealAnimationDelay = 1500;
2098
2099 initHeadline();
2100
2101 function initHeadline() {
2102 //initialise headline animation
2103 animateHeadline('.word-rotator', '.word-rotator.letters');
2104 }
2105
2106 function animateHeadline($selector) {
2107 var duration = animationDelay;
2108
2109 theme.fn.intObs($selector, function(){
2110
2111 // Single Letters - Insert <i> element for each letter of a changing word
2112 if( $(this).hasClass('letters') ) {
2113 $(this).find('b').each(function() {
2114 var word = $(this),
2115 letters = word.text().split(''),
2116 selected = word.hasClass('is-visible');
2117 for (i in letters) {
2118 if (word.parents('.rotate-2').length > 0) letters[i] = '<em>' + letters[i] + '</em>';
2119 letters[i] = (selected) ? '<i class="in">' + letters[i] + '</i>' : '<i>' + letters[i] + '</i>';
2120 }
2121 var newLetters = letters.join('');
2122 word.html(newLetters).css('opacity', 1);
2123 });
2124 }
2125
2126 // Animate the Headline
2127 var headline = $(this);
2128
2129 if (headline.hasClass('loading-bar')) {
2130 duration = barAnimationDelay;
2131 setTimeout(function() {
2132 headline.find('.word-rotator-words').addClass('is-loading')
2133 }, barWaiting);
2134 } else if (headline.hasClass('clip')) {
2135 var spanWrapper = headline.find('.word-rotator-words'),
2136 newWidth = spanWrapper.outerWidth() + 10
2137 spanWrapper.css('width', newWidth);
2138 } else if (!headline.hasClass('type')) {
2139 //assign to .word-rotator-words the width of its longest word
2140 var words = headline.find('.word-rotator-words b'),
2141 width = 0;
2142 words.each(function() {
2143 var wordWidth = $(this).outerWidth();
2144 if (wordWidth > width) width = wordWidth;
2145 });
2146 headline.find('.word-rotator-words').css('width', width);
2147 };
2148
2149 // Trigger animation
2150 setTimeout(function() {
2151 hideWord(headline.find('.is-visible').eq(0))
2152 }, duration);
2153 }, {});
2154 }
2155
2156 function hideWord($word) {
2157 var nextWord = takeNext($word);
2158
2159 if ($word.parents('.word-rotator').hasClass('type')) {
2160 var parentSpan = $word.parent('.word-rotator-words');
2161 parentSpan.addClass('selected').removeClass('waiting');
2162 setTimeout(function() {
2163 parentSpan.removeClass('selected');
2164 $word.removeClass('is-visible').addClass('is-hidden').children('i').removeClass('in').addClass('out');
2165 }, selectionDuration);
2166 setTimeout(function() {
2167 showWord(nextWord, typeLettersDelay)
2168 }, typeAnimationDelay);
2169
2170 } else if ($word.parents('.word-rotator').hasClass('letters')) {
2171 var bool = ($word.children('i').length >= nextWord.children('i').length) ? true : false;
2172 hideLetter($word.find('i').eq(0), $word, bool, lettersDelay);
2173 showLetter(nextWord.find('i').eq(0), nextWord, bool, lettersDelay);
2174
2175 } else if ($word.parents('.word-rotator').hasClass('clip')) {
2176 $word.parents('.word-rotator-words').stop( true, true ).animate({
2177 width: '2px'
2178 }, revealDuration, function() {
2179 switchWord($word, nextWord);
2180 showWord(nextWord);
2181 });
2182
2183 } else if ($word.parents('.word-rotator').hasClass('loading-bar')) {
2184 $word.parents('.word-rotator-words').removeClass('is-loading');
2185 switchWord($word, nextWord);
2186 setTimeout(function() {
2187 hideWord(nextWord)
2188 }, barAnimationDelay);
2189 setTimeout(function() {
2190 $word.parents('.word-rotator-words').addClass('is-loading')
2191 }, barWaiting);
2192
2193 } else {
2194 switchWord($word, nextWord);
2195 setTimeout(function() {
2196 hideWord(nextWord)
2197 }, animationDelay);
2198 }
2199 }
2200
2201 function showWord($word, $duration) {
2202 if ($word.parents('.word-rotator').hasClass('type')) {
2203 showLetter($word.find('i').eq(0), $word, false, $duration);
2204 $word.addClass('is-visible').removeClass('is-hidden');
2205 } else if ($word.parents('.word-rotator').hasClass('clip')) {
2206 if (document.hasFocus()) {
2207 $word.parents('.word-rotator-words').stop( true, true ).animate({
2208 'width': $word.outerWidth() + 10
2209 }, revealDuration, function() {
2210 setTimeout(function() {
2211 hideWord($word)
2212 }, revealAnimationDelay);
2213 });
2214 } else {
2215 $word.parents('.word-rotator-words').stop( true, true ).animate({
2216 width: $word.outerWidth() + 10
2217 });
2218 setTimeout(function() {
2219 hideWord($word)
2220 }, revealAnimationDelay);
2221 }
2222 }
2223 }
2224
2225 function hideLetter($letter, $word, $bool, $duration) {
2226 $letter.removeClass('in').addClass('out');
2227
2228 if (!$letter.is(':last-child')) {
2229 setTimeout(function() {
2230 hideLetter($letter.next(), $word, $bool, $duration);
2231 }, $duration);
2232 } else if ($bool) {
2233 setTimeout(function() {
2234 hideWord(takeNext($word))
2235 }, animationDelay);
2236 }
2237
2238 if ($letter.is(':last-child') && $('html').hasClass('no-csstransitions')) {
2239 var nextWord = takeNext($word);
2240 switchWord($word, nextWord);
2241 }
2242 }
2243
2244 function showLetter($letter, $word, $bool, $duration) {
2245 $letter.addClass('in').removeClass('out');
2246
2247 if (!$letter.is(':last-child')) {
2248 setTimeout(function() {
2249 showLetter($letter.next(), $word, $bool, $duration);
2250 }, $duration);
2251 } else {
2252 if ($word.parents('.word-rotator').hasClass('type')) {
2253 setTimeout(function() {
2254 $word.parents('.word-rotator-words').addClass('waiting');
2255 }, 200);
2256 }
2257 if (!$bool) {
2258 setTimeout(function() {
2259 hideWord($word)
2260 }, animationDelay)
2261 }
2262
2263 if (!$word.closest('.word-rotator').hasClass('type')) {
2264 $word.closest('.word-rotator-words').stop( true, true ).animate({
2265 width: $word.outerWidth()
2266 });
2267 }
2268 }
2269 }
2270
2271 function takeNext($word) {
2272 return (!$word.is(':last-child')) ? $word.next() : $word.parent().children().eq(0);
2273 }
2274
2275 function takePrev($word) {
2276 return (!$word.is(':first-child')) ? $word.prev() : $word.parent().children().last();
2277 }
2278
2279 function switchWord($oldWord, $newWord) {
2280 $oldWord.removeClass('is-visible').addClass('is-hidden');
2281 $newWord.removeClass('is-hidden').addClass('is-visible');
2282
2283 if (!$newWord.closest('.word-rotator').hasClass('clip')) {
2284 var space = 0,
2285 delay = ($newWord.outerWidth() > $oldWord.outerWidth()) ? 0 : 600;
2286
2287 if ($newWord.closest('.word-rotator').hasClass('loading-bar') || $newWord.closest('.word-rotator').hasClass('slide')) {
2288 space = 3;
2289 delay = 0;
2290 }
2291
2292 setTimeout(function() {
2293 $newWord.closest('.word-rotator-words').stop( true, true ).animate({
2294 width: $newWord.outerWidth() + space
2295 });
2296 }, delay);
2297 }
2298 }
2299});
2300
2301/*
2302jQuery Hover3d
2303=================================================
2304Version: 1.1.0
2305Author: Rian Ariona
2306Website: http://ariona.net
2307Docs: http://ariona.github.io/hover3d
2308Repo: http://github.com/ariona/hover3d
2309Issues: http://github.com/ariona/hover3d/issues
2310*/
2311
2312(function($){
2313
2314 $.fn.hover3d = function(options){
2315
2316 var settings = $.extend({
2317 selector : null,
2318 perspective : 1000,
2319 sensitivity : 20,
2320 invert : false,
2321 shine : false,
2322 hoverInClass : "hover-in",
2323 hoverOutClass : "hover-out",
2324 hoverClass : "hover-3d"
2325 }, options);
2326
2327 return this.each(function(){
2328
2329 var $this = $(this),
2330 $card = $this.find(settings.selector);
2331 currentX = 0;
2332 currentY = 0;
2333
2334
2335 if( settings.shine ){
2336 $card.append('<div class="shine"></div>');
2337 }
2338 var $shine = $(this).find(".shine");
2339
2340 // Set perspective and transformStyle value
2341 // for element and 3d object
2342 $this.css({
2343 perspective: settings.perspective+"px",
2344 transformStyle: "preserve-3d"
2345 });
2346
2347 $card.css({
2348 perspective: settings.perspective+"px",
2349 transformStyle: "preserve-3d",
2350 });
2351
2352 $shine.css({
2353 position : "absolute",
2354 top : 0,
2355 left : 0,
2356 bottom : 0,
2357 right : 0,
2358 transform : 'translateZ(1px)',
2359 "z-index" : 9
2360 });
2361
2362 // Mouse Enter function, this will add hover-in
2363 // Class so when mouse over it will add transition
2364 // based on hover-in class
2365 function enter(event){
2366 $card.addClass(settings.hoverInClass+" "+settings.hoverClass);
2367 currentX = currentY = 0;
2368 setTimeout(function(){
2369 $card.removeClass(settings.hoverInClass);
2370 }, 1000);
2371 }
2372
2373 // Mouse movement Parallax effect
2374 function move(event){
2375
2376 var w = $card.innerWidth(),
2377 h = $card.innerHeight(),
2378 currentX = Math.round(event.pageX - $card.offset().left),
2379 currentY = Math.round(event.pageY - $card.offset().top),
2380 ax = settings.invert ? ( w / 2 - currentX)/settings.sensitivity : -( w / 2 - currentX)/settings.sensitivity,
2381 ay = settings.invert ? -( h / 2 - currentY)/settings.sensitivity : ( h / 2 - currentY)/settings.sensitivity,
2382 dx = currentX - w / 2,
2383 dy = currentY - h / 2,
2384 theta = Math.atan2(dy, dx),
2385 angle = theta * 180 / Math.PI - 90;
2386
2387
2388 if (angle < 0) {
2389 angle = angle + 360;
2390 }
2391
2392
2393 $card.css({
2394 perspective : settings.perspective+"px",
2395 transformStyle : "preserve-3d",
2396 transform : "rotateY("+ax+"deg) rotateX("+ay+"deg)"
2397 });
2398
2399 $shine.css('background', 'linear-gradient(' + angle + 'deg, rgba(255,255,255,' + event.offsetY / h * .5 + ') 0%,rgba(255,255,255,0) 80%)');
2400 }
2401
2402 // Mouse leave function, will set the transform
2403 // property to 0, and add transition class
2404 // for exit animation
2405 function leave(){
2406 $card.addClass(settings.hoverOutClass+" "+settings.hoverClass);
2407 $card.css({
2408 perspective : settings.perspective+"px",
2409 transformStyle : "preserve-3d",
2410 transform : "rotateX(0) rotateY(0)"
2411 });
2412 setTimeout( function(){
2413 $card.removeClass(settings.hoverOutClass+" "+settings.hoverClass);
2414 currentX = currentY = 0;
2415 }, 1000 );
2416 }
2417
2418 // Mouseenter event binding
2419 $this.on( "mouseenter", function(){
2420 return enter();
2421 });
2422
2423 // Mousemove event binding
2424 $this.on( "mousemove", function(event){
2425 return move(event);
2426 });
2427
2428 // Mouseleave event binding
2429 $this.on( "mouseleave", function(){
2430 return leave();
2431 });
2432
2433 });
2434
2435 };
2436
2437}(jQuery));
2438
2439
2440/*
2441jQuery Hover3d
2442*/
2443(function($) {
2444 if ($.isFunction($.fn['hover3d']) && $('.hover-effect-3d').length) {
2445
2446 theme.fn.execOnceTroughEvent( '.hover-effect-3d', 'mouseover.trigger.hover3d', function(){
2447 $(this).each(function() {
2448 var $this = $(this);
2449
2450 $this.hover3d({
2451 selector: ".thumb-info"
2452 });
2453 });
2454 });
2455
2456
2457 }
2458}).apply(this, [jQuery]);
2459
2460/*
2461* Title Border
2462*/
2463if($('[data-title-border]').length) {
2464
2465 var $pageHeaderTitleBorder = $('<span class="page-header-title-border"></span>'),
2466 $pageHeaderTitle = $('[data-title-border]'),
2467 $window = $(window);
2468
2469 $pageHeaderTitle.before($pageHeaderTitleBorder);
2470
2471 var setPageHeaderTitleBorderWidth = function() {
2472 $pageHeaderTitleBorder.width($pageHeaderTitle.width());
2473 }
2474
2475 $window.afterResize(function(){
2476 setPageHeaderTitleBorderWidth();
2477 });
2478
2479 setPageHeaderTitleBorderWidth();
2480
2481 $pageHeaderTitleBorder.addClass('visible');
2482}
2483
2484/*
2485* Footer Reveal
2486*/
2487(function($) {
2488 var $footerReveal = {
2489 $wrapper: $('.footer-reveal'),
2490 init: function() {
2491 var self = this;
2492
2493 self.build();
2494 self.events();
2495 },
2496 build: function() {
2497 var self = this,
2498 footer_height = self.$wrapper.outerHeight(true),
2499 window_height = ( $(window).height() - $('.header-body').height() );
2500
2501 if( footer_height > window_height ) {
2502 $('#footer').removeClass('footer-reveal');
2503 $('body').css('margin-bottom', 0);
2504 } else {
2505 $('#footer').addClass('footer-reveal');
2506 $('body').css('margin-bottom', footer_height);
2507 }
2508
2509 },
2510 events: function() {
2511 var self = this,
2512 $window = $(window);
2513
2514 $window.on('load', function(){
2515 $window.afterResize(function(){
2516 self.build();
2517 });
2518 });
2519 }
2520 }
2521
2522 if( $('.footer-reveal').length ) {
2523 $footerReveal.init();
2524 }
2525})(jQuery);
2526
2527/* Re-Init Plugin */
2528if( $('[data-reinit-plugin]').length ) {
2529 $('[data-reinit-plugin]').on('click', function(e) {
2530 e.preventDefault();
2531
2532 var pluginInstance = $(this).data('reinit-plugin'),
2533 pluginFunction = $(this).data('reinit-plugin-function'),
2534 pluginElement = $(this).data('reinit-plugin-element'),
2535 pluginOptions = theme.fn.getOptions($(this).data('reinit-plugin-options'));
2536
2537 $( pluginElement ).data( pluginInstance ).destroy();
2538
2539 setTimeout(function(){
2540 theme.fn.execPluginFunction(pluginFunction, $( pluginElement ), pluginOptions);
2541 }, 1000);
2542
2543 });
2544}
2545
2546/* Simple Copy To Clipboard */
2547if( $('[data-copy-to-clipboard]').length ) {
2548 theme.fn.intObs( '[data-copy-to-clipboard]', function(){
2549 var $this = $(this);
2550
2551 $this.wrap( '<div class="copy-to-clipboard-wrapper position-relative"></div>' );
2552
2553 var $copyButton = $('<a href="#" class="btn btn-primary btn-px-2 py-1 text-0 position-absolute top-8 right-8">COPY</a>');
2554 $this.parent().prepend( $copyButton );
2555
2556 $copyButton.on('click', function(e){
2557 e.preventDefault();
2558
2559 var $btn = $(this),
2560 $temp = $('<textarea class="d-block opacity-0" style="height: 0;">');
2561
2562 $btn.parent().append( $temp );
2563
2564 $temp.val( $this.text() );
2565
2566 $temp[0].select();
2567 $temp[0].setSelectionRange(0, 99999);
2568
2569 document.execCommand("copy");
2570
2571 $btn.addClass('copied');
2572 setTimeout(function(){
2573 $btn.removeClass('copied');
2574 }, 1000);
2575
2576 $temp.remove();
2577 });
2578 }, {
2579 rootMargin: '0px 0px 0px 0px'
2580 } );
2581}
2582
2583// Animate
2584(function(theme, $) {
2585
2586 theme = theme || {};
2587
2588 var instanceName = '__animate';
2589
2590 var PluginAnimate = function($el, opts) {
2591 return this.initialize($el, opts);
2592 };
2593
2594 PluginAnimate.defaults = {
2595 accX: 0,
2596 accY: -80,
2597 delay: 100,
2598 duration: '750ms',
2599 minWindowWidth: 0,
2600 forceAnimation: false
2601 };
2602
2603 PluginAnimate.prototype = {
2604 initialize: function($el, opts) {
2605 if ($el.data(instanceName)) {
2606 return this;
2607 }
2608
2609 this.$el = $el;
2610
2611 this
2612 .setData()
2613 .setOptions(opts)
2614 .build();
2615
2616 return this;
2617 },
2618
2619 setData: function() {
2620 this.$el.data(instanceName, this);
2621
2622 return this;
2623 },
2624
2625 setOptions: function(opts) {
2626 this.options = $.extend(true, {}, PluginAnimate.defaults, opts, {
2627 wrapper: this.$el
2628 });
2629
2630 return this;
2631 },
2632
2633 build: function() {
2634 var self = this;
2635
2636 if($('body').hasClass('loading-overlay-showing')) {
2637 $(window).on('loading.overlay.ready', function(){
2638 self.animate();
2639 });
2640 } else {
2641 self.animate();
2642 }
2643
2644 return this;
2645 },
2646
2647 animate: function() {
2648 var self = this,
2649 $el = this.options.wrapper,
2650 delay = 0,
2651 duration = this.options.duration,
2652 elTopDistance = $el.offset().top,
2653 windowTopDistance = $(window).scrollTop();
2654
2655 // If has appear animation elements inside a SVG.
2656 // Intersection Observer API do not check elements inside SVG's, so we need initialize trough top parent SVG
2657 if( $el.data('appear-animation-svg') ) {
2658 $el.find('[data-appear-animation]').each(function(){
2659 var $this = $(this),
2660 opts;
2661
2662 var pluginOptions = theme.fn.getOptions($this.data('plugin-options'));
2663 if (pluginOptions)
2664 opts = pluginOptions;
2665
2666 $this.themePluginAnimate(opts);
2667 });
2668
2669 return this;
2670 }
2671
2672 // No animation at the first load of page. This is good for performance
2673 if( self.options.firstLoadNoAnim ) {
2674 $el.removeClass('appear-animation');
2675
2676 // Inside Carousel
2677 if( $el.closest('.owl-carousel').get(0) ) {
2678 setTimeout(function(){
2679 $el.closest('.owl-carousel').on('change.owl.carousel', function(){
2680 self.options.firstLoadNoAnim = false;
2681 $el.removeData('__animate');
2682 $el.themePluginAnimate( self.options );
2683 });
2684 }, 500);
2685 }
2686
2687 return this;
2688 }
2689
2690 $el.addClass('appear-animation animated');
2691
2692 if (!$('html').hasClass('no-csstransitions') && $(window).width() > self.options.minWindowWidth && elTopDistance >= windowTopDistance || self.options.forceAnimation == true) {
2693 delay = ($el.attr('data-appear-animation-delay') ? $el.attr('data-appear-animation-delay') : self.options.delay);
2694 duration = ($el.attr('data-appear-animation-duration') ? $el.attr('data-appear-animation-duration') : self.options.duration);
2695
2696 if (duration != '750ms') {
2697 $el.css('animation-duration', duration);
2698 }
2699
2700 $el.css('animation-delay', delay + 'ms');
2701 $el.addClass($el.attr('data-appear-animation') + ' appear-animation-visible');
2702
2703 $el.trigger('animation:show');
2704
2705 } else {
2706 $el.addClass('appear-animation-visible');
2707 }
2708
2709 return this;
2710 }
2711 };
2712
2713 // expose to scope
2714 $.extend(theme, {
2715 PluginAnimate: PluginAnimate
2716 });
2717
2718 // jquery plugin
2719 $.fn.themePluginAnimate = function(opts) {
2720 return this.map(function() {
2721 var $this = $(this);
2722
2723 if ($this.data(instanceName)) {
2724 return $this.data(instanceName);
2725 } else {
2726 return new PluginAnimate($this, opts);
2727 }
2728
2729 });
2730 };
2731
2732}).apply(this, [window.theme, jQuery]);
2733
2734// Animated Letters
2735(function(theme, $) {
2736
2737 theme = theme || {};
2738
2739 var instanceName = '__animatedLetters';
2740
2741 var PluginAnimatedLetters = function($el, opts) {
2742 return this.initialize($el, opts);
2743 };
2744
2745 PluginAnimatedLetters.defaults = {
2746 animationName: 'fadeIn',
2747 animationSpeed: 50,
2748 startDelay: 500,
2749 minWindowWidth: 768,
2750 letterClass: ''
2751 };
2752
2753 PluginAnimatedLetters.prototype = {
2754 initialize: function($el, opts) {
2755 if ($el.data(instanceName)) {
2756 return this;
2757 }
2758
2759 var self = this;
2760
2761 this.$el = $el;
2762 this.initialText = $el.text();
2763
2764 this
2765 .setData()
2766 .setOptions(opts)
2767 .build()
2768 .events();
2769
2770 return this;
2771 },
2772
2773 setData: function() {
2774 this.$el.data(instanceName, this);
2775
2776 return this;
2777 },
2778
2779 setOptions: function(opts) {
2780 this.options = $.extend(true, {}, PluginAnimatedLetters.defaults, opts, {
2781 wrapper: this.$el
2782 });
2783
2784 return this;
2785 },
2786
2787 build: function() {
2788 var self = this,
2789 letters = self.$el.text().split('');
2790
2791 if( $(window).width() < self.options.minWindowWidth ) {
2792 return this;
2793 }
2794
2795 if( self.options.firstLoadNoAnim ) {
2796 self.$el.css({
2797 visibility: 'visible'
2798 });
2799
2800 // Inside Carousel
2801 if( self.$el.closest('.owl-carousel').get(0) ) {
2802 setTimeout(function(){
2803 self.$el.closest('.owl-carousel').on('change.owl.carousel', function(){
2804 self.options.firstLoadNoAnim = false;
2805 self.build();
2806 });
2807 }, 500);
2808 }
2809
2810 return this;
2811 }
2812
2813 // Add class to show
2814 self.$el.addClass('initialized');
2815
2816 // Set Min Height to avoid flicking issues
2817 self.setMinHeight();
2818
2819 self.$el.text('');
2820
2821 setTimeout(function(){
2822 for( var i = 0; i < letters.length; i++ ) {
2823 var letter = letters[i];
2824
2825 self.$el.append( '<span class="letter '+ ( self.options.letterClass ? self.options.letterClass + ' ' : '' ) + self.options.animationName +' animated" style="animation-delay: '+ ( i * self.options.animationSpeed ) +'ms;">' + letter + '</span>' );
2826
2827 }
2828 }, self.options.startDelay);
2829
2830 return this;
2831 },
2832
2833 setMinHeight: function() {
2834 var self = this;
2835
2836 // if it's inside carousel
2837 if( self.$el.closest('.owl-carousel').get(0) ) {
2838 self.$el.closest('.owl-carousel').addClass('d-block');
2839 self.$el.css( 'min-height', self.$el.height() );
2840 self.$el.closest('.owl-carousel').removeClass('d-block');
2841 } else {
2842 self.$el.css( 'min-height', self.$el.height() );
2843 }
2844
2845 return this;
2846 },
2847
2848 destroy: function() {
2849 var self = this;
2850
2851 self.$el
2852 .html( self.initialText )
2853 .css( 'min-height', '' );
2854
2855 return this;
2856 },
2857
2858 events: function() {
2859 var self = this;
2860
2861 // Destroy
2862 self.$el.on('animated.letters.destroy', function(){
2863 self.destroy();
2864 });
2865
2866 // Initialize
2867 self.$el.on('animated.letters.initialize', function(){
2868 self.build();
2869 });
2870
2871 return this;
2872 }
2873 };
2874
2875 // expose to scope
2876 $.extend(theme, {
2877 PluginAnimatedLetters: PluginAnimatedLetters
2878 });
2879
2880 // jquery plugin
2881 $.fn.themePluginAnimatedLetters = function(opts) {
2882 return this.map(function() {
2883 var $this = $(this);
2884
2885 if ($this.data(instanceName)) {
2886 return $this.data(instanceName);
2887 } else {
2888 return new PluginAnimatedLetters($this, opts);
2889 }
2890
2891 });
2892 }
2893
2894}).apply(this, [window.theme, jQuery]);
2895
2896// Before / After
2897(function(theme, $) {
2898
2899 theme = theme || {};
2900
2901 var instanceName = '__beforeafter';
2902
2903 var PluginBeforeAfter = function($el, opts) {
2904 return this.initialize($el, opts);
2905 };
2906
2907 PluginBeforeAfter.defaults = {
2908
2909 };
2910
2911 PluginBeforeAfter.prototype = {
2912 initialize: function($el, opts) {
2913 this.$el = $el;
2914
2915 this
2916 .setData()
2917 .setOptions(opts)
2918 .build();
2919
2920 return this;
2921 },
2922
2923 setData: function() {
2924 this.$el.data(instanceName, this);
2925
2926 return this;
2927 },
2928
2929 setOptions: function(opts) {
2930 this.options = $.extend(true, {}, PluginBeforeAfter.defaults, opts, {
2931 wrapper: this.$el
2932 });
2933
2934 return this;
2935 },
2936
2937 build: function() {
2938
2939 if (!($.isFunction($.fn.twentytwenty))) {
2940 return this;
2941 }
2942
2943 var self = this;
2944
2945 self.options.wrapper
2946 .twentytwenty(self.options);
2947
2948 return this;
2949
2950 }
2951 };
2952
2953 // expose to scope
2954 $.extend(theme, {
2955 PluginBeforeAfter: PluginBeforeAfter
2956 });
2957
2958 // jquery plugin
2959 $.fn.themePluginBeforeAfter = function(opts) {
2960 return this.map(function() {
2961 var $this = $(this);
2962
2963 if ($this.data(instanceName)) {
2964 return $this.data(instanceName);
2965 } else {
2966 return new PluginBeforeAfter($this, opts);
2967 }
2968
2969 });
2970 }
2971
2972}).apply(this, [window.theme, jQuery]);
2973
2974// Carousel Light
2975(function(theme, $) {
2976
2977 theme = theme || {};
2978
2979 var instanceName = '__carouselLight';
2980
2981 var PluginCarouselLight = function($el, opts) {
2982 return this.initialize($el, opts);
2983 };
2984
2985 PluginCarouselLight.defaults = {
2986 autoplay: true,
2987 autoplayTimeout: 7000
2988 };
2989
2990 PluginCarouselLight.prototype = {
2991 initialize: function($el, opts) {
2992 if ($el.data(instanceName)) {
2993 return this;
2994 }
2995
2996 this.$el = $el;
2997 this.clickFlag = true;
2998
2999 this
3000 .setData()
3001 .setOptions(opts)
3002 .build()
3003 .owlNav()
3004 .owlDots()
3005 .autoPlay()
3006 .events();
3007
3008 return this;
3009 },
3010
3011 setData: function() {
3012 this.$el.data(instanceName, this);
3013
3014 return this;
3015 },
3016
3017 setOptions: function(opts) {
3018 this.options = $.extend(true, {}, PluginCarouselLight.defaults, opts, {
3019 wrapper: this.$el
3020 });
3021
3022 return this;
3023 },
3024
3025 build: function() {
3026 var self = this;
3027
3028 self.$el
3029 .css('opacity', 1)
3030 .find('.owl-item:first-child')
3031 .addClass('active');
3032
3033 self.$el.trigger('initialized.owl.carousel');
3034
3035 // Carousel Navigate By ID and item index
3036 self.carouselNavigate();
3037
3038 return this;
3039 },
3040
3041 changeSlide: function( $nextSlide ) {
3042 var self = this,
3043 $prevSlide = self.$el.find('.owl-item.active');
3044
3045 self.$el.find('.owl-item.active').addClass('removing');
3046
3047 $prevSlide
3048 .removeClass('fadeIn')
3049 .addClass( 'fadeOut animated' );
3050
3051 setTimeout(function(){
3052 setTimeout(function(){
3053 $prevSlide.removeClass('active');
3054 }, 400);
3055
3056 $nextSlide
3057 .addClass('active')
3058 .removeClass('fadeOut')
3059 .addClass( 'fadeIn animated' );
3060
3061 }, 200);
3062
3063 // Dots
3064 self.$el
3065 .find('.owl-dot')
3066 .removeClass('active')
3067 .eq( $nextSlide.index() )
3068 .addClass('active');
3069
3070 self.$el.trigger({
3071 type: 'change.owl.carousel',
3072 nextSlideIndex: $nextSlide.index(),
3073 prevSlideIndex: $prevSlide.index()
3074 });
3075
3076 setTimeout(function(){
3077 self.$el.trigger({
3078 type: 'changed.owl.carousel',
3079 nextSlideIndex: $nextSlide.index(),
3080 prevSlideIndex: $prevSlide.index()
3081 });
3082 }, 500);
3083 },
3084
3085 owlNav: function() {
3086 var self = this,
3087 $owlNext = self.$el.find('.owl-next'),
3088 $owlPrev = self.$el.find('.owl-prev');
3089
3090 $owlNext.on('click', function(e){
3091 e.preventDefault();
3092
3093 if( self.avoidMultipleClicks() ) {
3094 return false;
3095 }
3096
3097 if( self.$el.find('.owl-item.active').next().get(0) ) {
3098 self.changeSlide( self.$el.find('.owl-item.active').next() );
3099 } else {
3100 self.changeSlide( self.$el.find('.owl-item').eq(0) );
3101 }
3102 });
3103
3104 $owlPrev.on('click', function(e){
3105 e.preventDefault();
3106
3107 if( self.avoidMultipleClicks() ) {
3108 return false;
3109 }
3110
3111 if( self.$el.find('.owl-item.active').prev().get(0) ) {
3112 self.changeSlide( self.$el.find('.owl-item.active').prev() );
3113 } else {
3114 self.changeSlide( self.$el.find('.owl-item:last-child') );
3115 }
3116 });
3117
3118 return this;
3119 },
3120
3121 owlDots: function(){
3122 var self = this,
3123 $owlDot = self.$el.find('.owl-dot');
3124
3125 $owlDot.on('click', function(e){
3126 e.preventDefault();
3127
3128 if( self.avoidMultipleClicks() ) {
3129 return false;
3130 }
3131
3132 var dotIndex = $(this).index();
3133
3134 self.changeSlide( self.$el.find('.owl-item').eq( dotIndex ) );
3135 });
3136
3137 return this;
3138 },
3139
3140 avoidMultipleClicks: function() {
3141 var self = this;
3142
3143 if( !self.clickFlag ) {
3144 return true;
3145 }
3146
3147 if( self.clickFlag ) {
3148 self.clickFlag = false;
3149 setTimeout(function(){
3150 self.clickFlag = true;
3151 }, 1500);
3152 }
3153
3154 return false;
3155 },
3156
3157 autoPlay: function(){
3158 var self = this;
3159
3160
3161
3162 return this;
3163 },
3164
3165 carouselNavigate: function() {
3166 var self = this,
3167 $el = this.options.wrapper,
3168 $carousel = $el;
3169
3170 if( $('[data-carousel-navigate]').get(0) ) {
3171 $('[data-carousel-navigate-id="#'+ $el.attr('id') +'"]').each(function(){
3172 var $this = $(this),
3173 hasCarousel = $( $this.data('carousel-navigate-id') ).get(0),
3174 toIndex = $this.data('carousel-navigate-to');
3175
3176 if( hasCarousel ) {
3177
3178 $this.on('click', function(){
3179 self.changeSlide( self.$el.find('.owl-item').eq( parseInt(toIndex) - 1 ) );
3180 });
3181
3182 }
3183 });
3184
3185 $el.on('change.owl.carousel', function(e){
3186 $('[data-carousel-navigate-id="#'+ $el.attr('id') +'"]').removeClass('active');
3187 });
3188
3189 $el.on('changed.owl.carousel', function(e){
3190 $('[data-carousel-navigate-id="#'+ $el.attr('id') +'"][data-carousel-navigate-to="'+ ( e.nextSlideIndex + 1 ) +'"]').addClass('active');
3191 });
3192 }
3193
3194 return this;
3195 },
3196
3197 events: function() {
3198 var self = this;
3199
3200 self.$el.on('change.owl.carousel', function(event) {
3201
3202 // Hide elements inside carousel
3203 self.$el.find('[data-appear-animation], [data-plugin-animated-letters]').addClass('d-none');
3204
3205 // Animated Letters
3206 self.$el.find('[data-plugin-animated-letters]').trigger('animated.letters.destroy');
3207
3208 // Remove "d-none" class before show the element. This is useful when using background images inside a carousel. Like ken burns effect
3209 self.$el.find('.owl-item:not(.active) [data-carousel-onchange-show]').removeClass('d-none');
3210
3211 });
3212
3213 self.$el.on('changed.owl.carousel', function(event) {
3214 setTimeout(function(){
3215
3216 // Appear Animation
3217 if( self.$el.find('.owl-item.cloned [data-appear-animation]').get(0) ) {
3218 self.$el.find('.owl-item.cloned [data-appear-animation]').each(function() {
3219 var $this = $(this),
3220 opts;
3221
3222 var pluginOptions = theme.fn.getOptions($this.data('plugin-options'));
3223 if (pluginOptions)
3224 opts = pluginOptions;
3225
3226 $this.themePluginAnimate(opts);
3227 });
3228 }
3229
3230 // Show elements inside carousel
3231 self.$el.find('.owl-item.active [data-appear-animation], [data-plugin-animated-letters]').removeClass('d-none');
3232
3233 // Animated Letters
3234 self.$el.find('.owl-item.active [data-plugin-animated-letters]').trigger('animated.letters.initialize');
3235
3236 // Background Video
3237 self.$el.find('.owl-item.cloned.active [data-plugin-video-background]').trigger('video.background.initialize');
3238
3239 }, 500);
3240
3241 });
3242 }
3243 };
3244
3245 // expose to scope
3246 $.extend(theme, {
3247 PluginCarouselLight: PluginCarouselLight
3248 });
3249
3250 // jquery plugin
3251 $.fn.themePluginCarouselLight = function(opts) {
3252 return this.map(function() {
3253 var $this = $(this);
3254
3255 if ($this.data(instanceName)) {
3256 return $this.data(instanceName);
3257 } else {
3258 return new PluginCarouselLight($this, opts);
3259 }
3260
3261 });
3262 };
3263
3264}).apply(this, [window.theme, jQuery]);
3265
3266// Carousel
3267(function(theme, $) {
3268
3269 theme = theme || {};
3270
3271 var instanceName = '__carousel';
3272
3273 var PluginCarousel = function($el, opts) {
3274 return this.initialize($el, opts);
3275 };
3276
3277 PluginCarousel.defaults = {
3278 loop: true,
3279 responsive: {
3280 0: {
3281 items: 1
3282 },
3283 479: {
3284 items: 1
3285 },
3286 768: {
3287 items: 2
3288 },
3289 979: {
3290 items: 3
3291 },
3292 1199: {
3293 items: 4
3294 }
3295 },
3296 navText: [],
3297 refresh: false
3298 };
3299
3300 PluginCarousel.prototype = {
3301 initialize: function($el, opts) {
3302 if ($el.data(instanceName)) {
3303 return this;
3304 }
3305
3306 this.$el = $el;
3307
3308 // If has data-icon inside, initialize only after icons get rendered
3309 // Prevent flicking issues
3310 if( $el.find('[data-icon]').get(0) ) {
3311 var self = this;
3312
3313 $(window).on('icon.rendered', function(){
3314 if ($el.data(instanceName)) {
3315 return this;
3316 }
3317
3318 setTimeout(function(){
3319 self
3320 .setData()
3321 .setOptions(opts)
3322 .build();
3323 }, 1000);
3324 });
3325
3326 return this;
3327 }
3328
3329 this
3330 .setData()
3331 .setOptions(opts)
3332 .build();
3333
3334 return this;
3335 },
3336
3337 setData: function() {
3338 this.$el.data(instanceName, this);
3339
3340 return this;
3341 },
3342
3343 setOptions: function(opts) {
3344 this.options = $.extend(true, {}, PluginCarousel.defaults, opts, {
3345 wrapper: this.$el
3346 });
3347
3348 return this;
3349 },
3350
3351 build: function() {
3352 if (!($.isFunction($.fn.owlCarousel))) {
3353 return this;
3354 }
3355
3356 var self = this,
3357 $el = this.options.wrapper;
3358
3359 // Add Theme Class
3360 $el.addClass('owl-theme');
3361
3362 // Add Loading
3363 $el.addClass('owl-loading');
3364
3365 // Force RTL according to HTML dir attribute
3366 if ($('html').attr('dir') == 'rtl') {
3367 this.options = $.extend(true, {}, this.options, {
3368 rtl: true
3369 });
3370 }
3371
3372 if (this.options.items == 1) {
3373 this.options.responsive = {}
3374 }
3375
3376 if (this.options.items > 4) {
3377 this.options = $.extend(true, {}, this.options, {
3378 responsive: {
3379 1199: {
3380 items: this.options.items
3381 }
3382 }
3383 });
3384 }
3385
3386 // Auto Height Fixes
3387 if (this.options.autoHeight) {
3388 var itemsHeight = [];
3389
3390 $el.find('.owl-item').each(function(){
3391 if( $(this).hasClass('active') ) {
3392 itemsHeight.push( $(this).height() );
3393 }
3394 });
3395
3396 $(window).afterResize(function() {
3397 $el.find('.owl-stage-outer').height( Math.max.apply(null, itemsHeight) );
3398 });
3399
3400 $(window).on('load', function() {
3401 $el.find('.owl-stage-outer').height( Math.max.apply(null, itemsHeight) );
3402 });
3403 }
3404
3405 // Initialize OwlCarousel
3406 $el.owlCarousel(this.options).addClass('owl-carousel-init animated fadeIn');
3407
3408 // Remove "animated fadeIn" class to prevent conflicts
3409 setTimeout(function(){
3410 $el.removeClass('animated fadeIn');
3411 }, 1000);
3412
3413 // Owl Carousel Wrapper
3414 if( $el.closest('.owl-carousel-wrapper').get(0) ) {
3415 setTimeout(function(){
3416 $el.closest('.owl-carousel-wrapper').css({
3417 height: ''
3418 });
3419 }, 500);
3420 }
3421
3422 // Owl Carousel Loader
3423 if( $el.prev().hasClass('owl-carousel-loader') ) {
3424 $el.prev().remove();
3425 }
3426
3427 // Nav Offset
3428 self.navigationOffsets();
3429
3430 // Nav Outside
3431 if( $el.hasClass('nav-outside') ) {
3432 $(window).on('owl.carousel.nav.outside', function(){
3433 if( $(window).width() < 992 ) {
3434 self.options.stagePadding = 40;
3435 $el.addClass('stage-margin');
3436 } else {
3437 self.options.stagePadding = 0;
3438 $el.removeClass('stage-margin');
3439 }
3440
3441 $el.owlCarousel('destroy').owlCarousel( self.options );
3442
3443 // Nav Offset
3444 self.navigationOffsets();
3445 });
3446
3447 // Window Resize
3448 $(window).on('load', function(){
3449 $(window).afterResize(function(){
3450 $(window).trigger('owl.carousel.nav.outside');
3451 });
3452 });
3453
3454 // First Load
3455 $(window).trigger('owl.carousel.nav.outside');
3456 }
3457
3458 // Nav style 5 (SVG Arrows)
3459 if( $el.hasClass('nav-svg-arrows-1') ) {
3460 var svg_arrow = '' +
3461 '<svg version="1.1" viewBox="0 0 15.698 8.706" width="17" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' +
3462 '<polygon stroke="#212121" stroke-width="0.1" fill="#212121" points="11.354,0 10.646,0.706 13.786,3.853 0,3.853 0,4.853 13.786,4.853 10.646,8 11.354,8.706 15.698,4.353 "/>' +
3463 '</svg>';
3464
3465 $el.find('.owl-next, .owl-prev').append( svg_arrow );
3466 }
3467
3468 // Sync
3469 if( $el.attr('data-sync') ) {
3470 $el.on('change.owl.carousel', function(event) {
3471 if (event.namespace && event.property.name === 'position') {
3472 var target = event.relatedTarget.relative(event.property.value, true);
3473 $( $el.data('sync') ).owlCarousel('to', target, 300, true);
3474 }
3475 });
3476 }
3477
3478 // Carousel Center Active Item
3479 if( $el.hasClass('carousel-center-active-item') ) {
3480 var itemsActive = $el.find('.owl-item.active'),
3481 indexCenter = Math.floor( ($el.find('.owl-item.active').length - 1) / 2 ),
3482 itemCenter = itemsActive.eq(indexCenter);
3483
3484 itemCenter.addClass('current');
3485
3486 $el.on('change.owl.carousel', function(event) {
3487 $el.find('.owl-item').removeClass('current');
3488
3489 setTimeout(function(){
3490 var itemsActive = $el.find('.owl-item.active'),
3491 indexCenter = Math.floor( ($el.find('.owl-item.active').length - 1) / 2 ),
3492 itemCenter = itemsActive.eq(indexCenter);
3493
3494 itemCenter.addClass('current');
3495 }, 100);
3496 });
3497
3498 // Refresh
3499 $el.trigger('refresh.owl.carousel');
3500
3501 }
3502
3503 // AnimateIn / AnimateOut Fix
3504 if( self.options.animateIn || self.options.animateOut ) {
3505 $el.on('change.owl.carousel', function(event) {
3506
3507 // Hide elements inside carousel
3508 $el.find('[data-appear-animation], [data-plugin-animated-letters]').addClass('d-none');
3509
3510 // Animated Letters
3511 $el.find('[data-plugin-animated-letters]').trigger('animated.letters.destroy');
3512
3513 // Remove "d-none" class before show the element. This is useful when using background images inside a carousel. Like ken burns effect
3514 $el.find('.owl-item:not(.active) [data-carousel-onchange-show]').removeClass('d-none');
3515
3516 });
3517
3518 $el.on('changed.owl.carousel', function(event) {
3519 setTimeout(function(){
3520
3521 // Appear Animation
3522 if( $el.find('.owl-item.cloned [data-appear-animation]').get(0) ) {
3523 $el.find('.owl-item.cloned [data-appear-animation]').each(function() {
3524 var $this = $(this),
3525 opts;
3526
3527 var pluginOptions = theme.fn.getOptions($this.data('plugin-options'));
3528 if (pluginOptions)
3529 opts = pluginOptions;
3530
3531 $this.themePluginAnimate(opts);
3532 });
3533 }
3534
3535 // Show elements inside carousel
3536 $el.find('.owl-item.active [data-appear-animation], [data-plugin-animated-letters]').removeClass('d-none');
3537
3538 // Animated Letters
3539 $el.find('.owl-item.active [data-plugin-animated-letters]').trigger('animated.letters.initialize');
3540
3541 // Background Video
3542 $el.find('.owl-item.cloned.active [data-plugin-video-background]').trigger('video.background.initialize');
3543
3544 }, 1000);
3545
3546 });
3547 }
3548
3549 // data-icon inside carousel
3550 if( $el.find('[data-icon]').length ) {
3551 $el.on('change.owl.carousel drag.owl.carousel', function(){
3552 $el.find('.owl-item.cloned [data-icon]').each(function(){
3553 var $this = $(this),
3554 opts;
3555
3556 var pluginOptions = theme.fn.getOptions($this.data('plugin-options'));
3557 if (pluginOptions)
3558 opts = pluginOptions;
3559
3560 $this.themePluginIcon(opts);
3561 });
3562 });
3563 }
3564
3565 // Render Background Videos inside carousel. Just a trigger on window is sufficient to render
3566 if( $el.find('[data-plugin-video-background]').get(0) ) {
3567 $(window).resize();
3568 }
3569
3570 // Remove Loading
3571 $el.removeClass('owl-loading');
3572
3573 // Remove Height
3574 $el.css('height', 'auto');
3575
3576 // Carousel Navigate By ID and item index
3577 self.carouselNavigate();
3578
3579 // Refresh Carousel
3580 if( self.options.refresh ) {
3581 $el.owlCarousel('refresh');
3582 }
3583
3584 return this;
3585 },
3586
3587 navigationOffsets: function() {
3588 var self = this,
3589 $el = this.options.wrapper,
3590 navHasTransform = $el.find('.owl-nav').css('transform') == 'none' ? false : true,
3591 dotsHasTransform = $el.find('.owl-dots').css('transform') == 'none' ? false : true;
3592
3593 // ************* NAV *****************
3594 // Nav Offset - Horizontal
3595 if( self.options.navHorizontalOffset && !self.options.navVerticalOffset ) {
3596 if( !navHasTransform ) {
3597 $el.find('.owl-nav').css({
3598 transform: 'translate3d('+ self.options.navHorizontalOffset +', 0, 0)'
3599 });
3600 } else {
3601 $el.find('.owl-nav').css({
3602 left: self.options.navHorizontalOffset
3603 });
3604 }
3605 }
3606
3607 // Nav Offset - Vertical
3608 if( self.options.navVerticalOffset && !self.options.navHorizontalOffset ) {
3609 if( !navHasTransform ) {
3610 $el.find('.owl-nav').css({
3611 transform: 'translate3d(0, '+ self.options.navVerticalOffset +', 0)'
3612 });
3613 } else {
3614 $el.find('.owl-nav').css({
3615 top: 'calc( 50% - '+ self.options.navVerticalOffset +' )'
3616 });
3617 }
3618 }
3619
3620 // Nav Offset - Horizontal & Vertical
3621 if( self.options.navVerticalOffset && self.options.navHorizontalOffset ) {
3622 if( !navHasTransform ) {
3623 $el.find('.owl-nav').css({
3624 transform: 'translate3d('+ self.options.navHorizontalOffset +', '+ self.options.navVerticalOffset +', 0)'
3625 });
3626 } else {
3627 $el.find('.owl-nav').css({
3628 top: 'calc( 50% - '+ self.options.navVerticalOffset +' )',
3629 left: self.options.navHorizontalOffset
3630 });
3631 }
3632 }
3633
3634 // ********** DOTS *********************
3635 // Dots Offset - Horizontal
3636 if( self.options.dotsHorizontalOffset && !self.options.dotsVerticalOffset ) {
3637 $el.find('.owl-dots').css({
3638 transform: 'translate3d('+ self.options.dotsHorizontalOffset +', 0, 0)'
3639 });
3640 }
3641
3642 // Dots Offset - Vertical
3643 if( self.options.dotsVerticalOffset && !self.options.dotsHorizontalOffset ) {
3644 if( !dotsHasTransform ) {
3645 $el.find('.owl-dots').css({
3646 transform: 'translate3d(0, '+ self.options.dotsVerticalOffset +', 0)'
3647 });
3648 } else {
3649 $el.find('.owl-dots').css({
3650 top: 'calc( 50% - '+ self.options.dotsVerticalOffset +' )'
3651 });
3652 }
3653 }
3654
3655 // Dots Offset - Horizontal & Vertical
3656 if( self.options.dotsVerticalOffset && self.options.dotsHorizontalOffset ) {
3657 $el.find('.owl-dots').css({
3658 transform: 'translate3d('+ self.options.dotsHorizontalOffset +', '+ self.options.dotsVerticalOffset +', 0)'
3659 });
3660 }
3661
3662 return this;
3663 },
3664
3665 carouselNavigate: function() {
3666 var self = this,
3667 $el = this.options.wrapper,
3668 $carousel = $el.data('owl.carousel');
3669
3670 if( $('[data-carousel-navigate]').get(0) ) {
3671 $('[data-carousel-navigate-id="#'+ $el.attr('id') +'"]').each(function(){
3672 var $this = $(this),
3673 hasCarousel = $( $this.data('carousel-navigate-id') ).get(0),
3674 toIndex = $this.data('carousel-navigate-to');
3675
3676 if( hasCarousel ) {
3677
3678 $this.on('click', function(){
3679 $carousel.to( parseInt(toIndex) - 1 );
3680 });
3681
3682 }
3683 });
3684
3685 $el.on('change.owl.carousel', function(){
3686 $('[data-carousel-navigate-id="#'+ $el.attr('id') +'"]').removeClass('active');
3687 });
3688
3689 $el.on('changed.owl.carousel', function(e){
3690 $('[data-carousel-navigate-id="#'+ $el.attr('id') +'"][data-carousel-navigate-to="'+ ( e.item.index + 1 ) +'"]').addClass('active');
3691 });
3692 }
3693
3694 return this;
3695 }
3696 };
3697
3698 // expose to scope
3699 $.extend(theme, {
3700 PluginCarousel: PluginCarousel
3701 });
3702
3703 // jquery plugin
3704 $.fn.themePluginCarousel = function(opts) {
3705 return this.map(function() {
3706 var $this = $(this);
3707
3708 if ($this.data(instanceName)) {
3709 return $this.data(instanceName);
3710 } else {
3711 return new PluginCarousel($this, opts);
3712 }
3713
3714 });
3715 }
3716
3717}).apply(this, [window.theme, jQuery]);
3718
3719// Chart Circular
3720(function(theme, $) {
3721
3722 theme = theme || {};
3723
3724 var instanceName = '__chartCircular';
3725
3726 var PluginChartCircular = function($el, opts) {
3727 return this.initialize($el, opts);
3728 };
3729
3730 PluginChartCircular.defaults = {
3731 accX: 0,
3732 accY: -150,
3733 delay: 1,
3734 barColor: '#0088CC',
3735 trackColor: '#f2f2f2',
3736 scaleColor: false,
3737 scaleLength: 5,
3738 lineCap: 'round',
3739 lineWidth: 13,
3740 size: 175,
3741 rotate: 0,
3742 animate: ({
3743 duration: 2500,
3744 enabled: true
3745 })
3746 };
3747
3748 PluginChartCircular.prototype = {
3749 initialize: function($el, opts) {
3750 if ($el.data(instanceName)) {
3751 return this;
3752 }
3753
3754 this.$el = $el;
3755
3756 this
3757 .setData()
3758 .setOptions(opts)
3759 .build();
3760
3761 return this;
3762 },
3763
3764 setData: function() {
3765 this.$el.data(instanceName, this);
3766
3767 return this;
3768 },
3769
3770 setOptions: function(opts) {
3771 this.options = $.extend(true, {}, PluginChartCircular.defaults, opts, {
3772 wrapper: this.$el
3773 });
3774
3775 return this;
3776 },
3777
3778 build: function() {
3779 if (!($.isFunction($.fn.easyPieChart))) {
3780 return this;
3781 }
3782
3783 var self = this,
3784 $el = this.options.wrapper,
3785 value = ($el.attr('data-percent') ? $el.attr('data-percent') : 0),
3786 percentEl = $el.find('.percent');
3787
3788 $.extend(true, self.options, {
3789 onStep: function(from, to, currentValue) {
3790 percentEl.html(parseInt(currentValue));
3791 }
3792 });
3793
3794 $el.attr('data-percent', 0);
3795
3796 $el.easyPieChart(self.options);
3797
3798 setTimeout(function() {
3799
3800 $el.data('easyPieChart').update(value);
3801 $el.attr('data-percent', value);
3802
3803 }, self.options.delay);
3804
3805 return this;
3806 }
3807 };
3808
3809 // expose to scope
3810 $.extend(theme, {
3811 PluginChartCircular: PluginChartCircular
3812 });
3813
3814 // jquery plugin
3815 $.fn.themePluginChartCircular = function(opts) {
3816 return this.map(function() {
3817 var $this = $(this);
3818
3819 if ($this.data(instanceName)) {
3820 return $this.data(instanceName);
3821 } else {
3822 return new PluginChartCircular($this, opts);
3823 }
3824
3825 });
3826 }
3827
3828}).apply(this, [window.theme, jQuery]);
3829
3830// Countdown
3831(function(theme, $) {
3832
3833 theme = theme || {};
3834
3835 var instanceName = '__countdown';
3836
3837 var PluginCountdown = function($el, opts) {
3838 return this.initialize($el, opts);
3839 };
3840
3841 PluginCountdown.defaults = {
3842 date: '2030/06/10 12:00:00',
3843 textDay: 'DAY',
3844 textHour: 'HRS',
3845 textMin: 'MIN',
3846 textSec: 'SEC',
3847 uppercase: true,
3848 numberClass: '',
3849 wrapperClass: '',
3850 insertHTMLbefore: '',
3851 insertHTMLafter: ''
3852 };
3853
3854 PluginCountdown.prototype = {
3855 initialize: function($el, opts) {
3856 if ($el.data(instanceName)) {
3857 return this;
3858 }
3859
3860 this.$el = $el;
3861
3862 this
3863 .setData()
3864 .setOptions(opts)
3865 .build();
3866
3867 return this;
3868 },
3869
3870 setData: function() {
3871 this.$el.data(instanceName, this);
3872
3873 return this;
3874 },
3875
3876 setOptions: function(opts) {
3877 this.options = $.extend(true, {}, PluginCountdown.defaults, opts, {
3878 wrapper: this.$el
3879 });
3880
3881 return this;
3882 },
3883
3884 build: function() {
3885 if (!($.isFunction($.fn.countTo))) {
3886 return this;
3887 }
3888
3889 var self = this,
3890 $el = this.options.wrapper,
3891 numberClass = ( self.options.numberClass ) ? ' ' + self.options.numberClass : '',
3892 wrapperClass = ( self.options.wrapperClass ) ? ' ' + self.options.wrapperClass : '';
3893
3894 if( self.options.uppercase ) {
3895 $el.countdown(self.options.date).on('update.countdown', function(event) {
3896 var $this = $(this).html(event.strftime(self.options.insertHTMLbefore
3897 + '<span class="days'+ wrapperClass +'"><span class="'+ numberClass +'">%D</span> '+ self.options.textDay +'<div class="d-inline text-uppercase">%!d</div></span> '
3898 + '<span class="hours'+ wrapperClass +'"><span class="'+ numberClass +'">%H</span> '+ self.options.textHour +'</span> '
3899 + '<span class="minutes'+ wrapperClass +'"><span class="'+ numberClass +'">%M</span> '+ self.options.textMin +'</span> '
3900 + '<span class="seconds'+ wrapperClass +'"><span class="'+ numberClass +'">%S</span> '+ self.options.textSec +'</span> '
3901 + self.options.insertHTMLafter
3902 ));
3903 });
3904 } else {
3905 $el.countdown(self.options.date).on('update.countdown', function(event) {
3906 var $this = $(this).html(event.strftime(self.options.insertHTMLbefore
3907 + '<span class="days'+ wrapperClass +'"><span class="'+ numberClass +'">%D</span> '+ self.options.textDay +'%!d</span> '
3908 + '<span class="hours'+ wrapperClass +'"><span class="'+ numberClass +'">%H</span> '+ self.options.textHour +'</span> '
3909 + '<span class="minutes'+ wrapperClass +'"><span class="'+ numberClass +'">%M</span> '+ self.options.textMin +'</span> '
3910 + '<span class="seconds'+ wrapperClass +'"><span class="'+ numberClass +'">%S</span> '+ self.options.textSec +'</span> '
3911 + self.options.insertHTMLafter
3912 ));
3913 });
3914 }
3915
3916 return this;
3917 }
3918 };
3919
3920 // expose to scope
3921 $.extend(theme, {
3922 PluginCountdown: PluginCountdown
3923 });
3924
3925 // jquery plugin
3926 $.fn.themePluginCountdown = function(opts) {
3927 return this.map(function() {
3928 var $this = $(this);
3929
3930 if ($this.data(instanceName)) {
3931 return $this.data(instanceName);
3932 } else {
3933 return new PluginCountdown($this, opts);
3934 }
3935
3936 });
3937 }
3938
3939}).apply(this, [window.theme, jQuery]);
3940
3941// Counter
3942(function(theme, $) {
3943
3944 theme = theme || {};
3945
3946 var instanceName = '__counter';
3947
3948 var PluginCounter = function($el, opts) {
3949 return this.initialize($el, opts);
3950 };
3951
3952 PluginCounter.defaulst = {
3953 accX: 0,
3954 accY: 0,
3955 appendWrapper: false,
3956 prependWrapper: false,
3957 speed: 3000,
3958 refreshInterval: 100,
3959 decimals: 0,
3960 onUpdate: null,
3961 onComplete: null
3962 }
3963
3964 PluginCounter.prototype = {
3965 initialize: function($el, opts) {
3966 if ($el.data(instanceName)) {
3967 return this;
3968 }
3969
3970 this.$el = $el;
3971
3972 this
3973 .setData()
3974 .setOptions(opts)
3975 .build();
3976
3977 return this;
3978 },
3979
3980 setData: function() {
3981 this.$el.data(instanceName, this);
3982
3983 return this;
3984 },
3985
3986 setOptions: function(opts) {
3987 this.options = $.extend(true, {}, PluginCounter.defaults, opts, {
3988 wrapper: this.$el
3989 });
3990
3991 return this;
3992 },
3993
3994 build: function() {
3995 if (!($.isFunction($.fn.countTo))) {
3996 return this;
3997 }
3998
3999 var self = this,
4000 $el = this.options.wrapper;
4001
4002 $.extend(self.options, {
4003 onComplete: function() {
4004
4005 if ($el.data('append')) {
4006 if( self.options.appendWrapper ) {
4007 var appendWrapper = $( self.options.appendWrapper );
4008
4009 appendWrapper.append( $el.data('append') );
4010
4011 $el.html( $el.html() + appendWrapper[0].outerHTML );
4012 } else {
4013 $el.html($el.html() + $el.data('append'));
4014 }
4015 }
4016
4017 if ($el.data('prepend')) {
4018 if( self.options.prependWrapper ) {
4019 var prependWrapper = $( self.options.prependWrapper );
4020
4021 prependWrapper.append( $el.data('prepend') );
4022
4023 $el.html( $el.html() + prependWrapper[0].outerHTML );
4024 } else {
4025 $el.html($el.data('prepend') + $el.html());
4026 }
4027 }
4028 }
4029 });
4030
4031 $el.countTo(self.options);
4032
4033 return this;
4034 }
4035 };
4036
4037 // expose to scope
4038 $.extend(theme, {
4039 PluginCounter: PluginCounter
4040 });
4041
4042 // jquery plugin
4043 $.fn.themePluginCounter = function(opts) {
4044 return this.map(function() {
4045 var $this = $(this);
4046
4047 if ($this.data(instanceName)) {
4048 return $this.data(instanceName);
4049 } else {
4050 return new PluginCounter($this, opts);
4051 }
4052
4053 });
4054 }
4055
4056}).apply(this, [window.theme, jQuery]);
4057
4058// CursorEffect
4059(function(theme, $) {
4060
4061 theme = theme || {};
4062
4063 var instanceName = '__cursorEffect';
4064
4065 var PluginCursorEffect = function($el, opts) {
4066 return this.initialize($el, opts);
4067 };
4068
4069 PluginCursorEffect.defaulst = {
4070
4071 }
4072
4073 PluginCursorEffect.prototype = {
4074 initialize: function($el, opts) {
4075 if ($el.data(instanceName)) {
4076 return this;
4077 }
4078
4079 this.$el = $el;
4080
4081 this
4082 .setData()
4083 .setOptions(opts)
4084 .build()
4085 .events();
4086
4087 return this;
4088 },
4089
4090 setData: function() {
4091 this.$el.data(instanceName, this);
4092
4093 return this;
4094 },
4095
4096 setOptions: function(opts) {
4097 this.options = $.extend(true, {}, PluginCursorEffect.defaults, opts, {
4098 wrapper: this.$el
4099 });
4100
4101 return this;
4102 },
4103
4104 build: function() {
4105 var self = this;
4106
4107 // Global Variables for cursor position
4108 self.clientX = -100;
4109 self.clientY = -100;
4110
4111 // Hide Mouse Cursor
4112 if( self.options.hideMouseCursor ) {
4113 self.$el.addClass('hide-mouse-cursor');
4114 }
4115
4116 // Creates the cursor wrapper node
4117 var cursorOuter = document.createElement('DIV');
4118 cursorOuter.className = 'cursor-outer';
4119
4120 // Creates the cursor inner node
4121 var cursorInner = document.createElement('DIV');
4122 cursorInner.className = 'cursor-inner';
4123
4124 // Custom Cursor Outer Color
4125 if( self.options.cursorOuterColor ) {
4126 cursorOuter.style = 'border-color: ' + self.options.cursorOuterColor + ';';
4127 }
4128
4129 // Custom Cursor Inner Color
4130 if( self.options.cursorInnerColor ) {
4131 cursorInner.style = 'background-color: ' + self.options.cursorInnerColor + ';';
4132 }
4133
4134 // Size
4135 if( self.options.size ) {
4136 switch ( self.options.size ) {
4137 case 'small':
4138 self.$el.addClass( 'cursor-effect-size-small' );
4139 break;
4140
4141 case 'big':
4142 self.$el.addClass( 'cursor-effect-size-big' );
4143 break;
4144 }
4145 }
4146
4147 // Style
4148 if( self.options.style ) {
4149 self.$el.addClass( self.options.style );
4150 }
4151
4152 // Prepend cursor wrapper node to the body
4153 document.body.prepend( cursorOuter );
4154
4155 // Prepend cursor inner node to the body
4156 document.body.prepend( cursorInner );
4157
4158 // Loop for render
4159 var render = function() {
4160 cursorOuter.style.transform = `translate(${self.clientX}px, ${self.clientY}px)`;
4161 cursorInner.style.transform = `translate(${self.clientX}px, ${self.clientY}px)`;
4162
4163 self.loopInside = requestAnimationFrame(render);
4164 }
4165 self.loop = requestAnimationFrame(render);
4166
4167 return this;
4168 },
4169
4170 events: function() {
4171 var self = this,
4172 $cursorOuter = $('.cursor-outer'),
4173 $cursorInner = $('.cursor-inner');
4174
4175 var initialCursorOuterBox = $cursorOuter[0].getBoundingClientRect(),
4176 initialCursorOuterRadius = $cursorOuter.css('border-radius');
4177
4178 // Update Cursor Position
4179 document.addEventListener('mousemove', function(e){
4180 if( !self.isStuck ) {
4181 self.clientX = e.clientX - 20;
4182 self.clientY = e.clientY - 20;
4183 }
4184
4185 $cursorOuter.removeClass('opacity-0');
4186 });
4187
4188 self.isStuck = false;
4189 $('[data-cursor-effect-hover]').on('mouseenter', function(e){
4190
4191 // Identify Event With Hover Class
4192 $cursorOuter.addClass('cursor-outer-hover');
4193 $cursorInner.addClass('cursor-inner-hover');
4194
4195 // Hover Color
4196 var hoverColor = $(this).data('cursor-effect-hover-color');
4197 $cursorOuter.addClass( 'cursor-color-' + hoverColor );
4198 $cursorInner.addClass( 'cursor-color-' + hoverColor );
4199
4200 // Effect Types
4201 switch ( $(this).data('cursor-effect-hover') ) {
4202 case 'fit':
4203 var thisBox = $(this)[0].getBoundingClientRect();
4204
4205 self.clientX = thisBox.x;
4206 self.clientY = thisBox.y;
4207
4208 $cursorOuter.css({
4209 width: thisBox.width,
4210 height: thisBox.height,
4211 'border-radius': $(this).css('border-radius')
4212 }).addClass('cursor-outer-fit');
4213
4214 $cursorInner.addClass('opacity-0');
4215
4216 self.isStuck = true;
4217 break;
4218
4219 case 'plus':
4220 $cursorInner.addClass('cursor-inner-plus');
4221 break;
4222 }
4223 });
4224
4225 $('[data-cursor-effect-hover]').on('mouseleave', function(){
4226
4227 // Identify Event With Hover Class
4228 $cursorOuter.removeClass('cursor-outer-hover');
4229 $cursorInner.removeClass('cursor-inner-hover');
4230
4231 // Remove Color Class
4232 var hoverColor = $(this).data('cursor-effect-hover-color');
4233 $cursorOuter.removeClass( 'cursor-color-' + hoverColor );
4234 $cursorInner.removeClass( 'cursor-color-' + hoverColor );
4235
4236 // Effect Types
4237 switch ( $(this).data('cursor-effect-hover') ) {
4238 case 'fit':
4239 $cursorOuter.css({
4240 width: initialCursorOuterBox.width,
4241 height: initialCursorOuterBox.height,
4242 'border-radius': initialCursorOuterRadius
4243 }).removeClass('cursor-outer-fit');
4244
4245 $cursorInner.removeClass('opacity-0');
4246
4247 self.isStuck = false;
4248 break;
4249
4250 case 'plus':
4251 $cursorInner.removeClass('cursor-inner-plus');
4252 break;
4253 }
4254 });
4255
4256 $(window).on('scroll', function(){
4257 if( $cursorOuter.hasClass('cursor-outer-fit') ) {
4258 $cursorOuter.addClass('opacity-0').removeClass('cursor-outer-fit');
4259 }
4260 });
4261
4262 return this;
4263 },
4264
4265 destroy: function() {
4266 var self = this;
4267
4268 self.$el.removeClass('hide-mouse-cursor cursor-effect-size-small cursor-effect-size-big cursor-effect-style-square');
4269
4270 cancelAnimationFrame( self.loop );
4271 cancelAnimationFrame( self.loopInside );
4272
4273 document.querySelector('.cursor-outer').remove();
4274 document.querySelector('.cursor-inner').remove();
4275
4276 self.$el.removeData( instanceName, self );
4277 }
4278 };
4279
4280 // expose to scope
4281 $.extend(theme, {
4282 PluginCursorEffect: PluginCursorEffect
4283 });
4284
4285 // jquery plugin
4286 $.fn.themePluginCursorEffect = function(opts) {
4287 return this.map(function() {
4288 var $this = $(this);
4289
4290 if ($this.data(instanceName)) {
4291 return $this.data(instanceName);
4292 } else {
4293 return new PluginCursorEffect($this, opts);
4294 }
4295
4296 });
4297 }
4298
4299}).apply(this, [window.theme, jQuery]);
4300
4301// Float Element
4302(function(theme, $) {
4303
4304 'use strict';
4305
4306 theme = theme || {};
4307
4308 var instanceName = '__floatElement';
4309
4310 var PluginFloatElement = function($el, opts) {
4311 return this.initialize($el, opts);
4312 };
4313
4314 PluginFloatElement.defaults = {
4315 startPos: 'top',
4316 speed: 3,
4317 horizontal: false,
4318 isInsideSVG: false,
4319 transition: false,
4320 transitionDelay: 0,
4321 transitionDuration: 500
4322 };
4323
4324 PluginFloatElement.prototype = {
4325 initialize: function($el, opts) {
4326 if ($el.data(instanceName)) {
4327 return this;
4328 }
4329
4330 this.$el = $el;
4331
4332 this
4333 .setData()
4334 .setOptions(opts)
4335 .build();
4336
4337 return this;
4338 },
4339
4340 setData: function() {
4341 this.$el.data(instanceName, this);
4342
4343 return this;
4344 },
4345
4346 setOptions: function(opts) {
4347 this.options = $.extend(true, {}, PluginFloatElement.defaults, opts, {
4348 wrapper: this.$el
4349 });
4350
4351 return this;
4352 },
4353
4354 build: function() {
4355 var self = this,
4356 $el = this.options.wrapper,
4357 $window = $(window),
4358 minus;
4359
4360 // If has floating elements inside a SVG.
4361 // Intersection Observer API do not check elements inside SVG's, so we need initialize trough top parent SVG
4362 if( $el.data('plugin-float-element-svg') ) {
4363 $el.find('[data-plugin-float-element]').each(function(){
4364 var $this = $(this),
4365 opts;
4366
4367 var pluginOptions = theme.fn.getOptions($this.data('plugin-options'));
4368 if (pluginOptions)
4369 opts = pluginOptions;
4370
4371 $this.themePluginFloatElement(opts);
4372 });
4373
4374 return this;
4375 }
4376
4377 if( self.options.style ) {
4378 $el.attr('style', self.options.style);
4379 }
4380
4381 if( $window.width() > 767 ) {
4382
4383 // Set Start Position
4384 if( self.options.startPos == 'none' ) {
4385 minus = '';
4386 } else if( self.options.startPos == 'top' ) {
4387 $el.css({
4388 top: 0
4389 });
4390 minus = '';
4391 } else {
4392 $el.css({
4393 bottom: 0
4394 });
4395 minus = '-';
4396 }
4397
4398 // Set Transition
4399 if( self.options.transition ) {
4400 $el.css({
4401 transition: 'ease-out transform '+ self.options.transitionDuration +'ms ' + self.options.transitionDelay + 'ms'
4402 });
4403 }
4404
4405 // First Load
4406 self.movement(minus);
4407
4408 // Scroll
4409 $window.on('scroll', function(){
4410 self.movement(minus);
4411 });
4412
4413 }
4414
4415 return this;
4416 },
4417
4418 movement: function(minus) {
4419 var self = this,
4420 $el = this.options.wrapper,
4421 $window = $(window),
4422 scrollTop = $window.scrollTop(),
4423 elementOffset = $el.offset().top,
4424 currentElementOffset = (elementOffset - scrollTop),
4425 factor = ( self.options.isInsideSVG ) ? 2 : 100;
4426
4427 var scrollPercent = factor * currentElementOffset / ($window.height());
4428
4429 if( $el.visible( true ) ) {
4430
4431 if( !self.options.horizontal ) {
4432
4433 $el.css({
4434 transform: 'translate3d(0, '+ minus + scrollPercent / self.options.speed +'%, 0)'
4435 });
4436
4437 } else {
4438
4439 $el.css({
4440 transform: 'translate3d('+ minus + scrollPercent / self.options.speed +'%, '+ minus + scrollPercent / self.options.speed +'%, 0)'
4441 });
4442
4443 }
4444
4445 }
4446
4447 }
4448 };
4449
4450 // expose to scope
4451 $.extend(theme, {
4452 PluginFloatElement: PluginFloatElement
4453 });
4454
4455 // jquery plugin
4456 $.fn.themePluginFloatElement = function(opts) {
4457 return this.map(function() {
4458 var $this = $(this);
4459
4460 if ($this.data(instanceName)) {
4461 return $this.data(instanceName);
4462 } else {
4463 return new PluginFloatElement($this, opts);
4464 }
4465
4466 });
4467 }
4468
4469}).apply(this, [window.theme, jQuery]);
4470
4471// GDPR
4472(function(theme, $) {
4473
4474 theme = theme || {};
4475
4476 var instanceName = '__gdpr';
4477
4478 var PluginGDPR = function($el, opts) {
4479 return this.initialize($el, opts);
4480 };
4481
4482 PluginGDPR.defaults = {
4483 cookieBarShowDelay: 3000
4484 };
4485
4486 PluginGDPR.prototype = {
4487 initialize: function($el, opts) {
4488 var self = this;
4489
4490 this.$el = $el;
4491
4492 this
4493 .setData()
4494 .setOptions(opts)
4495 .build()
4496 .events();
4497
4498 return this;
4499 },
4500
4501 setData: function() {
4502 this.$el.data(instanceName, this);
4503
4504 return this;
4505 },
4506
4507 setOptions: function(opts) {
4508 this.options = $.extend(true, {}, PluginGDPR.defaults, opts, {
4509 wrapper: this.$el
4510 });
4511
4512 return this;
4513 },
4514
4515 build: function() {
4516 var self = this;
4517
4518 // Show
4519 if( !$.cookie( 'porto-privacy-bar' ) ) {
4520 $(window).on('load', function(){
4521 setTimeout(function(){
4522 self.options.wrapper.addClass('show');
4523 }, self.options.cookieBarShowDelay);
4524 });
4525 }
4526
4527 // If already has preferences cookie, check inputs according preferences cookie data
4528 if( $.cookie( 'porto-gdpr-preferences' ) ) {
4529 var preferencesArr = $.cookie( 'porto-gdpr-preferences' ).split(',');
4530
4531 for( var i = 0; i < preferencesArr.length; i++ ) {
4532 if( $('input[value="'+ preferencesArr[i] +'"]').get(0) ) {
4533 if( $('input[value="'+ preferencesArr[i] +'"]').is(':checkbox') ) {
4534 $('input[value="'+ preferencesArr[i] +'"]').prop('checked', true);
4535 }
4536 }
4537 }
4538 }
4539
4540 return this;
4541
4542 },
4543
4544 events: function() {
4545 var self = this;
4546
4547 // Agree Trigger
4548 self.options.wrapper.find('.gdpr-agree-trigger').on('click', function(e){
4549 e.preventDefault();
4550
4551 $.cookie( 'porto-privacy-bar', true );
4552
4553 self.removeCookieBar();
4554 });
4555
4556 // Preferences Trigger
4557 self.options.wrapper.find('.gdpr-preferences-trigger').on('click', function(e){
4558 e.preventDefault();
4559
4560 $('.gdpr-preferences-popup').toggleClass('show');
4561 });
4562
4563 // Close Popup Button
4564 $('.gdpr-close-popup').on('click', function(e){
4565 e.preventDefault();
4566
4567 $('.gdpr-preferences-popup').toggleClass('show');
4568 });
4569
4570 // Close Popup When Click Outside of popup area
4571 $('.gdpr-preferences-popup').on('click', function(e){
4572 if( !$(e.target).closest('.gdpr-preferences-popup-content').get(0) ) {
4573 $('.gdpr-preferences-popup').toggleClass('show');
4574 }
4575 });
4576
4577 // Preference Form
4578 $('.gdpr-preferences-form').on('submit', function(e){
4579 e.preventDefault();
4580
4581 var $this = $(this);
4582
4583 // Save Preferences Button
4584 $this.find('button[type="submit"]').text( 'SAVING...' );
4585
4586 // Form Data
4587 var formData = [];
4588 $this.find('.gdpr-input').each(function(){
4589 if( $(this).is(':checkbox') && $(this).is(':checked') || $(this).is(':hidden') ) {
4590 formData.push( $(this).val() );
4591 }
4592 });
4593
4594 $.cookie( 'porto-privacy-bar', true );
4595 $.cookie( 'porto-gdpr-preferences', formData );
4596
4597 setTimeout(function(){
4598 $this.find('button[type="submit"]').text( 'SAVED!' ).removeClass('btn-primary').addClass('btn-success');
4599
4600 setTimeout(function(){
4601 $('.gdpr-preferences-popup').toggleClass('show');
4602 self.removeCookieBar();
4603
4604 $this.find('button[type="submit"]').text( 'SAVE PREFERENCES' ).removeClass('btn-success').addClass('btn-primary');
4605
4606 location.reload();
4607 }, 500);
4608 }, 1000);
4609 });
4610
4611 // Remove/Reset Cookies
4612 $('.gdpr-reset-cookies').on('click', function(e){
4613 e.preventDefault();
4614
4615 self.clearCookies();
4616
4617 location.reload();
4618 });
4619
4620 // Open Preferences
4621 $('.gdpr-open-preferences').on('click', function(e){
4622 e.preventDefault();
4623
4624 $('.gdpr-preferences-popup').toggleClass('show');
4625 });
4626
4627 return this;
4628 },
4629
4630 removeCookieBar: function() {
4631 var self = this;
4632
4633 self.options.wrapper.addClass('removing').on('transitionend', function(){
4634 setTimeout(function(){
4635 self.options.wrapper.removeClass('show removing');
4636 }, 500);
4637 });
4638
4639 return this;
4640 },
4641
4642 clearCookies: function() {
4643 var self = this;
4644
4645 $.removeCookie( 'porto-privacy-bar' );
4646 $.removeCookie( 'porto-gdpr-preferences' );
4647
4648 return this;
4649 }
4650 };
4651
4652 // expose to scope
4653 $.extend(theme, {
4654 PluginGDPR: PluginGDPR
4655 });
4656
4657 // jquery plugin
4658 $.fn.themePluginGDPR = function(opts) {
4659 return this.map(function() {
4660 var $this = $(this);
4661
4662 if ($this.data(instanceName)) {
4663 return $this.data(instanceName);
4664 } else {
4665 return new PluginGDPR($this, opts);
4666 }
4667
4668 });
4669 }
4670
4671}).apply(this, [window.theme, jQuery]);
4672
4673// GDPR Wrapper
4674(function(theme, $) {
4675
4676 theme = theme || {};
4677
4678 var instanceName = '__gdprwrapper';
4679
4680 var PluginGDPRWrapper = function($el, opts) {
4681 return this.initialize($el, opts);
4682 };
4683
4684 PluginGDPRWrapper.defaults = {
4685
4686 };
4687
4688 PluginGDPRWrapper.prototype = {
4689 initialize: function($el, opts) {
4690 var self = this;
4691
4692 this.$el = $el;
4693
4694 this
4695 .setData()
4696 .setOptions(opts)
4697 .build();
4698
4699 return this;
4700 },
4701
4702 setData: function() {
4703 this.$el.data(instanceName, this);
4704
4705 return this;
4706 },
4707
4708 setOptions: function(opts) {
4709 this.options = $.extend(true, {}, PluginGDPRWrapper.defaults, opts, {
4710 wrapper: this.$el
4711 });
4712
4713 return this;
4714 },
4715
4716 build: function() {
4717 var self = this;
4718
4719 if( $.cookie( 'porto-gdpr-preferences' ).indexOf( self.options.checkCookie ) != -1 ) {
4720 $.ajax({
4721 url: self.options.ajaxURL,
4722 cache: false,
4723 complete: function(data) {
4724
4725 setTimeout(function() {
4726
4727 self.options.wrapper.html(data.responseText);
4728
4729 }, 1000);
4730
4731 }
4732 });
4733 }
4734
4735 return this;
4736
4737 }
4738 };
4739
4740 // expose to scope
4741 $.extend(theme, {
4742 PluginGDPRWrapper: PluginGDPRWrapper
4743 });
4744
4745 // jquery plugin
4746 $.fn.themePluginGDPRWrapper = function(opts) {
4747 return this.map(function() {
4748 var $this = $(this);
4749
4750 if ($this.data(instanceName)) {
4751 return $this.data(instanceName);
4752 } else {
4753 return new PluginGDPRWrapper($this, opts);
4754 }
4755
4756 });
4757 }
4758
4759}).apply(this, [window.theme, jQuery]);
4760
4761// Icon
4762(function(theme, $) {
4763
4764 'use strict';
4765
4766 theme = theme || {};
4767
4768 var instanceName = '__icon';
4769
4770 var PluginIcon = function($el, opts) {
4771 return this.initialize($el, opts);
4772 };
4773
4774 PluginIcon.defaults = {
4775 color: '#2388ED',
4776 animated: false,
4777 delay: 300,
4778 onlySVG: false
4779 };
4780
4781 PluginIcon.prototype = {
4782 initialize: function($el, opts) {
4783 if ($el.data(instanceName)) {
4784 return this;
4785 }
4786
4787 this.$el = $el;
4788
4789 this
4790 .setData()
4791 .setOptions(opts)
4792 .build();
4793
4794 return this;
4795 },
4796
4797 setData: function() {
4798 this.$el.data(instanceName, this);
4799
4800 return this;
4801 },
4802
4803 setOptions: function(opts) {
4804 this.options = $.extend(true, {}, PluginIcon.defaults, opts, {
4805 wrapper: this.$el
4806 });
4807
4808 return this;
4809 },
4810
4811 build: function() {
4812 var self = this,
4813 $el = this.options.wrapper,
4814 color = self.options.color,
4815 elTopDistance = $el.offset().top,
4816 windowTopDistance = $(window).scrollTop(),
4817 duration = ( self.options.animated && !self.options.strokeBased ) ? 200 : 100;
4818
4819 // Check origin
4820 if( window.location.protocol === 'file:' ) {
4821 $el.css({
4822 opacity: 1,
4823 width: $el.attr('width')
4824 });
4825
4826 if( self.options.extraClass ) {
4827 $el.addClass( self.options.extraClass );
4828 }
4829
4830 if( self.options.extraClass.indexOf('-color-light') > 0 ) {
4831 $el.css({
4832 filter: 'invert(1)'
4833 });
4834 }
4835
4836 $(window).trigger('icon.rendered');
4837 return;
4838 }
4839
4840 // Duration
4841 if( self.options.duration ) {
4842 duration = self.options.duration;
4843 }
4844
4845 // SVG Content
4846 var SVGContent = $.get({
4847 url: $el.attr('src'),
4848 success: function(data, status, xhr){
4849 var iconWrapper = $('<div class="animated-icon animated fadeIn">'+ xhr.responseText +'</div>'),
4850 uniqid = 'icon_' + Math.floor(Math.random() * 26) + Date.now();
4851
4852 iconWrapper.find('svg').attr('id', uniqid);
4853
4854 if( $el.attr('width') ) {
4855 iconWrapper.find('svg')
4856 .attr('width', $el.attr('width'))
4857 .attr('height', $el.attr('width'));
4858 }
4859
4860 if( $el.attr('height') ) {
4861 iconWrapper.find('svg')
4862 .attr('height', $el.attr('height'));
4863 }
4864
4865 if( self.options.svgViewBox ) {
4866 iconWrapper.find('svg')
4867 .attr('viewBox', self.options.svgViewBox);
4868 }
4869
4870 $el.replaceWith(iconWrapper);
4871
4872 if( self.options.extraClass ) {
4873 iconWrapper.addClass( self.options.extraClass );
4874 }
4875
4876 if( self.options.onlySVG ) {
4877 $(window).trigger('icon.rendered');
4878 return this;
4879 }
4880
4881 $el = iconWrapper;
4882
4883 var icon = new Vivus(uniqid, {start: 'manual', type: 'sync', selfDestroy: true, duration: duration, onReady: function(obj){
4884 var styleElement = document.createElementNS("http://www.w3.org/2000/svg", "style"),
4885 animateStyle = '';
4886
4887 // SVG Fill Based
4888 if( self.options.animated && !self.options.strokeBased || !self.options.animated && color && !self.options.strokeBased ) {
4889 animateStyle = 'stroke-width: 0.1px; fill-opacity: 0; transition: ease fill-opacity 300ms;';
4890
4891 // Set Style on SVG inside object
4892 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; }';
4893 obj.el.appendChild(styleElement);
4894 }
4895
4896 // SVG Stroke Based
4897 if( self.options.animated && self.options.strokeBased || !self.options.animated && color && self.options.strokeBased ) {
4898
4899 // Set Style on SVG inside object
4900 styleElement.textContent = '#' + uniqid + ' path, #' + uniqid + ' line, #' + uniqid + ' rect, #' + uniqid + ' circle, #' + uniqid + ' polyline { stroke: '+ color +'; ' + (self.options.svgStyle ? self.options.svgStyle : "") + '}';
4901 obj.el.appendChild(styleElement);
4902 }
4903
4904 $.event.trigger('theme.plugin.icon.svg.ready');
4905 }});
4906
4907 // Isn't animated
4908 if( !self.options.animated ) {
4909 setTimeout(function(){
4910 icon.finish();
4911 }, 10);
4912 $el.css({ opacity: 1 });
4913 }
4914
4915 // Animated
4916 if( self.options.animated && $(window).width() > 767 ) {
4917
4918 // First Load
4919 if( $el.visible( true ) ) {
4920 self.startIconAnimation( icon, $el );
4921 } else if( elTopDistance < windowTopDistance ) {
4922 self.startIconAnimation( icon, $el );
4923 }
4924
4925 // On Scroll
4926 $(window).on('scroll', function(){
4927 if( $el.visible( true ) ) {
4928 self.startIconAnimation( icon, $el );
4929 }
4930 });
4931
4932 } else {
4933
4934 $el.css({ opacity: 1 });
4935 icon.finish();
4936
4937 $(window).on('theme.plugin.icon.svg.ready', function(){
4938 setTimeout(function(){
4939 icon.el.setAttribute('class', 'finished');
4940 icon.finish();
4941 }, 300);
4942 });
4943
4944 }
4945
4946 $(window).trigger('icon.rendered');
4947 }
4948 });
4949
4950 return this;
4951 },
4952
4953 startIconAnimation: function(icon, $el) {
4954 var self = this;
4955
4956 // Animate for better performance
4957 $({to:0}).animate({to:1}, ((self.options.strokeBased) ? self.options.delay : self.options.delay + 300 ), function() {
4958 $el.css({ opacity: 1 });
4959 });
4960
4961 $({to:0}).animate({to:1}, self.options.delay, function() {
4962 icon.play(1);
4963
4964 setTimeout(function(){
4965 icon.el.setAttribute('class', 'finished');
4966 }, icon.duration * 5 );
4967 });
4968 }
4969 };
4970
4971 // expose to scope
4972 $.extend(theme, {
4973 PluginIcon: PluginIcon
4974 });
4975
4976 // jquery plugin
4977 $.fn.themePluginIcon = function(opts) {
4978 return this.map(function() {
4979 var $this = $(this);
4980
4981 if ($this.data(instanceName)) {
4982 return $this.data(instanceName);
4983 } else {
4984 return new PluginIcon($this, opts);
4985 }
4986
4987 });
4988 };
4989
4990}).apply(this, [window.theme, jQuery]);
4991
4992// Lightbox
4993(function(theme, $) {
4994
4995 theme = theme || {};
4996
4997 var instanceName = '__lightbox';
4998
4999 var PluginLightbox = function($el, opts) {
5000 return this.initialize($el, opts);
5001 };
5002
5003 PluginLightbox.defaults = {
5004 tClose: 'Close (Esc)', // Alt text on close button
5005 tLoading: 'Loading...', // Text that is displayed during loading. Can contain %curr% and %total% keys
5006 gallery: {
5007 tPrev: 'Previous (Left arrow key)', // Alt text on left arrow
5008 tNext: 'Next (Right arrow key)', // Alt text on right arrow
5009 tCounter: '%curr% of %total%' // Markup for "1 of 7" counter
5010 },
5011 image: {
5012 tError: '<a href="%url%">The image</a> could not be loaded.' // Error message when image could not be loaded
5013 },
5014 ajax: {
5015 tError: '<a href="%url%">The content</a> could not be loaded.' // Error message when ajax request failed
5016 },
5017 callbacks: {
5018 open: function() {
5019 $('html').addClass('lightbox-opened');
5020 },
5021 close: function() {
5022 $('html').removeClass('lightbox-opened');
5023 }
5024 }
5025 };
5026
5027 PluginLightbox.prototype = {
5028 initialize: function($el, opts) {
5029 if ($el.data(instanceName)) {
5030 return this;
5031 }
5032
5033 this.$el = $el;
5034
5035 this
5036 .setData()
5037 .setOptions(opts)
5038 .build();
5039
5040 return this;
5041 },
5042
5043 setData: function() {
5044 this.$el.data(instanceName, this);
5045
5046 return this;
5047 },
5048
5049 setOptions: function(opts) {
5050 this.options = $.extend(true, {}, PluginLightbox.defaults, opts, {
5051 wrapper: this.$el
5052 });
5053
5054 return this;
5055 },
5056
5057 build: function() {
5058 if (!($.isFunction($.fn.magnificPopup))) {
5059 return this;
5060 }
5061
5062 this.options.wrapper.magnificPopup(this.options);
5063
5064 return this;
5065 }
5066 };
5067
5068 // expose to scope
5069 $.extend(theme, {
5070 PluginLightbox: PluginLightbox
5071 });
5072
5073 // jquery plugin
5074 $.fn.themePluginLightbox = function(opts) {
5075 return this.map(function() {
5076 var $this = $(this);
5077
5078 if ($this.data(instanceName)) {
5079 return $this.data(instanceName);
5080 } else {
5081 return new PluginLightbox($this, opts);
5082 }
5083
5084 });
5085 }
5086
5087}).apply(this, [window.theme, jQuery]);
5088
5089// Loading Overlay
5090(function(theme, $) {
5091
5092 'use strict';
5093
5094 theme = theme || {};
5095
5096 // Default
5097 var loadingOverlayDefaultTemplate = [
5098 '<div class="loading-overlay">',
5099 '<div class="bounce-loader"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>',
5100 '</div>'
5101 ].join('');
5102
5103 // Percentage
5104 var loadingOverlayPercentageTemplate = [
5105 '<div class="loading-overlay loading-overlay-percentage">',
5106 '<div class="page-loader-progress-wrapper"><span class="page-loader-progress">0</span><span class="page-loader-progress-symbol">%</span></div>',
5107 '</div>'
5108 ].join('');
5109
5110 // Cubes
5111 var loadingOverlayCubesTemplate = [
5112 '<div class="loading-overlay">',
5113 '<div class="bounce-loader"><div class="cssload-thecube"><div class="cssload-cube cssload-c1"></div><div class="cssload-cube cssload-c2"></div><div class="cssload-cube cssload-c4"></div><div class="cssload-cube cssload-c3"></div></div></div>',
5114 '</div>'
5115 ].join('');
5116
5117 // Cube Progress
5118 var loadingOverlayCubeProgressTemplate = [
5119 '<div class="loading-overlay">',
5120 '<div class="bounce-loader"><span class="cssload-cube-progress"><span class="cssload-cube-progress-inner"></span></span></div>',
5121 '</div>'
5122 ].join('');
5123
5124 // Float Rings
5125 var loadingOverlayFloatRingsTemplate = [
5126 '<div class="loading-overlay">',
5127 '<div class="bounce-loader"><div class="cssload-float-rings-loader"><div class="cssload-float-rings-inner cssload-one"></div><div class="cssload-float-rings-inner cssload-two"></div><div class="cssload-float-rings-inner cssload-three"></div></div></div>',
5128 '</div>'
5129 ].join('');
5130
5131 // Floating Bars
5132 var loadingOverlayFloatBarsTemplate = [
5133 '<div class="loading-overlay">',
5134 '<div class="bounce-loader"><div class="cssload-float-bars-container"><ul class="cssload-float-bars-flex-container"><li><span class="cssload-float-bars-loading"></span></li></div></div></div>',
5135 '</div>'
5136 ].join('');
5137
5138 // Speeding Wheel
5139 var loadingOverlaySpeedingWheelTemplate = [
5140 '<div class="loading-overlay">',
5141 '<div class="bounce-loader"><div class="cssload-speeding-wheel-container"><div class="cssload-speeding-wheel"></div></div></div>',
5142 '</div>'
5143 ].join('');
5144
5145 // Zenith
5146 var loadingOverlayZenithTemplate = [
5147 '<div class="loading-overlay">',
5148 '<div class="bounce-loader"><div class="cssload-zenith-container"><div class="cssload-zenith"></div></div></div>',
5149 '</div>'
5150 ].join('');
5151
5152 // Spinning Square
5153 var loadingOverlaySpinningSquareTemplate = [
5154 '<div class="loading-overlay">',
5155 '<div class="bounce-loader"><div class="cssload-spinning-square-loading"></div></div>',
5156 '</div>'
5157 ].join('');
5158
5159 // Pulse
5160 var loadingOverlayPulseTemplate = [
5161 '<div class="loading-overlay">',
5162 '<div class="bounce-loader"><div class="wrapper-pulse"><div class="cssload-pulse-loader"></div></div></div>',
5163 '</div>'
5164 ].join('');
5165
5166 var LoadingOverlay = function( $wrapper, options, noInheritOptions ) {
5167 return this.initialize( $wrapper, options, noInheritOptions );
5168 };
5169
5170 LoadingOverlay.prototype = {
5171
5172 options: {
5173 css: {},
5174 hideDelay: 500,
5175 progressMinTimeout: 0,
5176 effect: 'default'
5177 },
5178
5179 initialize: function( $wrapper, options, noInheritOptions ) {
5180 this.$wrapper = $wrapper;
5181
5182 this
5183 .setVars()
5184 .setOptions( options, noInheritOptions )
5185 .build()
5186 .events()
5187 .dynamicShowHideEvents();
5188
5189 this.$wrapper.data( 'loadingOverlay', this );
5190 },
5191
5192 setVars: function() {
5193 this.$overlay = this.$wrapper.find('.loading-overlay');
5194 this.pageStatus = null;
5195 this.progress = null;
5196 this.animationInterval = 33;
5197
5198 return this;
5199 },
5200
5201 setOptions: function( options, noInheritOptions ) {
5202 if ( !this.$overlay.get(0) ) {
5203 this.matchProperties();
5204 }
5205
5206 if( noInheritOptions ) {
5207 this.options = $.extend( true, {}, this.options, options );
5208 } else {
5209 this.options = $.extend( true, {}, this.options, options, theme.fn.getOptions(this.$wrapper.data('plugin-options')) );
5210 }
5211
5212 this.loaderClass = this.getLoaderClass( this.options.css.backgroundColor );
5213
5214 return this;
5215 },
5216
5217 build: function() {
5218 var _self = this;
5219
5220 if ( !this.$overlay.closest(document.documentElement).get(0) ) {
5221 if ( !this.$cachedOverlay ) {
5222
5223 switch ( _self.options.effect ) {
5224 case 'percentageProgress1':
5225 this.$overlay = $( loadingOverlayPercentageTemplate ).clone();
5226 break;
5227
5228 case 'percentageProgress2':
5229 this.$overlay = $( loadingOverlayPercentageTemplate ).clone();
5230 this.$overlay
5231 .addClass('loading-overlay-percentage-effect-2')
5232 .prepend('<div class="loading-overlay-background-layer"></div>');
5233 break;
5234
5235 case 'cubes':
5236 this.$overlay = $( loadingOverlayCubesTemplate ).clone();
5237 break;
5238
5239 case 'cubeProgress':
5240 this.$overlay = $( loadingOverlayCubeProgressTemplate ).clone();
5241 break;
5242
5243 case 'floatRings':
5244 this.$overlay = $( loadingOverlayFloatRingsTemplate ).clone();
5245 break;
5246
5247 case 'floatBars':
5248 this.$overlay = $( loadingOverlayFloatBarsTemplate ).clone();
5249 break;
5250
5251 case 'speedingWheel':
5252 this.$overlay = $( loadingOverlaySpeedingWheelTemplate ).clone();
5253 break;
5254
5255 case 'zenith':
5256 this.$overlay = $( loadingOverlayZenithTemplate ).clone();
5257 break;
5258
5259 case 'spinningSquare':
5260 this.$overlay = $( loadingOverlaySpinningSquareTemplate ).clone();
5261 break;
5262
5263 case 'pulse':
5264 this.$overlay = $( loadingOverlayPulseTemplate ).clone();
5265 break;
5266
5267 case 'default':
5268 default:
5269 this.$overlay = $( loadingOverlayDefaultTemplate ).clone();
5270 break;
5271 }
5272
5273 if ( this.options.css ) {
5274 this.$overlay.css( this.options.css );
5275 this.$overlay.find( '.loader' ).addClass( this.loaderClass );
5276 }
5277 } else {
5278 this.$overlay = this.$cachedOverlay.clone();
5279 }
5280
5281 this.$wrapper.prepend( this.$overlay );
5282 }
5283
5284 if ( !this.$cachedOverlay ) {
5285 this.$cachedOverlay = this.$overlay.clone();
5286 }
5287
5288 if( ['percentageProgress1', 'percentageProgress2'].includes(_self.options.effect) ) {
5289 _self.updateProgress();
5290
5291 if( _self.options.isDynamicHideShow ) {
5292 setTimeout(function(){
5293 _self.progress = 'complete';
5294
5295 $('.page-loader-progress').text(100);
5296
5297 if( ['percentageProgress2'].includes(_self.options.effect) ) {
5298 $('.loading-overlay-background-layer').css({
5299 width: '100%'
5300 });
5301 }
5302 }, 2800);
5303 }
5304 }
5305
5306 return this;
5307 },
5308
5309 events: function() {
5310 var _self = this;
5311
5312 if ( this.options.startShowing ) {
5313 _self.show();
5314 }
5315
5316 if ( this.$wrapper.is('body') || this.options.hideOnWindowLoad ) {
5317 $( window ).on( 'load error', function() {
5318 setTimeout(function(){
5319 _self.hide();
5320 }, _self.options.progressMinTimeout);
5321 });
5322 }
5323
5324 if ( this.options.listenOn ) {
5325 $( this.options.listenOn )
5326 .on( 'loading-overlay:show beforeSend.ic', function( e ) {
5327 e.stopPropagation();
5328 _self.show();
5329 })
5330 .on( 'loading-overlay:hide complete.ic', function( e ) {
5331 e.stopPropagation();
5332 _self.hide();
5333 });
5334 }
5335
5336 this.$wrapper
5337 .on( 'loading-overlay:show beforeSend.ic', function( e ) {
5338 if ( e.target === _self.$wrapper.get(0) ) {
5339 e.stopPropagation();
5340 _self.show();
5341 return true;
5342 }
5343 return false;
5344 })
5345 .on( 'loading-overlay:hide complete.ic', function( e ) {
5346 if ( e.target === _self.$wrapper.get(0) ) {
5347 e.stopPropagation();
5348 _self.hide();
5349 return true;
5350 }
5351 return false;
5352 });
5353
5354 if( ['percentageProgress1', 'percentageProgress2'].includes(_self.options.effect) ) {
5355 $(window).on('load', function(){
5356 setTimeout(function(){
5357 _self.pageStatus = "complete";
5358
5359 $('.page-loader-progress').text(100);
5360
5361 if( ['percentageProgress2'].includes(_self.options.effect) ) {
5362 $('.loading-overlay-background-layer').css({
5363 width: '100%'
5364 });
5365 }
5366 }, _self.options.progressMinTimeout);
5367 });
5368 }
5369
5370 return this;
5371 },
5372
5373 show: function() {
5374 this.build();
5375
5376 this.position = this.$wrapper.css( 'position' ).toLowerCase();
5377 if ( this.position != 'relative' || this.position != 'absolute' || this.position != 'fixed' ) {
5378 this.$wrapper.css({
5379 position: 'relative'
5380 });
5381 }
5382 this.$wrapper.addClass( 'loading-overlay-showing' );
5383 },
5384
5385 hide: function() {
5386 var _self = this;
5387
5388 setTimeout(function() {
5389 _self.$wrapper.removeClass( 'loading-overlay-showing' );
5390
5391 if ( this.position != 'relative' || this.position != 'absolute' || this.position != 'fixed' ) {
5392 _self.$wrapper.css({ position: '' });
5393 }
5394
5395 $(window).trigger('loading.overlay.ready');
5396 }, _self.options.hideDelay);
5397 },
5398
5399 updateProgress: function() {
5400 var _self = this;
5401
5402 var render = function() {
5403 if(_self.pageStatus == "complete"){
5404 $('.page-loader-progress').text(100);
5405 setTimeout(function(){
5406 $('.page-loader-progress').addClass('d-none');
5407 }, 700);
5408 }
5409 else{
5410 if(_self.progress == null){
5411 _self.progress = 1;
5412 }
5413
5414 _self.progress = _self.progress + 1;
5415 if(_self.progress >= 0 && _self.progress <= 30){
5416 _self.animationInterval += 1;
5417 $('.page-loader-progress').text(_self.progress);
5418 }
5419 else if(_self.progress > 30 && _self.progress <= 60){
5420 _self.animationInterval += 2;
5421 $('.page-loader-progress').text(_self.progress);
5422 }
5423 else if(_self.progress > 60 && _self.progress <= 80){
5424 _self.animationInterval += 40;
5425 $('.page-loader-progress').text(_self.progress);
5426 }
5427 else if(_self.progress > 80 && _self.progress <= 90){
5428 _self.animationInterval += 80;
5429 $('.page-loader-progress').text(_self.progress);
5430 }
5431 else if(_self.progress > 90 && _self.progress <= 95){
5432 _self.animationInterval += 150;
5433 $('.page-loader-progress').text(_self.progress);
5434 }
5435 else if(_self.progress > 95 && _self.progress <= 99){
5436 _self.animationInterval += 400;
5437 $('.page-loader-progress').text(_self.progress);
5438 }
5439 else if(_self.progress >= 100){
5440 $('.page-loader-progress').text(99);
5441 }
5442
5443 if( ['percentageProgress2'].includes(_self.options.effect) ) {
5444 $('.loading-overlay-background-layer').css({
5445 width: _self.progress + '%'
5446 });
5447 }
5448
5449 self.loopInside = setTimeout(render, _self.animationInterval);
5450 }
5451
5452 }
5453 render();
5454
5455 return this;
5456 },
5457
5458 matchProperties: function() {
5459 var i,
5460 l,
5461 properties;
5462
5463 properties = [
5464 'backgroundColor',
5465 'borderRadius'
5466 ];
5467
5468 l = properties.length;
5469
5470 for( i = 0; i < l; i++ ) {
5471 var obj = {};
5472 obj[ properties[ i ] ] = this.$wrapper.css( properties[ i ] );
5473
5474 $.extend( this.options.css, obj );
5475 }
5476 },
5477
5478 getLoaderClass: function( backgroundColor ) {
5479 if ( !backgroundColor || backgroundColor === 'transparent' || backgroundColor === 'inherit' ) {
5480 return 'black';
5481 }
5482
5483 var hexColor,
5484 r,
5485 g,
5486 b,
5487 yiq;
5488
5489 var colorToHex = function( color ){
5490 var hex,
5491 rgb;
5492
5493 if( color.indexOf('#') >- 1 ){
5494 hex = color.replace('#', '');
5495 } else {
5496 rgb = color.match(/\d+/g);
5497 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);
5498 }
5499
5500 if ( hex.length === 3 ) {
5501 hex = hex + hex;
5502 }
5503
5504 return hex;
5505 };
5506
5507 hexColor = colorToHex( backgroundColor );
5508
5509 r = parseInt( hexColor.substr( 0, 2), 16 );
5510 g = parseInt( hexColor.substr( 2, 2), 16 );
5511 b = parseInt( hexColor.substr( 4, 2), 16 );
5512 yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;
5513
5514 return ( yiq >= 128 ) ? 'black' : 'white';
5515 },
5516
5517 dynamicShowHide: function( effect ) {
5518 var _self = this;
5519
5520 // Remove Loading Overlay Data
5521 $('body').removeData('loadingOverlay');
5522
5523 // Remove Html Of Loading Overlay
5524 $('.loading-overlay').remove();
5525
5526 if( effect == '' ) {
5527 return this;
5528 }
5529
5530 // Initialize New Loading Overlay (second parameter is to NO inherit data-plugin-options)
5531 $('body').loadingOverlay({
5532 effect: effect ? effect : 'pulse',
5533 isDynamicHideShow: true
5534 }, true);
5535
5536 // Show Loading Overlay Loader
5537 $('body').data('loadingOverlay').show();
5538
5539 // Hide Loading Overlay Loader
5540 setTimeout(function(){
5541 $('body').data('loadingOverlay').hide();
5542 }, 3000);
5543
5544 return this;
5545 },
5546
5547 dynamicShowHideEvents: function() {
5548 var _self = this;
5549
5550 // Button
5551 $(document).off('click.loading-overlay-button').on('click.loading-overlay-button', '.loading-overlay-button', function(e){
5552 e.preventDefault();
5553
5554 _self.dynamicShowHide( $(this).data('effect') );
5555 });
5556
5557 // Select
5558 $(document).off('change.loading-overlay-select').on('change.loading-overlay-select', '.loading-overlay-select', function(){
5559 _self.dynamicShowHide( $(this).val() );
5560 });
5561
5562 return this;
5563 }
5564
5565 };
5566
5567 // expose to scope
5568 $.extend(theme, {
5569 LoadingOverlay: LoadingOverlay
5570 });
5571
5572 // expose as a jquery plugin
5573 $.fn.loadingOverlay = function( opts, noInheritOptions ) {
5574 return this.each(function() {
5575 var $this = $( this );
5576
5577 var loadingOverlay = $this.data( 'loadingOverlay' );
5578 if ( loadingOverlay ) {
5579 return loadingOverlay;
5580 } else {
5581 var options = opts || $this.data( 'loading-overlay-options' ) || {};
5582 return new LoadingOverlay( $this, options, noInheritOptions );
5583 }
5584 });
5585 }
5586
5587 // auto init
5588 $('[data-loading-overlay]').loadingOverlay();
5589
5590}).apply(this, [window.theme, jQuery]);
5591
5592// Masonry
5593(function(theme, $) {
5594
5595 theme = theme || {};
5596
5597 var instanceName = '__masonry';
5598
5599 var PluginMasonry = function($el, opts) {
5600 return this.initialize($el, opts);
5601 };
5602
5603 PluginMasonry.defaults = {
5604
5605 };
5606
5607 PluginMasonry.prototype = {
5608 initialize: function($el, opts) {
5609 if ($el.data(instanceName)) {
5610 return this;
5611 }
5612
5613 this.$el = $el;
5614
5615 this
5616 .setData()
5617 .setOptions(opts)
5618 .build();
5619
5620 return this;
5621 },
5622
5623 setData: function() {
5624 this.$el.data(instanceName, this);
5625
5626 return this;
5627 },
5628
5629 setOptions: function(opts) {
5630 this.options = $.extend(true, {}, PluginMasonry.defaults, opts, {
5631 wrapper: this.$el
5632 });
5633
5634 return this;
5635 },
5636
5637 build: function() {
5638 if (!($.isFunction($.fn.isotope))) {
5639 return this;
5640 }
5641
5642 var self = this,
5643 $window = $(window);
5644
5645 self.$loader = false;
5646
5647 if (self.options.wrapper.parents('.masonry-loader').get(0)) {
5648 self.$loader = self.options.wrapper.parents('.masonry-loader');
5649 self.createLoader();
5650 }
5651
5652 self.options.wrapper.one('layoutComplete', function(event, laidOutItems) {
5653 self.removeLoader();
5654 });
5655
5656 self.options.wrapper.waitForImages(function() {
5657 self.options.wrapper.isotope(self.options);
5658 });
5659
5660 // IE10/11 fix
5661 if( $('html').hasClass('ie10') || $('html').hasClass('ie11') ) {
5662 var padding = parseInt( self.options.wrapper.children().css('padding-left') ) + parseInt( self.options.wrapper.children().css('padding-right') );
5663 }
5664
5665 $(window).on('resize', function() {
5666 setTimeout(function() {
5667 self.options.wrapper.isotope('layout');
5668 }, 300);
5669 });
5670
5671 setTimeout(function() {
5672 self.removeLoader();
5673 }, 3000);
5674
5675 return this;
5676 },
5677
5678 createLoader: function() {
5679 var self = this;
5680
5681 var loaderTemplate = [
5682 '<div class="bounce-loader">',
5683 '<div class="bounce1"></div>',
5684 '<div class="bounce2"></div>',
5685 '<div class="bounce3"></div>',
5686 '</div>'
5687 ].join('');
5688
5689 self.$loader.append(loaderTemplate);
5690
5691 return this;
5692 },
5693
5694 removeLoader: function() {
5695
5696 var self = this;
5697
5698 if (self.$loader) {
5699
5700 self.$loader.removeClass('masonry-loader-showing');
5701
5702 setTimeout(function() {
5703 self.$loader.addClass('masonry-loader-loaded');
5704 }, 300);
5705
5706 }
5707
5708 }
5709 };
5710
5711 // expose to scope
5712 $.extend(theme, {
5713 PluginMasonry: PluginMasonry
5714 });
5715
5716 // jquery plugin
5717 $.fn.themePluginMasonry = function(opts) {
5718 return this.map(function() {
5719 var $this = $(this);
5720
5721 if ($this.data(instanceName)) {
5722 return $this.data(instanceName);
5723 } else {
5724 return new PluginMasonry($this, opts);
5725 }
5726
5727 });
5728 }
5729
5730}).apply(this, [window.theme, jQuery]);
5731
5732// Match Height
5733(function(theme, $) {
5734
5735 theme = theme || {};
5736
5737 var instanceName = '__matchHeight';
5738
5739 var PluginMatchHeight = function($el, opts) {
5740 return this.initialize($el, opts);
5741 };
5742
5743 PluginMatchHeight.defaults = {
5744 byRow: true,
5745 property: 'height',
5746 target: null,
5747 remove: false
5748 };
5749
5750 PluginMatchHeight.prototype = {
5751 initialize: function($el, opts) {
5752 if ($el.data(instanceName)) {
5753 return this;
5754 }
5755
5756 this.$el = $el;
5757
5758 this
5759 .setData()
5760 .setOptions(opts)
5761 .build();
5762
5763 return this;
5764 },
5765
5766 setData: function() {
5767 this.$el.data(instanceName, this);
5768
5769 return this;
5770 },
5771
5772 setOptions: function(opts) {
5773 this.options = $.extend(true, {}, PluginMatchHeight.defaults, opts, {
5774 wrapper: this.$el
5775 });
5776
5777 return this;
5778 },
5779
5780 build: function() {
5781 if (!($.isFunction($.fn.matchHeight))) {
5782 return this;
5783 }
5784
5785 var self = this;
5786
5787 self.options.wrapper.matchHeight(self.options);
5788
5789 return this;
5790 }
5791
5792 };
5793
5794 // expose to scope
5795 $.extend(theme, {
5796 PluginMatchHeight: PluginMatchHeight
5797 });
5798
5799 // jquery plugin
5800 $.fn.themePluginMatchHeight = function(opts) {
5801 return this.map(function() {
5802 var $this = $(this);
5803
5804 if ($this.data(instanceName)) {
5805 return $this.data(instanceName);
5806 } else {
5807 return new PluginMatchHeight($this, opts);
5808 }
5809
5810 });
5811 }
5812
5813}).apply(this, [window.theme, jQuery]);
5814
5815// Parallax
5816(function(theme, $) {
5817
5818 theme = theme || {};
5819
5820 var instanceName = '__parallax';
5821
5822 var PluginParallax = function($el, opts) {
5823 return this.initialize($el, opts);
5824 };
5825
5826 PluginParallax.defaults = {
5827 speed: 1.5,
5828 horizontalPosition: '50%',
5829 offset: 0,
5830 parallaxDirection: 'top',
5831 parallaxHeight: '180%',
5832 scrollableParallax: false,
5833 scrollableParallaxMinWidth: 991,
5834 startOffset: 7,
5835 transitionDuration: '200ms',
5836 cssProperty: 'width',
5837 cssValueStart: 40,
5838 cssValueEnd: 100,
5839 cssValueUnit: 'vw'
5840 };
5841
5842 PluginParallax.prototype = {
5843 initialize: function($el, opts) {
5844 if ($el.data(instanceName)) {
5845 return this;
5846 }
5847
5848 this.$el = $el;
5849
5850 this
5851 .setData()
5852 .setOptions(opts)
5853 .build();
5854
5855 return this;
5856 },
5857
5858 setData: function() {
5859 this.$el.data(instanceName, this);
5860
5861 return this;
5862 },
5863
5864 setOptions: function(opts) {
5865 this.options = $.extend(true, {}, PluginParallax.defaults, opts, {
5866 wrapper: this.$el
5867 });
5868
5869 return this;
5870 },
5871
5872 build: function() {
5873 var self = this,
5874 $window = $(window),
5875 offset,
5876 yPos,
5877 bgpos,
5878 background,
5879 rotateY;
5880
5881 // Scrollable
5882 if( self.options.scrollableParallax && $(window).width() > self.options.scrollableParallaxMinWidth ) {
5883 var $scrollableWrapper = self.options.wrapper.find('.scrollable-parallax-wrapper');
5884
5885 if( $scrollableWrapper.get(0) ) {
5886
5887 var progress = ( $(window).scrollTop() > ( self.options.wrapper.offset().top + $(window).outerHeight() ) ) ? self.options.cssValueEnd : self.options.cssValueStart,
5888 cssValueUnit = self.options.cssValueUnit ? self.options.cssValueUnit : '';
5889
5890 $scrollableWrapper.css({
5891 'background-image' : 'url(' + self.options.wrapper.data('image-src') + ')',
5892 'background-size' : 'cover',
5893 'background-position' : 'center',
5894 'background-attachment' : 'fixed',
5895 'transition' : 'ease '+ self.options.cssProperty +' '+ self.options.transitionDuration,
5896 'width' : progress + '%'
5897 });
5898
5899 $(window).on('scroll', function(e){
5900 if( self.options.wrapper.visible( true ) ) {
5901 var $window = $(window),
5902 scrollTop = $window.scrollTop(),
5903 elementOffset = self.options.wrapper.offset().top,
5904 currentElementOffset = (elementOffset - scrollTop);
5905
5906 var scrollPercent = Math.abs( +( currentElementOffset - $window.height() ) / (self.options.startOffset ? self.options.startOffset : 7) );
5907
5908 // Increment progress value according scroll position
5909 if( scrollPercent <= self.options.cssValueEnd && progress <= self.options.cssValueEnd ) {
5910 progress = self.options.cssValueStart + scrollPercent;
5911 }
5912
5913 // Adjust CSS end value
5914 if( progress > self.options.cssValueEnd ) {
5915 progress = self.options.cssValueEnd;
5916 }
5917
5918 // Adjust CSS start value
5919 if( progress < self.options.cssValueStart ) {
5920 progress = self.options.cssValueStart;
5921 }
5922
5923 var styles = {}
5924 styles[self.options.cssProperty] = progress + cssValueUnit;
5925
5926 $scrollableWrapper.css(styles);
5927 }
5928 });
5929
5930 }
5931
5932 return;
5933 }
5934
5935 // Create Parallax Element
5936 if( self.options.fadeIn ) {
5937 background = $('<div class="parallax-background fadeIn animated"></div>');
5938 } else {
5939 background = $('<div class="parallax-background"></div>');
5940 }
5941
5942 // Set Style for Parallax Element
5943 background.css({
5944 'background-image' : 'url(' + self.options.wrapper.data('image-src') + ')',
5945 'background-size' : 'cover',
5946 'position' : 'absolute',
5947 'top' : 0,
5948 'left' : 0,
5949 'width' : '100%',
5950 'height' : self.options.parallaxHeight
5951 });
5952
5953 // Add Parallax Element on DOM
5954 self.options.wrapper.prepend(background);
5955
5956 // Set Overlfow Hidden and Position Relative to Parallax Wrapper
5957 self.options.wrapper.css({
5958 'position' : 'relative',
5959 'overflow' : 'hidden'
5960 });
5961
5962 // Parallax Effect on Scroll & Resize
5963 var parallaxEffectOnScrolResize = function() {
5964 $window.on('scroll resize', function() {
5965 offset = self.options.wrapper.offset();
5966 yPos = -($window.scrollTop() - (offset.top - 100)) / ((self.options.speed + 2 ));
5967 plxPos = (yPos < 0) ? Math.abs(yPos) : -Math.abs(yPos);
5968 rotateY = ( $('html[dir="rtl"]').get(0) ) ? ' rotateY(180deg)' : ''; // RTL
5969
5970 if( self.options.parallaxDirection == 'bottom' ) {
5971 self.options.offset = 250;
5972 }
5973
5974 var y = ( (plxPos - 50) + (self.options.offset) );
5975 if( self.options.parallaxDirection == 'bottom' ) {
5976 y = ( y < 0 ) ? Math.abs( y ) : -Math.abs( y );
5977 }
5978
5979 background.css({
5980 'transform' : 'translate3d(0, '+ y +'px, 0)' + rotateY,
5981 'background-position-x' : self.options.horizontalPosition
5982 });
5983 });
5984
5985 $window.trigger('scroll');
5986 }
5987
5988 if (!$.browser.mobile) {
5989 parallaxEffectOnScrolResize();
5990 } else {
5991 if( self.options.enableOnMobile == true ) {
5992 parallaxEffectOnScrolResize();
5993 } else {
5994 self.options.wrapper.addClass('parallax-disabled');
5995 }
5996 }
5997
5998 return this;
5999 }
6000 };
6001
6002 // expose to scope
6003 $.extend(theme, {
6004 PluginParallax: PluginParallax
6005 });
6006
6007 // jquery plugin
6008 $.fn.themePluginParallax = function(opts) {
6009 return this.map(function() {
6010 var $this = $(this);
6011
6012 if ($this.data(instanceName)) {
6013 return $this.data(instanceName);
6014 } else {
6015 return new PluginParallax($this, opts);
6016 }
6017
6018 });
6019 }
6020
6021}).apply(this, [window.theme, jQuery]);
6022
6023// Progress Bar
6024(function(theme, $) {
6025
6026 theme = theme || {};
6027
6028 var instanceName = '__progressBar';
6029
6030 var PluginProgressBar = function($el, opts) {
6031 return this.initialize($el, opts);
6032 };
6033
6034 PluginProgressBar.defaults = {
6035 accX: 0,
6036 accY: -50,
6037 delay: 1
6038 };
6039
6040 PluginProgressBar.prototype = {
6041 initialize: function($el, opts) {
6042 if ($el.data(instanceName)) {
6043 return this;
6044 }
6045
6046 this.$el = $el;
6047
6048 this
6049 .setData()
6050 .setOptions(opts)
6051 .build();
6052
6053 return this;
6054 },
6055
6056 setData: function() {
6057 this.$el.data(instanceName, this);
6058
6059 return this;
6060 },
6061
6062 setOptions: function(opts) {
6063 this.options = $.extend(true, {}, PluginProgressBar.defaults, opts, {
6064 wrapper: this.$el
6065 });
6066
6067 return this;
6068 },
6069
6070 build: function() {
6071 var self = this,
6072 $el = this.options.wrapper,
6073 delay = 1;
6074
6075 delay = ($el.attr('data-appear-animation-delay') ? $el.attr('data-appear-animation-delay') : self.options.delay);
6076
6077 $el.addClass($el.attr('data-appear-animation'));
6078
6079 setTimeout(function() {
6080
6081 $el.animate({
6082 width: $el.attr('data-appear-progress-animation')
6083 }, 1500, 'easeOutQuad', function() {
6084 $el.find('.progress-bar-tooltip').animate({
6085 opacity: 1
6086 }, 500, 'easeOutQuad');
6087 });
6088
6089 }, delay);
6090
6091 return this;
6092 }
6093 };
6094
6095 // expose to scope
6096 $.extend(theme, {
6097 PluginProgressBar: PluginProgressBar
6098 });
6099
6100 // jquery plugin
6101 $.fn.themePluginProgressBar = function(opts) {
6102 return this.map(function() {
6103 var $this = $(this);
6104
6105 if ($this.data(instanceName)) {
6106 return $this.data(instanceName);
6107 } else {
6108 return new PluginProgressBar($this, opts);
6109 }
6110
6111 });
6112 }
6113
6114}).apply(this, [window.theme, jQuery]);
6115
6116// Read More
6117(function(theme, $) {
6118
6119 theme = theme || {};
6120
6121 var instanceName = '__readmore';
6122
6123 var PluginReadMore = function($el, opts) {
6124 return this.initialize($el, opts);
6125 };
6126
6127 PluginReadMore.defaults = {
6128 buttonOpenLabel: 'Read More <i class="fas fa-chevron-down text-2 ml-1"></i>',
6129 buttonCloseLabel: 'Read Less <i class="fas fa-chevron-up text-2 ml-1"></i>',
6130 enableToggle: true,
6131 maxHeight: 110,
6132 overlayColor: '#FFF',
6133 overlayHeight: 100,
6134 startOpened: false,
6135 align: 'left'
6136 };
6137
6138 PluginReadMore.prototype = {
6139 initialize: function($el, opts) {
6140 var self = this;
6141
6142 this.$el = $el;
6143
6144 this
6145 .setData()
6146 .setOptions(opts)
6147 .build()
6148 .events();
6149
6150 if( self.options.startOpened ) {
6151 self.options.wrapper.find('.readmore-button-wrapper > a').trigger('click');
6152 }
6153
6154 return this;
6155 },
6156
6157 setData: function() {
6158 this.$el.data(instanceName, this);
6159
6160 return this;
6161 },
6162
6163 setOptions: function(opts) {
6164 this.options = $.extend(true, {}, PluginReadMore.defaults, opts, {
6165 wrapper: this.$el
6166 });
6167
6168 return this;
6169 },
6170
6171 build: function() {
6172 var self = this;
6173
6174 self.options.wrapper.addClass('position-relative');
6175
6176 // Overlay
6177 self.options.wrapper.append( '<div class="readmore-overlay"></div>' );
6178
6179 // Check if is Safari
6180 var backgroundCssValue = 'linear-gradient(180deg, rgba(2, 0, 36, 0) 0%, '+ self.options.overlayColor +' 100%)';
6181 if( $('html').hasClass('safari') ) {
6182 backgroundCssValue = '-webkit-linear-gradient(top, rgba(2, 0, 36, 0) 0%, '+ self.options.overlayColor +' 100%)'
6183 }
6184
6185 self.options.wrapper.find('.readmore-overlay').css({
6186 background: backgroundCssValue,
6187 position: 'absolute',
6188 bottom: 0,
6189 left: 0,
6190 width: '100%',
6191 height: self.options.overlayHeight,
6192 'z-index': 1
6193 });
6194
6195 // Read More Button
6196 self.options.wrapper.find('.readmore-button-wrapper').removeClass('d-none').css({
6197 position: 'absolute',
6198 bottom: 0,
6199 left: 0,
6200 width: '100%',
6201 'z-index': 2
6202 });
6203
6204 // Button Label
6205 self.options.wrapper.find('.readmore-button-wrapper > a').html( self.options.buttonOpenLabel );
6206
6207 self.options.wrapper.css({
6208 'height': self.options.maxHeight,
6209 'overflow-y': 'hidden'
6210 });
6211
6212 // Alignment
6213 switch ( self.options.align ) {
6214 case 'center':
6215 self.options.wrapper.find('.readmore-button-wrapper').addClass('text-center');
6216 break;
6217
6218 case 'right':
6219 self.options.wrapper.find('.readmore-button-wrapper').addClass('text-right');
6220 break;
6221
6222 case 'left':
6223 default:
6224 self.options.wrapper.find('.readmore-button-wrapper').addClass('text-left');
6225 break;
6226 }
6227
6228 return this;
6229
6230 },
6231
6232 events: function() {
6233 var self = this;
6234
6235 // Read More
6236 self.readMore = function() {
6237 self.options.wrapper.find('.readmore-button-wrapper > a:not(.readless)').on('click', function(e){
6238 e.preventDefault();
6239
6240 var $this = $(this);
6241
6242 setTimeout(function(){
6243 self.options.wrapper.animate({
6244 'height': self.options.wrapper[0].scrollHeight
6245 }, function(){
6246 if( !self.options.enableToggle ) {
6247 $this.fadeOut();
6248 }
6249
6250 $this.html( self.options.buttonCloseLabel ).addClass('readless').off('click');
6251
6252 self.readLess();
6253
6254 self.options.wrapper.find('.readmore-overlay').fadeOut();
6255 self.options.wrapper.css({
6256 'max-height': 'none',
6257 'overflow': 'visible'
6258 });
6259
6260 self.options.wrapper.find('.readmore-button-wrapper').animate({
6261 bottom: -20
6262 });
6263 });
6264 }, 200);
6265 });
6266 }
6267
6268 // Read Less
6269 self.readLess = function() {
6270 self.options.wrapper.find('.readmore-button-wrapper > a.readless').on('click', function(e){
6271 e.preventDefault();
6272
6273 var $this = $(this);
6274
6275 // Button
6276 self.options.wrapper.find('.readmore-button-wrapper').animate({
6277 bottom: 0
6278 });
6279
6280 // Overlay
6281 self.options.wrapper.find('.readmore-overlay').fadeIn();
6282
6283 setTimeout(function(){
6284 self.options.wrapper.height(self.options.wrapper[0].scrollHeight).animate({
6285 'height': self.options.maxHeight
6286 }, function(){
6287 $this.html( self.options.buttonOpenLabel ).removeClass('readless').off('click');
6288
6289 self.readMore();
6290
6291 self.options.wrapper.css({
6292 'overflow': 'hidden'
6293 });
6294 });
6295 }, 200);
6296 });
6297 }
6298
6299 // First Load
6300 self.readMore();
6301
6302 return this;
6303 }
6304 };
6305
6306 // expose to scope
6307 $.extend(theme, {
6308 PluginReadMore: PluginReadMore
6309 });
6310
6311 // jquery plugin
6312 $.fn.themePluginReadMore = function(opts) {
6313 return this.map(function() {
6314 var $this = $(this);
6315
6316 if ($this.data(instanceName)) {
6317 return $this.data(instanceName);
6318 } else {
6319 return new PluginReadMore($this, opts);
6320 }
6321
6322 });
6323 }
6324
6325}).apply(this, [window.theme, jQuery]);
6326
6327// Revolution Slider
6328(function(theme, $) {
6329
6330 theme = theme || {};
6331
6332 var instanceName = '__revolution';
6333
6334 var PluginRevolutionSlider = function($el, opts) {
6335 return this.initialize($el, opts);
6336 };
6337
6338 PluginRevolutionSlider.defaults = {
6339 sliderType: 'standard',
6340 sliderLayout: 'fullwidth',
6341 delay: 9000,
6342 gridwidth: 1170,
6343 gridheight: 500,
6344 spinner: 'spinner3',
6345 disableProgressBar: 'on',
6346 parallax: {
6347 type: 'off',
6348 bgparallax: 'off'
6349 },
6350 navigation: {
6351 keyboardNavigation: 'off',
6352 keyboard_direction: 'horizontal',
6353 mouseScrollNavigation: 'off',
6354 onHoverStop: 'off',
6355 touch: {
6356 touchenabled: 'on',
6357 swipe_threshold: 75,
6358 swipe_min_touches: 1,
6359 swipe_direction: 'horizontal',
6360 drag_block_vertical: false
6361 },
6362 arrows: {
6363 enable: true,
6364 hide_onmobile: false,
6365 hide_under: 0,
6366 hide_onleave: true,
6367 hide_delay: 200,
6368 hide_delay_mobile: 1200,
6369 left: {
6370 h_align: 'left',
6371 v_align: 'center',
6372 h_offset: 30,
6373 v_offset: 0
6374 },
6375 right: {
6376 h_align: 'right',
6377 v_align: 'center',
6378 h_offset: 30,
6379 v_offset: 0
6380 }
6381 }
6382 },
6383
6384 /* ADDONS */
6385 addOnTypewriter: {
6386 enable: false
6387 },
6388 addOnWhiteboard: {
6389 enable: false,
6390
6391 },
6392 whiteboard: {
6393 movehand: {
6394 src: '../vendor/rs-plugin/revolution-addons/whiteboard/assets/images/hand_point_right.png',
6395 width: 400,
6396 height: 1000,
6397 handtype: 'right',
6398 transform: {
6399 transformX: 50,
6400 transformY: 50
6401 },
6402 jittering: {
6403 distance: '80',
6404 distance_horizontal: '100',
6405 repeat: '5',
6406 offset: '10',
6407 offset_horizontal: '0'
6408 },
6409 rotation: {
6410 angle: '10',
6411 repeat: '3'
6412 }
6413 },
6414 writehand: {
6415 src: '../vendor/rs-plugin/revolution-addons/whiteboard/assets/images/write_right_angle.png',
6416 width: 572,
6417 height: 691,
6418 handtype: 'right',
6419 transform: {
6420 transformX: 50,
6421 transformY: 50
6422 },
6423 jittering: {
6424 distance: '80',
6425 distance_horizontal: '100',
6426 repeat: '5',
6427 offset: '10',
6428 offset_horizontal: '0'
6429 },
6430 rotation:{
6431 angle: '10',
6432 repeat: '3'
6433 }
6434 }
6435 },
6436 addOnParticles: {
6437 enable: false
6438 },
6439 particles: {
6440 startSlide: "first",
6441 endSlide: "last",
6442 zIndex: "1",
6443 particles: {
6444 number: {value: 80}, color: {value: "#ffffff"},
6445 shape: {
6446 type: "circle", stroke: {width: 0, color: "#ffffff", opacity: 1},
6447 image: {src: ""}
6448 },
6449 opacity: {value: 0.5, random: true, min: 0.25, anim: {enable: false, speed: 3, opacity_min: 0, sync: false}},
6450 size: {value: 2, random: false, min: 30, anim: {enable: false, speed: 40, size_min: 1, sync: false}},
6451 line_linked: {enable: true, distance: 150, color: "#ffffff", opacity: 0.4, width: 1},
6452 move: {enable: true, speed: 6, direction: "none", random: true, min_speed: 6, straight: false, out_mode: "out"}
6453 },
6454 interactivity: {
6455 events: {onhover: {enable: false, mode: "repulse"}, onclick: {enable: false, mode: "repulse"}},
6456 modes: {grab: {distance: 400, line_linked: {opacity: 0.5}}, bubble: {distance: 400, size: 40, opacity: 0.4}, repulse: {distance: 200}}
6457 }
6458 },
6459 addOnCountdown: {
6460 enable: false,
6461 targetdate: new Date().getTime() + 864000000, // http://www.freeformatter.com/epoch-timestamp-to-date-converter.html
6462 slidechanges: [{days: 0, hours: 0, minutes: 0, seconds: 0, slide: 2}]
6463 },
6464 addOnSlicey: {
6465 enable: false
6466 },
6467 addOnFilmstrip: {
6468 enable: false
6469 },
6470 addOnBeforeAfter : {
6471 enable: false,
6472 options: {
6473 cursor: "move",
6474 carousel: false,
6475 arrowStyles: {
6476 leftIcon: "fa-icon-caret-left",
6477 rightIcon: "fa-icon-caret-right",
6478 topIcon: "fa-icon-caret-up",
6479 bottomIcon: "fa-icon-caret-down",
6480 size: "35",
6481 color: "#ffffff",
6482 spacing: "10",
6483 bgColor: "transparent",
6484 padding: "0",
6485 borderRadius: "0"
6486 },
6487 dividerStyles: {
6488 width: "1",
6489 color: "rgba(255, 255, 255, 0.5)"
6490 }
6491 }
6492 },
6493 addOnPanorama: {
6494 enable: false
6495 },
6496 addOnRevealer: {
6497 enable: false,
6498 },
6499 revealer: {
6500 direction: "open_horizontal",
6501 color: "#ffffff",
6502 duration: "1500",
6503 delay: "0",
6504 easing: "Power2.easeInOut",
6505 overlay_enabled: true,
6506 overlay_color: "#000000",
6507 overlay_duration: "1500",
6508 overlay_delay: "0",
6509 overlay_easing: "Power2.easeInOut",
6510 spinner: "1",
6511 spinnerColor: "#006dd2",
6512 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 \/>"
6513 },
6514 addOnDuotone: {
6515 enable: false
6516 },
6517 addOnBubblemorph: {
6518 enable: false
6519 },
6520 addOnDistortion: {
6521 enable: false
6522 }
6523
6524 };
6525
6526 PluginRevolutionSlider.prototype = {
6527 initialize: function($el, opts) {
6528 if ($el.data(instanceName)) {
6529 return this;
6530 }
6531
6532 this.$el = $el;
6533
6534 this
6535 .setData()
6536 .setOptions(opts)
6537 .build()
6538 .events();
6539
6540 return this;
6541 },
6542
6543 setData: function() {
6544 this.$el.data(instanceName, this);
6545
6546 return this;
6547 },
6548
6549 setOptions: function(opts) {
6550 this.options = $.extend(true, {}, PluginRevolutionSlider.defaults, opts, {
6551 wrapper: this.$el
6552 });
6553
6554 return this;
6555 },
6556
6557 build: function() {
6558 if (!($.isFunction($.fn.revolution))) {
6559 return this;
6560 }
6561
6562 // Single Slider Class
6563 if(this.options.wrapper.find('> ul > li').length == 1) {
6564 this.options.wrapper.addClass('slider-single-slide');
6565
6566 // Remove Bullets
6567 // this.options.navigation.bullets.enable = false;
6568 $.extend(this.options.navigation, {
6569 bullets: {
6570 enable: false
6571 }
6572 });
6573
6574 }
6575
6576 // Full Screen Class
6577 if(this.options.sliderLayout == 'fullscreen') {
6578 this.options.wrapper.closest('.slider-container').addClass('fullscreen-slider');
6579 }
6580
6581 // Initialize Revolution Slider
6582 this.options.wrapper.revolution(this.options);
6583
6584 // Addon Init - Typewriter
6585 if(this.options.addOnTypewriter.enable) {
6586 RsTypewriterAddOn($, this.options.wrapper);
6587 }
6588
6589 // Addon Init - Whiteboard
6590 if(this.options.addOnWhiteboard.enable) {
6591 this.options.wrapper.rsWhiteBoard();
6592 }
6593
6594 // Addon Init - Particles
6595 if(this.options.addOnParticles.enable) {
6596 RsParticlesAddOn(this.options.wrapper);
6597 }
6598
6599 // Addon Init - Countdown
6600 if(this.options.addOnCountdown.enable) {
6601 tp_countdown(this.options.wrapper, this.options.addOnCountdown.targetdate, this.options.addOnCountdown.slidechanges);
6602 }
6603
6604 // Addon Init - Slicey
6605 if(this.options.addOnSlicey.enable) {
6606 this.options.wrapper.revSliderSlicey();
6607 }
6608
6609 // Addon Init - Filmstrip
6610 if(this.options.addOnFilmstrip.enable) {
6611 RsFilmstripAddOn($, this.options.wrapper, '../vendor/rs-plugin/revolution-addons/filmstrip/', false);
6612 }
6613
6614 // Addon Init - Before After
6615 if(this.options.addOnBeforeAfter.enable) {
6616 RevSliderBeforeAfter($, this.options.wrapper, this.options.addOnBeforeAfter.options);
6617 }
6618
6619 // Addon Init - Panorama
6620 if(this.options.addOnPanorama.enable) {
6621 RsAddonPanorama($, this.options.wrapper);
6622 }
6623
6624 // Addon Init - Revealer
6625 if(this.options.addOnRevealer.enable) {
6626 RsRevealerAddOn($, this.options.wrapper, this.options.revealer.spinnerHtml);
6627 }
6628
6629 // Addon Init - Duotone
6630 if(this.options.addOnDuotone.enable) {
6631 RsAddonDuotone($, this.options.wrapper, true, "cubic-bezier(0.645, 0.045, 0.355, 1.000)", "1000");
6632 }
6633
6634 // Addon Init - Bubblemorph
6635 if(this.options.addOnBubblemorph.enable) {
6636 BubbleMorphAddOn($, this.options.wrapper, false);
6637 }
6638
6639 // Addon Init - Distortion
6640 if(this.options.addOnDistortion.enable) {
6641 RsLiquideffectAddOn($, this.options.wrapper);
6642 }
6643
6644 return this;
6645 },
6646
6647 events: function() {
6648
6649 return this;
6650 }
6651 };
6652
6653 // expose to scope
6654 $.extend(theme, {
6655 PluginRevolutionSlider: PluginRevolutionSlider
6656 });
6657
6658 // jquery plugin
6659 $.fn.themePluginRevolutionSlider = function(opts) {
6660 return this.map(function() {
6661 var $this = $(this);
6662
6663 if ($this.data(instanceName)) {
6664 return $this.data(instanceName);
6665 } else {
6666 return new PluginRevolutionSlider($this, opts);
6667 }
6668
6669 });
6670 }
6671
6672}).apply(this, [window.theme, jQuery]);
6673
6674// Scroll to Top
6675(function(theme, $) {
6676
6677 theme = theme || {};
6678
6679 $.extend(theme, {
6680
6681 PluginScrollToTop: {
6682
6683 defaults: {
6684 wrapper: $('body'),
6685 offset: 150,
6686 buttonClass: 'scroll-to-top',
6687 iconClass: 'fas fa-chevron-up',
6688 delay: 1000,
6689 visibleMobile: false,
6690 label: false,
6691 easing: 'easeOutBack'
6692 },
6693
6694 initialize: function(opts) {
6695 initialized = true;
6696
6697 // Don't initialize if the page has Section Scroll
6698 if( $('body[data-plugin-section-scroll]').get(0) ) {
6699 return;
6700 }
6701
6702 this
6703 .setOptions(opts)
6704 .build()
6705 .events();
6706
6707 return this;
6708 },
6709
6710 setOptions: function(opts) {
6711 this.options = $.extend(true, {}, this.defaults, opts);
6712
6713 return this;
6714 },
6715
6716 build: function() {
6717 var self = this,
6718 $el;
6719
6720 // Base HTML Markup
6721 $el = $('<a />')
6722 .addClass(self.options.buttonClass)
6723 .attr({
6724 'href': '#',
6725 })
6726 .append(
6727 $('<i />')
6728 .addClass(self.options.iconClass)
6729 );
6730
6731 // Visible Mobile
6732 if (!self.options.visibleMobile) {
6733 $el.addClass('hidden-mobile');
6734 }
6735
6736 // Label
6737 if (self.options.label) {
6738 $el.append(
6739 $('<span />').html(self.options.label)
6740 );
6741 }
6742
6743 this.options.wrapper.append($el);
6744
6745 this.$el = $el;
6746
6747 return this;
6748 },
6749
6750 events: function() {
6751 var self = this,
6752 _isScrolling = false;
6753
6754 // Click Element Action
6755 self.$el.on('click', function(e) {
6756 e.preventDefault();
6757 $('body, html').animate({
6758 scrollTop: 0
6759 }, self.options.delay, self.options.easing);
6760 return false;
6761 });
6762
6763 // Show/Hide Button on Window Scroll event.
6764 $(window).scroll(function() {
6765
6766 if (!_isScrolling) {
6767
6768 _isScrolling = true;
6769
6770 if ($(window).scrollTop() > self.options.offset) {
6771
6772 self.$el.stop(true, true).addClass('visible');
6773 _isScrolling = false;
6774
6775 } else {
6776
6777 self.$el.stop(true, true).removeClass('visible');
6778 _isScrolling = false;
6779
6780 }
6781
6782 }
6783
6784 });
6785
6786 return this;
6787 }
6788
6789 }
6790
6791 });
6792
6793}).apply(this, [window.theme, jQuery]);
6794
6795// Scrollable
6796(function(theme, $) {
6797
6798 theme = theme || {};
6799
6800 var instanceName = '__scrollable';
6801
6802 var PluginScrollable = function($el, opts) {
6803 return this.initialize($el, opts);
6804 };
6805
6806 PluginScrollable.updateModals = function() {
6807 PluginScrollable.updateBootstrapModal();
6808 };
6809
6810 PluginScrollable.updateBootstrapModal = function() {
6811 var updateBoostrapModal;
6812
6813 updateBoostrapModal = typeof $.fn.modal !== 'undefined';
6814 updateBoostrapModal = updateBoostrapModal && typeof $.fn.modal.Constructor !== 'undefined';
6815 updateBoostrapModal = updateBoostrapModal && typeof $.fn.modal.Constructor.prototype !== 'undefined';
6816 updateBoostrapModal = updateBoostrapModal && typeof $.fn.modal.Constructor.prototype.enforceFocus !== 'undefined';
6817
6818 if ( !updateBoostrapModal ) {
6819 return false;
6820 }
6821
6822 var originalFocus = $.fn.modal.Constructor.prototype.enforceFocus;
6823 $.fn.modal.Constructor.prototype.enforceFocus = function() {
6824 originalFocus.apply( this );
6825
6826 var $scrollable = this.$element.find('.scrollable');
6827 if ( $scrollable ) {
6828 if ( $.isFunction($.fn['themePluginScrollable']) ) {
6829 $scrollable.themePluginScrollable();
6830 }
6831
6832 if ( $.isFunction($.fn['nanoScroller']) ) {
6833 $scrollable.nanoScroller();
6834 }
6835 }
6836 };
6837 };
6838
6839 PluginScrollable.defaults = {
6840 contentClass: 'scrollable-content',
6841 paneClass: 'scrollable-pane',
6842 sliderClass: 'scrollable-slider',
6843 alwaysVisible: true,
6844 preventPageScrolling: true
6845 };
6846
6847 PluginScrollable.prototype = {
6848 initialize: function($el, opts) {
6849 if ( $el.data( instanceName ) ) {
6850 return this;
6851 }
6852
6853 this.$el = $el;
6854
6855 this
6856 .setData()
6857 .setOptions(opts)
6858 .build();
6859
6860 return this;
6861 },
6862
6863 setData: function() {
6864 this.$el.data(instanceName, this);
6865
6866 return this;
6867 },
6868
6869 setOptions: function(opts) {
6870 this.options = $.extend(true, {}, PluginScrollable.defaults, opts, {
6871 wrapper: this.$el
6872 });
6873
6874 return this;
6875 },
6876
6877 build: function() {
6878 this.options.wrapper.nanoScroller(this.options);
6879
6880 return this;
6881 }
6882 };
6883
6884 // expose to scope
6885 $.extend(theme, {
6886 PluginScrollable: PluginScrollable
6887 });
6888
6889 // jquery plugin
6890 $.fn.themePluginScrollable = function(opts) {
6891 return this.each(function() {
6892 var $this = $(this);
6893
6894 if ($this.data(instanceName)) {
6895 return $this.data(instanceName);
6896 } else {
6897 return new PluginScrollable($this, opts);
6898 }
6899
6900 });
6901 };
6902
6903 $(function() {
6904 PluginScrollable.updateModals();
6905 });
6906
6907}).apply(this, [window.theme, jQuery]);
6908
6909// Section Scroll
6910(function(theme, $) {
6911
6912 theme = theme || {};
6913
6914 var instanceName = '__sectionScroll';
6915
6916 var PluginSectionScroll = function($el, opts) {
6917 return this.initialize($el, opts);
6918 };
6919
6920 PluginSectionScroll.defaults = {
6921 targetClass: '.section',
6922 dotsNav: true,
6923 changeHeaderLogo: true,
6924 headerLogoDark: 'img/logo-default-slim.png',
6925 headerLogoLight: 'img/logo-default-slim-dark.png'
6926 };
6927
6928 PluginSectionScroll.prototype = {
6929 initialize: function($el, opts) {
6930 if ($el.data(instanceName)) {
6931 return this;
6932 }
6933
6934 this.$el = $el;
6935
6936 this
6937 .setData()
6938 .setOptions(opts)
6939 .build()
6940 .events();
6941
6942 return this;
6943 },
6944
6945 setData: function() {
6946 this.$el.data(instanceName, this);
6947
6948 return this;
6949 },
6950
6951 setOptions: function(opts) {
6952 this.options = $.extend(true, {}, PluginSectionScroll.defaults, opts, {
6953 wrapper: this.$el
6954 });
6955
6956 return this;
6957 },
6958
6959 build: function() {
6960 var self = this,
6961 $el = this.options.wrapper;
6962
6963 // Check type of header and change the target for header (by change header color purpose)
6964 if( $('html').hasClass('side-header-overlay-full-screen') ) {
6965 self.$header = $('.sticky-wrapper');
6966 } else {
6967 self.$header = $('#header');
6968 }
6969
6970 // Turn the section full height or not depeding on the content size
6971 self.updateSectionsHeight();
6972
6973 // Wrap all sections in a section wrapper
6974 $( this.options.targetClass ).wrap('<div class="section-wrapper"></div>');
6975
6976 // Set the section wrapper height
6977 $('.section-wrapper').each(function(){
6978 $(this).height( $(this).find('.section-scroll').outerHeight() );
6979 });
6980
6981 // Add active class to the first section on page load
6982 $('.section-wrapper').first().addClass('active');
6983
6984 var flag = false,
6985 scrollableFlag = false,
6986 touchDirection = '',
6987 touchstartY = 0,
6988 touchendY = 0;
6989
6990 $(window).on('touchstart', function(event) {
6991 touchstartY = event.changedTouches[0].screenY;
6992 });
6993
6994 var wheelEvent = 'onwheel' in document ? 'wheel' : document.onmousewheel !== undefined ? 'mousewheel' : 'DOMMouseScroll';
6995 if( $(window).width() < 992 && $('html').hasClass('touch') ) {
6996 wheelEvent = 'onwheel' in document ? 'wheel touchend' : document.onmousewheel !== undefined ? 'mousewheel touchend' : 'DOMMouseScroll touchend';
6997 }
6998
6999 if( $(window).width() < 992 ) {
7000 $('html').removeClass('overflow-hidden');
7001 $(window).on('scroll', function(){
7002
7003 var index = 0;
7004 $('.section-scroll').each(function(){
7005 if( $(this).offset().top <= $(window).scrollTop() + 50 ) {
7006 var $currentSection2 = $('.section-wrapper').eq( index ).find('.section-scroll');
7007
7008 $('.section-scroll-dots-navigation > ul > li').removeClass('active');
7009 $('.section-scroll-dots-navigation > ul > li').eq( index ).addClass('active');
7010
7011 $(window).trigger({
7012 type: 'section.scroll.mobile.change.header.color',
7013 currentSection: $currentSection2
7014 });
7015 }
7016
7017 index++;
7018 });
7019
7020 });
7021
7022 $(window).on('section.scroll.mobile.change.header.color', function(e){
7023 if( typeof e.currentSection == 'undefined' ) {
7024 return;
7025 }
7026
7027 var $currentSection = e.currentSection,
7028 headerColor = $currentSection.data('section-scroll-header-color');
7029
7030 $('#header .header-nav').removeClass('header-nav-light-text header-nav-dark-text').addClass('header-nav-' + headerColor + '-text');
7031 $('#header .header-nav-features').removeClass('header-nav-features-dark header-nav-features-light').addClass('header-nav-features-' + headerColor);
7032 $('#header .header-social-icons').removeClass('social-icons-icon-dark social-icons-icon-light').addClass('social-icons-icon-' + headerColor);
7033
7034 // Change Logo
7035 if( self.options.changeHeaderLogo && headerColor != undefined ) {
7036 if( headerColor == 'light' ) {
7037 $('#header .header-logo img').attr('src', self.options.headerLogoLight);
7038 } else if( headerColor == 'dark' ) {
7039 $('#header .header-logo img').attr('src', self.options.headerLogoDark);
7040 }
7041 }
7042
7043 self.$header.css({
7044 opacity: 1
7045 });
7046
7047 });
7048 }
7049
7050 $(window).on(wheelEvent, function(e){
7051 if( $(window).width() < 992 ) {
7052 return;
7053 }
7054
7055 if( $(window).width() < 992 && $('html').hasClass('touch') ) {
7056 if( $(e.target).closest('.section-scroll-dots-navigation').get(0) || $(e.target).closest('.header-body').get(0) || $(e.target).closest('.owl-carousel').get(0) ) {
7057 return;
7058 }
7059 }
7060
7061 // Side Header Overlay Full Screen
7062 if( $('html.side-header-overlay-full-screen.side-header-hide').get(0) ) {
7063 return;
7064 }
7065
7066 var wheelDirection = e.originalEvent.wheelDelta == undefined ? e.originalEvent.deltaY > 0 : e.originalEvent.wheelDelta < 0;
7067 if( $(window).width() < 992 && $('html').hasClass('touch') ) {
7068 touchendY = event.changedTouches[0].screenY;
7069
7070 if( touchendY <= touchstartY ) {
7071 touchDirection = 'up';
7072 }
7073
7074 if( touchendY >= touchstartY ) {
7075 touchDirection = 'down';
7076 }
7077
7078 if( touchendY == touchstartY ) {
7079 return;
7080 }
7081 }
7082
7083 var $currentSection = $('.section-wrapper').eq( self.getCurrentIndex() ).find('.section-scroll'),
7084 $nextSection = self.getNextSection(wheelDirection, touchDirection),
7085 nextSectionOffsetTop;
7086
7087 // If is the last section, then change the offsetTop value
7088 if( self.getCurrentIndex() == $('.section-wrapper').length - 1 ) {
7089 nextSectionOffsetTop = $(document).height();
7090 } else {
7091 nextSectionOffsetTop = $nextSection.offset().top;
7092 }
7093
7094 if( $(window).width() < 992 && $('html').hasClass('touch') ) {
7095 setTimeout(function(){
7096 if( $('.section-wrapper').eq( self.getCurrentIndex() ).find('.section-scroll').hasClass('section-scroll-scrollable') ) {
7097 $('html').removeClass('overflow-hidden');
7098 } else {
7099 $('html').addClass('overflow-hidden');
7100 }
7101 }, 1200);
7102 }
7103
7104 // For non full height sections
7105 if( $currentSection.hasClass('section-scroll-scrollable') ) {
7106 if( !flag && !scrollableFlag ) {
7107
7108 // Scroll Direction
7109 if(wheelDirection || touchDirection == 'up') {
7110 if( ( $(window).scrollTop() + $(window).height() ) >= nextSectionOffsetTop ) {
7111 flag = true;
7112 setTimeout(function(){
7113 $(window).trigger('section.scroll.change.header.color');
7114
7115 setTimeout(function(){
7116 flag = false;
7117 }, 500);
7118 }, 1000);
7119
7120 if( self.getCurrentIndex() == ( $('.section-wrapper').length - 1 ) ) {
7121 return false;
7122 }
7123
7124 // Move to the next section
7125 self.moveTo( $currentSection.offset().top + $currentSection.outerHeight() );
7126
7127 // Change Section Active Class
7128 self.changeSectionActiveState( $nextSection );
7129
7130 self.$header.css({
7131 opacity: 0,
7132 transition: 'ease opacity 500ms'
7133 });
7134 }
7135
7136 if( !$('html').hasClass('touch') ) {
7137 for( var i = 1; i < 100; i++ ) {
7138 $('body, html').scrollTop( $(window).scrollTop() + 1 );
7139
7140 if( ( $(window).scrollTop() + $(window).height() ) >= nextSectionOffsetTop ) {
7141 scrollableFlag = true;
7142 setTimeout(function(){
7143 $(window).trigger('section.scroll.change.header.color');
7144 scrollableFlag = false;
7145 }, 500);
7146 break;
7147 }
7148 }
7149 }
7150 } else {
7151 if( $(window).scrollTop() <= $currentSection.offset().top ) {
7152 flag = true;
7153 setTimeout(function(){
7154 $(window).trigger('section.scroll.change.header.color');
7155
7156 setTimeout(function(){
7157 flag = false;
7158 }, 500);
7159 }, 1000);
7160
7161 if( self.getCurrentIndex() == 0 ) {
7162 return false;
7163 }
7164
7165 // Move to the next section
7166 self.moveTo( $currentSection.offset().top - $(window).height() );
7167
7168 // Change Section Active Class
7169 self.changeSectionActiveState( $nextSection );
7170
7171 self.$header.css({
7172 opacity: 0,
7173 transition: 'ease opacity 500ms'
7174 });
7175 }
7176
7177 if( !$('html').hasClass('touch') ) {
7178 for( var i = 1; i < 100; i++ ) {
7179 $('body, html').scrollTop( $(window).scrollTop() - 1 );
7180
7181 if( $(window).scrollTop() <= $currentSection.offset().top ) {
7182 scrollableFlag = true;
7183 setTimeout(function(){
7184 $(window).trigger('section.scroll.change.header.color');
7185 scrollableFlag = false;
7186 }, 500);
7187 break;
7188 }
7189 }
7190 }
7191 }
7192
7193 // Change Dots Active Class
7194 self.changeDotsActiveState();
7195
7196 return;
7197
7198 }
7199 }
7200
7201 // For full height sections
7202 if( !flag && !scrollableFlag ) {
7203 if(wheelDirection || touchDirection == 'up') {
7204 if( self.getCurrentIndex() == ( $('.section-wrapper').length - 1 ) ) {
7205 return false;
7206 }
7207
7208 // Change Section Active Class
7209 self.changeSectionActiveState( $nextSection );
7210
7211 setTimeout(function(){
7212 // Move to the next section
7213 self.moveTo( $nextSection.offset().top );
7214
7215 }, 150);
7216 } else {
7217 if( self.getCurrentIndex() == 0 ) {
7218 return false;
7219 }
7220
7221 // Change Section Active Class
7222 self.changeSectionActiveState( $nextSection );
7223
7224 if( $nextSection.height() > $(window).height() ) {
7225 // Move to the next section
7226 self.moveTo( $currentSection.offset().top - $(window).height() );
7227 } else {
7228 setTimeout(function(){
7229 // Move to the next section
7230 self.moveTo( $nextSection.offset().top );
7231
7232 }, 150);
7233 }
7234 }
7235
7236 // Change Dots Active Class
7237 self.changeDotsActiveState();
7238
7239 self.$header.css({
7240 opacity: 0,
7241 transition: 'ease opacity 500ms'
7242 });
7243
7244 // Style next section
7245 $nextSection.css({
7246 position: 'relative',
7247 opacity: 1,
7248 'z-index': 1,
7249 transform: 'translate3d(0,0,0) scale(1)'
7250 });
7251
7252 // Style previous section
7253 $currentSection.css({
7254 position: 'fixed',
7255 width: '100%',
7256 top: 0,
7257 left: 0,
7258 opacity: 0,
7259 'z-index': 0,
7260 transform: 'translate3d(0,0,-10px) scale(0.7)',
7261 transition: 'ease transform 600ms, ease opacity 600ms',
7262 });
7263
7264 setTimeout(function(){
7265 $currentSection.css({
7266 position: 'relative',
7267 opacity: 1,
7268 transform: 'translate3d(0,0,-10px) scale(1)'
7269 });
7270
7271 $(window).trigger('section.scroll.change.header.color');
7272
7273 setTimeout(function(){
7274 flag = false;
7275 }, 500);
7276 }, 1000);
7277
7278 flag = true;
7279
7280 }
7281
7282 return;
7283 });
7284
7285 // Dots Navigation
7286 if( this.options.dotsNav ) {
7287 self.dotsNavigation();
7288 }
7289
7290 // First Load
7291 setTimeout(function(){
7292 if( $(window.location.hash).get(0) ) {
7293 self.moveTo( $(window.location.hash).parent().offset().top );
7294
7295 self.changeSectionActiveState( $(window.location.hash) );
7296
7297 // Change Dots Active Class
7298 self.changeDotsActiveState();
7299
7300 self.updateHash( true );
7301 } else {
7302 var hash = window.location.hash,
7303 index = hash.replace('#','');
7304
7305 if( !hash ) {
7306 index = 1;
7307 }
7308
7309 self.moveTo( $('.section-wrapper').eq( index - 1 ).offset().top );
7310
7311 self.changeSectionActiveState( $('.section-wrapper').eq( index - 1 ).find('.section-scroll') );
7312
7313 // Change Dots Active Class
7314 self.changeDotsActiveState();
7315
7316 self.updateHash( true );
7317 }
7318
7319 $(window).trigger('section.scroll.ready');
7320 $(window).trigger('section.scroll.change.header.color');
7321 }, 500);
7322
7323 return this;
7324 },
7325
7326 updateSectionsHeight: function() {
7327 var self = this;
7328
7329 $('.section-scroll').css({ height: '' });
7330
7331 $('.section-scroll').each(function(){
7332 if( $(this).outerHeight() < ( $(window).height() + 3 ) ) {
7333 $(this).css({ height: '100vh' });
7334 } else {
7335 $(this).addClass('section-scroll-scrollable');
7336 }
7337 });
7338
7339 // Set the section wrapper height
7340 $('.section-wrapper').each(function(){
7341 $(this).height( $(this).find('.section-scroll').outerHeight() );
7342 });
7343
7344 return this;
7345 },
7346
7347 updateHash: function( first_load ){
7348 var self = this;
7349
7350 if( !window.location.hash ) {
7351 window.location.hash = 1;
7352 } else {
7353 if(!first_load) {
7354 var $section = $('.section-wrapper').eq( self.getCurrentIndex() ).find('.section-scroll'),
7355 section_id = $section.attr('id') ? $section.attr('id') : $section.parent().index() + 1;
7356
7357 window.location.hash = section_id;
7358 }
7359 }
7360
7361 return this;
7362 },
7363
7364 getCurrentIndex: function() {
7365 var self = this,
7366 currentIndex = 0;
7367
7368 currentIndex = $('.section-wrapper.active').index();
7369
7370 return currentIndex;
7371 },
7372
7373 moveTo: function( $scrollTopValue, first_load ) {
7374 var self = this;
7375
7376 $('body, html').animate({
7377 scrollTop: $scrollTopValue
7378 }, 1000, 'easeOutQuint');
7379
7380 setTimeout(function(){
7381 self.updateHash();
7382 }, 500);
7383
7384 return this;
7385 },
7386
7387 getNextSection: function(wheelDirection, touchDirection) {
7388 var self = this,
7389 $nextSection = '';
7390
7391 // Scroll Direction
7392 if(wheelDirection || touchDirection == 'up') {
7393 $nextSection = $('.section-wrapper').eq( self.getCurrentIndex() + 1 ).find('.section-scroll');
7394 } else {
7395 $nextSection = $('.section-wrapper').eq( self.getCurrentIndex() - 1 ).find('.section-scroll');
7396 }
7397
7398 return $nextSection;
7399 },
7400
7401 changeSectionActiveState: function( $nextSection ) {
7402 var self = this;
7403
7404 $('.section-wrapper').removeClass('active');
7405 $nextSection.parent().addClass('active');
7406
7407 return this;
7408 },
7409
7410 changeDotsActiveState: function() {
7411 var self = this;
7412
7413 $('.section-scroll-dots-navigation > ul > li').removeClass('active');
7414 $('.section-scroll-dots-navigation > ul > li').eq( self.getCurrentIndex() ).addClass('active');
7415
7416 return this;
7417 },
7418
7419 dotsNavigation: function() {
7420 var self = this;
7421
7422 var dotsNav = $('<div class="section-scroll-dots-navigation"><ul class="list list-unstyled"></ul></div>'),
7423 currentSectionIndex = self.getCurrentIndex();
7424
7425 if( self.options.dotsClass ) {
7426 dotsNav.addClass( self.options.dotsClass );
7427 }
7428
7429 for( var i = 0; i < $('.section-scroll').length; i++ ) {
7430 var title = $('.section-wrapper').eq( i ).find('.section-scroll').data('section-scroll-title');
7431
7432 dotsNav.find('> ul').append( '<li'+ ( ( currentSectionIndex == i ) ? ' class="active"' : '' ) +'><a href="#'+ i +'" data-nav-id="'+ i +'"><span>'+ title +'</span></a></li>' );
7433 }
7434
7435 $('.body').append( dotsNav );
7436
7437 dotsNav.find('a[data-nav-id]').on('click touchstart', function(e){
7438 e.preventDefault();
7439 var $this = $(this);
7440
7441 $('.section-scroll').css({
7442 opacity: 0,
7443 transition: 'ease opacity 300ms'
7444 });
7445
7446 self.$header.css({
7447 opacity: 0,
7448 transition: 'ease opacity 500ms'
7449 });
7450
7451 setTimeout(function(){
7452 self.moveTo( $('.section-wrapper').eq( $this.data('nav-id') ).offset().top )
7453
7454 $('.section-wrapper').removeClass('active');
7455 $('.section-wrapper').eq( $this.data('nav-id') ).addClass('active');
7456
7457 $('.section-wrapper').eq( self.getCurrentIndex() ).find('.section-scroll').css({
7458 opacity: 1
7459 });
7460
7461 setTimeout(function(){
7462 $('.section-scroll').css({ opacity: 1 });
7463
7464 $(window).trigger('section.scroll.change.header.color');
7465 }, 500);
7466
7467 if( $(window).width() > 991 ) {
7468 self.changeDotsActiveState();
7469 }
7470 }, 500);
7471 });
7472
7473 return this;
7474 },
7475
7476 events: function() {
7477 var self = this;
7478
7479 $(window).on('section.scroll.ready', function(){
7480 $(window).scrollTop(0);
7481 });
7482
7483 $(window).on('section.scroll.change.header.color', function(){
7484 var headerColor = $('.section-wrapper').eq( self.getCurrentIndex() ).find('.section-scroll').data('section-scroll-header-color');
7485
7486 $('#header .header-nav').removeClass('header-nav-light-text header-nav-dark-text').addClass('header-nav-' + headerColor + '-text');
7487 $('#header .header-nav-features').removeClass('header-nav-features-dark header-nav-features-light').addClass('header-nav-features-' + headerColor);
7488 $('#header .header-social-icons').removeClass('social-icons-icon-dark social-icons-icon-light').addClass('social-icons-icon-' + headerColor);
7489
7490 // Change Logo
7491 if( self.options.changeHeaderLogo && headerColor != undefined ) {
7492 if( headerColor == 'light' ) {
7493 $('#header .header-logo img').attr('src', self.options.headerLogoLight);
7494 } else if( headerColor == 'dark' ) {
7495 $('#header .header-logo img').attr('src', self.options.headerLogoDark);
7496 }
7497 }
7498
7499 self.$header.css({
7500 opacity: 1
7501 });
7502 });
7503
7504 $(document).ready(function(){
7505 $(window).afterResize(function(){
7506 self.updateSectionsHeight();
7507
7508 if( $(window).width() < 992 ) {
7509 $('html').removeClass('overflow-hidden');
7510 }
7511 });
7512 });
7513
7514 return this;
7515 }
7516 };
7517
7518 // expose to scope
7519 $.extend(theme, {
7520 PluginSectionScroll: PluginSectionScroll
7521 });
7522
7523 // jquery plugin
7524 $.fn.themePluginSectionScroll = function(opts) {
7525 return this.map(function() {
7526 var $this = $(this);
7527
7528 if ($this.data(instanceName)) {
7529 return $this.data(instanceName);
7530 } else {
7531 return new PluginSectionScroll($this, opts);
7532 }
7533
7534 });
7535 };
7536
7537}).apply(this, [window.theme, jQuery]);
7538
7539// Sort
7540(function(theme, $) {
7541
7542 theme = theme || {};
7543
7544 var instanceName = '__sort';
7545
7546 var PluginSort = function($el, opts) {
7547 return this.initialize($el, opts);
7548 };
7549
7550 PluginSort.defaults = {
7551 useHash: true,
7552 itemSelector: '.isotope-item',
7553 layoutMode: 'masonry',
7554 filter: '*',
7555 hiddenStyle: {
7556 opacity: 0
7557 },
7558 visibleStyle: {
7559 opacity: 1
7560 },
7561 stagger: 30,
7562 isOriginLeft: ($('html').attr('dir') == 'rtl' ? false : true)
7563 };
7564
7565 PluginSort.prototype = {
7566 initialize: function($el, opts) {
7567 if ($el.data(instanceName)) {
7568 return this;
7569 }
7570
7571 this.$el = $el;
7572
7573 this
7574 .setData()
7575 .setOptions(opts)
7576 .build();
7577
7578 return this;
7579 },
7580
7581 setData: function() {
7582 this.$el.data(instanceName, this);
7583
7584 return this;
7585 },
7586
7587 setOptions: function(opts) {
7588 this.options = $.extend(true, {}, PluginSort.defaults, opts, {
7589 wrapper: this.$el
7590 });
7591
7592 return this;
7593 },
7594
7595 build: function() {
7596 if (!($.isFunction($.fn.isotope))) {
7597 return this;
7598 }
7599
7600 var self = this,
7601 $source = this.options.wrapper,
7602 $destination = $('.sort-destination[data-sort-id="' + $source.attr('data-sort-id') + '"]'),
7603 $window = $(window);
7604
7605 if ($destination.get(0)) {
7606
7607 self.$source = $source;
7608 self.$destination = $destination;
7609 self.$loader = false;
7610
7611 self.setParagraphHeight($destination);
7612
7613 if (self.$destination.parents('.sort-destination-loader').get(0)) {
7614 self.$loader = self.$destination.parents('.sort-destination-loader');
7615 self.createLoader();
7616 }
7617
7618 $destination.attr('data-filter', '*');
7619
7620 $destination.one('layoutComplete', function(event, laidOutItems) {
7621 self.removeLoader();
7622
7623 // If has data-plugin-sticky on the page we need recalculate sticky position
7624 if( $('[data-plugin-sticky]').length ) {
7625 setTimeout(function(){
7626 $('[data-plugin-sticky]').each(function(){
7627 $(this).data('__sticky').build();
7628 $(window).trigger('resize');
7629 });
7630 }, 500);
7631 }
7632 });
7633
7634 // IE10/11 fix
7635 if( $('html').hasClass('ie10') || $('html').hasClass('ie11') ) {
7636 var padding = parseInt( self.options.wrapper.children().css('padding-left') ) + parseInt( self.options.wrapper.children().css('padding-right') );
7637 }
7638
7639 $destination.waitForImages(function() {
7640 $destination.isotope(self.options);
7641 self.events();
7642 });
7643
7644
7645 setTimeout(function() {
7646 self.removeLoader();
7647 }, 3000);
7648
7649 }
7650
7651 return this;
7652 },
7653
7654 events: function() {
7655 var self = this,
7656 filter = null,
7657 $window = $(window);
7658
7659 self.$source.find('a').click(function(e) {
7660 e.preventDefault();
7661
7662 filter = $(this).parent().data('option-value');
7663
7664 self.setFilter(filter);
7665
7666 if (e.originalEvent) {
7667 self.$source.trigger('filtered');
7668 }
7669
7670 return this;
7671 });
7672
7673 self.$destination.trigger('filtered');
7674 self.$source.trigger('filtered');
7675
7676 if (self.options.useHash) {
7677 self.hashEvents();
7678 }
7679
7680 $window.on('resize sort.resize', function() {
7681 setTimeout(function() {
7682 self.$destination.isotope('layout');
7683 }, 300);
7684 });
7685
7686 setTimeout(function() {
7687 $window.trigger('sort.resize');
7688 }, 300);
7689
7690 return this;
7691 },
7692
7693 setFilter: function(filter) {
7694 var self = this,
7695 page = false,
7696 currentFilter = filter;
7697
7698 self.$source.find('.active').removeClass('active');
7699 self.$source.find('li[data-option-value="' + filter + '"], li[data-option-value="' + filter + '"] > a').addClass('active');
7700
7701 self.options.filter = currentFilter;
7702
7703 if (self.$destination.attr('data-current-page')) {
7704 currentFilter = currentFilter + '[data-page-rel=' + self.$destination.attr('data-current-page') + ']';
7705 }
7706
7707 self.$destination.attr('data-filter', filter).isotope({
7708 filter: currentFilter
7709 }).one('arrangeComplete', function( event, filteredItems ) {
7710
7711 if (self.options.useHash) {
7712 if (window.location.hash != '' || self.options.filter.replace('.', '') != '*') {
7713 window.location.hash = self.options.filter.replace('.', '');
7714 }
7715 }
7716
7717 $(window).trigger('scroll');
7718
7719 }).trigger('filtered');
7720
7721 return this;
7722 },
7723
7724 hashEvents: function() {
7725 var self = this,
7726 hash = null,
7727 hashFilter = null,
7728 initHashFilter = '.' + location.hash.replace('#', '');
7729
7730 if (initHashFilter != '.' && initHashFilter != '.*') {
7731 self.setFilter(initHashFilter);
7732 }
7733
7734 $(window).on('hashchange', function(e) {
7735
7736 hashFilter = '.' + location.hash.replace('#', '');
7737 hash = (hashFilter == '.' || hashFilter == '.*' ? '*' : hashFilter);
7738
7739 self.setFilter(hash);
7740
7741 });
7742
7743 return this;
7744 },
7745
7746 setParagraphHeight: function() {
7747 var self = this,
7748 minParagraphHeight = 0,
7749 paragraphs = $('span.thumb-info-caption p', self.$destination);
7750
7751 paragraphs.each(function() {
7752 if ($(this).height() > minParagraphHeight) {
7753 minParagraphHeight = ($(this).height() + 10);
7754 }
7755 });
7756
7757 paragraphs.height(minParagraphHeight);
7758
7759 return this;
7760 },
7761
7762 createLoader: function() {
7763 var self = this;
7764
7765 var loaderTemplate = [
7766 '<div class="bounce-loader">',
7767 '<div class="bounce1"></div>',
7768 '<div class="bounce2"></div>',
7769 '<div class="bounce3"></div>',
7770 '</div>'
7771 ].join('');
7772
7773 self.$loader.append(loaderTemplate);
7774
7775 return this;
7776 },
7777
7778 removeLoader: function() {
7779
7780 var self = this;
7781
7782 if (self.$loader) {
7783
7784 self.$loader.removeClass('sort-destination-loader-showing');
7785
7786 setTimeout(function() {
7787 self.$loader.addClass('sort-destination-loader-loaded');
7788 }, 300);
7789
7790 }
7791
7792 }
7793
7794 };
7795
7796 // expose to scope
7797 $.extend(theme, {
7798 PluginSort: PluginSort
7799 });
7800
7801 // jquery plugin
7802 $.fn.themePluginSort = function(opts) {
7803 return this.map(function() {
7804 var $this = $(this);
7805
7806 if ($this.data(instanceName)) {
7807 return $this.data(instanceName);
7808 } else {
7809 return new PluginSort($this, opts);
7810 }
7811
7812 });
7813 }
7814
7815}).apply(this, [window.theme, jQuery]);
7816
7817// Star Rating
7818(function(theme, $) {
7819
7820 theme = theme || {};
7821
7822 var instanceName = '__starrating';
7823
7824 var PluginStarRating = function($el, opts) {
7825 return this.initialize($el, opts);
7826 };
7827
7828 PluginStarRating.defaults = {
7829 theme: 'krajee-fas',
7830 color: 'primary',
7831 showClear: false,
7832 showCaption: false
7833 };
7834
7835 PluginStarRating.prototype = {
7836 initialize: function($el, opts) {
7837 this.$el = $el;
7838
7839 this
7840 .setData()
7841 .setOptions(opts)
7842 .build();
7843
7844 return this;
7845 },
7846
7847 setData: function() {
7848 this.$el.data(instanceName, this);
7849
7850 return this;
7851 },
7852
7853 setOptions: function(opts) {
7854 this.options = $.extend(true, {}, PluginStarRating.defaults, opts, {
7855 wrapper: this.$el
7856 });
7857
7858 return this;
7859 },
7860
7861 build: function() {
7862
7863 if (!($.isFunction($.fn.rating))) {
7864 return this;
7865 }
7866
7867 var self = this;
7868
7869 self.options.wrapper
7870 .rating(self.options);
7871
7872 self.options.wrapper.parents('.rating-container')
7873 .addClass('rating-' + self.options.color);
7874
7875 if( self.options.extraClass ) {
7876 self.options.wrapper.parents('.rating-container')
7877 .addClass(self.options.extraClass);
7878 }
7879
7880 return this;
7881
7882 }
7883 };
7884
7885 // expose to scope
7886 $.extend(theme, {
7887 PluginStarRating: PluginStarRating
7888 });
7889
7890 // jquery plugin
7891 $.fn.themePluginStarRating = function(opts) {
7892 return this.map(function() {
7893 var $this = $(this);
7894
7895 if ($this.data(instanceName)) {
7896 return $this.data(instanceName);
7897 } else {
7898 return new PluginStarRating($this, opts);
7899 }
7900
7901 });
7902 }
7903
7904}).apply(this, [window.theme, jQuery]);
7905
7906// Sticky
7907(function(theme, $) {
7908
7909 theme = theme || {};
7910
7911 var instanceName = '__sticky';
7912
7913 var PluginSticky = function($el, opts) {
7914 return this.initialize($el, opts);
7915 };
7916
7917 PluginSticky.defaults = {
7918 minWidth: 991,
7919 activeClass: 'sticky-active'
7920 };
7921
7922 PluginSticky.prototype = {
7923 initialize: function($el, opts) {
7924 if ( $el.data( instanceName ) ) {
7925 return this;
7926 }
7927
7928 this.$el = $el;
7929
7930 this
7931 .setData()
7932 .setOptions(opts)
7933 .build()
7934 .events();
7935
7936 return this;
7937 },
7938
7939 setData: function() {
7940 this.$el.data(instanceName, this);
7941
7942 return this;
7943 },
7944
7945 setOptions: function(opts) {
7946 this.options = $.extend(true, {}, PluginSticky.defaults, opts, {
7947 wrapper: this.$el
7948 });
7949
7950 return this;
7951 },
7952
7953 build: function() {
7954 if (!($.isFunction($.fn.pin))) {
7955 return this;
7956 }
7957
7958 var self = this,
7959 $window = $(window);
7960
7961 self.options.wrapper.pin(self.options);
7962
7963 if( self.options.wrapper.hasClass('sticky-wrapper-transparent') ) {
7964 self.options.wrapper.parent().addClass('position-absolute w-100');
7965 }
7966
7967 $window.afterResize(function() {
7968 self.options.wrapper.removeAttr('style').removeData('pin');
7969 self.options.wrapper.pin(self.options);
7970 $window.trigger('scroll');
7971 });
7972
7973 // Change Logo Src
7974 if( self.options.wrapper.find('img').attr('data-change-src') ) {
7975 var $logo = self.options.wrapper.find('img'),
7976 logoSrc = $logo.attr('src'),
7977 logoNewSrc = $logo.attr('data-change-src');
7978
7979 self.changeLogoSrc = function(activate) {
7980 if(activate) {
7981 $logo.attr('src', logoNewSrc);
7982 } else {
7983 $logo.attr('src', logoSrc);
7984 }
7985 }
7986 }
7987
7988 return this;
7989 },
7990
7991 events: function() {
7992 var self = this,
7993 $window = $(window),
7994 $logo = self.options.wrapper.find('img'),
7995 sticky_activate_flag = true,
7996 sticky_deactivate_flag = false,
7997 class_to_check = ( self.options.wrapper.hasClass('sticky-wrapper-effect-1') ) ? 'sticky-effect-active' : 'sticky-active';
7998
7999 $window.on('scroll sticky.effect.active', function(){
8000 if( self.options.wrapper.hasClass( class_to_check ) ) {
8001 if( sticky_activate_flag ) {
8002 if( $logo.attr('data-change-src') ) {
8003 self.changeLogoSrc(true);
8004 }
8005
8006 sticky_activate_flag = false;
8007 sticky_deactivate_flag = true;
8008 }
8009 } else {
8010 if( sticky_deactivate_flag ) {
8011 if( $logo.attr('data-change-src') ) {
8012 self.changeLogoSrc(false);
8013 }
8014
8015 sticky_deactivate_flag = false;
8016 sticky_activate_flag = true;
8017 }
8018 }
8019 });
8020
8021 var is_backing = false;
8022 if( self.options.stickyStartEffectAt ) {
8023
8024 // First Load
8025 if( self.options.stickyStartEffectAt < $window.scrollTop() ) {
8026 self.options.wrapper.addClass('sticky-effect-active');
8027
8028 $window.trigger('sticky.effect.active');
8029 }
8030
8031 $window.on('scroll', function(){
8032 if( self.options.stickyStartEffectAt < $window.scrollTop() ) {
8033 self.options.wrapper.addClass('sticky-effect-active');
8034 is_backing = true;
8035
8036 $window.trigger('sticky.effect.active');
8037 } else {
8038 if( is_backing ) {
8039 self.options.wrapper.find('.sticky-body').addClass('position-fixed');
8040 is_backing = false;
8041 }
8042
8043 if( $window.scrollTop() == 0 ) {
8044 self.options.wrapper.find('.sticky-body').removeClass('position-fixed');
8045 }
8046
8047 self.options.wrapper.removeClass('sticky-effect-active');
8048 }
8049 });
8050 }
8051
8052 // Refresh Sticky Plugin if click in a data-toggle="collapse"
8053 if( $('[data-toggle="collapse"]').get(0) ) {
8054
8055 $('[data-toggle="collapse"]').on('click', function(){
8056 setTimeout(function(){
8057 self.build();
8058 $(window).trigger('scroll');
8059 }, 1000);
8060 });
8061
8062 }
8063 }
8064 };
8065
8066 // expose to scope
8067 $.extend(theme, {
8068 PluginSticky: PluginSticky
8069 });
8070
8071 // jquery plugin
8072 $.fn.themePluginSticky = function(opts) {
8073 return this.map(function() {
8074 var $this = $(this);
8075
8076 if ($this.data(instanceName)) {
8077 return $this.data(instanceName);
8078 } else {
8079 return new PluginSticky($this, opts);
8080 }
8081
8082 });
8083 }
8084
8085}).apply(this, [ window.theme, jQuery ]);
8086
8087// Toggle
8088(function(theme, $) {
8089
8090 theme = theme || {};
8091
8092 var instanceName = '__toggle';
8093
8094 var PluginToggle = function($el, opts) {
8095 return this.initialize($el, opts);
8096 };
8097
8098 PluginToggle.defaults = {
8099 duration: 350,
8100 isAccordion: false
8101 };
8102
8103 PluginToggle.prototype = {
8104 initialize: function($el, opts) {
8105 if ($el.data(instanceName)) {
8106 return this;
8107 }
8108
8109 this.$el = $el;
8110
8111 this
8112 .setData()
8113 .setOptions(opts)
8114 .build();
8115
8116 return this;
8117 },
8118
8119 setData: function() {
8120 this.$el.data(instanceName, this);
8121
8122 return this;
8123 },
8124
8125 setOptions: function(opts) {
8126 this.options = $.extend(true, {}, PluginToggle.defaults, opts, {
8127 wrapper: this.$el
8128 });
8129
8130 return this;
8131 },
8132
8133 build: function() {
8134 var self = this,
8135 $wrapper = this.options.wrapper,
8136 $items = $wrapper.find('> .toggle'),
8137 $el = null;
8138
8139 $items.each(function() {
8140 $el = $(this);
8141
8142 if ($el.hasClass('active')) {
8143 $el.find('> p').addClass('preview-active');
8144 $el.find('> .toggle-content').slideDown(self.options.duration);
8145 }
8146
8147 self.events($el);
8148 });
8149
8150 if (self.options.isAccordion) {
8151 self.options.duration = self.options.duration / 2;
8152 }
8153
8154 return this;
8155 },
8156
8157 events: function($el) {
8158 var self = this,
8159 previewParCurrentHeight = 0,
8160 previewParAnimateHeight = 0,
8161 toggleContent = null;
8162
8163 $el.find('> label, > .toggle-title').click(function(e) {
8164
8165 var $this = $(this),
8166 parentSection = $this.parent(),
8167 parentWrapper = $this.parents('.toggle'),
8168 previewPar = null,
8169 closeElement = null;
8170
8171 if (self.options.isAccordion && typeof(e.originalEvent) != 'undefined') {
8172 closeElement = parentWrapper.find('.toggle.active > label, .toggle.active > .toggle-title');
8173
8174 if (closeElement[0] == $this[0]) {
8175 return;
8176 }
8177 }
8178
8179 parentSection.toggleClass('active');
8180
8181 // Preview Paragraph
8182 if (parentSection.find('> p').get(0)) {
8183
8184 previewPar = parentSection.find('> p');
8185 previewParCurrentHeight = previewPar.css('height');
8186 previewPar.css('height', 'auto');
8187 previewParAnimateHeight = previewPar.css('height');
8188 previewPar.css('height', previewParCurrentHeight);
8189
8190 }
8191
8192 // Content
8193 toggleContent = parentSection.find('> .toggle-content');
8194
8195 if (parentSection.hasClass('active')) {
8196
8197 $(previewPar).animate({
8198 height: previewParAnimateHeight
8199 }, self.options.duration, function() {
8200 $(this).addClass('preview-active');
8201 });
8202
8203 toggleContent.slideDown(self.options.duration, function() {
8204 if (closeElement) {
8205 closeElement.trigger('click');
8206 }
8207 });
8208
8209 } else {
8210
8211 $(previewPar).animate({
8212 height: 0
8213 }, self.options.duration, function() {
8214 $(this).removeClass('preview-active');
8215 });
8216
8217 toggleContent.slideUp(self.options.duration);
8218
8219 }
8220
8221 });
8222 }
8223 };
8224
8225 // expose to scope
8226 $.extend(theme, {
8227 PluginToggle: PluginToggle
8228 });
8229
8230 // jquery plugin
8231 $.fn.themePluginToggle = function(opts) {
8232 return this.map(function() {
8233 var $this = $(this);
8234
8235 if ($this.data(instanceName)) {
8236 return $this.data(instanceName);
8237 } else {
8238 return new PluginToggle($this, opts);
8239 }
8240
8241 });
8242 }
8243
8244}).apply(this, [window.theme, jQuery]);
8245
8246// Tweets
8247(function(theme, $) {
8248
8249 theme = theme || {};
8250
8251 var instanceName = '__tweets';
8252
8253 var PluginTweets = function($el, opts) {
8254 return this.initialize($el, opts);
8255 };
8256
8257 PluginTweets.defaults = {
8258 username: null,
8259 count: 2,
8260 URL: 'php/twitter-feed.php',
8261 iconColor: false
8262 };
8263
8264 PluginTweets.prototype = {
8265 initialize: function($el, opts) {
8266 if ($el.data(instanceName)) {
8267 return this;
8268 }
8269
8270 this.$el = $el;
8271
8272 this
8273 .setData()
8274 .setOptions(opts)
8275 .build();
8276
8277 return this;
8278 },
8279
8280 setData: function() {
8281 this.$el.data(instanceName, this);
8282
8283 return this;
8284 },
8285
8286 setOptions: function(opts) {
8287 this.options = $.extend(true, {}, PluginTweets.defaults, opts, {
8288 wrapper: this.$el
8289 });
8290
8291 return this;
8292 },
8293
8294 build: function() {
8295 if (this.options.username == null || this.options.username == '') {
8296 return this;
8297 }
8298
8299 var self = this,
8300 $wrapper = this.options.wrapper;
8301
8302 $.ajax({
8303 type: 'GET',
8304 data: {
8305 twitter_screen_name: self.options.username,
8306 tweets_to_display: self.options.count,
8307 icon_color: self.options.iconColor
8308 },
8309 url: self.options.URL,
8310 }).done(function(html) {
8311 $wrapper.html(html).find('a').attr('target','_blank');
8312 });
8313
8314 return this;
8315 }
8316 };
8317
8318 // expose to scope
8319 $.extend(theme, {
8320 PluginTweets: PluginTweets
8321 });
8322
8323 // jquery plugin
8324 $.fn.themePluginTweets = function(opts) {
8325 return this.map(function() {
8326 var $this = $(this);
8327
8328 if ($this.data(instanceName)) {
8329 return $this.data(instanceName);
8330 } else {
8331 return new PluginTweets($this, opts);
8332 }
8333
8334 });
8335 }
8336
8337}).apply(this, [window.theme, jQuery]);
8338
8339// Validation
8340(function(theme, $) {
8341
8342 theme = theme || {};
8343
8344 $.extend(theme, {
8345
8346 PluginValidation: {
8347
8348 defaults: {
8349 formClass: 'needs-validation',
8350 validator: {
8351 highlight: function(element) {
8352 $(element)
8353 .addClass('is-invalid')
8354 .removeClass('is-valid')
8355 .parent()
8356 .removeClass('has-success')
8357 .addClass('has-danger');
8358 },
8359 success: function(label, element) {
8360 $(element)
8361 .removeClass('is-invalid')
8362 .addClass('is-valid')
8363 .parent()
8364 .removeClass('has-danger')
8365 .addClass('has-success')
8366 .find('label.error')
8367 .remove();
8368 },
8369 errorPlacement: function(error, element) {
8370 if (element.attr('type') == 'radio' || element.attr('type') == 'checkbox') {
8371 error.appendTo(element.parent().parent());
8372 } else {
8373 error.insertAfter(element);
8374 }
8375 }
8376 },
8377 validateCaptchaURL: 'php/contact-form-verify-captcha.php',
8378 refreshCaptchaURL: 'php/contact-form-refresh-captcha.php'
8379 },
8380
8381 initialize: function(opts) {
8382 initialized = true;
8383
8384 this
8385 .setOptions(opts)
8386 .build();
8387
8388 return this;
8389 },
8390
8391 setOptions: function(opts) {
8392 this.options = $.extend(true, {}, this.defaults, opts);
8393
8394 return this;
8395 },
8396
8397 build: function() {
8398 var self = this;
8399
8400 if (!($.isFunction($.validator))) {
8401 return this;
8402 }
8403
8404 self.addMethods();
8405 self.setMessageGroups();
8406
8407 $.validator.setDefaults(self.options.validator);
8408
8409 $('.' + self.options.formClass).validate();
8410
8411 return this;
8412 },
8413
8414 addMethods: function() {
8415 var self = this;
8416
8417 $.validator.addMethod('captcha', function(value, element, params) {
8418 var captchaValid = false;
8419
8420 $.ajax({
8421 url: self.options.validateCaptchaURL,
8422 type: 'POST',
8423 async: false,
8424 dataType: 'json',
8425 data: {
8426 captcha: $.trim(value)
8427 },
8428 success: function(data) {
8429 if (data.response == 'success') {
8430 captchaValid = true;
8431 }
8432 }
8433 });
8434
8435 if (captchaValid) {
8436 return true;
8437 }
8438
8439 }, '');
8440
8441 // Refresh Captcha
8442 $('#refreshCaptcha').on('click', function(e) {
8443 e.preventDefault();
8444 $.get(self.options.refreshCaptchaURL, function(url) {
8445 $('#captcha-image').attr('src', url);
8446 });
8447 });
8448
8449 },
8450
8451 setMessageGroups: function() {
8452
8453 $('.checkbox-group[data-msg-required], .radio-group[data-msg-required]').each(function() {
8454 var message = $(this).data('msg-required');
8455 $(this).find('input').attr('data-msg-required', message);
8456 });
8457
8458 }
8459
8460 }
8461
8462 });
8463
8464}).apply(this, [window.theme, jQuery]);
8465
8466// Video Background
8467(function(theme, $) {
8468
8469 theme = theme || {};
8470
8471 var instanceName = '__videobackground';
8472
8473 var PluginVideoBackground = function($el, opts) {
8474 return this.initialize($el, opts);
8475 };
8476
8477 PluginVideoBackground.defaults = {
8478 overlay: false,
8479 volume: 1,
8480 playbackRate: 1,
8481 muted: true,
8482 loop: true,
8483 autoplay: true,
8484 position: '50% 50%',
8485 posterType: 'detect',
8486 className: 'vide-video-wrapper'
8487 };
8488
8489 PluginVideoBackground.prototype = {
8490 initialize: function($el, opts) {
8491 this.$el = $el;
8492
8493 this
8494 .setData()
8495 .setOptions(opts)
8496 .build()
8497 .events();
8498
8499 return this;
8500 },
8501
8502 setData: function() {
8503 this.$el.data(instanceName, this);
8504
8505 return this;
8506 },
8507
8508 setOptions: function(opts) {
8509 this.options = $.extend(true, {}, PluginVideoBackground.defaults, opts, {
8510 path: this.$el.data('video-path'),
8511 wrapper: this.$el
8512 });
8513
8514 return this;
8515 },
8516
8517 build: function() {
8518 var self = this;
8519
8520 if (!($.isFunction($.fn.vide)) || (!this.options.path)) {
8521 return this;
8522 }
8523
8524 if (this.options.overlay) {
8525
8526 var overlayClass = this.options.overlayClass;
8527
8528 this.options.wrapper.prepend(
8529 $('<div />').addClass(overlayClass)
8530 );
8531 }
8532
8533 this.options.wrapper
8534 .vide(this.options.path, this.options)
8535 .first()
8536 .css('z-index', 0);
8537
8538 // Change Poster
8539 self.changePoster();
8540
8541 // Initialize Vide inside a carousel
8542 if( self.options.wrapper.closest('.owl-carousel').get(0) ) {
8543 self.options.wrapper.closest('.owl-carousel').on('initialized.owl.carousel', function(){
8544 $('.owl-item.cloned')
8545 .find('[data-plugin-video-background] .vide-video-wrapper')
8546 .remove();
8547
8548 $('.owl-item.cloned')
8549 .find('[data-plugin-video-background]')
8550 .vide(self.options.path, self.options)
8551 .first()
8552 .css('z-index', 0);
8553
8554 self.changePoster( self.options.wrapper.closest('.owl-carousel') );
8555 });
8556 }
8557
8558 // Play Video Button
8559 var $playButton = self.options.wrapper.find('.video-background-play');
8560
8561 if( $playButton.get(0) ) {
8562 var $playWrapper = self.options.wrapper.find('.video-background-play-wrapper');
8563
8564 self.options.wrapper.find('.video-background-play').on('click', function(e){
8565 e.preventDefault();
8566
8567 if( $playWrapper.get(0) ) {
8568 $playWrapper.animate({
8569 opacity: 0
8570 }, 300, function(){
8571 $playWrapper.parent().height( $playWrapper.outerHeight() );
8572 $playWrapper.remove();
8573 });
8574 } else {
8575 $playButton.animate({
8576 opacity: 0
8577 }, 300, function(){
8578 $playButton.remove();
8579 });
8580 }
8581
8582 setTimeout(function(){
8583 self.options.wrapper.find('video')[0].play();
8584 }, 500)
8585 });
8586 }
8587
8588 return this;
8589 },
8590
8591 changePoster: function( $carousel ) {
8592 var self = this;
8593
8594 // If it's inside carousel
8595 if( $carousel && self.options.changePoster ) {
8596 $carousel.find('.owl-item [data-plugin-video-background] .vide-video-wrapper').css({
8597 'background-image': 'url(' + self.options.changePoster + ')'
8598 });
8599
8600 return this;
8601 }
8602
8603 if( self.options.changePoster ) {
8604 self.options.wrapper.find('.vide-video-wrapper').css({
8605 'background-image': 'url(' + self.options.changePoster + ')'
8606 });
8607 }
8608
8609 return this;
8610 },
8611
8612 events: function() {
8613 var self = this;
8614
8615 // Initialize
8616 self.options.wrapper.on('video.background.initialize', function(){
8617 self.build();
8618 });
8619
8620 return this;
8621 }
8622 };
8623
8624 // expose to scope
8625 $.extend(theme, {
8626 PluginVideoBackground: PluginVideoBackground
8627 });
8628
8629 // jquery plugin
8630 $.fn.themePluginVideoBackground = function(opts) {
8631 return this.map(function() {
8632 var $this = $(this);
8633
8634 if ($this.data(instanceName)) {
8635 return $this.data(instanceName);
8636 } else {
8637 return new PluginVideoBackground($this, opts);
8638 }
8639
8640 });
8641 }
8642
8643}).apply(this, [window.theme, jQuery]);
8644
8645// Account
8646(function(theme, $) {
8647
8648 theme = theme || {};
8649
8650 var initialized = false;
8651
8652 $.extend(theme, {
8653
8654 Account: {
8655
8656 defaults: {
8657 wrapper: $('#headerAccount')
8658 },
8659
8660 initialize: function($wrapper, opts) {
8661 if (initialized) {
8662 return this;
8663 }
8664
8665 initialized = true;
8666 this.$wrapper = ($wrapper || this.defaults.wrapper);
8667
8668 this
8669 .setOptions(opts)
8670 .events();
8671
8672 return this;
8673 },
8674
8675 setOptions: function(opts) {
8676 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options')));
8677
8678 return this;
8679 },
8680
8681 events: function() {
8682 var self = this;
8683
8684 $(window).on('load', function(){
8685 $(document).ready(function(){
8686 setTimeout(function(){
8687
8688 self.$wrapper.find('input').on('focus', function() {
8689 self.$wrapper.addClass('open');
8690
8691 $(document).mouseup(function(e) {
8692 if (!self.$wrapper.is(e.target) && self.$wrapper.has(e.target).length === 0) {
8693 self.$wrapper.removeClass('open');
8694 }
8695 });
8696 });
8697
8698 }, 1500);
8699 });
8700 });
8701
8702 $('#headerSignUp').on('click', function(e) {
8703 e.preventDefault();
8704 self.$wrapper.addClass('signup').removeClass('signin').removeClass('recover');
8705 self.$wrapper.find('.signup-form input:first').focus();
8706 });
8707
8708 $('#headerSignIn').on('click', function(e) {
8709 e.preventDefault();
8710 self.$wrapper.addClass('signin').removeClass('signup').removeClass('recover');
8711 self.$wrapper.find('.signin-form input:first').focus();
8712 });
8713
8714 $('#headerRecover').on('click', function(e) {
8715 e.preventDefault();
8716 self.$wrapper.addClass('recover').removeClass('signup').removeClass('signin');
8717 self.$wrapper.find('.recover-form input:first').focus();
8718 });
8719
8720 $('#headerRecoverCancel').on('click', function(e) {
8721 e.preventDefault();
8722 self.$wrapper.addClass('signin').removeClass('signup').removeClass('recover');
8723 self.$wrapper.find('.signin-form input:first').focus();
8724 });
8725 }
8726
8727 }
8728
8729 });
8730
8731}).apply(this, [window.theme, jQuery]);
8732
8733// Nav
8734(function(theme, $) {
8735
8736 theme = theme || {};
8737
8738 var initialized = false;
8739
8740 $.extend(theme, {
8741
8742 Nav: {
8743
8744 defaults: {
8745 wrapper: $('#mainNav'),
8746 scrollDelay: 600,
8747 scrollAnimation: 'easeOutQuad'
8748 },
8749
8750 initialize: function($wrapper, opts) {
8751 if (initialized) {
8752 return this;
8753 }
8754
8755 initialized = true;
8756 this.$wrapper = ($wrapper || this.defaults.wrapper);
8757
8758 this
8759 .setOptions(opts)
8760 .build()
8761 .events();
8762
8763 return this;
8764 },
8765
8766 setOptions: function(opts) {
8767 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options')));
8768
8769 return this;
8770 },
8771
8772 build: function() {
8773 var self = this,
8774 $html = $('html'),
8775 $header = $('#header'),
8776 $headerNavMain = $('#header .header-nav-main'),
8777 thumbInfoPreview;
8778
8779 // Preview Thumbs
8780 if( self.$wrapper.find('a[data-thumb-preview]').length ) {
8781 self.$wrapper.find('a[data-thumb-preview]').each(function() {
8782 thumbInfoPreview = $('<span />').addClass('thumb-info thumb-info-preview')
8783 .append($('<span />').addClass('thumb-info-wrapper')
8784 .append($('<span />').addClass('thumb-info-image').css('background-image', 'url(' + $(this).data('thumb-preview') + ')')
8785 )
8786 );
8787
8788 $(this).append(thumbInfoPreview);
8789 });
8790 }
8791
8792 // Side Header / Side Header Hamburguer Sidebar (Reverse Dropdown)
8793 if($html.hasClass('side-header') || $html.hasClass('side-header-hamburguer-sidebar')) {
8794
8795 // Side Header Right / Side Header Hamburguer Sidebar Right
8796 if($html.hasClass('side-header-right') || $html.hasClass('side-header-hamburguer-sidebar-right')) {
8797 if(!$html.hasClass('side-header-right-no-reverse')) {
8798 $header.find('.dropdown-submenu').addClass('dropdown-reverse');
8799 }
8800 }
8801
8802 } else {
8803
8804 // Reverse
8805 var checkReverseFlag = false;
8806 self.checkReverse = function() {
8807 if( !checkReverseFlag ) {
8808 self.$wrapper.find('.dropdown, .dropdown-submenu').removeClass('dropdown-reverse');
8809
8810 self.$wrapper.find('.dropdown:not(.manual):not(.dropdown-mega), .dropdown-submenu:not(.manual)').each(function() {
8811 if(!$(this).find('.dropdown-menu').visible( false, true, 'horizontal' ) ) {
8812 $(this).addClass('dropdown-reverse');
8813 }
8814 });
8815
8816 checkReverseFlag = true;
8817 }
8818 }
8819
8820 $(window).on('resize', function(){
8821 checkReverseFlag = false;
8822 });
8823
8824 $header.on('mouseover', function(){
8825 self.checkReverse();
8826 });
8827
8828 }
8829
8830 // Clone Items
8831 if($headerNavMain.hasClass('header-nav-main-clone-items')) {
8832
8833 $headerNavMain.find('nav > ul > li > a').each(function(){
8834 var parent = $(this).parent(),
8835 clone = $(this).clone(),
8836 clone2 = $(this).clone(),
8837 wrapper = $('<span class="wrapper-items-cloned"></span>');
8838
8839 // Config Classes
8840 $(this).addClass('item-original');
8841 clone2.addClass('item-two');
8842
8843 // Insert on DOM
8844 parent.prepend(wrapper);
8845 wrapper.append(clone).append(clone2);
8846 });
8847
8848 }
8849
8850 // Floating
8851 if($('#header.header-floating-icons').length && $(window).width() > 991) {
8852
8853 var menuFloatingAnim = {
8854 $menuFloating: $('#header.header-floating-icons .header-container > .header-row'),
8855
8856 build: function() {
8857 var self = this;
8858
8859 self.init();
8860 },
8861 init: function(){
8862 var self = this,
8863 divisor = 0;
8864
8865 $(window).scroll(function() {
8866 var scrollPercent = 100 * $(window).scrollTop() / ($(document).height() - $(window).height()),
8867 st = $(this).scrollTop();
8868
8869 divisor = $(document).height() / $(window).height();
8870
8871 self.$menuFloating.find('.header-column > .header-row').css({
8872 transform : 'translateY( calc('+ scrollPercent +'vh - '+ st / divisor +'px) )'
8873 });
8874 });
8875 }
8876 }
8877
8878 menuFloatingAnim.build();
8879
8880 }
8881
8882 // Slide
8883 if($('.header-nav-links-vertical-slide').length) {
8884 var slideNavigation = {
8885 $mainNav: $('#mainNav'),
8886 $mainNavItem: $('#mainNav li'),
8887
8888 build: function(){
8889 var self = this;
8890
8891 self.menuNav();
8892 },
8893 menuNav: function(){
8894 var self = this;
8895
8896 self.$mainNavItem.on('click', function(e){
8897 var currentMenuItem = $(this),
8898 currentMenu = $(this).parent(),
8899 nextMenu = $(this).find('ul').first(),
8900 prevMenu = $(this).closest('.next-menu'),
8901 isSubMenu = currentMenuItem.hasClass('dropdown') || currentMenuItem.hasClass('dropdown-submenu'),
8902 isBack = currentMenuItem.hasClass('back-button'),
8903 nextMenuHeightDiff = ( ( nextMenu.find('> li').length * nextMenu.find('> li').outerHeight() ) - nextMenu.outerHeight() ),
8904 prevMenuHeightDiff = ( ( prevMenu.find('> li').length * prevMenu.find('> li').outerHeight() ) - prevMenu.outerHeight() );
8905
8906 if( isSubMenu ) {
8907 currentMenu.addClass('next-menu');
8908 nextMenu.addClass('visible');
8909 currentMenu.css({
8910 overflow: 'visible',
8911 'overflow-y': 'visible'
8912 });
8913
8914 if( nextMenuHeightDiff > 0 ) {
8915 nextMenu.css({
8916 overflow: 'hidden',
8917 'overflow-y': 'scroll'
8918 });
8919 }
8920
8921 for( i = 0; i < nextMenu.find('> li').length; i++ ) {
8922 if( nextMenu.outerHeight() < ($('.header-row-side-header').outerHeight() - 100) ) {
8923 nextMenu.css({
8924 height: nextMenu.outerHeight() + nextMenu.find('> li').outerHeight()
8925 });
8926 }
8927 }
8928
8929 nextMenu.css({
8930 'padding-top': nextMenuHeightDiff + 'px'
8931 });
8932 }
8933
8934 if( isBack ) {
8935 currentMenu.parent().parent().removeClass('next-menu');
8936 currentMenu.removeClass('visible');
8937
8938 if( prevMenuHeightDiff > 0 ) {
8939 prevMenu.css({
8940 overflow: 'hidden',
8941 'overflow-y': 'scroll'
8942 });
8943 }
8944 }
8945
8946 e.stopPropagation();
8947 });
8948 }
8949 }
8950
8951 $(window).trigger('resize');
8952
8953 if( $(window).width() > 991 ) {
8954 slideNavigation.build();
8955 }
8956
8957 $(document).ready(function(){
8958 $(window).afterResize(function(){
8959 if( $(window).width() > 991 ) {
8960 slideNavigation.build();
8961 }
8962 });
8963 });
8964 }
8965
8966 // Header Nav Main Mobile Dark
8967 if($('.header-nav-main-mobile-dark').length) {
8968 $('#header:not(.header-transparent-dark-bottom-border):not(.header-transparent-light-bottom-border)').addClass('header-no-border-bottom');
8969 }
8970
8971 // Keyboard Navigation / Accessibility
8972 if( $(window).width() > 991 ) {
8973 var focusFlag = false;
8974 $header.find('.header-nav-main nav > ul > li > a').on('focus', function(){
8975
8976 if( $(window).width() > 991 ) {
8977 if( !focusFlag ) {
8978 focusFlag = true;
8979 $(this).trigger('blur');
8980
8981 self.focusMenuWithChildren();
8982 }
8983 }
8984
8985 });
8986 }
8987
8988 return this;
8989 },
8990
8991 focusMenuWithChildren: function() {
8992 // Get all the link elements within the primary menu.
8993 var links, i, len,
8994 menu = document.querySelector( 'html:not(.side-header):not(.side-header-hamburguer-sidebar):not(.side-header-overlay-full-screen) .header-nav-main > nav' );
8995
8996 if ( ! menu ) {
8997 return false;
8998 }
8999
9000 links = menu.getElementsByTagName( 'a' );
9001
9002 // Each time a menu link is focused or blurred, toggle focus.
9003 for ( i = 0, len = links.length; i < len; i++ ) {
9004 links[i].addEventListener( 'focus', toggleFocus, true );
9005 links[i].addEventListener( 'blur', toggleFocus, true );
9006 }
9007
9008 //Sets or removes the .focus class on an element.
9009 function toggleFocus() {
9010 var self = this;
9011
9012 // Move up through the ancestors of the current link until we hit .primary-menu.
9013 while ( -1 === self.className.indexOf( 'header-nav-main' ) ) {
9014 // On li elements toggle the class .focus.
9015 if ( 'li' === self.tagName.toLowerCase() ) {
9016 if ( -1 !== self.className.indexOf( 'accessibility-open' ) ) {
9017 self.className = self.className.replace( ' accessibility-open', '' );
9018 } else {
9019 self.className += ' accessibility-open';
9020 }
9021 }
9022 self = self.parentElement;
9023 }
9024 }
9025 },
9026
9027 events: function() {
9028 var self = this,
9029 $html = $('html'),
9030 $header = $('#header'),
9031 $window = $(window),
9032 headerBodyHeight = $('.header-body').outerHeight();
9033
9034 if( $header.hasClass('header') ) {
9035 $header = $('.header');
9036 }
9037
9038 $header.find('a[href="#"]').on('click', function(e) {
9039 e.preventDefault();
9040 });
9041
9042 // Mobile Arrows
9043 if( $html.hasClass('side-header-hamburguer-sidebar') ) {
9044 $header.find('.dropdown-toggle, .dropdown-submenu > a')
9045 .append('<i class="fas fa-chevron-down fa-chevron-right"></i>');
9046 } else {
9047 $header.find('.dropdown-toggle, .dropdown-submenu > a')
9048 .append('<i class="fas fa-chevron-down"></i>');
9049 }
9050
9051 $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) {
9052 e.preventDefault();
9053 if ($window.width() < 992) {
9054 $(this).closest('li').toggleClass('open');
9055
9056 // Adjust Header Body Height
9057 var height = ( $header.hasClass('header-effect-shrink') && $html.hasClass('sticky-header-active') ) ? theme.StickyHeader.options.stickyHeaderContainerHeight : headerBodyHeight;
9058 $('.header-body').animate({
9059 height: ($('.header-nav-main nav').outerHeight(true) + height) + 10
9060 }, 0);
9061 }
9062 });
9063
9064 $header.find('li a.active').addClass('current-page-active');
9065
9066 // Add Open Class
9067 $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) {
9068 if( !$('html').hasClass('side-header-hamburguer-sidebar') && $window.width() > 991 ) {
9069 e.preventDefault();
9070 e.stopPropagation();
9071 }
9072
9073 if ($window.width() > 991) {
9074 e.preventDefault();
9075 e.stopPropagation();
9076
9077 $header.find('li a.active').removeClass('active');
9078
9079 if( $(this).prop('tagName') == 'I' ) {
9080 $(this).parent().addClass('active');
9081 } else {
9082 $(this).addClass('active');
9083 }
9084
9085 if (!$(this).closest('li').hasClass('open')) {
9086
9087 var $li = $(this).closest('li'),
9088 isSub = false;
9089
9090 if( $(this).prop('tagName') == 'I' ) {
9091 $('#header .dropdown.open').removeClass('open');
9092 $('#header .dropdown-menu .dropdown-submenu.open').removeClass('open');
9093 }
9094
9095 if ( $(this).parent().hasClass('dropdown-submenu') ) {
9096 isSub = true;
9097 }
9098
9099 $(this).closest('.dropdown-menu').find('.dropdown-submenu.open').removeClass('open');
9100 $(this).parent('.dropdown').parent().find('.dropdown.open').removeClass('open');
9101
9102 if (!isSub) {
9103 $(this).parent().find('.dropdown-submenu.open').removeClass('open');
9104 }
9105
9106 $li.addClass('open');
9107
9108 $(document).off('click.nav-click-to-open').on('click.nav-click-to-open', function (e) {
9109 if (!$li.is(e.target) && $li.has(e.target).length === 0) {
9110 $li.removeClass('open');
9111 $li.parents('.open').removeClass('open');
9112 $header.find('li a.active').removeClass('active');
9113 $header.find('li a.current-page-active').addClass('active');
9114 }
9115 });
9116
9117 } else {
9118 $(this).closest('li').removeClass('open');
9119 $header.find('li a.active').removeClass('active');
9120 $header.find('li a.current-page-active').addClass('active');
9121 }
9122
9123 $window.trigger({
9124 type: 'resize',
9125 from: 'header-nav-click-to-open'
9126 });
9127 }
9128 });
9129
9130 // Collapse Nav
9131 $header.find('[data-collapse-nav]').on('click', function(e) {
9132 $(this).parents('.collapse').removeClass('show');
9133 });
9134
9135 // Top Features
9136 $header.find('.header-nav-features-toggle').on('click', function(e) {
9137 e.preventDefault();
9138
9139 var $toggleParent = $(this).parent();
9140
9141 if (!$(this).siblings('.header-nav-features-dropdown').hasClass('show')) {
9142
9143 var $dropdown = $(this).siblings('.header-nav-features-dropdown');
9144
9145 $('.header-nav-features-dropdown.show').removeClass('show');
9146
9147 $dropdown.addClass('show');
9148
9149 $(document).off('click.header-nav-features-toggle').on('click.header-nav-features-toggle', function (e) {
9150 if (!$toggleParent.is(e.target) && $toggleParent.has(e.target).length === 0) {
9151 $('.header-nav-features-dropdown.show').removeClass('show');
9152 }
9153 });
9154
9155 if ($(this).attr('data-focus')) {
9156 $('#' + $(this).attr('data-focus')).focus();
9157 }
9158
9159 } else {
9160 $(this).siblings('.header-nav-features-dropdown').removeClass('show');
9161 }
9162 });
9163
9164 // Hamburguer Menu
9165 var $hamburguerMenuBtn = $('.hamburguer-btn:not(.side-panel-toggle)'),
9166 $hamburguerSideHeader = $('#header.side-header, #header.side-header-overlay-full-screen');
9167
9168 $hamburguerMenuBtn.on('click', function(){
9169 if($(this).attr('data-set-active') != 'false') {
9170 $(this).toggleClass('active');
9171 }
9172 $hamburguerSideHeader.toggleClass('side-header-hide');
9173 $html.toggleClass('side-header-hide');
9174
9175 $window.trigger('resize');
9176 });
9177
9178 $('.hamburguer-close:not(.side-panel-toggle)').on('click', function(){
9179 $('.hamburguer-btn:not(.hamburguer-btn-side-header-mobile-show)').trigger('click');
9180 });
9181
9182 // Set Header Body Height when open mobile menu
9183 $('.header-nav-main nav').on('show.bs.collapse', function () {
9184 $(this).removeClass('closed');
9185
9186 // Add Mobile Menu Opened Class
9187 $('html').addClass('mobile-menu-opened');
9188
9189 $('.header-body').animate({
9190 height: ($('.header-body').outerHeight() + $('.header-nav-main nav').outerHeight(true)) + 10
9191 });
9192
9193 // Header Below Slider / Header Bottom Slider - Scroll to menu position
9194 if( $('#header').is('.header-bottom-slider, .header-below-slider') && !$('html').hasClass('sticky-header-active') ) {
9195 self.scrollToTarget( $('#header'), 0 );
9196 }
9197 });
9198
9199 // Set Header Body Height when collapse mobile menu
9200 $('.header-nav-main nav').on('hide.bs.collapse', function () {
9201 $(this).addClass('closed');
9202
9203 // Remove Mobile Menu Opened Class
9204 $('html').removeClass('mobile-menu-opened');
9205
9206 $('.header-body').animate({
9207 height: ($('.header-body').outerHeight() - $('.header-nav-main nav').outerHeight(true))
9208 }, function(){
9209 $(this).height('auto');
9210 });
9211 });
9212
9213 // Header Effect Shrink - Adjust header body height on mobile
9214 $window.on('stickyHeader.activate', function(){
9215 if( $window.width() < 992 && $header.hasClass('header-effect-shrink') ) {
9216 if( $('.header-btn-collapse-nav').attr('aria-expanded') == 'true' ) {
9217 $('.header-body').animate({
9218 height: ( $('.header-nav-main nav').outerHeight(true) + theme.StickyHeader.options.stickyHeaderContainerHeight ) + ( ($('.header-nav-bar').length) ? $('.header-nav-bar').outerHeight() : 0 )
9219 });
9220 }
9221 }
9222 });
9223
9224 $window.on('stickyHeader.deactivate', function(){
9225 if( $window.width() < 992 && $header.hasClass('header-effect-shrink') ) {
9226 if( $('.header-btn-collapse-nav').attr('aria-expanded') == 'true' ) {
9227 $('.header-body').animate({
9228 height: headerBodyHeight + $('.header-nav-main nav').outerHeight(true) + 10
9229 });
9230 }
9231 }
9232 });
9233
9234 // Remove Open Class on Resize
9235 $window.on('resize.removeOpen', function(e) {
9236 if( e.from == 'header-nav-click-to-open' ) {
9237 return;
9238 }
9239
9240 setTimeout(function() {
9241 if( $window.width() > 991 ) {
9242 $header.find('.dropdown.open').removeClass('open');
9243 }
9244 }, 100);
9245 });
9246
9247 // Side Header - Change value of initial header body height
9248 $(document).ready(function(){
9249 if( $window.width() > 991 ) {
9250 var flag = false;
9251
9252 $window.on('resize', function(e) {
9253 if( e.from == 'header-nav-click-to-open' ) {
9254 return;
9255 }
9256
9257 $header.find('.dropdown.open').removeClass('open');
9258
9259 if( $window.width() < 992 && flag == false ) {
9260 headerBodyHeight = $('.header-body').outerHeight();
9261 flag = true;
9262
9263 setTimeout(function(){
9264 flag = false;
9265 }, 500);
9266 }
9267 });
9268 }
9269 });
9270
9271 // Side Header - Set header height on mobile
9272 if( $html.hasClass('side-header') ) {
9273 if( $window.width() < 992 ) {
9274 $header.css({
9275 height: $('.header-body .header-container').outerHeight() + (parseInt( $('.header-body').css('border-top-width') ) + parseInt( $('.header-body').css('border-bottom-width') ))
9276 });
9277 }
9278
9279 $(document).ready(function(){
9280 $window.afterResize(function(){
9281 if( $window.width() < 992 ) {
9282 $header.css({
9283 height: $('.header-body .header-container').outerHeight() + (parseInt( $('.header-body').css('border-top-width') ) + parseInt( $('.header-body').css('border-bottom-width') ))
9284 });
9285 } else {
9286 $header.css({
9287 height: ''
9288 });
9289 }
9290 });
9291 });
9292 }
9293
9294 // Anchors Position
9295 if( $('[data-hash]').length ) {
9296 $('[data-hash]').on('mouseover', function(){
9297 var $this = $(this);
9298
9299 if( !$this.data('__dataHashBinded') ) {
9300 var target = $this.attr('href'),
9301 offset = ($this.is("[data-hash-offset]") ? $this.data('hash-offset') : 0),
9302 delay = ($this.is("[data-hash-delay]") ? $this.data('hash-delay') : 0);
9303
9304 if( target.indexOf('#') != -1 && $(target).length) {
9305 $this.on('click', function(e) {
9306 e.preventDefault();
9307
9308 if( !$(e.target).is('i') ) {
9309
9310 setTimeout(function(){
9311
9312 // Close Collapse if open
9313 $this.parents('.collapse.show').collapse('hide');
9314
9315 // Close Side Header
9316 $hamburguerSideHeader.addClass('side-header-hide');
9317 $html.addClass('side-header-hide');
9318
9319 $window.trigger('resize');
9320
9321 self.scrollToTarget(target, offset);
9322
9323 // Data Hash Trigger Click
9324 if( $this.data('hash-trigger-click') ) {
9325
9326 var $clickTarget = $( $this.data('hash-trigger-click') ),
9327 clickDelay = $this.data('hash-trigger-click-delay') ? $this.data('hash-trigger-click-delay') : 0;
9328
9329 if( $clickTarget.length ) {
9330 setTimeout(function(){
9331 $clickTarget.trigger('click');
9332 }, clickDelay);
9333 }
9334
9335 }
9336
9337 }, delay);
9338
9339 }
9340
9341 return;
9342 });
9343 }
9344
9345 $(this).data('__dataHashBinded', true);
9346 }
9347 });
9348 }
9349
9350 // Floating
9351 if($('#header.header-floating-icons').length) {
9352
9353 $('#header.header-floating-icons [data-hash]').off().each(function() {
9354
9355 var target = $(this).attr('href'),
9356 offset = ($(this).is("[data-hash-offset]") ? $(this).data('hash-offset') : 0);
9357
9358 if($(target).length) {
9359 $(this).on('click', function(e) {
9360 e.preventDefault();
9361
9362 $('html, body').animate({
9363 scrollTop: $(target).offset().top - offset
9364 }, 600, 'easeOutQuad', function() {
9365
9366 });
9367
9368 return;
9369 });
9370 }
9371
9372 });
9373
9374 }
9375
9376 // Side Panel Toggle
9377 if( $('.side-panel-toggle').length ) {
9378 var init_html_class = $('html').attr('class');
9379
9380 $('.side-panel-toggle').on('click', function(e){
9381 var extra_class = $(this).data('extra-class'),
9382 delay = ( extra_class ) ? 100 : 0;
9383
9384 e.preventDefault();
9385
9386 if( $(this).hasClass('active') ) {
9387 $('html').removeClass('side-panel-open');
9388 $('.hamburguer-btn.side-panel-toggle:not(.side-panel-close)').removeClass('active');
9389 return false;
9390 }
9391
9392 if( extra_class ) {
9393 $('.side-panel-wrapper').css('transition','none');
9394 $('html')
9395 .removeClass()
9396 .addClass( init_html_class )
9397 .addClass( extra_class );
9398 }
9399
9400 setTimeout(function(){
9401 $('.side-panel-wrapper').css('transition','');
9402 $('html').toggleClass('side-panel-open');
9403 }, delay);
9404 });
9405
9406 $(document).on('click', function(e){
9407 if( !$(e.target).closest('.side-panel-wrapper').length && !$(e.target).hasClass('side-panel-toggle') ) {
9408 $('.hamburguer-btn.side-panel-toggle:not(.side-panel-close)').removeClass('active');
9409 $('html').removeClass('side-panel-open');
9410 }
9411 });
9412 }
9413
9414 return this;
9415 },
9416
9417 scrollToTarget: function(target, offset, stopFlag) {
9418 var self = this;
9419
9420 $('body').addClass('scrolling');
9421
9422 $('html, body').animate({
9423 scrollTop: $(target).offset().top - offset
9424 }, self.options.scrollDelay, self.options.scrollAnimation, function() {
9425 $('body').removeClass('scrolling');
9426
9427 // If by some reason the scroll finishes in a wrong position, this code will run the scrollToTarget() again until get the correct position
9428 // We need do it just one time to prevent infinite recursive loop at scrollToTarget() function
9429 if( !theme.fn.isElementInView( $(target) ) ) {
9430 if( stopFlag == false ) {
9431 self.scrollToTarget( target, offset, false );
9432 stopFlag = true;
9433 }
9434 }
9435 });
9436
9437 return this;
9438
9439 }
9440
9441 }
9442
9443 });
9444
9445}).apply(this, [window.theme, jQuery]);
9446
9447
9448// Newsletter
9449(function(theme, $) {
9450
9451 theme = theme || {};
9452
9453 var initialized = false;
9454
9455 $.extend(theme, {
9456
9457 Newsletter: {
9458
9459 defaults: {
9460 wrapper: $('#newsletterForm')
9461 },
9462
9463 initialize: function($wrapper, opts) {
9464 if (initialized) {
9465 return this;
9466 }
9467
9468 initialized = true;
9469 this.$wrapper = ($wrapper || this.defaults.wrapper);
9470
9471 this
9472 .setOptions(opts)
9473 .build();
9474
9475 return this;
9476 },
9477
9478 setOptions: function(opts) {
9479 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options')));
9480
9481 return this;
9482 },
9483
9484 build: function() {
9485 if (!($.isFunction($.fn.validate))) {
9486 return this;
9487 }
9488
9489 var self = this,
9490 $email = self.$wrapper.find('#newsletterEmail'),
9491 $success = $('#newsletterSuccess'),
9492 $error = $('#newsletterError');
9493
9494 self.$wrapper.validate({
9495 submitHandler: function(form) {
9496
9497 $.ajax({
9498 type: 'POST',
9499 url: self.$wrapper.attr('action'),
9500 data: {
9501 'email': $email.val()
9502 },
9503 dataType: 'json',
9504 success: function(data) {
9505 if (data.response == 'success') {
9506
9507 $success.removeClass('d-none');
9508 $error.addClass('d-none');
9509
9510 $email
9511 .val('')
9512 .blur()
9513 .closest('.control-group')
9514 .removeClass('success')
9515 .removeClass('error');
9516
9517 } else {
9518
9519 $error.html(data.message);
9520 $error.removeClass('d-none');
9521 $success.addClass('d-none');
9522
9523 $email
9524 .blur()
9525 .closest('.control-group')
9526 .removeClass('success')
9527 .addClass('error');
9528
9529 }
9530 }
9531 });
9532
9533 },
9534 rules: {
9535 newsletterEmail: {
9536 required: true,
9537 email: true
9538 }
9539 },
9540 errorPlacement: function(error, element) {
9541
9542 }
9543 });
9544
9545 return this;
9546 }
9547
9548 }
9549
9550 });
9551
9552}).apply(this, [window.theme, jQuery]);
9553
9554// Search
9555(function(theme, $) {
9556
9557 theme = theme || {};
9558
9559 var initialized = false;
9560
9561 $.extend(theme, {
9562
9563 Search: {
9564
9565 defaults: {
9566 wrapper: $('#searchForm')
9567 },
9568
9569 initialize: function($wrapper, opts) {
9570 if (initialized) {
9571 return this;
9572 }
9573
9574 initialized = true;
9575 this.$wrapper = ($wrapper || this.defaults.wrapper);
9576
9577 this
9578 .setOptions(opts)
9579 .build();
9580
9581 return this;
9582 },
9583
9584 setOptions: function(opts) {
9585 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options')));
9586
9587 return this;
9588 },
9589
9590 build: function() {
9591 if (!($.isFunction($.fn.validate))) {
9592 return this;
9593 }
9594
9595 this.$wrapper.validate({
9596 errorPlacement: function(error, element) {}
9597 });
9598
9599 // Search Reveal
9600 theme.fn.execOnceTroughEvent( '#header', 'mouseover.search.reveal', function(){
9601 $('.header-nav-features-search-reveal').each(function() {
9602 var $el = $(this),
9603 $header = $('#header'),
9604 $html = $('html');
9605
9606 $el.find('.header-nav-features-search-show-icon').on('click', function() {
9607 $el.addClass('show');
9608 $header.addClass('search-show');
9609 $html.addClass('search-show');
9610 $('#headerSearch').focus();
9611 });
9612
9613 $el.find('.header-nav-features-search-hide-icon').on('click', function() {
9614 $el.removeClass('show');
9615 $header.removeClass('search-show');
9616 $html.removeClass('search-show');
9617 });
9618 });
9619 } );
9620
9621 return this;
9622 }
9623
9624 }
9625
9626 });
9627
9628}).apply(this, [window.theme, jQuery]);
9629
9630// Sticky Header
9631(function(theme, $) {
9632
9633 theme = theme || {};
9634
9635 var initialized = false;
9636
9637 $.extend(theme, {
9638
9639 StickyHeader: {
9640
9641 defaults: {
9642 wrapper: $('#header'),
9643 headerBody: $('#header .header-body'),
9644 stickyEnabled: true,
9645 stickyEnableOnBoxed: true,
9646 stickyEnableOnMobile: true,
9647 stickyStartAt: 0,
9648 stickyStartAtElement: false,
9649 stickySetTop: 0,
9650 stickyEffect: '',
9651 stickyHeaderContainerHeight: false,
9652 stickyChangeLogo: false,
9653 stickyChangeLogoWrapper: true,
9654 stickyForce: false
9655 },
9656
9657 initialize: function($wrapper, opts) {
9658 if (initialized) {
9659 return this;
9660 }
9661
9662 initialized = true;
9663 this.$wrapper = ($wrapper || this.defaults.wrapper);
9664
9665 if( this.$wrapper.hasClass('header') ) {
9666 this.$wrapper = $('.header[data-plugin-options]');
9667 }
9668
9669 this
9670 .setOptions(opts)
9671 .build()
9672 .events();
9673
9674 return this;
9675 },
9676
9677 setOptions: function(opts) {
9678 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options')));
9679
9680 return this;
9681 },
9682
9683 build: function() {
9684 if (!this.options.stickyEnableOnBoxed && $('html').hasClass('boxed') || $('html').hasClass('side-header-hamburguer-sidebar') && !this.options.stickyForce || !this.options.stickyEnabled) {
9685 return this;
9686 }
9687
9688 var self = this;
9689
9690 if( self.options.wrapper.hasClass('header') ) {
9691 self.options.wrapper = $('.header');
9692 self.options.headerBody = $('.header .header-body');
9693 }
9694
9695
9696 var $html = $('html'),
9697 $window = $(window),
9698 sideHeader = $html.hasClass('side-header'),
9699 initialHeaderTopHeight = self.options.wrapper.find('.header-top').outerHeight(),
9700 initialHeaderContainerHeight = self.options.wrapper.find('.header-container').outerHeight(),
9701 minHeight;
9702
9703 // HTML Classes
9704 $html.addClass('sticky-header-enabled');
9705
9706 if (parseInt(self.options.stickySetTop) < 0) {
9707 $html.addClass('sticky-header-negative');
9708 }
9709
9710 // Notice Top Bar First Load
9711 if( $('.notice-top-bar').get(0) ) {
9712 if (parseInt(self.options.stickySetTop) == 1 || self.options.stickyEffect == 'shrink') {
9713 $('.body').on('transitionend webkitTransitionEnd oTransitionEnd', function () {
9714 setTimeout(function(){
9715 if( !$html.hasClass('sticky-header-active') ) {
9716 self.options.headerBody.animate({
9717 top: $('.notice-top-bar').outerHeight()
9718 }, 300, function(){
9719 if( $html.hasClass('sticky-header-active') ) {
9720 self.options.headerBody.css('top', 0);
9721 }
9722 });
9723 }
9724 }, 0);
9725 });
9726 }
9727 }
9728
9729 // Set Start At
9730 if(self.options.stickyStartAtElement) {
9731
9732 var $stickyStartAtElement = $(self.options.stickyStartAtElement);
9733
9734 $(window).on('scroll resize sticky.header.resize', function() {
9735 self.options.stickyStartAt = $stickyStartAtElement.offset().top;
9736 });
9737
9738 $(window).trigger('sticky.header.resize');
9739 }
9740
9741 // Define Min Height value
9742 if( self.options.wrapper.find('.header-top').get(0) ) {
9743 minHeight = ( initialHeaderTopHeight + initialHeaderContainerHeight );
9744 } else {
9745 minHeight = initialHeaderContainerHeight;
9746 }
9747
9748 // Set Wrapper Min-Height
9749 if( !sideHeader ) {
9750 if( !$('.header-logo-sticky-change').get(0) ) {
9751 self.options.wrapper.css('height', self.options.headerBody.outerHeight());
9752 } else {
9753 $window.on('stickyChangeLogo.loaded', function(){
9754 self.options.wrapper.css('height', self.options.headerBody.outerHeight());
9755 });
9756 }
9757
9758 if( self.options.stickyEffect == 'shrink' ) {
9759
9760 // Prevent wrong visualization of header when reload on middle of page
9761 $(document).ready(function(){
9762 if( $window.scrollTop() >= self.options.stickyStartAt ) {
9763 self.options.wrapper.find('.header-container').on('transitionend webkitTransitionEnd oTransitionEnd', function(){
9764 self.options.headerBody.css('position', 'fixed');
9765 });
9766 } else {
9767 if( !$html.hasClass('boxed') ) {
9768 self.options.headerBody.css('position', 'fixed');
9769 }
9770 }
9771 });
9772
9773 self.options.wrapper.find('.header-container').css('height', initialHeaderContainerHeight);
9774 self.options.wrapper.find('.header-top').css('height', initialHeaderTopHeight);
9775 }
9776 }
9777
9778 // Sticky Header Container Height
9779 if( self.options.stickyHeaderContainerHeight ) {
9780 self.options.wrapper.find('.header-container').css('height', self.options.wrapper.find('.header-container').outerHeight());
9781 }
9782
9783 // Boxed
9784 if($html.hasClass('boxed') && self.options.stickyEffect == 'shrink') {
9785 self.boxedLayout();
9786 }
9787
9788 // Check Sticky Header / Flags prevent multiple runs at same time
9789 var activate_flag = true,
9790 deactivate_flag = false,
9791 initialStickyStartAt = self.options.stickyStartAt;
9792
9793 self.checkStickyHeader = function() {
9794
9795 // Notice Top Bar
9796 var $noticeTopBar = $('.notice-top-bar');
9797 if ( $noticeTopBar.get(0) ) {
9798 self.options.stickyStartAt = ( $noticeTopBar.data('sticky-start-at') ) ? $noticeTopBar.data('sticky-start-at') : $('.notice-top-bar').outerHeight();
9799 } else {
9800 if( $html.hasClass('boxed') ) {
9801 self.options.stickyStartAt = initialStickyStartAt + 25;
9802 } else {
9803 self.options.stickyStartAt = initialStickyStartAt;
9804 }
9805 }
9806
9807 if( $window.width() > 991 && $html.hasClass('side-header') ) {
9808 $html.removeClass('sticky-header-active');
9809 activate_flag = true;
9810 return;
9811 }
9812
9813 if ($window.scrollTop() >= parseInt(self.options.stickyStartAt)) {
9814 if( activate_flag ) {
9815 self.activateStickyHeader();
9816 activate_flag = false;
9817 deactivate_flag = true;
9818 }
9819 } else {
9820 if( deactivate_flag ) {
9821 self.deactivateStickyHeader();
9822 deactivate_flag = false;
9823 activate_flag = true;
9824 }
9825 }
9826 };
9827
9828 // Activate Sticky Header
9829 self.activateStickyHeader = function() {
9830 if ($window.width() < 992) {
9831 if (!self.options.stickyEnableOnMobile) {
9832 self.deactivateStickyHeader();
9833 return;
9834 }
9835 } else {
9836 if (sideHeader) {
9837 self.deactivateStickyHeader();
9838 return;
9839 }
9840 }
9841
9842 $html.addClass('sticky-header-active');
9843
9844 // Sticky Effect - Reveal
9845 if( self.options.stickyEffect == 'reveal' ) {
9846
9847 self.options.headerBody.css('top','-' + self.options.stickyStartAt + 'px');
9848
9849 self.options.headerBody.animate({
9850 top: self.options.stickySetTop
9851 }, 400, function() {});
9852
9853 }
9854
9855 // Sticky Effect - Shrink
9856 if( self.options.stickyEffect == 'shrink' ) {
9857
9858 // If Header Top
9859 if( self.options.wrapper.find('.header-top').get(0) ) {
9860 self.options.wrapper.find('.header-top').css({
9861 height: 0,
9862 'min-height': 0,
9863 overflow: 'hidden'
9864 });
9865 }
9866
9867 // Header Container
9868 if( self.options.stickyHeaderContainerHeight ) {
9869 self.options.wrapper.find('.header-container').css({
9870 height: self.options.stickyHeaderContainerHeight,
9871 'min-height': 0
9872 });
9873 } else {
9874 self.options.wrapper.find('.header-container').css({
9875 height: (initialHeaderContainerHeight / 3) * 2, // two third of container height
9876 'min-height': 0
9877 });
9878
9879 var y = initialHeaderContainerHeight - ((initialHeaderContainerHeight / 3) * 2);
9880 $('.main').css({
9881 transform: 'translate3d(0, -'+ y +'px, 0)',
9882 transition: 'ease transform 300ms'
9883 }).addClass('has-sticky-header-transform');
9884
9885 if($html.hasClass('boxed')) {
9886 self.options.headerBody.css('position','fixed');
9887 }
9888 }
9889
9890 }
9891
9892 self.options.headerBody.css('top', self.options.stickySetTop);
9893
9894 if (self.options.stickyChangeLogo) {
9895 self.changeLogo(true);
9896 }
9897
9898 // Set Elements Style
9899 if( $('[data-sticky-header-style]').length ) {
9900 $('[data-sticky-header-style]').each(function() {
9901 var $el = $(this),
9902 css = theme.fn.getOptions($el.data('sticky-header-style-active')),
9903 opts = theme.fn.getOptions($el.data('sticky-header-style'));
9904
9905 if( $window.width() > opts.minResolution ) {
9906 $el.css(css);
9907 }
9908 });
9909 }
9910
9911 $.event.trigger({
9912 type: 'stickyHeader.activate'
9913 });
9914 };
9915
9916 // Deactivate Sticky Header
9917 self.deactivateStickyHeader = function() {
9918
9919 $html.removeClass('sticky-header-active');
9920
9921 // Sticky Effect - Shrink
9922 if( self.options.stickyEffect == 'shrink' ) {
9923
9924 // Boxed Layout
9925 if( $html.hasClass('boxed') ) {
9926
9927 // Set Header Body Position Absolute
9928 self.options.headerBody.css('position','absolute');
9929
9930 if( $window.scrollTop() > $('.body').offset().top ) {
9931 // Set Header Body Position Fixed
9932 self.options.headerBody.css('position','fixed');
9933 }
9934
9935 } else {
9936 // Set Header Body Position Fixed
9937 self.options.headerBody.css('position','fixed');
9938 }
9939
9940 // If Header Top
9941 if( self.options.wrapper.find('.header-top').get(0) ) {
9942 self.options.wrapper.find('.header-top').css({
9943 height: initialHeaderTopHeight,
9944 overflow: 'visible'
9945 });
9946
9947 // Fix [data-icon] issue when first load is on middle of the page
9948 if( self.options.wrapper.find('.header-top [data-icon]').length ) {
9949 theme.fn.intObsInit( '.header-top [data-icon]:not(.svg-inline--fa)', 'themePluginIcon' );
9950 }
9951 }
9952
9953 // Header Container
9954 self.options.wrapper.find('.header-container').css({
9955 height: initialHeaderContainerHeight
9956 });
9957
9958 }
9959
9960 self.options.headerBody.css('top', 0);
9961
9962 if (self.options.stickyChangeLogo) {
9963 self.changeLogo(false);
9964 }
9965
9966 // Set Elements Style
9967 if( $('[data-sticky-header-style]').length ) {
9968 $('[data-sticky-header-style]').each(function() {
9969 var $el = $(this),
9970 css = theme.fn.getOptions($el.data('sticky-header-style-deactive')),
9971 opts = theme.fn.getOptions($el.data('sticky-header-style'));
9972
9973 if( $window.width() > opts.minResolution ) {
9974 $el.css(css);
9975 }
9976 });
9977 }
9978
9979 $.event.trigger({
9980 type: 'stickyHeader.deactivate'
9981 });
9982 };
9983
9984 // Always Sticky
9985 if (parseInt(self.options.stickyStartAt) <= 0) {
9986 self.activateStickyHeader();
9987 }
9988
9989 // Set Logo
9990 if (self.options.stickyChangeLogo) {
9991
9992 var $logoWrapper = self.options.wrapper.find('.header-logo'),
9993 $logo = $logoWrapper.find('img'),
9994 logoWidth = $logo.attr('width'),
9995 logoHeight = $logo.attr('height'),
9996 logoSmallTop = parseInt($logo.attr('data-sticky-top') ? $logo.attr('data-sticky-top') : 0),
9997 logoSmallWidth = parseInt($logo.attr('data-sticky-width') ? $logo.attr('data-sticky-width') : 'auto'),
9998 logoSmallHeight = parseInt($logo.attr('data-sticky-height') ? $logo.attr('data-sticky-height') : 'auto');
9999
10000 if (self.options.stickyChangeLogoWrapper) {
10001 $logoWrapper.css({
10002 'width': $logo.outerWidth(true),
10003 'height': $logo.outerHeight(true)
10004 });
10005 }
10006
10007 self.changeLogo = function(activate) {
10008 if(activate) {
10009
10010 $logo.css({
10011 'top': logoSmallTop,
10012 'width': logoSmallWidth,
10013 'height': logoSmallHeight
10014 });
10015
10016 } else {
10017
10018 $logo.css({
10019 'top': 0,
10020 'width': logoWidth,
10021 'height': logoHeight
10022 });
10023
10024 }
10025 }
10026
10027 $.event.trigger({
10028 type: 'stickyChangeLogo.loaded'
10029 });
10030
10031 }
10032
10033 // Side Header
10034 var headerBodyHeight,
10035 flag = false;
10036
10037 self.checkSideHeader = function() {
10038 if($window.width() < 992 && flag == false) {
10039 headerBodyHeight = self.options.headerBody.height();
10040 flag = true;
10041 }
10042
10043 if(self.options.stickyStartAt == 0 && sideHeader) {
10044 self.options.wrapper.css('min-height', 0);
10045 }
10046
10047 if(self.options.stickyStartAt > 0 && sideHeader && $window.width() < 992) {
10048 self.options.wrapper.css('min-height', headerBodyHeight);
10049 }
10050 }
10051
10052 return this;
10053 },
10054
10055 events: function() {
10056 var self = this;
10057
10058 if (!this.options.stickyEnableOnBoxed && $('body').hasClass('boxed') || $('html').hasClass('side-header-hamburguer-sidebar') && !this.options.stickyForce || !this.options.stickyEnabled) {
10059 return this;
10060 }
10061
10062 if (!self.options.alwaysStickyEnabled) {
10063 $(window).on('scroll resize', function() {
10064 self.checkStickyHeader();
10065 });
10066 } else {
10067 self.activateStickyHeader();
10068 }
10069
10070 $(window).on('load resize', function(){
10071 self.checkSideHeader();
10072 });
10073
10074 $(window).on('layout.boxed', function(){
10075 self.boxedLayout();
10076 });
10077
10078 return this;
10079 },
10080
10081 boxedLayout: function(){
10082 var self = this,
10083 $window = $(window);
10084
10085 if($('html').hasClass('boxed') && self.options.stickyEffect == 'shrink') {
10086 if( (parseInt(self.options.stickyStartAt) == 0) && $window.width() > 991) {
10087 self.options.stickyStartAt = 30;
10088 }
10089
10090 // Set Header Body Position Absolute
10091 self.options.headerBody.css({
10092 position: 'absolute',
10093 top: 0
10094 });
10095
10096 // Set position absolute because top margin from boxed layout
10097 $window.on('scroll', function(){
10098 if( $window.scrollTop() > $('.body').offset().top ) {
10099 self.options.headerBody.css({
10100 'position' : 'fixed',
10101 'top' : 0
10102 });
10103 } else {
10104 self.options.headerBody.css({
10105 'position' : 'absolute',
10106 'top' : 0
10107 });
10108 }
10109 });
10110 }
10111
10112 return this;
10113 }
10114
10115 }
10116
10117 });
10118
10119}).apply(this, [window.theme, jQuery]);