MediaWiki:Guidedtour-tour-twa3.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.
// 3a etapa del Bus turístic, adaptació de
// The Wikipedia Adventure Mission 3
( 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 des del [[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: 'twa3',
shouldLog: true,
steps: [ {
//1
title: 'Comencem la 3a etapa!',
description: '<br><div align="right">[[File:Wikipe-tan head.png|80px|link=]]</div>GaiaNoia ens està esperant a l\'article Terra.<br><br>Som-hi.<br><br>',
onShow: gt.parseDescription,
overlay: true,
closeOnClickOutside: false,
buttons: [ {
name: 'Cap a la Terra*',
onclick: function() { if(!mw.config.get('wgUserName')){ alert( "Registreu-vos." ); return; } sendMessage( 'User:' + mw.config.get( 'wgUserName' ) + '/Bus/Terra', 'Viquipèdia:Bus_turístic/Earth/1' , mw.util.getUrl( 'Special:MyPage/Bus/Terra' ) + '?tour=twa3&step=2'); }
} ],
allowAutomaticOkay: false
}, {
//2
title: 'Això és la Terra!',
description: '<br>Els articles de la Viquipèdia donen una visió enciclopèdica del tema: expliquen als lectors tot allò que és important conèixer.<br><br>',
onShow: gt.parseDescription,
overlay: false,
closeOnClickOutside: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.getUrl( 'Viquipèdia:Bus_turístic/3/Start' ) + '?tour=twa3&step=1'
} , {
name: 'Comprovem-ho',
action: 'next',
} ],
allowAutomaticOkay: false
}, {
//3
title: 'Trobeu alguna cosa que cal corregir?',
description: '<br><div align="left">[[File:Wikitanface.png|100px|link=]]</div>Jo hi veig alguns errors ortogràfics que dificulten la lectura. Quants en veieu?<br><br>',
attachTo: '#content.mw-body',
position: 'bottom',
onShow: gt.parseDescription,
overlay: false,
closeOnClickOutside: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.getUrl( 'Special:MyPage/Bus/Terra' ) + '?tour=twa3&step=2'
} , {
name: 'Cerquem errades',
action: 'next'
} ],
allowAutomaticOkay: false
}, {
//4
title: 'Comprovació d\'errades.',
description: '<br>Els heu trobat tots 5?<br><br>tercè -- <b>tercer</b><br>mes -- <b>més</b><br>cuatre -- <b>quatre</b> <br>planete -- <b>planeta</b><br>millions -- <b>milions</b>',
attachTo: '#content.mw-body',
position: 'bottom',
onShow: gt.parseDescription,
overlay: false,
closeOnClickOutside: false,
allowAutomaticOkay: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.getUrl( 'Special:MyPage/Bus/Terra' ) + '?tour=twa3&step=3'
} , {
name: 'Trobats tots',
action: 'next',
} ],
}, {
//5
title: 'Corregint',
description: '<br>Anem a posar a prova les vostres capacitats d\'edició per corregir aquesta prova. Cliqueu MODIFICA EL CODI.<br><br>',
attachTo: '#ca-edit',
position: 'bottom',
onShow: gt.parseDescription,
overlay: false,
closeOnClickOutside: false,
allowAutomaticOkay: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.getUrl( 'Special:MyPage/Bus/Terra' ) + '?tour=twa3&step=4'
} ],
shouldSkip: function() {
return gt.hasQuery( { action: 'edit' } );
}
}, {
//6
title: 'Cinc correccions',
description: '<br>tercè -- <b>tercer</b><br>mes -- <b>més</b><br>cuatre -- <b>quatre</b> <br>planete -- <b>planeta</b><br>millions -- <b>milions</b>',
onShow: gt.parseDescription,
overlay: false,
attachTo: '#wpTextbox1',
position: 'bottomRight',
closeOnClickOutside: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.getUrl( 'Special:MyPage/Bus/Terra' ) + '?tour=twa3&step=5'
} , {
name: 'Corregit',
action: 'next',
} ],
allowAutomaticOkay: false
}, {
//7
title: 'Resum i Desa',
description: '<br>Expliquem que heu, "Corregit 5 errades".<br><br>Cliqueu DESA LA PÀGINA quan ho tingueu a punt.',
attachTo: '#wpSave',
position: 'bottomRight',
autoFocus: 'yes',
onShow: gt.parseDescription,
overlay: false,
closeOnClickOutside: false,
allowAutomaticOkay: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.getUrl( 'Special:MyPage/Bus/Terra' ) + '?tour=twa3&step=6&action=edit'
} ],
shouldSkip: function() {
return gt.isPostEdit();
},
buttons: postEditButtons
} , {
//8
title: 'Atreviu-vos-hi!',
description: 'NOU ESCALAFÓ: <b>Distinció de Corrector</b><center>[[File:TWA badge 4.png|250px|link=]]</center><br>Guau. Ara tothom pot veure la versió millorada de l\'article on has participat... és emocionant!<br><br>Anem a fer alguns canvis més. Afegim negreta en la primera menció de <b>Terra</b> en el primer paràgraf de l\'article.<br><br>Així els lectors detectaran ràpidament el tema principal de l\'article. Cliqueu MODIFICA EL CODI.<br><br>',
onShow: gt.parseDescription,
overlay: false,
attachTo: '#ca-edit',
position: 'bottom',
closeOnClickOutside: false,
allowAutomaticOkay: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.getUrl( 'Special:MyPage/Bus/Terra' ) + '?tour=twa3&step=7&action=edit'
} ],
shouldSkip: function() {
return gt.hasQuery( { action: 'edit' } );
}
} , {
//9
title: 'Afefint negreta!',
description: '<br><div align="right">[[File:Wikipe-tan head.png|80px|link=]]</div>Igual que abans, per afegir negreta, marqueu la primera menció de la paraula Terra i cliqueu el botó <b>A</b> de la barra d\'eines.<br><br>',
attachTo: '#wpTextbox1',
position: 'bottomRight',
autoFocus: 'yes',
onShow: gt.parseDescription,
overlay: false,
closeOnClickOutside: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.getUrl( 'Special:MyPage/Bus/Terra' ) + '?tour=twa3&step=8'
} , {
name: 'Fet en negreta',
action: 'next',
} ],
allowAutomaticOkay: false
} , {
//10
title: 'Resum i Desa',
description: '<br>Expliquem que heu, "Afegida negreta"<br><br>Llavors DESA LA PÀGINA quan ho tingueu a punt.',
attachTo: '#wpSave',
position: 'bottomRight',
autoFocus: 'yes',
onShow: gt.parseDescription,
overlay: false,
closeOnClickOutside: false,
allowAutomaticOkay: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.getUrl( 'Special:MyPage/Bus/Terra' ) + '?tour=twa3&step=9&action=edit'
} ],
shouldSkip: function() {
return gt.isPostEdit();
},
buttons: postEditButtons
} , {
//11
title: 'Ostres... Això és emocionant!',
description: '<br><div align="left">[[File:Wikitanface.png|100px|link=]]</div>Ho esteu pillant. Tinc la sensació que podeu fer un munt de coses bones aquí.<br><br>Epa, teniu un nou missatge...<br><br>',
onShow: gt.parseDescription,
overlay: false,
closeOnClickOutside: false,
allowAutomaticOkay: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.getUrl( 'Special:MyPage/Bus/Terra' ) + '?tour=twa3&step=10&action=edit'
} , {
name: 'Comprova el nou missatge*',
onclick: function() { if(!mw.config.get('wgUserName')){ alert( "Registreu-vos." ); return; } sendMessage( 'User talk:' + mw.config.get( 'wgUserName' ) + '/Bus', 'Viquipèdia:Bus_turístic/MyTalk/3a' , mw.util.getUrl( 'Special:MyTalk/Bus' ) + '?tour=twa3&step=12'); }
} ],
} , {
//12
title: 'Nou contingut...',
description: '<br><div align="left">[[File:Wikitanface.png|100px|link=]]</div>A veure què hi ha de nou<br><br>',
onShow: gt.parseDescription,
attachTo: '#content.mw-body',
position: 'bottom',
overlay: false,
closeOnClickOutside: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.getUrl( 'Special:MyPage/Bus/Terra' ) + '?tour=twa3&step=11'
} , {
name: 'Comprova el nou contingut*',
onclick: function() { if(!mw.config.get('wgUserName')){ alert( "Registreu-vos." ); return; } sendMessage( 'User:' + mw.config.get( 'wgUserName' ), 'Viquipèdia:Bus_turístic/Badge/4template2' , mw.util.getUrl( 'Viquipèdia:Bus_turístic/3/End' ) + '?tour=twa3&step=13'); }
} ],
allowAutomaticOkay: false
} , {
//13
title: '3a etapa completada!',
description: '<br>[[File:Wesnothmusic.ogg (short).ogg]]<br><b>Viatge a la 4a etapa...</b>',
onShow: gt.parseDescription,
overlay: false,
closeOnClickOutside: false,
buttons: [ {
name: 'Felicita\'m!',
action: 'end'
} ],
allowAutomaticOkay: false
}]
} );
} (window, document, jQuery, mediaWiki, mediaWiki.guidedTour ) ) ;