« MediaWiki:Gadget-AncreTitres.js » : différence entre les versions
Contenu supprimé Contenu ajouté
mAucun résumé des modifications |
m et voilà, ça marche mieux maintenant ! |
||
Ligne 7 :
*
* Auteurs : Pabix, Phe
* Date de dernière révision :
*/
var AncreTitres={
nom_ancre : "[URL]",
nom_lien_interne : "[[lien]]",
linkcolor : "blue",
fontSize : "50%",
afficheE : true,
afficheI : true,
if (noeud==null) return undefined;
}
}
}
function ancrer(){
▲ function noeud_precedent(noeud) {
▲ while (noeud.previousSibling.nodeType!=1)
▲ noeud = noeud.previousSibling;
▲ return noeud.previousSibling;
▲ }
if (!document.getElementById('content')) return;
var titres = document.getElementsByTagName("span");
Ligne 34 :
for (i = 0 ; i < titres.length ; i++){
var titre_courant = titres[i].parentNode;
if (!(titres[i].className.match(/mw-headline/
if (!AncreTitres.noeud_precedent(titre_courant)) continue;
var ancre_nom;
if (!noeud_precedent(titre_courant).lastChild) continue;▼
if (
} else {
var small;
var link;
if (
small = document.createElement('small'); with(small) {
innerHTML=
title=
style.color=
style.fontSize=
▲ }
link = document.createElement('a'); with(link) {▼
setAttribute("ancre", wgServer + wgScriptPath + "/index.php?title=" + wgPageName + "#" + ancre_nom) ;▼
setAttribute("onclick", "window.prompt('Lien : ', this.getAttribute('ancre'));");▼
appendChild(small);▼
}
▲
titre_courant.appendChild(link);
}
if (
small = document.createElement('small'); with(small) {
innerHTML=
title=
style.color=
style.fontSize=
link = document.createElement('a'); with(link) {▼
setAttribute("ancre", "[[" + wgPageName + "#" + ancre_nom + "]]");▼
setAttribute("onclick", "window.prompt('Lien : ', this.getAttribute('ancre'));");▼
appendChild(small);▼
}
titre_courant.appendChild(link);
}
}
}
|