MediaWiki:Guidedtour-tour-tuto1.js

Na Galipedia, a Wikipedia en galego.
/*
* Titorial adaptado de https://fr.wikipedia.org/wiki/MediaWiki:Guidedtour-tour-tuto1.js
* Titorial 1 de Axuda:Wikipedia paso a paso
* Interface dos artigos
*
* Ver [[:mw:Extension:GuidedTour]] para máis información
*
* Autor: [[User:0x010C]]
* Creación: 25 octobre 2016
* Última revisión: 17 de xaneiro de 2018 / funciona (Chrome Windows 7) ata o 2 de abril de 2019

* Adaptación: [[User:Elisardojm]], 10 de abril de 2020
*/
//<nowiki>

( function ( window, document, $, mw, gt ) {
	var tour;
	
	// Preparar detalles para colocar correctamente algunhas caixas
	//step2
	if ( mw.config.get( 'wgPageName' ) == 'Framboeseiro' ) {
		$( 'h1' ).html( 'Framboeseiro<span id="gt-mooc-12b-titre"></span>' );
	}

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

	// 1
	tour.firstStep( {
		name: 'benvida',
		title: 'Benvida! (1/11)',
		description: new mw.Title( 'Axuda:Proxecto:WikiMOOC/2017/GT/1.2/B/1' ),
		overlay: true,
		closeOnClickOutside: false,
	} )
	.next( function() {
		window.location.href = mw.util.getUrl( 'Framboeseiro' );
	} )
	.transition( function() {
		// Se o alumno non está conectado
		if ( mw.user.getId() === 0 )
			return 'conectarse';
		if ( mw.config.get( 'wgPageName' ) == 'Framboeseiro' )
			return 'título';
	} );
	
	// 2
	tour.step( {
		name: 'título',
		title: 'Título do artigo (2/11)',
		description: new mw.Title( 'Axuda:Wikipedia paso a paso/Textos/T1E2' ),
		attachTo: '#gt-mooc-12b-titre',
		position: 'right',
		autoFocus: true,
		closeOnClickOutside: false,
	} )
	.back( 'benvida' )
	.next( 'pestanas' );
	
	// 3
	tour.step( {
		name: 'pestanas',
		title: 'Unha interface constante (3/11)',
		description: new mw.Title( 'Axuda:Wikipedia paso a paso/WikiMOOC/2017/GT/1.2/B/3' ),
		attachTo: '#ca-nstab-main',
		position: 'bottomRight',
		autoFocus: true,
		closeOnClickOutside: false,
	} )
	.back( 'título' )
	.next( 'conversa' );
	
	// 4
	tour.step( {
		name: 'conversa',
		title: 'Desprácese entre o artigo e as conversas (4/11)',
		description: new mw.Title( 'Axuda:Wikipedia paso a paso/WikiMOOC/2017/GT/1.2/B/4' ),
		attachTo: '#ca-talk',
		position: 'bottomRight',
		autoFocus: true,
		closeOnClickOutside: false,
	} )
	.back( 'pestanas' )
	.transition( function() {
		if ( mw.config.get( 'wgPageName' ) === 'Conversa:Framboeseiro' ) {
			return 'volverartigo';
		}
	} );
	
	// 4b
	tour.step( {
		name: 'volverartigo',
		title: 'Desprácese entre o artigo e as conversas (5/11)',
		description: new mw.Title( 'Axuda:Wikipedia paso a paso/WikiMOOC/2017/GT/1.2/B/4b' ),
		attachTo: '#ca-nstab-main',
		position: 'bottomRight',
		autoFocus: true,
		closeOnClickOutside: false,
	} )
	.transition( function() {
		if ( mw.config.get( 'wgPageName' ) === 'Framboeseiro' ) {
			return 'editar';
		}
	} );
	
	// 5
	tour.step( {
		name: 'editar',
		title: 'Editar o artigo (6/11)',
		description: new mw.Title( 'Axuda:Wikipedia paso a paso/Textes/T1E5' ),
		attachTo: '#ca-ve-edit',
		position: 'bottom',
		autoFocus: true,
		closeOnClickOutside: false,
	} )
	.back( 'conversa' )
	.next( 'historial' );
	
	// 6
	tour.step( {
		name: 'historial',
		title: 'Un historial para acceder aos arquivos (7/11)',
		description: new mw.Title( 'Axuda:Wikipedia paso a paso/Textes/T1E6' ),
		attachTo: '#ca-history',
		position: 'bottom',
		autoFocus: true,
		closeOnClickOutside: false,
	} )
	.back( 'editar' )
	.next( 'seguimento' );
	
	// 7
	tour.step( {
		name: 'seguimento',
		title: 'Realiza o seguimento dun artigo (8/11)',
		description: new mw.Title( 'Axuda:Wikipedia paso a paso/Textes/T1E7' ),
		attachTo: '#ca-watch',
		position: 'bottom',
		autoFocus: true,
		closeOnClickOutside: false,
	} )
	.back( 'historial' )
	.next( 'sección' );
	
	// 8
	tour.step( {
		name: 'sección',
		title: 'Edita unha única sección (9/11)',
		description: new mw.Title( 'Axuda:Wikipedia paso a paso/WikiMOOC/2017/GT/1.2/B/8' ),
		attachTo: '.mw-editsection',
		position: 'right',
		autoFocus: true,
		closeOnClickOutside: false,
	} )
	.back( 'seguimento' )
	.next( 'interwikis' );
	
	// 9
	tour.step( {
		name: 'interwikis',
		title: 'Para políglotas (10/11)',
		description: new mw.Title( 'Axuda:Wikipedia paso a paso/WikiMOOC/2017/GT/1.2/B/9' ),
		attachTo: '#p-lang-label',
		position: 'rightTop',
		autoFocus: true,
		closeOnClickOutside: false,
	} )
	.back( 'sección' )
	.next( function() {
		window.location.href = mw.util.getUrl( 'Wikipedia:Axuda/Wikipedia_paso_a_paso/Titorial_1' );
	} )
	.transition( function() {
		if(mw.config.get( 'wgPageName' ) == 'Wikipedia:Axuda/Wikipedia_paso_a_paso/Titorial_1' )
			return 'fin';
	} );

	// 10	
	tour.step( {
		name: 'fin',
		title: 'Fin do titorial (11/11)',
		description: new mw.Title( 'Axuda:Wikipedia_paso_a_paso/Textes/T1E10' ),
		autoFocus: true,
		overlay: true,
		closeOnClickOutside: false,
		buttons: [ {
			action: 'end'
		} ],
		allowAutomaticOkay: false,
	} )
	.back( 'interwikis' );



	// 0
	tour.step( {
		name: 'conectarse',
		title: 'Iniciar sesión',
		description: new mw.Title( 'Axuda:Wikipedia paso a paso/WikiMOOC/2017/GT/0' ),
		autoFocus: true,
		overlay: true,
		closeOnClickOutside: false,
	} )
	.transition( function() {
		// Se o alumno entrou
		if ( mw.user.getId() !== 0 )
			return 'benvida';
	} );
	
	//Engadir un botón na parte inferior dereita para reproducir de novo un paso pechado accidentalmente
	mw.loader.using( [ 'oojs-ui' ], function () {
		var reloadButton = new OO.ui.ButtonWidget( {
			label: 'Volver a ver o paso actual',
			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 ) );

//</nowiki>