/*
--------------------------------------------------------------------------------------
---------LLLL---------III--------------------------RRRRRRRRRR--------CCCCC------------
---------LLLL---------III--------------------------RRRRRRRRRRRR----CCCCCCCCC----------
---------LLLL--------------------------------------RRR------RRR---CCC-----CCC---------
---------LLLL---------III--VV-----VV--EEEEEEEEE----RRR------RRR--CCC------------------
---------LLLL---------III---VV---VV---EEE----------RRRRRRRRRRR---CCC------------------
---------LLLL---------III---VV---VV---EEEEEE-------RRRRRRRRRR----CCC------------------
---------LLLL---------III----VV-VV----EEEEEE-------RRR-----RRR----CCC-----CCC---------
---------LLLLLLLLLLL--III----VVVVV----EEE----------RRR------RRR----CCCCCCCCC----------
---------LLLLLLLLLLL--III-----VVV-----EEEEEEEEE----RRR-------RRR-----CCCCC------------
--------------------------------------------------------------------------------------
'''Extension de LiveRC'''
Permet de mettre un lien sur les icônes PàS, AdQ, etc.
* Licence : CC0
* Documentation :
* Auteur : ]
* Développement et maintenance :
{{Catégorisation JS|LiveRC}}
<source lang=javascript> */
if(typeof(LiveRC_AddHook)==="function"){ // DÉBUT IF
LiveRC_Config.push("LinkOnIconExtension");
/* ************************************************************************************************************************************************ */
window.LinkOnIconParams = [
{ class:"PaSIcon" , page:"$1/Admissibilité" },
{ class:"CopyrightIcon" , page:"$1/Droit d'auteur" },
{ class:"AdQIcon" , page:"$1/Article de qualité" },
{ class:"APDQIcon" , page:"$1/Article de qualité" },
{ class:"BAIcon" , page:"$1/Bon article" }
];
window.Custom_LinkOnIconParams = new Array();
lrcParamDesc = "Paramètres de l’extension LinkOnIcon";
lrcParamDesc = "LinkOnIcon";
// Personnalisation auto
window.defineCustomLinkOnIconParams = function(LOI_Params){
Custom_LinkOnIconParams = LOI_Params;
}
LiveRC_AddHook("AfterFillParamPanel", function(){
LiveRC_ManageParams_Fill(LinkOnIconParams, "LinkOnIconParams", "defineCustomLinkOnIconParams", true);
});
window.lrcXILGetTalkPage = function(article) {
var PageNamespaceNumber = getNamespaceInfoFromPage(article);
var PageName = getNamespaceInfoFromPage(article, "PageName");
if(PageNamespaceNumber%2==0){
var TalkPageNamespaceNumber = (PageNamespaceNumber+1);
}else{
var TalkPageNamespaceNumber = PageNamespaceNumber;
}
return lrcGetNamespaceName(TalkPageNamespaceNumber) + ":" + PageName;
}
window.lrcXILHook = function(Args) {
var tr1 = document.getElementById(Args.id);
if (!tr1) return;
var rc = Args.rc;
var article = rc.title;
var user = rc.user;
var talkpage = lrcXILGetTalkPage(article);
var LinkTargets = Custom_LinkOnIconParams;
if(LinkTargets.length===0) LinkTargets = LinkOnIconParams;
var treatedImage;
var images = tr1.getElementsByTagName('img');
for (var i=0,ilen=images.length;i<ilen;i++) {
var img = images;
treatedImage = false;
for(var a=0,l=LinkTargets.length;a<l;a++){
if(treatedImage) continue;
if(!lrcHasClass(img, LinkTargets.class)) continue;
treatedImage = true;
var ThePage = LinkTargets.page.split("$1").join(talkpage);
var Link = document.createElement('a');
Link.href = lrcGetPageURL(ThePage);
Link.onclick = function(){ liveArticle(ThePage); return false; }
img.parentNode.insertBefore(Link, img);
img.parentNode.removeChild(img);
Link.appendChild(img);
}
}
}
LiveRC_AddHook("AfterRC", lrcXILHook);
/* ************************************************************************************************************************************************ */
} // FIN IF
//</source>