Actions

Utilisateur

Utilisateur:Momo50/common.js

De Wikimanche

Note : après avoir publié vos modifications, il se peut que vous deviez forcer le rechargement complet du cache de votre navigateur pour voir les changements.

  • Firefox / Safari : maintenez la touche Maj (Shift) en cliquant sur le bouton Actualiser ou appuyez sur Ctrl + F5 ou Ctrl + R (⌘ + R sur un Mac).
  • Google Chrome : appuyez sur Ctrl + Maj + R (⌘ + Shift + R sur un Mac).
  • Internet Explorer / Edge : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl + F5.
  • Opera : appuyez sur Ctrl + F5.
/* met en surbrillance les pages non patrouillé */
function highlightUnpatrolled() {
  if (wgCanonicalNamespace == 'Special' && wgCanonicalSpecialPageName == 'Recentchanges' ) {
    var colLI = document.getElementsByTagName('li');
    for(var i=0; i<colLI.length; i++) {
      var colSPAN = colLI[i].getElementsByTagName('span');
      if ( colSPAN.length > 0 ) {
        if (colSPAN[0].className == 'unpatrolled') {
          colLI[i].style.backgroundColor = '#FFFF99';
        }
      }
    }
  }
}
addOnloadHook(highlightUnpatrolled);

// Installe wikEd pour l'édition des pages (pour tous)
// Traduction de [[Utilisateur:Leag|Leag]] : [[Utilisateur:Leag/wikEd|wikEd]]

// disable loading for IE, not needed, but might save a few milliseconds
if (navigator.appName != 'Microsoft Internet Explorer') {

// install [[:en:User:Cacycle/wikEd]] in-browser text editor
mw.loader.load( '//fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-WikEd.js/local&action=raw&ctype=text/javascript' );
}

var customizeToolbar = function () {
	/* Your code goes here */
/* Remove button for <big> */
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
	'section': 'advanced',
	'group': 'size',
	'tool': 'big'
});
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"comment": {
			label: 'Comment',
			type: 'button',
			icon: '//upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "<!-- ",
					post: " -->"
				}
			}
		}
	}
} );
};

/* Vérifier si la vue est en mode édition et que les modules requis sont disponibles. Ensuite, personnaliser la barre d'outils... */
/* if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) { */
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
	mw.loader.using( 'user.options' ).then( function () {
		// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
		if ( mw.user.options.get( 'usebetatoolbar' ) == 0 ) {
			$.when(
				mw.loader.using( 'ext.wikiEditor' ), $.ready
			).then( customizeToolbar );
		}
	} );
}