// 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 = page.revisions[0]['*'];
api.post( {
'action' : 'edit',
'title' : targetPage,
'appendtext' : "\n" + text,
'summary' : 'New Message (simulated automatically as part of [[WP:The Wikipedia Adventure|The Wikipedia Adventure]])',
'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: 'Click here to go back and make an edit',
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: 'Go Back',
onclick: function() {
window.location.href = window.location.href +
"&veaction=edit";
}
} );
}
gt.defineTour( {
name: 'twa3',
shouldLog: true,
steps: [ {
//1
title: 'Mission 3 begins!',
description: '<br><div align="right">[[File:TWA_guide_right_top.png|link=]]</div>GaiaGirl is waiting for us at the Earth article.<br><br>Let\'s go there.<br><br>',
onShow: gt.parseDescription,
overlay: true,
closeOnClickOutside: false,
buttons: [ {
name: 'Head to Earth*',
onclick: function() { if(!mw.config.get('wgUserName')){ alert( "Please login." ); return; } sendMessage( 'User:' + mw.config.get( 'wgUserName' ) + '/TWA/Earth', 'Wikipedia:TWA/Earth/1' , mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa3&step=2'); }
} ],
allowAutomaticOkay: false
}, {
//2
title: 'So this is Planet Earth!',
description: '<br>Articles on Wikipedia give an encyclopedic overview of a subject: they tell readers a little bit about everything that\'s important to know.<br><br>',
onShow: gt.parseDescription,
overlay: false,
closeOnClickOutside: false,
buttons: [ {
name: '<big>←</big>',
action: 'externalLink',
url: mw.util.getUrl( 'Wikipedia:TWA/3/Start' ) + '?tour=twa3&step=1'
} , {
name: 'Check it out',
action: 'next',
} ],
allowAutomaticOkay: false
}, {
//3
title: 'See anything that needs fixing?',
description: '<br><div align="left">[[File:TWA_guide_left_top.png|link=]]</div>I notice a few spelling edits distracting from the information. How many do you see?<br><br>',
attachTo: '#content.mw-body',
position: 'bottom',
onShow: gt.parseDescription,
overlay: false,
closeOnClickOutside: false,
buttons: [ {
name: '<big>←</big>',
action: 'externalLink',
url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa3&step=2'
} , {
name: 'Search for typos',
action: 'next'
} ],
allowAutomaticOkay: false
}, {
//4
title: 'Spellcheck.',
description: '<br>Did you find all 5?<br><br>thurd -- <b>third</b><br>fore -- <b>four</b><br>tree -- <b>three</b> <br>aminals -- <b>animals</b><br>hughmans -- <b>humans</b>',
attachTo: '#content.mw-body',
position: 'bottom',
onShow: gt.parseDescription,
overlay: false,
closeOnClickOutside: false,
allowAutomaticOkay: false,
buttons: [ {
name: '<big>←</big>',
action: 'externalLink',
url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa3&step=3'
} , {
name: 'Found them all',
action: 'next',
} ],
}, {
//5
title: 'Typofixing',
description: '<br>Let\'s put your editing skills to the test and fix those up. Click EDIT SOURCE.<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/TWA/Earth' ) + '?tour=twa3&step=4'
} ],
shouldSkip: function() {
return gt.hasQuery( { action: 'edit' } );
}
}, {
//6
title: '5 fixes',
description: '<br>thurd -- <b>third</b><br>fore -- <b>four</b><br>tree -- <b>three</b> <br>aminals -- <b>animals</b><br>hughmans -- <b>humans</b>',
onShow: gt.parseDescription,
overlay: false,
attachTo: '#wpTextbox1',
position: 'bottomRight',
closeOnClickOutside: false,
buttons: [ {
name: '<big>←</big>',
action: 'externalLink',
url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa3&step=5'
} , {
name: 'Fixed',
action: 'next',
} ],
allowAutomaticOkay: false
}, {
//7
title: 'Edit summary, and Publish',
description: '<br>Let them know that you, "Fixed 5 typos".<br><br>Then PUBLISH when you\'re ready.',
attachTo: '#wpSave',
position: 'bottomRight',
autoFocus: 'yes',
onShow: gt.parseDescription,
overlay: false,
closeOnClickOutside: false,
allowAutomaticOkay: false,
buttons: [ {
name: '<big>←</big>',
action: 'externalLink',
url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa3&step=6&action=edit'
} ],
shouldSkip: function() {
return gt.isPostEdit();
},
buttons: postEditButtons
} , {
//8
title: 'See boldly!',
description: 'NEW TOOL EARNED: <b>Copyeditor Badge</b><div class="center">[[File:TWA badge 4.png|250px|link=]]</div><br>Wow. Now the whole world can see the improved version of the article you contributed to...pretty cool!<br><br>Let\'s make a few more changes. Let\'s add bold around the first mention of <b>Earth</b> in the first sentence of the article.<br><br>This lets readers focus quickly on the main subject of the article. Click EDIT SOURCE.<br><br>',
onShow: gt.parseDescription,
overlay: false,
attachTo: '#ca-edit',
position: 'bottom',
closeOnClickOutside: false,
allowAutomaticOkay: false,
buttons: [ {
name: '<big>←</big>',
action: 'externalLink',
url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa3&step=7&action=edit'
} ],
shouldSkip: function() {
return gt.hasQuery( { action: 'edit' } );
}
} , {
//9
title: 'Add bold!',
description: '<br><div align="right">[[File:TWA_guide_right_top.png|link=]]</div>Just like before, to add bold, highlight the first mention of the word Earth and then click the B on the toolbar.<br><br>',
attachTo: '#wpTextbox1',
position: 'bottomRight',
autoFocus: 'yes',
onShow: gt.parseDescription,
overlay: false,
closeOnClickOutside: false,
buttons: [ {
name: '<big>←</big>',
action: 'externalLink',
url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa3&step=8'
} , {
name: 'Bolded',
action: 'next',
} ],
allowAutomaticOkay: false
} , {
//10
title: 'Edit summary, and Publish',
description: '<br>Let them know that you, "Added bold"<br><br>Then PUBLISH when you\'re ready.',
attachTo: '#wpSave',
position: 'bottomRight',
autoFocus: 'yes',
onShow: gt.parseDescription,
overlay: false,
closeOnClickOutside: false,
allowAutomaticOkay: false,
buttons: [ {
name: '<big>←</big>',
action: 'externalLink',
url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa3&step=9&action=edit'
} ],
shouldSkip: function() {
return gt.isPostEdit();
},
buttons: postEditButtons
} , {
//11
title: 'Whew... This is exciting!',
description: '<br><div align="left">[[File:TWA_guide_left_top.png|link=]]</div>You\'re getting the hang of this. You\'re going to do a lot of good here, I can sense it.<br><br>Hey you also have a new message...<br><br>',
onShow: gt.parseDescription,
overlay: false,
closeOnClickOutside: false,
allowAutomaticOkay: false,
buttons: [ {
name: '<big>←</big>',
action: 'externalLink',
url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa3&step=10&action=edit'
} , {
name: 'Check your new message*',
onclick: function() { if(!mw.config.get('wgUserName')){ alert( "Please login." ); return; } sendMessage( 'User talk:' + mw.config.get( 'wgUserName' ) + '/TWA', 'Wikipedia:TWA/MyTalk/3a' , mw.util.getUrl( 'Special:MyTalk/TWA' ) + '?tour=twa3&step=12'); }
} ],
} , {
//12
title: 'New content...',
description: '<br><div align="left">[[File:TWA_guide_left_top.png|link=]]</div>Let\'s see what\'s new<br><br>',
onShow: gt.parseDescription,
attachTo: '#content.mw-body',
position: 'bottom',
overlay: false,
closeOnClickOutside: false,
buttons: [ {
name: '<big>←</big>',
action: 'externalLink',
url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa3&step=11'
} , {
name: 'Check out the new content*',
onclick: function() { if(!mw.config.get('wgUserName')){ alert( "Please login." ); return; } sendMessage( 'User:' + mw.config.get( 'wgUserName' ), 'Wikipedia:TWA/Badge/4template2' , mw.util.getUrl( 'Wikipedia:TWA/3/End' ) + '?tour=twa3&step=13'); }
} ],
allowAutomaticOkay: false
} , {
//13
title: 'Mission 3 complete!',
description: '<br>[[File:Wesnothmusic.ogg (short).ogg]]<br><b>Journey on to mission 4...</b>',
onShow: gt.parseDescription,
overlay: false,
closeOnClickOutside: false,
buttons: [ {
name: 'Congrats me!',
action: 'end'
} ],
allowAutomaticOkay: false
}]
} );
} (window, document, jQuery, mediaWiki, mediaWiki.guidedTour ) ) ;