Utilisateur:Dr Brains/NavigationGuilde.js
var GuildePageTitleSpace = "Questions techniques";
var GuildePageTitleNospace = "Questions_techniques";
if((mw.config.get('wgPageName').indexOf('Wikipédia:'+GuildePageTitleNospace+'/')!=-1)&&((mw.config.get('wgAction')=="view")||(mw.config.get('wgAction')="purge"))){
addOnloadHook(NavigationGuilde);
document.write('<style type="text/css">'
+'.Navigation_Guilde {'
+'margin:0.5em;'
+'padding-left:1em;'
+'padding-right:1em;'
+'border:1px solid silver;'
+'}'
+'</style>');
}
function NavigationGuilde(){
var Content = document.getElementById('bodyContent');
if(!Content) Content = document.getElementById('mw_contentholder');
if(!Content) Content = document.getElementById('article');
if(!Content) return;
var SousPageSemaine = mw.config.get('wgPageName').split('Wikipédia:'+GuildePageTitleNospace+'/semaine').join('');
var Annee = parseInt(SousPageSemaine.replace(/.*_/g,""));
var Semaine = parseInt(SousPageSemaine.split(Annee).join('').replace(/_/g,""));
//alert('Année :\n' + Annee + '\n\nSemaine :\n' + Semaine);
var PreviousSemaine = (Semaine-1);
var PreviousAnnee = Annee;
if(PreviousSemaine==0){
PreviousSemaine = 52;
PreviousAnnee = (PreviousAnnee-1);
}
var NextSemaine = (Semaine+1);
var NextAnnee = Annee;
if(NextSemaine==53){
NextSemaine = 1;
NextAnnee = (NextAnnee+1);
}
var PreviousPageHref = mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join('Wikipédia:'+GuildePageTitleNospace+'/semaine_' + PreviousSemaine + '_' + PreviousAnnee);
var PreviousPageTitle = 'Wikipédia:'+GuildePageTitleSpace+'/semaine ' + PreviousSemaine + ' ' + PreviousAnnee;
var NextPageHref = mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join('Wikipédia:'+GuildePageTitleNospace+'/semaine_' + NextSemaine + '_' + NextAnnee);
var NextPageTitle = 'Wikipédia:'+GuildePageTitleSpace+'/semaine ' + NextSemaine + ' ' + NextAnnee;
//alert('Page précédente :\n' + PreviousPageHref + '\n\nPage suivante :\n' + NextPageHref);
//alert('Page précédente :\n' + PreviousPageTitle + '\n\nPage suivante :\n' + NextPageTitle);
var Titre = Content.firstChild;
var Printfooter = Content.firstChild;
while(!$(Printfooter).hasClass("printfooter")) Printfooter = Printfooter.nextSibling;
var NavigDivTop = document.createElement('div');
NavigDivTop.className = "Navigation_Guilde";
Content.insertBefore(NavigDivTop, Titre);
var NavigDivBottom = document.createElement('div');
NavigDivBottom.className = "Navigation_Guilde";
Content.insertBefore(NavigDivBottom, Printfooter);
var LinksHTML = '<span style="float:left;">'
+'<a href="'+PreviousPageHref+'" title="'+PreviousPageTitle+'">'
+'<img src="http://upload.wikimedia.org/wikipedia/commons/1/16/Crystal_Clear_action_2leftarrow.png" height="50" width="50" alt="Page '+PreviousPageTitle+'" />'
+'</a>'
+'</span>'
+'<span style="float:right;">'
+'<a href="'+NextPageHref+'" title="'+NextPageTitle+'">'
+'<img src="http://upload.wikimedia.org/wikipedia/commons/4/45/Crystal_Clear_action_2rightarrow.png" height="50" width="50" alt="'+NextPageTitle+'" />'
+'</a>'
+'</span>'
+'<div class="visualClear"></div>';
NavigDivTop.innerHTML = LinksHTML;
NavigDivBottom.innerHTML = LinksHTML;
}
Text is available under the CC BY-SA 4.0 license; additional terms may apply.
Images, videos and audio are available under their respective licenses.