[go: nahoru, domu]

Aller au contenu

Utilisateur:Old Thingol/monobook.js

Une page de Wikipédia, l'encyclopédie libre.
Ceci est une version archivée de cette page, en date du 7 mars 2008 à 12:20 et modifiée en dernier par Old Thingol (discuter | contributions). Elle peut contenir des erreurs, des inexactitudes ou des contenus vandalisés non présents dans la version actuelle.
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> */

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

//Accélère l'affichage en désactivant des bouts de Mediawiki.js 
function remLoadEvent(func) 
{
  if (window.removeEventListener) 
    window.removeEventListener("load", func, false);
  else if (window.detachEvent) 
    window.detachEvent("onload", func);
}

function insertAfter(parent, node, referenceNode) {
    parent.insertBefore(node, referenceNode.nextSibling);
}

//evaluation Wikipedia 1.0
var alwaysEval = false; //mettez cette valeur à true si vous voulez que l'evaluation soit lancée automatiquement (à éviter en temps normal)
function initEvalProjectNames()
{
        evalProjectNames=new Array(); //liste de vos projets
        evalProjectNames.push("Bande dessinée") 
        evalProjectNames.push("Japon") 
        evalProjectNames.push("Monde chinois")
        evalProjectNames.push("Musique") 
}


//Ajout de liens internes (bistro, PàS, etc.) dans la boîte de navigation à gauche
function OptimizedNavig() 
{
  var a = document.getElementById("p-navigation");
  if (a) 
  {
    b = a.getElementsByTagName("ul");
    if(b.length > 0)
    {
      b[0].innerHTML = b[0].innerHTML
      + '<TABLE valign="top" cellspacing="0" cellpadding="0"><TR>'
      + '<TD colspan="3"><a href="/wiki/Utilisateur:Darkoneko/outils">Boite à outils</a></TD>'
      + '<TR></TR>'
      + '<TD colspan="3"><a href="/wiki/Wikipédia:Bulletin des administrateurs">Bulletin admins</a></TD>'
      + '<TR></TR>'
      + '<TD colspan="3"><a href="/wiki/Special:Log/newusers">Nouveaux</a></TD>'
      + '<TR></TR>'
      + '<TD colspan="3"><a href="/wiki/Wikipédia:Modèles/Espace_Discussion_Utilisateur">Disct utilis</a></TD>'
      + '</TR><TR>'
      + '<TD><a href="/wiki/Wikipédia:Le_bistro">Bistro</a></TD>'
      + '<TD>&nbsp;&nbsp;|&nbsp;&nbsp;</TD>'
      + '<TD><a href="/wiki/Portail:Manga_et_japanimation">Portail</a></TD>'
      + '<TR>'
      + '</TR></TABLE>';
    }
  }
}

function DeluxeBar() {
  if (document.createTextNode) {
  	var toolbar = document.getElementById("toolbar"); 
	if (!toolbar) return;
	
        ///// zone personnalisable ////
	var messages = new Array()
	var images = new Array()
	var commentaires = new Array()


        // le texte a été splitté sinon Mediawiki casse tout...
	messages[0] = "{{subst:" + "Bienvenue sur ta page"  + "}}" +  "~~" + "~~";
	images[0] = "http://upload.wikimedia.org/wikipedia/fr/1/12/Button_accueilA.png";
	commentaires[0] = "Bienvenue sur ta page !"

	messages[1] = "{{subst:" + "Bienvenue" + "}}" +  "~~" + "~~";
	images[1] = "http://upload.wikimedia.org/wikipedia/fr/e/eb/Button_accueilB.png";
	commentaires[1] = "Bienvenue !"

	messages[2] = "{{subst:" + "Test0" + "}}" +  "~~" + "~~";
	images[2] = "http://upload.wikimedia.org/wikipedia/fr/0/00/Button_vandale.png";
	commentaires[2] = "Vandale0"

	messages[3] = "{{subst:" + "Test1" + "}}" +  "~~" + "~~";
	images[3] = "http://upload.wikimedia.org/wikipedia/fr/0/00/Button_vandale.png";
	commentaires[3] = "Vandale1"

	messages[4] = "{{subst:" + "Test2" + "}}" +  "~~" + "~~";
	images[4] = "http://upload.wikimedia.org/wikipedia/fr/0/00/Button_vandale.png";
	commentaires[4] = "Vandale2"

	messages[5] = "{{subst:" + "Vandalisme|page" + "}}" +  "~~" + "~~";
        images[5] = "http://upload.wikimedia.org/wikipedia/fr/a/ad/Button_vandale2.png";
        commentaires[5] = "Avertissement vandalisme";

	messages[6] = "{{subst:" + "Bienvenue spammeur" + "}}" +  "~~" + "~~";
	images[6] = "http://upload.wikimedia.org/wikipedia/fr/f/fb/Button_spam2.png";
        commentaires[6] = "Avertissement spam" ;

        ////////////////////////////////

	for (var i=0;i<messages.length;i++) {
		var img = document.createElement("img");
		img.setAttribute("src", images[i]);
		
		var ref = document.createElement("a");
		ref.setAttribute("href", "javascript:insertTags('', \"" + messages[i] + "\", '');" + 
		                 "javascript:changeSummary(\"" + commentaires[i] + "\");" ); 
		ref.appendChild(img); 
		
		toolbar.appendChild(ref);
	}
  }
}

