« Utilisateur:Deadhoax/monobook.js » : différence entre les versions

Un livre de Wikilivres.
Contenu supprimé Contenu ajouté
Deadhoax (discussion | contributions)
Aucun résumé des modifications
 
(Aucune différence)

Version actuelle du 10 octobre 2006 à 11:12

function DeluxeBar() {
  if (document.createTextNode) {
        var toolbar = document.getElementById("toolbar"); 
        if (!toolbar) return;
        
        ///// zone personnalisable ////
        var messages = new Array()
        // le texte a été splitté sinon Mediawiki casse tout...
        messages[0] = "{{subst:" + "Bienvenue sur ta page"  + "}}" +  "~~" + "~~";
        messages[1] = "{{subst:" + "Bienvenue" + "}}" +  "~~" + "~~";
        messages[2] = "{{subst:" + "Bienvenue vandale" + "}}" +  "~~" + "~~";
        messages[3] = "{{subst:" + "Vandalisme|page" + "}}" +  "~~" + "~~";
        messages[4] = "{{subst:" + "Bienvenue spammeur" + "}}" +  "~~" + "~~";

        messages[5] = "{{subst:" + "Utilisateur:Dake/Traité||~~" + "~~" + "}}";
        messages[6] = "{{subst:" + "Utilisateur:Dake/TraitéConserver||~~" + "~~" + "}}";
        messages[7] = "{{subst:" + "Utilisateur:Dake/TraitéSupprimer||~~" + "~~" + "}}";
        
        messages[8] = "{{subst:" + "Utilisateur:Eskimo/Copyvio|page|URL|titre" + "}} " +  "~~" + "~~";
        messages[9] = "{{" + "copie de site|URL|Titre" + "}}";
        messages[10] = "{{" + "suppression" + "}}";

        messages[11] = "{{subst:" + "Utilisateur:Meanos/Modèles/PAdQ rejetée|premier/second tour|0|0|0|-|~~" + "~~}}";
        messages[12] = "{{subst:" + "Utilisateur:Meanos/Modèles/PAdQ validée|premier/second tour|0|0|0|-|~~" + "~~}}";
        messages[13] = "{{subst:" + "Utilisateur:Dake/Toolbox/LicenceInconnue|test.jpg}}";
        messages[14] = "{{" + "ROs"  + "}}";
        var images = new Array()
        images[0] = "http://upload.wikimedia.org/wikipedia/fr/1/12/Button_accueilA.png";
        images[1] = "http://upload.wikimedia.org/wikipedia/fr/e/eb/Button_accueilB.png";
        images[2] = "http://upload.wikimedia.org/wikipedia/fr/0/00/Button_vandale.png";
        images[3] = "http://upload.wikimedia.org/wikipedia/fr/a/ad/Button_vandale2.png";
        images[4] = "http://upload.wikimedia.org/wikipedia/fr/f/fb/Button_spam2.png";

        images[5] = "http://upload.wikimedia.org/wikipedia/fr/d/d9/Button_trait%C3%A9.png";
        images[6] = "http://upload.wikimedia.org/wikipedia/fr/a/ae/Button_trait%C3%A9conserver.png";
        images[7] = "http://upload.wikimedia.org/wikipedia/fr/9/96/Button_trait%C3%A9supprimer.png";

        images[8] = "http://upload.wikimedia.org/wikipedia/fr/e/e5/Button_copyvio.png";
        images[9] = "http://upload.wikimedia.org/wikipedia/fr/e/e5/Button_copyvio.png";
        images[10] = "http://upload.wikimedia.org/wikipedia/fr/f/f8/Button_suppr.png";
        images[11] = "http://upload.wikimedia.org/wikipedia/fr/c/cf/Button_PAdQ_rejet.png";
        images[12] = "http://upload.wikimedia.org/wikipedia/fr/2/29/Button_PAdQ_validation.png";
        images[13] = "http://upload.wikimedia.org/wikipedia/fr/6/67/Button_%C3%A9clair.png"
        images[14] = "http://upload.wikimedia.org/wikipedia/fr/2/20/Bouton_Portail.png"

        var commentaires = new Array()
        commentaires[0] = "Bienvenue sur ta page !"
        commentaires[1] = "Bienvenue !"
        commentaires[2] = "Avertissement vandalisme"

        commentaires[3] = "Avertissement vandalisme";
        commentaires[4] = "Avertissement spam" ;

        commentaires[5] = "Traité"
        commentaires[6] = "Traité : article conservé" 
        commentaires[7] = "Traité : article supprimé"

        commentaires[8] = "Violation de copyright"
        commentaires[9] = "Violation de copyright";
        commentaires[10] = "Proposé à la suppression"; 

        commentaires[11] = "Notification de rejet de la proposition"
        commentaires[12] = "Notification de validation de la proposition"
        commentaires[13] = "Image - licence inconnue ou imprécise"
        commentaires[14] = "Rajout du bandeau:[[Portail:Les Royaumes Oubliés]]"
        ////////////////////////////////

        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;
}

addLoadEvent(DeluxeBar);
//////////////////////////////////
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[0] = 'Portail:Les_Royaumes_Oubliés'
      urls[1] = 'Projet:Les_Royaumes_Oubliés'
      urls[2] = 'Special:Log/newusers'
      urls[3] = 'Portail:Accueil'
      var labels = new Array()
      labels[0] = 'Portail RO'
      labels[1] = 'Projet RO'
      labels[2] = 'Nvx arrivants'
      labels[3] = 'Portails'
      for (var i=0;i<urls.length;i+=2) {
        tableHTML = '<table valign="top" cellspacing="0" cellpadding="0">'
        tableHTML += '<tr>'
        tableHTML += '<td><a href="' + startUrl + urls[i] + endUrl + '">' + labels[i] + ' | </a></td>'
        tableHTML += '<td><a href="' + startUrl + urls[i+1] + endUrl + '">' + labels[i+1] + '</a></td>'
        tableHTML += '</tr>'
        tableHTML += '</table>' 
        b[0].innerHTML = b[0].innerHTML + tableHTML
      }

    }
  }
}


