MediaWiki:Common.js: Difference between revisions

From DBWiki
Jump to navigation Jump to search
Created page with "→‎Any JavaScript here will be loaded for all users on every page load.: // Example to hide Edit Source for anonymous users document.addEventListener("DOMContentLoaded", function() { var userGroups = mw.config.get('wgUserGroups'); if (userGroups.includes('sysop')) { var editSourceLink = document.getElementById('ca-editsource'); if (editSourceLink) { editSourceLink.style.display = 'inline'; } } });"
 
No edit summary
Line 5: Line 5:
     var userGroups = mw.config.get('wgUserGroups');
     var userGroups = mw.config.get('wgUserGroups');
     if (userGroups.includes('sysop')) {
     if (userGroups.includes('sysop')) {
         var editSourceLink = document.getElementById('ca-editsource');
         var editSourceLink = document.getElementById('ca-edit');
         if (editSourceLink) {
         if (editSourceLink) {
             editSourceLink.style.display = 'inline';
             editSourceLink.style.display = 'inline';

Revision as of 16:41, 10 October 2024

/* Any JavaScript here will be loaded for all users on every page load. */

// Example to hide Edit Source for anonymous users
document.addEventListener("DOMContentLoaded", function() {
    var userGroups = mw.config.get('wgUserGroups');
    if (userGroups.includes('sysop')) {
        var editSourceLink = document.getElementById('ca-edit');
        if (editSourceLink) {
            editSourceLink.style.display = 'inline';
        }
    }
});