From ProventusNova DeveloperWiki
No edit summary Tag: Reverted |
No edit summary Tag: Reverted |
||
Line 10: | Line 10: | ||
mw.loader.using('mediawiki.user').then(function () { |
mw.loader.using('mediawiki.user').then(function () { |
||
if (!mw.user.isAnon()) return; // Only |
if (!mw.user.isAnon()) return; // Only apply to anonymous users |
||
if (mw.config.get('wgAction') === 'viewsource') { |
|||
document.querySelectorAll('a[title="View source"], a[title="History"]').forEach(el => el.remove()); |
|||
window.location.href = mw.config.get('wgArticlePath').replace('$1', 'Main_Page'); // Redirect to Main Page |
|||
} |
|||
}); |
}); |
Revision as of 16:22, 4 April 2025
/* Any JavaScript here will be loaded for all users on every page load. */
document.addEventListener("DOMContentLoaded", function() {
if (!mw.config.get("wgUserName")) { // If user is not logged in
document.getElementById("ca-viewsource")?.remove();
}
});
document.getElementById('p-tb')?.style.display = 'none';
document.getElementById('catlinks')?.style.display = 'none';
mw.loader.using('mediawiki.user').then(function () {
if (!mw.user.isAnon()) return; // Only apply to anonymous users
if (mw.config.get('wgAction') === 'viewsource') {
window.location.href = mw.config.get('wgArticlePath').replace('$1', 'Main_Page'); // Redirect to Main Page
}
});