addLoadEvent(OptimizedNavig);


      function addLoadEvent(func) 
      {
         if (window.addEventListener) 
             window.addEventListener("load", func, false);
         else if (window.attachEvent) 
             window.attachEvent("onload", func);
      }

      function nouvelOnglet() 
      {
        var a = document.getElementById("p-cactions");
        if (a) 
        {
          b = a.getElementsByTagName("ul");
          if(b.length > 0)
          {
            b[0].innerHTML = b[0].innerHTML
            + '<li id="ca-nstab-user">'
            + '<a href="/wiki/Utilisateur:Deadhoax/Bacasable">'
            + 'Ma Test Zone</a></li>';
          }
        }
      }
      
      addLoadEvent(nouvelOnglet);
////////////////////////
//<pre><nowiki>
/* Lien Editcount */
var tabAction = "p-cactions";
function addECButton()
       {
        if ( window.location.href.indexOf('Contributions') < 0) return;
        var c = document.getElementById('contentSub');
        var a = c.getElementsByTagName('a');
        name = a[0].innerHTML;
        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='http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?user="+escape(name)+"&dbname=frwiki_p'>"+
                "<div id='EditCount' style='display:inline;'>" + 
                "Editcount"  + 
                "</div></a></li>";
        l.innerHTML = before + pitem + after ;           
      }
addLoadEvent(addECButton);
//</nowiki></pre>
function NUPatrol()
{
	if ( window.location.href.indexOf( 'Special:Log/newusers') < 0 &&
	     window.location.href.indexOf( '&type=newusers' ) < 0  ) return;

	var items, item, i, links, user, name, talk, contribs, insertLoc, link;

	items = document.getElementById( 'bodyContent' ).getElementsByTagName( 'ul' )[ 0 ].getElementsByTagName( 'li' );

	function NewLink( txt, url, plainlinks, linkColor )
	{	var a = document.createElement( 'a' );
			a.appendChild( document.createTextNode( txt ) );
			a.href = url;
		if ( plainlinks ) a.className = 'plainlinks';
		if ( linkColor )
		{	if ( typeof linkColor == "string" )
					a.style.color = linkColor;
			else	a.style.color = '#FF0000'; // old default behavior
		}
		return a;
	}

	for ( i = 0; i < items.length; i++ )
	{
		item = items[ i ];
		
		links = item.getElementsByTagName( 'a' );

			user = links[ 0 ]; name = user.firstChild.nodeValue;
			talk = links[ 2 ]; talk.firstChild.nodeValue = 'discussion'; // lowercase 'Talk' for consistency
		contribs = links[ 3 ];

		insertLoc = user.nextSibling; // ' newusers '

		item.insertBefore( document.createTextNode( ' ( ' ), insertLoc );

		item.insertBefore( talk, insertLoc );
		item.insertBefore( document.createTextNode( ', ' ), insertLoc );

		item.insertBefore( contribs, insertLoc );
		item.insertBefore( document.createTextNode( ', ' ), insertLoc );

		item.insertBefore( NewLink( 'actions', '/w/index.php?title=Special%3ALog&user=' + name, true, '#000088' ), insertLoc );
		item.insertBefore( document.createTextNode( ', ' ), insertLoc );

		item.insertBefore( NewLink( 'blocages', '/w/index.php?title=Special%3ALog&type=block&page=User%3A' + name, true, '#008800' ), insertLoc );
		item.insertBefore( document.createTextNode( ', ' ), insertLoc );

		item.insertBefore( NewLink( 'est bloqué ?', '/wiki/Special:Ipblocklist?action=search&ip=' + name, true, '#888800' ), insertLoc );
		item.insertBefore( document.createTextNode( ', ' ), insertLoc );

		item.insertBefore( NewLink( 'bloquer', '/w/index.php?title=Special:Blockip&ip=' + name, true, '#880000' ), insertLoc );

		item.insertBefore( document.createTextNode( ' )' ), insertLoc );

		item.removeChild( insertLoc.nextSibling ); // should remove the span
		item.removeChild( insertLoc ); // should remove ' newusers ' text
	}
}
if ( window.addEventListener ) window.addEventListener( 'load', NUPatrol, false );
else if ( window.attachEvent ) window.attachEvent( 'onload', NUPatrol );

/* [[User:Deadhoax|Deadhoax]] ([[User talk:Deadhoax|<small><font style="color:Red;">Disc</font></small>]] | [[Special:Contributions/Deadhoax|<small><font style="color:Red;">Contr</font></small>]]) 2 octobre 2006 à 19:08 (CEST) <-- test */

var tabAction = "p-cactions";
function addPurgeButton()
       {
        // condition à améliorer
        var s = window.location.search;
        if (s.indexOf("?") == -1) {
           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:purgePage();'>"+
                   "<div id='purgeTab' style='display:inline;'>" + 
                   "Purger"  + 
                   "</div></a></li>";
           l.innerHTML = before + pitem + after ;           
        }
      }
function purgePage()
      {
        window.location.search = '?action=purge';
      }

addLoadEvent(addPurgeButton);