MediaWiki:Common.css

Note : après avoir publié vos modifications, il se peut que vous deviez forcer le rechargement complet du cache de votre navigateur pour voir les changements.

  • Firefox / Safari : maintenez la touche Maj (Shift) en cliquant sur le bouton Actualiser ou appuyez sur Ctrl + F5 ou Ctrl + R (⌘ + R sur un Mac).
  • Google Chrome : appuyez sur Ctrl + Maj + R (⌘ + Shift + R sur un Mac).
  •  Edge : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl + F5.
/* Kolleggram – masquage RC des pages privées pour les visiteurs */
window.kgmHideRC = (function () {
  var groups = mw.config.get('wgUserGroups') || [];
  var isAdmin = groups.indexOf('sysop') !== -1;
  if (isAdmin) return; // les admins voient tout

  var canon = mw.config.get('wgCanonicalSpecialPageName') || '';
  var onList = ['Recentchanges','Recentchangeslinked','Watchlist','Newpages'].indexOf(canon) !== -1;
  if (!onList) return;

  var targets = [
    'Espace_administratrice',        // DBkey
    'Espace administratrice',        // titre humain
    'Admini'
  ];

  function isTargetLink(a) {
    var href = (a.getAttribute('href') || '').toLowerCase();
    var text = (a.textContent || '').toLowerCase();
    return targets.some(function (t) {
      t = t.toLowerCase();
      return href.indexOf(t) !== -1 || href.indexOf(encodeURIComponent(t)) !== -1 || text.indexOf(t) !== -1;
    });
  }

  function removeRowForLink(a) {
    var row = a.closest('li, tr, .mw-changeslist-line, .mw-newpages-page'); // gère plusieurs skins
    if (row) row.remove();
  }

  function sweep() {
    // Liens de titre dans les RC (plusieurs variantes selon skin/extensions)
    var sel = [
      '.mw-changeslist a.mw-changeslist-title',
      '.mw-changeslist .mw-title a',
      'a.mw-newpages-pagename',
      'a[title]' // filet de sécurité
    ].join(', ');
    document.querySelectorAll(sel).forEach(function (a) {
      if (isTargetLink(a)) removeRowForLink(a);
    });
  }

  // Premier passage + pour les mises à jour en direct
  sweep();
  mw.hook('wikipage.content').add(sweep);

  // Et si RC Live réinvente le DOM, on observe aussi
  var obs = new MutationObserver(function () { sweep(); });
  obs.observe(document.body, {childList: true, subtree: true});

  // Marqueur debug
  console.log('kgmHideRC actif');
})();