Utilisateur:Demiphon/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) ;

Chrome / Internet Explorer / Opera : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5.
/*
*  Navigation Popup
*/
importScript('MediaWiki:Gadget-Popups.js');



// Modification de l'onglet Google de Dake par GôTô
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 = "fr"
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);






/*
*  Historique en couleurs
*/
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>');

document.write('<script type="text/javascript" src="' 
            + 'http://fr.wikipedia.org/w/index.php?title=Utilisateur:Dake/monobook.js/deluxehistory.js' 
            + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');