MediaWiki:Guidedtour-tour-twa6.js

// The Wikipedia Adventure Mission 6

( function ( window, document, $, mw, gt ) { //automatic api:edit function to send yourself messages function sendTalkMessage( targetPage, msgPage, linkTo, overwrite, isTalkPost) {	if(!mw.config.get('wgUserName')) { 		alert( "Please login." );  		return;	}    var api = new mw.Api;    api.get( { 'action' : 'query', 'titles' : msgPage+'|'+targetPage, 'prop'  : 'revisions', 'meta'  : 'tokens', 'type'  : 'csrf', 'rvprop' : 'content', 'indexpageids' : 1 } ).done( function (result) { result = result.query; var page = result.pages[result.pageids[1]]; var text = page.revisions[0]['*']; text = text.replaceAll(" ",""); if (result.pageids[0] > 0) { var targetSrc = result.pages[result.pageids[0]]; var srcText = targetSrc.revisions[0]['*']; if (!overwrite) { // Check for duplicate talk messages with only the first 20 characters in case the messages subst into something different if (isTalkPost && srcText.includes(text.substring(0, 20))) { // Don't send duplicate badges/talk posts window.location.href = linkTo; return; } else if (srcText.includes(text)) { // Check for duplicate badges literally window.location.href = linkTo; return; }       		if (isTalkPost) { // Preserve the banner for talk posts text = srcText.replace("  ","") + "\n" + text + "   "; } else { // Otherwise just add for badges text = srcText + "\n" + text; }          }        }        api.post( {            'action' : 'edit',            'title' : targetPage,            'text' : text,            'summary' : 'New Message (simulated automatically as part of The Wikipedia Adventure)',            'token' : result.tokens.csrftoken        } ).done( function  {        	window.location.href = linkTo;        } ); } ); } var tour = new gt.TourBuilder( { name: 'twa6', }); var steps = [{               //1                title: 'Jumping right in. ',                description: new gt.WikitextDescription(' TWA_guide_left_top.png Let\'s head to the article talk page where GaiaGirl left a summary of the Nature Reviews Earth and Environment article in her own words. It\'s important for Wikipedia editors to summarize sources in their own words, rather than directly copying material from elsewhere - Wikipedia does not tolerate plagiarism or copyright violations.'),               overlay: true,                buttons: [ {                        name: 'Go to the Earth talk page*',                        onclick: function {sendTalkMessage( 'User talk:' + mw.config.get( 'wgUserName' ) + '/TWA/Earth', 'Wikipedia:TWA/Earth/Talk/2', mw.util.getUrl( 'Special:MyTalk/TWA/Earth' ) + '?tour=twa6&step=2', false, true); }                           } ],		        allowAutomaticOkay: false        },  {                //2                title: 'Cool!  New info.',                description: new gt.WikitextDescription(' TWA_guide_left_top.png Let\'s add that text to the article. '),               overlay: false,                attachTo: '#content.mw-body',                position: 'bottom',                closeOnClickOutside: false,                buttons: [ {                        name: ' ← ',                        action: 'externalLink',                        url: mw.util.getUrl( 'Wikipedia:TWA/6/Start' ) + '?tour=twa6&step=1'                          }, {                        name: 'Go to the Earth article',                        action: 'externalLink',                        url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa6&step=3'                      } ],                allowAutomaticOkay: false,        },  {                title: 'Click edit.',                description: new gt.WikitextDescription(' Click EDIT so you can add the summarized content  '),                attachTo: '#ca-edit',                position: 'bottom',                overlay: false, closeOnClickOutside: false, allowAutomaticOkay: false, buttons: [ { name: ' ← ', action: 'externalLink', url: mw.util.getUrl( 'Special:MyTalk/TWA/Earth' ) + '?tour=twa6&step=2' } ],               skip: "vefork", hooks: "ve.activationComplete"

}, {

//4               title: 'Add this!', description: new gt.WikitextDescription(' Science shows that Earth formed around 4.5 billion years ago. The organisms that live on Earth have completely changed its air (atmosphere); this is called a biosphere. 71% of Earth\'s surface is covered in salt water oceans. Earth is the only place in the Solar System where liquid water is known to exist at present. The other 29% is made of rocky land in the shape of continents and islands. Earth interacts with other objects in the Solar System, particularly the Sun and the Moon. The Earth orbits the Sun roughly once every 365.25 days. One spin is called a day and one orbit around the Sun is called a year. This is why there are 365 days in a year, but a leap day added to the calendar once every 4 years. Then click PUBLISH CHANGES as before.'), closeOnClickOutside: false, allowAutomaticOkay: false, buttons: [ { name: ' ← ', action: 'externalLink', url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa6&step=3' }],               skip: function(transitionEvent) { return transitionEvent.type === gt.TransitionEvent.MW_HOOK && transitionEvent.hookName == "ve.saveDialog.stateChanged"; },               hooks: "ve.saveDialog.stateChanged"

}, {                //5                title: 'Edit summary, and Publish', description: new gt.WikitextDescription(' Let them know that you, "Added more reliable, neutral info about Earth\'s history from the talk page". Then PUBLISH when you\'re ready.  '), // Ideally this would be attached to the save dialog itself but since it is still loading when the tour event fires that doesn't work attachTo: "#footer", position:"bottom", overlay: false, closeOnClickOutside: false, allowAutomaticOkay: false, buttons: [ { name: 'Go back', action: 'externalLink', url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa6&step=4&veaction=edit'

} ],               skip: gt.isPostEdit, }, {                //6                title: 'Hey Look...', description: new gt.WikitextDescription(' A New Message notification just came in!  '), overlay: false, closeOnClickOutside: false, allowAutomaticOkay: false, buttons: [ { name: ' ← ', action: 'externalLink', url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa6&step=4&veaction=edit' }, {                       name: 'Check your messages*', onclick: function { sendTalkMessage( 'User talk:' + mw.config.get( 'wgUserName' ) + '/TWA', 'Wikipedia:TWA/MyTalk/6', mw.util.getUrl( 'Special:MyTalk/TWA' ) + '?tour=twa6&step=7', false, true); } } ],

}, {                //7                title: 'Good question', description: new gt.WikitextDescription(' My inner orbit is feeling tingly.  I think you have another message...  '), overlay: false, attachTo: '#content.mw-body', position: 'bottom', closeOnClickOutside: false, allowAutomaticOkay: false, buttons: [ { name: ' ← ', action: 'externalLink', url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa6&step=6' }, {                       name: 'Reload the talk page*', onclick: function {  sendTalkMessage( 'User talk:' + mw.config.get( 'wgUserName' ) + '/TWA', 'Wikipedia:TWA/MyTalk/7', mw.util.getUrl( 'Special:MyTalk/TWA' ) + '?tour=twa6&step=8', false, true); } } ],

}, {                //8                title: 'What\'s a citation, you ask?', description: new gt.WikitextDescription(' Let\'s get to Earth and find out!  '), overlay: false, attachTo: '#content.mw-body', position: 'bottom', closeOnClickOutside: false, allowAutomaticOkay: false, back: true, buttons: [ { name: 'Head to Earth*', onclick: function {  sendTalkMessage( 'User:' + mw.config.get( 'wgUserName' ) + '/TWA/Earth', 'Wikipedia:TWA/Earth/cleanup', mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa6&step=9', true, true); } } ],

}, {               //9                title: 'What\'s that thing?', description: new gt.WikitextDescription(' That...CLEANUP TAG...doesn\'t look so good.  Let\'s check out the talk page to see what it means.'), overlay: false, attachTo: '.box-Unreferenced', position: 'bottom', closeOnClickOutside: false, buttons: [ { name: ' ← ', action: 'externalLink', url: mw.util.getUrl( 'Special:MyTalk/TWA' ) + '?tour=twa6&step=8' }, {                       name: 'Take it to Talk*', onclick: function { sendTalkMessage( 'User talk:' + mw.config.get( 'wgUserName' ) + '/TWA/Earth', 'Wikipedia:TWA/Earth/Talk/3', mw.util.getUrl( 'Special:MyTalk/TWA/Earth' ) + '?tour=twa6&step=10', false, true); } } ],               allowAutomaticOkay: false }, {

//10               title: 'Reply to Taggy', description: new gt.WikitextDescription(' Okay, stay cool.... deep breaths, deeeep breaths, deeeeeeeep breaaaaths.  What should we tell Taggy so that they know you understand sourcing policy, and were on your way to adding that info (as soon as you learned how)?  '), overlay: false, attachTo: '#content.mw-body', position: 'bottom', closeOnClickOutside: false, buttons: [ { name: ' ← ', action: 'externalLink', url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa6&step=9' }, {                       name: 'Reply to Taggy!', action: 'externalLink', url: mw.util.getUrl( 'Wikipedia:TWA/6/Civil' ) + '?tour=twa6&step=11' } ],               allowAutomaticOkay: false

}, {                //11                title: 'Challenge yourself BELOW...', description: 'Hint: you can learn as much from getting it wrong as getting it right. And you can always try again!', attachTo:'#contentSub', position: 'bottom', buttons: [ { name: ' ← ', action: 'externalLink', url: mw.util.getUrl( 'Special:MyTalk/TWA/Earth' ) + '?tour=twa6&step=10' } ],               overlay: false, closeOnClickOutside: false, allowAutomaticOkay: false

}, {                //12                title: 'Well done', description: new gt.WikitextDescription('NEW TOOL EARNED: Civility Badge   Reload the Earth talk page. '), overlay: false, closeOnClickOutside: false, buttons: [ { name: ' ← ', action: 'externalLink', url: mw.util.getUrl( 'Wikipedia:TWA/6/Civil' ) + '?tour=twa6&step=11' }, {                           name: 'Reload*', onclick: function {  sendTalkMessage( 'User talk:' + mw.config.get( 'wgUserName' ) + '/TWA/Earth', 'Wikipedia:TWA/Earth/Talk/4', mw.util.getUrl( 'Special:MyTalk/TWA/Earth' ) + '?tour=twa6&step=13', false, true); } } ],               allowAutomaticOkay: false

}, {

//13               title: 'Ok, Citation needed', description: new gt.WikitextDescription(' Citing a source means saying where you found the information in an article.  A source used to support information is called a reference.  '), overlay: false, attachTo: '#content.mw-body', position: 'bottom', closeOnClickOutside: false, buttons: [ { name: ' ← ', action: 'externalLink', url: mw.util.getUrl( 'Wikipedia:TWA/6/Start' ) + '?tour=twa6&step=12' }, {                           name: 'Inline magic*', onclick: function { sendTalkMessage( 'User:' + mw.config.get( 'wgUserName' ), 'Wikipedia:TWA/Badge/11template2', mw.util.getUrl( 'Wikipedia:TWA/6/Start' ) + '?tour=twa6&step=14', false, false); } } ],               allowAutomaticOkay: false

}, {               //14                title: 'How and why citations', description: new gt.WikitextDescription(' I\'m going to show you how to add a reference in the article and how to do it using an inline citation. An inline citation shows up as a [number] in the text of the article, and it links to a reference at the bottom.  We do that so readers know which part of the article a source backs up.  '), overlay: false, closeOnClickOutside: false, allowAutomaticOkay: false, buttons: [ { name: ' ← ', action: 'externalLink', url: mw.util.getUrl( 'Special:MyTalk/TWA/Earth' ) + '?tour=twa6&step=13' }, {                               name: 'Let\'s do this', action: 'externalLink', url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa6&step=15' } ],

}, {                //15                title: 'Click edit', description: new gt.WikitextDescription(' Click EDIT so you can add an inline citation. '), attachTo: '#ca-edit', position: 'bottom', overlay: false, closeOnClickOutside: false, allowAutomaticOkay: false, buttons: [ { name: ' ← ', action: 'externalLink', url: mw.util.getUrl( 'Wikipedia:TWA/6/Start' ) + '?tour=twa6&step=14' } ],               skip: "vefork", hooks: "ve.activationComplete"

}, {                //16                title: 'Citation steps', description: new gt.WikitextDescription(' First, copy the URL of the source: https://www.nature.com/articles/s43017-019-0005-6  The Visual editor is smart enough to automatically generate a citation with only a URL. This works well for scientific journals, and less well for other websites, so the citation may need tweaking. '), closeOnClickOutside: false, buttons: [ { name: ' ← ', action: 'externalLink', url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa6&step=15' }, {                	    name: 'Copied', action: 'next', } ],

}, {               //17                title: 'Cite it', description: new gt.WikitextDescription(' Place the mouse, after the period, of the sentence you want to source. DON\'T paste the reference just yet.  Now, click the " Cite" icon on the editing toolbar.  Paste the URL in there!  After you\'ve pasted it, click CREATE, and then, once the citation has been created, click INSERT to add it.  '), overlay: false, attachTo: '.ve-ui-toolbar-group-citoid', position: 'bottom', closeOnClickOutside: false, allowAutomaticOkay: false, back: true, buttons: [ { name: 'Reference added', action: 'next', } ],

}, {               //18                title: 'Add a REFLIST', description: new gt.WikitextDescription(' To make the reference show up properly, add a REFERENCES section with a REFLIST  Click away from the citation and put the mouse at the bottom of the text, below the citation.  Copy this line there:     '), overlay: false, closeOnClickOutside: false, allowAutomaticOkay: false, back: true, buttons: [ { name: 'Reflist added!', action: 'next', } ],

}, {               //19                title: 'Remove that tag :)',                description: new gt.WikitextDescription('  You solved the problem, so let\'s go delete the cleanup tag. Go ahead, select the box, and press backspace to delete it. Begone! Then click PUBLISH CHANGES.'),               overlay: false,                attachTo: '.box-Unreferenced',                position: 'bottomRight',                closeOnClickOutside: false,                allowAutomaticOkay: false,                back: true,                buttons: [ ],                skip: function(transitionEvent) {                	return transitionEvent.type === gt.TransitionEvent.MW_HOOK && transitionEvent.hookName == "ve.saveDialog.stateChanged";                },                hooks: "ve.saveDialog.stateChanged"

}, {               //20                title: 'Edit summary, and Publish', description: new gt.WikitextDescription(' Let them know that you, "Added an inline citation for the reliable source and removed the cleanup tag". Then PUBLISH when you\'re ready.  '), autoFocus: 'yes', // Ideally this would be attached to the save dialog itself but since it is still loading when the tour event fires that doesn't work attachTo: "#footer", position:"bottom", closeOnClickOutside: false, allowAutomaticOkay: false, buttons: [ { name: 'Go Back', action: 'externalLink', url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa6&step=19&veaction=edit' } ],               skip: gt.isPostEdit }, {               //21                title: 'Awesome job!', description: new gt.WikitextDescription('NEW TOOL EARNED: Citer Badge   Look at that! Gosh that gets me every time. I just take so much pride in my—I mean your references. How do you feel? Good, I hope. You should, because you\'re learning. You\'re becoming a great editor! You impress me. You\'ve begun to master editing... policy... communication...references...navigation... '), overlay: false, closeOnClickOutside: false, buttons: [ { name: ' ← ', action: 'externalLink', url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa6&step=19&veaction=edit' }, {                        name: 'What\'s next*', onclick: function { sendTalkMessage( 'User:' + mw.config.get( 'wgUserName' ), 'Wikipedia:TWA/Badge/12template2', mw.util.getUrl( 'Wikipedia:TWA/6/End' ) + '?tour=twa6&step=22', false, false); } } ],               allowAutomaticOkay: false

}, {               //22                title: 'Mission 6 complete!', description: new gt.WikitextDescription(' Journey on to mission 7, your skills are needed again!'), overlay: false, closeOnClickOutside: false, buttons: [ { name: 'Congrats me!', action: 'end' } ],               allowAutomaticOkay: false }]; var sourceEditorStepOverrides = { 4: {               title: 'Add this!', description: new gt.WikitextDescription(' Science shows that Earth formed around 4.5 billion years ago. The organisms that live on Earth have completely changed its air (atmosphere); this is called a biosphere. 71% of Earth\'s surface is covered in salt water oceans. Earth is the only place in the Solar System where liquid water is known to exist at present. The other 29% is made of rocky land in the shape of continents and islands. Earth interacts with other objects in the Solar System, particularly the Sun and the Moon. The Earth orbits the Sun roughly once every 365.25 days. One spin is called a day and one orbit around the Sun is called a year. This is why there are 365 days in a year, but a leap day added to the calendar once every 4 years. '), attachTo: '#wpTextbox1', position: 'bottomRight', overlay: false, closeOnClickOutside: false, allowAutomaticOkay: false, buttons: [ { name: ' ← ', action: 'externalLink', url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa6&step=3' }, {		       	    name: 'Added', action: 'next', } ],	}, 5: {               title: 'Edit summary and Publish', description: new gt.WikitextDescription(' Let them know that you, "Added more reliable, neutral info about Earth\'s history from the talk page". Then PUBLISH when you\'re ready.  '), attachTo: '#wpSave', position: 'bottomRight', autoFocus: 'yes', overlay: false, closeOnClickOutside: false, allowAutomaticOkay: false, back: true, buttons: [ ], skip: gt.isPostEdit }, 16: {		       title: 'Citation steps', description: new gt.WikitextDescription(' First copy the citation which describes the source.  Steffen, W., Richardson, K., Rockström, J. et al. The emergence and evolution of Earth System Science. Nature Reviews Earth & Environment. 1, 54–63 (2020). https.//doi.org/10.1038/s43017-019-0005-6. Retrieved .  '), overlay: false, attachTo: '#wpTextbox1', position: 'bottomRight', closeOnClickOutside: false, buttons: [ { name: ' ← ', action: 'externalLink', url: mw.util.getUrl( 'Special:MyPage/TWA/Earth' ) + '?tour=twa6&step=15' }, {                	    name: 'Copied', action: 'next', } ],	}, 17: {               title: 'Cite it', description: new gt.WikitextDescription(' Place the mouse, after the period, of the sentence you want to source. DON\'T paste the reference just yet.  Now, click the  on the editing toolbar.  Paste the reference inside the tags!'), overlay: false, attachTo: '#wpTextbox1', position: 'bottomRight', closeOnClickOutside: false, allowAutomaticOkay: false, back: true, buttons: [ { name: 'Reference added', action: 'next', } ],	}, 18: {               title: 'Add a REFLIST', description: new gt.WikitextDescription(' To make the reference show up properly, add a REFERENCES section with a REFLIST  Put the mouse at the bottom of the editing box.  Type:     '), overlay: false, attachTo: '#wpTextbox1', position: 'bottomRight', closeOnClickOutside: false, allowAutomaticOkay: false, back: true, buttons: [ { name: 'Reflist added!', action: 'next', } ],	}, 19: {		       title: 'Remove that tag :)',                description: new gt.WikitextDescription('  You solved the problem, so let\'s go delete the cleanup tag. Go ahead and find and delete:    Begone! '),               overlay: false,                attachTo: '#wpTextbox1',                 position: 'bottomRight',                closeOnClickOutside: false,                allowAutomaticOkay: false,                back: true,                buttons: [ {                 	    name: 'Removed!',                        action: 'next',                } ],	}, 20: {		        title: 'Edit summary and publish',                description: new gt.WikitextDescription(' Let them know that you, "Added an inline citation for the reliable source and removed the cleanup tag". Then PUBLISH when you\'re ready. '),	           attachTo: '#wpSave',                position: 'bottomRight',                autoFocus: 'yes',                overlay: false,                closeOnClickOutside: false,                allowAutomaticOkay: false,                back: true,                buttons: [ ],                skip: gt.isPostEdit	} }; var stepBuilders = []; var sStepBuilders = []; function makeSkip(target, query) {	return function(event) {		if (query(event)) {			return target;		}	}; } function makeVeSkip(target1, target2) {	return function {		if (gt.isEditingWithVisualEditor) {			return target1;		} else if (gt.isEditingWithWikitext) {			return target2;		} 	}; } for (var i = 0; i < steps.length; i++) {	var step = steps[i];	step.allowAutomaticNext = false;	step.name = (i+1).toString;	var stepBuilder;	if (i == 0) {		stepBuilder = tour.firstStep(step);	} else {		stepBuilder = tour.step(step);	}

stepBuilders[i] = stepBuilder; if (sourceEditorStepOverrides[i]) { var sStep = sourceEditorStepOverrides[i]; sStep.allowAutomaticNext = false; sStep.name = i.toString+"src"; sStepBuilders[i-1] = tour.step(sStep); } } for (var j = 0; j < steps.length; j++) { if (steps[j].hooks) { stepBuilders[j].listenForMwHooks(steps[j].hooks); }	if (steps[j].skip) { if (steps[j].skip == "vefork") { stepBuilders[j].transition(makeVeSkip(stepBuilders[j+1], sStepBuilders[j+1])); } else { stepBuilders[j].transition(makeSkip(stepBuilders[j+1], steps[j].skip)); }	}	if (sourceEditorStepOverrides[j] && sourceEditorStepOverrides[j].skip) { sStepBuilders[j-1].transition(makeSkip(sStepBuilders[j] || stepBuilders[j], sourceEditorStepOverrides[j].skip)); }	if (j > 0) { if (steps[j].back) { stepBuilders[j].back(stepBuilders[j-1]); }		if (sStepBuilders[j-1] && sStepBuilders[j-2] && sourceEditorStepOverrides[j].back) { sStepBuilders[j-1].back(sStepBuilders[j-2]); }	}	if (j < steps.length - 1) { stepBuilders[j].next(stepBuilders[j+1]); if (sStepBuilders[j] && sStepBuilders[j+1]) { sStepBuilders[j].next(sStepBuilders[j+1]); }	} } } (window, document, jQuery, mediaWiki, mediaWiki.guidedTour ) ) ;