User:Jean-Frédéric/monobook.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
importScript('user:esby/testls2.js');
importScript("User:Jean-Frédéric/flickrLinks.js");

//Description Seeker

languagesArray=new Array("en","es","de");
languageSpoken="fr";
depth=0;

importScript("User:Jean-Frédéric/descriptionSeeker.js");

mw.loader.load('https://fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-QPreview.js&action=raw&ctype=text/javascript');

/*
 * HotCatsàGauche
 *
 * Met les catégories,avec les liens HotCats, dans un panneau de navigation
 *
 * Auteur : Original par Jmfayard, Version modifiée par Jean-Fred
 * Dernière révision : 26 juin 2009
 */
 
function CategoriesAGauche() {
 
	var catlinks = document.getElementById("mw-normal-catlinks");
	if (!catlinks) { return; }
	var categories = catlinks.getElementsByTagName("a") ;
 
	var h5_cats = document.createElement( "h5" );
	var text = document.createTextNode( "Catégories" ) ;
	h5_cats.appendChild( text ) ;
 
	var div_cats = document.createElement( "div" );
	div_cats.setAttribute( "class", "pBody" );
 
	var ul = document.createElement( "ul" );
 
	var len = categories.length;
	if (wgAction == 'view'){
	
		for (var i = 1 ; i < len-2 ; i+=3 ) {
			var li = document.createElement( "li" ) ;
			li.appendChild(categories[i].cloneNode(1));
			li.appendChild (document.createTextNode (' '));
			li.appendChild(categories[i+1].cloneNode(1));
			li.appendChild (document.createTextNode (' '));
			li.appendChild(categories[i+2].cloneNode(1));
			ul.appendChild( li );
		}
		//Le lien d'ajout rapide 
		var a = categories[len -1];
		var li = document.createElement( "li" ) ;
		li.appendChild( a.cloneNode(1)) ;
		ul.appendChild( li );
	}
	else
	{
		for (var i = 1 ; i < len ; i++ )
		{
			var li = document.createElement( "li" ) ;
			li.appendChild(categories[i].cloneNode(1));
			ul.appendChild( li );
		}
	}
 
 
	//Les catégories cachées
	var hiddencatlinks = document.getElementById("mw-hidden-catlinks");
	if (hiddencatlinks) 
	{ 
		var hiddencategories = hiddencatlinks.getElementsByTagName("a") ;
		for (var i = 0 ; i < hiddencategories.length ; i++ ) 
		{
			var li = document.createElement( "li" ) ;
			li.appendChild(hiddencategories[i].cloneNode(1));
			ul.appendChild( li );
		}
	}
 
	div_cats.appendChild( ul ) ;
 
	var portlet = document.createElement( "div" ) ;
	portlet.setAttribute( "class", "portlet" );
	portlet.setAttribute( "id", "p-cat" ) ;
 
	portlet.appendChild( h5_cats ) ;
 
	portlet.appendChild( div_cats ) ;
 
	//document.getElementById("column-one").insertBefore( document.getElementById("p-search"),  portlet ) ;
	//document.getElementById("column-one").appendChild(  portlet ) ;
	div_ptb = document.getElementById( "p-tb" );
	document.getElementById("column-one").insertBefore( portlet, div_ptb)
}
 
addOnloadHook( CategoriesAGauche ) ;


/*----------------------------------------------------------------------------
 * Ajoute des commentaires de modification prédéfinis
 *
 * Auteur : Dake
 * Contributions : Pabix, Tieno
 * Date de dernière révision : 12 novembre 2006
 */
//////////////////////ZONE PERSONNALISABLE//////////////////////
var resumedeluxeTitles = new Array();
with (resumedeluxeTitles) {
        push("Fr desc");
        push("- En desc");
        push("- Norm");
        push("- Cat");
        push("- I18n");
        push("- Mérimée");
        push("- Mld");
        push("- On WP");
        push("- ObLoc");
        push("- Painting");
        push("- Personality");
        push("- Taxo");
        push("- PhotoInfo");
        push("- Auto");
        push("- Fallback");
        push("- Switch");
        push("- lle");
        push("- Box");
}
var resumedeluxeInputs= new Array();
with (resumedeluxeInputs) {
        push("Description in french");
        push("Description in english");
        push("Normalisation");
        push("Categorisation");
        push("Creation for Internationalisation");
        push("Using [[Template:Mérimée|{{Mérimée}}]]");
        push("Using [[Template:Mld|{{Mld}}]]");
        push("Using [[Template:On Wikipedia|{{On Wikipedia}}]]");
        push("Using [[Template:Object location|{{Object location}}]]");
        push("Using [[Template:Painting|{{Painting}}]]");
        push("Using [[Template:Personality rights|{{Personality rights}}]]");
        push("Using [[Template:Taxonavigation|{{Taxonavigation}}]]");
        push("Using [[Template:Photo information|{{Photo information}}]]");
        push("Enabling internationalisation using [[Template:Autotranslate|{{Autotranslate}}]]");
        push("Enabling internationalisation using [[Template:Fallback|{{Fallback}}]]");
        push("Enabling internationalisation using [[Template:LangSwitch|{{LangSwitch}}]]");
        push("Update using [[Template:lle|{{lle}}]]");
        push("Creation using [[Template:TemplateBox|{{TemplateBox}}]]");
}
/////////////////FIN DE LA ZONE PERSONNALISABLE/////////////////

function setSummary(str)
{
        document.editform.wpSummary.value = str;
}

function addToSummary(str)
{
        var resum = document.editform.wpSummary.value;
        if(resum != 0 && resum.indexOf("*/") < resum.length - 3) {
                document.editform.wpSummary.value += " - ";
        }
        document.editform.wpSummary.value += str;
}

function DeluxeSummary()
{
        var sumLbl = document.getElementById("wpSummaryLabel");
        if(sumLbl) {
                var sumInput = document.getElementById("wpSummary");
                sumInput.style.width = "95%";
                var str = "Messages prédéfinis : ";
                for(var cpt = 0; cpt < resumedeluxeTitles.length; cpt ++) {
                        str += "<a href=\"javascript:addToSummary('" +resumedeluxeInputs[cpt] + "')\""
                                + " class=\"sumLink\" title=\"Ajouter '" +resumedeluxeInputs[cpt] +"' dans la boîte de résumé\">"
                                + resumedeluxeTitles[cpt]
                                + "</a> ";
                }
                sumLbl.innerHTML = str + "<br />" + sumLbl.innerHTML;
        }
}
$(DeluxeSummary);
//

function addGreatPicsTab()
{
  if(wgNamespaceNumber == 14){
     var title = encodeURIComponent (wgTitle.split (" ").join ("_"));
     mw.util.addPortletLink('p-cactions','http://toolserver.org/~magnus/catscan_rewrite.php?language=commons&project=wikimedia&depth=10&categories='+title+'&ns[6]=1&templates_any=Quality+image%0D%0AVI%0D%0AAssessments&sortby=title&ext_image_data=1&doit=1', 'Great Pictures', 'ca-greatpics');
  }
}

$(addGreatPicsTab);