« MediaWiki:Gadget-AncreTitres.js » : différence entre les versions

Contenu supprimé Contenu ajouté
Bayo (discussion | contributions)
autre solution pour mettre un href
Bayo (discussion | contributions)
jout d'un span englobant pour être cohérent avec editsection
Ligne 15 :
description : "Obtenir une URL vers cette section",
descinterne : "Obtenir un [[Lien#interne]]",
linkcolor : "blueinherite",
fontSize : "50%xx-small",
fontWeight : "normal",
afficheE : true,
afficheI : true,
Ligne 32 ⟶ 33 :
var i = 0;
var titre_courant;
if (!AncreTitres.afficheI && !AncreTitres.afficheE) return;
for (i = 0 ; i < titres.length ; i++){
var titre_courant = titres[i].parentNode;
Ligne 44 ⟶ 46 :
var small;
var link;
 
span = document.createElement('span');
with(span ) {
style.color=AncreTitres.linkcolor;
style.fontSize=AncreTitres.fontSize;
style.colorfontWeight=AncreTitres.linkcolorfontWeight;
}
 
if (AncreTitres.afficheE) {
small = document.createElement('small'); with(small) {
innerHTML=AncreTitres.nom_ancre;
title=AncreTitres.description;
style.color=AncreTitres.linkcolor;
style.fontSize=AncreTitres.fontSize;
}
link = document.createElement('a');
Ligne 55 ⟶ 63 :
link.setAttribute("onclick", "window.prompt('Lien : ', this.getAttribute('ancre'));");
link.setAttribute("href", "javascript:;"); link.appendChild(small);
titre_courantspan.appendChild(link);
}
if (AncreTitres.afficheI) {
Ligne 61 ⟶ 69 :
innerHTML=AncreTitres.nom_lien_interne;
title=AncreTitres.descinterne;
style.color=AncreTitres.linkcolor;
style.fontSize=AncreTitres.fontSize;
}
link = document.createElement('a');
Ligne 69 ⟶ 75 :
link.setAttribute("href", "javascript:;");
link.appendChild(small);
titre_courantspan.appendChild(link);
}
titre_courant.appendChild(span);
}
}