1jQuery(document).ready(function ($) { 2 "use strict"; 3 4 var rtl = false; 5 6 /* Content Post Gallery */ 7 $(".post-content-gallery.justify").each( function() { 8 $(this).justifiedGallery({ 9 selector: 'div, div:not(.spinner)', 10 rowHeight: $(this).attr('data-justify'), 11 maxRowHeight: parseInt( $(this).attr('data-justify') ) * 0.7, 12 margins: 10 13 }); 14 }); 15 16 $('.post-content-gallery.slider .post-gallery-list').slick({ 17 fade: true, 18 swipe: true, 19 dots: false, 20 arrows: true, 21 cssEase: 'cubic-bezier(0.445, 0.05, 0.55, 0.95)', 22 prevArrow: '<button type="button" class="slick-prev slick-arrow"><i class="icon icon-arrow-left-circle"></i></button>', 23 nextArrow: '<button type="button" class="slick-next slick-arrow"><i class="icon icon-arrow-right-circle"></i></button>', 24 rtl: rtl, 25 }); 26 $('.post-content-gallery.slider .post-gallery-list').on('afterChange', function (event, slick, currentSlide, nextSlide) { 27 var i = (currentSlide ? currentSlide : 0) + 1; 28 $(this).parents('.post-content-gallery.slider').find('.post-gallery-pagination').text(i + '/' + slick.slideCount); 29 }); 30 31 32 /* Mobile Navigation Render */ 33 if( $('.primary-desktop .sh-header-top .sh-nav').length ) { 34 $('.primary-mobile .sh-nav-mobile').html( $('.primary-desktop #header-navigation .sh-nav').html() + $('.primary-desktop .sh-header-top .sh-nav').html() ); 35 } else { 36 $('.primary-mobile .sh-nav-mobile').html( $('.primary-desktop #header-navigation .sh-nav').html() ); 37 } 38 $('.primary-mobile .sh-nav-mobile > li.menu-item-has-mega-menu').each( function() { 39 40 if( $(this).find('.mega-menu-dynamic-elements').length ) { 41 var menu_items = ''; 42 if( $(this).find('.nav-tabs-header-categories a').length ) { 43 menu_items = '<ul class="sub-menu">'; 44 $(this).find('.nav-tabs-header-categories a').each( function() { 45 menu_items += '<li class="menu-item"><a href="' + $(this).attr('href') + '">' + $(this).html() + '</a></li>'; 46 }); 47 menu_items += '</ul>'; 48 } else { 49 if( $(this).find('.header-dynamic-categories').attr('data-cat') && $(this).find('.header-dynamic-categories').attr('data-cat-link') ) { 50 menu_items += '<ul class="sub-menu"><li class="menu-item"><a href="' + $(this).find('.header-dynamic-categories').attr('data-cat-link') + '">' + $(this).find('.header-dynamic-categories').attr('data-cat') + '</a></li></ul>'; 51 } 52 53 } 54 55 $(this).append( menu_items ); 56 $(this).find('.mega-menu-dynamic-elements').remove(); 57 } 58 59 }); 60 //$('.primary-mobile .sh-nav-mobile').find('.mega-menu-row').remove(); 61 62 63 /* Header Post Render */ 64 $('.post-item.post-header-item').each(function(){ 65 var background_image = ''; 66 if( $(this).attr('data-i') ) { 67 background_image = '<div class="post-thumbnail">' + 68 '<div class="sh-ratio">' + 69 '<div class="sh-ratio-container">' + 70 '<div class="sh-ratio-content" data-lazy-background="'+ $(this).attr('data-i') +'"></div>' + 71 '</div>' + 72 '</div>' + 73 '<a href="'+ $(this).attr('data-l') +'" class="post-overlay">' + 74 '<div class="post-overlay-content">' + 75 '<span></span>' + 76 '<span></span>' + 77 '<span></span>' + 78 '</div>' + 79 '</a>' + 80 '</div>'; 81 } 82 83 $(this).html('<div class="post-container">' + background_image + 84 '<div class="post-content-container">' + 85 '<a href="'+ $(this).attr('data-l') +'" class="post-title">' + 86 '<h4>'+ $(this).attr('data-t') +'</h4>' + 87 '</a>' + 88 '<div class="post-meta">' + 89 '<div class="post-meta-content">' + 90 '<span class="post-auhor-date">' + 91 '<a href="'+ $(this).attr('data-l') +'" class="post-date">' + 92 '<i class="icon icon-clock"></i> '+ $(this).attr('data-d') + 93 '</a>' + 94 '</span>' + 95 '</div>' + 96 '</div>' + 97 '</div>' + 98 '</div>'); 99 100 $(this).removeAttr('data-i').removeAttr('data-t').removeAttr('data-l').removeAttr('data-d'); 101 });
102 103 104 /* Header Post Categories */ 105 $('.nav-tabs-header-categories a').on( "click", function() { 106 window.location = $(this).attr( 'href' ); 107 }); 108 109 /* */ 110 $('.post-overlay').html( '<div class="post-overlay-content"><span></span> <span></span> <span></span></div>' ); 111 112 $(document).off('click.bs.tab.data-api', '[data-hover="tab"]'); 113 $(document).on('mouseenter.bs.tab.data-api', '[data-hover="tab"]', function () { 114 $(this).tab('show'); 115 }); 116 117 if( $('.tab-pagination').length > 0 ) { 118 $('.tab-pagination .tab-pagination-back').on( 'click', function(){ 119 var tab_current_item = $(this).parents('.tab-pane').find('.nav-tabs > .active'); 120 tab_current_item.prev('li').find('a').trigger('click'); 121 122 var tab_current_item_new = $(this).parents('.tab-pane').find('.nav-tabs > .active'); 123 if( tab_current_item_new.prev('li').length > 0 ) { 124 $(this).removeClass('disabled'); 125 } else { 126 $(this).addClass('disabled'); 127 } 128 129 if( tab_current_item_new.next('li').length > 0 ) { 130 $(this).parent().find('.tab-pagination-next').removeClass('disabled'); 131 } else { 132 $(this).parent().find('.tab-pagination-next').addClass('disabled'); 133 } 134 }); 135 136 $('.tab-pagination .tab-pagination-next').on( 'click', function(){ 137 var tab_current_item = $(this).parents('.tab-pane').find('.nav-tabs > .active'); 138 tab_current_item.next('li').find('a').trigger('click'); 139 140 var tab_current_item_new = $(this).parents('.tab-pane').find('.nav-tabs > .active'); 141 if( tab_current_item_new.next('li').length > 0 ) { 142 $(this).removeClass('disabled'); 143 } else { 144 $(this).addClass('disabled'); 145 } 146 147 if( tab_current_item_new.prev('li').length > 0 ) { 148 $(this).parent().find('.tab-pagination-back').removeClass('disabled'); 149 } else { 150 $(this).parent().find('.tab-pagination-back').addClass('disabled'); 151 } 152 }); 153 154 $('.tab-pagination .tab-pagination-back').trigger('click'); 155 } 156 157 158 159 160 161 162 /* Mobile Header Dropdown (close if needed) */ 163 setTimeout(function(){ 164 if( $(document).width() < 1025 ) { 165 $('.primary-desktop .sh-nav ul.sub-menu').css('display', 'none'); 166 } 167 }, 50); 168 function gillion_header_dropdown() { 169 if ($(document).width() > 1025) { 170 $('.sh-header-mobile-dropdown').hide(); 171 $('.sh-nav-dropdown').removeClass('open'); 172 } 173 174 if ($(document).width() < 1025) { 175 $('body').removeClass('page-layout-right-fixed'); 176 $('.primary-desktop ul.sub-menu').css('display', 'none'); 177 $('.sh-sticky-mobile-header .sh-header-mobile-dropdown').css( 'overflow', 'auto' ); 178 if( $('#wpadminbar').length ) { 179 $('.sh-sticky-mobile-header .sh-header-mobile-dropdown').css( 'max-height', $(window).height() - $('.sh-header-mobile-navigation').height() - $('#wpadminbar').height() ); 180 } else { 181 $('.sh-sticky-mobile-header .sh-header-mobile-dropdown').css( 'max-height', $(window).height() - $('.sh-header-mobile-navigation').height() ); 182 } 183 } 184 } 185 gillion_header_dropdown(); 186 187 188 /* Header Navigation Position FIX */ 189 function gillion_navigation_position() { 190 var new_position, menu_status, menu_width, menu_offset, window_width; 191 window_width = $(document).width(); 192 $('ul.sh-nav ul').mouseover(function() { 193 194 menu_status = $(this).find('.sub-menu').length; 195 if( menu_status > 0 ) { 196 197 menu_width = $(this).find('.sub-menu').width(); 198 menu_offset = $(this).find('.sub-menu').parent().offset().left + menu_width; 199 if( (menu_offset + menu_width) > window_width ) { 200 201 new_position = menu_width + 0; 202 $(this).find('.sub-menu').css({ 203 left: -new_position-0, 204 top: '0', 205 }); 206 207 } else { 208 209 $(this).find('.sub-menu').css({ 210 left: new_position+0, 211 top: '0', 212 }); 213 214 } 215 216 } 217 }); 218 } 219 gillion_navigation_position(); 220 221 222 /* Mega Menu Helper */ 223 function gillion_megamenu() { 224 $('.sh-nav .mega-menu-row').each(function(){ 225 $(this).children().css('height',''); 226 var self = $(this); 227 var count = parseInt( $(this).children().length ); 228 if( count > 0 && count <= 4 ) { 229 $(this).addClass( 'mega-menu-row-'+count ); 230 231 var maxHeight = $(self).actual( 'height' ); 232 $(this).find('>:nth-child(-n+'+count+')').each(function() { 233 $(this).height( maxHeight ); 234 }); 235 } else { 236 $(this).addClass( 'mega-menu-row-5' ); 237 238 var count_now = 0; 239 while( count >= count_now ) { 240 count_now += 4; 241 242 var maxHeight = -1; 243 $(this).find('>:nth-child(n+'+(count_now-3)+'):nth-child(-n+'+count_now+')').each(function() { 244 maxHeight = maxHeight > $(this).actual( 'height' ) ? maxHeight : $(this).actual( 'height' ); 245 }); 246 247 $(this).find('>:nth-child(n+'+(count_now-3)+'):nth-child(-n+'+count_now+')').each(function() { 248 $(this).height(maxHeight); 249 }); 250 } 251 } 252 }); 253 } 254 gillion_megamenu(); 255 256 257 /* Resize Action (slow) */ 258 $(window).resize(function() { 259 clearTimeout(window.resizedFinished); 260 window.resizedFinished = setTimeout(function(){ 261 262 gillion_header_dropdown(); 263 gillion_navigation_position(); 264 gillion_megamenu(); 265 266 }, 500); 267 });
268 269 270 /* Header Height Load */ 271 var primary_desktop = $('.sh-header').actual( 'outerHeight') + $('.sh-header-top').actual( 'outerHeight'); 272 if( !isNaN( $('.sh-header-middle').actual( 'outerHeight') ) ) { 273 primary_desktop += $('.sh-header-middle').actual( 'outerHeight'); 274 } 275 276 $('header.primary-desktop').css('height', primary_desktop ); 277 $('header.primary-mobile').css('height', $('.sh-header-mobile-navigation').actual( 'height' ) ); 278 var primary_desktop = '' 279 $(window).on( 'load resize', function() { 280 if( $(document).width() > 1000 ) { 281 $('header.primary-desktop').css('height',''); 282 primary_desktop = $('.sh-header').actual( 'outerHeight') + $('.sh-header-top').actual( 'outerHeight'); 283 if( !isNaN( $('.sh-header-middle').actual( 'outerHeight') ) ) { 284 primary_desktop += $('.sh-header-middle').actual( 'outerHeight'); 285 } 286 $('header.primary-desktop').css('height', primary_desktop ); 287 288 $('.header-dynamic-categories-side, .header-dynamic-categories-content').css('height', '' ); 289 $('.header-dynamic-categories').each( function() { 290 $(this).find('.header-dynamic-categories-side, .header-dynamic-categories-content').css('height', $(this).actual( 'outerHeight') ); 291 }); 292 } 293 }); 294 295 296 297 298 /* Mobile Header Dropdown Folders */ 299 $('.sh-header-mobile-dropdown ul li:has(">ul") a').on( 'click', function() { 300 $(this).parent().toggleClass('open'); 301 $(this).parent().find('> ul').stop(true, true).slideToggle(300, 'easeOutQuint'); 302 if( $(this).parent().hasClass('open') ) { 303 $(this).parent().find('ul ul').stop(true, true).slideUp(0, 'easeOutQuint'); 304 } 305 306 if( $(this).parent().hasClass('menu-item-has-children') ) { 307 return false; 308 } 309 }); 310 $('html').click(function() { 311 if ($('.sh-header-mobile-dropdown').is(':visible')) { 312 $('.sh-nav-dropdown .c-hamburger').trigger('click').toggleClass('is-active'); 313 } 314 }); 315 $('.sh-header-mobile-dropdown').click(function(event){ 316 event.stopPropagation(); 317 }); 318 319 320 /* Close mobile dropdown on click */ 321 $('.sh-header-mobile-dropdown li.menu-item:not(.menu-item-has-children)').on( 'click', function() { 322 if( $(this).find('> a').attr('href').indexOf("#") >= 0 ) { 323 $('.sh-header-mobile .sh-nav-dropdown').trigger('click'); 324 } 325 }); 326 327 328 /* Blog Masonry Layout */ 329 $('.blog-style-masonry:not(.sh-recent-posts-list-carousel), .post-content-gallery.masonry').each( function() { 330 var $masonry = $(this).isotope({ 331 itemSelector: '.post-item, .post-content-gallery-item', 332 columnWidth: 0, 333 gutter: 0, 334 }).isotope('reloadItems'); 335 $masonry.imagesLoaded( function() { 336 $masonry.isotope('layout').css( 'opacity', 1 ); 337 }); 338 $(window).load(function (){ 339 setTimeout(function(){ 340 $masonry.isotope('layout'); 341 }, 0); 342 }); 343 }); 344 345 346 347 /* Sidebar Widgets Masonry */ 348 if( $(document).width() <= 1025 && $(document).width() > 700 ) { 349 var $masonry = $('.sidebar-container, .gillion-columns-sidebar .wpb_widgetised_column > .wpb_wrapper').isotope({ 350 itemSelector: '.widget-item', 351 columnWidth: 0, 352 gutter: 0, 353 }).isotope('reloadItems'); 354 $masonry.imagesLoaded( function() { 355 $masonry.isotope('layout').css( 'opacity', 1 ); 356 }); 357 $(window).load(function (){ 358 setTimeout(function(){ 359 $masonry.isotope('layout'); 360 }, 0); 361 }); 362 } 363 364 365 /* Header Sticky */ 366 function gillion_sticky(){ 367 if ($(document).width() > 1025) { 368 369 if( header_height < 0 ) { 370 header_height = $('.sh-header').actual( 'height' ); 371 } 372 373 if( header_offset_total < 0 ) { 374 if( $('#wpadminbar').length ) { 375 var header_admin = $('#wpadminbar').actual( 'height' ); 376 } else { 377 var header_admin = 0; 378 } 379 380 if( $('.sh-header').length ) { 381 var header_offset = $('.sh-header').offset().top - header_admin; 382 } else { 383 var header_offset = 0; 384 } 385 header_offset_total = header_offset; 386 } 387 388 if($(document).scrollTop() > header_offset_total ){ 389 if( !$('body').hasClass('compose-mode') ) { 390 $('.sh-header').addClass('sh-sticky-header-active').css('top', $('#wpadminbar').actual( 'height' )); 391 } else { 392 $('.sh-header').addClass('sh-sticky-header-active'); 393 } 394 } else { 395 if( primary_desktop > 0 ) { 396 $('.sh-header-height').css( 'height', primary_desktop ); 397 $('.sh-header:not(.sh-header-2):not(.sh-header-3):not(.sh-header-4)').css( 'height', primary_desktop ); 398 399 setTimeout(function(){ 400 $('.sh-header-height').css( 'height', '' ); 401 $('.sh-header:not(.sh-header-2):not(.sh-header-3):not(.sh-header-4)').css( 'height', '' ); 402 }, 300); 403 } 404 405 $('.sh-header').removeClass('sh-sticky-header-active').css('top', 0); 406 } 407 } 408 409 if( $('.sh-sticky-mobile-header').length ) { 410 if($(document).scrollTop() > 0 ){ 411 $('.sh-header-mobile').addClass('sh-sticky-mobile-header-active'); 412 } else { 413 $('.sh-header-mobile').removeClass('sh-sticky-mobile-header-active'); 414 } 415 } 416 } 417 if( $('.sh-sticky-header').length ) { 418 419 if( $('#wpadminbar').length ) { 420 var header_admin = $('#wpadminbar').height(); 421 } else { 422 var header_admin = 0; 423 } 424 425 if( $('.sh-header').length ) { 426 var header_offset = $('.sh-header').offset().top - header_admin; 427 } else { 428 var header_offset = 0; 429 } 430 431 var header_height = $('.sh-header').height(); 432 var header_offset_total = header_offset; 433 var header_offset_sticky = 0; 434 435 gillion_sticky(); 436 $(window).scroll(gillion_sticky); 437 } 438 439 440 /* Footer Copyrights */ 441 if( $('.sh-copyrights-image').height() > 0 ) { 442 $('.sh-copyrights-text, .sh-copyrights-social').css('line-height', $('.sh-copyrights-image').height()+'px'); 443 } 444 445 446 /* Sidebar Search */ 447 $('.sh-sidebar-search').blur( function() { 448 $(this).parent().parent().parent().removeClass("sh-sidebar-search-active"); 449 }) 450 .focus( function() { 451 $(this).parent().parent().parent().addClass("sh-sidebar-search-active"); 452 });
453 454 455 /* Quantity buttons */ 456 function sh_increase_number_update() { 457 if( $('body').hasClass('woocommerce-cart') ) { 458 $('button[name="update_cart"]').removeAttr('disabled'); 459 } 460 } 461 462 $('.quantity').each( function() { 463 if( $(this).children().is( 'input' ) ) { 464 465 $(this).children().attr( 'type', 'text' ); 466 $(this).children().attr( 'class', 'sh-quantity-number' ); 467 $(this).prepend( '<span class="sh-noselect sh-increase-number-down">-</span>' ); 468 $(this).append( '<span class="sh-noselect sh-increase-number-up">+</span>' ); 469 $(this).addClass( 'sh-increase-numbers' ); 470 471 } 472 }); 473 474 $("input.sh-quantity-number").on('keyup keypress blur change', function(e) { 475 if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) { 476 return false; 477 }else{ 478 if( $(this).val().length >= parseInt($(this).attr('maxlength')) && (e.which != 8 && e.which != 0)){ 479 return false; 480 } 481 } 482 }); 483 484 $('body').on( 'updated_cart_totals', function(){ 485 if( $('.woocommerce .sh-alert-error').length > 1 ) { 486 $('.woocommerce .sh-alert-error').first().remove(); 487 } 488 489 $('.quantity').each( function() { 490 if( $(this).children().is( 'input' ) ) { 491 $(this).find('.sh-increase-number-down').remove(); 492 $(this).find('.sh-increase-number-up').remove(); 493 494 $(this).children().attr( 'type', 'text' ); 495 $(this).children().attr( 'class', 'sh-quantity-number' ); 496 $(this).prepend( '<span class="sh-noselect sh-increase-number-down">-</span>' ); 497 $(this).append( '<span class="sh-noselect sh-increase-number-up">+</span>' ); 498 $(this).addClass( 'sh-increase-numbers' ); 499 500 } 501 }); 502 }); 503 504 var gillion_product_increase_number_min = ( $('.woocommerce-grouped-product-list.group_table').length ) ? 0 : 1; 505 $(document).on('click', '.sh-increase-number-down', function(){ 506 var current_number_val = parseInt( $(this).parent().find('input.sh-quantity-number').val() ); 507 var current_number = isNaN( current_number_val ) ? 0 : current_number_val; 508 current_number = current_number - 1; 509 510 if( current_number >= gillion_product_increase_number_min ) { 511 $(this).parent().find('input.sh-quantity-number').val( current_number ); 512 sh_increase_number_update(); 513 } 514 }); 515 516 $(document).on('click', '.sh-increase-number-up', function(){ 517 var current_number_val = parseInt( $(this).parent().find('input.sh-quantity-number').val() ); 518 var current_number = isNaN( current_number_val ) ? 0 : current_number_val; 519 current_number = current_number + 1; 520 521 if( current_number >= 0 ) { 522 $(this).parent().find('input.sh-quantity-number').val( current_number ); 523 sh_increase_number_update(); 524 } 525 }); 526 527 528 529 /* Back To Top */ 530 if ($('.sh-back-to-top').length) { 531 var scrollTrigger = 100, // px 532 backToTop = function () { 533 var scrollTop = $(window).scrollTop(); 534 if (scrollTop > scrollTrigger) { 535 $('.sh-back-to-top').addClass('active'); 536 } else { 537 $('.sh-back-to-top').removeClass('active'); 538 } 539 }; 540 backToTop(); 541 $(window).on('scroll', function () { 542 backToTop(); 543 }); 544 545 $('.sh-back-to-top').on('click', function (e) { 546 e.preventDefault(); 547 $(this).blur(); 548 $('html,body').animate({ 549 scrollTop: 0 550 }, 500); 551 }); 552 } 553 554 555 /* Youtube controls change */ 556 $('iframe').each( function() { 557 var iframe_src = $(this).attr('src'); 558 if( iframe_src ) { 559 if( iframe_src.indexOf("youtube.com") !== -1 ) { 560 return this.src + '?title=0&byline=0&portrait=0'; 561 } 562 } 563 });
564 565 566 /* Titlebar Parallax */ 567 if( $(window).width() >= 768 ) { 568 $('.sh-titlebar-parallax').jarallax({ 569 speed: 0.5 570 }); 571 572 if( gillion.single_post_slider_parallax == 1 ) { 573 $('body.single .blog-slider-item').jarallax({ 574 speed: 0.5 575 }); 576 } 577 } else { 578 $('.sh-titlebar-parallax').addClass('sh-titlebar-parallax-disabled'); 579 } 580 581 582 /* Categories Widget */ 583 $('.widget_categories li').each(function() { 584 var cat_count = $(this).clone().children().remove().end().text().trim().slice(1, -1); 585 if( cat_count ) { 586 $(this).find('> a').append( '<span class="count">' + cat_count + '</span>' ); 587 } 588 }); 589 $('.widget_product_categories li').each(function() { 590 if( $(this).find('span').html() ) { 591 $(this).find('> span').html( $(this).find('span').html().slice(1, -1) ); 592 } 593 }); 594 595 596 $('.widget_categories').each(function() { 597 if( $(this).find('li').length > 7 ) { 598 $(this).append('<div class="post-meta"><span class="widget_categories_button">' + gillion.text_show_all + '</span></div>'); 599 } 600 }); 601 602 $('body').on('click', '.widget_categories_button', function() { 603 $(this).parent().parent().find('li').css( 'display', 'block' ); 604 $(this).remove(); 605 return false; 606 }); 607 608 609 /* Share */ 610 $('.sh-social-share-button').on( 'click', function() { 611 $(this).next().toggleClass('sh-social-share-networks-active'); 612 }); 613 614 615 /* Header Navigation */ 616 function gillion_navigation() { 617 $("ul.sh-nav").superfish({ 618 delay: gillion.header_animation_dropdown_delay, 619 hoverClass: 'sh-hover', 620 animation: { opacity: "show", height:'show' }, 621 animationOut: { opacity: "hide", height:'hide' }, 622 easing: gillion.header_animation_dropdown, 623 speed: 500, 624 speedOut: 0,
625 cssArrows: false, 626 pathLevels: 2, 627 onBeforeShow: function() { 628 if( $(this).hasClass('mega-menu-dynamic-elements') ) { 629 var self_mega = $(this); 630 $(this).find('.sh-ratio-content[data-lazy-background]').each( function() { 631 $(this).css('background-image', 'url("' + $(this).attr('data-lazy-background') + '")' ); 632 }); 633 $(this).find('.sh-ratio-content[data-lazy-background]').imagesLoaded( { background: true }, function() { 634 self_mega.find('.header-dynamic-categories-loader').hide(); 635 }); 636 } else if( $(this).hasClass('sh-read-later-list') ) { 637 $(this).find('.sh-read-later-thumbnail[data-lazy-background]').each( function() { 638 $(this).css('background-image', 'url("' + $(this).attr('data-lazy-background') + '")' ); 639 }); 640 } 641 } 642 }); 643 } 644 645 gillion_navigation(); 646 if( !$('header.primary-desktop .sh-nav-social').find('a').length ) { 647 $('header.primary-desktop .sh-nav-social').remove(); 648 } 649 650 651 /* Mobile Header Dropdown */ 652 $('.sh-header-mobile .sh-nav-dropdown').click(function() { 653 $('.sh-header-mobile-dropdown').stop(true, true).slideToggle( 654 gillion.header_animation_dropdown_speed, 655 gillion.header_animation_dropdown 656 ); 657 return false; 658 }); 659 660 661 /* Notice */ 662 if( gillion.notice !== false ) { 663 if( gillion.notice == 'enable2' ) { 664 665 $('.sh-page-notice').show(); 666 $(".sh-page-notice-button").on('click', function() { 667 $('.sh-page-notice').hide(); 668 return false; 669 }); 670 671 } else { 672 673 if ( 'set' !== $.cookie( 'sh-notice' ) ) { 674 $('.sh-page-notice').show(); 675 $(".sh-page-notice-button").on('click', function() { 676 $.cookie( 'sh-notice', 'set', { expires: 356, path: '/' }); 677 $('.sh-page-notice').hide(); 678 return false; 679 }); 680 } 681 682 } 683 } 684 685 686 /* Lightbox */ 687 $("a[rel^='sh-lightbox'], a[rel^='lightbox'],a[data-rel^=lightcase]" ).lightcase({ 688 maxWidth: 1200, 689 maxHeight: 1200, 690 overlayOpacity: gillion.lightbox_opacity, 691 transition: gillion.lightbox_transition, 692 labels: { 693 'sequenceInfo.of': ' / ', 694 }, 695 }); 696 697 $('.sh-login-popup-trigger, .post-read-later-guest, .sh-product-wishlist-add-guest').lightcase({ 698 type: 'inline', 699 maxWidth: 440, 700 inline: { 701 height: 460 702 } 703 }); 704 $('.sh-login-popup-content-login input[type="text"], .sh-login-popup-content-login input[type="password"]').attr( 'required', 'required' ); 705 706 707 /* Page Loader */ 708 if( gillion.page_loader == 1 ) { 709 $(".sh-page-loader").fadeOut(500); 710 $("body").css('overflow', 'visible'); 711 712 $(window).bind('beforeunload', function(e){ 713 $('.sh-page-loader').fadeIn(); 714 }); 715 } 716 717 718 /* RTL Support */ 719 if( gillion.rtl_support == 1 ) { 720 //custom adjustments will be added here 721 } 722 723 724 /* Footer Parallax */ 725 function gillion_footer_parallax() { 726 if ($(document).width() > 850) { 727 $("#wrapper > .content-container").css( 'margin-bottom', $('.sh-footer').height() ); 728 } else { 729 $("#wrapper > .content-container").css( 'margin-bottom', '' ); 730 } 731 } 732 733 function gillion_footer_parallax_visible() { 734 if ($(document).width() > 850) { 735 if( ( $(document).height() - ($(window).scrollTop() + $(window).height()) ) < $('.sh-footer').height() ) { 736 $('.sh-footer').css( 'opacity', '1'); 737 } else { 738 $('.sh-footer').css( 'opacity', '0'); 739 } 740 } 741 } 742 743 if( gillion.footer_parallax == 1 ) { 744 $("body").addClass( 'sh-footer-paralalx-init' ); 745 746 $(window).load(function (){ 747 gillion_footer_parallax();
748 gillion_footer_parallax_visible(); 749 }); 750 751 $(window).resize(function() { 752 clearTimeout(window.resizedFinishedFooter); 753 window.resizedFinishedFooter = setTimeout(function(){ 754 755 gillion_footer_parallax(); 756 757 }, 500); 758 }); 759 760 $(window).scroll(gillion_footer_parallax_visible); 761 } 762 763 764 /* Read Later Functionality */ 765 $('.post-title, .responsive-post-read-later, .desktop-post-read-later').on('click', function(e) { 766 var title_class = $(e.target).attr('class'); 767 if( title_class == 'post-read-later' || title_class == 'fa fa-bookmark-o' || title_class == 'fa fa-bookmark' ) { 768 e.stopPropagation(); 769 e.preventDefault(); 770 771 if( gillion.loggedin == true ) { 772 773 if( title_class == 'fa fa-bookmark-o' || title_class == 'fa fa-bookmark' ) { 774 var self = $(e.target).parent(); 775 } else { 776 var self = $(e.target); 777 } 778 779 $.ajax({
780 dataType: 'json', 781 type: 'POST', 782 url: gillion.siteurl+"wp-admin/admin-ajax.php", 783 data : { 784 action : 'read_later_trigger', 785 type : self.attr('data-type'), 786 post_id : self.attr('data-id'), 787 }, 788 success: function( response ) { 789 if( response['post_id'] > 0 ) { 790 791 if( response['commit'] == 'remove') { 792 $('.post-read-later[data-id='+self.attr('data-id')+']').attr('data-type','add').html('<i class="fa fa-bookmark-o"></i>'); 793 $('.sh-read-later-item[data-id='+ response['post_id'] +']').remove(); 794 $('.sh-read-later-total').html( parseInt( $('.sh-read-later-total').html() ) - 1 ); 795 } else if( response['commit'] == 'add') { 796 $('.post-read-later[data-id='+self.attr('data-id')+']').attr('data-type','remove').html('<i class="fa fa-bookmark"></i>'); 797 $('.sh-read-later-list').prepend( response['body'] ); 798 $('.sh-read-later-total').html( parseInt( $('.sh-read-later-total').html() ) + 1 ); 799 } 800 801 } 802 } 803 }); 804 805 } 806 807 return false; 808 } 809 }); 810 $('.sh-read-later-list').on( 'click', '.sh-read-later-delete', function(e) { 811 var self = $(this).parent().parent().parent(); 812 $.ajax({
813 type: "POST", 814 url: gillion.siteurl+"wp-admin/admin-ajax.php", 815 data : { 816 action : 'read_latter_delete', 817 post_id : self.attr('data-id') 818 }, 819 success: function( response ) { 820 $('.sh-read-later-total').html( parseInt( $('.sh-read-later-total').html() ) - 1 ); 821 $('.post-read-later[data-id='+ parseInt( self.attr('data-id') ) +']').attr( 'data-type', 'add' ).html('<i class="ti-bookmark"></i>') 822 self.fadeOut(300, function(){ $(this).remove(); return false; }); 823 } 824 }); 825 }); 826 $('.sh-read-later-list').on( 'click', '.sh-read-later-item', function(e) { 827 if( $(e.target).attr('class') == 'sh-read-later-link' && $(e.target).attr('data-href') ) { 828 window.location.href = $(e.target).attr('data-href'); 829 } 830 831 return false; 832 }); 833 834 835 /* Header Slide Menu */ 836 $(window).load(function() { 837 $('.sh-nav-menu').on( 'click', function() { 838 var slide_menu_icon = $(this).find('i'); 839 if( !slide_menu_icon.hasClass( 'open' ) ) { 840 slide_menu_icon.attr( 'class', slide_menu_icon.attr( 'data-attr-opened' )+' open' ); 841 } else { 842 slide_menu_icon.attr( 'class', slide_menu_icon.attr( 'data-attr-closed' ) ); 843 } 844 845 $('.sh-header-side').show(0).css('transform','translateX( 0px )'); 846 $('.sh-header-side-overlay').show(0).css('opacity','1'); 847 return false; 848 }); 849 850 $('.sh-header-side-overlay, .sh-header-side-close').on( 'click', function() { 851 $('.sh-header-side').css('transform','translateX( 320px )').delay(350).hide(0); 852 $('.sh-header-side-overlay').css('opacity','0').delay(350).hide(0); 853 854 var slide_menu_icon = $('.sh-nav-menu i'); 855 if( !slide_menu_icon.hasClass( 'open' ) ) { 856 slide_menu_icon.attr( 'class', slide_menu_icon.attr( 'data-attr-opened' )+' open' ); 857 } else { 858 slide_menu_icon.attr( 'class', slide_menu_icon.attr( 'data-attr-closed' ) ); 859 } 860 }); 861 }); 862 863 864 /* Blog Content Center */ 865 $(window).on( 'load resize', function() { 866 if( $(document).width() > 768 ) { 867 $('.blog-style-left .post-item, .blog-style-left-right .post-item').each( function() { 868 $(this).find('.post-container-right').css('height', $(this).find('.post-container').css('height')); 869 }); 870 } else { 871 $('.blog-style-left .post-item, .blog-style-left-right .post-item').each( function() { 872 $(this).find('.post-container-right').css('height', ''); 873 }); 874 } 875 876 $('.sh-post-author-info').css( 'height', $('.sh-post-author').height() ); 877 878 $('.sh-404-page > .row > .col-md-6').each( function() { 879 $(this).css( 'height', '' ); 880 }); 881 var page_404_height = $('.sh-404-page').height(); 882 $('.sh-404-page > .row > .col-md-6').each( function() { 883 $(this).css( 'height', page_404_height ); 884 }); 885 }); 886 887 888 /* Blog Video Player */ 889 $('.post-media-play-overlay').on('click', function(ev) { 890 var videoURL = $(this).parent().find('iframe').prop('src'); 891 if( !videoURL.match(/vimeo.com/) ){ 892 $(this).parent().find('iframe').attr( 'src', $(this).parent().parent().find('iframe').attr( 'src') + "&wmode=transparent&autoplay=1&showinfo=0&controls=0&auto_play=true" ); 893 } else { 894 $(this).parent().find('iframe').attr( 'src', $(this).parent().parent().find('iframe').attr( 'src') + "?autoplay=1" ); 895 } 896 897 $(this).remove(); 898 ev.preventDefault(); 899 }); 900 901 902 /* Blog Gallery List */ 903 if( $('.post-gallery-list-background').length ) { 904 $('.post-gallery-list-background').slick({ 905 fade: true, 906 swipe: false, 907 dots: false, 908 arrows: false, 909 cssEase: 'cubic-bezier(0.445, 0.05, 0.55, 0.95)', 910 rtl: rtl, 911 }); 912 $('.post-gallery-list-background').on('init reInit afterChange', function (event, slick, currentSlide, nextSlide) { 913 var i = (currentSlide ? currentSlide : 0) + 1; 914 $(this).parents('.sh-ratio-content').find('.post-gallery-pagination-inside-cover').text(i + '/' + slick.slideCount); 915 }); 916 $('.post-cover-gallery-prev').click(function(){ 917 $(this).parents('.sh-ratio-content').find('.post-gallery-list-background').slick('slickPrev'); 918 }) 919 $('.post-cover-gallery-next').click(function(){ 920 $(this).parents('.sh-ratio-content').find('.post-gallery-list-background').slick('slickNext'); 921 }); 922 923 $(window).resize(function() { 924 clearTimeout(window.resizedFinished3); 925 window.resizedFinished3 = setTimeout(function(){ 926 927 $('.post-gallery-list-background').slick('refresh'); 928 929 }, 500); 930 }); 931 } 932 933 934 935 $('.post-gallery-list:not(.post-gallery-list-background)').slick({ 936 fade: true, 937 swipe: false, 938 dots: false, 939 arrows: true, 940 cssEase: 'cubic-bezier(0.445, 0.05, 0.55, 0.95)', 941 prevArrow: '<button type="button" class="slick-prev slick-arrow"><i class="icon icon-arrow-left-circle"></i></button>', 942 nextArrow: '<button type="button" class="slick-next slick-arrow"><i class="icon icon-arrow-right-circle"></i></button>', 943 rtl: rtl, 944 });
945 $('.post-gallery-list:not(.post-gallery-list-background)').on('init reInit afterChange', function (event, slick, currentSlide, nextSlide) { 946 var i = (currentSlide ? currentSlide : 0) + 1; 947 $(this).parents('.post-gallery').find('.post-gallery-pagination').text(i + '/' + slick.slideCount); 948 }); 949 950 951 952 $('.post-gallery-list-row').each( function() { 953 var gallery_count = $(this).find('.post-gallery-list-col').length; 954 if( gallery_count == 1) { 955 $(this).find('.post-gallery-list-col').addClass( 'post-gallery-list-col1' ); 956 } else if ( gallery_count == 2) { 957 $(this).find('.post-gallery-list-col').addClass( 'post-gallery-list-col2' ); 958 } 959 }); 960 961 962 /* Facebook Widget Overlay */ 963 $('.sh-widget-facebook-overlay').on('click', function(ev) { 964 $(this).fadeOut( 300 ); 965 setTimeout(function(){ 966 $(this).remove(); 967 }, 300); 968 ev.preventDefault(); 969 }); 970 971 972 /* Twitter Widget */ 973 $('.sh-widget-twitter-list').each( function() { 974 var self_slider = $(this); 975 $(self_slider).slick({ 976 slidesToShow: 1, 977 slidesToScroll: 1, 978 arrows: true, 979 infinite: false, 980 speed: 900, 981 cssEase: 'ease-in-out', 982 autoplay: true, 983 autoplaySpeed: 6000, 984 dots: false, 985 appendArrows: $(self_slider).parent().find('.widget-slide-arrows'), 986 prevArrow: '<button type="button" class="slick-prev"><i class="icon icon-arrow-left-circle"></i></button>', 987 nextArrow: '<button type="button" class="slick-next"><i class="icon icon-arrow-right-circle"></i></button>', 988 rtl: rtl, 989 }); 990 }); 991 992 993 /* Posts Slider Widget */ 994 $('.sh-widget-posts-slider-init').each( function() { 995 var self_slider = $(this); 996 $(self_slider).slick({ 997 slidesToShow: 1, 998 slidesToScroll: 1, 999 arrows: true, 1000 infinite: false, 1001 speed: 900, 1002 cssEase: 'ease-in-out', 1003 autoplay: false, 1004 dots: false, 1005 centerPadding: '60px', 1006 appendArrows: $(self_slider).parent().find('.widget-slide-arrows'), 1007 prevArrow: '<button type="button" class="slick-prev"><i class="icon icon-arrow-left-circle"></i></button>', 1008 nextArrow: '<button type="button" class="slick-next"><i class="icon icon-arrow-right-circle"></i></button>', 1009 rtl: rtl, 1010 }); 1011 }); 1012 1013 1014 /* Post Share Bar */ 1015 var social_share = Object.keys( jQuery.parseJSON( gillion.social_share ) ); 1016 if( !jQuery.isEmptyObject( social_share ) ) { 1017 $(".post-content-share-bar").jsSocials({ 1018 showLabel: false, 1019 showCount: false, 1020 shares: social_share, 1021 }); 1022 1023 $(".vcg-image-container-social").each( function() { 1024 $(this).jsSocials({ 1025 showLabel: false, 1026 showCount: false, 1027 shares: social_share, 1028 url: $(this).attr('data-url'), 1029 text: $(this).attr('data-title'), 1030 }); 1031 }); 1032 1033 $(".post-content-share-side").each( function() { 1034 $(this).jsSocials({ 1035 showLabel: false, 1036 showCount: false, 1037 shares: social_share, 1038 url: $(this).attr('data-url'), 1039 text: $(this).attr('data-title'), 1040 }); 1041 }); 1042 } 1043 1044 /* Posts Share Bar Sticky */ 1045 $(".post-content-share-bar").each( function() { 1046 var self_share = $(this); 1047 $(self_share).stick_in_parent({ 1048 offset_top: $('.sh-header').height() + $('#wpadminbar').height() + 15 1049 }); 1050 }); 1051 1052 /* Sticky Widgets */ 1053 let wpadminbar_height = parseInt( $('#wpadminbar').height() ); 1054 wpadminbar_height = wpadminbar_height > 0 ? wpadminbar_height : 0; 1055 $('#sidebar, .gillion-columns-sticky-sidebar .vc_col-sm-4').theiaStickySidebar({ 1056 additionalMarginTop: parseInt( $('.sh-header').height() + wpadminbar_height + 15 ), 1057 minWidth: 1026 1058 });
1059 1060 $('.gillion-sticky-element').stick_in_parent({ 1061 offset_top: parseInt( $('.sh-header').height() + wpadminbar_height + 15 ), 1062 sticky_class: 'sh-sticky-element' 1063 }); 1064 1065 1066 1067 /* Posts Related Slider */ 1068 $('.post-related').slick({ 1069 slidesToShow: 3, 1070 slidesToScroll: 3, 1071 arrows: true, 1072 infinite: false, 1073 speed: 900, 1074 cssEase: 'ease-in-out', 1075 autoplay: false, 1076 dots: false, 1077 appendArrows: $('.post-slide-arrows'), 1078 prevArrow: '<button type="button" class="slick-prev"><i class="icon icon-arrow-left-circle"></i></button>', 1079 nextArrow: '<button type="button" class="slick-next"><i class="icon icon-arrow-right-circle"></i></button>', 1080 responsive: [ 1081 { 1082 breakpoint: 799, 1083 settings: { 1084 slidesToShow: 2, 1085 slidesToScroll: 2, 1086 } 1087 }, 1088 { 1089 breakpoint: 600, 1090 settings: { 1091 slidesToShow: 1, 1092 slidesToScroll: 1, 1093 } 1094 } 1095 ], 1096 rtl: rtl, 1097 }); 1098 1099 1100 /* Miscellaneous Functions */ 1101 $('.blog-slider-mini-list').perfectScrollbar(); 1102 $('.sh-categories-list').perfectScrollbar({ suppressScrollX: true }); 1103 $('.sh-read-later-list').perfectScrollbar().removeClass('sh-read-later-list-init'); 1104 1105 $('a[data-rel^=lightcase-post]').each( function() { 1106 $(this).lightcase(); 1107 }); 1108 1109 $('.sh-hamburger-menu').click(function(){ 1110 $(this).toggleClass('open'); 1111 }); 1112 1113 $('.widget-item.widget_tag_cloud').each( function() { 1114 $(this).find('a').each( function() { 1115 $(this).html( '#' + $(this).html() ); 1116 }); 1117 }); 1118 1119 if( gillion.loggedin == false ) { 1120 $('.post-read-later').tooltipster({ 1121 theme: 'tooltipster-borderless' 1122 }); 1123 } 1124 1125 1126 if( $('.sh-widget-facebook-item').length ) { 1127 $('.sh-widget-facebook-item').on("mouseover", function () { 1128 $(this).append('<div id="fb-root"></div>'); 1129 $(this).append('<script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.6"; fjs.parentNode.insertBefore(js, fjs); }(document, "script", "facebook-jssdk"));</script>'); 1130 }); 1131 } 1132 1133 $('#sidebar .mc4wp-form-name').remove(); 1134 1135 1136 /* AJAX - Lazy Load */ 1137 if( $('.sh-load-more:not(.sh-load-more-product)').length ) { 1138 if( $('.sh-load-more.infinite').length ) { 1139 $(window).scroll( function() { 1140 if( $('.sh-load-more').length && $('.sh-load-more').isInViewport() ) { 1141 if( $('.sh-load-more:not(.disabled)').length ) { 1142 gillion_loadmore(); 1143 } 1144 } else if( !$('.sh-load-more').length ) { 1145 $(this).off(); 1146 } 1147 }); 1148 } 1149 1150 jQuery( document ).on( 'click', '.sh-load-more:not(.disabled)', function() { 1151 gillion_loadmore( $(this).attr('data-id') ); 1152 }); 1153 1154 function gillion_loadmore( load_more_id ) { 1155 if( load_more_id === undefined) { 1156 load_more_id = ''; 1157 } 1158 1159 1160 if( load_more_id ) { 1161 var lazy_self = $('.sh-load-more[data-id="'+ load_more_id +'"]'); 1162 } else { 1163 var lazy_self = $('.sh-load-more'); 1164 } 1165 1166 1167 lazy_self.addClass( 'disabled' ); 1168 var lazy_categories = lazy_self.attr('data-categories'); 1169 var lazy_post_style = lazy_self.attr('data-post-style'); 1170 var lazy_offset = lazy_self.attr('data-offset'); 1171 var lazy_posts_per_page = lazy_self.attr('data-posts-per-page'); 1172 var lazy_paged = lazy_self.attr('data-paged'); 1173 var lazy_element_id = lazy_self.attr('data-id'); 1174 1175 1176 jQuery.ajax({ 1177 url : gillion_loadmore_posts.ajax_url, 1178 type : 'post', 1179 data : { 1180 action : 'load_more_posts', 1181 categories : lazy_categories, 1182 per_page: lazy_posts_per_page, 1183 offset: lazy_offset, 1184 post_style : lazy_post_style, 1185 paged: lazy_paged, 1186 }, 1187 success : function( response ) { 1188 if( response == 'done' ) { 1189 lazy_self.remove(); 1190 } else { 1191 lazy_self.attr('data-paged', parseInt( $('.sh-load-more').attr('data-paged') ) + 1 ); 1192 1193 if( lazy_element_id ) { 1194 1195 var lazy_add_posts = $( '.content-container .'+ lazy_element_id +' .blog-list' ); 1196 if( lazy_add_posts.hasClass('blog-style-masonry') ) { 1197 lazy_add_posts.isotope( 'insert', $(response) ).imagesLoaded( function() { 1198 lazy_add_posts.isotope('layout').css( 'opacity', 1 ); 1199 }); 1200 } else { 1201 $(response).appendTo( '.content-container .'+ lazy_element_id +' .blog-list' ); 1202 } 1203 1204 } else { 1205 if( $( '.blog-list.blog-style-masonry' ).length ) { 1206 $( '.blog-list.blog-style-masonry' ).isotope( 'insert', $(response) ).imagesLoaded( function() { 1207 $( '.blog-list.blog-style-masonry' ).isotope('layout').css( 'opacity', 1 ); 1208 }); 1209 } else { 1210 $(response).appendTo( '.content-container .blog-list' ).hide().fadeIn( 700 ); 1211 } 1212 } 1213 1214 lazy_add_posts.find(".post-content-share-side").each( function() { 1215 if( !$(this).html() ) { 1216 $(this).jsSocials({ 1217 showLabel: false, 1218 showCount: false, 1219 shares: social_share, 1220 url: $(this).attr('data-url'), 1221 text: $(this).attr('data-title'), 1222 }); 1223 } 1224 }); 1225 1226 lazy_self.removeClass( 'disabled' ); 1227 if( $(response).filter('.post-item').length < lazy_posts_per_page ) { 1228 lazy_self.remove(); 1229 } 1230 1231 gillion_review_animation(); 1232 1233 } 1234 } 1235 }); 1236 } 1237 } 1238 1239 1240 /* AJAX - Wishlist */ 1241 if( $('body.single-product .sh-product-wishlist-single-placeholder').length ) { 1242 $('.summary.entry-summary form.cart').append( '<span class="sh-product-wishlist-single">'+ $('.sh-product-wishlist-single-placeholder').html() +'</span>' ); 1243 } 1244 1245 jQuery( document ).on( 'click', '.sh-product-wishlist-add-trigger:not(.disabled)', function(e) { 1246 var self = $(this); 1247 var product_id = self.attr('data-id'); 1248 var product_status = self.attr('data-status'); 1249 $('.sh-product-wishlist-add-trigger[data-id='+product_id+']').addClass( 'disabled' ); 1250 1251 jQuery.ajax({ 1252 url : gillion_loadmore_posts.ajax_url, 1253 type : 'post', 1254 data : { 1255 action : 'wishlist_item', 1256 product_id : product_id, 1257 status: product_status 1258 }, 1259 success : function( response ) { 1260 if( response.indexOf( 'done' ) >= 0 ) { 1261 if( product_status == 'add' ) { 1262 $('.sh-product-wishlist-add-trigger[data-id='+product_id+']').attr( 'data-status', 'remove' ); 1263 } else if( product_status == 'remove' ) { 1264 $('.sh-product-wishlist-add-trigger[data-id='+product_id+']').attr( 'data-status', 'add' ); 1265 } 1266 1267 if( $( '.woocommerce.woocommerce-wishlist' ).length ) { 1268 $( '.woocommerce.woocommerce-wishlist ul.products li.post-'+product_id ).fadeOut( 400, function() { 1269 $(this).remove(); 1270 if( !$( '.woocommerce.woocommerce-wishlist ul.products li.product' ).length ) { 1271 1272 if( $( '.woocommerce.woocommerce-wishlist .sh-pagination' ).length ) { 1273 $( '.woocommerce.woocommerce-wishlist .sh-pagination a.page-numbers' ).not('.current, .next, .prev').first().get(0).click(); 1274 } else { 1275 $( '.woocommerce-wishlist-not-found' ).fadeIn(); 1276 } 1277 } 1278 }); 1279 } 1280 } 1281 1282 $('.sh-product-wishlist-add-trigger[data-id='+product_id+']').removeClass( 'disabled' ); 1283 } 1284 }); 1285 1286 e.stopPropagation(); 1287 e.preventDefault(); 1288 return false; 1289 });
1290 1291 1292 /* WooCommerce */ 1293 if( $('body.gillion-woocommerce').length) { 1294 1295 /* WooCommerce- Stock */ 1296 if( $('.woocommerce div.product p.stock' ).length ) { 1297 $('.woocommerce div.product div.product_meta' ).prepend( '<span class="product_stock product-stock-information"><span class="product_meta_name">Stock</span><span class="'+ $('.woocommerce div.product p.stock' ).attr('class') +'">' + $('.woocommerce div.product p.stock' ).html() + '</span></span>' ); 1298 } 1299 1300 $('.woocommerce-products-for').slick({ 1301 slidesToShow: 1, 1302 slidesToScroll: 1, 1303 arrows: false, 1304 fade: true, 1305 asNavFor: '.woocommerce-products-nav', 1306 rtl: rtl, 1307 }); 1308 $('.woocommerce-products-nav').slick({ 1309 slidesToShow: 4, 1310 slidesToScroll: 1, 1311 asNavFor: '.woocommerce-products-for', 1312 dots: false, 1313 focusOnSelect: true, 1314 arrows: false, 1315 responsive: [ 1316 { 1317 breakpoint: 1000, 1318 settings: { slidesToShow: 3 } 1319 } 1320 ], 1321 rtl: rtl, 1322 }); 1323 $('.woocommerce-products-for').on( 'afterChange', function( event, slick, currentSlide, nextSlide ) { 1324 var i = (currentSlide ? currentSlide : 0) + 1; 1325 $('.woocommerce-product-gallery .post-gallery-pagination').text( i + '/' + slick.slideCount ); 1326 }); 1327 1328 1329 /* Account Placeholders */ 1330 if( $('body.gillion-woocommerce.woocommerce-edit-account:not(.sh-wc-labels-on)').length || 1331 $('body.gillion-woocommerce.woocommerce-edit-address:not(.sh-wc-labels-on)').length || 1332 $('body.woocommerce-checkout:not(.sh-wc-labels-on)').length ) { 1333 1334 $('body.gillion-woocommerce.woocommerce-edit-account .woocommerce-MyAccount-content input').each( function() { 1335 $(this).attr( 'placeholder', $(this).parent().find('label').text() ); 1336 $(this).attr( 'title', $(this).attr( 'placeholder' ) ); 1337 }); 1338 1339 $('body.gillion-woocommerce.woocommerce-edit-address .woocommerce-MyAccount-content input').each( function() { 1340 $(this).attr( 'placeholder', $(this).parent().find('label').text() ); 1341 $(this).attr( 'title', $(this).attr( 'placeholder' ) ); 1342 }); 1343 1344 $('body.woocommerce-checkout .woocommerce-billing-fields input').each( function() { 1345 $(this).attr( 'placeholder', $(this).parent().parent().find('label').text() ); 1346 $(this).attr( 'title', $(this).attr( 'placeholder' ) ); 1347 }); 1348 } 1349 1350 1351 /* AJAX - Load more products */ 1352 jQuery( document ).on( 'click', '.sh-load-more-product:not(.disabled)', function() { 1353 gillion_loadmore_products(); 1354 }); 1355 1356 function gillion_loadmore_products() { 1357 var lazy_self = $('.sh-load-more-product'); 1358 lazy_self.addClass( 'disabled' ); 1359 var lazy_categories = lazy_self.attr('data-categories'); 1360 var lazy_post_style = lazy_self.attr('data-post-style'); 1361 var lazy_posts_per_page = lazy_self.attr('data-posts-per-page'); 1362 var lazy_paged = lazy_self.attr('data-paged'); 1363 jQuery.ajax({ 1364 url : gillion_loadmore_posts.ajax_url, 1365 type : 'post', 1366 data : { 1367 action : 'load_more_products', 1368 per_page: lazy_posts_per_page, 1369 paged: lazy_paged, 1370 }, 1371 success : function( response ) { 1372 if( response == 'done' ) { 1373 $('.sh-load-more-product').remove(); 1374 } else { 1375 $(response).appendTo( '.vcg-woocommerce-products ul.products' ); 1376 1377 $('.sh-load-more-product').attr('data-paged', parseInt( $('.sh-load-more-product').attr('data-paged') ) + 1 ); 1378 lazy_self.removeClass( 'disabled' ); 1379 1380 if( $(response).filter('.type-product').length < lazy_posts_per_page ) { 1381 $('.sh-load-more-product').remove(); 1382 } 1383 1384 } 1385 } 1386 }); 1387 } 1388 } 1389 1390 1391 /* Remove unused slider buttons */ 1392 if( $('body').hasClass( 'sh-carousel-style2' ) ) { 1393 $( window ).load(function() { 1394 $('.widget-slide-arrows, .post-slide-arrows').each( function() { 1395 if( !$(this).html() ) { 1396 $(this).remove(); 1397 } 1398 }); 1399 }); 1400 } 1401 1402 1403 /* Review Animation */ 1404 function gillion_review_animation() { 1405 $(".sh-pie:not(.loaded)").each( function() { 1406 if( $(this).isInViewport() && !document.hidden ) { 1407 $(this).find( 'circle' ).css( 'stroke-dashoffset', $(this).attr( 'data-offset' ) + 'px' ); 1408 $(this).addClass( 'loaded' ); 1409 1410 var self = $(this); 1411 jQuery({ 1412 Counter: 0 1413 }).animate({ 1414 Counter: parseFloat( self.attr( 'data-score' ) ) * 10 1415 }, { 1416 duration: 1500, 1417 easing: 'swing', 1418 step : function(now, fx){ 1419 self.attr( 'data-score', parseFloat(now/10).toFixed(1) ); 1420 } 1421 }); 1422 } 1423 }); 1424 } 1425 $(window).scroll(function() { 1426 clearTimeout(window.scrollFinished); 1427 window.scrollFinished = setTimeout(function(){ 1428 1429 gillion_review_animation(); 1430 1431 }, 250); 1432 });
1433 1434 1435 1436 1437 // Fix jssocials share Whatsapp and Messenger links for web 1438 if( $(document).width() > 1024 ) { 1439 $('.jssocials-share-whatsapp a').each( function() { 1440 $(this).attr( 'href', 'https://web.whatsapp.com/send?text=' + encodeURI( document.title ) + '%0D%0A' + encodeURI( window.location.href ) ); 1441 }); 1442 } 1443}); 1444 1445 1446/* Load functions */ 1447(function( $ ){ 1448 1449 /* Shufflehound Carousel */ 1450 $.fn.isInViewport = function() { 1451 var elementTop = $(this).offset().top; 1452 var elementBottom = elementTop + $(this).outerHeight(); 1453 1454 var viewportTop = $(window).scrollTop(); 1455 var viewportBottom = viewportTop + $(window).height(); 1456 1457 return elementBottom > viewportTop && elementTop < viewportBottom; 1458 }; 1459 1460 $.fn.sh_carousel = function() { 1461 1462 /* Prepair Carusel */ 1463 $(this).html( '<div class="sh-carousel-items">' + $(this).html() + '</div>' ); 1464 var self_main = $(this); 1465 var self = $(this).find('.sh-carousel-items'); 1466 self.find('.blog-textslider-post:first-child').addClass( 'sh-active' ); 1467 1468 1469 /* Add Buttons */ 1470 self_main.append( '<span class="sh-carousel-buttons sh-carousel-buttons-styling"></span>' ); 1471 self_main.find( '.sh-carousel-buttons' ).append( '<span class="sh-carousel-prev"><i class="icon icon-arrow-left-circle"></i></span>' ); 1472 self_main.find( '.sh-carousel-buttons' ).append( '<span class="sh-carousel-next"><i class="icon icon-arrow-right-circle"></i></span>' ); 1473 1474 1475 /* Add Button Actions */ 1476 self_main.find('.sh-carousel-prev').on( 'click', function() { 1477 var active = self.find( '.blog-textslider-post.sh-active' ); 1478 var prev = active.prev(); 1479 1480 /* If one the last slide */ 1481 if( !prev.length ) { 1482 prev = self.find( '.blog-textslider-post:last-child' ); 1483 } 1484 1485 active.removeClass( 'sh-active' ); 1486 prev.addClass( 'sh-active' ); 1487 }); 1488 1489 self_main.find('.sh-carousel-next').on( 'click', function() { 1490 if( self.isInViewport() && !document.hidden ) { 1491 var active = self.find( '.blog-textslider-post.sh-active' ); 1492 var next = active.next(); 1493 1494 /* If one the last slide */ 1495 if( !next.length ) { 1496 next = self.find( '.blog-textslider-post:first-child' ); 1497 } 1498 1499 active.removeClass( 'sh-active' ); 1500 next.addClass( 'sh-active' ); 1501 } 1502 }); 1503 1504 1505 /* Start Carousel */ 1506 if( !$('body').hasClass( 'elementor-editor-active' ) && !$('body').hasClass( 'yp-yellow-pencil' ) ) { 1507 var speed = 5000; 1508 var run = setInterval( function(){ self_main.find('.sh-carousel-next').trigger('click'); }, speed); 1509 self_main.hover( 1510 function() { 1511 clearInterval(run); 1512 }, 1513 function() { 1514 run = setInterval( function(){ self_main.find('.sh-carousel-next').trigger('click'); }, speed); 1515 } 1516 ); 1517 } 1518 1519 } 1520 1521})( jQuery ); 1522 1523 1524 1525/* 1526** After loaded 1527*/ 1528window.addEventListener( 'load', function() { 1529 jQuery( function($) { 1530 // Fix Facebook widget plceholder image issue 1531 $('.sh-widget-facebook-item').css( 'min-height', 'auto' ).trigger( 'mouseenter' ); 1532 1533 1534 /* Header - Search Actions */ 1535 $(".sh-nav-search").on( 'click', function(e) { 1536 $(".sh-header-search-side").css('width', 'auto').css('height', 'auto').css('opacity', '1'); 1537 $(".sh-header-search-side-input").focus(); 1538 return false; 1539 }); 1540 $(".sh-header-search-side").on( 'click', function(e) { 1541 var search_class = $( e.target ).attr('class'); 1542 if( search_class != 'sh-header-search-side-input' && search_class != 'sh-header-search-side-icon' && search_class != 'ti-search' ) { 1543 $(".sh-header-search-side").css('opacity', '0'); 1544 setTimeout(function(){ 1545 $(".sh-header-search-side").css('width', '0px').css('height', '0px'); 1546 }, 300); 1547 } 1548 return false; 1549 }); 1550 1551 $('.sh-header-search-side-icon').on( 'click', function() { 1552 $('.sh-header-search-form').submit(); 1553 }); 1554 1555 $(document).keyup(function(e) { 1556 if (e.keyCode == 27) { 1557 $("#header-search").fadeOut("fast"); 1558 } 1559 }); 1560 });
1561});
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.