Utilisateur:Chouca/monobook.js

Un article de Wikipédia, l'encyclopédie libre.

Note : Après avoir publié la page, vous devrez forcer son rechargement pour voir les changements : Mozilla / Konqueror / Firefox : Shift-Ctrl-R, Internet Explorer / Opera : Ctrl-F5, Safari : Cmd-R.

function addArticleTrafficStatistics()
{
  var histo = document.getElementById("ca-history");
  if(histo)
  {
    var lien = document.createElement("a");
    var today = new Date();
    var annee = today.getYear() + 1900;
    var mois = new String(today.getMonth() + 1);
    if(mois.length < 2)
    {
      mois = "0" + mois;
    }
    lien.setAttribute("href", "http://stats.grok.se/fr/" + annee + mois + "/" + wgPageName);
    lien.appendChild(document.createTextNode("Consultation"));
 
    var stats = document.createElement("li");
    stats.setAttribute("id", "ca-stats");
    stats.appendChild(lien);
 
    histo.parentNode.insertBefore(stats, histo.nextSibling);
  }
}
addOnloadHook(addArticleTrafficStatistics);