User:François Melchior/common.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
/* Not used for the moment...
function addSpecialChar(tagBegin,tagEnd,defaultValue,showedText,separe)
 {
 var specialchars=document.getElementById('specialcharsets');
 if (!specialchars) return;
 var caracteresSpeciaux=specialchars.previousSibling.parentNode.getElementsByTagName('p')[0];
 var nouveauA=document.createElement("a");
 nouveauA.setAttribute('href','#');
 nouveauA.setAttribute('onClick','insertTags(\''+tagBegin+'\',\''+tagEnd+'\',\''+defaultValue+'\')\;return false');
 nouveauA.appendChild(document.createTextNode(showedText));
 nextNode=caracteresSpeciaux.getElementsByTagName('small')[0].previousSibling; //ici, c'est expérimental: si la page change, il faut changer.
 if(separe)
  caracteresSpeciaux.insertBefore(document.createTextNode(' · '),nextNode);
 caracteresSpeciaux.insertBefore(nouveauA,nextNode);
 }

function dontFollowUserTalkPages()
 {
 if(document.editform==undefined||
    document.editform.wpWatchthis==undefined
    ||wgCanonicalNamespace!="User_talk") return;
 document.editform.wpWatchthis.checked=false
 }

function customOnLoad()
 {
 addSpecialChar('“','„','','“ „',true); //″“„
 dontFollowUserTalkPages();
 }

addLoadEvent(customOnLoad)*/

addOnloadHook(
 function()
  {/* Doesn't work here for the moment (needs newer Mediawiki version)
  mw.util.addPortletLink('p-personal',
                          '/w/index.php?title=Special:Whatchlist&target=User:Fran%C3%A7ois_Melchior/Mes_images&hideminor=0&days=180&limit=10',
                          'Suivi personnalisé');*/
  mw.util.addPortletLink('p-personal',
                          'http://fr.wikipedia.org/wiki/Special:Liste_de_suivi',
                          'WP:fr (liste de suivi)');
  mw.util.addPortletLink('p-personal',
                          '/wiki/User:François_Melchior/Mes_images',
                          'Mes images');
  mw.util.addPortletLink('p-navigation',
                          '/w/index.php?title=Special%3APrefixindex&from=Fran%C3%A7ois+Melchior&namespace=2',
                          'Liste de mes sous-pages');
  }
 );

document.writeln('<'+'script type="text/javascript" src="http://commons.wikimedia.org/w/index.php?title=User:François_Melchior/CatHelp.js&action=raw&ctype=text/javascript&dontcountme=s" />');