function changeSummary(sampleText) {
	document.editform.wpSummary.value = sampleText;
}

function customSpecialChars()
{
        var elmtP = document.getElementById("editpage-copywarn")
        if (elmtP == undefined)
                return  // not editing mode
        elmtP = elmtP.getElementsByTagName("P")[0]

        //for adding instead of replacing, switch the comments
        //var str = ""
        var str = "Caractères spéciaux: "
        
        // add your links here ; Note for newbies: accesskey = shortcut (ALT+accesskey) -- don't forget there are shortcuts already in use: e -> edit ; a -> article ; etc.
        str += "<a href=\"javascript:insertTags('Ā','', '')\" accesskey=\"A\">Ā</a> "
        str += "<a href=\"javascript:insertTags('ā','', '')\" accesskey=\"a\">ā</a> "
        str += "<a href=\"javascript:insertTags('Ē','', '')\" accesskey=\"E\">Ē</a> "
        str += "<a href=\"javascript:insertTags('ē','', '')\" accesskey=\"e\">ē</a> "
        str += "<a href=\"javascript:insertTags('Ī','', '')\" accesskey=\"I\">Ī</a> "
        str += "<a href=\"javascript:insertTags('ī','', '')\" accesskey=\"i\">ī</a> "
        str += "<a href=\"javascript:insertTags('Ō','', '')\" accesskey=\"O\">Ō</a> "
        str += "<a href=\"javascript:insertTags('ō','', '')\" accesskey=\"o\">ō</a> "
        str += "<a href=\"javascript:insertTags('Ū','', '')\" accesskey=\"U\">Ū</a> "
        str += "<a href=\"javascript:insertTags('ū','', '')\" accesskey=\"u\">ū</a> "
        
        //for adding instead of replacing, switch the comments
        //elmtP.innerHTML += str
        elmtP.innerHTML = str
}

//parties effectivement prises en compte.
addLoadEvent(OptimizedNavig);
addLoadEvent(DeluxeBar);
addLoadEvent(customSpecialChars)

var tabAction = "p-cactions";
function addJapanButton()
       {
        // condition à améliorer
        var toolbar = document.getElementById("toolbar"); 
        if (!toolbar) return;
        var l = document.getElementById(tabAction);
        t = l.innerHTML;
        ind = t.toLowerCase().indexOf("</ul>");
        before = t.substring(0,ind);
        after = t.substring(ind); 
        pitem = "<li><a href='javascript:hepburn();' accesskey=\"<\">"+
                "<div id='japan' style='display:inline;'>" + 
                "Hepburn"  + 
                "</div></a></li>";
        l.innerHTML = before + pitem + after ;           
      }

