1/* Themify Theme Scripts - http://themify.me/ */ 2 3// Declar object literals and variables 4var FixedHeader = {}, LayoutAndFilter = {}, themifyScript, ThemifySlider, ThemifyMediaElement, qp_max_pages; 5 6// throttledresize 7!function($){var e=$.event,t,n={_:0},r=0,s,i;t=e.special.throttledresize={setup:function(){$(this).on("resize",t.handler)},teardown:function(){$(this).off("resize",t.handler)},handler:function(h,o){var a=this,l=arguments;s=!0,i||(setInterval(function(){r++,(r>t.threshold&&s||o)&&(h.type="throttledresize",e.dispatch.apply(a,l),s=!1,r=0),r>9&&($(n).stop(),i=!1,r=0)},30),i=!0)},threshold:0}}(jQuery); 8 9// debouncedresize event 10(function($){var $event=$.event,$special,resizeTimeout;$special=$event.special.debouncedresize={setup:function(){$(this).on("resize",$special.handler);},teardown:function(){$(this).off("resize",$special.handler);},handler:function(event,execAsap){var context=this,args=arguments,dispatch=function(){event.type="debouncedresize";$event.dispatch.apply(context,args);};if(resizeTimeout){clearTimeout(resizeTimeout);}execAsap?dispatch():resizeTimeout=setTimeout(dispatch,$special.threshold);},threshold:150};})(jQuery); 11 12(function($){ 13 14 var $sections = $('.type-section'), 15 isFullPageScroll = ('undefined' !== typeof $.fn.fullpage) && (themifyScript.fullPageScroll ? true : false) && ($sections.length > 0), 16 usesRows = $sections.length === 0, 17 sectionClass = '.section-post', 18 sectionsWrapper = 'div:not(.module-layout-part) > #loops-wrapper', 19 fixedHeader = $('body').hasClass('fixed-header'), 20 wowInit2; 21 22// Setup variables if it uses Builder rows instead of section post type 23 if (usesRows) { 24 isFullPageScroll = ('undefined' !== typeof $.fn.fullpage) && (themifyScript.fullPageScroll ? true : false) && ($('.themify_builder').length > 0) && $('body').hasClass('full-section-scrolling'); 25 sectionClass = '.module_row'; 26 sectionsWrapper = 'div:not(.module-layout-part) > .themify_builder_content'; 27 } 28 29 $( sectionClass + ':hidden' ).remove(); 30 sectionClass += ':visible'; 31 32 function loadIsotop(condition,callback){ 33 if(condition){ 34 if( typeof $.fn.isotope !== 'function' ) { 35 Themify.LoadAsync(themifyScript.themeURI + '/js/jquery.isotope.min.js', function() { 36 callback(); 37 }, 38 null, 39 null, 40 function () { 41 return ('undefined' !== typeof $.fn.isotope); 42 } ); 43 } else { 44 callback(); 45 } 46 } 47 } 48 49// Fixed Header ///////////////////////// 50FixedHeader = { 51 headerHeight: 0, 52 hasHeaderSlider: false, 53 headerSlider: false, 54 $pageWrap: $( '#pagewrap' ), 55 $headerWrap: $( '#headerwrap' ), 56 stickyHeader: themifyScript.sticky_header, 57 init: function() { 58 var _this = this; 59 60 _this.calculateHeaderHeight(); 61 62 if( fixedHeader ) { 63 if( isFullPageScroll ) { 64 $( 'body' ).on( 'themify_onepage_afterload', function( event, $section, section_id ) { 65 var $is_scroll = $( sectionClass + '.active', $( sectionsWrapper ) ).index() > 0; 66 67 _this.activate( $is_scroll ); 68 69 if( $is_scroll ) { 70 var $height = _this.headerHeight; 71 72 _this.calculateHeaderHeight(); 73 $height != _this.headerHeight && _this.updatePageOffset() 74 } 75 }.bind( _this ) ); 76 } else { 77 _this.activate( false ); 78 $( window ).on( 'scroll touchstart.touchScroll touchmove.touchScroll', function( e ) { 79 _this.activate(false); 80 }.bind( _this ) ); 81 } 82 83 $( window ).load( _this.updatePageOffset.bind( _this ) ) 84 .on( 'debouncedresize', function(e) { 85 if( ! e.isTrigger ) { 86 setTimeout( function() { 87 _this.calculateHeaderHeight(); 88 _this.updatePageOffset(); 89 }.bind( _this ), 400 ) 90 } 91 }); 92 93 if( $( '#gallery-controller' ).length > 0 ) _this.hasHeaderSlider = true; 94 95 if ( _this.stickyHeader ) { 96 var img = '<img id="sticky_header_logo" src="' + _this.stickyHeader.src + '"'; 97 98 if( _this.stickyHeader.imgwidth ) img += ' width="' + _this.stickyHeader.imgwidth + '"'; 99 if( _this.stickyHeader.imgheight ) img += ' height="' + _this.stickyHeader.imgheight + '"'; 100 img += '/>'; 101 $( '#site-logo a' ).prepend( img ); 102 } 103 104 $( 'body' ).on( 'announcement_bar_position announcement_bar_scroll_on_after announcementBarUpdate', _this.calculateHeaderHeight.bind( _this ) ); 105 } 106 }, 107 activate: function( $hard ) { 108 var scrollTop = $( window ).scrollTop(); 109 110 if( $hard || scrollTop >= this.headerHeight ) { 111 ! this.$headerWrap.hasClass( 'fixed-header' ) && this.scrollEnabled(); 112 } else if ( this.$headerWrap.hasClass( 'fixed-header' ) ) { 113 this.scrollDisabled(); 114 } 115 }, 116 scrollDisabled: function() { 117 this.$headerWrap.removeClass( 'fixed-header' ); 118 $( '#header' ).removeClass('header-on-scroll'); 119 $( 'body' ).removeClass( 'fixed-header-on' ); 120 121 /** 122 * force redraw the header 123 * required in order to calculate header height properly after remov
123ing fixed-header classes 124 */ 125 this.$headerWrap.hide(); 126 this.$headerWrap.get(0).offsetHeight; 127 this.$headerWrap.show(); 128 this.calculateHeaderHeight(); 129 this.updatePageOffset(); 130 this.triggerHeaderSlider(); 131 132 }, 133 scrollEnabled: function() { 134 this.updatePageOffset(); 135 this.$headerWrap.addClass( 'fixed-header' ); 136 $( '#header' ).addClass( 'header-on-scroll' ); 137 $( 'body' ).addClass( 'fixed-header-on' ); 138 this.triggerHeaderSlider(); 139 $( window ).trigger( 'resize' ); 140 }, 141 triggerHeaderSlider: function() { 142 if ( this.hasHeaderSlider && 'object' === typeof this.$headerWrap.data( 'backstretch' ) ) { 143 this.$headerWrap.data( 'backstretch' ).resize(); 144 $( '#gallery-controller .slides' ).trigger( 'next' ); 145 } 146 }, 147 calculateHeaderHeight : function() { 148 this.headerHeight = this.$headerWrap.outerHeight( true ); 149 this.updateHeaderOffset(); 150 }, 151 updateHeaderOffset: function() { 152 var offset = this.$headerWrap.css( 'position' ) === 'fixed' ? this.$pageWrap.offset().top + 'px' : ''; 153 this.$headerWrap.css( 'margin-top', offset ); 154 }, 155 updatePageOffset: function() { 156 this.$pageWrap.css( 'paddingTop', Math.floor( this.headerHeight ) ); 157 } 158}; 159FixedHeader.init(); 160 161// Initialize carousels ////////////////////////////// 162ThemifySlider = { 163 recalcHeight: function(items, $obj) { 164 var heights = [], height; 165 $.each( items, function() { 166 heights.push( $(this).outerHeight(true) ); 167 }); 168 height = Math.max.apply( Math, heights ); 169 $obj.closest('.carousel-wrap').find( '.caroufredsel_wrapper, .slideshow' ).each(function(){ 170 $(this).outerHeight( height ); 171 }); 172 }, 173 didResize: false, 174 175 createCarousel: function(obj) { 176 var self = this; 177 obj.each(function() { 178 var $this = $(this); 179 $this.carouFredSel({ 180 responsive: true, 181 prev: '#' + $this.data('id') + ' .carousel-prev', 182 next: '#' + $this.data('id') + ' .carousel-next', 183 pagination: { 184 container: '#' + $this.data('id') + ' .carousel-pager' 185 }, 186 circular: true, 187 infinite: true, 188 swipe: true, 189 scroll: { 190 items: $this.data('scroll'), 191 fx: 'scroll', 192 duration: parseInt($this.data('speed')) 193 }, 194 auto: { 195 play: ('off' !== $this.data('autoplay')), 196 timeoutDuration: 'off' !== $this.data('autoplay') ? parseInt($this.data('autoplay')) : 0 197 }, 198 items: { 199 visible: { 200 min: 1, 201 max: $this.data('visible') ? parseInt($this.data('visible')) : 1 202 }, 203 width: 222 204 }, 205 onCreate: function( items ) { 206 var $slideWrap = $this.closest( '.slideshow-wrap' ); 207 $slideWrap.css({ 208 'visibility': 'visible', 209 'height': 'auto' 210 }); 211 212 213 $(window).on( 'throttledresize', function() { 214 self.recalcHeight(items.items, $this); 215 }); 216 $(window).resize(); 217 218 setTimeout( function(){ 219 $slideWrap.find( '.carousel-nav-wrap' ).css( 'width', ( parseInt( $slideWrap.find( '.carousel-pager' ).find( 'a' ).length ) * 18 ) + 'px' ); 220 }, 200 ); 221 } 222 }); 223 }); 224 } 225}; 226 227// Test if this is a touch device ///////// 228function is_touch_device() { 229 return $('body').hasClass('touch'); 230} 231 232// Scroll to Element ////////////////////////////// 233function themeScrollTo(offset) { 234 $('body,html').animate({ scrollTop: offset }, 800); 235} 236// Get builder rows anchor class to ID ////////////////////////////// 237function getClassToId($section) { 238 var classes = $section.prop('class').split(' '), 239 expr = new RegExp('^tb_section-', 'i'), 240 spanClass = null; 241 for (var i = 0; i < classes.length; i++) { 242 if (expr.test(classes[i])) { 243 spanClass = classes[i]; 244 } 245 } 246 247 if (spanClass == null) 248 return ''; 249 250 return spanClass.replace('tb_section-', ''); 251} 252// Create fullpage scrolling ////////////////////////////// 253function createFullScrolling() { 254 var $body = $('body'), 255 initFullPage = false, 256 currentHash = themifyScript.hash.replace( '#', '' ), 257 sectionSelector = usesRows ? sectionsWrapper + ' > ' + sectionClass : sectionClass, 258 autoScrolling = !usesRows && '' != themifyScript.hash.replace('#', '') ? false : true, 259 anchors = $( sectionSelector ).map( function() { 260 var $this = $( this ), 261 anchorName = usesRows && $this.is('[class*="tb_section-"]') ? getClassToId( $this ) : $this.attr('id'); 262 return anchorName ? anchorName : ''; 263 } ); 264
265 $(sectionsWrapper).fullpage({ 266 resize: false, 267 sectionSelector: sectionSelector, 268 paddingBottom: '78px', 269 scrollOverflow: true, 270 navigation: true, 271 lockAnchors: true, 272 autoScrolling: autoScrolling, 273 anchors: anchors, 274 afterRender: function () { 275 if (!autoScrolling) { // hack deep linking not working when use section row 276 $.fn.fullpage.setAutoScrolling(true); 277 } 278 279 var $section = $(sectionClass + '.active', $(sectionsWrapper)), 280 section_id = usesRows && $section.is('[class*="tb_section-"]') ? getClassToId($section) : $section.prop('id'), 281 $aSectionHref = $('#main-nav').find('a[href$="#' + section_id + '"]'); 282 283 setTimeout(function () { 284 $('.section_loader').hide(); 285 286 if ('undefined' !== typeof ThemifyBuilderModuleJs && 'undefined' !== typeof wowInit2) { 287 wowInit2(); 288 } 289 }, 1000); 290 291 if (usesRows) { 292 var extraEmptyRow = $('#fp-nav').find('li').get($('.module_row').length); 293 if ('undefined' !== typeof extraEmptyRow) { 294 extraEmptyRow.hide(); 295 } 296 } 297 298 if ($aSectionHref.length > 0) { 299 $aSectionHref.closest('li').addClass('current_page_item').siblings().removeClass('current_page_item current-menu-item'); 300 } 301 302 $body.trigger('themify_onepage_after_render', [$section, section_id]); 303 }, 304 afterLoad: function () { 305 var $section = $(sectionClass + '.active', $(sectionsWrapper)), 306 section_id = usesRows && $section.is('[class*="tb_section-"]') ? getClassToId($section) : $section.prop('id'), 307 $aSectionHref = $('#main-nav').find('a[href$="#' + section_id + '"]'); 308 309 if ($aSectionHref.length > 0) { 310 $aSectionHref.closest('li').addClass('current_page_item').siblings().removeClass('current_page_item current-menu-item'); 311 } 312 313 if( history.pushState && section_id ) { 314 if( initFullPage && currentHash !== section_id ) { 315 history.pushState(null, null, '#' + section_id); 316 } else { 317 history.replaceState(null, null, '#' + section_id); 318 } 319 } 320 321 initFullPage = true; 322 323 $body.trigger('themify_onepage_afterload', [$section, section_id]); 324 }, 325 onLeave: function (index, nextIndex, direction) { 326 327 // when lightbox is active, prevent scrolling the page 328 if ($body.find('> .mfp-wrap').length > 0) { 329 return false; 330 } 331 332 var $rows = usesRows ? $(sectionsWrapper).children(sectionClass) : $(sectionsWrapper).find(sectionClass); 333 if ($rows.length > 0) { 334 335 if (index > 0 && nextIndex > 0) { 336 var sectionIndex = index; 337 if ('up' === direction) { 338 for (sectionIndex = index; sectionIndex >= nextIndex; sectionIndex--) { 339 $rows.eq(sectionIndex - 1).css('visibility', 'visible'); 340 } 341 } else { 342 for (sectionIndex = index; sectionIndex <= nextIndex; sectionIndex++) { 343 $rows.eq(sectionIndex - 1).css('visibility', 'visible'); 344 } 345 } 346 347 } 348 } 349 } 350 }); 351} 352 353 354 355// Infinite Scroll /////////////////////////////// 356function doInfinite( $container, selector ) { 357 358 if ( 'undefined' !== typeof $.fn.infinitescroll ) { 359 360 // Get max pages for regular category pages and home 361 var scrollMaxPages = parseInt(themifyScript.maxPages); 362 363 // Get max pages for Query Category pages 364 if ( typeof qp_max_pages !== 'undefined') { 365 scrollMaxPages = qp_max_pages; 366 } 367 368 // infinite scroll 369 $container.infinitescroll({ 370 navSelector : '#load-more a:last', // selector for the paged navigation 371 nextSelector : '#load-more a:last', // selector for the NEXT link (to page 2) 372 itemSelector : selector, // selector for all items you'll retrieve 373 loadingText : '', 374 donetext : '', 375 loading : { img: themifyScript.loadingImg }, 376 maxPage : scrollMaxPages, 377 behavior : 'auto' !== themifyScript.autoInfinite? 'twitter' : '', 378 pathParse : function ( path ) { 379 return path.match(/^(.*?)\b\d+\b(?!.*\b\d+\b)(.*?$)/).slice(1); 380 }, 381 bufferPx: 50, 382 pixelsFromNavToBottom: $('#footerwrap').height(), 383 state: { 384 currPage: themifyScript.currentPage && Number.isInteger( +themifyScript.currentPage ) 385 ? +themifyScript.currentPage : 1 386 } 387 }, function(newElements, instance, url) { 388 // call Isotope for new elements 389 var $newElems = $(newElements); 390 391 // Mark new items: remove newItems from already loaded items and add it to loaded items
392 $('.newItems').removeClass('newItems'); 393 $newElems.addClass('newItems'); 394 395 if ( 'reset' === themifyScript.resetFilterOnLoad ) { 396 // Make filtered elements visible again 397 LayoutAndFilter.reset(); 398 } 399 400 $newElems.hide().imagesLoaded(function(){ 401 402 $newElems.fadeIn(); 403 404 $('.wp-audio-shortcode, .wp-video-shortcode').not('div').each(function() { 405 var $self = $(this); 406 if ( $self.closest('.mejs-audio').length === 0 ) { 407 ThemifyMediaElement.init($self); 408 } 409 }); 410 411 if (history.pushState && !+themifyScript.infiniteURL ) { 412 history.pushState(null, null, url); 413 } 414 415 // redirect to corresponding page 416 $('.post').contents().find("a:not([class='comment-reply-link'], [id='cancel-comment-reply-link'], .themify_lightbox, .post-content a[href$='jpg'], .post-content a[href$='gif'], .post-content a[href$='png'], .post-content a[href$='JPG'], .post-content a[href$='GIF'], .post-content a[href$='PNG'], .post-content a[target='_new'], .post-content a[target='_blank'])").click(function(){ 417 var href = $(this).attr('href'); 418 window.parent.location.assign(href); 419 return false; 420 }); 421 422 // Apply lightbox/fullscreen gallery to new items 423 Themify.InitGallery(); 424 loadIsotop('object' === typeof $container.data('isotope'),function(){ 425 $container.isotope('appended', $newElems ); 426 }); 427 if ($container.hasClass('auto_tiles') && $('body').hasClass('tile_enable')) { 428 $container.trigger('infiniteloaded.themify', [$newElems]); 429 } 430 if ( LayoutAndFilter.filterActive ) { 431 // If new elements with new categories were added enable them in filter bar 432 LayoutAndFilter.enableFilters(); 433 434 if ( 'scroll' === themifyScript.scrollToNewOnLoad ) { 435 LayoutAndFilter.restore(); 436 } 437 } 438 439 $('#infscr-loading').fadeOut('normal'); 440 if( 1 === scrollMaxPages ){ 441 $('#load-more, #infscr-loading').remove(); 442 } 443 444 /** 445 * Fires event after the elements and its images are loaded. 446 * 447 * @event infiniteloaded.themify 448 * @param {object} $newElems The elements that were loaded. 449 */ 450 $('body').trigger( 'infiniteloaded.themify', [$newElems] ); 451 452 $(window).trigger( 'resize' ); 453 }); 454 455 scrollMaxPages = scrollMaxPages - 1; 456 if( 1 < scrollMaxPages && 'auto' !== themifyScript.autoInfinite) { 457 $('.load-more-button').show(); 458 } 459 }); 460 461 // disable auto infinite scroll based on user selection 462 if( 'auto' === themifyScript.autoInfinite ){ 463 $('#load-more, #load-more a').hide(); 464 } 465 } 466} 467 468// Entry Filter ///////////////////////// 469LayoutAndFilter = { 470 filterActive: false, 471 init: function(el) { 472 $('.post-filter+.loops-wrapper:not(.auto_tiles),.masonry:not(.list-post):not(.auto_tiles), .post-filter+.loops-wrapper .ptb_loops_wrapper',el).prepend('<div class="grid-sizer"></div><div class="gutter-sizer"></div>'); 473 if (!Themify.is_builder_active) { 474 this.enableFilters(); 475 this.filterActive = true; 476 } 477 this.filter(el); 478 }, 479 enableFilters: function() { 480 var $filter = $('.post-filter'); 481 if ( $filter.find('a').length > 0 && 'undefined' !== typeof $.fn.isotope ) { 482 $filter.find('li').each(function(){ 483 var $li = $(this), 484 $entries = $li.parent().next(), 485 cat = $li.attr('class').replace(/(current-cat)|(cat-item)|(-)|(active)/g, '').replace(' ', ''); 486 if ( $entries.find('.post.cat-' + cat).length === 0 ) { 487 $li.hide(); 488 } else { 489 $li.show(); 490 } 491 }); 492 } 493 }, 494 filter: function(el) { 495 var $filter = $('.post-filter',el), 496 is_left= !$( 'body' ).hasClass( 'rtl' ); 497 498 initFilter = function() { 499 $filter.each( function() { 500 var f = $(this), 501 isotopeArgs = { 502 isOriginLeft: is_left, 503 percentPosition: true 504 }, 505 $entries = f.next(); 506 507 // PTB isotope fix 508 if( $entries.has( '.ptb_loops_wrapper' ).length ) { 509 $entries.find( '.grid-sizer, gutter-sizer' ).remove(); 510 $entries = $entries.find( '.ptb_loops_wrapper' ); 511 } 512 513 isotopeArgs['masonry'] = { 514 columnWidth: $entries.children('.grid-sizer').length ? '.grid-sizer' : null, 515 gutter: $entries.children('.gutter-sizer').length ? '.gutter-sizer' : null 516 }; 517 518 if( ! $entries.hasClass( 'masonry' ) ) { 519 $entries.imagesLoaded( function() { 520 isotopeArgs['itemSelector'] = '.post'; 521 isotopeArgs['layoutMode'] = 'fitRows'; 522 isotopeArgs['fitRows'] = { 523 gutter: $entries.children('.gutter-sizer').length ? '.gutter-sizer' : null 524 }; 525 $entries.addClass('masonry-done').isotope( isotopeArgs ); 526 } ); 527 } 528 529 f.addClass('filter-visible').on('click', 'a', function( e ) { 530 e.preventDefault(); 531 532 var $li = $(this).parent(), 533 $cat = false, 534 $auto = $('body').hasClass('tile_enable') && $entries.hasClass('auto_tiles'); 535 536 if ( $li.hasClass('active') ) { 537 $li.removeClass('active'); 538 ! $auto && ( isotopeArgs['filter'] = '.post' ); 539 } else { 540 $li.addClass('active').siblings().removeClass('active'); 541 $cat = $li.attr('class').replace(/(current-cat)|(cat-item)|(-)|(active)/g, '').replace(' ', ''); 542 ! $auto && ( isotopeArgs['filter'] = '.cat-' + $cat ); 543 } 544 545 if (!e.isTrigger && $auto && $entries.data('themify_tiles')) { 546 var $post = $entries.children('.post'); 547 548 $post.show(); 549 $cat && $post.not('.cat-' + $cat).hide(); 550 $entries.data('themify_tiles').update(); 551 552 setTimeout(function () { 553 $.themify_tiles.resizeParent($entries); 554 f.removeClass('filter-disable'); 555 }, Math.round(parseFloat($entries.css('transition-duration')) * 1000) + 100); 556 } else { 557 $entries.addClass( 'masonry-done' ).imagesLoaded( function() { 558 $entries.isotope( isotopeArgs ); 559 f.removeClass('filter-disable'); 560 } ); 561 } 562 563 }); 564 }); 565 }; 566 567 if( Themify.is_builder_active ) { 568 $( 'body' ).one( 'builder_load_module_partial', function( e, el, type ) { 569 ! el && loadIsotop( $filter.find('a').length > 0, initFilter ); 570 }); 571 } else { 572 loadIsotop( $filter.find( 'a' ).length > 0, initFilter ); 573 } 574 }, 575 scrolling: false, 576 reset: function() { 577 $('.post-filter').find('li.active').find('a').addClass('previous-active').trigger('click'); 578 this.scrolling = true; 579 }, 580 restore: function() { 581 //$('.previous-active').removeClass('previous-active').trigger('click'); 582 var $first = $('.newItems').first(), 583 self = this, 584 to = $first.offset().top - ( $first.outerHeight(true)/2 ), 585 speed = 800; 586 587 if ( to >= 800 ) { 588 speed = 800 + Math.abs( ( to/1000 ) * 100 ); 589 } 590 $('html,body').stop().animate({ 591 scrollTop: to 592 }, speed, function() { 593 self.scrolling = false;
594 }); 595 }, 596 layout: function(el) { 597 var posts = $('.loops-wrapper.masonry:not(.list-post)',el); 598 if( posts.length > 0 ) { 599 var last = posts.children('.loops-wrapper > article').last(); 600 function callback(){ 601 posts 602 .addClass('masonry-done') 603 .isotope({ 604 masonry: { 605 columnWidth: '.grid-sizer', 606 gutter: '.gutter-sizer' 607 }, 608 itemSelector: '.loops-wrapper > article', 609 isOriginLeft : ! $( 'body' ).hasClass( 'rtl' ) 610 }) 611 .isotope( 'once', 'layoutComplete', function() { 612 $(window).trigger('resize'); 613 }); 614 } 615 if(last.hasClass('wow')){ 616 last.one('webkitAnimationEnd oanimationend msAnimationEnd animationend',function(){ 617 setTimeout(callback,1000); 618 }); 619 } 620 else{ 621 callback(); 622 } 623 } 624 625 if(themifyScript.shop_masonry==='yes'){ 626 var $products = $('.woocommerce.archive',el).find('#content').find('ul.products'); 627 if ( $products.length ) { 628 $products.imagesLoaded(function(){ 629 $products.isotope({ 630 layoutMode: 'fitRows', 631 itemSelector : '.product', 632 isOriginLeft : ! $( 'body' ).hasClass( 'rtl' ) 633 }).addClass('masonry-done'); 634 }); 635 } 636 } 637 var $gallery = $('.gallery-wrapper.packery-gallery',el); 638 if ( $gallery.length > 0 ) { 639 $gallery.imagesLoaded(function(){ 640 $gallery.isotope({ 641 layoutMode: 'packery', 642 itemSelector: '.item' 643 }); 644 }); 645 } 646 }, 647 reLayout: function() { 648 $('.masonry').not('.list-post').each(function(){ 649 var $loopsWrapper = $(this); 650 if ( 'object' === typeof $loopsWrapper.data('isotope') ) { 651 $loopsWrapper.isotope('layout'); 652 } 653 }); 654 var $gallery = $('.gallery-wrapper.packery-gallery'); 655 if ( $gallery.length > 0 && 'object' === typeof $gallery.data('isotope') ) { 656 $gallery.isotope('layout'); 657 } 658 if(themifyScript.shop_masonry==='yes'){ 659 var $products = $('.woocommerce.archive').find('#content').find('ul.products'); 660 if ( $products.length && 'object' === typeof $products.data('isotope') ) { 661 $products.isotope('layout'); 662 } 663 } 664 } 665}; 666 667 668// DOCUMENT READY 669$(document).ready(function() { 670 671 var $body = $('body'), 672 $header = $('#header'), 673 $header_icons = $( '.header-icons' ); 674 if( $body.hasClass( 'header-leftpane' ) || $body.hasClass( 'header-rightpane' ) ) { 675 $( '.cart-icon' ).appendTo( $( '.social-widget' ) ); 676 } else if( $body.hasClass( 'header-minbar' ) ) { 677 $( '.cart-icon' ).appendTo( $( '.header-icons' ) ); 678 } else { 679 $(window).on( 'throttledresize', function() { 680 if( $header_icons.is( ':visible' ) && ! $header_icons.find( '.cart-icon' ).length ) { 681 $( '.cart-icon' ).appendTo( $header_icons ); 682 } else if ( ! $header_icons.is( ':visible' ) && $header_icons.find( '.cart-icon' ).length ) { 683 $( '.cart-icon' ).appendTo( $( '#main-nav-wrap' ) ); 684 } 685 }); 686 } 687 688 ///// Header Top Widget 689 var header_top_widget_content = $('.header-top-widgets .header-widget').wrap('</p>').parent().html(); 690 if(header_top_widget_content != undefined){ 691 $('.header-top-widgets #headerwrap').prepend("<div class='header-widget-full clearfix'><div class='header-widget-inner'>"+ header_top_widget_content +"</div></div>"); 692 } 693 ///////////////////////////////////////////// 694 // Scroll to row when a menu item is clicked. 695 ///////////////////////////////////////////// 696 if ( 'undefined' !== typeof $.fn.themifyScrollHighlight ) { 697 $body.themifyScrollHighlight(); 698 } 699 700 ///////////////////////////////////////////// 701 // Initialize Packery Layout and Filter 702 ///////////////////////////////////////////// 703 function LayoutAndFilterCallback(){ 704 var condition = $('.post-filter+.loops-wrapper,.masonry:not(.list-post)').length>0 705 || (themifyScript.shop_masonry==='yes' && $('.woocommerce.archive').find('#content').find('ul.products').length>0) 706 || $('.gallery-wrapper.packery-gallery').length>0; 707 708 loadIsotop(condition,function(){ 709 LayoutAndFilter.init(); 710 $body.imagesLoaded().always(function(){ 711 LayoutAndFilter.layout(); 712 }); 713 }); 714 } 715 716 if (Themify.is_builder_active) { 717 $body.one('builder_load_module_partial',function(e,el,type){ 718 if(!el){ 719 LayoutAndFilterCallback(); 720 } 721 }); 722 } 723 else{ 724 LayoutAndFilterCallback(); 725 } 726 ///////////////////////////////////////////// 727 // Scroll to top 728 ///////////////////////////////////////////// 729 var $back_top = $('.back-top'); 730 if($back_top.length>0){ 731 if(!isFullPageScroll && $back_top.hasClass('back-top-float')){ 732 $(window).on("scroll touchstart.touchScroll touchmove.touchScroll", function() { 733 if( window.scrollY < 10){ 734 $back_top.addClass('back-top-hide'); 735 }else{ 736 $back_top.removeClass('back-top-hide'); 737 } 738 }); 739 740 } 741 $back_top.on('click', function(e){ 742 e.preventDefault(); 743 e.stopPropagation(); 744 if(isFullPageScroll){ 745 $('#footerwrap').toggleClass('expanded'); 746 } 747 else{ 748 themeScrollTo(0); 749 } 750 }); 751 } 752 ///////////////////////////////////////////// 753 // Toggle main nav on mobile 754 ///////////////////////////////////////////// 755 if( is_touch_device() && typeof $.fn.themifyDropdown != 'function' ) { 756 Themify.LoadAsync(themify_vars.url + '/js/themify.dropdown.js', function(){ 757 $( '#main-nav' ).themifyDropdown(); 758 }); 759 } 760 761 if ( $body.hasClass( 'header-minbar' ) || $body.hasClass( 'header-leftpane' ) ) { 762 ///////////////////////////////////////////// 763 // Side Menu for header-minbar and header-leftpane 764 ///////////////////////////////////////////// 765 $('#menu-icon').themifySideMenu({ 766 close: '#menu-icon-close', 767 side: 'left' 768 }); 769 ///////////////////////////////////////////// 770 // NiceScroll only for header-minbar and header-leftpane 771 ///////////////////////////////////////////// 772 var headerNicescroll = function() { 773 if ( 'undefined' !== typeof $.fn.niceScroll && ! is_touch_device() ) { 774 var $niceScrollTarget = $header; 775 if ( $body.hasClass( 'header-minbar' ) ) { 776 $niceScrollTarget = $('#mobile-menu'); 777 } 778 $niceScrollTarget.niceScroll(); 779 $body.on( 'sidemenushow.themify', function(){ 780 setTimeout(function(){ 781 $niceScrollTarget.getNiceScroll().resize(); 782 }, 200); 783 } ); 784 } 785 }; 786 787 if( $header.length ) { 788 if( typeof $.fn.niceScroll !== 'function' ) { 789 Themify.LoadAsync(themifyScript.themeURI + '/js/jquery.nicescroll.min.js', headerNicescroll, null, null, function () { return ('undefined' !== typeof $.fn.niceScroll); } ); 790 } else { 791 headerNicescroll(); 792 } 793 } 794 } 795 else if ( $body.hasClass( 'header-slide-out' ) || $body.hasClass( 'header-rightpane' ) ){ 796 $('#menu-icon').themifySideMenu({ 797 close: '#menu-icon-close', 798 side: 'right' 799 }); 800 801 var nicescrollMenu = function() { 802 if ( 'undefined' !== typeof $.fn.niceScroll && ! is_touch_device() ) { 803 var $niceScrollTarget = $header; 804 if ( $body.hasClass( 'header-slide-out' ) ) { 805 $niceScrollTarget = $('#mobile-menu'); 806 } 807 $niceScrollTarget.niceScroll(); 808 $body.on( 'sidemenushow.themify', function(){ 809 setTimeout(function(){ 810 $niceScrollTarget.getNiceScroll().resize(); 811 }, 200); 812 } ); 813 } 814 }; 815 816 if( $header.length || $body.hasClass( 'header-slide-out' ) ) { 817 if( typeof $.fn.niceScroll !== 'function' ) { 818 Themify.LoadAsync(themifyScript.themeURI + '/js/jquery.nicescroll.min.js', nicescrollMenu, null, null, function () { return ('undefined' !== typeof $.fn.niceScroll); } ); 819 } else { 820 nicescrollMenu(); 821 } 822 } 823 } 824 else { 825 ///////////////////////////////////////////// 826 // Side Menu for all other header designs 827 ///////////////////////////////////////////// 828 $('#menu-icon').themifySideMenu({ 829 close: '#menu-icon-close' 830 }); 831
832 var $overlay = $( '<div class="body-overlay">' ); 833 $body.append( $overlay ).on( 'sidemenushow.themify', function () { 834 $overlay.addClass( 'body-overlay-on' ); 835 } ).on( 'sidemenuhide.themify', function () { 836 $overlay.removeClass( 'body-overlay-on' ); 837 } ).on( 'click.themify touchend.themify', '.body-overlay', function () { 838 $( '#menu-icon' ).themifySideMenu( 'hide' ); 839 $( '#cart-icon' ).themifySideMenu( 'hide' ); 840 } ); 841 $(window).resize(function(){ 842 if($('#mobile-menu').hasClass('sidemenu-on') && $( '#menu-icon' ).is(':visible')){ 843 $overlay.addClass( 'body-overlay-on' ); 844 } else { 845 $overlay.removeClass( 'body-overlay-on' ); 846 } 847 }); 848 } 849 850 851 if ( !($body.hasClass( 'header-overlay' )) ) { 852 853 $("#main-nav li.menu-item-has-children > a, #main-nav li.page_item_has_children > a").after( 854 "<span class='child-arrow'></span>" 855 ); 856 $('#main-nav li.menu-item-has-children > .child-arrow, #main-nav li.page_item_has_children > .child-arrow').click(function(){ 857 $(this).toggleClass('toggle-on'); 858 return true; 859 }); 860 861 } 862 863 ///////////////////////////////////////////// 864 // Slide cart icon 865 ///////////////////////////////////////////// 866 $('#cart-icon').themifySideMenu({ 867 panel: '#slide-cart', 868 close: '#cart-icon-close' 869 }); 870 871 ///////////////////////////////////////////// 872 // Add class "first" to first elements 873 ///////////////////////////////////////////// 874 $('.highlight-post:odd').addClass('odd'); 875 876 var nicescrollHeaderStuff = function() { 877 if ( 'undefined' !== typeof $.fn.niceScroll && ! is_touch_device() ) { 878 // NiceScroll Initialized Default 879 if ($(window).width() > 1200) { 880 $(".header-horizontal .header-widget, .header-top-bar .header-widget, .boxed-compact .header-widget, .header-stripe .header-widget").niceScroll(); 881 } 882 } 883 }; 884 885 if( $(".header-horizontal .header-widget, .header-top-bar .header-widget, .boxed-compact .header-widget, .header-stripe .header-widget").length ) { 886 if( typeof $.fn.niceScroll !== 'function' ) { 887 Themify.LoadAsync(themifyScript.themeURI + '/js/jquery.nicescroll.min.js', nicescrollHeaderStuff, null, null, function () { return ('undefined' !== typeof $.fn.niceScroll); } ); 888 } else { 889 nicescrollHeaderStuff(); 890 } 891 } 892 893 var $headerWidgets = $('.header-horizontal, .header-top-bar, .boxed-compact, .header-stripe').find('.header-widget'); 894 if ( $headerWidgets.length > 0 ) { 895 // Header Horizontal, Header Topbar, Boxed Compact Add pull down wrapper 896 $( '.header-horizontal #main-nav, .header-top-bar #main-nav, .boxed-compact #main-nav, .header-stripe #main-nav' ).after( $( '<a href="#" class="pull-down">' ) ); 897 898 // Pull Down onclick Header Horizontal, Header Topbar, Boxed Compact Only 899 $('.pull-down').on('click', function(e) { 900 if( ! is_touch_device() ) { 901 if( typeof $.fn.niceScroll !== 'function' ) { 902 Themify.LoadAsync(themifyScript.themeURI + '/js/jquery.nicescroll.min.js', function() { 903 $headerWidgets.getNiceScroll().resize(); 904 }, null, null, function () { return ('undefined' !== typeof $.fn.niceScroll); } ); 905 } else { 906 $headerWidgets.getNiceScroll().resize(); 907 } 908 } 909 910 $('#header').toggleClass('pull-down-close'); 911 $headerWidgets.slideToggle( 'fast', function() { 912 $('#pagewrap').css('paddingTop', $('#headerwrap').outerHeight(true)); 913 }); 914 e.preventDefault(); 915 }); 916 } 917 918 // Reset NiceScroll Resize 919 $(window).resize(function(){ 920 if ($(window).width() < 1200) { 921 var nicescrollItems = $(".header-horizontal .header-widget, .header-top-bar .header-widget, .boxed-compact .header-widget, .header-stripe .header-widget"); 922 if( nicescrollItems.length && ! is_touch_device() ) { 923 if( typeof $.fn.niceScroll !== 'function' ) { 924 Themify.LoadAsync(themifyScript.themeURI + '/js/jquery.nicescroll.min.js', function() { 925 nicescrollItems.getNiceScroll().remove(); 926 }, null, null, function () { return ('undefined' !== typeof $.fn.niceScroll); } ); 927 } else { 928 nicescrollItems.getNiceScroll().remove(); 929 } 930 } 931 nicescrollItems.attr("style",""); 932 } 933 }); 934 935 ///////////////////////////////////////////// 936 // Make overlay clickable 937 ///////////////////////////////////////////// 938 $body.on( 'click', '.loops-wrapper.grid4.polaroid .post-image + .post-content, .loops-wrapper.grid3.polaroid .post-image + .post-content, .loops-wrapper.grid2.polaroid .post-image + .post-content, .loops-wrapper.grid4.overlay .post-image + .post-content, .loops-wrapper.grid3.overlay .post-image + .post-content, .loops-wrapper.grid2.overlay .post-image + .post-content', function(){ 939 var $link = $( this ).closest( '.post' ).find( 'a[data-post-permalink]' ); 940 if($link.attr( 'href' ) && ! $link.hasClass( 'themify_lightbox' ) ) { 941 window.location = $link.attr( 'href' ); 942 } 943 }); 944 945 ///////////////////////////////////////////// 946 // Carousel initialization 947 ///////////////////////////////////////////// 948 949 if ( $('.loops-wrapper.slider').length > 0 ) { 950 var elID = 0; 951 $('.loops-wrapper.slider').each(function(){ 952 elID++; 953 var $self = $(this); 954 955 if ( 'undefined' === typeof $self.attr( 'id' ) ) { 956 // If this doesn't have an id, set dummy id 957 $self.attr( 'id', 'loops-wrapper-' + elID ); 958 } 959 var dataID = $self.attr( 'id' ); 960 961 $self.addClass( 'slideshow-wrap' ); 962 963 if ( $self.find( '.slideshow' ).length === 0 ) { 964 $self.wrapInner( '<div class="slideshow" data-id="' + dataID + '" data-autoplay="off" data-speed="1000" data-effect="scroll" data-visible="3" />' ); 965 } else { 966 $self.find( '.slideshow' ).attr( 'data-id', dataID ); 967 } 968 }); 969 } 970 if($('.slideshow').length>0){ 971 if(!$.fn.carouFredSel){
972 Themify.LoadAsync(themify_vars.url+'/js/carousel.min.js',function(){ 973 ThemifySlider.createCarousel($('.slideshow')); 974 },null,null,function(){ 975 return typeof $.fn.carouFredSel!=='undefined'; 976 }); 977 } 978 else{ 979 ThemifySlider.createCarousel( $( '.slideshow' ) ); 980 } 981 } 982 var $headerwrap = $( '#headerwrap' ); 983 $body.on( 'announcement_bar_position announcement_bar_scroll_on_after', function( e, el ){ 984 $('#pagewrap').css( 'paddingTop', Math.floor( $headerwrap.outerHeight(true) ) ); 985 }).on( 'announcement_bar_position', function( e, el ){ 986 if( $( this ).hasClass( 'header-minbar' ) ) { 987 var w = $headerwrap.width(); 988 el.css( {'left': w - Math.abs( parseInt( $headerwrap.css( 'left' ), 10 ) ),'right':w - Math.abs( parseInt( $headerwrap.css( 'right' ), 10 ) )} ); 989 } 990 } ); 991 992 var initResize = 0, 993 condition = $body.hasClass( 'header-top-bar' ) || $body.hasClass( 'header-horizontal' ) || $body.hasClass( 'header-top-widgets' ) || $body.hasClass( 'boxed-compact' ) || $body.hasClass( 'header-stripe' ) || $body.hasClass( 'header-magazine' ); 994 $(window).resize(function(){ 995 ///////////////////////////////////////////// 996 // Mega menu width 997 ///////////////////////////////////////////// 998 /* Adjust for scroll bar width */ 999 if(condition){ 1000 if ($(window).width() > tf_mobile_menu_trigger_point) { 1001 $('#main-nav li.has-mega-column > ul, #main-nav li.has-mega-sub-menu > .mega-sub-menu').css( 1002 'width', $('#header').width() 1003 ); 1004 } else { 1005 $('#main-nav li.has-mega-column > ul,#main-nav li.has-mega-sub-menu > .mega-sub-menu').removeAttr("style"); 1006 } 1007 } 1008 ///////////////////////////////////////////// 1009 // Nicescroll for mobile menu 1010 ///////////////////////////////////////////// 1011 if(!initResize && typeof nicescrollMobile === 'function' && $('.mobile_menu_active').length ) { 1012 if( typeof $.fn.niceScroll !== 'function' ) { 1013 Themify.LoadAsync( themifyScript.themeURI + '/js/jquery.nicescroll.min.js', nicescrollMobile, null, null, function () { return ('undefined' !== typeof $.fn.niceScroll); } ); 1014 } else { 1015 nicescrollMobile(); 1016 } 1017 1018 initResize = 1; 1019 } 1020 }); 1021 1022 ///////////////////////////////////////////// 1023 // Header Overlay toggle-able dropdown 1024 ///////////////////////////////////////////// 1025 // Set Dropdown Arrow 1026 $(".header-overlay #main-nav li.menu-item-has-children > a, .header-overlay #main-nav li.page_item_has_children > a").after( 1027 "<span class='child-arrow'></span>" 1028 ); 1029 $('.header-overlay #main-nav li.menu-item-has-children > .child-arrow, .header-overlay #main-nav li.page_item_has_children > .child-arrow').click(function(){ 1030 $(this).toggleClass('toggle-on').next('div, ul').toggle('fast'); 1031 return true; 1032 }); 1033 1034 var nicescrollMobile = function() { 1035 if ( 'undefined' !== typeof $.fn.niceScroll && ! is_touch_device() ) { 1036 if ( $body.hasClass( 'header-overlay' ) ) { 1037 1038 var $niceScrollTarget = $('#mobile-menu'); 1039 $niceScrollTarget.niceScroll(); 1040 $body.on('sidemenushow.themify', function(){ 1041 setTimeout(function(){ 1042 $niceScrollTarget.getNiceScroll().resize(); 1043 }, 200); 1044 }); 1045 1046 } 1047 } 1048 }; 1049 1050 if( $('.mobile_menu_active').length ) { 1051 if( typeof $.fn.niceScroll !== 'function' ) { 1052 Themify.LoadAsync(themifyScript.themeURI + '/js/jquery.nicescroll.min.js', nicescrollMobile, null, null, function () { return ('undefined' !== typeof $.fn.niceScroll); } ); 1053 } else { 1054 nicescrollMobile(); 1055 } 1056 } 1057 ///////////////////////////////////////////// 1058 // One Page Scroll 1059 ///////////////////////////////////////////// 1060 if (isFullPageScroll && $body.hasClass('query-section')) { 1061 themifyScript.hash = window.location.hash.replace('#', '').replace('!/', ''); 1062 if ('undefined' !== typeof $.fn.themifyScrollHighlight) { 1063 $body.on('scrollhighlight.themify', function (e, section) { 1064 if ('undefined' != typeof section && '' != section) { 1065 $('#fp-nav').find('li').eq($('.tb_section-' + section.replace('#', '')).index()).find('a').trigger('click'); 1066 } 1067 }); 1068 $(window).trigger('scroll'); 1069 }; 1070 // Get rid of wow js animation since animation is managed with fullpage js 1071 var callbackTimer = setInterval(function () { 1072 if ('undefined' !== typeof ThemifyBuilderModuleJs) { 1073 clearInterval(callbackTimer); 1074 wowInit2 = ThemifyBuilderModuleJs.wowInit; 1075 ThemifyBuilderModuleJs.wowInit = function () {}; 1076 } 1077 }, 100); 1078 1079 createFullScrolling(); 1080 $body.on('builder_toggle_frontend', function (event, is_edit) { 1081 if (typeof $.fn.fullpage !== 'undefined') { 1082 if (is_edit) { 1083 $.fn.fullpage.destroy('all'); 1084 $('html,body').css('overflowY','auto'); 1085 } else { 1086 createFullScrolling(); 1087 } 1088 } 1089 }); 1090
1091 if( $( window.frameElement ).is( '#themify_builder_site_canvas_iframe' ) ) { 1092 $.fn.fullpage.destroy('all'); 1093 } 1094 1095 $body.on('themify_onepage_afterload', function (e, $panel) { 1096 // Trigger wow display for elements in this panel 1097 if (tbLocalScript && tbLocalScript.animationInviewSelectors && typeof ThemifyBuilderModuleJs !== 'undefined' && ThemifyBuilderModuleJs.wow) { 1098 $(tbLocalScript.animationInviewSelectors).each(function (i, selector) { 1099 $(selector, $panel).each(function () { 1100 ThemifyBuilderModuleJs.wow.show(this); 1101 }); 1102 }); 1103 } 1104 }).on('themify_onepage_afterload themify_onepage_after_render', function (event, $section, section_id) { 1105 if ($.fn.waypoint) { 1106 Waypoint.refreshAll(); 1107 } 1108 if ('undefined' !== typeof ThemifyBuilderModuleJs && ThemifyBuilderModuleJs.wow !== null && typeof ThemifyBuilderModuleJs.wow.scrollHandler() === 'boolean') { 1109 ThemifyBuilderModuleJs.wow.scrollHandler(); 1110 } 1111 1112 }); 1113 } 1114 else { 1115 $('.section_loader').hide(); 1116 } 1117 if(isFullPageScroll){ 1118 // anchor scrollTo 1119 // exclude lightbox links from scrolling 1120 $body.on('click', 'a[href*="#"]:not(.themify_lightbox)', function (e) { 1121 var url = $(this).prop('href'), 1122 idx = url.indexOf('#'), 1123 hash = idx != -1 ? url.substring(idx + 1) : '', 1124 offset = 0, 1125 $sectionEl = $('.tb_section-' + hash); 1126 if (hash.length > 1 && $sectionEl.length > 0 && hash !== 'header') { 1127 offset = $sectionEl.offset().top; 1128 // If header is set to fixed, calculate this 1129 if ($('.fixed-header').length > 0) { 1130 offset += $('#headerwrap').outerHeight(true); 1131 } 1132 $.fn.fullpage.moveTo($sectionEl.index(sectionClass) + 1); 1133 e.preventDefault(); 1134 } 1135 }); 1136 } 1137 1138 //Fix overlay style regardless the featured image position above/below post title 1139 $(".loops-wrapper.overlay .post").each(function () { 1140 $(this).find('.post-image').insertBefore($(this).find('.post-content')); 1141 }); 1142 1143 ///////////////////////////////////////////// 1144 // Mega Menu 1145 ///////////////////////////////////////////// 1146 var megaMenuInit = function() { 1147 if( 'undefined' !== typeof $.fn.ThemifyMegaMenu ) { 1148 /* add required wrappers for mega menu items */ 1149 $( '.has-mega-sub-menu' ).each(function(){ 1150 var $this = $( this ); 1151 1152 $this.find( '> ul' ).removeAttr( 'class' ) 1153 .wrap( '<div class="mega-sub-menu sub-menu" />' ) 1154 .after( '<div class="mega-menu-posts" />' ) 1155 .find( 'li.menu-item-type-taxonomy' ) // only taxonomy terms can display mega posts 1156 .addClass( 'mega-link' ); 1157 }); 1158 1159 $('.has-mega-sub-menu').ThemifyMegaMenu({ 1160 events: themifyScript.events 1161 }); 1162 } 1163 }; 1164 if( $('.has-mega-sub-menu').length ) { 1165 if( typeof $.fn.ThemifyMegaMenu !== 'function' ) { 1166 Themify.LoadAsync( themifyScript.themeURI + '/themify/megamenu/js/themify.mega-menu.js', megaMenuInit ); 1167 } else { 1168 megaMenuInit(); 1169 } 1170 } 1171 1172}); 1173 1174// WINDOW RESIZE 1175$(window).resize(function() { 1176 1177 ///////////////////////////////////////////// 1178 // Swapping logo with Window Resize Function in Header Split Menu Layout 1179 ///////////////////////////////////////////// 1180 var $body = $('body'); 1181 if ( $body.hasClass( 'header-menu-split' ) ){ 1182 if ($('#menu-icon').is(':visible')) { 1183 if ($('.header-bar').find('#site-logo').length == 0) { 1184 $('#site-logo').prependTo( '.header-bar' ); 1185 } 1186 } else if ($('.themify-logo-menu-item').find('#site-logo').length === 0) { 1187 $('.themify-logo-menu-item').append($('.header-bar').find('#site-logo')); 1188 } 1189 } 1190 1191 var mgviewport = $(window).width(); 1192 if (mgviewport > tf_mobile_menu_trigger_point) { 1193 if ( $body.hasClass( 'header-magazine' ) ) { 1194 clearTimeout( ); 1195 setTimeout( function() { 1196 $('#headerwrap').css({ 1197 'paddingBottom': $('.navbar-wrapper').outerHeight() 1198 }); 1199 }, 400 ); 1200 } 1201 } 1202 1203}).load(function() { 1204 var $body = $('body'); 1205 /////////////////////////////////////////// 1206 // Initialize infinite scroll 1207 /////////////////////////////////////////// 1208 if (!Themify.is_builder_active) { 1209 if ( $body.hasClass( 'woocommerce' ) && $body.hasClass( 'archive' ) ) { 1210 doInfinite( $( '#content ul.products' ), '#content .product' ); 1211 } else { 1212 doInfinite( $( '#loops-wrapper' ), '.post' ); 1213 } 1214 } 1215 1216 /////////////////////////////////////////// 1217 // Header Video 1218 /////////////////////////////////////////// 1219 var $header = $('#headerwrap'), 1220 $videos = $header.find('[data-fullwidthvideo]'); 1221 if($header.data('fullwidthvideo')){ 1222 $videos = $videos.add($header); 1223 } 1224 function ThemifyBideo(){ 1225 var init = true, 1226 $fixed = $header.hasClass('fixed-header'); 1227 if ($fixed){ 1228 $header.removeClass('fixed-header'); 1229 } 1230 $videos.each(function(i){ 1231 var url = $(this).data('fullwidthvideo'); 1232 if(url){ 1233 var options = { 1234 url: url, 1235 doLoop: true, 1236 ambient:true, 1237 id: i 1238 }; 1239 if (init && $fixed){ 1240 init = false;
1241 options['onload'] = function(){ 1242 $header.addClass('fixed-header'); 1243 } 1244 } 1245 $(this).ThemifyBgVideo(options); 1246 } 1247 }); 1248 } 1249 if ($videos.length>0 && !is_touch_device()) { 1250 if(typeof $.fn.ThemifyBgVideo === 'undefined'){ 1251 Themify.LoadAsync( 1252 themify_vars.url + '/js/bigvideo.js', 1253 ThemifyBideo, 1254 null, 1255 null, 1256 function () { 1257 return ('undefined' !== typeof $.fn.ThemifyBgVideo); 1258 } 1259 ); 1260 } 1261 else{ 1262 ThemifyBideo(); 1263 } 1264 } 1265 1266 ///////////////////////////////////////////// 1267 // Entry Filter Layout 1268 ///////////////////////////////////////////// 1269 function reLayoutCallback(){ 1270 loadIsotop($('.masonry:not(.list-post), .gallery-wrapper.packery-gallery').length>0 || (themifyScript.shop_masonry==='yes' && $('.woocommerce.archive #content ul.products').length>0),function(){ 1271 $body.imagesLoaded( function() { 1272 if(!Themify.is_builder_active){ 1273 $(window).resize(); 1274 } 1275 LayoutAndFilter.reLayout(); 1276 }); 1277 }); 1278 } 1279 if (Themify.is_builder_active) { 1280 $body.one('builder_load_module_partial',function(e,el,type){ 1281 if(!el){ 1282 reLayoutCallback(); 1283 } 1284 }); 1285 } 1286 else{ 1287 reLayoutCallback(); 1288 } 1289 1290 // Edge menu 1291 $(function ($) { 1292 $( '#main-nav li:has(ul), #footer-nav li:has(ul)' ).on( 'mouseenter dropdown_open', function (e) { 1293 /* prevent "edge" classname being removed by mouseleave event when flipping through menu items really fast */ 1294 window.clearTimeout( $( this ).data( 'edge_menu_t' ) ); 1295 1296 var elm = $( 'ul:first', this ), 1297 l = elm.offset().left, 1298 w = elm.width(), 1299 docW = $(window).width(), 1300 isEntirelyVisible = (l + w <= docW); 1301 1302 if ( ! isEntirelyVisible ) { 1303 $( this ).addClass( 'edge' ); 1304 } 1305 }) 1306 .on( 'mouseleave dropdown_close', function() { 1307 var $this = $( this ), 1308 t = setTimeout( function(){ 1309 $this.removeClass( 'edge' ); 1310 }, 300 ); 1311 $this.data( 'edge_menu_t', t ); 1312 } ); 1313 }); 1314 1315 if (isFullPageScroll && $body.hasClass('query-section')) { 1316 // Hack Chrome browser doesn't autoplay the video background 1317 $body.on('themify_onepage_after_render', function () { 1318 $.each(tbLocalScript.animationInviewSelectors, function (index, selector) { 1319 $(selector).css('visibility', 'hidden'); 1320 }); 1321 1322 // Section deep linking 1323 if (window.location.hash) { 1324 setTimeout(function () { 1325 var hashSection = themifyScript.hash; 1326 if ('' != hashSection && '#' != hashSection) { 1327 var $sectionEl = usesRows ? $('.tb_section-' + hashSection) : $('#' + hashSection); 1328 if ($sectionEl.length > 0) { 1329 $.fn.fullpage.moveTo($sectionEl.index() + 1); 1330 if( typeof ThemifyBuilderModuleJs !== 'undefined' ) { 1331 $(tbLocalScript.animationInviewSelectors).each(function (i, selector) { 1332 $(selector, $sectionEl).addBack().each(function () { 1333 ThemifyBuilderModuleJs.wow.show(this); 1334 }); 1335 }); 1336 } 1337 } 1338 } 1339 }, 1500); 1340 } 1341 }); 1342 // Make row backgrounds visible. 1343 $('.module_row').css('visibility', 'visible'); 1344 } 1345 1346 // remove item ajax 1347 $(document).on('click', '.remove-item-js', function (e) { 1348 e.preventDefault(); 1349 // AJAX add to cart request 1350 var $thisbutton = $(this), 1351 data = { 1352 action: 'theme_delete_cart', 1353 remove_item: $thisbutton.attr('data-product-key') 1354 }, 1355 $addedButton = $body.find( '.ajax_add_to_cart ' ), 1356 removedURL = $thisbutton.parent().find( '.product-title a' ).attr( 'href' ); 1357 1358 // Ajax action 1359 $.post(woocommerce_params.ajax_url, data, function (response) { 1360 var fragments = response.fragments, 1361 cart_hash = response.cart_hash; 1362 1363 // Changes button classes 1364 if ($thisbutton.parent().find('.added_to_cart').size() == 0) 1365 $thisbutton.addClass('added'); 1366 1367 // Replace fragments 1368 if (fragments) { 1369 $.each(fragments, function (key, value) { 1370 $(key).addClass('updating').replaceWith(value); 1371 }); 1372 if(!$(fragments['#shopdock-ultra']).find('.cart
1372-total').length) { 1373 $('#cart-icon-close').trigger( 'click' ); 1374 } 1375 } 1376 if( $addedButton.length ) { 1377 $addedButton.each( function() { 1378 if( $( this ).hasClass( 'added' ) && $( this ).closest( '.post-content' ).find( '[href="' + removedURL + '"]' ).length ) { 1379 $( this ).removeClass( 'added' ).siblings( '.added_to_cart' ).remove(); 1380 } 1381 } ) 1382 } 1383 // Trigger event so themes can refresh other areas 1384 $body.trigger('removed_from_cart', [fragments, cart_hash]); 1385 1386 }); 1387 }); 1388 1389 1390 function ThemifyTiles(container) { 1391 var dummy = $('<div class="post-tiled tiled-square-small" style="visibility: hidden !important; opacity: 0;" />').appendTo(container.first()), 1392 $gutter = themifyScript.tiledata['padding'], 1393 $small = parseFloat(dummy.width()); 1394 dummy.remove(); 1395 1396 container.each(function () { 1397 var $this = $(this); 1398 $(this).imagesLoaded().always(function (instance) { 1399 $this.children('.product').addClass('post'); 1400 var $post = $this.children('.post'); 1401 themifyScript.tiledata['padding'] = $this.hasClass('no-gutter') ? 0 : $gutter; 1402 $this.themify_tiles(themifyScript.tiledata, $small); 1403 setClasses($post, $small); 1404 }); 1405 }); 1406 1407 } 1408 ; 1409 function AjaxThemifyTiles(container) { 1410 1411 $(document).ajaxComplete(function (e, request, settings) { 1412 if (settings.type === 'POST' && settings.url.indexOf('wpf_search')) { 1413 ThemifyTiles($('.loops-wrapper.auto_tiles')) 1414 } 1415 }); 1416 } 1417 var container = $('.auto_tiles'); 1418 if (container.length > 0 && $body.hasClass('tile_enable')) { 1419 if ('undefined' === typeof Tiles) { 1420 Themify.LoadAsync(themifyScript.themeURI + '/js/tiles.min.js', function () { 1421 if (!$.fn.themify_tiles) { 1422 if('undefined' === typeof $.fn.backstretch){ 1423 Themify.LoadAsync(themify_vars.url + '/js/backstretch.min.js', function () { 1424 Themify.LoadAsync(themifyScript.themeURI + '/js/themify-tiles.js', function () { 1425 ThemifyTiles(container); 1426 AjaxThemifyTiles(container); 1427 }, 1428 null, 1429 null, 1430 function () { 1431 return ('undefined' !== typeof $.fn.themify_tiles); 1432 }); 1433 }, 1434 null, 1435 null, 1436 function () { 1437 return ('undefined' !== typeof $.fn.backstretch); 1438 }); 1439 } 1440 else{ 1441 Themify.LoadAsync(themifyScript.themeURI + '/js/themify-tiles.js', function () { 1442 ThemifyTiles(container); 1443 AjaxThemifyTiles(container); 1444 }, 1445 null, 1446 null, 1447 function () { 1448 return ('undefined' !== typeof $.fn.themify_tiles); 1449 }); 1450 } 1451 } 1452 else { 1453 ThemifyTiles(container); 1454 AjaxThemifyTiles(container); 1455 } 1456 } 1457 , null, 1458 null, 1459 function () { 1460 return ('undefined' !== typeof Tiles); 1461 }); 1462 } 1463 else { 1464 ThemifyTiles(container); 1465 AjaxThemifyTiles(container); 1466 } 1467 1468 } 1469 if (Themify.is_builder_active) { 1470 $body.on('builder_load_module_partial',function(e,el,type){ 1471 loadIsotop(el && el.find('.builder-posts-wrap.masonry:not(.list-post)').length>0,function(){ 1472 LayoutAndFilter.init(el); 1473 $body.imagesLoaded().always(function(){ 1474 LayoutAndFilter.layout(el); 1475 }); 1476 },true); 1477 }); 1478 } 1479 1480 1481}); 1482})(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.