Aller au contenu

Utilisateur:Neerdael/navigationsupp.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) ;

Firefox (sur GNU/Linux) / Chrome / Internet Explorer / Opera : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5.
// <pre><nowiki>
// Source: Dake + Goto

function NSclientSideGet(url, req, callback) {
  if ((req != null && callback == null)
    ||(req == null && callback != null)) {
    return("I need req && callback defined or not");
  }

  // For Safari, Firefox, and other non-MS browsers
  if (window.XMLHttpRequest) {
    try {
      req = new XMLHttpRequest();
    } catch (e) {
      req = false;
    }
  } else if (window.ActiveXObject) {
    // For Internet Explorer on Windows
    try {
      req = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {
        req = false;
      }
    }
  }
  if (req) {
    if (callback == null) {
      // Synchronous request, wait till we have it all
      req.open('GET', url, false);
      req.send(null);
      return (req.responseText);
    } else {
      // Asynchronous request, set callback and go
      req.open('GET', url, true);
      req.onreadystatechange = callback;
      req.send(null);
      return (null);
    }
  } else {
    return ("XMLHTTPRequest not supported");
  }
}

//function NSclientSideGetResponse()
//{
//  if (NSreq.readyState != 4)
//    return;
//  return(NSreq.responseText);
//}

function NSTodayDate()
{
        var m = new Array("janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre")
        var today = new Date()
        var day = today.getDate()
        var year = today.getYear()

        if (year < 2000)
                year += 1900

        return (day + " " + m[today.getMonth()] + " " + year)
}

function getWikiDefCon() 
{
  var nswikidefcon = NSclientSideGet("http://fr.wikipedia.org/wiki/Modèle:WikiDefcon");
  if (nswikidefcon != null) {
    var nswdctable = new RegExp('.*<strong>WikiDefcon</strong> ([1-5]).*')
    var nswdc = nswdctable.exec(nswikidefcon)
    if (nswdc != null && nswdc.length >= 1) {
      return (nswdc[1])
    }
  }
}

function getWikiDefConImage() {
  var nswikidefcon = NSclientSideGet("http://fr.wikipedia.org/wiki/Modèle:WikiDefcon")
  if (nswikidefcon != null) {
    var nswdctable = new RegExp('.*"(http://upload.wikimedia.org/.*/Dc_([^ "]*)\\.png)".*')
    var nswdc = nswdctable.exec(nswikidefcon)
    if (nswdc != null && nswdc.length >= 1) {
      return (nswdc[1])
    }
  }
}

function NavigationSupp() 
{
  var today = new Date()
  var day = today.getDate()
  var month = today.getMonth() + 1;
  if (month < 10)
      month = "0" + month
  var year = today.getYear()
  if (year < 2000)
      year += 1900

  var a = document.getElementById("column-one");
  if (!a) return;

  var startUrl = '/w/index.php?title='
  var endUrl = '&action=purge'

  // liste des URLs
  var urls = new Array()
  var labels = new Array()

  a.innerHTML += '<div class="portlet" id="p-nbx">'
+ '<h5>Boîte perso</h5>'
+ '<div class="pBody">' 
+ '<ul>'
+ '<li><a href="/w/index.php?title=Wikipédia:Bulletin des administrateurs">WP:BA</a>'
+ '<li><a href="/w/index.php?title=Wikipédia:Bot/Requêtes">BotReq</a>'
+ '<li><a href="/w/index.php?title=Wikipédia:Vandalisme en cours/Archives/' + year + '/' + month + '">Vandalismes</a>'
+ '<li><a href="/w/index.php?title=Wikipédia:Demande de protection de page">Dem Prot</a>'
+ '<p/>'
+ '<table ceilpadding=0 cellspacing=0>'
+ '<tr><td><a href="/w/index.php?title=Discussion Projet:Transports en Île-de-France">TIdF</a></td>'
+ '<td><a href="/w/index.php?title=Special:Suivi des liens&target=Portail:Transports en Île-de-France/Suivi&hidebots=0">RCb</a></td>'
+ '<td><a href="/w/index.php?title=Special:Suivi des liens&target=Catégorie:Portail:Transports en Île-de-France/Articles liés&hidebots=0">RCa</a></td>'
+ '</tr><tr>'
+ '<td><a href="/w/index.php?title=Discussion Projet:Stargate">SG</a></td>'
+ '<td><a href="/w/index.php?title=Special:Suivi des liens&target=Portail:Stargate/Suivi&hidebots=0">RCb</a></td>'
+ '<td><a href="/w/index.php?title=Special:Suivi des liens&target=Catégorie:Portail:Stargate/Articles liés&hidebots=0">RCa</a></td>'
+ '</tr><tr>'
+ '<td><a href="/w/index.php?title=Discussion Projet:Ferrovipédia">Ferr</a></td>'
+ '<td><a href="/w/index.php?title=Special:Suivi des liens&target=Portail:Chemin de fer/Suivi&hidebots=0">RCb</a></td>'
+ '<td><a href="/w/index.php?title=Special:Suivi des liens&target=Catégorie:Portail:Chemin de fer/Articles liés&hidebots=0">RCa</a></td>'
+ '</tr><tr>'
+ '<td><a href="/w/index.php?title=Discussion Projet:SF">SF</a></td>'
+ '<td><a href="/w/index.php?title=Special:Suivi des liens&target=Portail:Science-fiction/Articles récents&hidebots=0">RCb</a></td>'
+ '<td><a href="/w/index.php?title=Special:Suivi des liens&target=Catégorie:Portail:Science-fiction/Articles liés&hidebots=0">RCa</a></td>'
+ '</tr><tr>'
+ '<td>IdF</td>'
+ '<td></td>'
+ '<td><a href="/w/index.php?title=Special:Suivi des liens&target=Catégorie:Portail:Île-de-France/Articles liés&hidebots=0">RCa</a></td>'
+ '</tr><tr>'
+ '<td><a href="/w/index.php?title=Discussion Projet:Transport en commun">TC</a></td>'
+ '<td></td>'
+ '<td><a href="/w/index.php?title=Special:Suivi des liens&target=Catégorie:Portail:Transports en commun/Articles liés&hidebots=0">RCa</a></td>'
+ '</table>'
+ '<p/>'
+ '<li><a href="http://en.wikipedia.org/wiki/Special:Watchlist">((en))</a>'
+ '<li><a href="http://commons.wikimedia.org/wiki/Special:Watchlist">((commons))</a>'

  if ( location.href.indexOf('/Sp%C3%A9cial:Liste_de_suivi') != -1
   ||  location.href.indexOf('/Sp%C3%A9cial:Modifications_r%C3%A9centes') != -1
   ) {
     a.innerHTML += '<p/>'
       + '<img src="" title="Defcon" id="p-defcon" width="50" height="100" border="1">'
  }

  var defcon = document.getElementById("p-defcon")

  if (defcon != null) {
    defcon.src = getWikiDefConImage()
  }

  a.innerHTML += '</ul>'
+ '</div>'
+ '</div> ';
}

$(NavigationSupp);

// </nowiki></pre>