document.addEventListener("DOMContentLoaded", function() { if (window.innerWidth > 991) { var e = document.querySelectorAll(".webzine_type2 a, .rdn a"); e.forEach(function(el) { var parent = el.parentNode, href = el.getAttribute("href"); if (href) { var span = document.createElement("span"); Array.from(el.attributes).forEach(function(attr) { if (attr.name !== "href") span.setAttribute(attr.name, attr.value); }); span.classList.add("fake-link"); span.setAttribute("data-href", href); while (el.firstChild) span.appendChild(el.firstChild); parent.replaceChild(span, el); } }); function goToLink(el) { var link = el.getAttribute("data-href"); if (link && !el.classList.contains("clicked")) { el.classList.add("clicked"); window.location.href = link; setTimeout(function() { el.classList.remove("clicked"); }, 800); } } document.addEventListener("click", function(e) { var target = e.target.closest(".fake-link"); if (target) { e.preventDefault(); goToLink(target); } }, false); document.addEventListener("touchend", function(e) { var target = e.target.closest(".fake-link"); if (target) { e.preventDefault(); goToLink(target); } }, { passive: false }); const menuLinks = document.querySelectorAll(".sul_menu .fake-link"); menuLinks.forEach(function(link) { link.addEventListener("click", function() { menuLinks.forEach(l => l.classList.remove("active")); link.classList.add("active"); const href = link.getAttribute("data-href"); if (href) window.location.href = href; }); }); const current = window.location.href; menuLinks.forEach(function(link) { const href = link.getAttribute("data-href"); if (href && current === new URL(href, window.location.origin).href) { link.classList.add("active"); } }); } // if END });