// ]
// Traduction de ] : ]

importScript('MediaWiki:Gadget-Popups.js');

importScript('User:EDUCA33E/LiveRC.js');
importScript('User:Alphos/historyselect.js');

obtenir("BistroDuJour");
obtenir('LiensRouges');
 
function OptimizedNavig() 
{
  var a = document.getElementById("p-navigation");

  if (a) 
  {
    b = a.getElementsByTagName("ul");
    if(b.length > 0)
    { 
      var startUrl = '/w/index.php?title='
      var endUrl = '&action=purge'

      // liste des URLs
      var urls = new Array()
      urls = 'Wikipédia:Demande de suppression immédiate'
      urls = 'Wikipédia:Pages à supprimer'
      urls = 'Wikip%C3%A9dia:Demande_de_purge_d%27historique'
      urls = 'Utilisateur:EDUCA33E/LiveRC'
      urls = 'Special:Journal/newusers'
      urls = 'Wikip%C3%A9dia:Demande_de_renommage'
      urls = 'Wikip%C3%A9dia:V%C3%A9rificateur d%27adresses IP/Requêtes'
      urls = 'Sp%C3%A9cial:Suivi_des_liens/Utilisateur:Xic667/Suivi'
      urls = 'Wikipédia:Demande de restauration de page'
      urls = 'Wikip%C3%A9dia:Demande_de_fusion_d%27historiques'

      var labels = new Array()
      labels = 'SI'
      labels = 'PàS'
      labels = 'PH'
      labels = 'LRC'
      labels = 'nUsrs'
      labels = 'DdR'
      labels = 'RCU'
      labels = 'Suivi'
      labels = 'DRP'
      labels = 'FH'

      for (var i=0;i<urls.length;i+=2) {
        tableHTML = '<table valign="top" cellspacing="0" cellpadding="0">'
        tableHTML += '<tr>'
        tableHTML += '<li><td><a href="' + startUrl + urls + endUrl + '">' + labels + ' | </a></td>'
        tableHTML += '<td><a href="' + startUrl + urls + endUrl + '">' + labels + '</a></td></li>'
        tableHTML += '</tr>'
        tableHTML += '</table>' 
        b.innerHTML = b.innerHTML + tableHTML
      }

    }
  }
}


$(OptimizedNavig);

//---------------------------------------------------------------------------------------------Objets (cookies)
document.write('<script type="text/javascript" src="' 
             + 'http://fr.wikipedia.org/w/index.php?title=Utilisateur:GôTô/objects.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

function addWatchUserLinks() {
        var a = document.getElementById("p-search")
        if (a)
                a = a.getElementsByTagName("div")
        if (a)
        {
                var str = a.innerHTML + '  <a class="searchLink" href="javascript:watchUser(document.getElementById(\'searchInput\').value)" title="Mettre en évidence les contributions de cet utilisateur">'
                        + 'watch user</a>'
                        + '  <a class="searchLink" href="javascript:unwatchUser(document.getElementById(\'searchInput\').value)" title="Ne plus mettre en évidence les contributions de cet utilisateur">'
                        + 'unwatch user</a>'
                a.innerHTML = str
        }
}

function watchUser(usr) {
        if (!isUserWatched(usr)) {
                var all = cookies.get("watchUser")
                cookies.set("watchUser", (all ? all + usr + "/" : usr + "/"))
                highlightWatchedUsers()
        }
}

function unwatchUser(usr) {
        if (!isUserWatched(usr))
                return
        var all = cookies.get("watchUser").split("/")
        var out = ""
        for (var cpt = 0 ; cpt < all.length ; cpt++)
                if (all != usr && all)
                        out += all + "/"
        cookies.set("watchUser", out)
        highlightWatchedUsers()
}

function isUserWatched(usr) {
        var all = cookies.get("watchUser")
        if (!all)
                return null
        for (var cpt = 0 ; cpt < all.split("/").length ; cpt++)
                if (all.split("/") == usr)
                        return 1
        return null
}

function highlightWatchedUsers() {
        if (window.location.href.indexOf("Special:Recentchanges") < 1)
                return
        var uls = document.getElementsByTagName("ul")
        var ul = uls
        for (var cpt = 1 ; cpt < uls.length && ul.className != "special" ; cpt++)
                ul = uls
        var lis = ul.getElementsByTagName("li")
        for (var cpt = 0 ; cpt < lis.length ; cpt++) {
                var usr = lis.getElementsByTagName("a").innerHTML
                if (lis.getElementsByTagName("span")) {
                        var spans = lis.getElementsByTagName("span")
                        for (var cpt2 = 0 ; cpt2 < spans.length ; cpt2++)
                                if (spans.className == "newpage")
                                        var usr = lis.getElementsByTagName("a").innerHTML
                }
                if (isUserWatched(usr))
                        lis.className = "userWatched"
                else
                        lis.className = ""
        }
}

$(highlightWatchedUsers)
$(addWatchUserLinks)
importScript('Utilisateur:Argos42/PaStec.js');