User:Soumi150/Guidedtour-tour-protectdocument.js

// Guided Tour to help users manage protection settings of their page. ( function ( gt ) {	var tour;	// The tour should show up only for logged in users.	function shouldShowForPage {		return ( mw.config.get( 'wgCanonicalNamespace' ) === '' && mw.config.get( 'wgUserName' ) );	}

if ( !shouldShowForPage ) { alert( 'Please login to begin the tour. Register if you do not have an account.' ); // eslint-disable-line no-alert return; }

function shouldShowProtect { return ( mw.config.get( 'wgAction' ) === 'protect' ); }

tour = new gt.TourBuilder( {		name: 'protectdocument'	} );

tour.firstStep( {		name: 'intro',		title: 'Get Started',		description: 'Manage your document protection settings. Click on More to get started.',		attachTo: '#p-cactions-label',		position: 'left',		overlay: true	} ) .next( 'protect' ); tour.step( {

name: 'protect', title: 'Protect..', description: 'Click on protect in the dropdown.', attachTo: '#ca-protect', position: 'left' } )		.transition( function { if ( shouldShowProtect ) { return 'protectionsettings'; }		} )		.back( 'intro' );	tour.step( {

name: 'protectionsettings', title: 'Protection settings', description: 'Change your protection settings to what best suits you and then click confirm.', overlay: true } )		.back( 'protect' );

}( mw.guidedTour ) );