if (document.querySelector(".index")) { let whyUs = document.createElement("section"); whyUs.id = "cus-secs"; let wHeader = document.createElement("h1"); wHeader.innerHTML = "لماذا نحن؟"; wHeader.style = "text-align: center; color: #fff;"; let wDiv = document.createElement("div"); wDiv.id = "secs-wrapper"; wDiv.classList.add("container"); let wAnchor1 = document.createElement("a"); wAnchor1.id = "sec-link"; wAnchor1.href = ""; let wImg1 = document.createElement("img"); wImg1.id = "sec-image"; wImg1.src = "https://i.postimg.cc/NFjXxvkg/11.png"; let wAnchor2 = document.createElement("a"); wAnchor2.id = "sec-link"; wAnchor2.href = ""; let wImg2 = document.createElement("img"); wImg2.id = "sec-image"; wImg2.src = "https://i.postimg.cc/tRBW4797/22.png"; let wAnchor3 = document.createElement("a"); wAnchor3.id = "sec-link"; wAnchor3.href = ""; let wImg3 = document.createElement("img"); wImg3.id = "sec-image"; wImg3.src = "https://i.postimg.cc/RVqf690d/33.png"; document.querySelectorAll("footer")[0].before(whyUs); whyUs.append(wDiv); whyUs.prepend(wHeader); wDiv.append(wAnchor1); wAnchor1.append(wImg1); wDiv.append(wAnchor2); wAnchor2.append(wImg2); wDiv.append(wAnchor3); wAnchor3.append(wImg3); } (function() { document.addEventListener("DOMContentLoaded", function() { let links = document.querySelectorAll("a"); links.forEach(link => { let url = new URL(link.href, window.location.origin); if (!url.pathname.endsWith("/") && !url.pathname.includes(".")) { link.href = url.pathname + "/" + url.search + url.hash; } }); // إعادة توجيه الصفحة الحالية إذا لم يكن بها "/" if (!window.location.pathname.endsWith("/") && !window.location.pathname.includes(".")) { window.history.replaceState(null, "", window.location.pathname + "/" + window.location.search + window.location.hash); } }); })(); ---- ---- -----