MediaWiki:Common.js: Difference between revisions
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("#bodyContent a.external"); | ||
for (const link of links) { | for (const link of links) { | ||
link.setAttribute("target", "_blank"); | const href = link.getAttribute("href"); | ||
if (link.classList.contains("download-link") || href.endsWith(".ips") || href.endsWith(".zip")) { | |||
link.setAttribute("target", "_blank"); | |||
link.setAttribute("rel", "noopener noreferrer"); | |||
link.setAttribute("download", ""); | |||
} | |||
} | } | ||
}); | }); |
Revision as of 20:06, 17 April 2025
document.addEventListener("DOMContentLoaded", function () { const links = document.querySelectorAll("#bodyContent a.external"); for (const link of links) { const href = link.getAttribute("href"); if (link.classList.contains("download-link") || href.endsWith(".ips") || href.endsWith(".zip")) { link.setAttribute("target", "_blank"); link.setAttribute("rel", "noopener noreferrer"); link.setAttribute("download", ""); } } });