https://www.jenlewinstudio.com/wp-content/plugins/oshine-modules/public/js/oshine-modules.js?ver=3.2
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 "&oshine_nonce=" + oshineModulesConfig.oshinonce + 743 //"&source=" + $justified_gallery_wrap.attr('data-source') + 744 "&images_arr=" + $justified_gallery_wrap.attr('data-images-array') + 745 "&items_per_load=" + $justified_gallery_wrap.attr('data-items-per-load') + 746 "&lazy_load=" + ( $justified_gallery_wrap.attr('data-lazy-load') || '0' ) + 747 "&hover_style=" + $justified_gallery_wrap.attr('data-hover-style') + 748 "&img_grayscale=" + $justified_gallery_wrap.attr('data-image-grayscale') + 749 "&image_effect=" + $justified_gallery_wrap.attr('data-image-effect') + 750 "&thumb_overlay_color=" + $justified_gallery_wrap.attr('data-thumb-overlay-color') + 751 "&gradient_style_color=" + $justified_gallery_wrap.attr('data-grad-style-color') + 752 "&like_button=" + $justified_gallery_wrap.attr('data-like-button') + 753 "&disable_overlay=" + $justified_gallery_wrap.attr('data-disable-overlay'); 754 755 var be_waypoint = new Waypoint({ 756 element: $this, 757 handler: function (direction) { 758 if (direction === 'down') { 759 var $this_waypoint = this, 760 $page_loader = jQuery('.page-loader'); 761 $this_waypoint.disable(); //Disable Waypoint untill Images are Loaded 762 $page_loader.fadeIn(); 763 jQuery.ajax({ 764 type: "POST", 765 url: ajax_url, 766 data: $ajaxData + "&paged=" + $paged , 767 }).done(function (data) { 768 if ( '0' != data ) { 769 var $newItems = jQuery(data); 770 $justified_gallery.on('jg.complete jg.resize', function () { 771 Waypoint.refreshAll(); 772 $this_waypoint.enable(); //Enable Waypoint 773 } ); 774 775 $justified_gallery.append($newItems).justifiedGallery('norewind'); 776 sequentialReveal($newItems); 777 if( $justified_gallery.attr('data-lazy-load') ) { 778 updateLazyLoadItems($newItems.find('.thumb-img')); 779 } 780 $paged = Number($paged) + 1; 781 $justified_gallery_wrap.attr('data-paged', $paged); 782 $page_loader.fadeOut(); 783 784 } else { 785 $this_waypoint.destroy(); 786 $this.fadeOut(); 787 $page_loader.fadeOut(); 788 } 789 }); 790 } 791 }, 792 offset: 'bottom-in-view' 793 }) 794 795 }); 796 } 797 $window.on('scroll', function() { 798 lazyLoad(); 799 }) 800 }); 801 } 802 }, 803 804 like = function() { 805 jQuery(document).on('click', '.gallery-like .custom-like-button', function (e) { 806 var $this = jQuery(this), $post_id = $this.attr('data-post-id'); 807 // $this.addClass('disable'); 808 jQuery.ajax({ 809 810 type: "POST", 811 url: ajax_url, 812 dataType: 'json', 813 data: "action=post_like&post_id=" + $post_id + "&oshine_nonce=" + oshineModulesConfig.oshinonce, 814 success : function (msg) { 815 if (msg.status === "success") { 816 if( msg.type === "like" ){ 817 $this.addClass('liked'); 818 $this.removeClass('no-liked'); 819 $this.find('span').text(msg.count); 820 }else{ 821 $this.removeClass('liked'); 822 $this.addClass('no-liked'); 823 $this.find('span').text(msg.count); 824 } 825 } 826 }, 827 error: function (msg) { 828 console.log( "error", msg ); 829 } 830 });
831 return false; 832 }); 833 }, 834 835 accordion = function( shouldUpdate ) { 836 837 var accordionWrap = jQuery( '.accordion' ); 838 if( !shouldUpdate ) { 839 if( accordionWrap.length > 0 ) { 840 accordionWrap.each(function () { 841 var $accordion = jQuery(this), 842 $collapse = Number( $accordion.attr('data-collapsed') ); 843 $accordion.accordion({ 844 collapsible: $collapse, 845 heightStyle: "content", 846 active: false 847 }).css('opacity', 1); 848 849 }); 850 } 851 }else { 852 if( 0 < accordionWrap.length ) { 853 accordionWrap.each( function() { 854 855 var accordion = jQuery( this ), 856 collapse = Number( accordion.attr( 'data-collapsed' ) ); 857 if( collapse ) { 858 accordion.accordion( "option", "collapsible", true ); 859 }else{ 860 accordion.accordion( "option", "collapsible", false ); 861 } 862 accordion.accordion( "refresh" ); 863 864 } ); 865 } 866 } 867 868 }, 869 870 tabs = function( shouldUpdate ) { 871 var tabsWrap = jQuery('.tabs'); 872 if( !shouldUpdate ) { 873 if(tabsWrap.length > 0) { 874 tabsWrap.tabs({ 875 fx : { 876 opacity : 'toggle', 877 duration : 200 878 } 879 }).css('opacity', 1); 880 } 881 }else{ 882 if( 0 < tabsWrap.length ) { 883 tabsWrap.tabs( "refresh" ); 884 } 885 } 886 887 }, 888 fancyTabs = function( shouldUpdate ) { 889 var fancyTabsWrap = jQuery('.fancy-tabs'); 890 891 if (fancyTabsWrap.length > 0) { 892 fancyTabsWrap.each(function () { 893 var $this = jQuery(this); 894 var tab_event = $this.data('event'); 895 // Check if tabs already initialized 896 var isInitialized = !!$this.data('ui-tabs'); 897 898 if (!isInitialized) { 899 // Initialize 900 $this.tabs({ 901 event: tab_event, 902 fx: { 903 opacity: 'toggle', 904 duration: 300 905 } 906 }).css('opacity', 1); 907 908 } else { 909 // Refresh if already initialized 910 $this.tabs('option', 'event', tab_event); // update event 911 $this.tabs('refresh'); 912 } 913 }); 914 } 915 }, 916 portfolioHoverOverflowFix = function () { 917 jQuery(".oshine-fancy-hover-image-style").each(function () { 918 var $item = jQuery(this); 919 var $parentSection = $item.closest(".tatsu-section"); 920 921 if (!$parentSection.length) return; 922 923 $item.on("mouseenter", function () { 924 $parentSection.data( 925 "original-overflow", 926 $parentSection.css("overflow") 927 ); 928 $parentSection.css("overflow", "visible"); 929 $item.addClass("hover-active"); 930 }); 931 932 $item.on("mouseleave", function () { 933 var original = 934 $parentSection.data("original-overflow") || ""; 935 $parentSection.css("overflow", original); 936 $item.removeClass("hover-active"); 937 }); 938 }); 939 }, 940 941 portfolioTopBorderInView = function () { 942 943 var $items = jQuery('.oshine-fancy-portfolio-module-style-1 .oshine-fancy-portfolio-item'); 944 945 if (!$items.length) { 946 return; 947 } 948 949 var checkInView = function () { 950 951 var windowBottom = jQuery(window).scrollTop() + jQuery(window).height(); 952 953 $items.each(function () { 954 955 var $item = jQuery(this); 956 957 if ($item.hasClass('is-inview')) { 958 return; 959 } 960 961 var itemTop = $item.offset().top; 962 var triggerPoint = itemTop + ($item.outerHeight() * 0.2); 963 964 if (triggerPoint < windowBottom) { 965 $item.addClass('is-inview'); 966 } 967 }); 968 }; 969 970 // Run once on load 971 checkInView(); 972 973 // Bind events 974 jQuery(window).on('scroll resize', checkInView); 975 }, 976 services = function() { 977 978 jQuery(document).on('mouseenter.oshine mouseleave.oshine', '.service-wrap', function (e) { 979 var $this = jQuery(this), 980 $icon = $this.find('.font-icon'), 981 $options = {}; 982 983 $options.hoverColor = $this.attr( 'data-hover-color' ); 984 $options.hoverBgColor = $this.attr( 'data-hover-bg-color' ); 985 $options.bgColor = $this.attr( 'data-bg-color' ); 986 $options.color = $this.attr( 'data-color' ); 987 988 if( 'mouseenter' == e.type ) { 989 $icon.css({ 990 'background-color': $options.hoverBgColor, 991 'color': $options.hoverColor 992 });
993 } else { 994 $icon.css({ 995 'background-color': $options.bgColor, 996 'color': $options.color 997 }); 998 } 999 }); 1000 }, 1001 1002 clientCarousel = function( shouldUpdate ) { 1003 var clientsWrap = jQuery( '.client-carousel-module' ); 1004 if( shouldUpdate ) { 1005 clientsWrap.each( function() { 1006 jQuery(this).trigger( 'destroy.owl.carousel' ); 1007 jQuery(this).find( '.owl-stage-outer' ).children().unwrap(); 1008 }); 1009 } else{ 1010 if(clientsWrap.length > 0 ){ 1011 asyncloader.require( [ 'owlcarousel', 'imagesloaded' ], function(){ 1012 clientsWrap.imagesLoaded(function () { 1013 clientsWrap.each(function () { 1014 var $this = jQuery(this), 1015 $slideshowspeed = Number( $this.attr('data-slide-show-speed') ) , 1016 $slideshow = Number( $this.attr( 'data-slide-show' ) ), 1017 $nav_dots = Number( $this.attr( 'data-slide-navigation-dots' ) ), 1018 $item_number = $this.children('.client-carousel-item').length, 1019 $wrap = $this.closest('.carousel-wrap'); 1020 1021 if($item_number > 5){ 1022 $item_number = 5; 1023 } 1024 1025 if( 0 == $slideshow ){ 1026 $slideshow = false; 1027 } else { 1028 $slideshow = true; 1029 } 1030 1031 if( 0 == $nav_dots ){ 1032 $nav_dots = false; 1033 } else { 1034 $nav_dots = true; 1035 } 1036 1037 if($item_number == 1){ 1038 $this.fadeIn(); 1039 }else{ 1040 $this.owlCarousel({ 1041 navSpeed: 500, 1042 autoplay: $slideshow, 1043 autoplayTimeout: $slideshowspeed, 1044 autoplaySpeed: 1000, 1045 autoplayHoverPause: true, 1046 loop: true, 1047 navRewind: false, 1048 nav: false, 1049 responsiveRefreshRate: 0, 1050 responsive: { 1051 0:{ 1052 items:2, 1053 dots:$nav_dots 1054 }, 1055 768:{ 1056 items:$item_number, 1057 dots:$nav_dots 1058 } 1059 }, 1060 onInitialize: function() { 1061 $this.fadeIn(500); 1062 $this.trigger('refresh.owl.carousel'); 1063 }, 1064 }); 1065 } 1066 if( 0 == $wrap.css( 'opacity' ) ) { 1067 $wrap.css( { 'opacity' : '1', 'height' : 'auto', 'overflow' : 'initial' } ); 1068 } 1069 }); 1070 }); 1071 }); 1072 } 1073 } 1074 1075 }, 1076 1077 portfolioCarousel = function() { 1078 var portfolioCarouselWrap = jQuery( '.portfolio-carousel-module' ); 1079 if( portfolioCarouselWrap.length > 0 ){ 1080 asyncloader.require( [ 'owlcarousel', 'imagesloaded' ], function(){ 1081 portfolioCarouselWrap.imagesLoaded(function () { 1082 jQuery('.portfolio-carousel-module').each(function () { 1083 var $this = jQuery(this),
1084 $slideshowspeed = Number( $this.attr('data-slide-show-speed') ) , 1085 $slideshow = Number( $this.attr( 'data-slide-show' ) ),$number_of_cols = Number( $this.attr( 'data-cols' ) ),$mobile_cols = 2, 1086 $autoplaySpeed = Number( $this.attr('data-slide-show-speed')), 1087 $item_number = $this.children('.carousel-item').length; 1088 if(typeof $number_of_cols ==='undefined' || $number_of_cols == null || $number_of_cols == ''){ 1089 $number_of_cols = 2; 1090 } 1091 if($number_of_cols > 5){ 1092 $number_of_cols = 5; 1093 } 1094 1095 if( 0 == $slideshow ) { 1096 $slideshow = false; 1097 } else { 1098 $slideshow = true; 1099 } 1100 if($number_of_cols == 1){ 1101 $mobile_cols = 1; 1102 } 1103 1104 if($item_number == 1){ 1105 $this.fadeIn(); 1106 }else{ 1107 $this.owlCarousel({ 1108 autoplay: $slideshow, 1109 autoplayTimeout: $slideshowspeed, 1110 autoplaySpeed: $autoplaySpeed, 1111 autoplayHoverPause: true, 1112 navRewind: false, 1113 loop: true, 1114 navText: ['<i class="font-icon icon-arrow_carrot-left"></i>','<i class="font-icon icon-arrow_carrot-right"></i>'], 1115 responsiveRefreshRate: 0, 1116 responsive: { 1117 0:{ 1118 items:$mobile_cols, 1119 dots:true, 1120 nav: false 1121 }, 1122 767:{ 1123 items:$number_of_cols, 1124 dots:false, 1125 nav: true 1126 } 1127 }, 1128 onInitialize: function() { 1129 $this.fadeIn(500); 1130 $this.trigger('refresh.owl.carousel'); 1131 } 1132 }); 1133 1134 } 1135 }); 1136 }); 1137 }); 1138 } 1139 }, 1140 1141 imageSlider = function( shouldUpdate ) { 1142 var imageSliderWrap = jQuery( '.be_image_slider' ); 1143 if( shouldUpdate ) { 1144 var $owl = imageSliderWrap.find( '.image_slider_module' ); 1145 $owl.each( function() { 1146 jQuery(this).trigger('destroy.owl.carousel'); 1147 jQuery(this).find( '.owl-stage-outer' ).children().unwrap(); 1148 }); 1149 } else { 1150 if( imageSliderWrap.length > 0 ) { 1151 asyncloader.require( [ 'owlcarousel', 'imagesloaded' ], function(){ 1152 imageSliderWrap.imagesLoaded(function () { 1153 jQuery('.be_image_slider').each(function () { 1154 var $this = jQuery(this).find('.image_slider_module'), 1155 closestPortfolio = $this.closest( '.portfolio' ), 1156 $slideshowspeed = Number( $this.attr('data-slide-show-speed') ) , 1157 $slideshow = Number( $this.attr( 'data-slide-show' ) ), 1158 $loop = Number( $this.attr( 'data-loop' ) ), 1159 $navdots = Number( $this.attr( 'data-navigation-dots' ) ), 1160 $navbuttons = Number( $this.attr( 'data-navigation-buttons' ) ), 1161 $pause = Number( $this.attr( 'data-pause-hover' ) ), 1162 $number = $this.find('.be_image_slide').length, 1163 $wrap = $this.closest('.be_image_slider'); 1164 1165 if( 0 == $slideshow ) { 1166 $slideshow = false; 1167 } else { 1168 $slideshow = true; 1169 } 1170 1171 if( $number == 1 ) { 1172 $this.fadeIn(); 1173 } else { 1174 $this.on( 'initialized.owl.carousel', function( event ) { 1175 1176 var portfolioInstance; 1177 if( 0 < closestPortfolio.length ) { 1178 portfolioInstance = closestPortfolio.data( "oshinePortfolio" ); 1179 setTimeout( function() { 1180 portfolioInstance.portfolioContainer.isotope( 'layout' ); 1181 }, 100 ) ; 1182 } 1183 1184 } ); 1185 $this.owlCarousel({ 1186 items:1, 1187 autoHeight: true, 1188 autoplay: $slideshow, 1189 autoplayTimeout: $slideshowspeed, 1190 autoplaySpeed: 1000, 1191 autoplayHoverPause: 0 == $pause ? false : true, 1192 navRewind: false, 1193 nav: 0 == $navbuttons ? false : true, 1194 loop: 0 == $loop ? false : true, 1195 navText: ['<i class="font-icon icon-arrow_carrot-left"></i>','<i class="font-icon icon-arrow_carrot-right"></i>'], 1196 dots: ( ( 0 < closestPortfolio.length ) || 0 == $navdots ) ? false : true, 1197 onInitialize: function() { 1198 $this.fadeIn(500); 1199 $this.trigger('refresh.owl.carousel'); 1200 } 1201 }); 1202 $this.on( "translated.owl.carousel", function( event ) { 1203 1204 var portfolioInstance; 1205 if( 0 < closestPortfolio.length ) { 1206 portfolioInstance = closestPortfolio.data( "oshinePortfolio" ); 1207 setTimeout( function() { 1208 portfolioInstance.portfolioContainer.isotope( 'layout' ); 1209 }, 250 ); 1210 } 1211 1212 } ) 1213 } 1214 if( '0' == $wrap.css( 'opacity' ) ) { 1215 $wrap.css( { 'opacity' : '1', 'height' : 'auto', 'overflow' : 'initial' } ); 1216 } 1217 }); 1218 }); 1219 }); 1220 } 1221 1222 } 1223 }, 1224 1225 testimonials = function( shouldUpdate ) { 1226 var testimonialsWrap = jQuery( '.testimonials-slides' ); 1227 if( shouldUpdate ) { 1228 var $owl = testimonialsWrap.find('.testimonial_module'); 1229 $owl.each( function() { 1230 jQuery(this).trigger('destroy.owl.carousel'); 1231 jQuery(this).find( '.owl-stage-outer' ).children().unwrap(); 1232 }); 1233 } else{ 1234 if ( testimonialsWrap.length > 0 ) { 1235 asyncloader.require( [ 'owlcarousel', 'imagesloaded' ], function(){ 1236 testimonialsWrap.imagesLoaded(function () { 1237 jQuery('.testimonials-slides').each(function () { 1238 1239 var $slide = jQuery(this), 1240 $this = jQuery(this).find('.testimonial_module'), 1241 $slideshowspeed = Number( $this.attr('data-sli
1241de-show-speed') ) , 1242 $slideshow = Number( $this.attr( 'data-slide-show' ) ), 1243 $pagination = Number( $this.attr('data-pagination') ), 1244 $number = $slide.find('.testimonial_slide').length, 1245 $wrap = $this.closest('.testimonials_wrap'); 1246 1247 if( 0 == $slideshow ) { 1248 $slideshow = false; 1249 } else { 1250 $slideshow = true; 1251 } 1252 1253 if($pagination == 0){ 1254 $pagination = false; 1255 }else{ 1256 $pagination = true; 1257 } 1258 1259 if($number == 1){ 1260 $slide.fadeIn(); 1261 }else{ 1262 testimonialCarousel = $this.owlCarousel({ 1263 items: 1 , 1264 autoHeight: true, 1265 autoplay: $slideshow, 1266 autoplayTimeout: $slideshowspeed, 1267 autoplaySpeed: 1000, 1268 autoplayHoverPause: true, 1269 navRewind: false, 1270 loop: true, 1271 dots: $pagination, 1272 onInitialize: function() { 1273 $slide.fadeIn(); 1274 $this.trigger('refresh.owl.carousel'); 1275 } 1276 }); 1277 1278 } 1279 1280 if( $wrap[0].style.opacity == '0' ) { 1281 $wrap.css({'opacity':'1', 'height' : 'auto','overflow' :'initial' }); 1282 } 1283 }); 1284 }); 1285 }); 1286 } 1287 } 1288 }, 1289 1290 tweets = function() { 1291 var tweetsWrap = jQuery( '.tweet-slides' ); 1292 if ( tweetsWrap.length > 0 ) { 1293 asyncloader.require( [ 'owlcarousel', 'imagesloaded' ], function(){ 1294 tweetsWrap.each(function () { 1295 var $slide = jQuery(this), 1296 $this = jQuery(this).find('.twitter_module'), 1297 $slideshowspeed = Number( $this.attr('data-slide-show-speed') ) , 1298 $slideshow = Number( $this.attr( 'data-slide-show' ) ), 1299 $pagination = Number( $this.attr('data-pagination') ), 1300 $number = $this.children('.tweet_list').length; 1301 1302 if( 0 == $slideshow ){ 1303 $slideshow = false; 1304 } else{ 1305 $slideshow = true; 1306 } 1307 1308 if($pagination == 0){ 1309 $pagination = false; 1310 }else{ 1311 $pagination = true; 1312 } 1313 1314 if($number == 1){ 1315 $slide.fadeIn(); 1316 }else{ 1317 $this.owlCarousel({ 1318 items:1, 1319 autoHeight: true, 1320 autoplay: $slideshow, 1321 autoplayTimeout: $slideshowspeed, 1322 autoplaySpeed: 1000, 1323 autoplayHoverPause: true, 1324 navRewind: false, 1325 loop: true, 1326 dots: $pagination, 1327 onInitialize: function () { 1328 $slide.fadeIn(); 1329 $this.trigger('refresh.owl.carousel'); 1330 } 1331 }); 1332 } 1333 }); 1334 });
1335 } 1336 }, 1337 1338 contentSlider = function( shouldUpdate ) { 1339 var contentSliderWrap = jQuery( '.content-slider' ); 1340 if( shouldUpdate ) { 1341 contentSliderWrap.each( function() { 1342 var $owl = jQuery(this).find('.content_slider_module'); 1343 $owl.trigger( 'destroy.owl.carousel' ); 1344 $owl.find( '.owl-stage-outer' ).children().unwrap(); 1345 }); 1346 } else { 1347 if ( contentSliderWrap.length > 0 ) { 1348 asyncloader.require( [ 'owlcarousel', 'imagesloaded' ], function(){ 1349 contentSliderWrap.imagesLoaded(function () { 1350 contentSliderWrap.each(function () { 1351 var $slide = jQuery(this), 1352 $this = jQuery(this).find('.content_slider_module'), 1353 $slideshowspeed = Number( $this.attr('data-slide-show-speed') ) , 1354 $slideshow = Number( $this.attr( 'data-slide-show' ) ), 1355 $item_number = $this.children('.content_slide').length; 1356 1357 if( 0 == $slideshow ){ 1358 $slideshow = false; 1359 } else{ 1360 $slideshow = true; 1361 } 1362 1363 if($item_number == 1){ 1364 $slide.fadeIn(); 1365 }else{ 1366 $this.owlCarousel({ 1367 items:1, 1368 autoHeight: true, 1369 autoplay: $slideshow, 1370 autoplayTimeout: $slideshowspeed, 1371 autoplaySpeed: 1000, 1372 autoplayHoverPause: true, 1373 navRewind: false, 1374 loop: true, 1375 dots: true, 1376 onInitialize: function () { 1377 $slide.fadeIn(); 1378 $this.trigger('refresh.owl.carousel'); 1379 } 1380 }); 1381 } 1382 if( 0 == $this.closest( '.content-slide-wrap' )[0].style.opacity ) { 1383 $this.closest('.content-slide-wrap').css( { 'opacity' : '1', 'overflow' : 'initial', 'height' : 'auto' } ); 1384 } 1385 }); 1386 }); 1387 }); 1388 } 1389 } 1390 }, 1391 1392 owlButtons = function() { 1393 jQuery(document).on('mouseenter.oshine mouseleave.oshine', '.owl-carousel', function (e) { 1394 var $owlButtons = jQuery(this).find('.owl-buttons'); 1395 if( 'mouseenter' == e.type ){ 1396 $owlButtons.css( 'opacity', 1 ); 1397 } else { 1398 $owlButtons.css( 'opacity', 0 ); 1399 } 1400 }); 1401 }, 1402 1403 textRotate = function() { 1404 var rotatesWrap = jQuery( '.rotates' ); 1405 if( rotatesWrap.length > 0 ) { 1406 asyncloader.require( 'rotate', function(){ 1407 rotatesWrap.each(function () { 1408 var $this = jQuery(this), 1409 $options = $this.data(); 1410 1411 $this.textrotator({ 1412 animation : $options.animation, 1413 separator : "||", 1414 speed : $options.speed 1415 }).css('opacity', 1); 1416 }); 1417 });
1418 } 1419 }, 1420 1421 typedText = function() { 1422 var typedWrap = jQuery( '.typed' ); 1423 if( typedWrap.length > 0 ) { 1424 asyncloader.require( 'typed', function(){ 1425 typedWrap.each(function () { 1426 var $this = jQuery(this), 1427 $typed_text = $this.text(), 1428 $typed_text_arr = $typed_text.split('||'); 1429 $this.empty().typed({ 1430 strings: $typed_text_arr, 1431 typeSpeed: 30, 1432 backDelay: 500, 1433 loop: true, 1434 loopCount: false 1435 }).css('opacity', 1); 1436 }); 1437 }); 1438 } 1439 }, 1440 1441 contact = function() { 1442 jQuery(document).on('click.oshine', '.contact_submit', function () { 1443 console.log( 'contact form clicked' ); 1444 var $this = jQuery(this), 1445 $contact_form = $this.closest('.contact_form'), 1446 $contact_status = $contact_form.find(".contact_status"), 1447 $contact_loader = $contact_form.find(".contact_loader"), 1448 consent_checkbox = $contact_form.find('.consent-checkbox'), 1449 isConsentGiven = !consent_checkbox.length || consent_checkbox.prop('checked') ? true: false; 1450 if( !isConsentGiven ) { 1451 $contact_status.removeClass("tatsu-success").addClass("tatsu-error"); 1452 $contact_status.html( $contact_form.attr('data-consent-error') ).slideDown(); 1453 return false; 1454 } 1455 $contact_loader.fadeIn(); 1456 1457 jQuery.ajax({ 1458 type: "POST", 1459 url: ajax_url, 1460 dataType: 'json', 1461 data: "action=contact_authentication&" + jQuery(this).closest(".contact").serialize(), 1462 success : function (msg) { 1463 $contact_loader.fadeOut(); 1464 if (msg.status === "error") { 1465 $contact_status.removeClass("tatsu-success").addClass("tatsu-error"); 1466 } else { 1467 $contact_status.addClass("tatsu-success").removeClass("tatsu-error"); 1468 } 1469 $contact_status.html(msg.data).slideDown(); 1470 }, 1471 error: function () { 1472 $contact_status.html("Please Try Again Later").slideDown(); 1473 } 1474 }); 1475 return false; 1476 }); 1477 }, 1478 1479 mailchimp = function() { 1480 jQuery(document).on('click.oshine', '.oshine-mc-submit', function () { 1481 var $this = jQuery(this), 1482 $subscription_form = $this.closest('.oshine-mc-wrap'), 1483 $subscribe_status = $subscription_form.find(".subscribe_status"), 1484 $subscribe_loader = $subscription_form.find(".subscribe_loader"), 1485 consent_checkbox = $subscription_form.find('.consent-checkbox'), 1486 isConsentGiven = !consent_checkbox.length || consent_checkbox.prop('checked') ? true: false; 1487 if( !isConsentGiven ) { 1488 $subscribe_status.removeClass("tatsu-success").addClass("tatsu-error"); 1489 $subscribe_status.html( $subscription_form.attr('data-consent-error') ).slideDown(); 1490 return false; 1491 } 1492 $subscribe_loader.fadeIn(); 1493 jQuery.ajax({ 1494 type: "POST", 1495 url: ajax_url, 1496 dataType: 'json', 1497 data: "action=mailchimp_subscription&" + jQuery(this).closest(".oshine-mc-form").serialize(), 1498 success : function (msg) { 1499 $subscribe_loader.fadeOut(); 1500 if (msg.status === "error") { 1501 $subscribe_status.removeClass("tatsu-success").addClass("tatsu-error"); 1502 } else { 1503 $subscribe_status.addClass("tatsu-success").removeClass("tatsu-error"); 1504 } 1505 $subscribe_status.html(msg.data).slideDown(); 1506 }, 1507 error: function () { 1508 $subscribe_status.html("Please Try Again Later").slideDown(); 1509 $subscribe_loader.fadeOut(); 1510 } 1511 }); 1512 return false; 1513 }); 1514 }, 1515 1516 svgLineAnimate = function(shouldUpdate,moduleId) { 1517 asyncloader.require( 'vivusSVGanimation', function() { 1518 //SVG animate front-end 1519 if( svgAnimateModules.length > 0 ) { 1520 svgAnimateModules.each(function (i, el) { 1521 var el = jQuery( el ); 1522 var svgObject = el.find( 'svg' )[0],
1523 pathTimingFunction = el.attr( 'data-path-animation' ), 1524 animTimingFunction = el.attr( 'data-svg-animation' ), 1525 duration = el.attr( 'data-animation-duration' ), 1526 delay = el.attr( 'data-animation-delay' ); 1527 new Vivus( 1528 svgObject, 1529 { 1530 duration: duration, 1531 pathTimingFunction : Vivus[pathTimingFunction], 1532 animTimingFunction : Vivus[animTimingFunction], 1533 delay : delay, 1534 onReady: function() { 1535 el.css( 'visibility', 'visible' ); 1536 } 1537 }, 1538 function() { 1539 console.log('Svg Animated'); 1540 }); 1541 }); 1542 } 1543 //SVG animate in tatsu 1544 var svgAnimatesInTatsu = jQuery('.oshine-svg-icon span'); 1545 if(svgAnimatesInTatsu.length > 0){ 1546 svgAnimatesInTatsu.each(function(index,element){ 1547 var element = jQuery(element).parent(); 1548 if(!moduleId || element.parent().hasClass('be-pb-observer-'+moduleId)){ 1549 var svgObject1 = element.attr( 'data-target' ), 1550 pathTimingFunction = element.attr( 'data-path-animation' ), 1551 animTimingFunction = element.attr( 'data-svg-animation' ), 1552 duration = element.attr( 'data-animation-duration' ), 1553 delay = element.attr( 'data-animation-delay' ), 1554 fileUrl = element.attr( 'data-svg-url'); 1555 element.children().empty(); 1556 new Vivus(svgObject1, { 1557 file:fileUrl, 1558 duration: duration, 1559 pathTimingFunction : Vivus[pathTimingFunction], 1560 animTimingFunction : Vivus[animTimingFunction], 1561 delay : delay, 1562 onReady: function() { 1563 element.css( 'visibility', 'visible' ); 1564 } 1565 }, 1566 function() { 1567 console.log('Svg Animated'); 1568 }); 1569 } 1570 }); 1571 } 1572 1573 }); 1574 }, 1575 registerCallbacks = function() { 1576 tatsuCallbacks['be_countdown'] = countDown; 1577 tatsuCallbacks['chart'] = animatedCharts; 1578 tatsuCallbacks['typed'] = typedText; 1579 tatsuCallbacks['accordion'] = accordion; 1580 tatsuCallbacks['tabs'] = tabs; 1581 tatsuCallbacks['be_oshine_fancy_tabs'] = fancyTabs; 1582 tatsuCallbacks['be_fancy_portfolio'] = portfolioHoverOverflowFix; 1583 tatsuCallbacks['be_fancy_portfolio'] = portfolioTopBorderInView; 1584 1585 tatsuCallbacks['justified_gallery'] = justifiedGallery; 1586 tatsuCallbacks['clients'] = clientCarousel; 1587 tatsuCallbacks['portfolio_carousel'] = portfolioCarousel; 1588 tatsuCallbacks['testimonials'] = testimonials; 1589 tatsuCallbacks['tweets'] = tweets; 1590 tatsuCallbacks['content_slides'] = contentSlider; 1591 tatsuCallbacks['flex_slider'] = imageSlider; 1592 tatsuCallbacks['rotates'] = textRotate; 1593 tatsuCallbacks['skills'] = progressBar; 1594 tatsuCallbacks['animate_icons_style1'] = animatedIconModule; 1595 tatsuCallbacks['animate_icons_style2'] = animatedIconModule; 1596 tatsuCallbacks['services'] = services; 1597 tatsuCallbacks['recent_posts'] = imageSlider; 1598 tatsuCallbacks['grids'] = iconGrid; 1599 tatsuCallbacks[ 'oshine_svg_icon' ] = svgLineAnimate; 1600 1601 1602 }, 1603 1604 ready = function() { 1605 1606 if( !jQuery('body').hasClass('tatsu-frame') && ( jQuery('.component').length > 0 || jQuery('#ps-container').length > 0 ) ) { 1607 asyncloader.require( [ 'resizetoparent', 'mousewheel' ], function() { 1608 asyncloader.require( 'beslider', function() { 1609 }); 1610 }); 1611 } 1612 1613 countDown(); 1614 iconGrid(); 1615 animatedIconModule(); 1616 animatedCharts(); 1617 progressBar(); 1618 justifiedGallery(); 1619 like(); 1620 accordion(); 1621 tabs(); 1622 fancyTabs(); 1623 portfolioHoverOverflowFix();
1624 portfolioTopBorderInView(); 1625 services(); 1626 clientCarousel(); 1627 portfolioCarousel(); 1628 imageSlider(); 1629 testimonials(); 1630 tweets(); 1631 contentSlider(); 1632 owlButtons(); 1633 textRotate(); 1634 typedText(); 1635 contact(); 1636 mailchimp(); 1637 1638 // svgInitialRender(); 1639 svgLineAnimate(); 1640 1641 registerCallbacks(); 1642 1643 }, 1644 1645 run = function() { 1646 1647 ready(); 1648 1649 jQuery(window).on( 'tatsu_update.oshine', function( e, data ) { 1650 // cssAnimate(); 1651 1652 console.log(data); 1653 animatedChartsWrap = jQuery( '.chart' ); 1654 skillsWrap = jQuery( '.be-skill' ); 1655 if( 'trigger_ready' == data.moduleName ) { 1656 ready(); 1657 } else if( data.moduleName in tatsuCallbacks ) { 1658 tatsuCallbacks[data.moduleName]( data.shouldUpdate, data.moduleId ); 1659 if( jQuery('.be-photoswipe-gallery').length > 0 ) { 1660 photoswipe( '.be-photoswipe-gallery' ); 1661 } 1662 } 1663 }); 1664 1665 jQuery(window).resize( function() { 1666 animatedIconModule(); 1667 portfolioTopBorderInView(); 1668 }); 1669 1670 jQuery(window).on( 'scroll', function(){ 1671 didScroll = true; 1672 }); 1673 1674 // scrollInterval = setInterval( function() { 1675 // if( didScroll ) { 1676 // didScroll = false; 1677 // svgLineAnimate(); 1678 // } 1679 // }, 50); 1680 1681 if( animatedChartsWrap.length > 0 || $body.hasClass('tatsu-frame') ) { 1682 jQuery(window).on('scroll', function(){ 1683 animatedCharts(); 1684 }); 1685 } 1686 1687 if( skillsWrap.length > 0 || $body.hasClass('tatsu-frame') ) { 1688 jQuery(window).on('scroll', function(){ 1689 progressBar(); 1690 }); 1691 } 1692 1693 jQuery(document).on( 'update_content', function(){ 1694 console.log('update_content'); 1695 jQuery(document).off( 'mouseenter.oshine mouseleave.oshine scroll.oshine click.oshine', '**' ); 1696 ready(); 1697 }); 1698 } 1699 1700 return { 1701 run: run 1702 } 1703 1704 })(); 1705 var oshine_portfolio = (function() { 1706 1707 var ajax_url = jQuery('#ajax_url').val(), 1708 vendorScriptsUrl = oshineModulesConfig.vendorScriptsUrl, 1709 portfolio = jQuery('.portfolio'), 1710 portfolioWithDelayLoadCount = jQuery( '.portfolio.portfolio-delay-load' ).length, 1711 portfolioWithLazyLoadCount = jQuery( '.portfolio.portfolio-lazy-load' ).length, 1712 initializedPortfolioWithDelayCount = 0, 1713 portfolios = jQuery( '.portfolio' ), 1714 initializedPortfolioWithLazyCount = 0, 1715 portfolioContainer = jQuery('.portfolio-container'), 1716 element = portfolioContainer.find('.element'), 1717 elementInner = element.find('.element-inner'), 1718 trigger = jQuery('.trigger_infinite_scroll'), 1719 1720 portfolioScrollReveal = (function() { 1721 var delayLoadElements = jQuery( '.portfolio.portfolio-delay-load' ).find( '.element' ); 1722 if( 0 < delayLoadElements.length ) { 1723 delayLoadElements.on( 'webkitAnimationStart oanimationstart msAnimationStart animationstart', function( event ) { 1724 1725 if( jQuery( event.target ).hasClass( 'element' ) ) { 1726 var el = jQuery( this ); 1727 el.addClass( 'end-animation' ); 1728 } 1729 1730 } ); 1731 delayLoadElements.on( 'webkitAnimationEnd oanimationend msAnimationEnd animationend', function( event ) { 1732 1733 var el = jQuery( this ); 1734 el.addClass( 'animation-complete' ); 1735 1736 } ); 1737 } 1738 return { 1739 delayReveal : function( elements ) { 1740 1741 1742 var portfolioDelay = 200, 1743 visibleElements; 1744 if( null == elements ) { 1745 visibleElements = delayLoadElements.filter( function( i, el ) { 1746 1747 return ( jQuery( el ).visible( true ) && jQuery( el ).is( ":visible" ) && ( window.innerHeight - el.getBoundingClientRect().top > 30 ) ); 1748 1749 } ); 1750 }else { 1751 visibleElements = elements.filter( function( i, el ) { 1752 1753 return ( jQuery( el ).visible( true ) && jQuery( el ).is( ":visible" ) && ( window.innerHeight - el.getBoundingClientRect().top > 30 ) ); 1754 1755 } ); 1756 } 1757 visibleElements.each( function( i , el ) { 1758 1759 var el = jQuery( el ); 1760 el.addClass( "already-visible delay-loaded" ); 1761 el.css( 'animation-delay', portfolioDelay + 'ms' ); 1762 portfolioDelay = portfolioDelay + 200; 1763 el.addClass( el.closest( '.portfolio' ).attr( "data-animation" ) ); 1764 1765 } ); 1766 delayLoadElements = delayLoadElements.not( visibleElements ); 1767 1768 }, 1769 addElements : function( newElements, shouldAddListeners ) { 1770 1771 delayLoadElements = delayLoadElements.add( newElements ); 1772 if( 0 < newElements.length && !shouldAddListeners ) { 1773 newElements.on( 'webkitAnimationStart oanimationstart msAnimationStart animationstart', function( event ) { 1774 1775 if( jQuery( event.target ).hasClass( 'element' ) ) { 1776 var el = jQuery( this ); 1777 el.addClass( 'end-animation' ); 1778 } 1779 1780 } ); 1781 } 1782 1783 } 1784 } 1785 1786 })(), 1787 1788 portfolioLazyReveal = (function() { 1789 1790 var lazyLoadImages = jQuery( '.portfolio.portfolio-lazy-load' ).find( '.thumb
1790-wrap' ).find( 'img' ) , 1791 $w = jQuery( window ), 1792 th = 200, 1793 $wh = $w.height(), 1794 reveal = function( elements ) { 1795 1796 var visibleImages; 1797 if( null == elements ) { 1798 visibleImages = lazyLoadImages.filter(function() { 1799 1800 var $e = jQuery(this), 1801 wt = $w.scrollTop(), 1802 wb = wt + $wh, 1803 et = $e.offset().top, 1804 eb = et + $e.height(); 1805 return eb >= wt - th && et <= wb + th; 1806 1807 }); 1808 }else { 1809 visibleImages = elements.filter(function() { 1810 1811 var $e = jQuery(this), 1812 wt = $w.scrollTop(), 1813 wb = wt + $wh, 1814 et = $e.offset().top, 1815 eb = et + $e.height(); 1816 return eb >= wt - th && et <= wb + th; 1817 1818 }); 1819 } 1820 visibleImages.each( function() { 1821 1822 var el = jQuery( this ); 1823 el.load( function() { 1824 1825 el.css( "opacity", "1" ); 1826 1827 } ) 1828 el.attr( 'src', el.attr( 'data-src' ) ); 1829 1830 } ); 1831 lazyLoadImages = lazyLoadImages.not( visibleImages ); 1832 1833 }, 1834 addElements = function( newElements ) { 1835 1836 if( 0 < newElements.length ) { 1837 lazyLoadImages = lazyLoadImages.add( newElements ); 1838 } 1839 1840 }; 1841 return { 1842 reveal : reveal, 1843 addElements : addElements 1844 } 1845 1846 })(), 1847 1848 portfolioModule = function() { 1849 1850 this.portfolioContainer = null, 1851 this.closest_portfolio = null, 1852 this.initalRender = false, 1853 this.dataSource = '', 1854 this.gutter_width, 1855 this.initialRender = false, 1856 this.elements = null, 1857 this.init = function(element,actionParam){ 1858 1859 this.portfolioContainer = element.find('.portfolio-container'); 1860 this.closest_portfolio = element; 1861 this.setColumnWidth(); 1862 this.elements = element.find( '.element' ); 1863 this.storeData(); 1864 this.getDataSource(); 1865 this.gutter_width(); 1866 1867 }, 1868 this.storeData = function() { 1869 1870 this.closest_portfolio.data( "oshinePortfolio", this ); 1871 1872 }, 1873 this.getDataSource = function() { 1874 1875 if( 'undefined' != typeof this.closest_portfolio.attr( 'data-source' ) ) { 1876 this.dataSource = JSON.parse( this.closest_portfolio.attr( 'data-source' ) ).source; 1877 } 1878 1879 }, 1880 this.getContainerWidth = function(){ 1881 1882 return this.closest_portfolio.width(); 1883 1884 }, 1885 this.setContainerWidth = function(roundedWidthParam){ 1886 1887 this.portfolioContainer.width(roundedWidthParam); 1888 1889 }, 1890 this.gutter_width = function(){ 1891 1892 this.gutter_width = Number(this.closest_portfolio.attr('data-gutter-width')); 1893 if( 'number' != typeof this.gutter_width ) { 1894 this.gutter_width = 0; 1895 } 1896 1897 }, 1898 this.getElementNormalHeight = function () { 1899 1900 var normalHeight = 0, 1901 elementsWithNormalHeight = this.portfolioContainer.find( '.no-wide-width-height:visible' ), 1902 elementsWithWideWidth, 1903 elementsWithWideHeight, 1904 elementsWithWideWidthHeight; 1905 if( 0 < elementsWithNormalHeight.length ) { 1906 normalHeight = elementsWithNormalHeight.find( '.flip-img-wrap,.post-thumb-wrap' ).outerHeight(); 1907 }else{ 1908 elementsWithWideWidth = this.portfolioContainer.find( '.wide-width:visible' ); 1909 elementsWithWideHeight = this.portfolioContainer.find( '.wide-height:visible' ); 1910 elementsWithWideWidthHeight = this.portfolioContainer.find( '.wide-width-height:visible' ); 1911 if( 0 < elementsWithWideWidth.length ) { 1912 normalHeight = elementsWithWideWidth.find( '.flip-img-wrap,.post-thumb-wrap' ).outerHeight(); 1913 }else if( 0 < elementsWithWideHeight.length ) { 1914 normalHeight = ( elementsWithWideHeight.find( '.flip-img-wrap,.post-thumb-wrap' ).outerHeight() - this.gutter_width )/2; 1915 }else if( 0 < elementsWithWideWidthHeight.length ) { 1916 normalHeight = ( elementsWithWideWidthHeight.find( '.flip-img-wrap,.post-thumb-wrap' ).outerHeight() - this.gutter_width )/2; 1917 }else{ 1918 normalHeight = 0; 1919 } 1920 } 1921 return normalHeight; 1922 1923 }, 1924 this.getElementNormalWidth = function() { 1925 1926 var normalWidth = 0, 1927 elementsWithNormalWidth = this.portfolioContainer.find( '.no-wide-width-height:visible,.wide-height:visible' ), 1928 elementsWithWideWidth, 1929 elementsWithWideWidthHeight; 1930 if( 0 < elementsWithNormalWidth.length ) { 1931 normalWidth = elementsWithNormalWidth.find( '.flip-img-wrap,.post-thumb-wrap' ).width(); 1932 }else{ 1933 elementsWithWideWidth = this.portfolioContainer.find( '.wide-width:visible' ); 1934 elementsWithWideWidthHeight = this.portfolioContainer.find( '.wide-width-height:visible' ); 1935 if( 0 < elementsWithWideWidth.length ) { 1936 normalWidth = ( elementsWithWideWidth.find( '.flip-img-wrap,.post-thumb-wrap' ) - this.gutter_width )/2; 1937 }else if( 0 < elementsWithWideWidthHeight.length ) { 1938 normalWidth = ( elementsWithWideWidthHeight.find( '.flip-img-wrap,.post-thumb-wrap' ) - this.gutter_width )/2; 1939 }else{ 1940 normalWidth = 0; 1941 } 1942 } 1943 return normalWidth; 1944 1945 }, 1946 this.noOfColumns = function () { 1947 1948 var windowTotalWidth = jQuery(window).width() + jQuery.getScrollbarWidth() , 1949 $isBlog = jQuery( 'body' ).hasClass( 'blog' ) ; 1950 //console.log(jQuery.getScrollbarWidth()) 1951 if( windowTotalWidth < 1280 && windowTotalWidth >= 768 ) { 1952 if( ( $isBlog && windowTotalWidth > 960 ) || !$isBlog ) { 1953 switch(this.closest_portfolio.attr('data-col')){ 1954 case 'two': 1955 return 2; 1956 case 'one': 1957 return 1; 1958 default : 1959 return 3; 1960 } 1961 }else{ 1962 if( 1 == this.closest_portfolio.attr( 'data-col' ) ) { 1963 return 1; 1964 }else{ 1965 return 2; 1966 } 1967 } 1968 }else if ( windowTotalWidth < 768 && windowTotalWidth > 481 ){ 1969 if( $isBlog ) { 1970 return 1; 1971 } 1972 switch(this.closest_portfolio.attr('data-col')){ 1973 case 'one': 1974 return 1; 1975 default : 1976 return 2; 1977 } 1978 }else if ( windowTotalWidth <= 481 ){ 1979 if( this.closest_portfolio.hasClass( 'portfolio-two-col-mobile' ) ) { 1980 return 2; 1981 }else { 1982 return 1; 1983 } 1984 }else{ 1985 switch(this.closest_portfolio.attr('data-col')){ 1986 case 'five': 1987 return 5; 1988 case 'four': 1989 return 4; 1990 case 'three': 1991 return 3; 1992 case 'two': 1993 return 2; 1994 case 'one': 1995 return 1; 1996 default : 1997 return 3; 1998 } 1999 } 2000 2001 }, 2002 this.getRoundedWidth = function () { 2003 2004 var rounded_width = Math.floor(this.getContainerWidth() ); 2005 var nCols = this.noOfColumns(); 2006 if(nCols == 0) nCols = 1; 2007 var remainder = Math.floor(rounded_width / nCols); 2008 rounded_width = remainder * nCols + nCols; 2009 this.setContainerWidth( rounded_width ); 2010 return rounded_width; 2011 2012 }, 2013 this.setColumnWidth = function () { 2014 2015 this.columnWidth = this.getRoundedWidth() / this.noOfColumns(); 2016 2017 }, 2018 this.prepareToFireIsotope = function() { 2019 2020 var currentInstance = this; 2021 if( this.closest_portfolio.hasClass( 'portfolio-delay-load' ) || this.closest_portfolio.hasClass( 'portfolio-lazy-load' ) ) { 2022 this.multiGridSetup( null, false ); 2023 this.applyIsotope( !this.closest_portfolio.hasClass( 'portfolio-delay-load' ) ? true : false ); 2024 }else{ 2025 this.portfolioContainer.imagesLoaded( function(){ 2026 2027 currentInstance.multiGridSetup( null, false ); 2028 currentInstance.applyIsotope( true ); 2029 2030 } ); 2031 } 2032 2033 }, 2034 this.multiGridSetup = function ( $newItems, $isResize ) { 2035 2036 var elements = $newItems || this.elements, 2037 currentAspectRatio, 2038 flipImageWrap, 2039 vNormalHeight, 2040 normalWidth, 2041 vGutterWidth = this.gutter_width; 2042 if ( this.closest_portfolio.hasClass('full-screen-gutter') && 1 != Number(this.closest_portfolio.attr('data-enable-masonry')) && 'flickr' != this.dataSource ) { 2043 if( !$isResize ) { 2044 vNormalHeight = this.getElementNormalHeight(); 2045 }else{ 2046 currentAspectRatio = this.closest_portfolio.attr( 'data-aspect-ratio' ); 2047 vNormalHeight = Math.round( this.getElementNormalWidth()/currentAspectRatio ); 2048 } 2049 elements.each( function() { 2050 2051 var currentElement = jQuery( this ); 2052 if( currentElement.hasClass( 'wide-height' ) ) { 2053 currentElement.find( '.flip-img-wrap,.post-thumb-wrap' ).css( 'height', ( vNormalHeight*2 ) + vGutterWidth ); 2054 }else if( currentElement.hasClass( 'wide-width-height' ) ) { 2055 if( 480 > window.innerWidth ) { 2056 var actualWidth = currentElement.width() - parseInt( currentElement.children(0).css( 'margin-left' ) ); 2057 currentElement.find( '.flip-img-wrap,.post-thumb-wrap' ).css( 'height', Math.round( actualWidth/currentElement.find( '
2057img' ).attr( 'data-aspect-ratio' ) ) ); 2058 }else{ 2059 currentElement.find( '.flip-img-wrap,.post-thumb-wrap' ).css( 'height', (vNormalHeight*2) + vGutterWidth ); 2060 } 2061 }else{ 2062 currentElement.find( '.flip-img-wrap,.post-thumb-wrap' ).css( 'height', vNormalHeight ); 2063 } 2064 2065 } ); 2066 2067 }else if( 'flickr' == this.dataSource || Number(this.closest_portfolio.attr('data-enable-masonry')) == 1 ) { 2068 if( !$isResize ) { 2069 elements.find( '.flip-img-wrap,.post-thumb-wrap' ).each( function(i, el) { 2070 var currentElement = jQuery( el ); 2071 currentElement.css( 'height', currentElement.outerHeight() ); 2072 2073 } ); 2074 }else if( $isResize ) { 2075 var normalElementWidth = this.getElementNormalWidth(); 2076 elements.find( '.flip-img-wrap,.post-thumb-wrap' ).each( function( i, el ) { 2077 2078 var currentElement = jQuery( el ); 2079 currentElement.css( 'height', Math.round( normalElementWidth/currentElement.attr( 'data-aspect-ratio' ) ) ); 2080 2081 } ); 2082 } 2083 } 2084 if( !this.initialRender || null != $newItems ) { 2085 elements.find( '.flip-img-wrap,.post-thumb-wrap' ).css( "padding-bottom", "0px" ); 2086 elements.find( '.flip-img-wrap,.post-thumb-wrap' ).find( 'img' ).resizeToParent(); 2087 } 2088 2089 2090 }, 2091 this.applyIsotope = function( delayLoad ) { 2092 2093 var column_width = this.columnWidth, 2094 flipWrap = this.portfolioContainer.find('.flip-img-wrap,.post-thumb-wrap'), 2095 shouldMaintainOrder = '1' == this.closest_portfolio.attr( 'data-maintain-order' ); 2096 this.portfolioContainer.isotope({ 2097 isInitLayout : false, 2098 itemSelector : '.element', 2099 masonry: { 2100 columnWidth : column_width, 2101 horizontalOrder: shouldMaintainOrder 2102 }, 2103 transitionDuration : this.closest_portfolio.hasClass( 'portfolio-delay-load' ) ? 0 : 450 2104 }).isotope('on','layoutComplete', function( laidOutItems ) { 2105 2106 if( !this.initialRender ) { 2107 if( Number( this.closest_portfolio.hasClass( 'portfolio-delay-load' ) ) ) { 2108 this.elements.addClass( "element-animate" ); 2109 this.portfolioContainer.css( "visibility", "visible" ); 2110 if( !$body.hasClass( 'be-sticky-sections' ) || 960 >= window.innerWidth ) { 2111 if( this.portfolioContainer.hasClass( 'style8-blog' ) ) { 2112 setTimeout( portfolioScrollReveal.delayReveal, 100 ); 2113 }else{ 2114 setTimeout( portfolioScrollReveal.delayReveal, 0 ); 2115 } 2116 initializedPortfolioWithDelayCount++; 2117 if( initializedPortfolioWithDelayCount == portfolioWithDelayLoadCount ) { 2118 jQuery( window ).trigger( "beDelayLoad" ); 2119 } 2120 } 2121 }else{ 2122 this.portfolioContainer.css( "visibility", "visible" ); 2123 } 2124 if( Number( this.closest_portfolio.hasClass( 'portfolio-lazy-load' ) ) ) { 2125 if( !$body.hasClass( 'be-sticky-sections' ) || 960 >= window.innerWidth ) { 2126 if( this.portfolioContainer.hasClass( 'style8-blog' ) ) { 2127 setTimeout( 2128 portfolioLazyReveal.reveal, 200 2129 ); 2130 }else{ 2131 portfolioLazyReveal.reveal(); 2132 } 2133 initializedPortfolioWithLazyCount++; 2134 if( initializedPortfolioWithLazyCount == portfolioWithLazyLoadCount ) { 2135 jQuery( window ).trigger( "beLazyLoad" ); 2136 } 2137 } 2138 } 2139 this.initialRender = true; 2140 } 2141 setTimeout( function(){ 2142 2143 Waypoint.refreshAll(); 2144 if( delayLoad ) { 2145 this.delayLoad( this.elements ); 2146 } 2147 }.bind( this ), 0 ); 2148 2149 }.bind( this )); 2150 this.portfolioContainer.isotope( 'layout' ); 2151 2152 }, 2153 2154 this.delayLoad = function ( $elements ) { 2155
2156 var delay = 100; 2157 $elements.each( function() { 2158 2159 var curElement = jQuery( this ).find( 'img' ); 2160 setTimeout( function() { 2161 curElement.parent().addClass( 'img-loaded' ); 2162 curElement.closest('.flip-wrap').next().addClass('img-loaded'); 2163 }, delay ); 2164 delay = delay + 200; 2165 2166 } ); 2167 2168 }, 2169 this.portfolioParallaxSetup = function(){ 2170 if(this.portfolioContainer.hasClass('portfolio-item-parallax')) { 2171 this.portfolioContainer.parentsUntil('.be-section').css('overflow', 'visible'); 2172 this.portfolioContainer.closest('.be-section').css('overflow', 'visible'); 2173 this.portfolioContainer.css('overflow', 'visible').find('.element').css('overflow', 'visible'); 2174 } 2175 }, 2176 2177 this.triggerResize = function() { 2178 2179 this.setColumnWidth(); 2180 this.multiGridSetup( null, true ); 2181 this.applyIsotope( false ); 2182 2183 } 2184 }, 2185 2186 portfolioMainModule = function( portfolio ){ 2187 var portfolioModuleInst = [], i = 0; 2188 // Loop for Each Portfolio Item 2189 portfolio.each(function () { 2190 // Default Portfolio Layout 2191 portfolioModuleInst[i] = new portfolioModule(); 2192 portfolioModuleInst[i].init( jQuery(this) ); 2193 portfolioModuleInst[i].prepareToFireIsotope(); 2194 portfolioModuleInst[i].portfolioParallaxSetup(); 2195 // Increment loop Counter 2196 i++; 2197 }); //End of Loop 2198 }, 2199 2200 2201 paginationData = function(triggerParam, portfolioParam, elementParam) { 2202 var $this = portfolioParam, 2203 $trigger = triggerParam, 2204 $ajaxData = ''; 2205 2206 2207 switch(elementParam){ 2208 case 'portfolio' : 2209 2210 $ajaxData = "action=" + $this.attr("data-action") + 2211 "&oshine_nonce=" + oshineModulesConfig.oshinonce + 2212 "&category=" + $this.attr("data-category") + 2213 "&masonry=" + $this.attr("data-enable-masonry") + 2214 "&showposts=" + $this.attr("data-showposts") + 2215 "&col=" + $this.attr("data-col") + 2216 "&gallery=" + $this.attr("data-gallery") + 2217 "&filter=" + $this.attr("data-filter") + 2218 "&meta_to_show=" + $this.attr("data-meta_to_show") + 2219 "&placeholder_color" + $this.attr("data-placeholder-color") + 2220 "&show_filters=" + $this.attr("data-show_filters") + 2221 "&thumb_overlay_color=" + $this.attr("data-thumbnail-bg-color") + 2222 "&title_style=" + ( $this.attr("data-title-style") || "") + 2223 "&title_color=" + $this.attr("data-title-color") + 2224 "&cat_color=" + $this.attr("data-cat-color") + 2225 "&title_animation_type=" + ( $this.attr("data-title-animation-type") || "" ) + 2226 "&cat_animation_type=" + ( $this.attr("data-cat-animation-type") || "" ) + 2227 "&gutter_width=" + Number( $this.attr("data-gutter-width") ) + 2228 "&hover_style=" + ( $this.attr("data-hover-style") || "" ) + 2229 "&img_grayscale=" + $this.attr("data-img-grayscale") + 2230 "&image_effect=" + ( $this.attr("data-image-effect") || "" ) + 2231 "&gradient_style_color=" + $this.attr("data-gradient-style-color") + 2232 "&cat_hide=" + $this.attr("data-cat-hide") + 2233 "&like_button=" + $this.attr("data-like-indicator") + 2234 "&placeholder_color=" + $this.attr( "data-placeholder-color" ) + 2235 "&prebuilt_hover_style=" + ( $this.attr( "data-prebuilt-hover-style" ) || "" ); 2236 2237 return $ajaxData; 2238 2239 case 'gallery' : 2240 2241 $ajaxData = "action=" + $this.attr("data-action") + 2242 "&oshine_nonce=" + oshineModulesConfig.oshinonce + 2243 "&masonry=" + $this.attr("data-enable-masonry") + 2244 "&source=" + $this.attr("data-source") +
2245 "&gutter_width=" + $this.attr("data-gutter-width") + 2246 "&col=" + $this.attr("data-col") + 2247 "&data_gutter_width=" + Number( $this.attr("data-gutter-width") ) + 2248 "&images_arr=" + $this.attr("data-images-array") + 2249 "&items_per_load=" + $this.attr("data-items-per-load") + 2250 "&hover_style=" + $this.attr("data-hover-style") + 2251 "&img_grayscale=" + $this.attr("data-image-grayscale") + 2252 "&lightbox_type=" + $this.attr("data-lightbox-type") + 2253 "&image_source=" + $this.attr("data-image-source") + 2254 "&image_effect=" + $this.attr("data-image-effect") + 2255 "&thumb_overlay_color=" + $this.attr("data-thumb-overlay-color") + 2256 "&gradient_style_color=" + $this.attr("data-grad-style-color") + 2257 "&like_button=" + $this.attr("data-like-button") + 2258 "&hover_content_option=" + $this.attr("data-hover-content") + 2259 "&hover_content_color=" + $this.attr("data-hover-content-color") + 2260 "&lazy_load=0" + 2261 "&delay_load=" + ( $this.hasClass( 'portfolio-delay-load' ) ? 1 : 0 ) + 2262 "&placeholder_color=" + $this.attr( 'data-placeholder-color' ); 2263 2264 return $ajaxData; 2265 2266 case 'blog' : 2267 2268 $ajaxData = "action=" + $this.attr("data-action") + 2269 "&oshine_nonce=" + oshineModulesConfig.oshinonce + 2270 "&showposts=" + $this.attr("data-showposts") + 2271 "&gutter_width=" + Number( $this.attr("data-gutter-width") ) + 2272 "&blog_style=" + ( portfolioParam.find( '.portfolio-container' ).hasClass( 'style3-blog' ) ? 'style3' : 'style8' ) + 2273 "&total_items=" + $trigger.attr('data-total-items') ; 2274 2275 return $ajaxData; 2276 2277 } 2278 }, 2279 2280 infiniteScroll = function( triggerParam, portfolioParam, pagedParam, elementTypeParam ) { 2281 var $this = triggerParam, 2282 $portfolio = portfolioParam, 2283 $paged = pagedParam; 2284 2285 2286 var be_waypoint = new Waypoint({ 2287 element: $this, 2288 handler: function (direction) { 2289 if (direction === 'down') { 2290 var $this_waypoint = this, 2291 $page_loader = jQuery('.page-loader'); 2292 $this_waypoint.disable(); //Disable Waypoint untill Images are Loaded 2293 $page_loader.fadeIn(); 2294 jQuery.ajax({ 2295 type: "POST", 2296 url: ajax_url, 2297 data: paginationData( $this, $portfolio, elementTypeParam) + "&paged=" + $paged 2298 }).done(function (data) { 2299 if (data !== 0 && data !== '0' && data) { 2300 var $newItems = jQuery(data).filter( function() { 2301 return 1 == this.nodeType; 2302 }), 2303 $portfolioInstance = $portfolio.data( "oshinePortfolio" ); 2304 if( $portfolio.hasClass( 'be-portfolio-prebuilt-hover-style3' ) ) { 2305 tiltHoverEffect( $newItems.find( '.thumb-wrap' ) ); 2306 } 2307 $portfolioInstance.elements = $portfolioInstance.elements.add( $newItems ); 2308 if( $portfolio.hasClass( 'portfolio-delay-load' ) ) { 2309 $newItems.addClass( 'element-animate' ); 2310 $portfolioInstance.portfolioContainer.append( $newItems ); 2311 $portfolioInstance.multiGridSetup( $newItems, false ); 2312 $portfolioInstance.portfolioContainer.isotope( "appended", $newItems ); 2313 portfolioScrollReveal.addElements( $newItems ); 2314 portfolioScrollReveal.delayReveal(); 2315 if(elementTypeParam == 'portfolio' || elementTypeParam == 'gallery' ){ 2316 directionalHover( $portfolio.find('.element') ); 2317 } 2318 if(elementTypeParam == 'blog'){ 2319 portfolioLazyReveal.addElements( $newItems.find( '.thumb
2319-wrap' ).find( 'img' ) ); 2320 setTimeout( portfolioLazyReveal.reveal, 100 ); 2321 $newItems.find('.be_image_slider').each(function () { 2322 var $this = jQuery(this).find('.image_slider_module'); 2323 be_blog_gallery($this); 2324 }); 2325 $newItems.fitVids(); 2326 oshine_scripts.triggerStackShare( $newItems.find( '.be-share-stack-mask' ) ); 2327 } 2328 window.tatsu.lightbox(); 2329 $this_waypoint.enable(); //Enable Waypoint 2330 $paged = Number($paged) + 1; 2331 $page_loader.fadeOut(); 2332 }else{ 2333 $newItems.imagesLoaded(function() { 2334 $portfolioInstance.portfolioContainer.append( $newItems ) 2335 $portfolioInstance.multiGridSetup( $newItems, false ); 2336 $portfolioInstance.portfolioContainer.isotope( "appended", $newItems ); 2337 $portfolioInstance.delayLoad( $newItems ); 2338 if(elementTypeParam == 'portfolio' || elementTypeParam == 'gallery' ){ 2339 directionalHover( $portfolio.find('.element') ); 2340 } 2341 if(elementTypeParam == 'blog'){ 2342 $newItems.find('.be_image_slider').each(function () { 2343 var $this = jQuery(this).find('.image_slider_module'); 2344 be_blog_gallery($this); 2345 }); 2346 $newItems.fitVids(); 2347 } 2348 window.tatsu.lightbox(); 2349 2350 if( window.be_gdpr_magnific_popup_retrigger ){ 2351 window.be_gdpr_magnific_popup_retrigger(); 2352 } 2353 2354 $this_waypoint.enable(); //Enable Waypoint 2355 $paged = Number($paged) + 1; 2356 $page_loader.fadeOut(); 2357 2358 }); 2359 } 2360 } else { 2361 $this_waypoint.destroy(); 2362 $page_loader.fadeOut(); 2363 } 2364 }); 2365 } 2366 }, 2367 offset: 'bottom-in-view' 2368 }); 2369 }, 2370 2371 loadmore = function( triggerParam, portfolioParam, pagedParam, elementTypeParam ){ 2372 var $this = triggerParam, 2373 $portfolio = portfolioParam, 2374 $paged = pagedParam, 2375 $page_loader = jQuery('.page-loader'); 2376 $page_loader.fadeIn(); 2377 $this.addClass('disabled'); 2378 jQuery.ajax({ 2379 type: "POST", 2380 url: ajax_url, 2381 data: paginationData( $this, $portfolio , elementTypeParam) + "&paged=" + $paged , 2382 success: function (data) { 2383 2384 if (data!== 0 && data !== '0' && data) { 2385 var $newItems = jQuery(data).filter( function() { 2386 return 1 == this.nodeType; 2387 }), 2388 $portfolioInstance = $portfolio.data( "oshinePortfolio" ); 2389 if( $portfolio.hasClass( 'be-portfolio-prebuilt-hover-style3' ) ) { 2390 tiltHoverEffect( $newItems.find( '.thumb
2390-wrap' ) ); 2391 } 2392 $portfolioInstance.elements = $portfolioInstance.elements.add( $newItems ); 2393 if( $portfolio.hasClass( 'portfolio-delay-load' ) ) { 2394 $newItems.addClass( 'element-animate' ); 2395 $portfolioInstance.portfolioContainer.append( $newItems ) 2396 $portfolioInstance.multiGridSetup( $newItems, false ); 2397 2398 $portfolioInstance.portfolioContainer.isotope( "appended", $newItems ); 2399 portfolioScrollReveal.addElements( $newItems ); 2400 portfolioScrollReveal.delayReveal(); 2401 if(elementTypeParam == 'portfolio' || elementTypeParam == 'gallery' ){ 2402 directionalHover( $portfolio.find('.element') ); 2403 } 2404 if(elementTypeParam == 'blog'){ 2405 portfolioLazyReveal.addElements( $newItems.find( '.thumb-wrap' ).find( 'img' ) ); 2406 setTimeout( portfolioLazyReveal.reveal, 100 ); 2407 $newItems.find('.be_image_slider').each(function () { 2408 var $this = jQuery(this).find('.image_slider_module'); 2409 be_blog_gallery($this); 2410 }); 2411 $newItems.fitVids(); 2412 oshine_scripts.triggerStackShare( $newItems.find( '.be-share-stack-mask' ) ); 2413 } 2414 2415 window.tatsu.lightbox(); 2416 2417 $portfolio.attr("data-paged", Number($paged) + 1); 2418 2419 $this.attr("data-total-items", function () { 2420 return (Number(jQuery(this).attr('data-total-items')) - $newItems.find('.element-inner').length); 2421 }); 2422 2423 if ($this.attr("data-total-items") <= 0) { 2424 $this.fadeOut(500, function () { 2425 $this.remove(); 2426 }); 2427 } 2428 $this.removeClass('disabled'); 2429 $page_loader.fadeOut(); 2430 2431 }else{ 2432 $newItems.imagesLoaded(function () { 2433 2434 $portfolioInstance.portfolioContainer.append( $newItems ) 2435 $portfolioInstance.multiGridSetup( $newItems, false ); 2436 $portfolioInstance.portfolioContainer.isotope( "appended", $newItems ); 2437 $portfolioInstance.delayLoad( $newItems ); 2438 if(elementTypeParam == 'portfolio' || elementTypeParam == 'gallery' ){ 2439 directionalHover( $portfolio.find('.element') ); 2440 } 2441 if(elementTypeParam == 'blog'){ 2442 $newItems.find('.be_image_slider').each(function () { 2443 var $this = jQuery(this).find('.image_slider_module'); 2444 be_blog_gallery($this); 2445 }); 2446 $newItems.fitVids(); 2447 } 2448 2449 window.tatsu.lightbox(); 2450 if( window.be_gdpr_magnific_popup_retrigger ){ 2451 window.be_gdpr_magnific_popup_retrigger(); 2452 } 2453 $portfolio.attr("data-paged", Number($paged) + 1); 2454 2455 $this.attr("data-total-items", function () { 2456 return (Number(jQuery(this).attr('data-total-items')) - $newItems.find('.element-inner').length); 2457 }); 2458 2459 if ($this.attr("data-total-items") <= 0) { 2460 $this.fadeOut(500, function () { 2461 $this.remove(); 2462 }); 2463 } 2464 $this.removeClass('disabled'); 2465 $page_loader.fadeOut(); 2466 2467 if( typeof window.triggerBeGdpr === 'function' ){ 2468 window.triggerBeGdpr(); 2469 } 2470 }); 2471 } 2472 } else { 2473 $this.addClass('disabled'); 2474 $page_loader.fadeOut(); 2475 } 2476 } 2477 }); 2478 }, 2479 2480 //code to detect browser type. 2481 //Source code : https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser 2482 detectBrowser = function() { 2483 2484 // Opera 8.0+ 2485 var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0, 2486 isFirefox = typeof InstallTrigger !== 'undefined', 2487 isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification)), 2488 isIE = !!document.documentMode, 2489 isEdge = !!window.StyleMedia, 2490 isChrome = !!window.chrome && !!window.chrome.webstore; 2491 return isOpera ? 'Opera' : isFirefox ? 'Firefox' : isSafari ? 'Safari' : isIE ? 'IE' : isEdge ? 'Edge' : isChrome ? 'Chrome' : false; 2492 2493 }, 2494 2495 tiltHoverEffect = function( elements ) { 2496 2497 if( 0 < jQuery( '.be-portfolio-prebuilt-hover-style3' ).length ) { 2498 asyncloader.require( 'tilt', function() { 2499 var targetElements = elements || jQuery( '.be-portfolio-prebuilt-hover-style3' ).closest( '.portfolio-all-wrap' ).css( 'overflow', 'visible' ).find( '.thumb
2499-wrap' ), 2500 targetBrowser = detectBrowser(); 2501 if( 'string' == typeof targetBrowser && ( 'Edge' == targetBrowser || 'IE' == targetBrowser ) ) { 2502 return; 2503 }else if( 'string' == typeof targetBrowser && 'Safari' == targetBrowser ) { 2504 targetElements.find( '.thumb-shadow-wrapper' ).css( 'display', 'none' ); 2505 if( jQuery( 'body' ).hasClass( 'be-fixed-footer' ) ) { 2506 jQuery( '#be-fixed-footer-wrap' ).css( 'position', 'relative' ); 2507 jQuery( '#be-fixed-footer-placeholder' ).css( 'display', 'none' ); 2508 jQuery( 'body' ).removeClass( 'be-fixed-footer' ); 2509 jQuery( 'body' ).addClass( 'be-fixed-footer-disable' ); 2510 } 2511 } 2512 targetElements.tilt({ 2513 glare : true, 2514 maxGlare : 0.3, 2515 perspective : 1000, 2516 speed : 4000, 2517 maxTilt : 10, 2518 scale : 1.05 2519 }); 2520 2521 } ); 2522 } 2523 2524 }, 2525 2526 be_blog_gallery = function(blog_gallery_post){ 2527 var $this = blog_gallery_post, 2528 $slideshow = $this.attr('data-auto-slide'), 2529 $slideshowspeed = 1000; 2530 if( 'no' == $slideshow ){ 2531 $slideshow = false; 2532 } else { 2533 $slideshow = true; 2534 $slideshowspeed = $this.attr('data-slide-interval'); 2535 } 2536 asyncloader.require( [ 'owlcarousel', 'imagesloaded' ], function(){ 2537 2538 $this.imagesLoaded( function() { 2539 2540 $this.owlCarousel({ 2541 items:1, 2542 autoHeight: true, 2543 autoplay: $slideshow, 2544 autoplayTimeout: $slideshowspeed, 2545 autoplaySpeed: 1000, 2546 autoplayHoverPause: true, 2547 navRewind: false, 2548 nav: true, 2549 loop: true, 2550 navText: ['<i class="font-icon icon-arrow_carrot-left"></i>','<i class="font-icon icon-arrow_carrot-right"></i>'], 2551 dots:false, 2552 onInitialize: function() { 2553 $this.fadeIn(500); 2554 $this.trigger('refresh.owl.carousel'); 2555 } 2556 }); 2557 $this.closest( '.portfolio-container' ).isotope( 'layout' ); 2558 2559 } ); 2560 2561 }); 2562 2563 }, 2564 2565 forcePortfolioTitles = function() { 2566 2567 var portfolioContainer = jQuery('.portfolio-container'); 2568 portfolioContainer.imagesLoaded(function () { 2569 if( portfolioContainer.hasClass( 'force-show-thumb-overlay' ) ) { 2570 portfolioContainer.css('opacity','1'); 2571 } 2572 }); 2573 2574 }, 2575 2576 2577 triggerInfiniteScroll = function(){ 2578 if( trigger.length > 0 ) { 2579 trigger.each( function() { 2580 var $portfolio = jQuery(this).closest('.portfolio'); 2581 infiniteScroll( jQuery(this), $portfolio , $portfolio.attr( 'data-paged' ), jQuery(this).attr( 'data-type' ) ) 2582 }); 2583 } 2584 }, 2585 2586 2587 animationTrigger = function() { 2588 jQuery(document).on( 'mouseenter.oshine mouseleave.oshine', '.element-inner', function(e) { 2589 var $animationTrigger = jQuery(this).find( '.animation-trigger' ); 2590 if( $animationTrigger.length > 0 ) { 2591 if( 'mouseenter' == e.type ){ 2592 $animationTrigger.addClass( $animationTrigger.attr( 'data-animation-type' ) ); 2593 } else { 2594 $animationTrigger.removeClass( $animationTrigger.attr( 'data-animation-type' ) ); 2595 } 2596 } 2597 }); 2598 }, 2599 2600 parallaxPortfolioClasses = function() { 2601 jQuery('.portfolio-container').each(function () { 2602 var $this = jQuery(this), 2603 $i = 0; 2604 if($this.closest('.portfolio').hasClass('two-col')) { 2605 $this.find('.element').each(function() { 2606 if($i == 1 || $i == 2) { 2607 jQuery(this).addClass('parallax-effect'); 2608 $i = $i+1; 2609 } else if($i == 3) { 2610 jQuery(this).addClass('no-parallax-effect'); 2611 $i = 0; 2612 } else { 2613 jQuery(this).addClass('no-parallax-effect'); 2614 $i = $i+1; 2615 } 2616 }); 2617 } else { 2618 $this.find('.element:odd').addClass('parallax-effect'); 2619 $this.find('.element:even').addClass('no-parallax-effect'); 2620 } 2621 }); 2622 }, 2623 2624 parallaxPortfolio = function() { 2625 var portfolioContainer = jQuery('.portfolio-container'); 2626 if( portfolioContainer.length > 0 && portfolioContainer.hasClass('portfolio-item-parallax') ) { 2627 if(jQuery('html').hasClass('no-touch') && (jQuery(window).width() >= 768)) { 2628 portfolioContainer.each(function() { 2629 var $window_height = jQuery(window).height(), $window_scroll_top = jQuery(window).scrollTop(); 2630 jQuery(this).find('.element.parallax-effect').each(function() { 2631 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; 2632 $this.find('.element-inner').css({
2633 '-webkit-transform' : 'translatey('+opacity_2+'px) scale(0.7) translatez(0px)', 2634 '-moz-transform' : 'translatey('+opacity_2+'px) scale(0.7) translatez(0px)', 2635 '-o-transform' : 'translatey('+opacity_2+'px) scale(0.7) translatez(0px)', 2636 '-ms-transform' : 'translatey('+opacity_2+'px) scale(0.7) translatez(0px)', 2637 'transform' : 'translatey('+opacity_2+'px) scale(0.7) translatez(0px)' 2638 }); 2639 $this.find('.thumb-title-wrap, .custom-like-button').css({ 2640 '-webkit-transform' : 'scale(1.4) translatez(0px)', 2641 '-moz-transform' : 'scale(1.4) translatez(0px)', 2642 '-o-transform' : 'scale(1.4) translatez(0px)', 2643 '-ms-transform' : 'scale(1.4) translatez(0px)', 2644 'transform' : 'scale(1.4) translatez(0px)' 2645 }); 2646 }); 2647 jQuery(this).find('.element.no-parallax-effect').each(function() { 2648 var $this = jQuery(this), offset = $this.offset().top, animate_pos = offset-($window_height/2), opacity = ((animate_pos) - $window_scroll_top)/2; 2649 $this.find('.element-inner').css({ 2650 '-webkit-transform' : 'translatey('+opacity+'px) translatez(0px)', 2651 '-moz-transform' : 'translatey('+opacity+'px) translatez(0px)', 2652 '-o-transform' : 'translatey('+opacity+'px) translatez(0px)', 2653 '-ms-transform' : 'translatey('+opacity+'px) translatez(0px)', 2654 'transform' : 'translatey('+opacity+'px) translatez(0px)', 2655 }); 2656 }); 2657 }); 2658 } 2659 } 2660 }, 2661 2662 filter = function() { 2663 var delayCall = ''; 2664 jQuery(document).on('click', '.sort', function () { 2665 var currentTrigger = jQuery( this ), 2666 filterClass = currentTrigger.data().id.toString(), 2667 closestPortfolio = currentTrigger.closest( '.portfolio' ), 2668 filterElements; 2669 if( filterClass && filterClass.toString ) { 2670 filterClass = filterClass.toString(); 2671 } 2672 currentTrigger.closest( '.filters' ).find( '.sort' ).removeClass( 'current_choice' ); 2673 2674 currentTrigger.addClass( 'current_choice' ); 2675 if( closestPortfolio.hasClass( 'portfolio-delay-load' ) ) { 2676 var classQuotient = 'delay-loaded already-visible end-animation animation-complete ' + closestPortfolio.attr( 'data-animation' ), 2677 currentVisibleElements = closestPortfolio.find( '.element.delay-loaded' ); 2678 filterElements = ( 'element' != filterClass ) ? ( closestPortfolio.find( '.element' ).filter( function() { 2679 2680 return ( 'string' == typeof jQuery( this ).attr( 'data-category-names' ) && ( 0 <= jQuery( this ).attr( 'data-category-names' ).indexOf( filterClass ) ) ); 2681 2682 }) ) : closestPortfolio.find( '.element' ); 2683 currentVisibleElements.css( 'animation-delay', 'initial' ); 2684 currentVisibleElements.removeClass( classQuotient ); 2685 currentVisibleElements.addClass( 'end-animation' ); 2686 closestPortfolio.addClass( 'filter-scale-back-animation' ); 2687 if( '' != delayCall ) { 2688 clearTimeout( delayCall ); 2689 } 2690 delayCall = setTimeout( function() { 2691 if( '' != delayCall ) { 2692 delayCall = ''; 2693 } 2694 closestPortfolio.removeClass( 'filter-scale-back-animation' ); 2695 filterElements.removeClass( classQuotient ); 2696 closestPortfolio.data( 'oshinePortfolio' ).portfolioContainer.isotope({ 2697 filter : function() { 2698 var curCategories = jQuery( this ).attr( 'data-category-names' ), 2699 curCategoriesArray, 2700 result = false; 2701 if( 'element' == filterClass ) { 2702 result = true; 2703 }else if( 'string' == typeof curCategories && '' != curCategories ) { 2704 curCategoriesArray = curCategories.split( " " ); 2705 if( '' == curCategoriesArray[ curCategoriesArray.length - 1 ] ) { 2706 curCategoriesArray.pop(); 2707 } 2708 if( 0 <= curCategoriesArray.indexOf( filterClass ) ) { 2709 result = true; 2710 }else{ 2711 result = false; 2712 } 2713 }else{ 2714 result = false; 2715 } 2716 2717 return result; 2718 2719 } 2720 });
2721 portfolioScrollReveal.addElements( filterElements, true ); 2722 portfolioScrollReveal.delayReveal(); 2723 if( closestPortfolio.hasClass( 'portfolio-lazy-load' ) ) { 2724 portfolioLazyReveal.reveal(); 2725 } 2726 jQuery( window ).trigger( 'resize' ); 2727 }, 300 ); 2728 }else{ 2729 closestPortfolio.data( 'oshinePortfolio' ).portfolioContainer.isotope({ 2730 filter : function() { 2731 var curCategories = jQuery( this ).attr( 'data-category-names' ), 2732 curCategoriesArray, 2733 result = false; 2734 if( 'element' == filterClass ) { 2735 result = true; 2736 }else if( 'string' == typeof curCategories && '' != curCategories ) { 2737 curCategoriesArray = curCategories.split( " " ); 2738 if( '' == curCategoriesArray[ curCategoriesArray.length - 1 ] ) { 2739 curCategoriesArray.pop(); 2740 } 2741 if( 0 <= curCategoriesArray.indexOf( filterClass ) ) { 2742 result = true; 2743 }else{ 2744 result = false; 2745 } 2746 }else{ 2747 result = false; 2748 } 2749 2750 return result; 2751 2752 } 2753 }); 2754 if( closestPortfolio.hasClass( 'portfolio-lazy-load' ) ) { 2755 setTimeout( portfolioLazyReveal.reveal, 450 ); 2756 } 2757 jQuery( window ).trigger( 'resize' ); 2758 } 2759 }); 2760 }, 2761 2762 triggerLoadMore = function() { 2763 jQuery(document).on('click', '.trigger_load_more:not(.disabled)', function () { 2764 var $portfolio = jQuery(this).closest('.portfolio'), 2765 $paged = Number( $portfolio.attr('data-paged') ); 2766 loadmore( jQuery(this), $portfolio, $paged, jQuery(this).attr('data-type') ); 2767 }); 2768 }, 2769 2770 portfolioLike = function() { 2771 jQuery(document).on('click', '.portfolio-like .custom-like-button', function (e) { 2772 var $this = jQuery(this), $post_id = $this.attr('data-post-id'); 2773 // $this.addClass('disable'); 2774 jQuery.ajax({ 2775 type: "POST", 2776 url: ajax_url, 2777 dataType: 'json', 2778 data: "action=post_like&post_id=" + $post_id + "&oshine_nonce=" + oshineModulesConfig.oshinonce, 2779 success : function (msg) { 2780 if (msg.status === "success") { 2781 if( msg.type === "like" ){ 2782 $this.addClass('liked'); 2783 $this.removeClass('no-liked'); 2784 $this.find('span').text(msg.count); 2785 }else{ 2786 $this.removeClass('liked'); 2787 $this.addClass('no-liked'); 2788 $this.find('span').text(msg.count); 2789 } 2790 } 2791 }, 2792 error: function (msg) { 2793 console.log( "error", msg ); 2794 } 2795 }); 2796 return false; 2797 }); 2798 }, 2799 2800 2801 lightboxGallery = function() { 2802 asyncloader.require( 'magnificpopup', function() { 2803 if (jQuery('.popup-gallery').length > 0) { 2804 jQuery('.popup-gallery').magnificPopup({ 2805 delegate: 'a', 2806 type: 'image', 2807 tLoading: 'Loading image #%curr%...', 2808 mainClass: 'mfp-img-mobile', 2809 gallery: { 2810 enabled: true, 2811 navigateByImgClick: true, 2812 preload: [0, 1] 2813 }, 2814 image: { 2815 tError: '<a href="%url%">The image #%curr%</a> could not be loaded.' 2816 }, 2817 preloader: true, 2818 callbacks: { 2819 afterClose: function () { 2820 if (jQuery('body').hasClass('smooth-scroll')) { 2821 jQuery('html').css('overflow-y', 'scroll'); 2822 } 2823 }, 2824 open: function () { 2825 jQuery('body').addClass('mfp-active-state'); 2826 if (jQuery('#main').hasClass('layout-border')) { 2827 jQuery('.mfp-content').addClass('layout-border'); 2828 } 2829 }, 2830 close: function () { 2831 jQuery('body').removeClass('mfp-active-state'); 2832 } 2833 } 2834 }); 2835 } 2836 2837 jQuery(document).on('click.oshine', '.be-lightbox-gallery.mfp-image', function (e) { 2838 e.preventDefault(); 2839 jQuery(this).next('.popup-gallery').magnificPopup('open'); 2840 }); 2841 }); 2842 }, 2843 checkIsEmpty = function ( data ) { 2844 //check if data is empty 2845 return ( 'undefined' === typeof data || null === data || '' === data ); 2846 }, 2847 getMediaNameOrSize = function ( device_cat ) { 2848 //Get media name or size 2849 var device_width = (window.innerWidth > 0) ? window.innerWidth : screen.width; 2850 if ( checkIsEmpty( device_width ) ) { 2851 return false; 2852 } 2853 2854 if ( ! device_cat ) { 2855 return device_width; 2856 } 2857 2858 if ( 767 >= device_width ) { 2859 device_cat = 'm'; 2860 } else if ( 1024 >= device_width ) { 2861 device_cat = 't'; 2862 } else if ( 1377 >= device_width ) { 2863 device_cat = 'l'; 2864 } else { 2865 device_cat = 'd'; 2866 } 2867 2868 return device_cat; 2869 }, 2870 responsiveGutterWidth = function() { 2871 //Apply responsive gutter width in oshine gallery|portfolio module 2872 var portfolio = jQuery('.portfolio'); 2873 if( portfolio.length > 0 ) { 2874 var device_cat = getMediaNameOrSize( true ); 2875 if ( false === device_cat ) { 2876 return false; 2877 } 2878 portfolio.each( function() { 2879 var data_gutter_width = jQuery( this ).attr( "data-gutter-width-"+device_cat ); 2880 if ( ! checkIsEmpty( data_gutter_width ) ) { 2881 jQuery( this ).attr( "data-gutter-width", data_gutter_width ); 2882 data_gutter_width = data_gutter_width+'px'; 2883 2884 //refrence gallery module 2885 if ( jQuery( this).hasClass( 'style2-gutter' ) ) { 2886 jQuery( this ).css('margin-left', '-'+data_gutter_width ); 2887 } else { 2888 jQuery( this ).css('margin-right', data_gutter_width ); 2889 } 2890 2891 //refrence: get_be_gallery_shortcode() 2892 jQuery( this ).find( '.element' ).css('margin-bottom', data_gutter_width ); 2893 jQuery( this ).find( '.element .element-inner' ).css('margin-left', data_gutter_width ); 2894 } 2895 });
2896 } 2897 2898 }, 2899 2900 ready = function( portfolio ) { 2901 2902 asyncloader.require( ['isotope', 'imagesloaded', 'resizetoparent', 'waypoints' ], function() { 2903 2904 jQuery('html').addClass('show-overflow'); 2905 portfolioMainModule( portfolio ); 2906 triggerInfiniteScroll(); 2907 triggerLoadMore(); 2908 lightboxGallery(); 2909 portfolioLike(); 2910 filter(); 2911 forcePortfolioTitles(); 2912 tiltHoverEffect(); 2913 directionalHover( portfolio.find( '.element' ) ); 2914 parallaxPortfolioClasses(); 2915 parallaxPortfolio(); 2916 animationTrigger(); 2917 if( jQuery('.be-photoswipe-gallery').length > 0 ) { 2918 photoswipe( '.be-photoswipe-gallery' ); 2919 } 2920 tatsu.lightbox(); 2921 }); 2922 2923 }, 2924 2925 run = function() { 2926 responsiveGutterWidth(); 2927 portfolio = jQuery('.portfolio'); 2928 if( portfolio.length > 0 ) { 2929 ready( portfolio ); 2930 } 2931 2932 jQuery(window).on( 'tatsu_update.oshine', function( e, data ) { 2933 2934 if( 'oshine_gallery' === data.moduleName || 'gallery' === data.moduleName || 'portfolio' === data.moduleName || 'trigger_ready' === data.moduleName || 'blog' == data.moduleName ) { 2935 2936 portfolio = jQuery('.portfolio'); 2937 ready( portfolio ); 2938 2939 } 2940 }); 2941 2942 jQuery(window).resize( function() { 2943 2944 if( portfolio.length > 0 ) { 2945 asyncloader.require( ['isotope', 'imagesloaded', 'resizetoparent', 'waypoints' ], function() { 2946 portfolio.each( function() { 2947 2948 var currentPortfolioInstance = jQuery( this ).data( 'oshinePortfolio' ); 2949 currentPortfolioInstance.triggerResize(); 2950 2951 } ) 2952 }); 2953 2954 } 2955 }); 2956 2957 if( portfolioWithLazyLoadCount > 0 ) { 2958 jQuery( window ).one( 'beLazyLoad', function( event ) { 2959 2960 jQuery( window ).on( "scroll", function( event ) { 2961 2962 portfolioLazyReveal.reveal(); 2963 2964 } ); 2965 2966 } ); 2967 } 2968 if( portfolioWithDelayLoadCount > 0 ) { 2969 jQuery( window ).one( 'beDelayLoad', function( event ) { 2970 2971 jQuery( window ).on( "scroll", function( event ) { 2972 2973 portfolioScrollReveal.delayReveal(); 2974 2975 } ); 2976 2977 } ); 2978 } 2979 if( portfolioContainer.length > 0 && portfolioContainer.hasClass('portfolio-item-parallax') ) { 2980 jQuery(window).on( 'scroll', function(){ 2981 parallaxPortfolio(); 2982 }); 2983 } 2984 2985 }; 2986 2987 return { 2988 run: run, 2989 portfolioLazyReveal : portfolioLazyReveal.reveal, 2990 portfolioScrollReveal : portfolioScrollReveal.delayReveal 2991 } 2992 2993 })(); 2994 2995 2996 oshine_modules.run(); 2997 oshine_portfolio.run(); 2998 window.oshinePortfolio = { 2999 portfolioLazyReveal : oshine_portfolio.portfolioLazyReveal, 3000 portfolioScrollReveal : oshine_portfolio.portfolioScrollReveal 3001 }; 3002 }); 3003 3004})( 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.