« MediaWiki:Guidedtour-tour-interface.js » : différence entre les versions

Définition, traduction, prononciation, anagramme et synonyme sur le dictionnaire libre Wiktionnaire.
Contenu supprimé Contenu ajouté
Ligne 43 : Ligne 43 :
description: new mw.Title( 'Projet:Tutoriels/Interface/2' ),
description: new mw.Title( 'Projet:Tutoriels/Interface/2' ),
attachTo: '#gt-interface-titre',
attachTo: '#gt-interface-titre',
position: 'right',
position: 'rightTop',
autoFocus: true,
autoFocus: true,
closeOnClickOutside: false,
closeOnClickOutside: false,
Ligne 101 : Ligne 101 :
title: 'Modifier la page',
title: 'Modifier la page',
description: new mw.Title( 'Projet:Tutoriels/Interface/6' ),
description: new mw.Title( 'Projet:Tutoriels/Interface/6' ),
attachTo: '#ca-ve-edit',
attachTo: '#ca-edit',
position: 'bottom',
position: 'bottomLeft',
autoFocus: true,
autoFocus: true,
closeOnClickOutside: false,
closeOnClickOutside: false,
Ligne 115 : Ligne 115 :
description: new mw.Title( 'Projet:Tutoriels/Interface/7' ),
description: new mw.Title( 'Projet:Tutoriels/Interface/7' ),
attachTo: '#ca-history',
attachTo: '#ca-history',
position: 'bottom',
position: 'bottomLeft',
autoFocus: true,
autoFocus: true,
closeOnClickOutside: false,
closeOnClickOutside: false,
Ligne 127 : Ligne 127 :
title: 'Suivre une page',
title: 'Suivre une page',
description: new mw.Title( 'Projet:Tutoriels/Interface/8' ),
description: new mw.Title( 'Projet:Tutoriels/Interface/8' ),
attachTo: '#ca-watch',
attachTo: '.mw-watchlink',
position: 'bottom',
position: 'bottomLeft',
autoFocus: true,
autoFocus: true,
closeOnClickOutside: false,
closeOnClickOutside: false,

Version du 16 février 2018 à 12:50

/*
* Tutoriel interactif : L'interface
* Plan et textes sur [[Projet:Tutoriels#L’interface]]
*
* Voir [[:mw:Extension:GuidedTour]] pour plus d'informations
*
* Auteur : [[User:0x010C]]
* [[Catégorie:Guided tour]]
*/

