PageSourceSearch

https://justcreativepeople.co.uk/wp-content/plugins/tatsu-pro/incl…/public/js/oshine-modules.js?ver=3.2

js justcreativepeople.co.uk collected 2026-10-10 01:11:49 UTC 127,623 bytes, 2,843 lines download raw bytes

1/**OS SCROLLBAR**/
2;(function($) {
3	var isMsie = false;
4	if ( navigator.userAgent.match(/MSIE ([0-9]+)\./) ) {
5		isMsie = true;
6		$('body').addClass('internet-explorer');
7	}
8
9	var scrollbarWidth = 0;
10	$.getScrollbarWidth = function() {
11		if ( !scrollbarWidth ) {
12			if ( isMsie ) {
13				var $textarea1 = $('<textarea cols="10" rows="2"></textarea>')
14						.css({ position: 'absolute', top: -1000, left: -1000 }).appendTo('body'),
15					$textarea2 = $('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>')
16						.css({ position: 'absolute', top: -1000, left: -1000 }).appendTo('body');
17				scrollbarWidth = $textarea1.width() - $textarea2.width();
18				$textarea1.add($textarea2).remove();
19			} else {
20				var $div = $('<div />')
21					.css({ width: 100, height: 100, overflow: 'auto', position: 'absolute', top: -1000, left: -1000 })
22					.prependTo('body').append('<div />').find('div')
23						.css({ width: '100%', height: 200 });
24				scrollbarWidth = 100 - $div.width();
25				$div.parent().remove();
26			}
27		}
28		return scrollbarWidth;
29	};
30})(jQuery);
31
32/**
33 * jQuery Unveil
34 * A very lightweight jQuery plugin to lazy load images
35 * http://luis-almeida.github.com/unveil
36 *
37 * Licensed under the MIT license.
38 * Copyright 2013 Luís Almeida
39 * https://github.com/luis-almeida
40 */
41
42;(function($) {
43
44  $.fn.unveil = function(threshold, callback) {
45
46    var $w = $(window),
47        th = threshold || 0,
48        retina = window.devicePixelRatio > 1,
49        attrib = retina? "data-src-retina" : "data-src",
50        images = this,
51        loaded;
52
53    this.one("unveil", function() {
54      var source = this.getAttribute(attrib);
55      source = source || this.getAttribute("data-src");
56      if (source) {
57        this.setAttribute("src", source);
58        if (typeof callback === "function") callback.call(this);
59      }
60    });
61
62    function unveil() {
63      var inview = images.filter(function() {
64        var $e = $(this);
65        if ($e.is(":hidden")) return;
66
67        var wt = $w.scrollTop(),
68            wb = wt + $w.height(),
69            et = $e.offset().top,
70            eb = et + $e.height();
71
72        return eb >= wt - th && et <= wb + th;
73      });
74
75      loaded = inview.trigger("unveil");
76      images = images.not(loaded);
77    }
78
79    $w.on("scroll.unveil resize.unveil lookup.unveil", unveil);
80
81    unveil();
82
83    return this;
84
85  };
86
87})(window.jQuery || window.Zepto);
88
89/******************************************************************************/
90/** Smart Resize **/
91
92;(function($,sr) {
93 // debouncing function from John Hann
94 // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
95 var debounce = function (func, threshold, execAsap) {
96    var timeout;
97     return function debounced () {
98         var obj = this, args = arguments;
99         function delayed () {
100             if (!execAsap)
101                 func.apply(obj, args);
102             timeout = null;
103         };
104
105         if (timeout)
106             clearTimeout(timeout);
107         else if (execAsap)
108             func.apply(obj, args);
109
110         timeout = setTimeout(delayed, threshold || 100);
111     };
112 }
113 // smartresize 
114 jQuery.fn[sr] = function(fn){  return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); };
115})(jQuery,'smartresize');
116
117/******************************************************************************/
118
119;(function($) {
120	/**
121   * Copyright 2012, Digital Fusion
122   * Licensed under the MIT license.
123   * http://teamdf.com/jquery-plugins/license/
124   *
125   * @author Sam Sehnert
126   * @desc A small plugin that checks whether elements are within
127   *     the user visible viewport of a web browser.
128   *     only accounts for vertical position, not horizontal.
129   */
130	$.fn.visible = function(partial) {
131    
132      var $t            = $(this),
133          $w            = $(window),
134          viewTop       = $w.scrollTop(),
135          viewBottom    = viewTop + $w.height(),
136          _top          = $t.offset().top,
137          _bottom       = _top + $t.height(),
138          compareTop    = partial === true ? _bottom : _top,
139          compareBottom = partial === true ? _top : _bottom;
140    
141    return ((compareBottom <= viewBottom) && (compareTop >= viewTop));
142
143  };
144    
145})(jQuery);
146
147/******************************************************************************/
148
149(function( $ ) {
150    'use strict';
151
152	var vendorScriptsUrl = oshineModulesConfig.vendorScriptsUrl,
153		dependencies = oshineModulesConfig.dependencies || {};
154
155    // asyncloader.register( vendorScriptsUrl+'backgroundcheck.js', 'backgroundcheck' );
156    // asyncloader.register( vendorScriptsUrl+'backgroundposition.js', 'backgroundposition' );
157    // asyncloader.register( vendorScriptsUrl+'countdown.js', 'countdown' );
158    // asyncloader.register( vendorScriptsUrl+'easing.js', 'easing' );
159    // asyncloader.register( vendorScriptsUrl+'easypiechart.js', 'easypiechart' );
160    // asyncloader.register( vendorScriptsUrl+'fitvids.js', 'fitvids' );
161    // asyncloader.register( vendorScriptsUrl+'fullscreenheight.js', 'fullscreenheight' );
162    // asyncloader.register( vendorScriptsUrl+'hoverdir.js', 'hoverdir' );
163    // asyncloader.register( vendorScriptsUrl+'isotope.js', 'isotope' );
164    // asyncloader.register( vendorScriptsUrl+'justifiedgallery.js', 'justifiedgallery' );
165    // asyncloader.register( vendorScriptsUrl+'magnificpopup.js', 'magnificpopup' );
166    // asyncloader.register( vendorScriptsUrl+'mousewheel.js', 'mousewheel' );
167    // asyncloader.register( vendorScriptsUrl+'owlcarousel.js', 'owlcarousel' );
168    // asyncloader.register( vendorScriptsUrl+'photoswipe.js', 'photoswipe' );
169    // asyncloader.register( vendorScriptsUrl+'resizetoparent.js', 'resizetoparent' );
170    // asyncloader.register( vendorScriptsUrl+'rotate.js', 'rotate' );
171    // asyncloader.register( vendorScriptsUrl+'typed.js', 'typed' );
172    // asyncloader.register( vendorScriptsUrl+'waypoints.js', 'waypoints' );
173    // asyncloader.register( vendorScriptsUrl+'imagesloaded.js', 'imagesloaded' );  
174    // asyncloader.register( vendorScriptsUrl+'beslider.js', 'beslider' );    
175    // asyncloader.register( vendorScriptsUrl+'vivusSVGanimation.js', 'vivusSVGanimation' );    
176    // asyncloader.register( vendorScriptsUrl+'tilt.js', 'tilt' );
177
178	if( 'undefined' != typeof dependencies ) {
179		for( var dependency in dependencies ) {
180			if( dependencies.hasOwnProperty( dependency ) ) {
181				asyncloader.register( dependencies[ dependency ], dependency );
182			}
183		}
184	}
185
186    var directionalHover = function( element ) {	    
187    	 asyncloader.require( 'hoverdir', function() {
188    	 	var elementInner = element.find( '.element-inner' );
189            if( element.hasClass('style3-hover') ) {
190                elementInner.each(function () {
191                    jQuery(this).hoverdir();
192                });
193            } else if( element.hasClass('style4-hover') ) {
194                elementInner.each(function () {
195                    jQuery(this).hoverdir({
196                        inverse: true
197                    });
198                });                   
199            }
200        });
201    };
202
203   var photoswipe =  function( gallerySelector ) {
204
205            asyncloader.require( 'photoswipe', function() {
206
207                    var parseThumbnailElements = function(el) {
208                        var items = [],
209                            el,
210                            childElements,
211                            thumbnailEl,
212                            size,
213                            item;
214
215                        var anchor = jQuery(el).find('a.thumb-wrap');
216                        anchor.each( function() {
217                            size = jQuery(this).attr('data-size').split('x');
218                            item = {
219                                src: jQuery(this).attr('href'),
220                                w: parseInt(size[0], 10),
221                                h: parseInt(size[1], 10),
222                                author: jQuery(this).attr('data-author')
223                            };
224                            item.title = jQuery(this).attr('title');
225                            item.el = jQuery(this);
226                            item.o = {
227                                src: item.src,
228                                w: item.w,
229                                h: item.h
230                            };
231
232                            items.push(item);
233                        });
234                        return items;
235                    };
236
237                    // find nearest parent element
238                    var closest = function closest(el, fn) {
239                        return el && ( fn(el) ? el : closest(el.parentNode, fn) );
240                    };
241
242                    var onThumbnailsClick = function(e) {
243                        e = e || window.event;
244                        e.preventDefault ? e.preventDefault() : e.returnValue = false;
245
246                        var eTarget = e.target || e.srcElement;
247
248                        if(!clickedListItem) {
249                            return;
250                        }
251
252                        var clickedGallery = clickedListItem.parentNode;
253
254                        var childNodes = clickedListItem.parentNode.childNodes,
255                            numChildNodes = childNodes.length,
256                            nodeIndex = 0,
257                            index;
258
259                        for (var i = 0; i < numChildNodes; i++) {
260                            if(childNodes[i].nodeType !== 1) { 
261                                continue; 
262                            }
263
264                            if(childNodes[i] === clickedListItem) {
265                                index = nodeIndex;
266                                break;
267                            }
268                            nodeIndex++;
269                        }
270
271                        if(index >= 0) {
272                            openPhotoSwipe( index, clickedGallery );
273                        }
274                        return false;
275                    };
276
277                    var photoswipeParseHash = function() {
278                        var hash = window.location.hash.substring(1),
279                        params = {};
280
281                        if(hash.length < 5) { // pid=1
282                            return params;
283                        }
284
285                        var vars = hash.split('&');
286                        for (var i = 0; i < vars.length; i++) {
287                            if(!vars[i]) {
288                                continue;
289                            }
290                            var pair = vars[i].split('=');  
291                            if(pair.length < 2) {
292                                continue;
293                            }           
294                            params[pair[0]] = pair[1];
295                        }
296
297                        if(params.gid) {
298                            params.gid = parseInt(params.gid, 10);
299                        }
300
301                        if(!params.hasOwnProperty('pid')) {
302                            return params;
303                        }
304                        params.pid = parseInt(params.pid, 10);
305                        return params;
306                    };
307
308                    var openPhotoSwipe = function(index, galleryElement, disableAnimation) {
309
310                        var pswpElement = document.querySelectorAll('.pswp')[0],
311                            gallery,
312                            options,
313                            items,
314                            history = true;
315
316                        if( jQuery('body').hasClass('all-ajax-content') ){
317                            history = false;
318                        }
319
320                        items = parseThumbnailElements(galleryElement); //Parse Demo Gallery
321                        
322                        // define options (if needed)
323                        options = {
324                            index: index,
325                            history: history,
326                            galleryUID: galleryElement.attr('data-pswp-uid'),
327
328                            getThumbBoundsFn: function(index) {
329                                // See Options->getThumbBoundsFn section of docs for more info
330                                
331                                var thumbnail = items[index].el.find('img')[0],
332                                    pageYScroll = window.pageYOffset || document.documentElement.scrollTop,
333                                    rect = thumbnail.getBoundingClientRect(); 
334
335                                return {x:rect.left, y:rect.top + pageYScroll, w:rect.width};
336                            },
337
338                            addCaptionHTMLFn: function(item, captionEl, isFake) {
339
340                                if(!item.title) {
341                                    captionEl.children[0].innerText = '';
342                                    return false;
343                                }
344                                captionEl.children[0].innerHTML = item.title; //+  '<br/><small>
344Photo: ' + item.author + '</small>';
345                                return true;
346                            }
347                            
348                        };
349
350                        var radios = document.getElementsByName('gallery-style');
351                        for (var i = 0, length = radios.length; i < length; i++) {
352                            if (radios[i].checked) {
353                                if(radios[i].id == 'radio-all-controls') {
354
355                                } else if(radios[i].id == 'radio-minimal-black') {
356                                    options.mainClass = 'pswp--minimal--dark';
357                                    options.barsSize = {top:0,bottom:0};
358                                    options.captionEl = false;
359                                    options.fullscreenEl = false;
360                                    options.shareEl = false;
361                                    options.bgOpacity = 0.85;
362                                    options.tapToClose = true;
363                                    options.tapToToggleControls = false;
364                                }
365                                break;
366                            }
367                        }
368
369                        if(disableAnimation) {
370                            options.showAnimationDuration = 0;
371                        }
372
373                        // Pass data to PhotoSwipe and initialize it
374                        gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options);
375
376
377                        
378                        var realViewportWidth,
379                            useLargeImages = false,
380                            firstResize = true,
381                            imageSrcWillChange;
382
383                        gallery.listen('beforeResize', function() {
384
385                            var dpiRatio = window.devicePixelRatio ? window.devicePixelRatio : 1;
386                            dpiRatio = Math.min(dpiRatio, 2.5);
387                            realViewportWidth = gallery.viewportSize.x * dpiRatio;
388
389
390                            if(realViewportWidth >= 1200 || (!gallery.likelyTouchDevice && realViewportWidth > 800) || screen.width > 1200 ) {
391                                if(!useLargeImages) {
392                                    useLargeImages = true;
393                                    imageSrcWillChange = true;
394                                }
395                                
396                            } else {
397                                if(useLargeImages) {
398                                    useLargeImages = false;
399                                    imageSrcWillChange = true;
400                                }
401                            }
402
403                            if(imageSrcWillChange && !firstResize) {
404                                gallery.invalidateCurrItems();
405                            }
406
407                            if(firstResize) {
408                                firstResize = false;
409                            }
410
411                            imageSrcWillChange = false;
412
413                        });
414
415                        gallery.listen('gettingData', function(index, item) {
416                            //if( useLargeImages ) {
417                                item.src = item.o.src;
418                                item.w = item.o.w;
419                                item.h = item.o.h;
420                            // } else {
421                            //     item.src = item.m.src;
422                            //     item.w = item.m.w;
423                            //     item.h = item.m.h;
424                            // }
425                        });
426
427                        gallery.init();
428
429                    };
430
431
432
433                    var galleryElements = jQuery(gallerySelector);
434                    var i = 0;
435                    galleryElements.each( function() {
436                        var $this = jQuery(this);
437                        $this.attr('data-pswp-uid',i+1);
438                        $this.off('click');
439                        $this.on('click', 'a.thumb-wrap', function(e) {
440                            e.preventDefault();
441                            openPhotoSwipe(jQuery(this).closest('.element').index(), $this );
442                        });
443                        i++;
444                    });
445
446
447                    // Parse URL and open gallery if it contains #&pid=3&gid=1
448                    var hashData = photoswipeParseHash();
449                    if(hashData.pid > 0 && hashData.gid > 0) {
450                        openPhotoSwipe( hashData.pid - 1 ,  galleryElements.eq( hashData.gid - 1 ), true );
451                    }
452            });                 
453    };    
454     
455
456     jQuery(document).ready( function() {
457
458		var $window = jQuery( window ),
459		$body = jQuery('body');
460	    var oshine_modules = (function() {
461
462	        var  ajax_url = jQuery( '#ajax_url' ).val(),
463	        	 tatsuCallbacks = {},
464	        	 testimonialCarousel,
465                 portfolioElement = jQuery( '.element' ),
466				 animatedChartsWrap = jQuery( '.chart' ),
467				 skillsWrap = jQuery( '.be-skill' ),
468				 svgModules = jQuery( '.oshine-svg-icon:not( .svg-line-animate )' ),
469				 svgAnimateModules = jQuery( '.svg-line-animate' ),
470				 svgAnimateModulesCount = svgAnimateModules.length,
471				 alreadyVisibleIndex = 0,
472				 scrollInterval,
473				 didScroll = false,
474
475	        countDown = function( shouldUpdate ) {
476				var countdownWrap = jQuery( '.be-countdown' ),
477					countdownScripts = ( oshineModulesConfig.dependencies.countdownLangFile ) ? [] : 'countdown';
478	        	if( !shouldUpdate ) {
479					if( countdownWrap.length > 0 ) {
480						asyncloader.require( countdownScripts, function() { 
481						    countdownWrap.each( function() {
482						        var $this = jQuery(this);
483						        var $date = parseDate( $this.attr( 'data-time' ) );   //moment( $this.data().time, 'YYYY-MM-DD HH:mm:ss').toDate();
484						        $this.countdown({until: $date});
485						    }); 
486						});
487					} 
488				} else {
489				    countdownWrap.each( function() {
490				        var $this = jQuery(this);
491				        var $date = parseDate( $this.attr( 'data-time' ) );   //moment( $this.data().time, 'YYYY-MM-DD HH:mm:ss').toDate();
492				        $this.countdown( {until: $date} );
493				    });					
494				}        	
495	        },
496
497
498	        parseDate = function(dateAsString) {
499			    return new Date(dateAsString.replace(/-/g, '/'))
500			},
501         
502
503			iconGrid = function(shouldUpdate) {
504                var iconGridWrap =  jQuery( '.grid-wrap' );				
505				if( iconGridWrap.length > 0 ) {
506				    iconGridWrap.each(function () {
507                       //if( !jQuery(this).hasClass('changed') ) {
508    				        var $this = jQuery(this), 
509    				        	$col = Number( $this.attr( 'data-col' ) ), 
510    				        	i,
511    				        	$gridColumn = $this.find('.grid-col'),
512    				        	$length = $gridColumn.length;
513
514    				       // $this.addClass('changed');
515    				        $gridColumn.css('width', 100 / $col + '%');
516    				        $this.find('.grid-col:nth-of-type(' + $col + 'n)').css('border-right', 'none');
517    				        for (i = 0; i < $length; i += $col) {
518    				            $gridColumn.slice(i, i + $col).wrapAll("<div class='grid-row clearfix'></div>");
519    				        }
520    				        $this.find('.grid-row:last-child').find('.grid-col').css('border-bottom', 'none');
521    				        $this.css('opacity', 1);
522                        //}
523				  });
524				}
525			    if(jQuery('.process-style1').length > 0) {
526			        jQuery('.process-style1').each(function () {
527			            jQuery(this).find('.process-divider:last-child').remove();
528			        });
529			    }	
530			},
531
532			animatedIconModule = function() {
533	        	var  animatedIconModuleOne = jQuery( '.animate-icon-module-style1' ),
534	        	 	 animatedIconModuleTwo = jQuery( '.animate-icon-module-style2-wrap' );
535				if( animatedIconModuleOne.length > 0 ) {
536
537			        animatedIconModuleOne.each(function () {
538			            var $this = jQuery(this),
539			            $gutter = Number( $this.closest('.animate-icon-module-style1-wrap').attr( 'data-gutter-width' ) ),
540			            $width = Number( $this.closest('.animate-icon-module-style1-wrap-container').width() ),
541			            $numberOfSiblings = $this.siblings().length,
542			            $item_width = ( $width - ( $numberOfSiblings * $gutter ) );
543
544			            $this.closest('.animate-icon-module-style1-wrap').width( $width );		            
545			            $this.width( $item_width / ( $numberOfSiblings + 1 ) );
546			            if ( $this.is(':last-child') ) {
547			                $this.css('margin-right', '0px');
548			            } else {
549			                $this.css('margin-right', $gutter + 'px');
550			            }
551			            // $this.css('margin-bottom', $gutter + 'px');
552			            $this.css( 'opacity', 1 );
553			        });
554
555				}
556
557				if( animatedIconModuleTwo.length > 0 ) {
558
559			       animatedIconModuleTwo.each(function(){
560
561			            var $this = jQuery(this), 
562			            $normal_content_height = 0, 
563			            $hover_content_height = 0, 
564			            $module_height = 0,
565			            $max_module_height = 0,
566			            i=1,
567			            $animatedModule = $this.find('.animate-icon-module-style2');
568
569			            // Find the Height of the Tallest Sibling
570			            $animatedModule.each(function () {
571			                var $this_module = jQuery(this);
572
573			                $normal_content_height = Number( $this_module.find('.animate-icon-module-style2-normal-content').innerHeight() );
574			                $hover_content_height = Number( $this_module.find('.animate-icon-module-style2-hover-content').innerHeight() );
575			                $module_height = $normal_content_height + $hover_content_height;
576			                
577			                if( jQuery(window).width() <= 960 ){
578			                    $this_module.closest('.animate-icon-module-style2-wrap').css('height', 'auto');
579			                    $this_module.find('.animate-icon-module-style2-inner-wrap').css('height', $module_height + 115 + 'px');
580			                } else{
581			                    if( i == 1 ){
582			                        $max_module_height = $module_height; 
583			                    } else{
584			                        if($module_height >= $max_module_height){
585			                            $max_module_height = $module_height;    
586			                        }
587			                    }
588			                    i = i+1;
589			                }
590			            });
591
592			            if(jQuery(window).width() > 960){
593			                $this.css('height', $max_module_height * 2 + 40 + 'px');
594			                $this.find('.animate-icon-module-style2-inner-wrap').css('height', 'auto');
595			            }
596			            
597			           $animatedModule.css( 'opacity', 1 );
598
599			        });
600				}
601
602			},
603
604			animatedCharts = function( shouldUpdate ) {
605				//var animatedChartsWrap = jQuery( '.chart' );
606
607				if( animatedChartsWrap.length > 0 ) {
608					asyncloader.require( 'easypiechart', function() {
609					    animatedChartsWrap.each(function (i) {
610					        var $this = jQuery(this);
611					        	//$options = $this.data();
612					        if ( $this.visible(true) ) {
613					           $this.easyPieChart({
614					                animate : 1000,
615					                barColor : $this.attr( 'data-bar-color' ), // $options.barColor,
616					                trackColor : $this.attr( 'data-track-color' ), //$options.trackColor,
617					                scaleColor : $this.attr( 'data-scale-color' ), // $options.scaleColor,
618					                size : $this.attr( 'data-size' ), //$options.size,
619					                lineWidth : $this.attr( 'data-line-width' ), //$options.lineWidth,
620					                onStep : function (from, to, percent) {
621					                    $this.find('.percentage').text(Math.round(percent));
622					                }
623					            });
624					        }
625					    });
626					});
627				}
628
629			},
630
631			progressBar = function() {
632                var skillsContainer = skillsWrap.closest('.skill_container');
633
634                if( skillsContainer.length > 0 ) {
635                    skillsContainer.each(function () {
636                        if( jQuery(this).hasClass('skill-vertical') ) {
637                            var $width = (100 / jQuery(this).find('.skill-wrap').length) + '%';
638                            jQuery(this).find('.skill-wrap').css('width', $width).css('display', 'block');
639                        } else {
640							jQuery(this).find('.skill-wrap').css( 'width', '100%' );
641						}
642                    });
643                }
644
645
646				if( skillsWrap.length > 0) {
647				    skillsWrap.each(function (i) {
648				        var $this = jQuery(this),
649				        	$animate_property = 'width';
650				        if ( $this.visible(true) ) {
651				            if ( $this.closest('.skill_container').hasClass('skill-vertical') ) {
652				                $animate_property = 'height';
653				            }
654				            $this.css( $animate_property, $this.attr( 'data-skill-value' ) );
655				        }
656				    });
657				}
658
659			},
660
661			justifiedGallery = function() {
662                var justifiedGalleryWrap = jQuery( '.justified-gallery' ),
663                    itemsToLazyLoad = jQuery();
664				if( justifiedGalleryWrap.length > 0 ){
665                    var sequentialReveal = function(elements) {
666                            if( null != elements && elements.length ) {
667                                if( elements.closest('.justified-gallery').hasClass( 'none' ) ) {
668                                    elements.find('.flip-img-wrap').addClass('img-loaded');
669                                    return;
670                                }
671                                elements.each(function(index, element) {
672                                    setTimeout(function() {
673                                        jQuery(element).find('.flip-img-wrap').addClass('img-loaded');
674                                    }, index * 200);
675                                });
676                            }
677                        },
678                        updateLazyLoadItems = function( elements ) {
679                            itemsToLazyLoad = itemsToLazyLoad.add(elements);
680                        },
681                        lazyLoad = function() {
682                            if( 0 < itemsToLazyLoad.length ) {
683                                var visibleImages = itemsToLazyLoad.filter(function() {
684                                    var $e = jQuery(this),
685                                        wt = $window.scrollTop(),
686                                        wb = wt + $window.height(),
687                                        et = $e.offset().top,
688                                        eb = et + $e.height();
689                                    return eb >= wt - 200 && et <= wb + 200;
690                                });
691                                if( 0 < visibleImages.length ) {
692                                    visibleImages.one( 'load', function() {
693                                        $(this).closest( '.element' ).addClass('jg-entry-visible');
694                                    }).each( function( el ) {
695                                        var curEl = $(this)
696										curEl.attr( 'srcset', curEl.attr( 'data-srcset' ) );
697                                        curEl.attr( 'src', curEl.attr( 'data-src' ) );
698                                    });
699                                    itemsToLazyLoad = itemsToLazyLoad.not( visibleImages );
700                                }
701                            }
702                        };
703					asyncloader.require( [ 'justifiedgallery', 'waypoints', 'imagesloaded', 'photoswipe' ], function() {
704					    justifiedGalleryWrap.each(function () {
705                            var $this = jQuery(this),
706                                $elements = $this.find('.element'),
707							    $options = {};
708							    $options.imageHeight = $this.attr( 'data-image-height' );
709							    $options.gutterWidth = $this.attr( 'data-gutter-width' );
710
711                            $this.on( 'jg.complete jg.resize', function( event ) {
712                                lazyLoad();
713                                $(this).closest( '.justified-gallery-outer-wrap' ).css( 'visibility', 'visible' );
714                            } );
715							$this.justifiedGallery({
716								rowHeight : $options.imageHeight, 
717								margins : $options.gutterWidth,
718								lastRow : 'nojustify', 
719                                waitThumbnailsLoad : false,
720                                imgSelector : '.thumb-img'
721							});
722					        //$this.imagesLoaded(function () {
723
724                            photoswipe( $this );
725
726                            directionalHover( $elements );
727                            sequentialReveal( $elements );
728                            if( $this.attr('data-lazy-load') ) {
729                                updateLazyLoadItems( $this.find( '.thumb-img' ) );
730                            }
731						});
732
733
734						if(jQuery(".trigger_infinite_scroll.justified_gallery_infinite_scroll").length > 0 && !$body.hasClass('tatsu-frame')) {
735				            jQuery(".trigger_infinite_scroll.justified_gallery_infinite_scroll").each(function () {
736				                var $this = jQuery(this),
737				                $justified_gallery_wrap = $this.closest('.justified-gallery-inner-wrap'),
738				                $justified_gallery = $justified_gallery_wrap.find('.justified-gallery'),
739				               // $options = $justified_gallery_wrap.data(),
740				                $paged = Number( $justified_gallery_wrap.attr('data-paged') ),
741				                $ajaxData = "action=" + $justified_gallery_wrap.attr('data-action') + 
742                                            //"&source=" + $justified_gallery_wrap.attr('data-source') + 
743                                            "&images_arr=" + $justified_gallery_wrap.attr('data-images-array') + 
744                                            "&items_per_load=" + $justified_gallery_wrap.attr('data-items-per-load') + 
745                                            "&lazy_load=" + ( $justified_gallery_wrap.attr('data-lazy-load') || '0' ) + 
746                                            "&hover_style=" + $justified_gallery_wrap.attr('data-hover-style') + 
747                                            "&img_grayscale=" + $justified_gallery_wrap.attr('data-image-grayscale') + 
748                                            "&image_effect=" + $justified_gallery_wrap.attr('data-image-effect') + 
749                                            "&thumb_overlay_color=" + $justified_gallery_wrap.attr('data-thumb-overlay-color') + 
750                                            "&gradient_style_color=" + $justified_gallery_wrap.attr('data-grad-style-color') + 
751                                            "&like_button=" + $justified_gallery_wrap.attr('data-like-button') + 
752                                            "&disable_overlay=" + $justified_gallery_wrap.attr('data-disable-overlay');
753
754				                var be_waypoint = new Waypoint({
755				                    element: $this,
756				                    handler: function (direction) {
757				                        if (direction === 'down') {
758				                            var $this_waypoint = this,
759				                            	$page_loader = jQuery('.page-loader');
760				                            $this_waypoint.disable(); //Disable Waypoint untill Images are Loaded
761				                            $page_loader.fadeIn();
762				                            jQuery.ajax({
763				                                type: "POST",
764				                                url: ajax_url,
765				                                data: $ajaxData + "&paged=" + $paged                                                ,
766				                            }).done(function (data) {
767				                                if ( '0' != data ) {
768				                                    var $newItems = jQuery(data);
769                                                        $justified_gallery.on('jg.complete jg.resize', function () {
770                                                            Waypoint.refreshAll();    
771                                                            $this_waypoint.enable(); //Enable Waypoint 
772                                                        } );
773		
774				                                        $justified_gallery.append($newItems).justifiedGallery('norewind');
775                                                        sequentialReveal($newItems);
776                                                        if( $justified_gallery.attr('data-lazy-load') ) {
777                                                            updateLazyLoadItems($newItems.find('.thumb-img'));
778                                                        }
779                                                        $paged = Number($paged) + 1;
780                                                        $justified_gallery_wrap.attr('data-paged', $paged);
781				                                        $page_loader.fadeOut();
782
783				                                } else {
784				                                    $this_waypoint.destroy();
785				                                    $this.fadeOut();
786				                                    $page_loader.fadeOut();
787				                                }
788				                            });
789				                       }
790				                    }, 
791				                    offset: 'bottom-in-view'
792				                })
793
794				            });
795                        }
796                        $window.on('scroll', function() {
797                            lazyLoad();
798                        })
799				    });
800			    }	
801			},
802
803			like = function() {
804				jQuery(document).on('click', '.gallery-like .custom-like-button', function (e) {
805					var $this = jQuery(this), $post_id = $this.attr('data-post-id');
806					// $this.addClass('disable');
807					jQuery.ajax({
808						
809						type: "POST",
810						url: ajax_url,
811						dataType: 'json',
812						data: "action=post_like&post_id=" + $post_id,
813						success : function (msg) {
814							if (msg.status === "success") {
815								if( msg.type === "like" ){
816									$this.addClass('liked');
817									$this.removeClass('no-liked');
818									$this.find('span').text(msg.count);
819								}else{
820									$this.removeClass('liked');
821									$this.addClass('no-liked');
822									$this.find('span').text(msg.count);
823								}
824							}
825						},
826						error: function (msg) {
827							alert(msg);
828						}
829					});
830					return false;
831				});
832			},
833
834			accordion = function( shouldUpdate ) {
835
836				var accordionWrap = jQuery( '.accordion' );				
837				if( !shouldUpdate ) {
838					if( accordionWrap.length > 0 ) {
839						accordionWrap.each(function () {
840							var $accordion = jQuery(this), 
841							$collapse = Number( $accordion.attr('data-collapsed') );
842							$accordion.accordion({
843								collapsible: $collapse,
844								heightStyle: "content",
845								active: false
846							}).css('opacity', 1);			        
847
848						});
849					}						
850				}else {
851					if( 0 < accordionWrap.length ) {
852						accordionWrap.each( function() {
853
854							var accordion = jQuery( this ),
855								collapse = Number( accordion.attr( 'data-collapsed' ) );
856								if( collapse ) {
857									accordion.accordion( "option", "collapsible", true );
858								}else{
859									accordion.accordion( "option", "collapsible", false );
860								}
861								accordion.accordion( "refresh" );
862
863						} );
864					}
865				}
866
867			},
868
869			tabs = function( shouldUpdate ) {
870				var tabsWrap = jQuery( '.tabs' );
871				if( !shouldUpdate ) {
872					if(tabsWrap.length > 0) {
873						tabsWrap.tabs({
874							fx : {
875								opacity : 'toggle',
876								duration : 200
877							}
878						}).css('opacity', 1);
879					}
880				}else{
881					if( 0 < tabsWrap.length ) {
882						tabsWrap.tabs( "refresh" );
883					}
884				}
885	
886			},
887
888			services = function() {
889
890				 jQuery(document).on('mouseenter.oshine mouseleave.oshine', '.service-wrap', function (e) {
891				 	var $this = jQuery(this),
892				 		$icon = $this.find('.font-icon'),
893				 		$options = {};
894				 		
895	                $options.hoverColor = $this.attr( 'data-hover-color' );
896	                $options.hoverBgColor = $this.attr( 'data-hover-bg-color' );
897	                $options.bgColor = $this.attr( 'data-bg-color' );
898	                $options.color = $this.attr( 'data-color' );
899	                	
900				 	if( 'mouseenter' == e.type ) {
901				 		$icon.css({
902				 			'background-color': $options.hoverBgColor,
903				 			'color': $options.hoverColor
904				 		});
905				 	} else {
906				 		$icon.css({
907				 			'background-color': $options.bgColor,
908				 			'color': $options.color
909				 		});
910				 	}
911				 });
912			},
913
914            clientCarousel = function( shouldUpdate ) {
915                var clientsWrap = jQuery( '.client-carousel-module' );
916                if( shouldUpdate ) {                  
917                    clientsWrap.each( function() {
918                        jQuery(this).trigger( 'destroy.owl.carousel' );
919                        jQuery(this).find( '.owl-stage-outer' ).children().unwrap();
920                    });                           
921                } else{
922                    if(clientsWrap.length > 0 ){
923                        asyncloader.require( [ 'owlcarousel', 'imagesloaded' ], function(){
924                            clientsWrap.imagesLoaded(function () {
925                                clientsWrap.each(function () {
926                                    var $this = jQuery(this),
927                                        $slideshowspeed = Number( $this.attr('data-slide-show-speed') ) , 
928                                        $slideshow = Number( $this.attr( 'data-slide-show' ) ),
929                                        $nav_dots = Number( $this.attr( 'data-slide-navigation-dots' ) ),
930                                        $item_number = $this.children('.client-carousel-item').length,
931                                        $wrap = $this.closest('.carousel-wrap');
932
933                                    if($item_number > 5){
934                                        $item_number = 5;
935                                    }
936
937                                    if( 0 == $slideshow ){
938                                        $slideshow = false;
939                                    } else {
940                                        $slideshow = true;
941                                    }
942
943									if( 0 == $nav_dots ){
944                                        $nav_dots = false;
945                                    } else {
946                                        $nav_dots = true;
947                                    }
948
949                                    if($item_number == 1){
950                                        $this.fadeIn();
951                                    }else{                    
952                                        $this.owlCarousel({
953                                            navSpeed: 500,
954                                            autoplay: $slideshow,
955                                            autoplayTimeout: $slideshowspeed,
956                                            autoplaySpeed: 1000,
957                                            autoplayHoverPause: true,
958                                            loop: true,
959                                            navRewind: false,
960                                            nav: false,
961                                            responsiveRefreshRate: 0,
962                                            responsive: {
963                                                0:{
964                                                    items:2,
965                                                    dots:$nav_dots
966                                                },
967                                                768:{
968                                                    items:$item_number,
969                                                    dots:$nav_dots
970                                                }
971                                            },
972                                            onInitialize: function() {
973                                                $this.fadeIn(500);
974                                                $this.trigger('refresh.owl.carousel');
975                                            },
976                                        });
977                                    }
978                                    if( 0 == $wrap.css( 'opacity' ) ) {
979                                        $wrap.css( { 'opacity' : '1', 'height' : 'auto', 'overflow' : 'initial' } );
980                                    }                                   
981                                });
982                            });
983                        });
984                    }                    
985                }
986    
987            },
988
989			portfolioCarousel = function() {
990				var portfolioCarouselWrap = jQuery( '.portfolio-carousel-module' );
991				if( portfolioCarouselWrap.length > 0 ){
992					asyncloader.require( [ 'owlcarousel', 'imagesloaded' ], function(){
993					    portfolioCarouselWrap.imagesLoaded(function () {
994					        jQuery('.portfolio-carousel-module').each(function () {
995					            var $this = jQuery(this),
996							        $slideshowspeed = Number( $this.attr('data-slide-show-speed') ) , 
997							        $slideshow = Number( $this.attr( 'data-slide-show' ) ),$number_of_cols = Number( $this.attr( 'data-cols' ) ),$mobile_cols = 2,			
998									$autoplaySpeed = Number( $this.attr('data-slide-show-speed')),            
999					            	$item_number = $this.children('.carousel-item').length;
1000								if(typeof $number_of_cols ==='undefined' || $number_of_cols == null || $number_of_cols == ''){
1001									$number_of_cols = 2;
1002								}
1003					            if($number_of_cols > 5){
1004					                $number_of_cols = 5;
1005					            }
1006
1007					            if( 0 == $slideshow ) {
1008					                $slideshow = false;
1009					            } else {
1010					                $slideshow = true;
1011					            }				            
1012								if($number_of_cols == 1){
1013									$mobile_cols = 1;
1014					            }
1015
1016					            if($item_number == 1){
1017					                $this.fadeIn();
1018					            }else{
1019					                $this.owlCarousel({
1020					                    autoplay: $slideshow,
1021					                    autoplayTimeout: $slideshowspeed,
1022					                    autoplaySpeed: $autoplaySpeed, 
1023					                    autoplayHoverPause: true,
1024					                    navRewind: false,
1025										loop: true,
1026					                    navText: ['<i class="font-icon icon-arrow_carrot-left"></i>','<i class="font-icon icon-arrow_carrot-right"></i>'],
1027					                    responsiveRefreshRate: 0,
1028					                    responsive: {
1029					                        0:{
1030					                            items:$mobile_cols,
1031					                            dots:true,
1032					                            nav: false
1033					                        },
1034					                        767:{
1035					                            items:$number_of_cols,
1036					                            dots:false,
1037					                            nav: true
1038					                        }
1039					                    },
1040					                    onInitialize: function() {
1041					                        $this.fadeIn(500);
1042					                        $this.trigger('refresh.owl.carousel');
1043					                    }
1044					                });
1045									
1046					            }
1047					        });
1048					    });
1049					});
1050				}
1051			},
1052
1053            imageSlider = function( shouldUpdate ) {
1054                var imageSliderWrap = jQuery( '.be_image_slider' );
1055                if( shouldUpdate ) {
1056                    var $owl = imageSliderWrap.find( '.image_slider_module' );
1057                    $owl.each( function() {
1058                        jQuery(this).trigger('destroy.owl.carousel');   
1059                        jQuery(this).find( '.owl-stage-outer' ).children().unwrap();                                
1060                    });
1061                } else {
1062                   if( imageSliderWrap.length > 0 ) {
1063                        asyncloader.require( [ 'owlcarousel', 'imagesloaded' ], function(){
1064                            imageSliderWrap.imagesLoaded(function () {
1065                                jQuery('.be_image_slider').each(function () {
1066                                    var $this = jQuery(this).find('.image_slider_module'), 
1067										closestPortfolio = $this.closest( '.portfolio' ),
1068                                        $slideshowspeed = Number( $this.attr('data-slide-show-speed') ) , 
1069                                        $slideshow = Number( $this.attr( 'data-slide-show' ) ),
1070                                        $loop = Number( $this.attr( 'data-loop' ) ),
1071                                        $navdots = Number( $this.attr( 'data-navigation-dots' ) ),
1072                                        $navbuttons = Number( $this.attr( 'data-navigation-buttons' ) ),
1073                                        $pause = Number( $this.attr( 'data-pause-hover' ) ),
1074                                        $number = $this.find('.be_image_slide').length,
1075                                        $wrap = $this.closest('.be_image_slider');  
1076
1077                                    if( 0 == $slideshow ) {
1078                                        $slideshow = false;
1079                                    } else {
1080                                        $slideshow = true;
1081                                    }
1082
1083                                    if( $number == 1 ) {
1084                                        $this.fadeIn();
1085                                    } else {         
1086										$this.on( 'initialized.owl.carousel', function( event ) {
1087
1088											var portfolioInstance;
1089											if( 0 < closestPortfolio.length ) {
1090												portfolioInstance = closestPortfolio.data( "oshinePortfolio" );
1091												setTimeout( function() {
1092													portfolioInstance.portfolioContainer.isotope( 'layout' );
1093												}, 100 ) ;
1094											}
1095
1096										} );                             
1097                                        $this.owlCarousel({
1098                                            items:1,
1099                                            autoHeight: true,
1100                                            autoplay: $slideshow,
1101                                            autoplayTimeout: $slideshowspeed, 
1102                                            autoplaySpeed: 1000,
1103                                            autoplayHoverPause: 0 == $pause ? false : true,
1104                                            navRewind: false,
1105                                            nav: 0 == $navbuttons ? false : true,
1106                                            loop: 0 == $loop ? false : true,
1107                                            navText: ['<i class="font-icon icon-arrow_carrot-left"></i>','<i class="font-icon icon-arrow_carrot-right"></i>'],
1108                                            dots: ( ( 0 < closestPortfolio.length ) || 0 == $navdots ) ? false : true,
1109                                            onInitialize: function() {
1110                                                $this.fadeIn(500);
1111                                                $this.trigger('refresh.owl.carousel');
1112                                            }
1113                                        });
1114										$this.on( "translated.owl.carousel", function( event ) {
1115
1116											var portfolioInstance;
1117											if( 0 < closestPortfolio.length ) {
1118												portfolioInstance = closestPortfolio.data( "oshinePortfolio" );
1119												setTimeout( function() {
1120													portfolioInstance.portfolioContainer.isotope( 'layout' );
1121												}, 250 );
1122											}
1123
1124										} )
1125                                    }
1126                                    if( '0' == $wrap.css( 'opacity' ) ) {
1127                                        $wrap.css( { 'opacity' : '1', 'height' : 'auto', 'overflow' : 'initial' } );
1128                                    }                                    
1129                                });
1130                            });
1131                        });
1132                    }
1133
1134                }
1135            },
1136
1137            testimonials = function( shouldUpdate ) {
1138                    var testimonialsWrap = jQuery( '.testimonials-slides' );
1139                    if( shouldUpdate ) {
1140                        var $owl = testimonialsWrap.find('.testimonial_module');
1141                        $owl.each( function() {
1142                            jQuery(this).trigger('destroy.owl.carousel');   
1143                            jQuery(this).find( '.owl-stage-outer' ).children().unwrap();                                
1144                        });
1145                    } else{
1146                        if ( testimonialsWrap.length > 0 ) {
1147                            asyncloader.require( [ 'owlcarousel', 'imagesloaded' ], function(){             
1148                                testimonialsWrap.imagesLoaded(function () {
1149                                    jQuery('.testimonials-slides').each(function () {
1150                                        
1151                                        var $slide = jQuery(this),
1152                                            $this = jQuery(this).find('.testimonial_module'), 
1153                                            $slideshowspeed = Number( $this.attr('data-slide-show-speed') ) , 
1154                                            $slideshow = Number( $this.attr( 'data-sli
1154de-show' ) ),
1155                                            $pagination = Number( $this.attr('data-pagination') ),
1156                                            $number = $slide.find('.testimonial_slide').length,
1157                                            $wrap = $this.closest('.testimonials_wrap');  
1158
1159                                        if( 0 == $slideshow ) {
1160                                            $slideshow = false;
1161                                        } else {
1162                                            $slideshow = true;
1163                                        }
1164
1165                                        if($pagination == 0){
1166                                            $pagination = false;
1167                                        }else{
1168                                            $pagination = true;
1169                                        }
1170                                        
1171                                        if($number == 1){
1172                                            $slide.fadeIn();                                           
1173                                        }else{
1174                                            testimonialCarousel =  $this.owlCarousel({
1175                                                items: 1 ,
1176                                                autoHeight: true,
1177                                                autoplay: $slideshow,
1178                                                autoplayTimeout: $slideshowspeed,
1179                                                autoplaySpeed: 1000,
1180                                                autoplayHoverPause: true,
1181                                                navRewind: false,
1182                                                loop: true,
1183                                                dots: $pagination,
1184                                                onInitialize: function() {
1185                                                    $slide.fadeIn();
1186                                                    $this.trigger('refresh.owl.carousel');
1187                                                }
1188                                            });
1189
1190                                        }
1191                                        
1192                                        if( $wrap[0].style.opacity == '0' ) {
1193                                            $wrap.css({'opacity':'1', 'height' : 'auto','overflow' :'initial' });
1194                                        }                                        
1195                                    });
1196                                });
1197                            });
1198                        }                      
1199                    }
1200            },
1201
1202			tweets = function() {
1203				var tweetsWrap = jQuery( '.tweet-slides' );
1204				if ( tweetsWrap.length > 0 ) {
1205					asyncloader.require( [ 'owlcarousel', 'imagesloaded' ], function(){
1206					    tweetsWrap.each(function () {
1207					        var $slide = jQuery(this),
1208					        $this = jQuery(this).find('.twitter_module'), 
1209					        $slideshowspeed = Number( $this.attr('data-slide-show-speed') ) , 
1210					        $slideshow = Number( $this.attr( 'data-slide-show' ) ),
1211					        $pagination = Number( $this.attr('data-pagination') ),
1212					        $number = $this.children('.tweet_list').length;
1213
1214				            if( 0 == $slideshow ){
1215				                $slideshow = false;
1216				            } else{
1217				                $slideshow = true;
1218				            }
1219
1220					        if($pagination == 0){
1221					            $pagination = false;
1222					        }else{
1223					            $pagination = true;
1224					        }
1225
1226					        if($number == 1){
1227					            $slide.fadeIn();
1228					        }else{
1229					            $this.owlCarousel({
1230					                items:1,
1231					                autoHeight: true,
1232					                autoplay: $slideshow,
1233					                autoplayTimeout: $slideshowspeed,
1234					                autoplaySpeed: 1000,
1235					                autoplayHoverPause: true,
1236					                navRewind: false,
1237					                loop: true,
1238					                dots: $pagination,
1239					                onInitialize: function () {
1240					                    $slide.fadeIn();
1241					                    $this.trigger('refresh.owl.carousel');
1242					                }
1243					            });  
1244					        }
1245					    });
1246					});
1247				}	
1248			},
1249
1250            contentSlider = function( shouldUpdate ) {
1251                var contentSliderWrap = jQuery( '.content-slider' );
1252                if( shouldUpdate ) {
1253                    contentSliderWrap.each( function() {
1254                        var $owl = jQuery(this).find('.content_slider_module');
1255                        $owl.trigger( 'destroy.owl.carousel' );
1256                        $owl.find( '.owl-stage-outer' ).children().unwrap();                        
1257                    });
1258                } else {
1259                    if ( contentSliderWrap.length > 0 ) {
1260                        asyncloader.require( [ 'owlcarousel', 'imagesloaded' ], function(){
1261                            contentSliderWrap.imagesLoaded(function () {
1262                                contentSliderWrap.each(function () {
1263                                    var $slide = jQuery(this),
1264                                        $this = jQuery(this).find('.content_slider_module'), 
1265                                        $slideshowspeed = Number( $this.attr('data-slide-show-speed') ) , 
1266                                        $slideshow = Number( $this.attr( 'data-slide-show' ) ),
1267                                        $item_number = $this.children('.content_slide').length;
1268                                    
1269                                    if( 0 == $slideshow ){
1270                                        $slideshow = false;
1271                                    } else{
1272                                        $slideshow = true;
1273                                    }
1274
1275                                    if($item_number == 1){
1276                                        $slide.fadeIn();
1277                                    }else{
1278                                        $this.owlCarousel({
1279                                            items:1,
1280                                            autoHeight: true,
1281                                            autoplay: $slideshow,
1282                                            autoplayTimeout: $slideshowspeed,
1283                                            autoplaySpeed: 1000,
1284                                            autoplayHoverPause: true,
1285                                            navRewind: false,
1286                                            loop: true,
1287                                            dots: true,
1288                                            onInitialize: function () {
1289                                                $slide.fadeIn();
1290                                                $this.trigger('refresh.owl.carousel');
1291                                            }
1292                                        });
1293                                    }
1294                                    if( 0 == $this.closest( '.content-slide-wrap' )[0].style.opacity ) {
1295                                        $this.closest('.content-slide-wrap').css( { 'opacity' : '1', 'overflow' : 'initial', 'height' : 'auto' } );
1296                                    }                                   
1297                                });
1298                            });
1299                        });
1300                    }
1301                }
1302            },
1303
1304			owlButtons = function() {
1305				 jQuery(document).on('mouseenter.oshine mouseleave.oshine', '.owl-carousel', function (e) {
1306				 	var $owlButtons = jQuery(this).find('.owl-buttons');
1307				 	if( 'mouseenter' == e.type ){
1308				 		$owlButtons.css( 'opacity', 1 );
1309				 	} else {
1310				 		$owlButtons.css( 'opacity', 0 );
1311				 	}
1312				 });
1313			},
1314
1315			textRotate = function() {
1316				var rotatesWrap = jQuery( '.rotates' );
1317				if( rotatesWrap.length > 0 ) {
1318					asyncloader.require( 'rotate', function(){				
1319					    rotatesWrap.each(function () {
1320					    	var $this = jQuery(this),
1321					    		$options = $this.data();
1322
1323					        $this.textrotator({
1324					            animation : $options.animation,
1325					            separator : "||",
1326					            speed : $options.speed
1327					        }).css('opacity', 1);
1328					    });
1329					});
1330				}	
1331			},
1332
1333			typedText = function() {
1334				var typedWrap = jQuery( '.typed' );
1335				if( typedWrap.length > 0 ) {
1336					asyncloader.require( 'typed', function(){				
1337					    typedWrap.each(function () {
1338					        var $this = jQuery(this), 
1339					        	$typed_text = $this.text(), 
1340					        	$typed_text_arr = $typed_text.split('||');
1341					        $this.empty().typed({
1342					            strings: $typed_text_arr,
1343					            typeSpeed: 30,
1344					            backDelay: 500,
1345					            loop: true,
1346					            loopCount: false
1347					        }).css('opacity', 1);
1348					    });
1349					});
1350				}
1351			},
1352
1353			contact = function() {
1354		        jQuery(document).on('click.oshine', '.contact_submit', function () {
1355					console.log( 'contact form clicked' );
1356					var $this = jQuery(this),
1357						$contact_form =  $this.closest('.contact_form'),
1358		            	$contact_status = $contact_form.find(".contact_status"), 
1359						$contact_loader = $contact_form.find(".contact_loader"),
1360						consent_checkbox = $contact_form.find('.consent-checkbox'),
1361						isConsentGiven = !consent_checkbox.length || consent_checkbox.prop('checked') ? true: false;
1362					if( !isConsentGiven ) {
1363						$contact_status.removeClass("tatsu-success").addClass("tatsu-error");
1364						$contact_status.html( $contact_form.attr('data-consent-error') ).slideDown();
1365						return false;
1366					}	
1367					$contact_loader.fadeIn();
1368
1369					jQuery.ajax({
1370						type: "POST",
1371						url: ajax_url,
1372						dataType: 'json',
1373						data: "action=contact_authentication&" + jQuery(this).closest(".contact").serialize(),
1374						success    : function (msg) {
1375							$contact_loader.fadeOut();
1376							if (msg.status === "error") {
1377								$contact_status.removeClass("tatsu-success").addClass("tatsu-error");
1378							} else {
1379								$contact_status.addClass("tatsu-success").removeClass("tatsu-error");
1380							}
1381							$contact_status.html(msg.data).slideDown();
1382						},
1383						error: function () {
1384							$contact_status.html("Please Try Again Later").slideDown();
1385						}
1386					});
1387		            return false;
1388		        }); 			
1389			},
1390
1391            mailchimp = function() {
1392                jQuery(document).on('click.oshine', '.oshine-mc-submit', function () {
1393					var $this = jQuery(this),
1394						$subscription_form = $this.closest('.oshine-mc-wrap'), 
1395                        $subscribe_status = $subscription_form.find(".subscribe_status"), 
1396						$subscribe_loader = $subscription_form.find(".subscribe_loader"),
1397						consent_checkbox = $subscription_form.find('.consent-checkbox'),
1398						isConsentGiven = !consent_checkbox.length || consent_checkbox.prop('checked') ? true: false;
1399					if( !isConsentGiven ) {
1400						$subscribe_status.removeClass("tatsu-success").addClass("tatsu-error");
1401						$subscribe_status.html( $subscription_form.attr('data-consent-error') ).slideDown();
1402						return false;
1403					}
1404					$subscribe_loader.fadeIn();
1405                    jQuery.ajax({
1406                        type: "POST",
1407                        url: ajax_url,
1408                        dataType: 'json',
1409                        data: "action=mailchimp_subscription&" + jQuery(this).closest(".oshine-mc-form").serialize(),
1410                        success : function (msg) {
1411                            $subscribe_loader.fadeOut();
1412                            if (msg.status === "error") {
1413                                $subscribe_status.removeClass("tatsu-success").addClass("tatsu-error");
1414                            } else {
1415                                $subscribe_status.addClass("tatsu-success").removeClass("tatsu-error");
1416                            }
1417                            $subscribe_status.html(msg.data).slideDown();
1418                        },
1419                        error: function () {
1420                            $subscribe_status.html("Please Try Again Later").slideDown();
1421                            $subscribe_loader.fadeOut();
1422                        }
1423                    });
1424                    return false;
1425                }); 
1426            },
1427
1428			svgLineAnimate = function(shouldUpdate,moduleId) {
1429				asyncloader.require( 'vivusSVGanimation', function() {
1430					//SVG animate front-end
1431					if( svgAnimateModules.length > 0 ) {
1432						svgAnimateModules.each(function (i, el) {
1433							var el = jQuery( el );
1434							var svgObject = el.find( 'svg' )[0],
1435								pathTimingFunction = el.attr( 'data-path-animation' ),
1436								animTimingFunction = el.attr( 'data-svg-animation' ),
1437								duration = el.attr( 'data-animation-duration' ),
1438								delay = el.attr( 'data-animation-delay' );
1439							new Vivus(
1440									svgObject, 
1441									{
1442										duration: duration,
1443										pathTimingFunction	: Vivus[pathTimingFunction],
1444										animTimingFunction	: Vivus[animTimingFunction],
1445										delay : delay,
1446										onReady: function() {
1447											el.css( 'visibility', 'visible' );
1448										}
1449									}, 
1450									function() {
1451										console.log('Svg Animated');	
1452								}); 
1453						});
1454					}
1455					//SVG animate in tatsu
1456					 var svgAnimatesInTatsu = jQuery('.oshine-svg-icon span');
1457					  if(svgAnimatesInTatsu.length > 0){
1458					 	svgAnimatesInTatsu.each(function(index,element){
1459							var element = jQuery(element).parent();
1460							 if(!moduleId || element.parent().hasClass('be-pb-observer-'+moduleId)){
1461							 var svgObject1 = element.attr( 'data-target' ),
1462								 pathTimingFunction = element.attr( 'data-path-animation' ),
1463								 animTimingFunction = element.attr( 'data-svg-animation' ),
1464								 duration = element.attr( 'data-animation-duration' ),
1465								 delay = element.attr( 'data-animation-delay' ),
1466								 fileUrl = element.attr( 'data-svg-url');
1467					 			element.children().empty();
1468					 		 new Vivus(svgObject1, {
1469									  file:fileUrl,
1470									  duration: duration,
1471									  pathTimingFunction	: Vivus[pathTimingFunction],
1472									  animTimingFunction	: Vivus[animTimingFunction],
1473									  delay : delay,
1474									  onReady: function() {
1475										element.css( 'visibility', 'visible' );
1476									}
1477									}, 
1478					 			function() {
1479					 				console.log('Svg Animated');	
1480					 		}); 
1481							 } 
1482						});
1483					}
1484				
1485				});
1486			},
1487
1488			registerCallbacks = function() {
1489				tatsuCallbacks['be_countdown'] = countDown;
1490				tatsuCallbacks['chart'] = animatedCharts;
1491				tatsuCallbacks['typed'] = typedText;
1492				tatsuCallbacks['accordion'] = accordion;
1493				tatsuCallbacks['tabs'] = tabs;
1494				tatsuCallbacks['justified_gallery'] = justifiedGallery;
1495				tatsuCallbacks['clients'] = clientCarousel;
1496				tatsuCallbacks['portfolio_carousel'] = portfolioCarousel;
1497				tatsuCallbacks['testimonials'] = testimonials;
1498				tatsuCallbacks['tweets'] = tweets;
1499				tatsuCallbacks['content_slides'] = contentSlider;
1500				tatsuCallbacks['flex_slider'] = imageSlider;
1501				tatsuCallbacks['rotates'] = textRotate;
1502				tatsuCallbacks['skills'] = progressBar;
1503				tatsuCallbacks['animate_icons_style1'] = animatedIconModule;
1504				tatsuCallbacks['animate_icons_style2'] = animatedIconModule;
1505				tatsuCallbacks['services'] = services;	
1506                tatsuCallbacks['recent_posts'] = imageSlider;
1507                tatsuCallbacks['grids'] = iconGrid;    	
1508				tatsuCallbacks[ 'oshine_svg_icon' ] = svgLineAnimate;
1509
1510			},
1511
1512			ready = function() {  
1513
1514                if( !jQuery('body').hasClass('tatsu-frame') && ( jQuery('.component').length > 0 || jQuery('#ps-container').length > 0 ) ) {
1515                    asyncloader.require( [ 'resizetoparent', 'mousewheel' ], function() {
1516                            asyncloader.require( 'beslider', function() {
1517                        });
1518                    });
1519                }                      
1520
1521				countDown();
1522				iconGrid();
1523				animatedIconModule();
1524				animatedCharts();
1525				progressBar();
1526				justifiedGallery();
1527				like();
1528				accordion();
1529				tabs();
1530				services();
1531				clientCarousel();
1532				portfolioCarousel();
1533				imageSlider();
1534				testimonials();
1535				tweets();
1536				contentSlider();
1537				owlButtons();
1538				textRotate();
1539				typedText();
1540				contact();
1541				mailchimp();
1542			//	svgInitialRender();				
1543				svgLineAnimate();
1544				
1545				registerCallbacks();
1546
1547			},
1548			
1549			run = function() {
1550
1551				ready();
1552
1553				jQuery(window).on( 'tatsu_update.oshine', function( e, data )  {
1554                   // cssAnimate();
1555				 	animatedChartsWrap = jQuery( '.chart' );
1556					skillsWrap = jQuery( '.be-skill' );		 
1557					if( 'trigger_ready' == data.moduleName ) {
1558						ready();
1559					} else if( data.moduleName in tatsuCallbacks ) {					
1560						tatsuCallbacks[data.moduleName]( data.shouldUpdate, data.moduleId );	
1561                        if( jQuery('.be-photoswipe-gallery').length > 0 ) {
1562                            photoswipe( '.be-photoswipe-gallery' );
1563                        }										
1564					}
1565				});
1566
1567				jQuery(window).resize( function() {
1568					animatedIconModule();
1569				});
1570
1571				jQuery(window).on( 'scroll', function(){
1572					didScroll = true;
1573				});
1574
1575				// scrollInterval = setInterval( function() {
1576				// 	if( didScroll ) {
1577				// 		didScroll = false;
1578				// 		svgLineAnimate();
1579				// 	}
1580				// }, 50);
1581
1582				if( animatedChartsWrap.length > 0 || $body.hasClass('tatsu-frame') ) {
1583					jQuery(window).on('scroll', function(){
1584						animatedCharts();
1585					});
1586				}
1587				
1588				if( skillsWrap.length > 0 || $body.hasClass('tatsu-frame') ) {
1589					jQuery(window).on('scroll', function(){
1590						progressBar();
1591					});
1592				}
1593
1594				jQuery(document).on( 'update_content', function(){
1595					jQuery(document).off( 'mouseenter.oshine mouseleave.oshine scroll.oshine click.oshine', '**' );
1596					ready();				
1597				});
1598			}
1599
1600			return {
1601				run: run
1602			}
1603
1604	    })();
1605	    var oshine_portfolio = (function() {
1606
1607	            var ajax_url = jQuery('#ajax_url').val(),
1608	                vendorScriptsUrl = oshineModulesConfig.vendorScriptsUrl,
1609	                portfolio = jQuery('.portfolio'),
1610                    portfolioWithDelayLoadCount = jQuery( '.portfolio.portfolio-delay-load' ).length,
1611                    portfolioWithLazyLoadCount = jQuery( '.portfolio.portfolio-lazy-load' ).length,
1612                    initializedPortfolioWithDelayCount = 0,
1613					portfolios = jQuery( '.portfolio' ),
1614                    initializedPortfolioWithLazyCount = 0,
1615	                portfolioContainer = jQuery('.portfolio-container'),
1616	                element = portfolioContainer.find('.element'),
1617	                elementInner = element.find('.element-inner'),
1618	                trigger = jQuery('.trigger_infinite_scroll'),
1619
1620                    portfolioScrollReveal = (function() {
1621                        var delayLoadElements = jQuery( '.portfolio.portfolio-delay-load' ).find( '.element' );
1622                        if( 0 < delayLoadElements.length ) {
1623                            delayLoadElements.on( 'webkitAnimationStart oanimationstart msAnimationStart animationstart', function( event ) {
1624
1625								if( jQuery( event.target ).hasClass( 'element' ) ) {
1626									var el = jQuery( this );
1627                                	el.addClass( 'end-animation' );
1628								}
1629
1630                            } );
1631                            delayLoadElements.on( 'webkitAnimationEnd oanimationend msAnimationEnd animationend', function( event ) {
1632
1633                                var el = jQuery( this );
1634                                el.addClass( 'animation-complete' );
1635
1636                            } );
1637                        }
1638                        return {
1639                            delayReveal : function( elements ) {
1640
1641											
1642											var portfolioDelay = 200,
1643												visibleElements;
1644											if( null == elements ) {
1645                                                visibleElements = delayLoadElements.filter( function( i, el ) {
1646
1647                                                    return ( jQuery( el ).visible( true ) && jQuery( el ).is( ":visible" ) && ( window.innerHeight - el.getBoundingClientRect().top > 30 ) );
1648
1649												} );
1650											}else {
1651												visibleElements = elements.filter( function( i, el ) {
1652
1653                                                    return ( jQuery( el ).visible( true ) && jQuery( el ).is( ":visible" ) && ( window.innerHeight - el.getBoundingClientRect().top > 30 ) );
1654
1655												} );
1656											}
1657                                            visibleElements.each( function( i , el ) {
1658
1659                                                var el = jQuery( el );
1660                                                el.addClass( "already-visible delay-loaded" );												
1661                                                el.css( 'animation-delay', portfolioDelay + 'ms' );
1662                                                portfolioDelay = portfolioDelay + 200;
1663                                                el.addClass( el.closest( '.portfolio' ).attr( "data-animation" ) );
1664
1665                                            } );
1666                                            delayLoadElements = delayLoadElements.not( visibleElements );
1667
1668                                        },
1669                            addElements : function( newElements, shouldAddListeners ) {
1670
1671                                            delayLoadElements = delayLoadElements.add( newElements );
1672                                            if( 0 < newElements.length && !shouldAddListeners ) {
1673                                                newElements.on( 'webkitAnimationStart oanimationstart msAnimationStart animationstart', function( event ) {
1674
1675													if( jQuery( event.target ).hasClass( 'element' ) ) {
1676														var el = jQuery( this );
1677														el.addClass( 'end-animation' );															
1678													}
1679
1680                                                } );
1681                                            }
1682
1683                                        }
1684                        }
1685
1686                    })(),
1687
1688                    portfolioLazyReveal = (function() {
1689
1690                        var lazyLoadImages = jQuery( '.portfolio.portfolio-lazy-load' ).find( '.thumb
1690-wrap' ).find( 'img' ) ,
1691                            $w = jQuery( window ),
1692                            th = 200,
1693                            $wh = $w.height(),
1694                         	reveal = function( elements ) {
1695
1696								var visibleImages;
1697								if( null == elements ) { 
1698									visibleImages = lazyLoadImages.filter(function() {
1699
1700										var $e = jQuery(this),
1701											wt = $w.scrollTop(),
1702											wb = wt + $wh,
1703											et = $e.offset().top,
1704											eb = et + $e.height();
1705										return eb >= wt - th && et <= wb + th;
1706									
1707									});
1708								}else {
1709									visibleImages = elements.filter(function() {
1710
1711										var $e = jQuery(this),
1712											wt = $w.scrollTop(),
1713											wb = wt + $wh,
1714											et = $e.offset().top,
1715											eb = et + $e.height();
1716										return eb >= wt - th && et <= wb + th;
1717									
1718									});
1719								}
1720								visibleImages.each( function() {
1721
1722									var el = jQuery( this );
1723									el.load( function() {
1724
1725										el.css( "opacity", "1" );
1726
1727									} )
1728									el.attr( 'src', el.attr( 'data-src' ) );
1729
1730								} );
1731								lazyLoadImages = lazyLoadImages.not( visibleImages );
1732
1733                        	},
1734							addElements = function( newElements ) {
1735								
1736								if( 0 < newElements.length ) {
1737									lazyLoadImages = lazyLoadImages.add( newElements );
1738								}
1739								
1740							}; 
1741						return {
1742							reveal : reveal,
1743							addElements : addElements
1744						}
1745
1746                    })(),
1747                
1748				portfolioModule = function() {  
1749
1750                    this.portfolioContainer = null,
1751                    this.closest_portfolio = null,
1752                    this.initalRender = false,
1753					this.dataSource = '',
1754					this.gutter_width,
1755					this.initialRender = false,
1756					this.elements = null,
1757                    this.init = function(element,actionParam){
1758
1759                        this.portfolioContainer = element.find('.portfolio-container');
1760                        this.closest_portfolio = element; 
1761                        this.setColumnWidth();
1762						this.elements = element.find( '.element' );
1763						this.storeData();
1764						this.getDataSource();
1765						this.gutter_width();
1766						
1767			        },
1768					this.storeData = function() {
1769
1770						this.closest_portfolio.data( "oshinePortfolio", this );
1771
1772					},
1773					this.getDataSource = function() {
1774
1775						if( 'undefined' != typeof this.closest_portfolio.attr( 'data-source' ) ) {
1776							this.dataSource = JSON.parse( this.closest_portfolio.attr( 'data-source' ) ).source;
1777						}
1778
1779					},
1780                    this.getContainerWidth = function(){
1781
1782                        return this.closest_portfolio.width();
1783                   
1784					},
1785                    this.setContainerWidth = function(roundedWidthParam){
1786                    
1787					    this.portfolioContainer.width(roundedWidthParam);
1788                    
1789					},
1790                    this.gutter_width = function(){
1791                    
1792					    this.gutter_width =  Number(this.closest_portfolio.attr('data-gutter-width'));
1793						if( 'number' != typeof this.gutter_width ) {
1794							this.gutter_width = 0;
1795						}
1796                    
1797					},
1798                    this.getElementNormalHeight = function () {
1799
1800                        var normalHeight = 0,
1801							elementsWithNormalHeight = this.portfolioContainer.find( '.no-wide-width-height:visible' ),
1802							elementsWithWideWidth,
1803                            elementsWithWideHeight,
1804							elementsWithWideWidthHeight;
1805						if( 0 < elementsWithNormalHeight.length ) {
1806							normalHeight = elementsWithNormalHeight.find( '.flip-img-wrap,.post-thumb-wrap' ).outerHeight();
1807						}else{
1808							elementsWithWideWidth = this.portfolioContainer.find( '.wide-width:visible' );
1809                            elementsWithWideHeight = this.portfolioContainer.find( '.wide-height:visible' );
1810							elementsWithWideWidthHeight = this.portfolioContainer.find( '.wide-width-height:visible' );
1811							if( 0 < elementsWithWideWidth.length ) {
1812								normalHeight = elementsWithWideWidth.find( '.flip-img-wrap,.post-thumb-wrap' ).outerHeight();
1813							}else if( 0 < elementsWithWideHeight.length ) {  
1814                                normalHeight = ( elementsWithWideHeight.find( '.flip-img-wrap,.post-thumb-wrap' ).outerHeight() - this.gutter_width )/2;
1815                            }else if( 0 < elementsWithWideWidthHeight.length ) {
1816								normalHeight = ( elementsWithWideWidthHeight.find( '.flip-img-wrap,.post-thumb-wrap' ).outerHeight() - this.gutter_width )/2;
1817							}else{
1818								normalHeight = 0;
1819							}
1820						}
1821						return normalHeight;
1822
1823                    },
1824					this.getElementNormalWidth = function() {
1825
1826						var normalWidth = 0,
1827							elementsWithNormalWidth = this.portfolioContainer.find( '.no-wide-width-height:visible,.wide-height:visible' ),
1828							elementsWithWideWidth,
1829							elementsWithWideWidthHeight;
1830						if( 0 < elementsWithNormalWidth.length ) {
1831							normalWidth = elementsWithNormalWidth.find( '.flip-img-wrap,.post-thumb-wrap' ).width();
1832						}else{
1833							elementsWithWideWidth = this.portfolioContainer.find( '.wide-width:visible' );
1834							elementsWithWideWidthHeight = this.portfolioContainer.find( '.wide-width-height:visible' );
1835							if( 0 < elementsWithWideWidth.length ) {
1836								normalWidth = ( elementsWithWideWidth.find( '.flip-img-wrap,.post-thumb-wrap' ) - this.gutter_width )/2;
1837							}else if( 0 < elementsWithWideWidthHeight.length ) {
1838								normalWidth = ( elementsWithWideWidthHeight.find( '.flip-img-wrap,.post-thumb-wrap' ) - this.gutter_width )/2;
1839							}else{
1840								normalWidth = 0;
1841							}
1842						}
1843						return normalWidth;
1844					
1845					},
1846                    this.noOfColumns = function () {
1847
1848                        var windowTotalWidth = jQuery(window).width() + jQuery.getScrollbarWidth() ,
1849							$isBlog = jQuery( 'body' ).hasClass( 'blog' ) ;
1850						//console.log(jQuery.getScrollbarWidth())
1851                        if( windowTotalWidth < 1280 && windowTotalWidth >= 768 ) {
1852							if( ( $isBlog && windowTotalWidth > 960 ) || !$isBlog ) {
1853								switch(this.closest_portfolio.attr('data-col')){
1854									case 'two':
1855										return 2;
1856									case 'one':
1857										return 1;
1858									default :
1859										return 3;
1860								}
1861							}else{
1862								if( 1 == this.closest_portfolio.attr( 'data-col' ) ) {
1863									return 1;
1864								}else{
1865									return 2;
1866								}
1867							}
1868                        }else if ( windowTotalWidth < 768 && windowTotalWidth > 481 ){
1869							if( $isBlog ) {
1870								return 1;
1871							}
1872                            switch(this.closest_portfolio.attr('data-col')){
1873                                case 'one':
1874                                    return 1;
1875                                default :
1876                                    return 2;
1877                            }
1878                        }else if ( windowTotalWidth <= 481 ){
1879                            if( this.closest_portfolio.hasClass( 'portfolio-two-col-mobile' ) ) {
1880                                return 2;
1881                            }else {
1882                                return 1;
1883                            }
1884                        }else{
1885                            switch(this.closest_portfolio.attr('data-col')){
1886                                case 'five':
1887                                    return 5;
1888                                case 'four':
1889                                    return 4;
1890                                case 'three':
1891                                    return 3;
1892                                case 'two':
1893                                    return 2;
1894                                case 'one':
1895                                    return 1;
1896                                default :
1897                                    return 3;
1898                            }
1899                        }
1900                    
1901					},
1902                    this.getRoundedWidth = function () {
1903
1904                        var rounded_width = Math.floor(this.getContainerWidth() );
1905                        var nCols = this.noOfColumns();
1906                        if(nCols == 0) nCols = 1;
1907                        var remainder = Math.floor(rounded_width / nCols);
1908                        rounded_width = remainder * nCols + nCols;
1909                        this.setContainerWidth( rounded_width );
1910                        return rounded_width; 
1911                    
1912					},
1913                    this.setColumnWidth = function () {
1914                        
1915						this.columnWidth = this.getRoundedWidth() / this.noOfColumns();
1916                    
1917					},
1918					this.prepareToFireIsotope = function() {
1919
1920						var currentInstance = this;
1921						if( this.closest_portfolio.hasClass( 'portfolio-delay-load' ) || this.closest_portfolio.hasClass( 'portfolio-lazy-load' ) ) {
1922							this.multiGridSetup( null, false );
1923							this.applyIsotope( !this.closest_portfolio.hasClass( 'portfolio-delay-load' ) ? true : false );
1924						}else{
1925							this.portfolioContainer.imagesLoaded( function(){
1926
1927								currentInstance.multiGridSetup( null, false );
1928								currentInstance.applyIsotope( true );
1929
1930							} );
1931						}
1932
1933					},
1934                    this.multiGridSetup = function ( $newItems, $isResize ) {
1935
1936						var elements = $newItems || this.elements,
1937							currentAspectRatio,
1938							flipImageWrap,
1939							vNormalHeight,
1940							normalWidth,
1941							vGutterWidth = this.gutter_width;
1942                        if ( this.closest_portfolio.hasClass('full-screen-gutter') && 1 != Number(this.closest_portfolio.attr('data-enable-masonry'))  && 'flickr' != this.dataSource ) {  
1943                            if( !$isResize ) {
1944								vNormalHeight = this.getElementNormalHeight();
1945							}else{
1946								currentAspectRatio = this.closest_portfolio.attr( 'data-aspect-ratio' );
1947								vNormalHeight = Math.round( this.getElementNormalWidth()/currentAspectRatio );								
1948							}
1949							elements.each( function() {
1950
1951								var currentElement = jQuery( this );
1952								if( currentElement.hasClass( 'wide-height' ) ) {
1953									currentElement.find( '.flip-img-wrap,.post-thumb-wrap' ).css( 'height', ( vNormalHeight*2 ) + vGutterWidth );
1954								}else if( currentElement.hasClass( 'wide-width-height' ) ) {
1955									if( 480 > window.innerWidth ) {
1956                                        var actualWidth = currentElement.width() - parseInt( currentElement.children(0).css( 'margin-left' ) );
1957										currentElement.find( '.flip-img-wrap,.post-thumb-wrap' ).css( 'height', Math.round( actualWidth/currentElement.find( '
1957img' ).attr( 'data-aspect-ratio' ) ) );
1958									}else{
1959										currentElement.find( '.flip-img-wrap,.post-thumb-wrap' ).css( 'height', (vNormalHeight*2) + vGutterWidth );
1960									}
1961								}else{
1962									currentElement.find( '.flip-img-wrap,.post-thumb-wrap' ).css( 'height', vNormalHeight );
1963								}
1964
1965							} );
1966
1967                        }else if( 'flickr' == this.dataSource ||  Number(this.closest_portfolio.attr('data-enable-masonry')) == 1 ) {
1968							if( !$isResize ) {
1969								elements.find( '.flip-img-wrap,.post-thumb-wrap' ).each( function(i, el) {
1970									var currentElement = jQuery( el );
1971									currentElement.css( 'height', currentElement.outerHeight() );
1972
1973								} );
1974							}else if( $isResize ) {
1975								var normalElementWidth = this.getElementNormalWidth();
1976								elements.find( '.flip-img-wrap,.post-thumb-wrap' ).each( function( i, el ) {
1977
1978									var currentElement = jQuery( el );
1979									currentElement.css( 'height', Math.round( normalElementWidth/currentElement.attr( 'data-aspect-ratio' ) ) );
1980
1981								} );
1982							}
1983						}
1984						if( !this.initialRender || null != $newItems ) {
1985							elements.find( '.flip-img-wrap,.post-thumb-wrap' ).css( "padding-bottom", "0px" );							
1986							elements.find( '.flip-img-wrap,.post-thumb-wrap' ).find( 'img' ).resizeToParent();		
1987						}
1988
1989                            
1990                    },
1991                    this.applyIsotope = function( delayLoad ) {
1992						
1993                        var column_width = this.columnWidth,
1994							flipWrap = this.portfolioContainer.find('.flip-img-wrap,.post-thumb-wrap'),
1995							shouldMaintainOrder = '1' == this.closest_portfolio.attr( 'data-maintain-order' );
1996                        this.portfolioContainer.isotope({
1997							isInitLayout : false,
1998                            itemSelector : '.element',
1999                            masonry: {
2000								columnWidth : column_width,
2001								horizontalOrder: shouldMaintainOrder
2002                            },
2003							transitionDuration : this.closest_portfolio.hasClass( 'portfolio-delay-load' ) ? 0 : 450
2004                        }).isotope('on','layoutComplete', function( laidOutItems ) {
2005                           
2006                            if( !this.initialRender ) {
2007                                if( Number( this.closest_portfolio.hasClass( 'portfolio-delay-load' ) ) ) {
2008										this.elements.addClass( "element-animate" );
2009										this.portfolioContainer.css( "visibility", "visible" );
2010										if( !$body.hasClass( 'be-sticky-sections' ) || 960 >= window.innerWidth ) {
2011											if( this.portfolioContainer.hasClass( 'style8-blog' ) ) {
2012												setTimeout( portfolioScrollReveal.delayReveal, 100 );
2013											}else{
2014												setTimeout( portfolioScrollReveal.delayReveal, 0 );
2015											}
2016											initializedPortfolioWithDelayCount++;
2017											if( initializedPortfolioWithDelayCount == portfolioWithDelayLoadCount ) {
2018												jQuery( window ).trigger( "beDelayLoad" );
2019											}
2020										}
2021                                }else{
2022                                    this.portfolioContainer.css( "visibility", "visible" );                                
2023                                }
2024                                if( Number( this.closest_portfolio.hasClass( 'portfolio-lazy-load' ) ) ) {
2025									if( !$body.hasClass( 'be-sticky-sections' ) || 960 >= window.innerWidth ) {
2026										if( this.portfolioContainer.hasClass( 'style8-blog' ) ) {
2027											setTimeout( 
2028												portfolioLazyReveal.reveal, 200
2029											);
2030										}else{
2031											portfolioLazyReveal.reveal();
2032										}
2033										initializedPortfolioWithLazyCount++;
2034										if( initializedPortfolioWithLazyCount == portfolioWithLazyLoadCount ) {
2035											jQuery( window ).trigger( "beLazyLoad" );
2036										}
2037									}
2038                                }
2039                                this.initialRender = true;
2040                            }
2041							setTimeout( function(){
2042								
2043								Waypoint.refreshAll();
2044								if( delayLoad ) {
2045									this.delayLoad( this.elements );
2046								}
2047							}.bind( this ), 0 );
2048
2049                        }.bind( this ));
2050						this.portfolioContainer.isotope( 'layout' );
2051
2052                    },
2053
2054                    this.delayLoad = function ( $elements ) {
2055
2056						var delay = 100;
2057						$elements.each( function() {
2058
2059							var curElement = jQuery( this ).find( 'img' );
2060							setTimeout( function() {
2061								curElement.parent().addClass( 'img-loaded' );
2062								curElement.closest('.flip-wrap').next().addClass('img-loaded');
2063							}, delay );
2064							delay = delay + 200;
2065
2066						} );
2067
2068                    },
2069                    this.portfolioParallaxSetup = function(){
2070                        if(this.portfolioContainer.hasClass('portfolio-item-parallax')) {
2071                            this.portfolioContainer.parentsUntil('.be-section').css('overflow', 'visible');
2072                            this.portfolioContainer.closest('.be-section').css('overflow', 'visible');
2073                            this.portfolioContainer.css('overflow', 'visible').find('.element').css('overflow', 'visible');
2074                        }
2075                    },
2076
2077					this.triggerResize = function() {
2078
2079						this.setColumnWidth();
2080						this.multiGridSetup( null, true );
2081						this.applyIsotope( false );
2082
2083					}
2084                },
2085
2086	            portfolioMainModule = function( portfolio ){
2087	                var portfolioModuleInst = [], i = 0; 
2088	                // Loop for Each Portfolio Item
2089	                portfolio.each(function () {
2090	                    // Default Portfolio Layout
2091	                    portfolioModuleInst[i] = new portfolioModule();
2092	                    portfolioModuleInst[i].init( jQuery(this) );
2093	                    portfolioModuleInst[i].prepareToFireIsotope();
2094	                    portfolioModuleInst[i].portfolioParallaxSetup();
2095	                    // Increment loop Counter
2096	                    i++;
2097	                }); //End of Loop
2098	            },
2099
2100
2101	            paginationData = function(triggerParam, portfolioParam, elementParam) {
2102	                var $this = portfolioParam,
2103	                    $trigger = triggerParam,
2104	                    $ajaxData = '';
2105
2106
2107	                switch(elementParam){
2108	                    case 'portfolio' : 
2109
2110	                        $ajaxData = "action=" + $this.attr("data-action") + 
2111	                                    "&category=" + $this.attr("data-category") + 
2112	                                    "&masonry=" + $this.attr("data-enable-masonry") + 
2113	                                    "&showposts=" + $this.attr("data-showposts") + 
2114	                                    "&col=" + $this.attr("data-col") + 
2115	                                    "&gallery=" + $this.attr("data-gallery") + 
2116	                                    "&filter=" + $this.attr("data-filter") + 
2117										"&meta_to_show=" + $this.attr("data-meta_to_show") + 
2118										"&placeholder_color" + $this.attr("data-placeholder-color") +
2119	                                    "&show_filters=" + $this.attr("data-show_filters") + 
2120	                                    "&thumb_overlay_color=" + $this.attr("data-thumbnail-bg-color") + 
2121	                                    "&title_style=" + ( $this.attr("data-title-style") || "") + 
2122	                                    "&title_color=" + $this.attr("data-title-color") + 
2123	                                    "&cat_color=" + $this.attr("data-cat-color") + 
2124	                                    "&title_animation_type=" + ( $this.attr("data-title-animation-type") || "" ) + 
2125	                                    "&cat_animation_type=" + ( $this.attr("data-cat-animation-type") || "" ) + 
2126	                                    "&gutter_width=" + Number( $this.attr("data-gutter-width") ) + 
2127	                                    "&hover_style=" + ( $this.attr("data-hover-style") || "" ) + 
2128	                                    "&img_grayscale=" + $this.attr("data-img-grayscale") + 
2129	                                    "&image_effect=" + ( $this.attr("data-image-effect") || "" ) + 
2130	                                    "&gradient_style_color=" + $this.attr("data-gradient-style-color") + 
2131	                                    "&cat_hide=" + $this.attr("data-cat-hide") + 
2132	                                    "&like_button=" + $this.attr("data-like-indicator") + 
2133										"&placeholder_color=" + $this.attr( "data-placeholder-color" ) + 
2134                                        "&prebuilt_hover_style=" + ( $this.attr( "data-prebuilt-hover-style" ) || "" );
2135
2136	                        return $ajaxData;
2137
2138	                    case 'gallery' :
2139
2140	                        $ajaxData = "action=" + $this.attr("data-action") + 
2141	                                    "&masonry=" + $this.attr("data-enable-masonry") + 
2142	                                    "&source=" + $this.attr("data-source") + 
2143	                                    "&gutter_width=" + $this.attr("data-gutter-width") + 
2144	                                    "&col=" + $this.attr("data-col") + 
2145	                                    "&data_gutter_width=" + Number( $this.attr("data-gutter-width") ) + 
2146	                                    "&images_arr=" + $this.attr("data-images-array") + 
2147	                                    "&items_per_load=" + $this.attr("data-items-per-load") + 
2148	                                    "&hover_style=" + $this.attr("data-hover-style") + 
2149	                                    "&img_grayscale=" + $this.attr("data-image-grayscale") + 
2150	                                    "&lightbox_type=" + $this.attr("data-lightbox-type") + 
2151	                                    "&image_source=" + $this.attr("data-image-source") + 
2152	                                    "&image_effect=" + $this.attr("data-image-effect") + 
2153	                                    "&thumb_overlay_color=" + $this.attr("data-thumb-overlay-color") + 
2154	                                    "&gradient_style_color=" + $this.attr("data-grad-style-color") + 
2155	                                    "&like_button=" + $this.attr("data-like-button") + 
2156	                                    "&hover_content_option=" + $this.attr("data-hover-content") + 
2157	                                    "&hover_content_color=" + $this.attr("data-hover-content-color") + 
2158										"&lazy_load=0" +
2159										"&delay_load=" + ( $this.hasClass( 'portfolio-delay-load' ) ? 1 : 0 ) +
2160										"&placeholder_color=" + $this.attr( 'data-placeholder-color' ); 
2161
2162	                        return $ajaxData;
2163
2164	                    case 'blog' :
2165
2166	                        $ajaxData = "action=" + $this.attr("data-action") + 
2167	                        "&showposts=" + $this.attr("data-showposts") + 
2168	                        "&gutter_width=" + Number( $this.attr("data-gutter-width") ) + 
2169							"&blog_style=" + ( portfolioParam.find( '.portfolio-container' ).hasClass( 'style3-blog' ) ? 'style3' : 'style8' ) + 
2170	                        "&total_items=" + $trigger.attr('data-total-items') ;
2171
2172	                        return $ajaxData;
2173
2174	                }
2175	            },
2176
2177	            infiniteScroll = function( triggerParam, portfolioParam, pagedParam, elementTypeParam ) {
2178	                var $this = triggerParam,
2179	                $portfolio = portfolioParam,
2180	                $paged = pagedParam;
2181
2182
2183	                var be_waypoint = new Waypoint({
2184	                    element: $this,
2185	                    handler: function (direction) {
2186	                        if (direction === 'down') {
2187	                            var $this_waypoint = this, 
2188	                            $page_loader = jQuery('.page-loader');
2189	                            $this_waypoint.disable(); //Disable Waypoint untill Images are Loaded
2190	                            $page_loader.fadeIn();
2191	                            jQuery.ajax({
2192	                                type: "POST",
2193	                                url: ajax_url,
2194	                                data: paginationData( $this, $portfolio, elementTypeParam) + "&paged=" + $paged 
2195	                            }).done(function (data) {
2196	                                if (data !== 0 && data !== '0' && data) {
2197	                                    var $newItems = jQuery(data).filter( function() {
2198												return 1 == this.nodeType;
2199											}),
2200											$portfolioInstance = $portfolio.data( "oshinePortfolio" );
2201                                        if( $portfolio.hasClass( 'be-portfolio-prebuilt-hover-style3' ) ) {
2202                                            tiltHoverEffect( $newItems.find( '.thumb-wrap' ) );
2203                                        }
2204										$portfolioInstance.elements = $portfolioInstance.elements.add( $newItems );
2205                                        if( $portfolio.hasClass( 'portfolio-delay-load' ) ) {
2206                                                $newItems.addClass( 'element-animate' );
2207												$portfolioInstance.portfolioContainer.append( $newItems );
2208												$portfolioInstance.multiGridSetup( $newItems, false );
2209												$portfolioInstance.portfolioContainer.isotope( "appended", $newItems );
2210												portfolioScrollReveal.addElements( $newItems );
2211												portfolioScrollReveal.delayReveal();
2212                                                if(elementTypeParam == 'portfolio' || elementTypeParam == 'gallery' ){
2213                                                    directionalHover( $portfolio.find('.element') );
2214                                                }
2215                                                if(elementTypeParam == 'blog'){
2216													portfolioLazyReveal.addElements( $newItems.find( '.thumb
2216-wrap' ).find( 'img' ) );
2217													setTimeout( portfolioLazyReveal.reveal, 100 );													
2218                                                    $newItems.find('.be_image_slider').each(function () {
2219                                                        var $this = jQuery(this).find('.image_slider_module');
2220                                                        be_blog_gallery($this); 
2221                                                    });
2222                                                    $newItems.fitVids();
2223													oshine_scripts.triggerStackShare( $newItems.find( '.be-share-stack-mask' ) );
2224                                                }
2225                                                window.tatsu.lightbox();
2226                                                $this_waypoint.enable(); //Enable Waypoint 
2227                                                $paged = Number($paged) + 1;
2228                                                $page_loader.fadeOut();  
2229                                        }else{
2230                                            $newItems.imagesLoaded(function() {
2231												$portfolioInstance.portfolioContainer.append( $newItems )
2232												$portfolioInstance.multiGridSetup( $newItems, false );
2233												$portfolioInstance.portfolioContainer.isotope( "appended", $newItems );
2234												$portfolioInstance.delayLoad( $newItems );
2235                                                if(elementTypeParam == 'portfolio' || elementTypeParam == 'gallery' ){
2236                                                    directionalHover( $portfolio.find('.element') );
2237                                                }
2238                                                if(elementTypeParam == 'blog'){
2239                                                    $newItems.find('.be_image_slider').each(function () {
2240                                                        var $this = jQuery(this).find('.image_slider_module');
2241                                                        be_blog_gallery($this); 
2242                                                    });
2243                                                    $newItems.fitVids();
2244                                                }
2245												window.tatsu.lightbox();
2246												
2247												if( window.be_gdpr_magnific_popup_retrigger ){
2248													window.be_gdpr_magnific_popup_retrigger();
2249												}
2250
2251                                                $this_waypoint.enable(); //Enable Waypoint 
2252                                                $paged = Number($paged) + 1;
2253                                                $page_loader.fadeOut();
2254
2255                                            });
2256                                        }
2257	                                } else {
2258	                                    $this_waypoint.destroy();
2259	                                    $page_loader.fadeOut();
2260	                                }
2261	                            });
2262	                       }
2263	                    }, 
2264	                    offset: 'bottom-in-view'    
2265	                });
2266	            },
2267
2268	            loadmore = function( triggerParam, portfolioParam, pagedParam, elementTypeParam ){
2269	                var $this = triggerParam,
2270	                $portfolio = portfolioParam,
2271	                $paged = pagedParam,
2272	                $page_loader = jQuery('.page-loader');
2273	                $page_loader.fadeIn();
2274	                $this.addClass('disabled');
2275	                jQuery.ajax({
2276	                    type: "POST",
2277	                    url: ajax_url,
2278	                    data: paginationData( $this, $portfolio , elementTypeParam) + "&paged=" + $paged ,
2279	                    success: function (data) {
2280
2281	                        if (data!== 0 && data !== '0' && data) {
2282	                            var $newItems = jQuery(data).filter( function() {
2283									return 1 == this.nodeType;
2284									}),
2285									$portfolioInstance = $portfolio.data( "oshinePortfolio" );
2286                                if( $portfolio.hasClass( 'be-portfolio-prebuilt-hover-style3' ) ) {
2287                                    tiltHoverEffect( $newItems.find( '.thumb
2287-wrap' ) );
2288                                }
2289								$portfolioInstance.elements = $portfolioInstance.elements.add( $newItems );
2290								if( $portfolio.hasClass( 'portfolio-delay-load' ) ) {
2291									$newItems.addClass( 'element-animate' );
2292									$portfolioInstance.portfolioContainer.append( $newItems )
2293									$portfolioInstance.multiGridSetup( $newItems, false );
2294
2295									$portfolioInstance.portfolioContainer.isotope( "appended", $newItems );
2296									portfolioScrollReveal.addElements( $newItems );
2297									portfolioScrollReveal.delayReveal();
2298									if(elementTypeParam == 'portfolio' || elementTypeParam == 'gallery' ){
2299										directionalHover( $portfolio.find('.element') );
2300									}
2301									if(elementTypeParam == 'blog'){
2302										portfolioLazyReveal.addElements( $newItems.find( '.thumb-wrap' ).find( 'img' ) );
2303										setTimeout( portfolioLazyReveal.reveal, 100 );
2304										$newItems.find('.be_image_slider').each(function () {
2305											var $this = jQuery(this).find('.image_slider_module');
2306											be_blog_gallery($this); 
2307										});
2308										$newItems.fitVids();
2309										oshine_scripts.triggerStackShare( $newItems.find( '.be-share-stack-mask' ) );
2310									}
2311
2312									window.tatsu.lightbox();
2313
2314									$portfolio.attr("data-paged", Number($paged) + 1);
2315									
2316									$this.attr("data-total-items", function () {
2317										return (Number(jQuery(this).attr('data-total-items')) - $newItems.find('.element-inner').length);
2318									});
2319
2320									if ($this.attr("data-total-items") <= 0) {
2321										$this.fadeOut(500, function () {
2322											$this.remove();
2323										});
2324									}
2325									$this.removeClass('disabled');
2326									$page_loader.fadeOut();
2327
2328								}else{
2329									$newItems.imagesLoaded(function () {
2330										
2331										$portfolioInstance.portfolioContainer.append( $newItems )
2332										$portfolioInstance.multiGridSetup( $newItems, false );
2333										$portfolioInstance.portfolioContainer.isotope( "appended", $newItems );
2334										$portfolioInstance.delayLoad( $newItems );
2335										if(elementTypeParam == 'portfolio' || elementTypeParam == 'gallery' ){
2336											directionalHover( $portfolio.find('.element') );
2337										}
2338										if(elementTypeParam == 'blog'){
2339											$newItems.find('.be_image_slider').each(function () {
2340												var $this = jQuery(this).find('.image_slider_module');
2341												be_blog_gallery($this); 
2342											});
2343											$newItems.fitVids();
2344										}
2345
2346										window.tatsu.lightbox();
2347										if( window.be_gdpr_magnific_popup_retrigger ){
2348											window.be_gdpr_magnific_popup_retrigger();
2349										}
2350										$portfolio.attr("data-paged", Number($paged) + 1);
2351										
2352										$this.attr("data-total-items", function () {
2353											return (Number(jQuery(this).attr('data-total-items')) - $newItems.find('.element-inner').length);
2354										});
2355
2356										if ($this.attr("data-total-items") <= 0) {
2357											$this.fadeOut(500, function () {
2358												$this.remove();
2359											});
2360										}
2361										$this.removeClass('disabled');
2362										$page_loader.fadeOut();
2363										
2364										if( typeof window.triggerBeGdpr === 'function' ){
2365											window.triggerBeGdpr();
2366										}
2367									});									
2368								}
2369	                        } else {
2370	                            $this.addClass('disabled');
2371	                            $page_loader.fadeOut();
2372	                        }
2373	                    }
2374	                });
2375	            },
2376
2377                //code to detect browser type. 
2378                //Source code : https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
2379                detectBrowser = function() {
2380
2381                    // Opera 8.0+
2382                    var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0,
2383                        isFirefox = typeof InstallTrigger !== 'undefined',
2384                        isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification)),
2385                        isIE = !!document.documentMode,
2386                        isEdge = !!window.StyleMedia,
2387                        isChrome = !!window.chrome && !!window.chrome.webstore;
2388                    return isOpera ? 'Opera' : isFirefox ? 'Firefox' : isSafari ? 'Safari' : isIE ? 'IE' : isEdge ? 'Edge' : isChrome ? 'Chrome' : false;
2389
2390                }, 
2391
2392                tiltHoverEffect = function( elements ) {
2393
2394                    if( 0 < jQuery( '.be-portfolio-prebuilt-hover-style3' ).length ) {
2395                        asyncloader.require( 'tilt', function() {
2396                            var targetElements = elements || jQuery( '.be-portfolio-prebuilt-hover-style3' ).closest( '.portfolio-all-wrap' ).css( 'overflow', 'visible' ).find( '.thumb-wrap' ),
2397                                targetBrowser = detectBrowser();
2398                            if( 'string' == typeof targetBrowser && ( 'Edge' == targetBrowser || 'IE' == targetBrowser ) ) {
2399                                return;
2400                            }else if( 'string' == typeof targetBrowser && 'Safari' == targetBrowser ) {
2401                                targetElements.find( '.thumb-shadow-wrapper' ).css( 'display', 'none' );
2402                                if( jQuery( 'body' ).hasClass( 'be-fixed-footer' ) ) { 
2403                                    jQuery( '#be-fixed-footer-wrap' ).css( 'position', 'relative' );
2404                                    jQuery( '#be-fixed-footer-placeholder' ).css( 'display', 'none' );
2405									jQuery( 'body' ).removeClass( 'be-fixed-footer' );
2406									jQuery( 'body' ).addClass( 'be-fixed-footer-disable' );
2407                                } 
2408                            }
2409                            targetElements.tilt({
2410                                glare : true,
2411                                maxGlare : 0.3,
2412                                perspective : 1000,
2413                                speed : 4000,
2414                                maxTilt : 10,
2415                                scale : 1.05
2416                            });
2417
2418                        } );
2419                    }
2420
2421                },
2422
2423	            be_blog_gallery = function(blog_gallery_post){
2424	                var $this = blog_gallery_post,
2425	                $slideshow = $this.attr('data-auto-slide'),
2426	                $slideshowspeed = 1000;
2427	                if( 'no' == $slideshow ){
2428	                    $slideshow = false;
2429	                } else {
2430	                    $slideshow = true;
2431	                    $slideshowspeed = $this.attr('data-slide-interval');
2432					}
2433					asyncloader.require( [ 'owlcarousel', 'imagesloaded' ], function(){
2434						
2435						$this.imagesLoaded( function() {
2436
2437							$this.owlCarousel({
2438								items:1,
2439								autoHeight: true,
2440								autoplay: $slideshow,
2441								autoplayTimeout: $slideshowspeed, 
2442								autoplaySpeed: 1000,
2443								autoplayHoverPause: true,
2444								navRewind: false,
2445								nav: true,
2446								loop: true,
2447								navText: ['<i class="font-icon icon-arrow_carrot-left"></i>','<i class="font-icon icon-arrow_carrot-right"></i>'],
2448								dots:false,
2449								onInitialize: function() {
2450									$this.fadeIn(500);
2451									$this.trigger('refresh.owl.carousel');
2452								}
2453							});	
2454							$this.closest( '.portfolio-container' ).isotope( 'layout' );						
2455						
2456						} );
2457
2458					});
2459	                
2460	            },
2461
2462	            forcePortfolioTitles = function() {
2463
2464                    var portfolioContainer = jQuery('.portfolio-container');
2465	                portfolioContainer.imagesLoaded(function () {
2466	                    if( portfolioContainer.hasClass( 'force-show-thumb-overlay' ) ) {
2467	                       portfolioContainer.css('opacity','1');
2468	                    }
2469	                }); 
2470	           
2471				 },
2472
2473
2474	            triggerInfiniteScroll = function(){
2475	                if( trigger.length > 0 ) {
2476	                    trigger.each( function() {
2477	                        var $portfolio = jQuery(this).closest('.portfolio');
2478	                        infiniteScroll( jQuery(this), $portfolio , $portfolio.attr( 'data-paged' ), jQuery(this).attr( 'data-type' ) )
2479	                    });
2480	                }
2481	            },
2482
2483
2484	            animationTrigger = function() {
2485	                jQuery(document).on( 'mouseenter.oshine mouseleave.oshine', '.element-inner', function(e) {
2486	                    var $animationTrigger = jQuery(this).find( '.animation-trigger' );
2487	                    if( $animationTrigger.length > 0 ) {    
2488		                    if( 'mouseenter' == e.type ){
2489		                        $animationTrigger.addClass( $animationTrigger.attr( 'data-animation-type' ) );
2490		                    } else {
2491		                        $animationTrigger.removeClass( $animationTrigger.attr( 'data-animation-type' ) );
2492		                    }
2493		                }
2494	                });
2495	            },
2496
2497	            parallaxPortfolioClasses = function() {              
2498	                jQuery('.portfolio-container').each(function () {
2499	                    var $this = jQuery(this), 
2500	                        $i = 0;
2501	                    if($this.closest('.portfolio').hasClass('two-col')) {
2502	                        $this.find('.element').each(function() {
2503	                            if($i == 1 || $i == 2) {
2504	                                jQuery(this).addClass('parallax-effect');
2505	                                $i = $i+1;
2506	                            } else if($i == 3) {
2507	                                jQuery(this).addClass('no-parallax-effect');
2508	                                $i = 0;
2509	                            } else {
2510	                                jQuery(this).addClass('no-parallax-effect');
2511	                                $i = $i+1;
2512	                            }
2513	                        });
2514	                    } else {
2515	                        $this.find('.element:odd').addClass('parallax-effect');
2516	                        $this.find('.element:even').addClass('no-parallax-effect');
2517	                    }
2518	                });      
2519	            },
2520
2521	            parallaxPortfolio = function() {
2522                    var portfolioContainer = jQuery('.portfolio-container');
2523	                if( portfolioContainer.length > 0  && portfolioContainer.hasClass('portfolio-item-parallax') ) {
2524	                    if(jQuery('html').hasClass('no-touch') && (jQuery(window).width() >= 768)) {
2525	                        portfolioContainer.each(function() {
2526	                            var $window_height = jQuery(window).height(), $window_scroll_top = jQuery(window).scrollTop();
2527	                            jQuery(this).find('.element.parallax-effect').each(function() {
2528	                                var $this = jQuery(this), offset = $this.offset().top, animate_pos = offset-($window_height/2), opacity = ((animate_pos) - $window_scroll_top)/1.5, opacity_2 = opacity*1.7;
2529	                                $this.find('.element-inner').css({
2530	                                    '-webkit-transform' : 'translatey('+opacity_2+'px) scale(0.7) translatez(0px)',
2531	                                    '-moz-transform' : 'translatey('+opacity_2+'px) scale(0.7) translatez(0px)',
2532	                                    '-o-transform' : 'translatey('+opacity_2+'px) scale(0.7) translatez(0px)',
2533	                                    '-ms-transform' : 'translatey('+opacity_2+'px) scale(0.7) translatez(0px)',
2534	                                    'transform' : 'translatey('+opacity_2+'px) scale(0.7) translatez(0px)'
2535	                                });
2536	                                $this.find('.thumb-title-wrap, .custom-like-button').css({
2537	                                    '-webkit-transform' : 'scale(1.4) translatez(0px)',
2538	                                    '-moz-transform' : 'scale(1.4) translatez(0px)',
2539	                                    '-o-transform' : 'scale(1.4) translatez(0px)',
2540	                                    '-ms-transform' : 'scale(1.4) translatez(0px)',
2541	                                    'transform' : 'scale(1.4) translatez(0px)'
2542	                                });
2543	                            });
2544	                            jQuery(this).find('.element.no-parallax-effect').each(function() {
2545	                                var $this = jQuery(this), offset = $this.offset().top, animate_pos = offset-($window_height/2), opacity = ((animate_pos) - $window_scroll_top)/2;
2546	                                $this.find('.element-inner').css({
2547	                                    '-webkit-transform' : 'translatey('+opacity+'px) translatez(0px)',
2548	                                    '-moz-transform' : 'translatey('+opacity+'px) translatez(0px)',
2549	                                    '-o-transform' : 'translatey('+opacity+'px) translatez(0px)',
2550	                                    '-ms-transform' : 'translatey('+opacity+'px) translatez(0px)',
2551	                                    'transform' : 'translatey('+opacity+'px) translatez(0px)',
2552	                                });
2553	                            });
2554	                        });
2555	                    }
2556	                }   
2557	            },
2558
2559	            filter = function() {
2560                    var delayCall = '';
2561	                jQuery(document).on('click', '.sort', function () {
2562						var currentTrigger = jQuery( this ),                           
2563							filterClass = currentTrigger.data().id.toString(),
2564							closestPortfolio = currentTrigger.closest( '.portfolio' ),
2565							filterElements;
2566						if( filterClass && filterClass.toString ) {
2567							filterClass = filterClass.toString();
2568						}
2569						currentTrigger.closest( '.filters' ).find( '.sort' ).removeClass( 'current_choice' );
2570                        
2571						currentTrigger.addClass( 'current_choice' );
2572						if( closestPortfolio.hasClass( 'portfolio-delay-load' ) ) {
2573							var classQuotient = 'delay-loaded already-visible end-animation animation-complete ' + closestPortfolio.attr( 'data-animation' ),
2574								currentVisibleElements = closestPortfolio.find( '.element.delay-loaded' );
2575							filterElements = ( 'element' != filterClass ) ? ( closestPortfolio.find( '.element' ).filter( function() {
2576								
2577								return ( 'string' == typeof jQuery( this ).attr( 'data-category-names' ) && ( 0 <= jQuery( this ).attr( 'data-category-names' ).indexOf( filterClass ) ) );
2578
2579							}) ) : closestPortfolio.find( '.element' );
2580							currentVisibleElements.css( 'animation-delay', 'initial' );
2581							currentVisibleElements.removeClass( classQuotient );
2582							currentVisibleElements.addClass( 'end-animation' );
2583							closestPortfolio.addClass( 'filter-scale-back-animation' );
2584                            if( '' != delayCall ) {
2585                                clearTimeout( delayCall );
2586                            }
2587							delayCall = setTimeout( function() {
2588                                if( '' != delayCall ) {
2589                                    delayCall = '';
2590                                }
2591								closestPortfolio.removeClass( 'filter-scale-back-animation' );
2592								filterElements.removeClass( classQuotient );	
2593								closestPortfolio.data( 'oshinePortfolio' ).portfolioContainer.isotope({
2594									filter : function() {
2595										var curCategories = jQuery( this ).attr( 'data-category-names' ),
2596                                            curCategoriesArray,
2597											result = false;
2598                                        if( 'element' == filterClass ) {
2599                                            result = true;
2600                                        }else if( 'string' == typeof curCategories && '' != curCategories ) {
2601                                            curCategoriesArray = curCategories.split( " " );
2602                                            if( '' == curCategoriesArray[ curCategoriesArray.length - 1 ] ) {
2603                                                curCategoriesArray.pop();
2604                                            }
2605                                            if( 0 <= curCategoriesArray.indexOf( filterClass ) ) {
2606                                                result = true;
2607                                            }else{
2608                                                result = false;
2609                                            }                                            
2610                                        }else{
2611                                            result = false;
2612                                        }
2613
2614										return result;
2615
2616									}
2617								});
2618								portfolioScrollReveal.addElements( filterElements, true );
2619								portfolioScrollReveal.delayReveal();
2620								if( closestPortfolio.hasClass( 'portfolio-lazy-load' ) ) {
2621									portfolioLazyReveal.reveal();
2622								}
2623                                jQuery( window ).trigger( 'resize' );
2624							}, 300 );
2625						}else{
2626							closestPortfolio.data( 'oshinePortfolio' ).portfolioContainer.isotope({
2627								filter : function() {
2628                                            var curCategories = jQuery( this ).attr( 'data-category-names' ),
2629                                                curCategoriesArray,
2630                                                result = false;
2631                                            if( 'element' == filterClass ) {
2632                                                result = true;
2633                                            }else if( 'string' == typeof curCategories && '' != curCategories ) {
2634                                                curCategoriesArray = curCategories.split( " " );
2635                                                if( '' == curCategoriesArray[ curCategoriesArray.length - 1 ] ) {
2636                                                    curCategoriesArray.pop();
2637                                                }
2638                                                if( 0 <= curCategoriesArray.indexOf( filterClass ) ) {
2639                                                    result = true;
2640                                                }else{
2641                                                    result = false;
2642                                                }                                            
2643                                            }else{
2644                                                result = false;
2645                                            }
2646
2647                                            return result;
2648										
2649                                        }
2650							});	
2651							if( closestPortfolio.hasClass( 'portfolio-lazy-load' ) ) {
2652								setTimeout( portfolioLazyReveal.reveal, 450 );
2653							}	
2654                            jQuery( window ).trigger( 'resize' );					
2655						}
2656	                });                
2657	            },
2658
2659	            triggerLoadMore = function() {
2660	                jQuery(document).on('click', '.trigger_load_more:not(.disabled)', function () {
2661	                    var $portfolio = jQuery(this).closest('.portfolio'),
2662	                        $paged = Number( $portfolio.attr('data-paged') );
2663	                    loadmore( jQuery(this), $portfolio, $paged, jQuery(this).attr('data-type') );
2664	                });
2665	            },
2666
2667	            portfolioLike = function() {
2668	                jQuery(document).on('click', '.portfolio-like .custom-like-button', function (e) {
2669	                    var $this = jQuery(this), $post_id = $this.attr('data-post-id');
2670	                    // $this.addClass('disable');
2671	                    jQuery.ajax({
2672	                        type: "POST",
2673	                        url: ajax_url,
2674	                        dataType: 'json',
2675	                        data: "action=post_like&post_id=" + $post_id,
2676	                        success : function (msg) {
2677								if (msg.status === "success") {
2678									if( msg.type === "like" ){
2679										$this.addClass('liked');
2680										$this.removeClass('no-liked');
2681										$this.find('span').text(msg.count);
2682									}else{
2683										$this.removeClass('liked');
2684										$this.addClass('no-liked');
2685										$this.find('span').text(msg.count);
2686									}
2687								}
2688							},
2689	                        error: function (msg) {
2690								alert(msg);
2691	                        }
2692	                    });
2693	                    return false;
2694	                });
2695	            },
2696          
2697
2698	            lightboxGallery = function() {
2699                    asyncloader.require( 'magnificpopup', function() { 
2700    	                if (jQuery('.popup-gallery').length > 0) {
2701    	                    jQuery('.popup-gallery').magnificPopup({
2702    	                        delegate: 'a',
2703    	                        type: 'image',
2704    	                        tLoading: 'Loading image #%curr%...',
2705    	                        mainClass: 'mfp-img-mobile',
2706    	                        gallery: {
2707    	                            enabled: true,
2708    	                            navigateByImgClick: true,
2709    	                            preload: [0, 1]
2710    	                        },
2711    	                        image: {
2712    	                            tError: '<a href="%url%">The image #%curr%</a> could not be loaded.'
2713    	                        },
2714    	                        preloader: true,
2715    	                        callbacks: {
2716    	                            afterClose: function () {
2717    	                                if (jQuery('body').hasClass('smooth-scroll')) {
2718    	                                    jQuery('html').css('overflow-y', 'scroll');
2719    	                                }
2720    	                            },
2721    	                            open: function () {
2722    	                                jQuery('body').addClass('mfp-active-state');
2723    	                                if (jQuery('#main').hasClass('layout-border')) {
2724    	                                    jQuery('.mfp-content').addClass('layout-border');
2725    	                                }
2726    	                            },
2727    	                            close: function () {
2728    	                                jQuery('body').removeClass('mfp-active-state');
2729    	                            }
2730    	                        }
2731    	                    });
2732    	                }
2733
2734    	                jQuery(document).on('click.oshine', '.be-lightbox-gallery.mfp-image', function (e) {
2735    	                    e.preventDefault();
2736    	                    jQuery(this).next('.popup-gallery').magnificPopup('open');
2737    	                });
2738                    });                
2739	            },
2740
2741	            ready = function( portfolio ) {
2742
2743	                    asyncloader.require( ['isotope', 'imagesloaded', 'resizetoparent', 'waypoints' ], function() {  
2744							
2745                            jQuery('html').addClass('show-overflow');
2746                            portfolioMainModule( portfolio );
2747                            triggerInfiniteScroll();
2748                            triggerLoadMore();
2749                            lightboxGallery();
2750                            portfolioLike();
2751                            filter();
2752							forcePortfolioTitles();
2753                            tiltHoverEffect();
2754                            directionalHover( portfolio.find( '.element' ) );
2755                            parallaxPortfolioClasses();
2756                            parallaxPortfolio();
2757                            animationTrigger();
2758                            if( jQuery('.be-photoswipe-gallery').length > 0 ) {
2759                                photoswipe( '.be-photoswipe-gallery' );
2760                            }
2761                            tatsu.lightbox();                        
2762	                    });
2763	                
2764	            }, 
2765
2766	            run = function() {
2767	                portfolio = jQuery('.portfolio');
2768	                if( portfolio.length > 0 ) {	                   
2769	                    ready( portfolio );
2770	                }
2771
2772	                jQuery(window).on( 'tatsu_update.oshine', function( e, data )  {
2773	                	
2774	                    if( 'oshine_gallery' === data.moduleName || 'gallery' === data.moduleName || 'portfolio' === data.moduleName || 'trigger_ready' === data.moduleName || 'blog' == data.moduleName ) {
2775	                    	
2776	                        portfolio = jQuery('.portfolio');
2777							ready( portfolio );
2778
2779	                    }
2780	                });                
2781
2782	                jQuery(window).resize( function() {
2783                        
2784	                    if( portfolio.length > 0 ) {
2785                            asyncloader.require( ['isotope', 'imagesloaded', 'resizetoparent', 'waypoints' ], function() { 
2786	                           portfolio.each( function() {
2787
2788									var currentPortfolioInstance = jQuery( this ).data( 'oshinePortfolio' );
2789									currentPortfolioInstance.triggerResize();
2790
2791							   } )
2792                           });
2793
2794	                    }
2795	                });
2796					
2797					if( portfolioWithLazyLoadCount > 0 ) {
2798                        jQuery( window ).one( 'beLazyLoad', function( event ) {
2799                            
2800                            jQuery( window ).on( "scroll", function( event ) {
2801
2802                                portfolioLazyReveal.reveal();
2803
2804                            } );
2805                           
2806                        } );
2807                    }
2808                    if( portfolioWithDelayLoadCount > 0 ) {
2809                        jQuery( window ).one( 'beDelayLoad', function( event ) {
2810
2811                            jQuery( window ).on( "scroll", function( event ) {
2812
2813                                portfolioScrollReveal.delayReveal();
2814
2815                            } );
2816                        
2817                        } );
2818                    }
2819					if( portfolioContainer.length > 0 && portfolioContainer.hasClass('portfolio-item-parallax') ) {
2820						jQuery(window).on( 'scroll', function(){
2821							parallaxPortfolio();
2822						});
2823					}
2824
2825	            };
2826
2827	            return {
2828					run: run,
2829					portfolioLazyReveal : portfolioLazyReveal.reveal,
2830					portfolioScrollReveal : portfolioScrollReveal.delayReveal
2831	            }
2832
2833	    })();
2834
2835        oshine_modules.run();
2836		oshine_portfolio.run();    
2837		window.oshinePortfolio = {
2838			portfolioLazyReveal : oshine_portfolio.portfolioLazyReveal,
2839			portfolioScrollReveal : oshine_portfolio.portfolioScrollReveal
2840		};
2841     });
2842
2843})( jQuery );

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.