MediaWiki:Common.js: Difference between revisions
From Little Big Adventure Wiki
Jump to navigationJump to search
m Protected "MediaWiki:Common.js" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)) |
Open external link in new tab |
||
| Line 9: | Line 9: | ||
gaScript.src = 'https://www.googletagmanager.com/gtag/js?id=G-PQWT9K7NGV'; | gaScript.src = 'https://www.googletagmanager.com/gtag/js?id=G-PQWT9K7NGV'; | ||
document.head.appendChild(gaScript); | document.head.appendChild(gaScript); | ||
document.addEventListener("DOMContentLoaded", function() { | |||
document.querySelectorAll("#p-navigation a, #p-logo a, #p-personal a").forEach(link => { | |||
if (link.href.startsWith("http") && !link.href.includes(window.location.hostname)) { | |||
link.setAttribute("target", "_blank"); | |||
link.setAttribute("rel", "noopener noreferrer"); | |||
} | |||
}); | |||
}); | |||
Revision as of 21:14, 18 February 2025
/* Any JavaScript here will be loaded for all users on every page load. */
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-PQWT9K7NGV', { 'anonymize_ip': true });
var gaScript = document.createElement('script');
gaScript.async = true;
gaScript.src = 'https://www.googletagmanager.com/gtag/js?id=G-PQWT9K7NGV';
document.head.appendChild(gaScript);
document.addEventListener("DOMContentLoaded", function() {
document.querySelectorAll("#p-navigation a, #p-logo a, #p-personal a").forEach(link => {
if (link.href.startsWith("http") && !link.href.includes(window.location.hostname)) {
link.setAttribute("target", "_blank");
link.setAttribute("rel", "noopener noreferrer");
}
});
});