( function ( window, document, $, mw, gt ) {
	var tour;
	// Hack pour placer correctement l'étape 2
	if ( mw.config.get( 'wgPageName' ) == 'fanfreluche' ) {
		$( 'h1' ).html( 'fanfreluche<span id="gt-interface-titre"></span>' );
	}

	tour = new gt.TourBuilder( {
		name: 'interface',
		shouldLog: false
	} );

	// 1
	tour.firstStep( {
		name: 'bienvenue',
		title: 'Bienvenue !',
		description: new mw.Title( 'Projet:Tutoriels/Interface/1' ),
		overlay: true,
		closeOnClickOutside: false,
	} )
	.next( function() {
		window.location.href = mw.util.getUrl( 'fanfreluche' );
	} )
	.transition( function() {
		if ( mw.config.get( 'wgPageName' ) == 'fanfreluche' )
			return 'titre';
	} );
	
	// 2
	tour.step( {
		name: 'titre',
		title: 'Le titre de la page',
		description: new mw.Title( 'Projet:Tutoriels/Interface/2' ),
		attachTo: '#gt-interface-titre',
		position: 'rightTop',
		autoFocus: true,
		closeOnClickOutside: false,
	} )
	.back( 'bienvenue' )
	.next( 'onglets' );
	
	// 3
	tour.step( {
		name: 'onglets',
		title: 'Une interface constante',
		description: new mw.Title( 'Projet:Tutoriels/Interface/3' ),
		attachTo: '#ca-nstab-main',
		position: 'bottomRight',
		autoFocus: true,
		closeOnClickOutside: false,
	} )
	.back( 'titre' )
	.next( 'discussion' );
	
	// 4
	tour.step( {
		name: 'discussion',
		title: 'Articles et discussions',
		description: new mw.Title( 'Projet:Tutoriels/Interface/4' ),
		attachTo: '#ca-talk',
		position: 'bottomRight',
		autoFocus: true,
		closeOnClickOutside: false,
	} )
	.back( 'onglets' )
	.transition( function() {
		if ( mw.config.get( 'wgPageName' ) === 'Discussion:fanfreluche' ) {
			return 'revenirarticle';
		}
	} );
	
	// 5
	tour.step( {
		name: 'revenirarticle',
		title: 'Articles et discussions',
		description: new mw.Title( 'Projet:Tutoriels/Interface/5' ),
		attachTo: '#ca-nstab-main',
		position: 'bottomRight',
		autoFocus: true,
		closeOnClickOutside: false,
	} )
	.transition( function() {
		if ( mw.config.get( 'wgPageName' ) === 'fanfreluche' ) {
			return 'modifier';
		}
	} );
	
	// 6
	tour.step( {
		name: 'modifier',
		title: 'Modifier la page',
		description: new mw.Title( 'Projet:Tutoriels/Interface/6' ),
		attachTo: '#ca-edit',
		position: 'bottomLeft',
		autoFocus: true,
		closeOnClickOutside: false,
	} )
	.back( 'discussion' )
	.next( 'historique' );
	
	// 7
	tour.step( {
		name: 'historique',
		title: 'L\'historique',
		description: new mw.Title( 'Projet:Tutoriels/Interface/7' ),
		attachTo: '#ca-history',
		position: 'bottomLeft',
		autoFocus: true,
		closeOnClickOutside: false,
	} )
	.back( 'modifier' )
	.next( 'lds' );
	
	// 8
	tour.step( {
		name: 'lds',
		title: 'Suivre une page',
		description: new mw.Title( 'Projet:Tutoriels/Interface/8' ),
		attachTo: '.mw-watchlink',
		position: 'bottomLeft',
		autoFocus: true,
		closeOnClickOutside: false,
	} )
	.back( 'historique' )
	.next( 'interlangues' );
	
	// 9
	tour.step( {
		name: 'interlangues',
		title: 'Pour les polyglottes',
		description: new mw.Title( 'Projet:Tutoriels/Interface/9' ),
		attachTo: '#p-lang-label',
		position: 'rightTop',
		autoFocus: true,
		closeOnClickOutside: false,
	} )
	.back( 'lds' )
	.next( function() {
		window.location.href = mw.util.getUrl( 'Aide:Tutoriel/Interface' );
	} )
	.transition( function() {
		if(mw.config.get( 'wgPageName' ) === 'Aide:Tutoriel/Interface' )
			return 'fin';
	} );

	// 10	
	tour.step( {
		name: 'fin',
		title: 'Fin',
		description: new mw.Title( 'Projet:Tutoriels/Interface/10' ),
		autoFocus: true,
		overlay: true,
		closeOnClickOutside: false,
		buttons: [ {
			action: 'end'
		} ],
		allowAutomaticOkay: false,
	} );

	window.tour = tour;
	
	//Ajout d'un bouton en bas à droite pour permettre de réafficher une étape accidentellement fermé
	mw.loader.using( [ 'oojs-ui' ], function () {
		var reloadButton = new OO.ui.ButtonWidget( {
			label: 'Réafficher l\'étape courante',
			icon: 'redo',
			iconTitle: 'Réafficher'
		} );
		reloadButton.on( 'click', function() {
			gt.launchTourFromUserState();
		} );
		var container = $( '<div>' );
		container.append( reloadButton.$element[ 0 ] );
		container.css( 'position', 'fixed' ).css( 'bottom', '0px' ).css( 'right', '0px' ).css( 'z-index', '3000' ).appendTo( 'body' );
	} );

} ( window, document, jQuery, mediaWiki, mediaWiki.guidedTour ) );