MediaWiki:Gadget-EspaceReference.js

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.
/*
 * Code pour l'espace de noms 'Référence'
 * Choix du mode d'affichage des références
 * @note L'ordre de cette liste doit correspondre à celui de Modèle:Édition !
 */

/* globals $ */

mw.hook( 'wikipage.content' ).add( function ( $content ) {
	'use strict';

	var $specialBib = $content.find( '#specialBib' );
	if ( !$specialBib.length ) {
		return;
	}

	// select subsection of special characters
	var chooseBibSubset = function ( s ) {
		$content.find( '.edition-Liste' ).css( 'display', s === 0 ? 'block' : 'none' );
		$content.find( '.edition-WikiNorme' ).css( 'display', s === 1 ? 'block' : 'none' );
		$content.find( '.edition-BibTeX' ).css( 'display', s === 2 ? 'block' : 'none' );
		$content.find( '.edition-ISBD' ).css( 'display', s === 3 ? 'block' : 'none' );
		$content.find( '.edition-ISO690' ).css( 'display', s === 4 ? 'block' : 'none' );
	};

	var $menu = $( '<select>' )
		.css( 'display', 'inline' )
		.change( function () {
			chooseBibSubset( this.selectedIndex );
		} )
		.append(
			$( '<option>' ).text( 'Liste' ),
			$( '<option>' ).text( 'WikiNorme' ),
			$( '<option>' ).text( 'BibTeX' ),
			$( '<option>' ).text( 'ISBD' ),
			$( '<option>' ).text( 'ISO690' )
		);

	$specialBib.append( $menu );

	/* default subset - try to use a cookie some day */
	chooseBibSubset( 0 );

} );