Jump to content

User:Nemoi/common.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Nemoi (talk | contribs) at 22:23, 1 January 2012 (…). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/**
 * Permet d'afficher les catégories cachées pour les contributeurs enregistrés, en ajoutant un (+) à la manière des boîtes déroulantes
 */
function hiddencatN(){
  if(document.URL.indexOf("printable=yes")!=-1) return;
  if( !(hc = document.getElementById('mw-hidden-catlinks')) ) return;
  if( hasClass(hc, 'mw-hidden-cats-user-shown') ) return;
  if( hasClass(hc, 'mw-hidden-cats-ns-shown') )   addClass(hc, 'mw-hidden-cats-hidden');
  var nc = $('#mw-normal-catlinks');
  removeClass(nc, 'catlinks-allhidden' );
  hclink = nc.append('<a id="mw-hidden-cats-link" title="Cet article contient des catégories cachées" style="cursor: pointer; color: black; ">[+]</a>');
  hclink.click(function() {
    if( hasClass(hc, 'mw-hidden-cats-hidden') ) {
      removeClass(hc, 'mw-hidden-cats-hidden');
      addClass(hc, 'mw-hidden-cat-user-shown');
      changeText(hclink, '[–]');
    } else {
      removeClass(hc, 'mw-hidden-cat-user-shown');
      addClass(hc, 'mw-hidden-cats-hidden');
      changeText(hclink, '[+]');
    }
  });
}
addOnloadHook(hiddencatN);