Jump to content

User:Polletfa/monobook.js

From Wikipedia, the free encyclopedia
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.
/* Inspiré de :fr:Utilisateur:Jmfayard/monobook.js */

function addLoadEvent(func) 
{
         if (window.addEventListener) 
             window.addEventListener("load", func, false);
         else if (window.attachEvent) 
             window.attachEvent("onload", func);
}

function CategoriesAGauche() {

var catlinks = document.getElementById("catlinks");
if (!catlinks) { return; }
var categories = catlinks.getElementsByTagName("a") ;


var h5_cats = document.createElement( "h5" );
var text = document.createTextNode( "Categories" ) ;
h5_cats.appendChild( text ) ;

var div_cats = document.createElement( "div" );
div_cats.setAttribute( "class", "pBody" );

var ul = document.createElement( "ul" );

var a_debut = 1 ; // evitons le lien Categories:
for (var i = a_debut ; i < categories.length ; i++ ) {
	var a = categories[i] ;
	var li = document.createElement( "li" ) ;
	li.appendChild( a.cloneNode(1) ) ;
        ul.appendChild( li );
}

div_cats.appendChild( ul ) ;


var portlet = document.createElement( "div" ) ;
portlet.setAttribute( "class", "portlet" );
portlet.setAttribute( "id", "p-cat" ) ;

portlet.appendChild( h5_cats ) ;

portlet.appendChild( div_cats ) ;

//document.getElementById("column-one").insertBefore( document.getElementById("p-search"),  portlet ) ;
//document.getElementById("column-one").appendChild(  portlet ) ;
div_ptb = document.getElementById( "p-tb" );
document.getElementById("column-one").insertBefore( portlet, div_ptb)

}


addLoadEvent( CategoriesAGauche ) ;

function Polletfa() 
{
  var a = document.getElementById("p-cactions");
  if (a) 
  {
    b = a.getElementsByTagName("ul");
    if(b.length > 0)
    {
      b[0].innerHTML = b[0].innerHTML
      + '<li id="ca-nstab-user">'
      + '<a href="http://fr.wikipedia.org/wiki/Special:Watchlist">'
      + '(fr)</a>'
      + '<a href="http://de.wikipedia.org/wiki/Spezial:Watchlist">'
      + '(de)</a>'
      + '<a href="http://en.wikipedia.org/wiki/Special:Watchlist">'
      + '(en)</a>'
      + '<a href="http://meta.wikimedia.org/wiki/Special:Watchlist">'
      + '(meta)</a>'
      + '<a href="http://commons.wikimedia.org/wiki/Special:Watchlist">'
      + '(commons)</a>'
      + '<a href="http://incubator.wikimedia.org/wiki/Special:Watchlist">'
      + '(incubator)</a>'
      + '</li>'
    }
  }
}

addLoadEvent(Polletfa);