MediaWiki talk:Guidedtour-tour-studentsandbox.js/draft

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
// Guided Tour for making sandbox edits, to be launched by a button in the training that takes you straight to your sandbox in edit mode
 
( function ( window, document, $, mw, gt ) {
gt.defineTour( {
        name: 'studentsandbox',
        steps: [ {
                title: 'Experiment in your sandbox',
                description: 'Wikipedia:Training/tour/sandbox',
                onShow: gt.getPageAsDescription,
                // Normally, the guider will automatically close when the user clicks outside the boundaries. This prevents that.
                closeOnClickOutside: false,
                buttons: [ {
                        action: 'next'
                } ],
 
                // shouldSkip is a general tool to skip a step based on their progress towards some goal.
                // shouldSkip always returns true to skip, or false otherwise. Here we skip if they are *not* editing.
                shouldSkip: function() {
                        return !gt.hasQuery( { action: 'edit' } );
                }
        },  {
                title: 'Edit summary',
                description: 'Wikipedia:Training/tour/edit_summary',
                onShow: gt.getPageAsDescription,
                attachTo: '#wpSummary',
                position: 'topLeft',
                // Normally, the guider will automatically close when the user clicks outside the boundaries. This prevents that.
                closeOnClickOutside: false,
                buttons: [ {
                        action: 'next'
                } ],
                // shouldSkip always returns true to skip, or false otherwise. We skip if they are *not* editing.
                shouldSkip: function() {
                        return !gt.hasQuery( { action: 'edit' } );
                }
        }, {
                title: 'Preview (optional)',
                description: 'Wikipedia:Training/tour/preview',
                onShow: gt.getPageAsDescription,
                attachTo: '#wpPreview',
                position: 'top',
                // Normally, the guider will automatically close when the user clicks outside the boundaries. This prevents that.
                closeOnClickOutside: false,
                // shouldSkip always returns true to skip, or false otherwise. We skip if they are *not* editing.
                shouldSkip: function() {
                        return !gt.hasQuery( { action: 'edit' } );
                }
        }, {
                title: 'You\'re almost finished!',
                description: 'Wikipedia:Training/tour/save',
                onShow: gt.getPageAsDescription,
                attachTo: '#wpSave',
                position: 'top',
 
                // Normally, the guider will automatically close when the user clicks outside the boundaries. This prevents that.
                closeOnClickOutside: false,
 
                // We skip if they are not doing a preview, show changes, etc.
                shouldSkip: function() {
                        return !gt.hasQuery( { action: 'submit' } );
                }
        }, {
// more steps to be added here: instructions for adding a link back to the training, then a check to see whether they added that link, and a pointer to the link saying to keep playing, or click that link when they are ready to move on, and repeating those instructions again if they don't have the link.
                title: 'Good work!',
                description: 'Wikipedia:Training/tour/after_save',
                onShow: gt.getPageAsDescription,
                overlay: true,
 
                // We don't want to show this step if they didn't complete an edit.
                // Note that this requires they actually change something, not just click save.
                shouldSkip: function() {
                        return !gt.isPostEdit();
                },
                buttons: [ {
                        action: 'end'
                } ]
        } ]
} );
 
} (window, document, jQuery, mediaWiki, mediaWiki.guidedTour ) );