1/** Frequently Bought Together Title */ 2jQuery(document).ready(function ($) { 3 $('.woobt-wrap').before('<h3>Frequently Bought Together</h3>'); 4}); 5/** Frequently Bought Together Title */ 6jQuery(document).ready(function ($) { 7 // Move the Frequently Bought Together block above Related Products 8 var $target = $('section.related.products'); 9 var $woobt = $('.woobt-wrap').closest('div'); // includes <h3> if grouped together 10 11 if ($target.length && $woobt.length) { 12 $woobt.prev('h3').addBack().insertBefore($target); 13 } 14}); 15 16/** Images Icon Slider for Single Product Page */ 17jQuery(document).ready(function ($) { 18 const $slider = $('.slider'); 19 function handleSliderInit() { 20 const windowWidth = window.innerWidth; 21 // Initialize slider only if width <= 1366px 22 if (windowWidth <= 1199) { 23 if (!$slider.hasClass('slick-initialized')) { 24 $slider.slick({ 25 slidesToShow: 2, 26 slidesToScroll: 1, 27 autoplay: true, 28 autoplaySpeed: 5000, 29 arrows: true, 30 dots: false, 31 responsive: [ 32 { 33 breakpoint: 1024, 34 settings: { 35 slidesToShow: 2 36 } 37 }, 38 { 39 breakpoint: 768, 40 settings: { 41 slidesToShow: 1 42 } 43 } 44 ] 45 }); 46 } 47 } else { 48 // Destroy slick if it exists and screen is larger than 1366px 49 if ($slider.hasClass('slick-initialized')) { 50 $slider.slick('unslick'); 51 } 52 } 53 } 54 handleSliderInit(); 55 $(window).on('resize', function () { 56 handleSliderInit(); 57 }); 58}); 59/** Images Icon Slider for Single Product Page */ 60 61/** Popup For detail page */ 62jQuery(function ($) { 63 $('.video-link-2222').on('click', function (e) { 64 e.preventDefault(); 65 $('.popup-overlay, .popup-content').fadeIn().addClass('active'); 66 }); 67 68 $('.popup-overlay, .close').on('click', function () { 69 $('.popup-overlay, .popup-content').fadeOut().removeClass('active'); 70 }); 71}); 72/** Popup For detail page */ 73 74/** Cateory page read less/more content */ 75jQuery(document).ready(function ($) { 76 var $container = $(".categories_list"); 77 var $items = $container.find(".categories_list_item"); 78 79 if ($items.length <= 10) return; // No need for toggle 80 81 // Hide all after the 10th 82 $items.slice(10).hide(); 83 84 // Create the toggle button 85 var $btn = $("<button/>", { 86 text: "Show More", 87 css: { 88 marginTop: "10px", 89 padding: "0", 90 backgroundColor: "transparent", 91 color: "rgb(31 56 130)", 92 fontSize: "14px", 93 textDecoration: "underline", 94 cursor: "pointer" 95 } 96 }); 97 98 // Insert after the list 99 $container.after($btn); 100 101 var expanded = false; 102 $btn.on("click", function () { 103 expanded = !expanded; 104 if (expanded) { 105 $items.slice(10).slideDown(); 106 $btn.text("Show Less"); 107 } else { 108 $items.slice(10).slideUp(); 109 $btn.text("Show More"); 110 } 111 }); 112}); 113 114document.querySelectorAll('.categories_list_item').forEach(item => { 115 item.addEventListener('mouseenter', () => { 116 const title = item.querySelector('.categories_list_title'); 117 title.style.color = '#1F3882'; 118 title.style.textDecoration = 'underline'; 119 }); 120 item.addEventListener('mouseleave', () => { 121 const title = item.querySelector('.categories_list_title'); 122 title.style.color = ''; 123 title.style.textDecoration = ''; 124 }); 125}); 126/** Cateory page read less/more content */ 127 128/** H1 Tag Replace With H2 */ 129jQuery(document).ready(function ($) { 130 function fixHeadings() { 131 var h1s = $("h1"); 132 if (h1s.length > 1) { 133 h1s.not(":first").each(function () { 134 var $h1 = $(this); 135 // Preserve attributes & content 136 var attrs = $.map(this.attributes, function (attr) { 137 return attr.name + '="' + attr.value + '"'; 138 }).join(" "); 139 $h1.replaceWith("<h2 " + attrs + ">" + $h1.html() + "</h2>"); 140 }); 141 } 142 } 143 144 fixHeadings(); 145 $(document).ajaxComplete(fixHeadings); 146 new MutationObserver(fixHeadings).observe(document.body, { childList: true, subtree: true }); 147}); 148/** H1 Tag Replace With H2 */ 149 150document.addEventListener("DOMContentLoaded", function () { 151 document.querySelectorAll( 152 ".home .cat-h1-heading, .elementor-element.elementor-element-cae90aa" 153 ).forEach(function (el) { 154 el.style.display = "none"; 155 }); 156}); 157 158 159document.addEventListener("DOMContentLoaded", function () { 160 const countdown = document.getElementById("countdown-timer"); 161 162 // Exit if the element doesn't exist 163 if (!countdown) return; 164 function pad(num) { 165 return num.toString().padStart(2, '0'); 166 } 167 168 function updateCountdown() { 169 const now = new Date();
170 const ukString = now.toLocaleString("en-US", { timeZone: "Europe/London" }); 171 const nowUK = new Date(ukString); 172 173 const midnightUK = new Date(nowUK); 174 midnightUK.setHours(24, 0, 0, 0); 175 176 const diff = midnightUK - nowUK; 177 178 if (isNaN(diff) || diff <= 0) { 179 document.getElementById("countdown-timer").textContent = "00Days 00Hrs 00Mins 00Secs"; 180 return; 181 } 182 183 const days = Math.floor(diff / (1000 * 60 * 60 * 24)); 184 const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); 185 const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60)); 186 const seconds = Math.floor((diff % (1000 * 60)) / 1000); 187 188 document.getElementById("countdown-timer").textContent = pad(days) + "Days " + pad(hours) + "Hrs " + pad(minutes) + "Mins " + pad(seconds) + "Secs"; 189 } 190 191 updateCountdown(); 192 setInterval(updateCountdown, 1000); 193}); 194 195document.addEventListener("DOMContentLoaded", function () { 196 if (document.body.classList.contains("home")) { 197 var title = document.querySelector("h1.sc_layouts_title_caption"); 198 if (title) { 199 title.textContent = "PVC Panels for Walls, Floors & Interiors"; 200 } 201 } 202}); 203 204jQuery(function ($) { 205 var $stickyBar = $('#mobile-sticky-add-to-cart'); 206 var $mainCartForm = $('form.cart'); 207 208 if (!$stickyBar.length || !$mainCartForm.length) { 209 return; 210 } 211 212 function isMobile() { 213 return window.innerWidth <= 767; 214 } 215 216 function toggleStickyBar() { 217 if (!isMobile()) { 218 $stickyBar.removeClass('is-visible'); 219 return; 220 } 221 222 var cartTop = $mainCartForm.offset().top; 223 var cartBottom = cartTop + $mainCartForm.outerHeight(); 224 var scrollTop = $(window).scrollTop(); 225 226 if (scrollTop > cartBottom) { 227 $stickyBar.addClass('is-visible'); 228 } else { 229 $stickyBar.removeClass('is-visible'); 230 } 231 } 232 233 $(window).on('scroll resize load', toggleStickyBar); 234 toggleStickyBar(); 235}); 236 237// fix read more and read less button style on category page 238jQuery(function ($) { 239 240 $(document).on("click", ".read-more-btn", function (e) { 241 e.preventDefault(); 242 e.stopPropagation(); 243 244 var $wrapper = $(this).closest(".archive-extra-description"); 245 246 $wrapper.find(".read-more-btn").hide(); 247 $wrapper.find(".desc-less").show(); 248 }); 249 250 $(document).on("click", ".read-less-btn", function (e) { 251 e.preventDefault(); 252 e.stopPropagation(); 253 254 var $wrapper = $(this).closest(".archive-extra-description"); 255 256 $wrapper.find(".desc-less").hide(); 257 $wrapper.find(".read-more-btn").show(); 258 }); 259 260}); 261 262 263jQuery(function($){ 264 265 function addTrustBadge(){ 266 267 if($('.checkout-trust-badge').length) return; 268 269 $('.wc-ppcp-checkout-container').append(` 270 <div class="checkout-trust-badge"> 271 <strong>100,000+</strong> orders and rated excellent on 272 <a href="https://www.reviews.co.uk/company-reviews/store/floorstowalls.co.uk" target="_blank"> 273 Reviews.io 274 </a> 275 <p>Still need help? Call us on <a href="tel:0191 389 6636">0191 389 6636</a></p> 276 </div> 277 `); 278 } 279 280 // Initial load 281 setTimeout(addTrustBadge, 1000); 282 283 // WooCommerce refresh 284 $(document.body).on('updated_checkout', function(){ 285 setTimeout(addTrustBadge, 500); 286 }); 287 288}); 289 290 291window.addEventListener('load', function () { 292 293 if (window.innerWidth <= 1024) { 294 295 const slider = document.querySelector('.top-bar-slider'); 296 297 if (slider && !slider.swiper) { 298 new Swiper(slider, { 299 slidesPerView: 1, 300 spaceBetween: 15, 301 loop: true, 302 observer: true, 303 observeParents: true, 304 watchOverflow: true, 305 autoplay: { 306 delay: 2500, 307 disableOnInteraction: false, 308 }, 309 breakpoints: { 310 768: { 311 slidesPerView: 2 312 } 313 } 314 }); 315 } 316 317 } 318 319}); 320 321/* Filter page Restore the "Add to Cart" button 2 seconds after an AJAX add-to-cart action */ 322jQuery(function ($) { 323 $(document.body).on('added_to_cart', function (event, fragments, cart_hash, $button) { 324 setTimeout(function () { 325 $button.removeClass('added'); 326 $button.siblings('.added_to_cart').remove(); 327 }, 5000); // 2 seconds 328 }); 329 330}); 331 332/* Filter mobile js*/ 333jQuery(function ($) { 334 if (!$('.filter-overlay').length) { 335 $('body').append('<div class="filter-overlay"></div>'); 336 } 337 338 function closeSidebar() { 339 $('.filter-sidebar').removeClass('active'); 340 setTimeout(function () { 341 $('.filter-sidebar').css('display', 'none'); 342 }, 300); 343 $('.filter-overlay').fadeOut(200); 344 $('html, body').css({ 345 'overflow': '', 346 'height': '' 347 }); 348 } 349 350 $('.filter-btn a').on('click', function (e) { 351 e.preventDefault(); 352 $('.filter-sidebar').css('display', 'block'); 353 requestAnimationFrame(function () { 354 $('.filter-sidebar').addClass('active'); 355 }); 356 $('.filter-overlay').fadeIn(200); 357 $('html, body').css({ 358 'overflow': 'hidden', 359 'height': '100%' 360 }); 361 }); 362 363 $(document).on('click', '.filter-overlay, .filter-sidebar-close', function () { 364 closeSidebar(); 365 }); 366 367 // Intercept XHR requests 368 var originalOpen = XMLHttpRequest.prototype.open; 369 var originalSend = XMLHttpRequest.prototype.send; 370 371 XMLHttpRequest.prototype.open = function (method, url) { 372 this._requestURL = url; // stash for later checks 373 return originalOpen.apply(this, arguments); 374 }; 375 376 XMLHttpRequest.prototype.send = function (body) { 377 var xhr = this; 378 var url = xhr._requestURL || ''; 379 380 var isWpgbRequest = 381 (typeof url === 'string' && url.indexOf('wpgb') !== -1) || 382 (typeof body === 'string' && body.indexOf('wpgb') !== -1); 383 384 if (isWpgbRequest) { 385 xhr.addEventListener('loadend', function () { 386 closeSidebar(); 387 }); 388 } 389 390 return originalSend.apply(this, arguments); 391 }; 392});
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.