MediaWiki:Guidedtour-tour-wikifundi12e.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) ;

Chrome / Internet Explorer / Opera : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5.
/*
* Guidedtour #4 de WikiFundi
* Première modification
*
* Voir [[:mw:Extension:GuidedTour]] pour plus d'informations
*
* Auteur : [[User:Anthere]], adapté de 
* Auteur : [[User:0x010C]]
* Création : 10 novembre 2016
* Dernière révision : 11 juin 2018
* [[Catégorie:Guided tour]]
*/
//<nowiki>

( function ( window, document, $, mw, gt ) {
	var tour;

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

	// 1
	tour.firstStep( {
		name: 'bienvenue',
		title: 'Tutoriel #4 (1/9)',
		description: new mw.Title( 'Projet:WikiFundi/2018/GT/1.2/E/1' ),
		overlay: true,
		closeOnClickOutside: false,
	} )
	.next( 'explicationsbrouillon' )
	.transition( function() {
		// Si l'apprenant n'est pas connecté
		if ( mw.user.getId() === 0 )
			return 'connectetoi';
	} );
	
	// 2
	tour.step( {
		name: 'explicationsbrouillon',
		title: 'À quoi sert le brouillon ? (2/9)',
		description: new mw.Title( 'Projet:WikiFundi/2018/GT/1.2/E/2' ),
		overlay: true,
		closeOnClickOutside: false,
	} )
	.back( 'bienvenue' )
	.next( 'lienbrouillon' );
	
	// 3
	tour.step( {
		name: 'lienbrouillon',
		title: 'Accéder à son brouillon (3/9)',
		description: new mw.Title( 'Projet:WikiFundi/2018/GT/1.2/E/3' ),
		overlay: false,
		attachTo: '#pt-sandbox',
		position: 'bottom',
		closeOnClickOutside: false,
	} )
	.back( 'explicationsbrouillon' )
	.transition( function() {
		if ( mw.config.get( 'wgRelevantUserName' ) == mw.config.get( 'wgUserName' ) && mw.config.get( 'wgPageName' ).split( '/' )[ 1 ] == 'Brouillon' ) {
			if ( $( '#pt-sandbox .new' ).length === 1 ) {
				return 'creerbrouillon';
			}
			else {
				return 'editerbrouillon';
			}
		}
	} );
	
	// 4
	tour.step( {
		name: 'creerbrouillon',
		title: 'Création du brouillon (4/9)',
		description: new mw.Title( 'Projet:WikiFundi/2018/GT/1.2/E/4' ),
		overlay: false,
		attachTo: '#ca-ve-edit',
		position: 'bottom',
		closeOnClickOutside: false,
		onShow: function() {
			mw.hook( 've.activationComplete' ).add( function () {
			 	gt.setTourCookie( 'wikifundi12e', 'ev' );
			 	gt.launchTourFromUserState();
			} );
		},
	} )
	.back( 'lienbrouillon' );
	
	// 4b
	tour.step( {
		name: 'editerbrouillon',
		title: 'Édition du brouillon (4/9)',
		description: new mw.Title( 'Projet:WikiFundi/2018/GT/1.2/E/4b' ),
		overlay: false,
		attachTo: '#ca-ve-edit',
		position: 'bottom',
		closeOnClickOutside: false,
		onShow: function() {
			mw.hook( 've.activationComplete' ).add( function () {
			 	gt.setTourCookie( 'wikifundi12e', 'ev' );
			 	gt.launchTourFromUserState();
			} );
		},
	} )
	.back( 'lienbrouillon' );
	
	// 5
	tour.step( {
		name: 'ev',
		title: 'L\'Éditeur Visuel (5/9)',
		description: new mw.Title( 'Projet:WikiFundi/2018/GT/1.2/E/5' ),
		overlay: true,
		closeOnClickOutside: false,
		onShow: function() {
			$( '.oo-ui-toolbar-tools div:nth-of-type(3)' ).removeClass( 'oo-ui-popupToolGroup-active oo-ui-popupToolGroup-left' );
		},
	} )
	.next( 'mef' );
	
	// 6
	tour.step( {
		name: 'mef',
		title: 'Mise en forme du texte (6/9)',
		description: new mw.Title( 'Projet:WikiFundi/2018/GT/1.2/E/6' ),
		overlay: true,
		attachTo: '.oo-ui-toolbar-tools:nth-of-type(2) div:nth-of-type(3) div',
		position: 'right',
		closeOnClickOutside: false,
		onShow: function() {
			$( '.oo-ui-toolbar-tools div:nth-of-type(3)' ).addClass( 'oo-ui-popupToolGroup-active oo-ui-popupToolGroup-left' );
		},
	} )
	.back( 'ev' )
	.next( 'exercice' );
	
	// 7
	tour.step( {
		name: 'exercice',
		title: 'À vous de jouer ! (7/9)',
		description: new mw.Title( 'Projet:WikiFundi/2018/GT/1.2/E/7' ),
		overlay: true,
		closeOnClickOutside: false,
		onShow: function() {
			$( '.oo-ui-toolbar-tools div:nth-of-type(3)' ).removeClass( 'oo-ui-popupToolGroup-active oo-ui-popupToolGroup-left' );
			mw.hook( 've.saveDialog.stateChanged' ).add(function(){
				gt.setTourCookie( 'wikifundi12e', 'resumediff' );
				gt.launchTourFromUserState();
			} );
		},
	} )
	.back( 'mef' );
	
	// 8
	tour.step( {
		name: 'resumediff',
		title: 'Boîte de résumé (8/9)',
		description: new mw.Title( 'Projet:WikiFundi/2018/GT/1.2/E/8' ),
		attachTo: '.ve-ui-mwSaveDialog-savePanel textarea',
		position: 'bottomLeft',
		closeOnClickOutside: false,
	} )
	.back( 'exercice' )
	.transition( function() {
		if ( mw.config.get( 'wgRelevantUserName' ) == mw.config.get( 'wgUserName' ) && mw.config.get( 'wgPageName' ).split( '/' )[ 1 ] == 'Brouillon' && gt.isPostEdit() ) {
			return 'resultat';
		}
	} );
	
	// 9
	tour.step( {
		name: 'resultat',
		title: 'Résultat (9/9)',
		description: new mw.Title( 'Projet:WikiFundi/2018/GT/1.2/E/9' ),
		overlay: true,
		closeOnClickOutside: false,
		buttons: [ {
			action: 'okay',
			onclick: function() {
				gt.endTour();
				setTimeout(function() {
					window.location.href = mw.util.getUrl( 'Wikipédia:WikiFundi/2018/Première_modification' );
				}, 1000);
			},
		} ],
		allowAutomaticOkay: false,
	} )
	.back( 'resumediff' );



	// 0
	tour.step( {
		name: 'connectetoi',
		title: 'Connectez-vous',
		description: new mw.Title( 'Projet:WikiFundi/2018/GT/0' ),
		autoFocus: true,
		overlay: true,
		closeOnClickOutside: false,
	} )
	.transition( function() {
		// Si l'apprenant s'est connecté
		if ( mw.user.getId() !== 0 )
			return 'bienvenue';
	} );
	
	//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',
			title: '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 ) );

//</nowiki>