PageSourceSearch

https://keelesu.com/pagestylesheet/shop/product/10002480/scripts.js?v=227

js keelesu.com collected 2026-09-25 06:05:19 UTC 5,882 bytes, 157 lines download raw bytes

1document.addEventListener("DOMContentLoaded", function () {
2    // Remove query parameters from image URLs
3    document.querySelectorAll(".product_images img").forEach(img => {
4        let url = img.getAttribute("src");
5        if (url.includes("?")) {
6            img.setAttribute("src", url.split("?")[0]);
7        }
8    });
9
10    // Move and update product description
11    const productDescription = document.getElementById("product_description");
12    const productOptions = document.querySelector(".product_box_product_options");
13    if (productDescription && productOptions) {
14        productOptions.parentNode.insertBefore(productDescription, productOptions);
15        productDescription.insertAdjacentHTML("afterbegin", "<h2>Description</h2>");
16    }
17
18    // Move product box and notification
19    const productBox = document.querySelector(".product_box");
20    const notification = document.querySelector(".msl_notification");
21    if (productBox && productOptions) {
22        productOptions.parentNode.insertBefore(productBox, productOptions.nextSibling);
23    }
24    if (notification && productBox) {
25        productBox.parentNode.insertBefore(notification, productBox);
26        if (document.querySelectorAll(".msl_notification").length > 0) {
27            productBox.style.display = "none";
28        }
29    }
30
31    // Submit form on select change
32    document.querySelectorAll(".product_box_product_options input").forEach(input => input.style.display = "none");
33    document.querySelectorAll(".product_box_product_options select").forEach(select => {
34        select.addEventListener("change", () => {
35            const input = document.querySelector(".product_box_product_options input");
36            if (input) input.click();
37        });
38    });
39
40    // Show image thumbs if present
41    const imageThumb = document.getElementById("image_thumb");
42    if (imageThumb && imageThumb.querySelector(".product_image_thumb")) {
43        imageThumb.style.display = "block";
44    } else if (imageThumb) {
45        imageThumb.style.display = "none";
46    }
47
48    // Reorder elements
49    const product = document.getElementById("product");
50    const productId = document.querySelector(".msl-product-id");
51    const priceLabel = document.getElementById("ctl00_Main_ProductCtl1_lblNormalPrice");
52
53    const productImages = document.querySelector(".product_images");
54    if (product && productImages) {
55        product.parentNode.insertBefore(productImages, product);
56    }
57    if (product && productId) {
58        product.insertBefore(productId, product.querySelector("h1"));
59    }
60    if (product && priceLabel) {
61        product.querySelector("h1").insertAdjacentElement("afterend", priceLabel);
62    }
63
64    if (productDescription && productBox) {
65        productBox.insertAdjacentElement("afterend", productDescription);
66        const h2 = productDescription.querySelector("h2");
67        if (h2) h2.textContent = "Product Details";
68    }
69
70    // Clean up price label text
71    if (priceLabel) {
72        priceLabel.textContent = priceLabel.textContent.replace(/Price: /g, '');
73    }
74
75    // Update quantity heading
76    const productBoxHeading = document.querySelector(".product_box h2");
77    if (productBoxHeading) {
78        productBoxHeading.textContent = "Quantity";
79    }
80
81    // Thumbnail image selection
82    const thumbs = document.querySelectorAll(".product_image_thumb img");
83    if (thumbs.length > 0) {
84        thumbs[0].classList.add("active");
85        thumbs.forEach(img => {
86            img.addEventListener("click", () => {
87                thumbs.forEach(i => i.classList.remove("active"));
88                img.classList.add("active");
89            });
90        });
91    }
92
93    // Apply Bootstrap button classes
94    document.querySelectorAll(".button").forEach(btn => {
95        btn.classList.add("btn", "btn-primary");
96    });
97
98    document.querySelectorAll(".product_box > .btn").forEach(btn => {
99        btn.value = "Add to Basket";
100    });
101
102    // Move size guide info
103    const sizeGuide = document.getElementById("size-guide-info");
104    if (sizeGuide && productOptions) {
105        productOptions.appendChild(sizeGuide);
106        sizeGuide.style.display = "block";
107    }
108
109    // Replace h1 with custom element
110    const titleSection = document.getElementById("title-section");
111    if (titleSection) {
112        const h1 = titleSection.querySelector("h1.mslwidget");
113        if (h1) {
114            const evTitle = document.createElement("ev-title");
115            evTitle.className = h1.className;
116            evTitle.innerHTML = h1.innerHTML;
117            h1.parentNode.replaceChild(evTitle, h1);
118        }
119    }
120});
121
122var timer = setInterval(function () {
123    var ref = document.querySelector('.msl-product-id');
124    var description = document.querySelector('#product_description');
125
126    if (ref && description) {
127        description.appendChild(ref);
128        clearInterval(timer);
129    }
130}, 250);
131
132document.addEventListener('DOMContentLoaded', function () {
133    var price = document.getElementById('ctl00_Main_ProductCtl1_lblNormalPrice');
134
135    if (price) {
136        price.innerHTML = price.innerHTML.replace(
137            /Price:\s*(£[\d\.]+)/,
138            'Price: <span style="font-size:2rem;font-weight:700;">$1</span>'
139        );
140    }
141});
142
143document.addEventListener('DOMContentLoaded', function () {
144    var input = document.getElementById('ctl00_Main_ProductCtl1_btnAdd');
145
146    if (input) {
147        var button = document.createElement('button');
148
149        button.type = 'submit';
150        button.id = input.id;
151        button.name = input.name;
152        button.className = input.className;
153        button.innerHTML = 'Add to Basket <i class="fas fa-shopping-basket"></i>';
154
155        input.parentNode.replaceChild(button, input);
156    }
157});

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.