MediaWiki:Common.js: Difference between revisions

From Squidgy
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 1: Line 1:
document.addEventListener("DOMContentLoaded", function () {
document.addEventListener("DOMContentLoaded", function () {
   const links = document.querySelectorAll("#bodyContent a.external");
   const links = document.querySelectorAll("a.download-link");


   for (const link of links) {
   for (const link of links) {
     const href = link.getAttribute("href");
     link.setAttribute("target", "_blank");
 
    link.setAttribute("rel", "noopener noreferrer");
    if (link.classList.contains("download-link") || href.endsWith(".ips") || href.endsWith(".zip")) {
    link.setAttribute("download", "");
      link.setAttribute("target", "_blank");
      link.setAttribute("rel", "noopener noreferrer");
      link.setAttribute("download", "");
    }
   }
   }
});
});

Latest revision as of 20:07, 17 April 2025

document.addEventListener("DOMContentLoaded", function () {
  const links = document.querySelectorAll("a.download-link");

  for (const link of links) {
    link.setAttribute("target", "_blank");
    link.setAttribute("rel", "noopener noreferrer");
    link.setAttribute("download", "");
  }
});