MediaWiki:Guidedtour-tour-wikimooc32c.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 #13 du WikiMOOC
* Ajouter des catégories et portails
*
* Voir [[:mw:Extension:GuidedTour]] pour plus d'informations
*
* Auteur : [[User:0x010C]]
* Création : 7 février 2017
* Dernière révision : 27 février 2017
* [[Catégorie:Guided tour]]
*/
//<nowiki>
( function ( window, document, $, mw, gt ) {
var tour;
tour = new gt.TourBuilder( {
name: 'wikimooc32c',
shouldLog: false
} );
// 1
tour.firstStep( {
name: 'bienvenue',
title: 'Tutoriel #13',
description: new mw.Title( 'Projet:WikiMOOC/2017/GT/3.2/C/1' ),
overlay: true,
closeOnClickOutside: false,
} )
.next( function () {
if ( typeof BandeauxPortails === 'function' && typeof hotcat === 'function' ) {
return 'gadgetsactifs';
}
else {
return 'activergadgets';
}
} )
.transition( function () {
// Si l'apprenant n'est pas connecté
if ( mw.user.getId() === 0 )
return 'connectetoi';
} );
// 2a
tour.step( {
name: 'gadgetsactifs',
title: 'Les gadgets sont actifs',
description: new mw.Title( 'Projet:WikiMOOC/2017/GT/3.2/C/2a' ),
overlay: false,
attachTo: '',
position: '',
closeOnClickOutside: false,
} )
.back( 'bienvenue' )
.next( 'brouillon' );
// 2b
tour.step( {
name: 'activergadgets',
title: 'Activer les gadgets',
description: new mw.Title( 'Projet:WikiMOOC/2017/GT/3.2/C/2b' ),
overlay: true,
attachTo: '#pt-preferences',
position: 'bottomRight',
closeOnClickOutside: false,
} )
.back( 'bienvenue' )
.transition( function() {
if ( typeof BandeauxPortails === 'function' && typeof hotcat === 'function' ) {
return 'bravo';
}
} );
// 3
tour.step( {
name: 'bravo',
title: 'Les gadgets ont été activés',
description: new mw.Title( 'Projet:WikiMOOC/2017/GT/3.2/C/3' ),
overlay: false,
attachTo: '',
position: '',
closeOnClickOutside: false,
} )
.back( 'bienvenue' )
.next( 'brouillon' );
// 4
tour.step( {
name: 'brouillon',
title: 'Allons sur le brouillon',
description: new mw.Title( 'Projet:WikiMOOC/2017/GT/3.2/C/4' ),
overlay: true,
attachTo: '#pt-sandbox',
position: 'bottom',
closeOnClickOutside: false,
} )
.back( 'gadgetsactifs' )
.transition( function() {
if ( mw.config.get( 'wgRelevantUserName' ) === mw.config.get( 'wgUserName' ) && mw.config.get( 'wgPageName' ).split( '/' )[ 1 ] === 'Brouillon' ) {
return 'ajoutercat';
}
} );
// 5
tour.step( {
name: 'ajoutercat',
title: 'Ajouter une catégorie',
description: new mw.Title( 'Projet:WikiMOOC/2017/GT/3.2/C/5' ),
overlay: false,
attachTo: '#hotcat_addlink',
position: 'top',
closeOnClickOutside: false,
onShow: function() {
// Si l'apprenant appuie sur le bouton 'Générer'
$( '#hotcat_addlink' ).click( function() {
gt.setTourCookie( 'wikimooc32c' , 'nomcat' );
gt.launchTourFromUserState();
} );
},
} )
.back( function () {
gt.setTourCookie( 'wikimooc32c', 'brouillon' );
window.location.href = mw.util.getUrl( 'Wikipédia:WikiMOOC/2017/Ajouter des catégories et portails' );
} );
// 6
tour.step( {
name: 'nomcat',
title: 'Nom de la catégorie',
description: new mw.Title( 'Projet:WikiMOOC/2017/GT/3.2/C/6' ),
overlay: false,
attachTo: '#hotcat_text1000',
position: 'right',
closeOnClickOutside: false,
onShow: function() {
// Si l'apprenant appuie sur le bouton 'OK'
$( '#hotcat_OK1000' ).click( function() {
$.cookie( 'gt-wikimooc-32c-7', 'true' );
} );
// Ou s'il appuie sur la touche entrer de son clavier
$( '#hotcat_text1000' ).keypress( function( e ) {
if ( e.which === 13 ) {
$.cookie( 'gt-wikimooc-32c-7', 'true' );
}
} );
},
} )
.next( 'validercat' )
.transition( function() {
if ( $.cookie( 'gt-wikimooc-32c-7' ) !== null ) {
$.removeCookie( 'gt-wikimooc-32c-7' );
return 'ajouterportail';
}
} );
// 7
tour.step( {
name: 'validercat',
title: 'Valider l\'ajout de la catégorie',
description: new mw.Title( 'Projet:WikiMOOC/2017/GT/3.2/C/7' ),
overlay: false,
attachTo: '#hotcat_OK1000',
position: 'right',
closeOnClickOutside: false,
onShow: function() {
// Si l'apprenant appuie sur le bouton 'OK'
$( '#hotcat_OK1000' ).click( function() {
$.cookie( 'gt-wikimooc-32c-7', 'true' );
} );
// Ou s'il appuie sur la touche entrer de son clavier
$( '#hotcat_text1000' ).keypress( function( e ) {
if ( e.which === 13 ) {
$.cookie( 'gt-wikimooc-32c-7', 'true' );
}
} );
},
} )
.back( 'nomcat' )
.transition( function() {
if ( $.cookie( 'gt-wikimooc-32c-7' ) !== null ) {
$.removeCookie( 'gt-wikimooc-32c-7' );
return 'ajouterportail';
}
} );
// 8
tour.step( {
name: 'ajouterportail',
title: 'Ajouter un portail',
description: new mw.Title( 'Projet:WikiMOOC/2017/GT/3.2/C/8' ),
overlay: false,
attachTo: '#BandeauxPortails_Add',
position: 'top',
closeOnClickOutside: false,
onShow: function() {
// Pour faire apparaître le (+) de BandeauxPortails, même sur le brouillon
BandeauxPortails();
// Si l'apprenant appuie sur le bouton 'Générer'
$( '#BandeauxPortails_Add a' ).click( function() {
gt.setTourCookie( 'wikimooc32c' , 'nomportail' );
gt.launchTourFromUserState();
} );
},
} )
.back( 'ajoutercat' );
// 9
tour.step( {
name: 'nomportail',
title: 'Nom du portail',
description: new mw.Title( 'Projet:WikiMOOC/2017/GT/3.2/C/9' ),
overlay: false,
attachTo: '#InputAdd',
position: 'right',
closeOnClickOutside: false,
onShow: function() {
// Si l'apprenant appuie sur le bouton 'OK'
$( '#BP_Form_Add input[type="button"]' ).click( function() {
$.cookie( 'gt-wikimooc-32c-8', 'true' );
} );
// Ou s'il appuie sur la touche entrer de son clavier
$( '#InputAdd' ).keypress( function( e ) {
if ( e.which === 13 ) {
$.cookie( 'gt-wikimooc-32c-8', 'true' );
}
} );
},
} )
.next( 'validerportail' )
.transition( function() {
if ( $.cookie( 'gt-wikimooc-32c-8' ) !== null ) {
$.removeCookie( 'gt-wikimooc-32c-8' );
return 'fin';
}
} );
// 10
tour.step( {
name: 'validerportail',
title: 'Valider l\'ajout du portail',
description: new mw.Title( 'Projet:WikiMOOC/2017/GT/3.2/C/10' ),
overlay: false,
attachTo: '#BP_Form_Add input[type="button"]',
position: 'right',
closeOnClickOutside: false,
onShow: function() {
// Si l'apprenant appuie sur le bouton 'OK'
$( '#BP_Form_Add input[type="button"]' ).click( function() {
$.cookie( 'gt-wikimooc-32c-8', 'true' );
} );
// Ou s'il appuie sur la touche entrer de son clavier
$( '#InputAdd' ).keypress( function( e ) {
if ( e.which === 13 ) {
$.cookie( 'gt-wikimooc-32c-8', 'true' );
}
} );
},
} )
.back( 'nomportail' )
.transition( function() {
if ( $.cookie( 'gt-wikimooc-32c-8' ) !== null ) {
$.removeCookie( 'gt-wikimooc-32c-8' );
return 'fin';
}
} );
// 11
tour.step( {
name: 'fin',
title: 'Fin du tutoriel',
description: new mw.Title( 'Projet:WikiMOOC/2017/GT/3.2/C/11' ),
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/Ajouter des catégories et portails' );
}, 1600 );
},
} ],
allowAutomaticOkay: false,
} )
.back( 'ajouterportail' );
// 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>