MediaWiki:Common.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// Google Analytics 4 tracking via MediaWiki:Common.js
(function() {
var gaScript = document.createElement('script');
gaScript.async = true;
gaScript.src = 'https://www.googletagmanager.com/gtag/js?id=G-01G5LMDW7X';
document.head.appendChild(gaScript);
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
window.gtag = gtag;
gtag('js', new Date());
gtag('config', 'G-01G5LMDW7X');
})();
document.addEventListener("DOMContentLoaded", function () {
// Disable right-click on all images
document.addEventListener("contextmenu", function (event) {
if (event.target.tagName === "IMG") {
event.preventDefault();
}
});
// Disable clicking on image links for anonymous users
if (mw.config.get('wgUserGroups').includes('anon')) {
// Event delegation: handle current and future links
document.body.addEventListener('click', function(event) {
const anchor = event.target.closest('a');
if (!anchor) return;
if (anchor.querySelector('img')) {
event.preventDefault();
anchor.style.cursor = 'default';
}
});
// Attempt to disable MediaViewer for anonymous users
mw.loader.using('mediawiki.mediaViewer', function() {
if (window.MediaViewer) {
MediaViewer.disabled = true;
}
});
}
});
By using this site, you agree to the Terms of Use. © 1996–2025 The Quincy Examiner / MTB. All rights reserved.