MediaWiki talk:Guidedtour-tour-MoreMarkupStudent.js/draft
Appearance
// Guided Tour for learning wikicode by making a series of edits in a user sandbox, as an interactive interlude in Wikipedia:Training/For_students
( function ( window, document, $, mw, gt ) {
//automatic api:edit function to send yourself messages
sendMessage = function( targetPage, msgPage, linkTo ) {
var api = new mw.Api();
api.get( {
'action' : 'query',
'titles' : msgPage,
'prop' : 'revisions|info',
'intoken' : 'edit',
'rvprop' : 'content',
'indexpageids' : 1
}, {
'ok' : 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' : 'automatic post as part of the sandbox guided tour',
'token' : page.edittoken
},
{
'ok' : 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: 'MoreMarkupStudent',
shouldLog: true,
steps: [ {
//1
title: 'Let\'s try some more formatting.',
description: '',
onShow: gt.getPageAsDescription,
overlay: true,
closeOnClickOutside: false,
buttons: [ {
name: 'Go to your sandbox',
onclick: function() { if(!mw.config.get('wgUserName')){ alert( "Please login." ); return; } sendMessage( 'User:' + mw.config.get( 'wgUserName' ) + '/more_markup', 'Project:Training/tour/more_markup_preload' , mw.util.wikiGetlink( 'Special:MyPage/more_markup' ) + '?tour=MoreMarkupStudent&step=2'); }
} ],
allowAutomaticOkay: false
}, {
//2
title: 'Fix up this raw text.',
description: 'Project:Training/tour/more_markup2',
onShow: gt.getPageAsDescription,
attachTo: '#content.mw-body',
position: 'bottom',
overlay: false,
closeOnClickOutside: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.wikiGetlink( 'Project:Training/For_students/More_markup' ) + '?tour=MoreMarkupStudent&step=1'
} , {
name: 'Okay!',
action: 'next',
} ],
allowAutomaticOkay: false
}, {
//3
title: 'Click Edit',
description: '',
attachTo: '#ca-edit',
position: 'bottom',
onShow: gt.getPageAsDescription,
overlay: false,
closeOnClickOutside: false,
allowAutomaticOkay: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.wikiGetlink( 'Special:MyPage/more_markup' ) + '?tour=MoreMarkupStudent&step=2'
} ],
shouldSkip: function() {
return gt.hasQuery( { action: 'edit' } );
}
}, {
//4
title: 'First up, italic text.',
description: 'Project:Training/tour/more_markup4',
onShow: gt.getPageAsDescription,
attachTo: '#wpTextbox1',
position: 'bottomLeft',
overlay: false,
closeOnClickOutside: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.wikiGetlink( 'Special:MyPage/more_markup' ) + '?tour=MoreMarkupStudent&step=3'
} , {
name: 'I added the italic text markup.',
action: 'next',
} ],
allowAutomaticOkay: false
}, {
//5
title: 'Next, section headers.',
description: 'Project:Training/tour/more_markup5',
onShow: gt.getPageAsDescription,
attachTo: '#wpTextbox1',
position: 'bottomLeft',
overlay: false,
closeOnClickOutside: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.wikiGetlink( 'Special:MyPage/more_markup' ) + '?tour=MoreMarkupStudent&step=4&action=edit'
} , {
name: 'I added the section header markup.',
action: 'next',
} ],
allowAutomaticOkay: false
}, {
//6
title: 'Now, an external link.',
description: 'Project:Training/tour/more_markup6',
onShow: gt.getPageAsDescription,
attachTo: '#wpTextbox1',
position: 'bottomLeft',
overlay: false,
closeOnClickOutside: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.wikiGetlink( 'Special:MyPage/more_markup' ) + '?tour=MoreMarkupStudent&step=5&action=edit'
} , {
name: 'I added the external link.',
action: 'next',
} ],
allowAutomaticOkay: false
}, {
//7
title: 'Next, a bulleted list.',
description: 'Project:Training/tour/more_markup7',
onShow: gt.getPageAsDescription,
attachTo: '#wpTextbox1',
position: 'bottomLeft',
overlay: false,
closeOnClickOutside: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.wikiGetlink( 'Special:MyPage/more_markup' ) + '?tour=MoreMarkupStudent&step=6&action=edit'
} , {
name: 'I added the markup for bullet items.',
action: 'next',
} ],
allowAutomaticOkay: false
}, {
//8
title: 'Similarly, a numbered list.',
description: 'Project:Training/tour/more_markup8',
onShow: gt.getPageAsDescription,
attachTo: '#wpTextbox1',
position: 'bottomLeft',
overlay: false,
closeOnClickOutside: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.wikiGetlink( 'Special:MyPage/more_markup' ) + '?tour=MoreMarkupStudent&step=7&action=edit'
} , {
name: 'I added the numbered list markup.',
action: 'next',
} ],
allowAutomaticOkay: false
}, {
//9
title: 'Now for an image.',
description: 'Project:Training/tour/more_markup9',
onShow: gt.getPageAsDescription,
attachTo: '#wpTextbox1',
position: 'bottomLeft',
overlay: false,
closeOnClickOutside: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.wikiGetlink( 'Special:MyPage/more_markup' ) + '?tour=MoreMarkupStudent&step=8&action=edit'
} , {
name: 'I added the image code.',
action: 'next',
} ],
allowAutomaticOkay: false
}, {
//10
title: 'Next, a template.',
description: 'Project:Training/tour/more_markup10',
onShow: gt.getPageAsDescription,
attachTo: '#wpTextbox1',
position: 'bottomLeft',
overlay: false,
closeOnClickOutside: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.wikiGetlink( 'Special:MyPage/more_markup' ) + '?tour=MoreMarkupStudent&step=9&action=edit'
} , {
name: 'I added the template.',
action: 'next',
} ],
allowAutomaticOkay: false
}, {
//11
title: 'Finally, a signature.',
description: 'Project:Training/tour/more_markup11',
onShow: gt.getPageAsDescription,
attachTo: '#wpTextbox1',
position: 'bottomLeft',
overlay: false,
closeOnClickOutside: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.wikiGetlink( 'Special:MyPage/more_markup' ) + '?tour=MoreMarkupStudent&step=10&action=edit'
} , {
name: 'I added the signature code.',
action: 'next',
} ],
allowAutomaticOkay: false
}, {
//12
title: 'Add an edit summary, and Save',
description: '',
attachTo: '#wpSave',
position: 'bottom',
autoFocus: 'yes',
onShow: gt.getPageAsDescription,
overlay: false,
closeOnClickOutside: false,
allowAutomaticOkay: false,
buttons: [ {
name: '<small>←</small>',
action: 'externalLink',
url: mw.util.wikiGetlink( 'Special:MyPage/more_markup' ) + '?tour=MoreMarkupStudent&step=11&action=edit'
} ],
shouldSkip: function() {
return gt.isPostEdit();
},
buttons: postEditButtons
} , {
//13
title: 'Did it work?',
description: 'Project:Training/tour/more_markup13',
onShow: gt.getPageAsDescription,
overlay: false,
attachTo: '#ca-edit',
position: 'bottom',
closeOnClickOutside: false,
allowAutomaticOkay: false,
buttons: [ {
name: '<small>←</small> I want to try again.',
action: 'externalLink',
url: mw.util.wikiGetlink( 'Special:MyPage/more_markup' ) + '?tour=MoreMarkupStudent&step=4&action=edit'
} , {
name: 'It worked!',
action: 'externalLink',
url: mw.util.wikiGetlink( 'Project:Training/For students/Talk pages') + '?tour=MoreMarkupStudent&step=14'
} ],
allowAutomaticOkay: false
} , {
//14
title: 'Nice work!',
description: 'Project:Training/tour/more_markup14',
onShow: gt.getPageAsDescription,
overlay: false,
closeOnClickOutside: false,
buttons: [ {
name: 'Bye!',
action: 'end'
} ],
allowAutomaticOkay: false
}]
} );
} (window, document, jQuery, mediaWiki, mediaWiki.guidedTour ) ) ;
Talk pages are where people discuss how to make content on Wikipedia the best that it can be. You can use this page to start a discussion with others about how to improve the "MediaWiki:Guidedtour-tour-MoreMarkupStudent.js/draft" page.