/* Add custom Js code below */ function redirectByBestSell() { if (window.location.href.includes("?by=bestSell")) { window.location.href = "https://ajstore1.com/"; } } // call the function redirectByBestSell(); // Create the SVG element var svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"); svg.setAttribute("viewBox", "0 0 500 200"); // Create and set attributes for the first path element var path1 = document.createElementNS("http://www.w3.org/2000/svg", "path"); path1.setAttribute("d", "M 0 50 C 150 150 300 0 500 80 L 500 0 L 0 0"); path1.setAttribute("fill", "rgb(255, 255, 255)"); // Create and set attributes for the second path element var path2 = document.createElementNS("http://www.w3.org/2000/svg", "path"); path2.setAttribute("d", "M 0 50 C 150 150 330 -30 500 50 L 500 0 L 0 0"); path2.setAttribute("fill", "#f5f7f9"); path2.setAttribute("opacity", "0.8"); // Create and set attributes for the third path element var path3 = document.createElementNS("http://www.w3.org/2000/svg", "path"); path3.setAttribute("d", "M 0 50 C 215 150 250 0 500 100 L 500 0 L 0 0"); path3.setAttribute("fill", "#f5f7f9"); path3.setAttribute("opacity", "0.5"); // Append the path elements to the SVG element svg.appendChild(path1); svg.appendChild(path2); svg.appendChild(path3); // Get the div#splide31 element var testimonials = document.querySelector(".home-block--bg.home-block--testimonials"); // Create a div element for the pseudo-element var pseudoElement = document.createElement("div"); pseudoElement.setAttribute("id", "pseudo-element"); pseudoElement.style.content = '""'; pseudoElement.style.display = "block"; pseudoElement.style.position = "relative"; pseudoElement.style.width = "100%"; pseudoElement.style.height = "100%"; pseudoElement.style.pointerEvents = "none"; pseudoElement.appendChild(svg); // Insert the pseudo-element after the splide31 element testimonials.insertAdjacentElement("afterend", pseudoElement); // TEST // Function to extract the number from a text string function extractNumberFromString(text) { const numberMatch = text.match(/\d+/); return numberMatch ? parseInt(numberMatch[0], 10) : null; } // Function to update the buttons' content and CSS function updateButtons() { // Get the element with the specified class name const element = document.querySelector('.s-modal-header-content .s-modal-title'); // Check if the element exists if (element) { // Extract text content from the element const textContent = element.textContent; // Extract the number from the text const extractedNumber = extractNumberFromString(textContent); // Check if a number was extracted if (extractedNumber !== null) { // Create a CSS rule to set the ::before content and font-size const cssRule = ` button.undefined.s-button-element.s-button-btn.s-button-outline.s-button-wide.s-button-primary-outline.s-button-loader-center:before { content: " احصل على ${extractedNumber}% خصم الان"; font-size: small; } `; // Create a