MediaWiki:Common.js: Difference between revisions
No edit summary Tag: Manual revert |
mNo edit summary Tag: Reverted |
||
Line 10: | Line 10: | ||
gtag('js', new Date()); | gtag('js', new Date()); | ||
gtag('config', 'G-5MQXEFVQBE'); | gtag('config', 'G-5MQXEFVQBE'); | ||
// For Vector 2022: Hide "View history" and "Recent changes" for anonymous users | |||
$(function () { | |||
if (!mw.config.get('wgUserName')) { | |||
// Hide "View history" tab | |||
$('[data-vector-tab="ca-history"]').hide(); | |||
// Hide "Recent changes" from sidebar and other locations | |||
$('a[title="Special:RecentChanges"]').closest('li').hide(); | |||
} | |||
}); |
Revision as of 16:46, 28 June 2025
/* Any JavaScript here will be loaded for all users on every page load. */ // Google Analytics for GA4 (G-5MQXEFVQBE) var gtagScript = document.createElement("script"); gtagScript.src = "https://www.googletagmanager.com/gtag/js?id=G-5MQXEFVQBE"; gtagScript.async = true; document.head.appendChild(gtagScript); window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-5MQXEFVQBE'); // For Vector 2022: Hide "View history" and "Recent changes" for anonymous users $(function () { if (!mw.config.get('wgUserName')) { // Hide "View history" tab $('[data-vector-tab="ca-history"]').hide(); // Hide "Recent changes" from sidebar and other locations $('a[title="Special:RecentChanges"]').closest('li').hide(); } });