1jQuery(document).ready(function ($) { 2 3 /*----------------------------------------------------------------- 4 1. >>> Hero Slider 5 ----------------------------------------------------------------*/ 6 if ($(".hereo_banner_sec").length > 0) { 7 8 class Slideshow { 9 constructor(el) { 10 11 this.DOM = {el: el}; 12 13 this.config = { 14 slideshow: { 15 delay:5000, 16 17 } 18 }; 19 20 // Set the slideshow 21 this.init(); 22 23 } 24 init() { 25 26 var self = this; 27 28 // Charmed title 29 this.DOM.slideTitle = this.DOM.el.querySelectorAll('.slide-title'); 30 // this.DOM.slideTitle.forEach((slideTitle) => { 31 // charming(slideTitle); 32 // }); 33 34 // Set the slider 35 this.slideshow = new Swiper (this.DOM.el, { 36 37 loop: true, 38 // autoplay: { 39 // delay: this.config.slideshow.delay, 40 // disableOnInteraction: false, 41 // }, 42 speed: 400, 43 preloadImages: true, 44 updateOnImagesReady: true, 45 46 // lazy: true, 47 // preloadImages: false, 48 49 // pagination: { 50 // el: '.slideshow-pagination', 51 // clickable: true, 52 // bulletClass: 'slideshow-pagination-item', 53 // bulletActiveClass: 'active', 54 // clickableClass: 'slideshow-pagination-clickable', 55 // modifierClass: 'slideshow-pagination-', 56 // renderBullet: function (index, className) { 57 58 // var slideIndex = index, 59 // number = (index <= 8) ? '0' + (slideIndex + 1) : (slideIndex + 1); 60 61 // var paginationItem = '<span class="slideshow-pagination-item">'; 62 // paginationItem += '<span class="pagination-number">' + number + '</span>'; 63 // paginationItem = (index <= 8) ? paginationItem + '<span class="pagination-separator"><span class="pagination-separator-loader"></span></span>' : paginationItem; 64 // paginationItem += '</span>'; 65 66 // return paginationItem; 67 68 // }, 69 // }, 70 71 paginationClickable: true, 72 pagination: { 73 el: ".swiper-paginationslid", 74 clickable: true, 75 }, 76 // Navigation arrows 77 navigation: { 78 nextEl: '.slideshow-navigation-button.next', 79 prevEl: '.slideshow-navigation-button.prev', 80 }, 81 82 // And if we need scrollbar 83 // scrollbar: { 84 // el: '.swiper-scrollbar', 85 // }, 86 87 on: { 88 init: function() { 89 self.animate('next'); 90 }, 91 } 92 93 }); 94 95 // Init/Bind events. 96 this.initEvents(); 97 98 } 99 initEvents() { 100 101 //this.slideshow.on('paginationUpdate', (swiper, paginationEl) => this.animatePagination(swiper, paginationEl)); 102 //this.slideshow.on('paginationRender', (swiper, paginationEl) => this.animatePagination()); 103 104 this.slideshow.on('slideNextTransitionStart', () => this.animate('next')); 105 106 this.slideshow.on('slidePrevTransitionStart', () => this.animate('prev')); 107 108 }
109 animate(direction = 'next') { 110 111 // Get the active slide 112 this.DOM.activeSlide = this.DOM.el.querySelector('.swiper-slide-active'), 113 //this.DOM.activeSlideImg = this.DOM.activeSlide.querySelector('.slide-image'), 114 //this.DOM.activeSlideTitle = this.DOM.activeSlide.querySelector('.slide-title'), 115 //this.DOM.activeSlideTitleLetters = this.DOM.activeSlideTitle.querySelectorAll('span'); 116 117 // Reverse if prev 118 //this.DOM.activeSlideTitleLetters = direction === "next" ? this.DOM.activeSlideTitleLetters : [].slice.call(this.DOM.activeSlideTitleLetters).reverse(); 119 120 // Get old slide 121 this.DOM.oldSlide = direction === "next" ? this.DOM.el.querySelector('.swiper-slide-prev') : this.DOM.el.querySelector('.swiper-slide-next'); 122 if (this.DOM.oldSlide) { 123 // Get parts 124 //this.DOM.oldSlideTitle = this.DOM.oldSlide.querySelector('.slide-title') 125 //this.DOM.oldSlideTitleLetters = this.DOM.oldSlideTitle.querySelectorAll('span'); 126 // Animate 127 // this.DOM.oldSlideTitleLetters.forEach((letter,pos) => { 128 // TweenMax.to(letter, .2, { 129 // ease: Quart.easeIn, 130 // delay: (this.DOM.oldSlideTitleLetters.length-pos-1)*.02, 131 // y: '50%', 132 // opacity: 0 133 // }); 134 // }); 135 } 136 137 // Animate title 138 // this.DOM.activeSlideTitleLetters.forEach((letter,pos) => { 139 // TweenMax.to(letter, .3, { 140 // ease: Back.easeOut, 141 // delay: pos*.03, 142 // startAt: {y: '50%', opacity: 0}, 143 // y: '0%', 144 // opacity: 1 145 // }); 146 // }); 147 148 149 TweenMax.to(this.DOM.activeSlideTitle, 1.5, { 150 ease: Back.easeOut, 151 //delay: pos*.03, 152 startAt: {y: '50%', opacity: 0}, 153 y: '0%', 154 opacity: 1 155 }); 156 157 158 159 // Animate background 160 TweenMax.to(this.DOM.activeSlideImg, 1.5, { 161 ease: Expo.easeOut, 162 startAt: {x: direction === 'next' ? 200 : -200}, 163 x: 0, 164 }); 165 166 //this.animatePagination() 167 168 } 169 animatePagination(swiper, paginationEl) { 170 171 // Animate pagination 172 //this.DOM.paginationItemsLoader = paginationEl.querySelectorAll('.pagination-separator-loader'); 173 //this.DOM.activePaginationItem = paginationEl.querySelector('.slideshow-pagination-item.active');
174 //this.DOM.activePaginationItemLoader = this.DOM.activePaginationItem.querySelector('.pagination-separator-loader'); 175 176 //console.log(swiper.pagination); 177 // console.log(swiper.activeIndex); 178 179 // Reset and animate 180 // TweenMax.set(this.DOM.paginationItemsLoader, {scaleX: 0}); 181 // TweenMax.to(this.DOM.activePaginationItemLoader, this.config.slideshow.pagination.duration, { 182 // startAt: {scaleX: 0}, 183 // scaleX: 1, 184 // }); 185 186 187 } 188 189 } 190 191 const slideshow = new Slideshow(document.querySelector('.slideshow')); 192 } 193 194 /*----------------------------------------------------------------- 195 2. >>> Product Cat Slider 196 ----------------------------------------------------------------*/ 197 if ($(".home_product_cat_section").length > 0) { 198 var swiper = new Swiper(".home_product_cat_slider", { 199 //slidesPerView:'auto', 200 //initialSlide: 4, 201 speed: 800, 202 slidesPerView: 1, 203 slidesPerGroup: 1, 204 //centeredSlides: true, 205 //paginationClickable: true, 206 loop: true, 207 spaceBetween: 10, 208 // slideToClickedSlide: true, 209 // autoplay: { 210 // delay: 2300, 211 // disableOnInteraction: false, 212 // pauseOnMouseEnter: true, 213 // }, 214 // pagination: { 215 // el: ".swiper-pagination", 216 // clickable: true, 217 // }, 218 navigation: { 219 nextEl: ".swiper-button-next", 220 prevEl: ".swiper-button-prev", 221 }, 222 breakpoints: { 223 640: { 224 slidesPerView: 2, 225 slidesPerGroup: 2, 226 }, 227 768: { 228 slidesPerView: 3, 229 slidesPerGroup:3, 230 }, 231 1024: { 232 slidesPerView: 4, 233 slidesPerGroup:4, 234 }, 235 1400: { 236 slidesPerView: 5, 237 slidesPerGroup: 5, 238 }, 239 } 240 }); 241 } 242 /*----------------------------------------------------------------- 243 3. >>> Tooltip 244 ----------------------------------------------------------------*/ 245 if ($(".tooltips").length > 0) { 246 $('.tooltips').append("<span></span>"); 247 $('.tooltips:not([tooltip-position])').attr('tooltip-position','bottom'); 248 249 250 $(".tooltips").mouseenter(function(){ 251 $(this).find('span').empty().append($(this).attr('tooltip')); 252 }); 253 } 254 /*----------------------------------------------------------------- 255 4. >>> Logoes 256 ----------------------------------------------------------------*/ 257 if ($(".footer_logoes_area").length > 0) { 258 // var swiper = new Swiper(".footer_logoes_area_slier", { 259 // //slidesPerView:'auto', 260 // //initialSlide: 4, 261 // speed: 4000, 262 // slidesPerView: 3, 263 // //centeredSlides: true, 264 // paginationClickable: true, 265 // loop: true, 266 // spaceBetween: 30, 267 // slideToClickedSlide: true, 268 // autoplay: { 269 // delay: 2300, 270 // disableOnInteraction: false, 271 // pauseOnMouseEnter: true, 272 // }, 273 // pagination: { 274 // el: ".swiper-pagination", 275 // clickable: true, 276 // }, 277 // navigation: { 278 // nextEl: ".swiper-button-next", 279 // prevEl: ".swiper-button-prev", 280 // }, 281 // breakpoints: { 282 // 640: { 283 // slidesPerView: 3, 284 // }, 285 // 768: { 286 // slidesPerView: 4, 287 // }, 288 // 1024: { 289 // slidesPerView: 6, 290 // }, 291 // } 292 293 // }); 294 295 var swiper2 = new Swiper(".footer_logoes_area_slier", { 296 spaceBetween: 30, 297 slidesPerView: 2, 298 //centeredSlides: true, 299 loop: true, 300 // autoplay: { 301 // delay: 2000,
302 // disableOnInteraction: false, 303 // }, 304 //speed:2000, 305 pagination: { 306 el: ".swiper-pagination", 307 clickable: true, 308 }, 309 navigation: { 310 nextEl: ".swiper-button-next", 311 prevEl: ".swiper-button-prev", 312 }, 313 breakpoints: { 314 639: { 315 slidesPerView: 2, 316 }, 317 640: { 318 slidesPerView: 3, 319 }, 320 768: { 321 slidesPerView: 4, 322 }, 323 1024: { 324 slidesPerView: 6, 325 }, 326 } 327 }); 328 329 330 $('.swiper-slide').hover(function(){ 331 swiper2.autoplay.stop(); 332 }, function(){ 333 swiper2.autoplay.start(); 334 }); 335 336 } 337 338 /*----------------------------------------------------------------- 339 5. >>> Testimonial 340 ----------------------------------------------------------------*/ 341 if ($(".testimonial_sec").length > 0) { 342 var swiper = new Swiper(".testimonial_slider", { 343 //loop: true, 344 autoplay: { 345 delay: 2500, 346 disableOnInteraction: false, 347 pauseOnMouseEnter: true, 348 }, 349 pagination: { 350 el: ".swiper-pagination", 351 clickable: true, 352 }, 353 }); 354 } 355 356 /*-------------------------------------------------------------- 357 6. >>> Faq 358 ----------------------------------------------------------------*/ 359 $faqlist = function () { 360 $(".accordion_lst").accordion({ 361 header: "div.faq_questions", 362 active: false, 363 collapsible: true, 364 heightStyle: "content", 365 366 }); 367 }; 368 369 if ($(".faq_list").length > 0) { 370 $faqlist(); 371 } 372 373 374 375 $("div.tabtitle_formobile").click(function () { 376 $(this).next().slideToggle(500); 377 $("div.woocommerce-Tabs-panel").not($(this).next()).slideUp(500); 378 $(this).toggleClass("acc_open"); 379 }); 380 381 382 /*----------------------------------------------------------------- 383 7. >>> News Related-Products 384 ----------------------------------------------------------------*/ 385 if ($(".news_related_products_sec").length > 0) { 386 $('.news_related_products ul.products').slick({ 387 slidesToShow: 4, 388 slidesToScroll: 1, 389 autoplay: true, 390 autoplaySpeed: 4000, 391 //autoplaySpeed: 0, 392 //speed: 8000, 393 responsive: [ 394 { 395 breakpoint: 1024, 396 settings: { 397 slidesToShow: 3, 398 } 399 }, 400 { 401 breakpoint: 767, 402 settings: { 403 slidesToShow: 2, 404 } 405 }, 406 { 407 breakpoint: 480, 408 settings: { 409 slidesToShow: 1, 410 slidesToScroll: 1 411 } 412 } 413 ] 414 }); 415 416 } 417 /*-------------------------------------------------------------- 418 8. >>> Search 419 ----------------------------------------------------------------*/ 420 $("a.searchbutton").click(function(){ 421 $(".search_box_sec").toggleClass('search_box_open'); 422 }); 423 /*-------------------------------------------------------------- 424 9. >>> Product Cat Close Button 425 ----------------------------------------------------------------*/ 426 if($('body').hasClass('tax-product_cat') || $('body').hasClass('tax-product_tag') || ajaxobj.is_woo_tax_page==1) 427 { 428 $('a.clear_filter_btn').show(); 429 if($('.awf-filters-form').length>0) 430 { 431 $('.awf-filters-form .awf-filter-container').each(function(){ 432 if($(this).hasClass('awf-active')) 433 { 434 $(this).closest('.awf-filter-wrapper').removeClass('awf-collapsed'); 435 } 436 }); 437 } 438 } 439 if($('body').hasClass('post-type-archive')) 440 { 441 var url = window.location.href; 442 if( url.includes('?') ) 443 { 444 $('a.clear_filter_btn').show(); 445 if($('.awf-filters-form').length>0) 446 { 447 $('.awf-filters-form .awf-filter-container').each(function(){ 448 if($(this).hasClass('awf-active')) 449 { 450 $(this).closest('.awf-filter-wrapper').removeClass('awf-collapsed'); 451 } 452 }); 453 } 454 } 455 } 456 $(document).on( 'awf_after_ajax_products_update', function() 457 { 458 var url = window.location.href; 459 if( url.includes('?') ) 460 { 461 $('a.clear_filter_btn').show(); 462 if($('.awf-filters-form').length>0) 463 { 464 $('.awf-filters-form .awf-filter-container').each(function(){ 465 if($(this).hasClass('awf-active')) 466 { 467 $(this).closest('.awf-filter-wrapper').removeClass('awf-collapsed'); 468 } 469 }); 470 } 471 } 472 else 473 { 474 $('a.clear_filter_btn').hide(); 475 } 476 }); 477 478 if( $('body.single-product .type-product').hasClass('product-type-external') ) 479 { 480 $('.qty_add_to_cart_wishlist .cart').unbind('submit'); 481 } 482 483 /*-------------------------------------------------------------- 484 10. >>> Filter Mobile Popup Close Button 485 ----------------------------------------------------------------*/ 486 487 $(".offcanvas .awf-filters-container ul li label,.awf-filter-container awf-product-search-container.awf-active").click(function(){ 488 $(".offcanvas").removeClass("show"); 489 $(".offcanvas-backdrop").remove(); 490 491 }); 492 /*-------------------------------------------------------------- 493 11. >>> Slider 494 ----------------------------------------------------------------*/ 495 if ($(".available_single_slider_mobile").length > 0) { 496 var init = false;
497 var pricingCardSwiper; 498 function swiperCard() { 499 if (window.innerWidth <= 991) { 500 if (!init) { 501 init = true; 502 pricingCardSwiper = new Swiper(".available_single_slider_mobile", { 503 slidesPerView: "1", 504 spaceBetween: 0, 505 speed: 4000, 506 grabCursor: true, 507 keyboard: true, 508 autoHeight: false, 509 autoplay: { 510 delay: 4300, 511 disableOnInteraction: false, 512 pauseOnMouseEnter: true, 513 }, 514 navigation: { 515 nextEl: '.swiper-button-next-available_single_slider', 516 prevEl: '.swiper-button-prev-available_single_slider', 517 }, 518 // pagination: { 519 // el: '.swiper-pagination', 520 // clickable: true, 521 // }, 522 breakpoints: { 523 768: { 524 slidesPerView: 2, 525 spaceBetween: 10, 526 } 527 }, 528 }); 529 } 530 } else if (init) { 531 pricingCardSwiper.destroy(); 532 init = false; 533 } 534 } 535 swiperCard(); 536 window.addEventListener("resize", swiperCard); 537 538 } 539 540 /*-------------------------------------------------------------- 541 12. >>> Mmenu Mobile 542 ----------------------------------------------------------------*/ 543 if ($("#mobilenavigation").length > 0) { 544 new Mmenu("#mobilenavigation", { 545 onClick : { 546 close : true, 547 preventDefault : false, 548 }, 549 offCanvas: { 550 position: "right-front", 551 }, 552 counters: { 553 add: true, 554 }, 555 iconPanels: { 556 add: true, 557 visible: 1, 558 }, 559 navbars: [ 560 { 561 position: "top", 562 content: ["title", "prev", "close"], 563 }, 564 { 565 position: "bottom", 566 content: [ 567 "<span class='menutext'>Say Hello</span>", 568 "<a class='phonenumber' href='tel:" + 569 ajaxobj.header_phone_number + 570 "'> <span class='icon-phone-icon-one'></span>" + 571 ajaxobj.header_phone_number + 572 "</a>", 573 ], 574 }, 575 ], 576 }); 577 578 } 579 580 wow = new WOW( 581 { 582 boxClass: 'wow', // default 583 animateClass: 'animated', // default 584 offset: 100, // default 585 mobile: false, // default 586 live: true // default 587 } 588 ) 589 wow.init(); 590 591 if( $(document).find('.dw-estimated-bac').length ) 592 { 593 $(document).find('.dw-estimated-bac .ginput_container_number').append('%'); 594 } 595 596 //Ref::https://wordpress.stackexchange.com/questions/342148/list-of-js-events-in-the-woocommerce-frontend 597 function updateCartCount() { 598 $.ajax({ 599 url: ajaxobj.ajax_url, 600 data: { 601 action: 'get_custom_cart_count' 602 }, 603 type: 'POST', 604 success: function(data) { 605 $('span.cart_count_header').text(data); 606 }, 607 error: function(xhr, textStatus, errorThrown) { 608 console.log('Error:', xhr, textStatus, errorThrown); 609 } 610 }); 611 } 612 $(document.body) .on( 'removed_from_cart updated_cart_totals wc_cart_emptied', function() 613 { 614 console.log("cart Updated"); 615 // Call the updateCartCount function 616 updateCartCount(); 617 } ); 618 if ($(".woocommerce-tabs ul.tabs").length > 0 && $(window).width() >= 991.98) { 619 620 var $tabs = $('.woocommerce-tabs ul.tabs'); 621 var $wrapper = $('.woocommerce-tabs'); 622 623 function checkTabsOverflow() { 624 if (!$tabs[0]) return; 625 626 if ($tabs[0].scrollWidth > $tabs[0].clientWidth) { 627 $wrapper.addClass('has-scroll'); 628 } else { 629 $wrapper.removeClass('has-scroll'); 630 } 631 632 updateArrowVisibility(); 633 } 634 635 function updateArrowVisibility() { 636 var scrollLeft = $tabs.scrollLeft(); 637 var maxScroll = $tabs[0].scrollWidth - $tabs[0].clientWidth; 638 639 // LEFT arrow 640 if (scrollLeft <= 5) { 641 $('.tab-arrow.left').hide(); 642 } else { 643 $('.tab-arrow.left').show(); 644 } 645 646 // RIGHT arrow 647 if (scrollLeft >= maxScroll - 5) { 648 $('.tab-arrow.right').hide(); 649 } else { 650 $('.tab-arrow.right').show(); 651 } 652 } 653 654 // Initial check 655 checkTabsOverflow(); 656 657 // On resize 658 $(window).on('resize', function(){ 659 checkTabsOverflow(); 660 }); 661 662 // On scroll (important) 663 $tabs.on('scroll', function(){ 664 updateArrowVisibility(); 665 }); 666 667 // Arrow click 668 $('.tab-arrow.left').on('click', function(){ 669 $tabs.animate({ scrollLeft: "-=200" }, 300); 670 }); 671 672 $('.tab-arrow.right').on('click', function(){ 673 $tabs.animate({ scrollLeft: "+=200" }, 300); 674 }); 675 676 } 677 678 679});
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.