MediaWiki:Guidedtour-tour-wikimooc51b.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
Documentation for this user script can be added at MediaWiki:Guidedtour-tour-wikimooc51b. |
( function ( window, document, $, mw, gt ) {
var tour;
tour = new gt.TourBuilder( {
name: 'wikimooc51b',
shouldLog: false
} );
// Switch the namespace depending on which wiki we are
var namespace = 'Projet:';
if ( mw.config.get( 'wgDBname' ) === 'commonswiki' ) {
namespace = 'Commons:';
}
// 1
tour.firstStep( {
name: 'bienvenue',
title: 'Tutoriel #14',
description: new mw.Title( namespace + 'WikiMOOC/2017/GT/5.1/B/1' ),
overlay: true,
closeOnClickOutside: false,
} )
.next( function() {
window.location.href = mw.util.getUrl( ':c:Accueil' ) + '?tour=wikimooc51b&step=commons';
} )
.transition( function() {
// Si l'apprenant n'est pas connecté
if ( mw.user.getId() === 0 )
return 'connectetoi';
} );
// 1b
tour.step( {
name: 'commons',
title: 'Bienvenue sur Commons !',
description: new mw.Title( namespace + 'WikiMOOC/2017/GT/5.1/B/1b' ),
overlay: true,
closeOnClickOutside: false,
} )
.back( function() {
window.location.href = mw.util.getUrl( ':fr:Wikipédia:WikiMOOC/2017/Chercher une image sur Commons' ) + '?tour=wikimooc51b&step=bienvenue';
} )
.next(function() {
// Si l'apprenant n'est pas connecté
if ( mw.user.getId() === 0 ) {
return 'connectetoi';
}
return 'boiterecherche';
} );
// 2
tour.step( {
name: 'boiterecherche',
title: 'Barre de recherche',
description: new mw.Title( namespace + 'WikiMOOC/2017/GT/5.1/B/2' ),
overlay: false,
attachTo: '#searchInput',
position: 'bottomRight',
closeOnClickOutside: false,
} )
.back( 'commons' )
.next(function() {
$('#searchInput').attr('value', 'Kilimanjaro');
$("#searchInput").trigger("keypress");
return 'rechercheencours';
} );
// 3
tour.step( {
name: 'rechercheencours',
title: 'Rechercher',
description: new mw.Title( namespace + 'WikiMOOC/2017/GT/5.1/B/3' ),
overlay: false,
attachTo: '.mw-searchSuggest-link .suggestions-special',
position: 'left',
closeOnClickOutside: false,
} )
.back( 'boiterecherche' )
.next(function() {
gt.setTourCookie( 'wikimooc51b', 'resultats' );
window.location.href = 'https://commons.wikimedia.org/w/index.php?search=Kilimanjaro&title=Special%3ASearch&fulltext=1';
} );
// 4
tour.step( {
name: 'resultats',
title: 'Page des résultats',
description: new mw.Title( namespace + 'WikiMOOC/2017/GT/5.1/B/4' ),
overlay: false,
attachTo: '.searchResultImage',
position: 'right',
closeOnClickOutside: false,
} )
.back( function() {
gt.setTourCookie( 'wikimooc51b', 'boiterecherche' );
window.location.href = mw.util.getUrl( 'Accueil' );
} )
.next(function() {
gt.setTourCookie( 'wikimooc51b', 'image' );
window.location.href = mw.util.getUrl( 'File:Kilimanjaro from Amboseli.jpg' );
} );
// 5
tour.step( {
name: 'image',
title: 'Composition de la page d\'une image',
description: new mw.Title( namespace + 'WikiMOOC/2017/GT/5.1/B/5' ),
overlay: false,
closeOnClickOutside: false,
} )
.back( function() {
gt.setTourCookie( 'wikimooc51b', 'resultats' );
window.location.href = 'https://commons.wikimedia.org/w/index.php?search=Kilimanjaro&title=Special%3ASearch&fulltext=1';
} )
.next( 'description' );
// 6
tour.step( {
name: 'description',
title: 'Descriptif',
description: new mw.Title( namespace + 'WikiMOOC/2017/GT/5.1/B/6' ),
overlay: false,
attachTo: '.commons-file-information-table',
position: 'bottomLeft',
closeOnClickOutside: false,
} )
.back( 'image' )
.next( 'licence' );
// 7
tour.step( {
name: 'licence',
title: 'Licence',
description: new mw.Title( namespace + 'WikiMOOC/2017/GT/5.1/B/7' ),
overlay: false,
attachTo: '.licensetpl_wrapper',
position: 'bottomLeft',
closeOnClickOutside: false,
} )
.back( 'description' )
.next( function() {
gt.setTourCookie( 'wikimooc51b', 'recherchebis' );
window.location.href = 'https://commons.wikimedia.org/w/index.php?search=Kilimanjaro&title=Special%3ASearch&fulltext=1';
} );
// 8
tour.step( {
name: 'recherchebis',
title: 'Des images, mais aussi des pages...',
description: new mw.Title( namespace + 'WikiMOOC/2017/GT/5.1/B/8' ),
overlay: false,
attachTo: '.mw-search-result-heading',
position: 'right',
closeOnClickOutside: false,
} )
.back( function() {
gt.setTourCookie( 'wikimooc51b', 'licence' );
window.location.href = mw.util.getUrl( 'File:Kilimanjaro from Amboseli.jpg' );
} )
.next(function() {
gt.setTourCookie( 'wikimooc51b', 'page' );
window.location.href = mw.util.getUrl( 'Kilimanjaro' );
} );
// 9
tour.step( {
name: 'page',
title: 'Voici une page',
description: new mw.Title( namespace + 'WikiMOOC/2017/GT/5.1/B/9' ),
overlay: false,
attachTo: '.gallery mw-gallery-traditional',
position: 'top',
closeOnClickOutside: false,
} )
.back( function() {
gt.setTourCookie( 'wikimooc51b', 'recherchebis' );
window.location.href = 'https://commons.wikimedia.org/w/index.php?search=Kilimanjaro&title=Special%3ASearch&fulltext=1';
} )
.next(function() {
gt.setTourCookie( 'wikimooc51b', 'rechercheter' );
window.location.href = 'https://commons.wikimedia.org/w/index.php?search=Kilimanjaro&title=Special%3ASearch&fulltext=1';
} );
// prepare step 10
if ( mw.config.get( 'wgPageName' ) === 'Special:Search' ) {
$( 'a:contains("Category:Kilimanjaro")' ).attr( 'id', 'gt-mooc-51b-10' );
}
// 10
tour.step( {
name: 'rechercheter',
title: 'Des images, mais aussi des catégories !',
description: new mw.Title( namespace + 'WikiMOOC/2017/GT/5.1/B/10' ),
overlay: false,
attachTo: '#gt-mooc-51b-10',
position: 'right',
closeOnClickOutside: false,
} )
.back( function() {
gt.setTourCookie( 'wikimooc51b', 'page' );
window.location.href = mw.util.getUrl( 'Kilimanjaro' );
} )
.next(function() {
gt.setTourCookie( 'wikimooc51b', 'category' );
window.location.href = mw.util.getUrl( 'Category:Kilimanjaro' );
} );
// 11
tour.step( {
name: 'category',
title: 'Et voici la catégorie',
description: new mw.Title( namespace + 'WikiMOOC/2017/GT/5.1/B/11' ),
overlay: false,
attachTo: '#mw-category-media',
position: 'top',
closeOnClickOutside: false,
} )
.back( function() {
gt.setTourCookie( 'wikimooc51b', 'rechercheter' );
window.location.href = 'https://commons.wikimedia.org/w/index.php?search=Kilimanjaro&title=Special%3ASearch&fulltext=1';
} )
.next(function() {
gt.endTour();
window.location.href = mw.util.getUrl( ':fr:Wikipédia:WikiMOOC/2017/Chercher une image sur Commons' ) + '?tour=wikimooc51b&step=fin';
} );
// 12
tour.step( {
name: 'fin',
title: 'Fin du tutoriel',
description: new mw.Title( namespace + 'WikiMOOC/2017/GT/5.1/B/12' ),
overlay: true,
closeOnClickOutside: false,
buttons: [ {
action: 'okay',
onclick: function() {
gt.endTour();
},
} ],
allowAutomaticOkay: false,
} );
// 0
tour.step( {
name: 'connectetoi',
title: 'Connectez-vous',
description: new mw.Title( namespace + 'WikiMOOC/2017/GT/0' ),
autoFocus: true,
overlay: true,
closeOnClickOutside: false,
} )
.transition( function() {
// Si l'apprenant s'est connecté
if ( mw.user.getId() !== 0 ) {
if ( mw.config.get( 'wgDBname' ) === 'commonswiki' ) {
return 'commons';
}
else {
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',
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 ) );