Utilisateur:Dr Brains/EditCounterOptIn.js

Une page de Wikipédia, l'encyclopédie libre.
Note : après avoir enregistré la page, vous devrez forcer le rechargement complet du cache de votre navigateur pour voir les changements.

Mozilla / Firefox / Konqueror / Safari : maintenez la touche Majuscule (Shift) en cliquant sur le bouton Actualiser (Reload) ou pressez Maj-Ctrl-R (Cmd-R sur Apple Mac) ;

Chrome / Internet Explorer / Opera : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5.
// http://toolserver.org/~soxred93/pcount/index.php?name=Dr%20Brains&lang=fr&wiki=wikipedia


if(mw.config.get('wgCanonicalSpecialPageName')=="Contributions") addOnloadHook(EditCounterOptIn);

function EditCounterOptIn(){

     var ContribFooter = document.getElementById('contributions-footer-box');
     if(ContribFooter){
          var Links = ContribFooter.getElementsByTagName('a');
          for(var a=0;a<Links.length;a++){
               if($(Links[a]).hasClass("external")){
                    var Ref = Links[a].href;
                    var Title = Links[a].innerHTML;
                    EditCounterOptIn_insertIframe(ContribFooter.parentNode, Ref, Title);
               }
          }
     }
}

function EditCounterOptIn_insertIframe(ContribFooter, Ref, Title){

     var TitreIframe = document.createElement('h2');
     TitreIframe.innerHTML = Title;
     ContribFooter.appendChild(TitreIframe);

     var Iframe = document.createElement('iframe');
     Iframe.src = Ref;
     Iframe.width="100%"
     Iframe.height='300px';
     ContribFooter.appendChild(Iframe);   
}