Utilisateur:François Melchior/common.js
Note : après avoir enregistré la page, vous devrez forcer le rechargement complet du cache de votre navigateur pour voir les changements.
Mozilla / Firefox / Konqueror / Safari : maintenez la touche Majuscule (Shift) en cliquant sur le bouton Actualiser (Reload) ou pressez Maj-Ctrl-R (Cmd-R sur Apple Mac) ;
Firefox (sur GNU/Linux) / Chrome / Internet Explorer / Opera : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5.mw.loader.using('mediawiki.util', function () {
//<nowiki>
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
||mw.config.get('wgCanonicalNamespace')!="User_talk") return;
document.editform.wpWatchthis.checked=false
}
function customOnLoad()
{
addSpecialChar('“','„','','“ „',true); //″“„
dontFollowUserTalkPages();
/*
var saveButton=document.getElementById('wpSave');
var parentOfButtons=saveButton.parentNode;
var prevButton=parentOfButtons.removeChild(document.getElementById('wpPreview'));
parentOfButtons.insertBefore(prevButton,saveButton);
var saveButton=document.getElementById('wpSave');
var prevButton=document.getElementById('wpPreview');
var saveButtonIndex=saveButton.getAttribute('tabindex');
var prevButtonIndex=prevButton.getAttribute('tabindex');
saveButton.setAttribute('tabindex',prevButtonIndex);
prevButton.setAttribute('tabindex',saveButtonIndex);
*/
}
$(customOnLoad);
addOnloadHook(
function()
{
mw.util.addPortletLink('p-personal',
'/w/index.php?title=Special:Suivi_des_liens&target=Utilisateur:Fran%C3%A7ois_Melchior/Suivi_personnalis%C3%A9_1&hideminor=0&days=180&limit=10',
'Suivi personnalisé');
mw.util.addPortletLink('p-personal',
'http://commons.wikimedia.org/wiki/Special:Watchlist',
'Commons (liste de suivi)');
mw.util.addPortletLink('p-navigation',
'/wiki/Utilisateur:François_Melchior/Bloc-note',
'Bloc-note personnel');
mw.util.addPortletLink('p-navigation',
'/w/index.php?title=Sp%C3%A9cial%3AIndex&prefix=Fran%C3%A7ois+Melchior&namespace=2',
'Liste de mes sous-pages');
}
);
obtenir('LiensRouges');
//obtenir('OptimizedSuivi');
//From Utilisateur:Dake
function insertAfter(parent, node, referenceNode) {
parent.insertBefore(node, referenceNode.nextSibling);
}
function OptimizedSuivi()
{
if (document.URL.indexOf("http://fr.wikipedia.org/wiki/Special:Watchlist")==0 ||
document.URL.indexOf("http://fr.wikipedia.org/w/index.php?title=Special:Watchlist")==0 ){
var allDays = document.getElementsByTagName("ul");
for (i=0; i<allDays.length; i++) {
if (allDays[i].getAttribute("class") == "special") {
var artList = allDays[i].getElementsByTagName("li");
for (j=0; j<artList.length; j++) {
var elem = artList[j];
var aTag = elem.getElementsByTagName("a");
var articleName = aTag[0].getAttribute("title");
var stopWatch = "/w/index.php?title=" + articleName + "&action=unwatch"
var newElement = document.createElement("a");
newElement.setAttribute("href",stopWatch);
var newText = document.createTextNode("stop");
newElement.appendChild(newText);
var newPar = document.createTextNode(") (")
// séparation des cas (nouvel article, ou déjà existant)
if (aTag[0].childNodes[0].data == "diff") {
insertAfter(elem, newPar, aTag[1]);
} else {
insertAfter(elem, newPar, aTag[0]);
}
insertAfter(elem, newElement, newPar);
}
}
}
}
}
$(OptimizedSuivi);
//end (From Utilisateur:Dake)
//Params pour AdvancedResearch (Gadget)
adSearchSametab=true;
adSearchButtons=Array('w','l','reset','c');
adSearchDefault='w';
document.writeln('<'+'script type="text/javascript" src="http://fr.wikipedia.org/w/index.php?title=Utilisateur:François_Melchior/CatHelp.js&action=raw&ctype=text/javascript&dontcountme=s" />');
//</nowiki>
});