User:Polletfa/monobook.js

From Wikipedia, the free encyclopedia

If a message on your talk page led you here, please be wary of who left it. Code that you insert on this page could contain malicious content capable of compromising your account. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. If this is a .js page, the code will be executed when previewing the page.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
/* 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);