1(function ($, window) { 2 "use strict"; 3 4 var WooLentorBlocks = { 5 /** 6 * [init] 7 * @return {[void]} Initial Function 8 */ 9 init: function () { 10 this.TabsMenu($(".ht-tab-menus"), ".ht-tab-pane"); 11 this.TabsMenu($(".woolentor-product-video-tabs"), ".video-cus-tab-pane"); 12 if ($("[class*='woolentorblock-'] .ht-product-image-slider").length > 0) { 13 this.productImageThumbnailsSlider($(".ht-product-image-slider")); 14 } 15 this.thumbnailsimagescontroller(); 16 this.ThumbNailsTabs( 17 ".woolentor-thumbanis-image", 18 ".woolentor-advance-product-image-area" 19 ); 20 }, 21 22 /** 23 * [TabsMenu] Active first menu item 24 */ 25 TabsMenu: function ($tabmenus, $tabpane) { 26 $tabmenus.on("click", "a", function (e) { 27 e.preventDefault(); 28 var $this = $(this), 29 $target = $this.attr("href"); 30 $this 31 .addClass("htactive") 32 .parent() 33 .siblings() 34 .children("a") 35 .removeClass("htactive"); 36 $($tabpane + $target) 37 .addClass("htactive") 38 .siblings() 39 .removeClass("htactive"); 40 41 // slick refresh 42 if ($(".slick-slider").length > 0) { 43 var $id = $this.attr("href"); 44 $($id).find(".slick-slider").slick("refresh"); 45 } 46 }); 47 }, 48 49 /** 50 * 51 * @param {TabMen area selector} $tabmenu 52 * @param {Image Area} $area 53 */ 54 ThumbNailsTabs: function ($tabmenu, $area) { 55 $($tabmenu).on("click", "li", function (e) { 56 e.preventDefault(); 57 var $image = $(this).data("wlimage"); 58 if ($image) { 59 $($area) 60 .find(".woocommerce-product-gallery__image .wp-post-image") 61 .attr("src", $image); 62 $($area) 63 .find(".woocommerce-product-gallery__image .wp-post-image") 64 .attr("srcset", $image); 65 } 66 }); 67 }, 68 69 /** 70 * Slick Slider 71 */ 72 initSlickSlider: function ($block) { 73 $($block).css("display", "block"); 74 var settings = WooLentorBlocks.sanitizeObject($($block).data("settings")); 75 if (settings) { 76 var arrows = settings["arrows"]; 77 var dots = settings["dots"]; 78 var autoplay = settings["autoplay"]; 79 var rtl = settings["rtl"]; 80 var autoplay_speed = parseInt(settings["autoplay_speed"]) || 3000; 81 var animation_speed = parseInt(settings["animation_speed"]) || 300; 82 var fade = false;
83 var pause_on_hover = settings["pause_on_hover"]; 84 var display_columns = parseInt(settings["product_items"]) || 4; 85 var scroll_columns = parseInt(settings["scroll_columns"]) || 4; 86 var tablet_width = parseInt(settings["tablet_width"]) || 800; 87 var tablet_display_columns = 88 parseInt(settings["tablet_display_columns"]) || 2; 89 var tablet_scroll_columns = 90 parseInt(settings["tablet_scroll_columns"]) || 2; 91 var mobile_width = parseInt(settings["mobile_width"]) || 480; 92 var mobile_display_columns = 93 parseInt(settings["mobile_display_columns"]) || 1; 94 var mobile_scroll_columns = 95 parseInt(settings["mobile_scroll_columns"]) || 1; 96 97 $($block) 98 .not(".slick-initialized") 99 .slick({ 100 arrows: arrows, 101 prevArrow: 102 '<button type="button" class="slick-prev" aria-label="Previous slide"><i class="fa fa-angle-left" aria-hidden="true"></i></button>', 103 nextArrow: 104 '<button type="button" class="slick-next" aria-label="Next slide"><i class="fa fa-angle-right" aria-hidden="true"></i></button>', 105 dots: dots, 106 infinite: true, 107 autoplay: autoplay, 108 autoplaySpeed: autoplay_speed, 109 speed: animation_speed, 110 fade: fade, 111 pauseOnHover: pause_on_hover, 112 slidesToShow: display_columns, 113 slidesToScroll: scroll_columns, 114 rtl: rtl, 115 responsive: [ 116 { 117 breakpoint: tablet_width, 118 settings: { 119 slidesToShow: tablet_display_columns, 120 slidesToScroll: tablet_scroll_columns, 121 }, 122 }, 123 { 124 breakpoint: mobile_width, 125 settings: { 126 slidesToShow: mobile_display_columns, 127 slidesToScroll: mobile_scroll_columns, 128 }, 129 }, 130 ], 131 }); 132 133 // A11y fix: Slick adds role="listbox" to .slick-track which is semantically 134 // incorrect for a carousel and triggers a Lighthouse accessibility failure. 135 $($block).find(".slick-track").removeAttr("role"); 136 } 137 }, 138 139 /** 140 * Slick Nav For As Slider Initial 141 * @param {*} $sliderwrap 142 */ 143 initSlickNavForAsSlider: function ($sliderwrap) { 144 $($sliderwrap).find(".woolentor-learg-img").css("display", "block"); 145 $($sliderwrap).find(".woolentor-thumbnails").css("display", "block"); 146 var settings = WooLentorBlocks.sanitizeObject($($sliderwrap).data("settings")); 147 148 if (settings) { 149 $($sliderwrap) 150 .find(".woolentor-learg-img") 151 .not(".slick-initialized") 152 .slick({ 153 slidesToShow: 1, 154 slidesToScroll: 1, 155 dots: settings["mainslider"].dots, 156 arrows: settings["mainslider"].arrows, 157 fade: false, 158 asNavFor: ".woolentor-thumbnails", 159 prevArrow: 160 '<button type="button" class="woolentor-slick-large-prev" aria-label="Previous image"><i class="sli sli-arrow-left" aria-hidden="true"></i></button>', 161 nextArrow: 162 '<button type="button" class="woolentor-slick-large-next" aria-label="Next image"><i class="sli sli-arrow-right" aria-hidden="true"></i></button>', 163 }); 164 $($sliderwrap) 165 .find(".woolentor-thumbnails") 166 .not(".slick-initialized") 167 .slick({ 168 slidesToShow: settings["thumbnailslider"].slider_items, 169 slidesToScroll: 1, 170 asNavFor: ".woolentor-learg-img", 171 centerMode: false, 172 dots: false, 173 arrows: settings["thumbnailslider"].arrows, 174 vertical: settings["thumbnailslider"].slidertype, 175 focusOnSelect: true, 176 prevArrow: 177 '<button type="button" class="woolentor-slick-prev" aria-label="Previous thumbnail"><i class="sli sli-arrow-left" aria-hidden="true"></i></button>', 178 nextArrow: 179 '<button type="button" class="woolentor-slick-next" aria-label="Next thumbnail"><i class="sli sli-arrow-right" aria-hidden="true"></i></button>', 180 }); 181 182 // A11y fix: remove semantically incorrect role="listbox" Slick adds to .slick-track. 183 $($sliderwrap).find(".slick-track").removeAttr("role"); 184 } 185 }, 186 187 /** 188 * Accordion 189 */ 190 initAccordion: function ($block) { 191 var settings = $($block).data("settings"); 192 if ($block.length > 0) { 193 var $id = $block.attr("id"); 194 new Accordion("#" + $id, { 195 duration: 500, 196 showItem: settings.showitem, 197 elementClass: "htwoolentor-faq-card", 198 questionClass: "htwoolentor-faq-head", 199 answerClass: "htwoolentor-faq-body", 200 }); 201 } 202 }, 203 204 /** 205 * Senitize HTML 206 */ 207 sanitizeHTML: function (str) { 208 if( str ){ 209 return str.replace(/[&<>"']/g, function (c) { 210 switch (c) { 211 case '&': return '&'; 212 case '<': return '<'; 213 case '>': return '>'; 214 case '"': return '"';
215 case "'": return '''; 216 default: return c; 217 } 218 }); 219 }else{ 220 return ''; 221 } 222 }, 223 224 /** 225 * Object Sanitize 226 */ 227 sanitizeObject: function (inputObj) { 228 const sanitizedObj = {}; 229 230 for (let key in inputObj) { 231 if (inputObj.hasOwnProperty(key)) { 232 let value = inputObj[key]; 233 234 // Sanitize based on the value type 235 if (typeof value === 'string') { 236 // Sanitize strings to prevent injection 237 sanitizedObj[key] = WooLentorBlocks.sanitizeHTML(value); 238 } else if (typeof value === 'number') { 239 // Ensure numbers are valid (you could also set limits if needed) 240 sanitizedObj[key] = Number.isFinite(value) ? value : 0; 241 } else if (typeof value === 'boolean') { 242 // Keep boolean values as they are 243 sanitizedObj[key] = value; 244 } else { 245 // Handle other types if needed (e.g., arrays, objects) 246 sanitizedObj[key] = value; 247 } 248 } 249 } 250 251 return sanitizedObj; 252 }, 253 254 /* 255 * Tool Tip 256 */ 257 woolentorToolTips: function (element, content) { 258 if (content == "html") { 259 var tipText = element.text(); 260 } else { 261 var tipText = element.attr("title"); 262 } 263 element.on("mouseover", function () { 264 if ($(".woolentor-tip").length == 0) { 265 element.before('<span class="woolentor-tip">' + WooLentorBlocks.sanitizeHTML(tipText) + "</span>"); 266 $(".woolentor-tip").css("transition", "all 0.5s ease 0s"); 267 $(".woolentor-tip").css("margin-left", 0); 268 } 269 }); 270 element.on("mouseleave", function () { 271 $(".woolentor-tip").remove(); 272 }); 273 }, 274 275 woolentorToolTipHandler: function () { 276 $("a.woolentor-compare").each(function () { 277 WooLentorBlocks.woolentorToolTips($(this), "title"); 278 }); 279 $( 280 ".woolentor-cart a.add_to_cart_button,.woolentor-cart a.added_to_cart,.woolentor-cart a.button" 281 ).each(function () { 282 WooLentorBlocks.woolentorToolTips($(this), "html"); 283 }); 284 }, 285 286 /* 287 * Universal product 288 */ 289 productImageThumbnailsSlider: function ($slider) { 290 $slider.slick({ 291 dots: true, 292 arrows: true, 293 prevArrow: 294 '<button type="button" class="slick-prev" aria-label="Previous image"><i class="sli sli-arrow-left" aria-hidden="true"></i></button>', 295 nextArrow: 296 '<button type="button" class="slick-next" aria-label="Next image"><i class="sli sli-arrow-right" aria-hidden="true"></i></button>', 297 }); 298 299 // A11y fix: remove semantically incorrect role="listbox" Slick adds to .slick-track. 300 $slider.find(".slick-track").removeAttr("role"); 301 }, 302 303 thumbnailsimagescontroller: function () { 304 this.TabsMenu($(".ht-product-cus-tab-links"), ".ht-product-cus-tab-pane"); 305 this.TabsMenu($(".ht-tab-menus"), ".ht-tab-pane"); 306 307 // Countdown 308 $(".ht-product-countdown").each(function () { 309 var $this = $(this), 310 finalDate = $(this).data("countdown"); 311 var customlavel = $(this).data("customlavel"); 312 $this.countdown(finalDate, function (event) { 313 $this.html( 314 event.strftime( 315 '<div class="cd-single"><div class="cd-single-inner"><h3>%D</h3><p>' + 316 WooLentorBlocks.sanitizeHTML(customlavel.daytxt) + 317 '</p></div></div><div class="cd-single"><div class="cd-single-inner"><h3>%H</h3><p>' + 318 WooLentorBlocks.sanitizeHTML(customlavel.hourtxt) + 319 '</p></div></div><div class="cd-single"><div class="cd-single-inner"><h3>%M</h3><p>' + 320 WooLentorBlocks.sanitizeHTML(customlavel.minutestxt) + 321 '</p></div></div><div class="cd-single"><div class="cd-single-inner"><h3>%S</h3><p>' + 322 WooLentorBlocks.sanitizeHTML(customlavel.secondstxt) + 323 "</p></div></div>" 324 ) 325 ); 326 }); 327 }); 328 }, 329 330 /** 331 * Single Product Quantity Increase/decrease manager 332 */ 333 quantityIncreaseDescrease: function ($area) { 334 $area 335 .find("form.cart") 336 .on( 337 "click", 338 "span.wl-quantity-plus, span.wl-quantity-minus", 339 function () { 340 const poductType = $area.data("producttype"); 341 // Get current quantity values 342 if ("grouped" != poductType) { 343 var qty = $(this).closest("form.cart").find(".qty:visible"); 344 var val = parseFloat(qty.val()); 345 var min_val = 1; 346 } else { 347 var qty = $(this) 348 .closest(".wl-quantity-grouped-cal") 349 .find(".qty:visible"); 350 var val = !qty.val() ? 0 : parseFloat(qty.val()); 351 var min_val = 0; 352 } 353 354 var max = parseFloat(qty.attr("max")); 355 var min = parseFloat(qty.attr("min")); 356 var step = parseFloat(qty.attr("step")); 357 358 // Change the value if plus or minus 359 if ($(this).is(".wl-quantity-plus")) { 360 if (max && max <= val) { 361 qty.val(max); 362 } else { 363 qty.val(val + step); 364 } 365 } else { 366 if (min && min >= val) { 367 qty.val(min); 368 } else if (val > min_val) { 369 qty.val(val - step); 370 } 371 } 372 } 373 ); 374 }, 375 376 CartTableHandler: function () { 377 // Product Details Slide Toggle 378 $('body').on("click", '[class*="woolentorblock-"] .woolentor-cart-product-details-toggle', function (e) { 379 e.preventDefault(); 380 381 const $target = $(this).data('target'); 382 383 if($(`[data-id="${$target}"]`).is(':hidden')) { 384 $(`[data-id="${$target}"]`).slideDown(); 385 } else { 386 $(`[data-id="${$target}"]`).slideUp(); 387 } 388 }); 389 }, 390 391 /** 392 * Initialize View Switcher for Grid/List Tab Layout 393 */ 394 viewSwitcher: function ( $grid, $selector, $style = 'modern' ) { 395 const $viewButtons = $grid.find( '.woolentor-layout-btn' ); 396 397 if ( $viewButtons.length === 0 ) { 398 return; // No view switcher, probably grid or list only mode 399 } 400 401 $viewButtons.on( 'click', function( e ) { 402 e.preventDefault(); 403 404 const $this = $(this); 405 const layout = $this.data('layout'); 406 const $gridContainer = $this.closest('.woolentor-product-grid, .woolentor-filters-enabled').find($selector); 407 408 // console.log($gridContainer,$selector, $this); 409 410 // Update active button state 411 $this.siblings().removeClass('woolentor-active'); 412 $this.addClass('woolentor-active'); 413 414 // Update grid container layout classes 415 if ($gridContainer.length > 0) { 416 // Remove existing layout classes from container 417 $gridContainer.removeClass('woolentor-layout-grid woolentor-layout-list'); 418 419 // Add new layout class to container 420 $gridContainer.addClass('woolentor-layout-' + layout); 421 $gridContainer.attr('data-show-layout', layout); 422 423 // Update product card classes 424 const $productCards = $gridContainer.find('.woolentor-product-card'); 425 $productCards.removeClass('woolentor-grid-card woolentor-list-card'); 426 427 if (layout === 'grid') { 428 if($style === 'editorial'){ 429 $productCards.removeClass('woolentor-editorial-list-card'); 430 $productCards.addClass('woolentor-editorial-grid-card'); 431 }else if($style === 'magazine'){ 432 $productCards.removeClass('woolentor-magazine-list-card'); 433 $productCards.addClass('woolentor-magazine-grid-card'); 434 }else{ 435 $productCards.addClass('woolentor-grid-card'); 436 } 437 } else if (layout === 'list') { 438 if($style === 'editorial'){ 439 $productCards.removeClass('woolentor-editorial-grid-card'); 440 $productCards.addClass('woolentor-editorial-list-card'); 441 }else if($style === 'magazine'){ 442 $productCards.removeClass('woolentor-magazine-grid-card'); 443 $productCards.addClass('woolentor-magazine-list-card'); 444 }else{ 445 $productCards.addClass('woolentor-list-card'); 446 } 447 } 448 449 } 450 451 452 // Trigger custom event for potential extensions 453 $grid.trigger( 'woolentor:viewChanged', [ layout ] ); 454 }); 455 }, 456 457 /** 458 * Initialize Quantity Selectors (List View) 459 */ 460 quantitySelectors: function( $grid ) { 461 // Plus button 462 $grid.on( 'click', '.woolentor-qty-plus', function( e ) { 463 e.preventDefault(); 464 465 const $button = $( this ); 466 const $input = $button.siblings( '.woolentor-qty-input' ); 467 const currentValue = parseInt( $input.val() ) || 1; 468 const max = parseInt( $input.attr( 'max' ) ) || 999; 469 470 if ( currentValue < max ) { 471 $input.val( currentValue + 1 ).trigger( 'change' ); 472 } 473 }); 474 475 // Minus button 476 $grid.on( 'click', '.woolentor-qty-minus', function( e ) { 477 e.preventDefault(); 478 479 const $button = $( this ); 480 const $input = $button.siblings( '.woolentor-qty-input' ); 481 const currentValue = parseInt( $input.val() ) || 1; 482 const min = parseInt( $input.attr( 'min' ) ) || 1; 483 484 if ( currentValue > min ) { 485 $input.val( currentValue - 1 ).trigger( 'change' ); 486 } 487 }); 488 489 // Sync quantity input with add to cart button
490 $grid.on( 'change', '.woolentor-qty-input', function() { 491 const $input = $( this ); 492 const quantity = $input.val(); 493 const $cartButton = $input.closest( '.woolentor-product-actions' ).find( '.woolentor-cart-btn' ); 494 495 if ( $cartButton.length ) { 496 $cartButton.attr( 'data-quantity', quantity ); 497 } 498 }); 499 }, 500 501 /** 502 * LoadMore Product Ajax Action handeler 503 * @param {String} gridArea // gridArea area Selector 504 */ 505 loadMore: function( $gridArea ){ 506 507 let loadMoreButton = $gridArea.find('.woolentor-load-more-btn'); 508 509 if (loadMoreButton.length > 0) { 510 511 loadMoreButton.on('click', function(e) { 512 e.preventDefault(); 513 514 const $button = loadMoreButton; 515 const uniqIdentifire = $button.data('grid-id'); 516 const $loader = $button.siblings('.woolentor-ajax-loader'); 517 const $grid = $('#' + uniqIdentifire); 518 const currentPage = parseInt($button.data('page')); 519 const maxPages = parseInt($button.data('max-pages')); 520 const dataLayout = $grid.attr('data-show-layout'); 521
522 const loadMoreWrapper = $('.' + uniqIdentifire).find('.woolentor-ajax-enabled'); 523 524 if (currentPage > maxPages) { 525 return; 526 } 527 528 $button.hide(); 529 $loader.show(); 530 531 let settings = loadMoreWrapper.attr( 'data-wl-widget-settings' ); 532 533 // Prepare AJAX data 534 const ajaxData = { 535 action: 'woolentor_load_more_products', 536 nonce: typeof window?.woolentorLocalizeData !== 'undefined' ? window?.woolentorLocalizeData.security : '', 537 page: currentPage, 538 settings: settings, 539 viewlayout: typeof dataLayout === 'undefined' ? '' : dataLayout 540 }; 541 542 // AJAX request to load more products 543 $.ajax({ 544 url: typeof window?.woolentorLocalizeData !== 'undefined' ? window?.woolentorLocalizeData.ajaxUrl : '', 545 type: 'POST', 546 data: ajaxData, 547 success: function(response) { 548 if (response.success && response.data.html) { 549 550 // Append new products 551 const $newProducts = $(response.data.html); 552 $grid.append($newProducts); 553 554 // Update page counter 555 $button.data('page', currentPage+1); 556 557 // Show button if more pages available 558 if (currentPage < maxPages) { 559 $button.show(); 560 } else { 561 $button.text($button.data('complete-loadtxt')).prop('disabled', true).show(); 562 } 563 } 564 $loader.hide(); 565 }, 566 error: function(xhr, status, error) { 567 $loader.hide(); 568 $button.show(); 569 console.log("Status:", status, "Error:", error); 570 } 571 }); 572 }); 573 } 574 575 }, 576 577 infiniteScroll: function($gridArea){ 578 579 let selectorBtn = $gridArea.find('.woolentor-infinite-scroll'); 580 581 let isLoading = false; 582 const uniqIdentifire = selectorBtn.data('grid-id'); 583 const productLoadWrapper = $('.' + uniqIdentifire).find('.woolentor-ajax-enabled'); 584 const $loader = selectorBtn.find('.woolentor-ajax-loader'); 585 const $grid = $('#' + uniqIdentifire); 586 const paginationArea = productLoadWrapper.find('.woolentor-pagination-infinite'); 587 588 function loadMoreOnScroll() { 589 if (isLoading) return; 590 591 // Calculate trigger point based on product grid bottom position 592 const gridOffset = $grid?.offset()?.top; 593 const gridHeight = $grid.outerHeight(); 594 const gridBottom = gridOffset + gridHeight; 595 const scrollTop = $(window).scrollTop(); 596 const windowHeight = $(window).height(); 597 const triggerPoint = gridBottom - windowHeight - 100; // 100px before grid end 598 599 if (scrollTop >= triggerPoint) { 600 const currentPage = parseInt(selectorBtn.data('page')); 601 const maxPages = parseInt(selectorBtn.data('max-pages')); 602 603 if (currentPage > maxPages) { 604 $(window).off('scroll', loadMoreOnScroll); 605 return; 606 } 607 608 paginationArea.css('margin-top', '30px'); 609 isLoading = true; 610 $loader.show(); 611 612 let settings = productLoadWrapper.attr( 'data-wl-widget-settings' ); 613 const dataLayout = $grid.attr('data-show-layout'); 614 615 // AJAX request to load more products 616 $.ajax({ 617 url: typeof woolentor_addons !== 'undefined' ? woolentor_addons.woolentorajaxurl : '', 618 type: 'POST', 619 data: { 620 action: 'woolentor_load_more_products', 621 nonce: typeof woolentor_addons !== 'undefined' ? woolentor_addons.ajax_nonce : '', 622 page: currentPage, 623 settings: settings, 624 viewlayout: typeof dataLayout === 'undefined' ? '' : dataLayout 625 }, 626 success: function(response) { 627 if (response.success && response.data.html) { 628 // Append new products 629 const $newProducts = $(response.data.html); 630 $grid.append($newProducts); 631 632 // Update page counter 633 selectorBtn.data('page', currentPage + 1); 634 635 // Check if we've reached the last page 636 if (currentPage > maxPages) { 637 $(window).off('scroll', loadMoreOnScroll); 638 selectorBtn.remove(); 639 } 640 } 641 }, 642 complete: function() { 643 $loader.hide(); 644 isLoading = false;
645 paginationArea.css('margin-top', '0'); 646 }, 647 error: function() { 648 $loader.hide(); 649 isLoading = false; 650 } 651 }); 652 } 653 } 654 655 // Bind scroll event 656 $(window).on('scroll', loadMoreOnScroll); 657 658 }, 659 660 // Product Grid Related Script 661 initProductGridModern: function(){ 662 // Initialize all product grids on the page 663 $( "[class*='woolentorblock-'] .woolentor-product-grid" ).each( function() { 664 const $grid = $( this ); 665 666 if( $grid.hasClass('woolentor-style-editorial') ) { 667 WooLentorBlocks.viewSwitcher( $grid, '.woolentor-product-grid-editorial', 'editorial' ); 668 }else if( $grid.hasClass('woolentor-style-magazine') ) { 669 WooLentorBlocks.viewSwitcher( $grid, '.woolentor-product-grid-magazine', 'magazine' ); 670 }else{ 671 WooLentorBlocks.viewSwitcher( $grid, '.woolentor-product-grid-modern' ); 672 } 673 674 // Quantity Selectors 675 WooLentorBlocks.quantitySelectors( $grid ); 676 677 // LoadMore 678 WooLentorBlocks.loadMore($grid); 679 680 // Infinite Scroll 681 WooLentorBlocks.infiniteScroll($grid); 682 }); 683 684 } 685 686 687 688 }; 689 690 $(document).ready(function () { 691 WooLentorBlocks.init(); 692 WooLentorBlocks.CartTableHandler(); 693 WooLentorBlocks.initProductGridModern(); 694 695 $("[class*='woolentorblock-'] .product-slider").each(function () { 696 WooLentorBlocks.initSlickSlider($(this)); 697 }); 698 699 $("[class*='woolentorblock-'].woolentor-block-slider-navforas").each( 700 function () { 701 WooLentorBlocks.initSlickNavForAsSlider($(this)); 702 } 703 ); 704 705 $("[class*='woolentorblock-'] .htwoolentor-faq").each(function () { 706 WooLentorBlocks.initAccordion($(this)); 707 }); 708 709 $("[class*='woolentorblock-'].woolentor-product-addtocart").each( 710 function () { 711 WooLentorBlocks.quantityIncreaseDescrease($(this)); 712 } 713 ); 714 715 /** 716 * Tooltip Manager 717 */ 718 WooLentorBlocks.woolentorToolTipHandler(); 719 }); 720 721 // For Editor Mode Slider 722 document.addEventListener( 723 "WoolentorEditorModeSlick", 724 function (event) { 725 let editorMainArea = $(".block-editor__container"), 726 editorIframe = $("iframe.edit-site-visual-editor__editor-canvas"), 727 productSliderDiv = 728 editorIframe.length > 0 729 ? editorIframe 730 .contents() 731 .find("body.block-editor-iframe__body") 732 .find( 733 `.woolentorblock-editor-${event.detail.uniqid} .product-slider` 734 ) 735 : editorMainArea.find( 736 `.woolentorblock-editor-${event.detail.uniqid} .product-slider` 737 ); 738 window.setTimeout( 739 WooLentorBlocks.initSlickSlider(productSliderDiv), 740 1000 741 ); 742 }, 743 false 744 ); 745 746 // For Editor Mode Nav For As Slider 747 document.addEventListener( 748 "WoolentorEditorModeNavForSlick", 749 function (event) { 750 let editorMainArea = $(".block-editor__container"), 751 editorIframe = $("iframe.edit-site-visual-editor__editor-canvas"), 752 navForAsSliderDiv = 753 editorIframe.length > 0 754 ? editorIframe 755 .contents() 756 .find("body.block-editor-iframe__body") 757 .find( 758 `.woolentorblock-editor-${event.detail.uniqid} .woolentor-block-slider-navforas` 759 ) 760 : editorMainArea.find( 761 `.woolentorblock-editor-${event.detail.uniqid} .woolentor-block-slider-navforas` 762 ); 763 window.setTimeout( 764 WooLentorBlocks.initSlickNavForAsSlider(navForAsSliderDiv), 765 1000 766 ); 767 }, 768 false 769 ); 770 771 // Product Grid Modern Editor Script Run 772 document.addEventListener( "wooLentorProductGridModern", function (event) { WooLentorBlocks.initProductGridModern() }, false ); 773 document.addEventListener( "wooLentorProductGridEditorial", function (event) { WooLentorBlocks.initProductGridModern() }, false ); 774 document.addEventListener( "wooLentorProductGridMagazine", function (event) { WooLentorBlocks.initProductGridModern() }, false ); 775 776})(jQuery, window);
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.