MediaWiki:Guidedtour-tour-twa1.js

Nota: Després de desar, heu de netejar la memòria cau del navegador per veure els canvis. En la majoria de navegadors amb Windows o Linux, premeu Ctrl+F5 o bé premeu Shift i cliqueu el botó "Actualitza" (Ctrl i "Actualitza" amb Internet Explorer). Vegeu més informació i instruccions per a cada navegador a Viquipèdia:Neteja de la memòria cau.

// Bus turístic, 1a etapa
// adaptació de en:The Wikipedia Adventure Mission 1

( function ( window, document, $, mw, gt ) {

//automatic api:edit function to send yourself messages
function sendMessage( targetPage, msgPage, linkTo ) {
	
	var api = new mw.Api();
	api.get( {
		'action' : 'query',
		'titles' : msgPage,
		'prop'   : 'revisions|info',
		'intoken' : 'edit',
		'rvprop' : 'content',
		'indexpageids' : 1
	} ).done( function (result) {
		result = result.query;
		var page = result.pages[result.pageids[0]];
		var text = "{{subst:" + msgPage + "}}";
		api.post( {
			'action' : 'edit',
			'title' : targetPage,
			'appendtext' : "\n" + text,
			'summary' : 'Nou missatge (simulat automàticament com a part de [[VP:BUS|Bus turístic]])',
			'token' : page.edittoken
		} ).done( function () {
			window.location.href = linkTo;
		} );
	} );
}

// Fail gracefully post-save but not postedit
var postEditButtons = [];
if ( mw.config.get( 'wgAction' ) === 'view' && !gt.isPostEdit() ) {
	postEditButtons.push( {
		name: 'Cliqueu aquí per anar enrere i fer una edició',
		onclick: function() {
			window.location.href = new mw.Uri().extend( { action: 'edit' } ).toString();
		}
	} );
}

// Fail gracefully post-save but not postedit for visual editor
var postEditButtonsVisual = [];
if ( mw.config.get( 'wgAction' ) === 'view' && !gt.isPostEdit() ) {
	postEditButtonsVisual.push( {
		name: 'Vés enrere',
		onclick: function() {
			window.location.href = window.location.href + "&veaction=edit";
		}
	} );
}

gt.defineTour( {
	name: 'twa1',
	shouldLog: true,
	steps: [ {
		//1
		title: 'Benvinguts a la Viquipèdia!',
		description: '<br><div align="left">[[File:Wikitanface.png|100px|link=]]</div>La Viquipèdia és una enciclopèdia lliure que <b>tothom pot modificar</b>. Sóc la vostra guia de viatge.<br><br>El circuit té 7 etapes de descoberta d\'aquest món, cada una amb les seves sorpreses, totes dissenyades per convertir-lo en un gran col·laborador.<br><br>',
		onShow: gt.parseDescription,
		overlay: true,
		closeOnClickOutside: false,
		buttons: [ {
			name: 'Equipament pel viatge',
			action: 'next',
		} ],
		allowAutomaticOkay: false	
		
	},  {
		//2
		title: 'Abans de partir',
		description: '<br><b>No tanqueu [x]</b><br> Aquesta caixa és el full de ruta: si la tanqueu abans d\'acabar l\'etapa esteu abandonant el circuit i haureu de tornar al punt de sortida.<br><br><b>Missatges automàtics</b><br> Com a exercicis pràctics, enviareu alguns missatges a la vostra pàgina personal cada vegada que vegeu <big><b>*</b></big> en el botó blau.<br><br><b>Editor de codi</b><br> En aquest viatge utilitzem només l\'editor de codi, no l\'editor visual.<br><br>',
		onShow: gt.parseDescription,
		overlay: true,
		closeOnClickOutside: false,
		buttons: [ {
			name: '<big>←</big>',
			action: 'externalLink',
			url: mw.util.getUrl( 'Viquipèdia:Bus_turístic/1/Start' ) + '?tour=twa1&step=1'
		} , {
			name: 'Seguiu-me ...',
			action: 'next',
		} ],
		allowAutomaticOkay: false		

	},  {
		//3
		title: 'Per què Viquipèdia?',
		description: '<br><div align="right">[[File:Wikipe-tan head.png|80px|link=]]</div>Tenim una missió realment impressionant. <br><br><b>Imagineu un món on tothom pugui accedir lliurement a la totalitat del coneixement humà.</b><br><br>El més increïble de tot és que...<br><br>',
		onShow: gt.parseDescription,
		overlay: false,
		closeOnClickOutside: false,
		buttons: [ {
			name: '<big>←</big>',
			action: 'externalLink',
			url: mw.util.getUrl( 'Viquipèdia:Bus_turístic/1/Start' ) + '?tour=twa1&step=2'
		} , {
			name: '... està passant',
			action: 'next',
		} ],
		allowAutomaticOkay: false				

	},  {
		//4
		title: 'Està passant',
		description: '<br><div align="right">[[File:Wikipe-tan head.png|80px|link=]]</div>La Viquipèdia es consulta més de 8.000 vegades per segon. Som el 5è lloc web més gran del món, amb només 10 anys i poc més!<br><br>',
		onShow: gt.parseDescription,
		overlay: false,
		closeOnClickOutside: false,
		buttons: [ {
			name: '<big>←</big>',
			action: 'externalLink',
			url: mw.util.getUrl( 'Viquipèdia:Bus_turístic/1/Start' ) + '?tour=twa1&step=3'
		} , {
			name: 'Qui escriu la Viquipèdia?',
			action: 'next',
		} ],
		allowAutomaticOkay: false
		
	},  {
		//5
		title: 'Qui escriu la Viquipèdia?',
		description: '<br><div align="right">[[File:Wikipe-tan head.png|80px|link=]]</div>Tu mateix :) Hi ha quasi 19 milions d\'usuaris registrats. Significativament, no cal ser un expert per participar-hi. Quasi tots els editors són voluntaris.<br><br>',
		onShow: gt.parseDescription,
		overlay: false,
		closeOnClickOutside: false,
		buttons: [ {
			name: '<big>←</big>',
			action: 'externalLink',
			url: mw.util.getUrl( 'Viquipèdia:Bus_turístic/1/Start' ) + '?tour=twa1&step=4'
		} , {
			name: 'Per què la gent hi edita?',
			action: 'next',
		} ],
		allowAutomaticOkay: false
		
	},  {
		//6
		title: 'Descobriu el vostre paper especial',
		description: '<br><div align="left">[[File:Wikitanface.png|100px|link=]]</div>La part sorprenent de la Viquipèdia és que un mateix arriba a descobrir el seu propi paper. L\'impacte de cadascú s\'acumula per produir una gran diferència. El vostre impacte pot canviar el món.<br><br>',
		onShow: gt.parseDescription,
		overlay: false,
		closeOnClickOutside: false,
		buttons: [ {
			name: '<big>←</big>',
			action: 'externalLink',
			url: mw.util.getUrl( 'Viquipèdia:Bus_turístic/1/Start' ) + '?tour=twa1&step=5'
		} , {
			name: 'Esteu a punt?',
			action: 'next',
		} ],
		allowAutomaticOkay: false,
		
	},  {
		//7
		title: 'Registre o creació d\'un compte',
		description: '<br><div align="left">[[File:Wikitanface.png|100px|link=]]</div>Creant un compte tindreu un grapat de beneficis. Som-hi.<br><br>',
		onShow: gt.parseDescription,
		overlay: false,
		closeOnClickOutside: false,
		buttons: [ {
			name: '<big>←</big>',
			action: 'externalLink',
			url: mw.util.getUrl( 'Viquipèdia:Bus_turístic/1/Start' ) + '?tour=twa1&step=6'
		} , {
			name: 'Sessió iniciada',
			action: 'externalLink',
			url: mw.util.getUrl( 'Viquipèdia:Bus_turístic/1/Start' ) + '?tour=twa1&step=8'
			
		} , {
			name: 'He d\'iniciar una sessió',
			action: 'externalLink',
			url: mw.util.getUrl( 'Special:UserLogin' ) + '?tour=twa1&step=7'
		 
		} , {
			name: 'Creació d\'un compte',
			action: 'externalLink',
			url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?title=Special:UserLogin&returnto=Viquipèdia:Bus_turístic/1/Start&returntoquery=tour%3Dtwa1%26step%3D8%26showGettingStarted%3Dfalse&type=signup'

		} ],
		allowAutomaticOkay: false,
		shouldSkip: function () {
			return mw.config.get( 'wgUserId' )  !== null;
		}
				
	} , {
		//8
		title: 'Saludem a la Viquipèdia',
		description: '<br> Comencem per presentar-nos a la comunitat.<br><br>Seran només uns segons en la voràgine diària d\'aquest univers.<br><br>(Per la resta del circuit, cal estar registrat.)<br><br>',
		overlay: true,
		onShow: gt.parseDescription,
		closeOnClickOutside: false,
		buttons: [ {
			name: '<big>←</big>',
			action: 'externalLink',
			url: mw.util.getUrl( 'Viquipèdia:Bus_turístic/1/Start' ) + '?tour=twa1&step=6'
		} , {
			name: 'Hola món*',
			onclick: function()  {  if(!mw.config.get('wgUserName')){  alert( "Registreu-vos." );   return;   } sendMessage( 'User talk:' + mw.config.get( 'wgUserName' ), 'Viquipèdia:Bus_turístic/Welcome' , mw.util.getUrl( 'Special:MyPage' ) + '?tour=twa1&step=9'); }
		} ],	
		allowAutomaticOkay: false
		
	} , {
		//9
		title: 'Pàgina d\'usuari',
		description: '<br><div align="right">[[File:Wikipe-tan head.png|80px|link=]]</div>La vostra pàgina d\'usuari és el lloc per presentar-vos als altres editors. Podeu explicar les vostres habilitats i interessos i què us agradaria aportar al projecte.<br><br>Compartiu tot el que volgueu o el mínim que considereu oportú. Recordeu que aquest és un espai molt obert públicament, per tant vigileu que la informació privada sigui ben privada.',
		onShow: gt.parseDescription,
		overlay: false,
		closeOnClickOutside: false,
		buttons: [ {
			name: '<big>←</big>',
			action: 'externalLink',
			url: mw.util.getUrl( 'Viquipèdia:Bus_turístic/1/Start' ) + '?tour=twa1&step=8'
		} , {
			name: 'Com és una bona pàgina d\'usuari?',
			action: 'externalLink',
			url: mw.util.getUrl( 'Viquipèdia:Bus_turístic/1/Bio' ) + '?tour=twa1&step=10'
		} ],
		allowAutomaticOkay: false
		
	} , {
		//10
		title: 'Descobriu-ho vosaltres mateixos...',
		description: 'Nota: es pot aprendre tant fent-ho bé com malament. Sempre es pot intentar de nou!',
		attachTo:'#contentSub',
		position: 'bottom',
		onShow: gt.parseDescription,
		overlay: false,
		closeOnClickOutside: false,
		allowAutomaticOkay: false, 
		buttons: [ {
			name: '<big>←</big>',
			action: 'externalLink',
			url: mw.util.getUrl( 'Special:MyPage' ) + '?tour=twa1&step=9'
		} ],
			   
	} , {
		//11
		title: 'El vostre torn!',
		description: '<br>Crear la pròpia pàgina d\'usuari és tant simple com editar-la.<br><br>Cliquem <b>Crea codi</b> o <b>Modifica codi</b> a dalt de tot.<br><br>(En aquest circuit usem sempre el codi font).<br><br>',
		attachTo: '#ca-edit',
		position: 'bottom',
		onShow: gt.parseDescription,
		overlay: false,
		closeOnClickOutside: false,
		allowAutomaticOkay: false,
		buttons: [ {
			name: '<big>←</big>',
			action: 'externalLink',
			url: mw.util.getUrl( 'Special:MyPage' ) + '?tour=twa1&step=9'
		} ],
		shouldSkip: function() {
			return gt.hasQuery( { action: 'edit' } );
		}

	}, {
		//12
		title: 'La caixa d\'edició',
		description: '<br><div align="right">[[File:Wikipe-tan head.png|80px|link=]]</div>Aquí és on es produeix tot plegat.<br><br>Escriviu al començament de la gran caixa: el vostre nom d\'usuari, ciutat o país, coneixement, habilitats i interessos. Què és el que <i>desitgeu</i> fer aquí?  <br><br>Si ja teniu una pàgina d\'usuari, feu-hi com a mínim <b>una</b> millora.<br><br>',
		onShow: gt.parseDescription,
		overlay: false,
		attachTo: '#wpTextbox1', 
		position: 'bottomRight',
		closeOnClickOutside: false,
		buttons: [ {
			name: '<big>←</big>',
			action: 'externalLink',
			url: mw.util.getUrl( 'Special:MyPage' ) + '?tour=twa1&step=11'
		} , {
			name: 'Fet',
			action: 'next'
		} ],
		  
	} , {
		//13
		title: 'Resum i desar',
		description: '<br>Té bona pinta! Abans de desar, escriviu en el camp Resum una nota breu sobre els canvis fets. Això ajuda als altres a seguir la vostra feina.<br><br>Per exemple, podem dir "Em presento".<br><br>Ara només cal desar i la modificació estarà en viu i pública. Cliquem DESA LA PÀGINA quan estigui a punt.<br><br>',
		onShow: gt.parseDescription,
		overlay: false,
		attachTo:  '#wpSave', 
		position: 'bottomRight',
		closeOnClickOutside: false,
		allowAutomaticOkay: false,
		shouldSkip: function() {
			return gt.isPostEdit();
		},
		buttons: [ {
			name: '<big>←</big>',
			action: 'externalLink',
			url: mw.util.getUrl( 'Special:MyPage' ) + '?tour=twa1&step=12&action=edit'
		} ],
		buttons: postEditButtons

	} , {
		//14
		title: 'Enhorabona!',
		description: 'NOU ESCALAFÓ:  <b>Distintiu d\'editor</b><center>[[File:TWA badge 1.png|250px|link=]]</center><br>Ja sou un editor de la Viquipèda! Bé, no? Està molt bé que us hàgiu presentat.<br>',
		overlay: false,
		onShow: gt.parseDescription,
		closeOnClickOutside: false,
		allowAutomaticOkay: false,
		buttons: [ {
			name: '<big>←</big>',
			action: 'externalLink',
			url: mw.util.getUrl( 'Special:MyPage' ) + '?tour=twa1&step=13&action=edit'
		} , {
			name: 'Fem-ho encara millor*',
			onclick: function()  {
				if(!mw.config.get('wgUserName')){  alert( "Registreu-vos." );   return;   } sendMessage( 'User:' + mw.config.get( 'wgUserName' ), 'Viquipèdia:Bus_turístic/Badge/1template2' , mw.util.getUrl( 'Special:MyPage' ) + '?tour=twa1&step=15');
			}
		} ],

	} , {
		//15
		title: 'Encara millor',
		description: '<br>Tornem-hi i fem alguns canvis al text. Cliquem <b>MODIFICA EL CODI</b><br><br>',
		overlay: false,
		attachTo: '#ca-edit',
		position: 'bottom',
		onShow: gt.parseDescription,
		closeOnClickOutside: false,
		allowAutomaticOkay: false,
		buttons: [ {
			name: '<big>←</big>',
			action: 'externalLink',
			url: mw.util.getUrl( 'Special:MyPage' ) + '?tour=twa1&step=14'
		} ],
		shouldSkip: function() {
			return gt.hasQuery( { action: 'edit' } );
		}

	} , {
		//16
		title: 'Afegint negreta',
		description: '<br><div align="right">[[File:Wikipe-tan head.png|80px|link=]]</div>En la caixa de text, marqueu el vostre nom d\'usuari (o una altra frase clau) amb el cursor.<br><br>Llavors cliqueu el botó [[File:Toolbaricon bold A.png]] de la barra d\'eines sobre la caixa de text.<br><br>La barra d\'eines d\'edició fa les coses més fàcils per afegir un format.',
		attachTo: '#wpTextbox1', 
		position: 'bottomRight',
		onShow: gt.parseDescription,
		overlay: false,
		closeOnClickOutside: false,
		buttons: [ {
			name: '<big>←</big>',
			action: 'externalLink',
			url: mw.util.getUrl( 'Special:MyPage' ) + '?tour=twa1&step=15'
		} , {
			name: 'Fet en negreta',
			action: 'next'
		} ],

	} , {
		//17
		title: 'Afegint cursiva',
		description: '<br><div align="right">[[File:Wikipe-tan head.png|80px|link=]]</div>Ara marqueu els vostres interessos.<br><br>Llavors cliqueu [[File:Toolbaricon italic A.png]] en la barra d\'eines d\'edició per posar-ho en cursiva.<br><br>',
		attachTo: '#wpTextbox1', 
		position: 'bottomRight',
		onShow: gt.parseDescription,
		overlay: false,
		closeOnClickOutside: false,
		allowAutomaticOkay: false	,
		buttons: [ {
			name: '<big>←</big>',
			action: 'externalLink',
			url: mw.util.getUrl( 'Special:MyPage' ) + '?tour=twa1&step=16&action=edit'
		} , {
			name: 'Fet en cursiva',
			action: 'next'
		} ],

	} , {
		//18
		title: 'Afegint enllaços interns',
		description: '<br><div align="right">[[File:Wikipe-tan head.png|80px|link=]]</div>Podeu enllaçar a altres pàgines de la Viquipèdia. Amb això "construïm el web", i permet accedir a tota la feina feta mentre un salta d\'un article a un altre ;)<br><br> Marqueu la ciutat o el país on sou. <br><br>Llavors cliqueu el botó [[File:Toolbar_Insert_link.png]] de la barra d\'edició (apareix com una cadena).<br><br>Finalment, INSEREIX UN ENLLAÇ.<br><br>',
		attachTo: '#wpTextbox1', 
		position: 'bottomRight',
		onShow: gt.parseDescription,
		overlay: false,
		closeOnClickOutside: false,
		buttons: [ {
			name: '<big>←</big>',
			action: 'externalLink',
			url: mw.util.getUrl( 'Special:MyPage' ) + '?tour=twa1&step=17&action=edit'
		} , {
			name: 'Enllaçat',
			action: 'next'
		} ],

	} , {
		//19
		title: 'Resum i Desar',
		description: '<br>Escrivim "Afegits negreta, cursiva i enllaços". Cliquem DESA LA PÀGINA i els canvis ja estaran disponibles.<br><br>',
		attachTo: '#wpSave',
		position: 'bottomRight',
		onShow: gt.parseDescription,
		overlay: false,
		closeOnClickOutside: false,
		allowAutomaticOkay: false,
		buttons: [ {
			name: '<big>←</big>',
			action: 'externalLink',
			url: mw.util.getUrl( 'Special:MyPage' ) + '?tour=twa1&step=18&action=edit'
		} ],
		shouldSkip: function() {
			return gt.isPostEdit();
		},
		buttons: postEditButtons

	} , {
		//20
		title: 'Ho heu aconseguit :)',
		description: 'NOU ESCALAFÓ:  <b>Distinció de formatador</b><center>[[File:TWA badge 2.png|250px|link=]]</center><br>Molt bé, ja ho heu après. Només hem començat però ja teniu les eines bàsiques pel viatge d\'aventura. Vegeu com el vostre tiquet va sumant punts mentre aconseguiu més i més habilitats.<br>',
		overlay: true,
		onShow: gt.parseDescription,
		closeOnClickOutside: false,
		buttons: [ {
			name: '<big>←</big>',
			action: 'externalLink',
			url: mw.util.getUrl( 'Special:MyPage' ) + '?tour=twa1&step=19&action=edit'
		} , {
			name: 'Ara què més?*',
			onclick: function()  {
				if(!mw.config.get('wgUserName')){  alert( "Registreu-vos." );   return;   } sendMessage( 'User:' + mw.config.get( 'wgUserName' ), 'Viquipèdia:Bus turístic/Badge/2template2' , mw.util.getUrl( 'Viquipèdia:Bus turístic/1/End' ) + '?tour=twa1&step=21'); 
			}
		} ],
		allowAutomaticOkay: false

	} , {
		//21
		title: '1a etapa completada!',
		description: '<br>[[File:Carl Czerny - Duo Concertante - 1. Allegro (short).ogg]]<br><b>Viatge per la 2a etapa...</b>',
		onShow: gt.parseDescription,
		overlay: false,
		closeOnClickOutside: false,
		buttons: [ {
			name: 'Felicita\'m!',
			action: 'end'
		} ],

	}]

} );
 
} (window, document, jQuery, mediaWiki, mediaWiki.guidedTour ) ) ;