Aller au contenu

Utilisateur:Barraki/monobook.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.
function OngletGoogle() {
  var a = document.getElementById("p-cactions");
        if (a) 
        {
          var pageName = document.title.replace(" - Wikipédia", ""); 
          b = a.getElementsByTagName("ul");
                  
          if(b.length > 0)
          {
            b[0].innerHTML = b[0].innerHTML
            + '<li id="ca-nstab-user"><img src="http://www.google.com/intl/en/logos/Logo_60wht.gif" height="20px">'
            + '<a href="http://www.google.fr/search?num=20&hl=en&safe=off&q=site%3Afr.wikipedia.org+' + pageName + '&btnG=Search">'
            + '(fr)</a>'
            + '<a href="http://www.google.fr/search?num=20&hl=en&safe=off&q=' + pageName + '&btnG=Search">'
            + '(web)</a>'
            + '</li>';
          }
        }
      }

$(OngletGoogle);

function getArticleName()
{
        var strOut = document.title
        // case search
        if (strOut == "Rechercher - Wikipédia")
                return document.getElementById("lsearchbox").value
        // case article being modified
        strOut = strOut.replace("modification de ", "").replace(" - Modifier", "")

        strOut = strOut.replace(" - Prévisualiser", "")     
        strOut = strOut.replace(" - Wikipédia", "")
        return strOut
}

var whichWiki = "en"
function setWiki()
{
        var newWiki = document.getElementById("elmtWhichWiki").value
        // trim
        newWiki = newWiki.replace(/ /g, "")
        if (/com(mon)?/.test(newWiki))
                newWiki = "commons"
        else if (/méta/.test(newWiki))
                newWiki = "meta"
        // no need to change
        if (newWiki == whichWiki)
                return
        var elmt = document.getElementById("whichW")
        // it was a wikipedia and now it's a wikimedia (commons or meta)
        if (/commons|meta/.test(newWiki) && !(/commons|meta/.test(whichWiki)))
        {
                elmt.href = elmt.href.replace(".wikipedia.org", ".wikimedia.org")
                elmt.title = elmt.title.replace(".wikipedia.org", ".wikimedia.org")
        }
        // it was a wikimedia (commons or meta) and now it's a wikipedia
        else if (/commons|meta/.test(whichWiki) && !(/commons|meta/.test(newWiki)))
        {
                elmt.href = elmt.href.replace(".wikimedia.org", ".wikipedia.org")
                elmt.title = elmt.title.replace(".wikimedia.org", ".wikipedia.org")
        }
        // in any case
        elmt.href = elmt.href.replace("http://" + whichWiki, "http://" + newWiki)
        elmt.title = elmt.title.replace("sur " + whichWiki, "sur " + newWiki)
        whichWiki = newWiki
}

function searchLinks()
{
        var site = (/commons|meta/.test(whichWiki) ? 'wikimedia' : 'wikipedia')
        var a = document.getElementById("p-cactions")
        if (a)
        {
                var pageName = getArticleName()
                var ulElmt = a.getElementsByTagName("ul")

                if(ulElmt.length > 0)
                {
                        ulElmt[0].innerHTML += '<li><a id="whichW" onmousedown="setWiki()" onkeydown="setWiki()" href="http://' + whichWiki + '.' + site + '.org/wiki/Special:Search?search=' + pageName + '" title="Rechercher ' + pageName + '">'
                        + 'Recherche wp</a>'
                        + '<input type=text id="elmtWhichWiki" style="color : #002bb8; font: normal 8pt Arial; text-align: top; border: 0px; background: none; width: 50px" maxlength="7" value="' + whichWiki + '">'
                        + '<span style="color: #002bb8; font-weight: bold; padding-left: 0.5em; background: none">G:</span>'
                        + '<a href="http://www.google.fr/search?num=20&hl=en&safe=off&q=site%3Afr.wikipedia.org+' + pageName + '&btnG=Search" title="Rechercher sur Google dans fr.wikipédia.org">'
                        + 'wp-fr</a>'
                        + '<a href="http://www.google.fr/search?num=20&hl=en&safe=off&q=site%3Awikipedia.org+' + pageName + '&btnG=Search" title="Rechercher sur Google dans wikipédia.org">'
                        + 'wp</a>'
                        + '<a href="http://www.google.fr/search?num=20&hl=fr&safe=off&q=' + pageName + '&btnG=Search&meta=lr%3Dlang_fr" title="Rechercher sur Google dans tout le web en français">'
                        + 'web-fr</a>'
                        + '<a href="http://www.google.fr/search?num=20&hl=en&safe=off&q=' + pageName + '&btnG=Search" title="Rechercher sur Google dans tout le web">'
                        + 'web</a>'
                        + '</li>'
                }
        }
} 
$(searchLinks);

function OngletPurge() {
  var a = document.getElementById("p-cactions");
        if (a) 
        {
          var pageName = document.title.replace(" - Wikipédia", ""); 
          b = a.getElementsByTagName("ul");
                  
          if(b.length > 0)
          {
            b[0].innerHTML = b[0].innerHTML
            + '<li id="ca-nstab-user">'
            + '<a href="/w/index.php?action=purge&title=' + pageName + '">purger</a>'
            + '</li>';
          }
        }
      }

// Onglet Purge

$(OngletPurge);


/**
 * Outils pour réverter
 *
 * Fournit des liens dans les pages de diff
 *
 * Auteur : Lorian (en)
 * Dernière révision : 3 novembre 2006
 * {{Catégorisation JS}}
 */
 
importScript('MediaWiki:Gadget-RevertDiff.js');