MediaWiki:Guidedtour-tour-wikimooc7ccl.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 #17 du WikiMOOC
* Publication du brouillon
*
* Voir [[:mw:Extension:GuidedTour]] pour plus d'informations
*
* Auteur : [[User:0x010C]]
* Création : 9 février 2017
* Dernière révision : 10 février 2017
* [[Catégorie:Guided tour|Guidedtour-tour-wikimooc70ccl.js]]
*/
//<nowiki>

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

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

	// 1
	tour.firstStep( {
		name: 'bienvenue',
		title: 'Tutoriel #17',
		description: new mw.Title( 'Projet:WikiMOOC/2017/GT/CCL/1' ),
		overlay: true,
		closeOnClickOutside: false,
		onShow: function() {
			var api = new mw.Api();
			api.postWithToken( 'csrf', {
				action: 'edit',
				title: 'Projet:MOOC/2017/Participation/CCL',
				summary: 'Émargement automatique pour le module de conclusion du WikiMOOC',
				tags: 'wikimooc2017',
				appendtext: '\n{{u|' + mw.config.get( 'wgUserName' ) + '}}',
				format: 'json',
			} );
		},
	} )
	.next( 'warning' )
	.transition( function () {
		// Si l'apprenant n'est pas connecté
		if ( mw.user.getId() === 0 )
			return 'connectetoi';
	} );
	
	// 2
	tour.step( {
		name: 'warning',
		title: 'Avertissement',
		description: new mw.Title( 'Projet:WikiMOOC/2017/GT/CCL/2' ),
		overlay: false,
		attachTo: '',
		position: '',
		closeOnClickOutside: false,
	} )
	.back( 'bienvenue' )
	.next( 'brouillon' )
	.transition( function() {
		
	} );
	
	// 3
	tour.step( {
		name: 'brouillon',
		title: 'Allons sur le brouillon',
		description: new mw.Title( 'Projet:WikiMOOC/2017/GT/CCL/3' ),
		overlay: false,
		attachTo: '#pt-sandbox',
		position: 'bottomRight',
		closeOnClickOutside: false,
	} )
	.back( 'warning' )
	.transition( function() {
		if ( mw.config.get( 'wgPageName' ) !== 'Wikipédia:WikiMOOC/2017/Publication_du_brouillon' ) {
			return 'renommer';
		}
	} );
	
	// 4
	tour.step( {
		name: 'renommer',
		title: 'Renommons !',
		description: new mw.Title( 'Projet:WikiMOOC/2017/GT/CCL/4' ),
		overlay: false,
		attachTo: '#p-cactions-label',
		position: 'bottom',
		closeOnClickOutside: false,
	} )
	.back( function() {
		gt.setTourCookie( 'wikimooc7ccl', 'brouillon' );
		window.location.href = mw.util.getUrl( 'Wikipédia:WikiMOOC/2017/Publication du brouillon' );
	} )
	.transition( function() {
		if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Movepage' ) {
			return 'namespace';
		}
	} );
	
	// 5
	tour.step( {
		name: 'namespace',
		title: 'Changer d\'espace de nom',
		description: new mw.Title( 'Projet:WikiMOOC/2017/GT/CCL/5' ),
		overlay: false,
		attachTo: '#wpNewTitleNs',
		position: 'top',
		closeOnClickOutside: false,
	} )
	.back( 'renommer' )
	.next( 'titre' );
	
	// 6
	tour.step( {
		name: 'titre',
		title: 'Adapter le titre',
		description: new mw.Title( 'Projet:WikiMOOC/2017/GT/CCL/6' ),
		overlay: false,
		attachTo: '#wpNewTitleMain',
		position: 'top',
		closeOnClickOutside: false,
	} )
	.back( 'namespace' )
	.next( 'motif' );
	
	// 7
	tour.step( {
		name: 'motif',
		title: 'Expliquer votre renommage',
		description: new mw.Title( 'Projet:WikiMOOC/2017/GT/CCL/7' ),
		overlay: false,
		attachTo: '#wpReason',
		position: 'right',
		closeOnClickOutside: false,
	} )
	.back( 'titre' )
	.next( 'cases' );
	
	// 8
	tour.step( {
		name: 'cases',
		title: 'Les options de renommage',
		description: new mw.Title( 'Projet:WikiMOOC/2017/GT/CCL/8' ),
		overlay: false,
		attachTo: '#wpLeaveRedirect',
		position: 'right',
		closeOnClickOutside: false,
	} )
	.back( 'motif' )
	.next( 'valider' );
	
	// 9
	tour.step( {
		name: 'valider',
		title: 'Et on valide',
		description: new mw.Title( 'Projet:WikiMOOC/2017/GT/CCL/9' ),
		overlay: false,
		attachTo: 'button',
		position: 'right',
		closeOnClickOutside: false,
	} )
	.back( 'cases' )
	.transition( function() {
		if ( mw.config.get( 'wgAction' ) === 'view' && mw.config.get( 'wgCanonicalSpecialPageName' ) !== 'Movepage' ) {
			return 'fin';
		}
	} );
	
	// 10
	tour.step( {
		name: 'fin',
		title: 'Félicitations !',
		description: new mw.Title( 'Projet:WikiMOOC/2017/GT/CCL/10' ),
		overlay: false,
		attachTo: '',
		position: '',
		closeOnClickOutside: false,
		buttons: [ {
			action: 'okay',
			onclick: function() {
				gt.endTour();
				setTimeout( function() {
					window.location.href = mw.util.getUrl( 'Wikipédia:WikiMOOC/2017/Naviguer dans les catégories' );
				}, 2400 );
			},
		} ],
		allowAutomaticOkay: false,
	} );



	// 0
	tour.step( {
		name: 'connectetoi',
		title: 'Connectez-vous',
		description: new mw.Title( 'Projet:WikiMOOC/2017/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>