1/* 2 Plugin: WooCommerce Product Carousel, Slider & Grid Ultimate 3 Plugin URI: https://wordpress.org/plugins/woo-product-carousel-slider-and-grid-ultimate/ 4 Author: wpWax 5 Version: 1.0 6*/ 7 8document.addEventListener("DOMContentLoaded", function () { 9 (function ($) { 10 11 window.onload = (event) => { 12 console.log('page is fully loaded'); 13 }; 14 15 document.addEventListener('DOMContentLoaded', function () { 16 console.log('Content Loaded'); 17 }); 18 19 20 function alljs() { 21 console.log('JS Loaded'); 22 23 window.addEventListener('load', function() { 24 console.log('Loaded Window'); 25 let lazyLoadContainer = document.querySelectorAll('.wpcu-lazy-load'); 26 console.log({ 27 lazyLoadContainer: lazyLoadContainer, 28 }); 29 if (lazyLoadContainer.length !== 0) { 30 document.querySelectorAll('.wpcu-products').forEach((el) => { 31 el.classList.remove('wpcu-lazy-load'); 32 }) 33 } 34 }); 35 36 37 /* Style reset in buttons p tag */ 38 document.querySelectorAll('.wpcu-button p.woocommerce, p.product').forEach((el, id) => { 39 el.setAttribute('style', 'none'); 40 }); 41 42 /* Lazy load */ 43 let lazyLoadContainer = document.querySelectorAll('.wpcu-lazy-load'); 44 if (lazyLoadContainer.length !== 0) { 45 document.querySelectorAll('.wpcu-products').forEach((el) => { 46 el.classList.remove('wpcu-lazy-load'); 47 }) 48 } 49 50 /* Theme buttons (.wpcu-product__action-icons--boxed) responsive fix */ 51 function btnResFix(selector, breakPoint) { 52 var selectElement = document.querySelectorAll(selector); 53 selectElement.forEach(elm => { 54 if (elm.clientWidth < breakPoint) { 55 elm.classList.add('wpcu-product__content--res-fix'); 56 } 57 }) 58 } 59 btnResFix('.wpcu-theme_8 .wpcu-product__content', 300); 60 btnResFix('.wpcu-theme_7 .wpcu-product__content', 305); 61 btnResFix('.wpcu-theme_10 .wpcu-product__content', 320); 62 63 64 /* Theme 15 tweaks */ 65 var theme15items = document.querySelectorAll('.wpcu-theme_15 .wpcu-product__details__content'); 66 theme15items.forEach(element => { 67 element.closest('.wpcu-product__content').style.paddingBottom = (element.clientHeight - 45) + "px"; 68 }); 69 70 /* Check WPCU Carousel Data */ 71 let checkData = function (data, value) { 72 return typeof data === 'undefined' ? value : data; 73 }; 74 /* WPCU Carousel */ 75 let wpcuCarousel = document.querySelectorAll('.wpcu-carousel'); 76 wpcuCarousel.forEach(function (el) { 77 let swiper = new Swiper(el, { 78 slidesPerView: checkData(parseInt(el.dataset.wpcuItems), 4), 79 spaceBetween: checkData(parseInt(el.dataset.wpcuMargin), 30), 80 loop: checkData(JSON.parse(el.dataset.wpcuLoop.toLowerCase()), false), 81 slidesPerGroup: checkData(parseInt(el.dataset.wpcuPerslide), 4), 82 speed: checkData(parseInt(el.dataset.wpcuSpeed), 3000), 83 autoplay: checkData(JSON.parse(el.dataset.wpcuAutoplay), {}), 84 navigation: { 85 nextEl: '.wpcu-carousel-nav__btn--next', 86 prevEl: '.wpcu-carousel-nav__btn--prev', 87 }, 88 pagination: { 89 el: '.wpcu-carousel-pagination', 90 type: 'bullets', 91 clickable: true 92 }, 93 breakpoints: checkData(JSON.parse(el.dataset.wpcuResponsive), {}) 94 }) 95 }); 96 97 /* Add to cart icon for theme-4, theme-5 and theme-11 */ 98 $(".wpcu-theme_4 .woocommerce a, .wpcu-theme_5 .woocommerce a, .wpcu-theme_9 .woocommerce a").html(` 99 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1056" height="896" preserveAspectRatio="xMidYMid meet" viewBox="-3.63064 -66.0327 1030.76 1000.035" style="-ms-transform: rotate(180deg); -webkit-transform: rotate(180deg); transform: rotate(180deg);"><path d="M1022.74 17.3604l-83.4072 503.777c-7.44043 65.3115 -66.9766 118.432 -132.721 118.432h-70.6562v85.2803c0 130.16 -92.8477 236.032 -222.976 236.032c-130.096 0 -224.943 -105.872 -224.943 -236.032v-85.2803h-76.6719 c-65.7441 0 -125.28 -53.1201 -132.528 -117.056l-77.2803 -504.16c-2.97559 -26.5596 2.22461 -47.5039 15.4082 -62.2881c12.4316 -13.9043 30.5273 -20.9766 53.7432 -20.9766h873.568c32.9121 0 51.7764 13.2158 61.8408 24.3203 c9.21582 10.208 19.6475 28.1436 16.623 57.9512zM352.049 724.865c0 94.8477 66.127 172.031 160.943 172.031c94.816 0 158.977 -77.1836 158.977 -172.031v-85.2803h-319.92zM947.168 -0.446289l-872.498 -0.449219c-5.50391 0 -11.0078 2.94434 -9.71191 10.6885 l77.248 504.096c3.83984 33.4404 35.5039 61.6807 69.1523 61.6807h76.6885v-72.9277c-19.0723 -11.0723 -32.0479 -31.4883 -32.0479 -55.1367c0 -35.3438 28.6562 -64 64 -64s64 28.6562 64 64c0 23.6162 -12.9277 44 -31.9521 55.0879v72.9922h319.904v-72.9922 c-19.0078 -11.0879 -31.9521 -31.4883 -31.9521 -55.0879c0 -35.3438 28.6562 -64 64 -64s64 28.6562 64 64c0 23.6484 -12.9756 44.0645 -32.0479 55.1523v72.9277h70.6562c33.6641 0 65.3125 -28.2559 69.4082 -63.4395l83.3438 -503.28 c0.400391
99-4.0957 -2.81543 -9.31152 -12.1914 -9.31152z"/></svg> 100 `); 101 102 103 /* Marquee wrapper value */ 104 var wpcuStyles = document.createElement('style'); 105 document.head.append(wpcuStyles); 106 wpcuStyles.innerHTML = ` 107 .wpcu-carousel--marquee .swiper-wrapper{ 108 animation: wpcuMarquee var(--wpcu-marqueeSpeed) linear infinite running; 109 } 110 @keyframes wpcuMarquee { 111 0% { 112 transform: translate(0, 0); 113 } 114 100% { 115 transform: translate(var(--wpcu-marqueeItemsWidth), 0); 116 } 117 } 118 `; 119 var wpcuMarqueeCarousel = document.querySelectorAll('.wpcu-carousel--marquee'); 120 wpcuMarqueeCarousel.forEach(elm => { 121 var wpcuMarqueeCarouselItem = elm.querySelectorAll('.wpcu-product:not(.swiper-slide-duplicate)'); 122 wpcuMarqueeCarouselItem.forEach(elmnt => { 123 var wpcuMarqueeWrapperWidth = wpcuMarqueeCarouselItem.length * (elmnt.offsetWidth + checkData(parseInt(elm.dataset.wpcuMargin))); 124 elm.style.setProperty('--wpcu-marqueeItemsWidth', `-${wpcuMarqueeWrapperWidth}px`); 125 elm.style.setProperty('--wpcu-marqueeSpeed', `${checkData(parseInt(elm.dataset.wpcuSpeed))}ms`); 126 }) 127 }); 128 } 129 130 alljs(); 131 132 133 134 /* Elementor Edit Mode */ 135 $(window).on('elementor/frontend/init', function () { 136 setTimeout(() => { 137 if (elementorFrontend.isEditMode()) { 138 alljs(); 139 elementorFrontend.hooks.addAction('frontend/element_ready/widget', function () { 140 alljs(); 141 }); 142 } 143 smallColumnFix('.wpcu-theme_6'); 144 smallColumnFix('.wpcu-theme_7'); 145 }, 6000); 146 setTimeout(() => { 147 alljs(); 148 }, 0); 149 }); 150 151 // window._wpLoadBlockEditor.then( function() { 152 // console.log( 'hooray!' ); 153 // alljs(); 154 // }); 155 156 /* Issue fix in small product columns */ 157 function smallColumnFix(theme) { 158 let themeSixColumns = document.querySelectorAll(`.elementor-widget-container ${theme} .wpcu-product`); 159 themeSixColumns.forEach(elm=>{ 160 elm.offsetWidth < 250 ? elm.classList.add('wpcu-product--fix') : ''; 161 }) 162 } 163 smallColumnFix('.wpcu-theme_6'); 164 smallColumnFix('.wpcu-theme_7'); 165 166 })(jQuery); 167}) 168 169 170// document.addEventListener("DOMContentLoaded", function () { 171// (function ($) { 172// function alljs() { 173// console.log('JS Loaded'); 174 175// var doc = document.querySelector('.wpcu-lazy-load'); 176 177// /* Lazy load */ 178// document.addEventListener('load', function() { 179// console.log('Loaded Window'); 180// var lazyLoadContainer = document.querySelector('.wpcu-lazy-load'); 181// lazyLoadContainer.classList.remove('wpcu-lazy-load'); 182// console.log({ 183// lazyLoadContainer: lazyLoadContainer, 184// }); 185// if (lazyLoadContainer.length !== 0) { 186// document.querySelectorAll('.wpcu-products').forEach((el) => { 187// el.classList.remove('wpcu-lazy-load'); 188// }) 189// } 190// }); 191 192// // let lazyLoadContainer = document.querySelectorAll('.wpcu-lazy-load'); 193// // if (lazyLoadContainer.length !== 0) { 194// // document.querySelectorAll('.wpcu-products').forEach((el) => { 195// // el.classList.remove('wpcu-lazy-load'); 196// // }) 197// // } 198 199// /* WPCU Carousel */ 200// let wpcuCarousel = document.querySelectorAll('.wpcu-carousel'); 201// wpcuCarousel.forEach(function (el) { 202// let swiper = new Swiper(el, { 203// slidesPerView: checkData(parseInt(el.dataset.wpcuItems), 4), 204// spaceBetween: checkData(parseInt(el.dataset.wpcuMargin), 30), 205// loop: checkData(JSON.parse(el.dataset.wpcuLoop.toLowerCase()), false), 206// slidesPerGroup: checkData(parseInt(el.dataset.wpcuPerslide), 4), 207// speed: checkData(parseInt(el.dataset.wpcuSpeed), 3000), 208// autoplay: checkData(JSON.parse(el.dataset.wpcuAutoplay), {}), 209// navigation: { 210// nextEl: '.wpcu-carousel-nav__btn--next', 211// prevEl: '.wpcu-carousel-nav__btn--prev', 212// }, 213// pagination: { 214// el: '.wpcu-carousel-pagination', 215// type: 'bullets', 216// clickable: true 217// }, 218// breakpoints: checkData(JSON.parse(el.dataset.wpcuResponsive), {}) 219// }) 220// }); 221// } 222 223// alljs(); 224// })(jQuery); 225// })
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.