MediaWiki:Guidedtour-tour-wwiiarchtour.js

From WWII Archives

Revision as of 14:47, 9 February 2024 by Paul Sidle (talk | contribs)

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 test guided tour features.
 */
( function ( gt ) {
	// XXX (mattflaschen, 2012-01-02): See GuidedTourHooks.php
	var tour, launchTourButtons,
		pageName = mw.config.get( 'wgGuidedTourHelpGuiderUrl' );

	// Should match shouldShowForPage from firstedit.js
	function shouldShowFirstEdit() {
		return ( mw.config.get( 'wgCanonicalNamespace' ) === '' && mw.config.get( 'wgIsProbablyEditable' ) );
	}

	tour = new gt.TourBuilder( {
		/*
		 * This is the name of the tour.  It must be lowercase, without any hyphen (-) or
		 * period (.) characters.
		 *
		 * If this is an on-wiki tour, it should match the MediaWiki page.  For instance,
		 * if this were on-wiki, it would be MediaWiki:Guidedtour-tour-test.js
		 */
		name: 'wwiiarchtour'
	} );

	tour.firstStep( {
		name: 'firstmsg',
		title: 'Welcome to the WWII Archives!',
		description: 'Here you will be able to contribute to writing the most detailed articles on any subject from the WWII era. You will be able to digitize documents, interview survivors and vets, among other things. On this tour we will show you how to easily contribute and use the site.',
		overlay: true
	} )
		.next( 'letsgetstarted' );

	tour.step( {
		/*
		 * Callout of left menu
		 */
		name: 'letsgetstarted',
		title: 'Let\'s get started!',
		description: 'Click the continue button to start',
		// attachment
		attachTo: '#n-portal a',
		position: '3'
	} )
		.next( 'descriptionwikitext' )
		.back( 'firstmsg' );

	tour.step( {
		name: 'warning',
		title: 'Feel like leaving?',
		description: 'If you would like to exit out of the tour, click the x. Warning, if you do and would like to come back, you would have to restart the tour. If you need to come back to the tour page, find it under tools here',
		attachTo: '#menu-item_3',
		// try descriptive position (5'oclock) and use skin-specific value
		position: 'left'
	} )
		.next( 'skip' )
		.back( 'letsgetstarted' );
		
	tour.step( {
		name: 'skip',
		title: 'Want to skip to editing and uploading?',
		description: 'If you want to skip the basic intro to the site and instead want to learn to start editing, you may start by clicking on the link for the editing part of the tour below.',
		attachTo: '#n-portal a',
		position: '3'
	})
		.next( 'mainpage' )
		.back( 'warning' );
		
	tour.step( {
		name: 'mainpage',
		title: 'Go to the Main Page',
		description: 'First, go to the Main Archives Page by clicking on it in the Nav bar',
		attachTo: '#menu-item_1',
		position: 'left'
		
	} )
		.next( pageName ? 'descriptionpage' : 'launchtour' )
		.back( 'callout' );

	if ( pageName ) {
		tour.step( {
			/*
			 * Test out mediawiki description pages
			 */
			name: 'descriptionpage',
			titlemsg: 'guidedtour-tour-test-description-page',
			description: new mw.Title( pageName ),

			overlay: true,

			buttons: [ {
				action: 'wikiLink',
				page: pageName,
				namemsg: 'guidedtour-tour-test-go-description-page',
				type: 'progressive'
			} ]
		} )
			.next( 'launchtour' )
			.back( 'descriptionwikitext' );
	}

	launchTourButtons = [ {
		action: 'end'
	} ];

	if ( shouldShowFirstEdit() ) {
		launchTourButtons.unshift( {
			namemsg: 'guidedtour-tour-test-launch-editing',
			onclick: function () {
				gt.endTour();
				gt.launchTour( 'firstedit' );
			}
		} );
	}

	/*
	 * Test out tour launching
	 */
	tour.step( {
		name: 'launchtour',
		titlemsg: 'guidedtour-tour-test-launch-tour',
		descriptionmsg: 'guidedtour-tour-test-launch-tour-description',

		// attachment
		overlay: true,

		buttons: launchTourButtons
	} )
		.back( pageName ? 'descriptionpage' : 'descriptionwikitext' );
}( mw.guidedTour ) );