User:Soumi150/Guidedtour-tour-protectdocument.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (â-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (â-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
// 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 <strong>More</strong> 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 ) );