function hepburn() {
var txt = document.editform.wpTextbox1;
txt.focus();
    if ( window.getSelection )
    {
    // mozilla
      if( txt.selectionStart || txt.selectionStart == '0')
      {
        var text = txt.value.substring(txt.selectionStart, txt.selectionEnd);
        var s2 = txt.value;

      text = text.replace(new RegExp("aa", "g"), "ā").replace(new RegExp("Aa", "g"), "Ā");
      text = text.replace(new RegExp("ii", "g"), "ī").replace(new RegExp("Ii", "g"), "Ī");
      text = text.replace(new RegExp("ee", "g"), "ē").replace(new RegExp("Ee", "g"), "Ē");
      text = text.replace(new RegExp("uu", "g"), "ū").replace(new RegExp("Uu", "g"), "Ū");
      text = text.replace(new RegExp("oo", "g"), "ō").replace(new RegExp("Oo", "g"), "Ō");
      text = text.replace(new RegExp("ou", "g"), "ō").replace(new RegExp("Ou", "g"), "Ō");
      text = text.replace(new RegExp("â", "g"), "ā").replace(new RegExp("Â", "g"), "Ā");
      text = text.replace(new RegExp("î", "g"), "ī").replace(new RegExp("Î", "g"), "Ī");
      text = text.replace(new RegExp("ê", "g"), "ē").replace(new RegExp("Ê", "g"), "Ē");
      text = text.replace(new RegExp("û", "g"), "ū").replace(new RegExp("Û", "g"), "Ū");
      text = text.replace(new RegExp("ô", "g"), "ō").replace(new RegExp("Ô", "g"), "Ō");

        var savestart = txt.selectionStart;
        txt.value = s2.substring(0, txt.selectionStart)
                     + text
                     + s2.substr(txt.selectionEnd);
        txt.selectionStart = savestart;
        txt.selectionEnd = savestart;
      }
    }
    else if( document.getSelection )
    {
    // Safari/Konqueror
        var text = document.getSelection( ).replace(new RegExp("aa", "g"), "ā");
        //Manque la suite...
    }
    else 
    {
    // internet explorer
      var range = document.selection.createRange();
      var text = range.text;
      text = text.replace(new RegExp("aa", "g"), "ā").replace(new RegExp("Aa", "g"), "Ā");
      text = text.replace(new RegExp("ii", "g"), "ī").replace(new RegExp("Ii", "g"), "Ī");
      text = text.replace(new RegExp("ee", "g"), "ē").replace(new RegExp("Ee", "g"), "Ē");
      text = text.replace(new RegExp("uu", "g"), "ū").replace(new RegExp("Uu", "g"), "Ū");
      text = text.replace(new RegExp("oo", "g"), "ō").replace(new RegExp("Oo", "g"), "Ō");
      text = text.replace(new RegExp("ou", "g"), "ō").replace(new RegExp("Ou", "g"), "Ō");
      text = text.replace(new RegExp("â", "g"), "ā").replace(new RegExp("Â", "g"), "Ā");
      text = text.replace(new RegExp("î", "g"), "ī").replace(new RegExp("Î", "g"), "Ī");
      text = text.replace(new RegExp("ê", "g"), "ē").replace(new RegExp("Ê", "g"), "Ē");
      text = text.replace(new RegExp("û", "g"), "ū").replace(new RegExp("Û", "g"), "Ū");
      text = text.replace(new RegExp("ô", "g"), "ō").replace(new RegExp("Ô", "g"), "Ō");
      range.text = text;
    }
}

function customSpecialChars()
{
        var elmtP = document.getElementById("editpage-copywarn")
        if (elmtP == undefined)
                return  // Pas en édition
        elmtP = elmtP.getElementsByTagName("P")[0]

        var str = "Caractères spéciaux: "

        str += "<a href=\"javascript:insertTags('Ā','', '')\" accesskey=\",\">Ā</a> "
        str += "<a href=\"javascript:insertTags('ā','', '')\" accesskey=\"a\">ā</a> "
        str += "<a href=\"javascript:insertTags('Ē','', '')\" accesskey=\";\">Ē</a> "
        str += "<a href=\"javascript:insertTags('ē','', '')\" accesskey=\"f\">ē</a> "
        str += "<a href=\"javascript:insertTags('Ī','', '')\" accesskey=\":\">Ī</a> "
        str += "<a href=\"javascript:insertTags('ī','', '')\" accesskey=\"i\">ī</a> "
        str += "<a href=\"javascript:insertTags('Ō','', '')\" accesskey=\"!\">Ō</a> "
        str += "<a href=\"javascript:insertTags('ō','', '')\" accesskey=\"o\">ō</a> "
        str += "<a href=\"javascript:insertTags('Ū','', '')\" accesskey=\"ù\">Ū</a> "
        str += "<a href=\"javascript:insertTags('ū','', '')\" accesskey=\"v\">ū</a> "

        elmtP.innerHTML = str
}

addLoadEvent(addJapanButton);
addLoadEvent(customSpecialChars);

/* </nowiki></pre> */