MediaWiki:Guidedtour-tour-oclcfulltext.js

// OCLC Full Text Reference Tool ( function ( window, document, $, mw, gt ) { //automatic api:edit function to send yourself messages function sendMessage( targetPage, msgPage, linkTo ) {	var api = new mw.Api;	api.get( { 'action' : 'query', 'titles' : msgPage, 'prop'  : 'revisions', 'meta'  : 'tokens', 'type'  : 'csrf', 'rvprop' : 'content', 'indexpageids' : 1 } ).done( function (result) { result = result.query; var page = result.pages[result.pageids[0]]; var text = page.revisions[0]['*']; api.post( {			'action' : 'edit',			'title' : targetPage,			'appendtext' : "\n" + text,			'summary' : 'Installing OCLC Full Text Reference script (API:EDIT) through The Wikipedia Library',			'token' : result.tokens.csrftoken		} ).done( function {			window.location.href = linkTo;		} ); } ); } // Fail gracefully post-save but not postedit var postEditButtons = []; if ( mw.config.get( 'wgAction' ) === 'view' && !gt.isPostEdit ) {       postEditButtons.push( { name: 'Click here to go back and make an edit', onclick: function { window.location.href = new mw.Uri.extend( { action: 'edit' } ).toString; }       } ); } // Fail gracefully post-save but not postedit for visual editor var postEditButtonsVisual = []; if ( mw.config.get( 'wgAction' ) === 'view' && !gt.isPostEdit ) {        postEditButtonsVisual.push( { name: 'Go Back', onclick: function { window.location.href = window.location.href + "&veaction=edit"; }       } ); } gt.defineTour( { name: 'oclcfulltext', shouldLog: true, steps: [ { //1               title: 'Welcome to Wikipedia!', description: ' We built a tool so you can go directly from Wikipedia article references to holdings at your library. ',               onShow: gt.parseDescription, overlay: true, closeOnClickOutside: false, buttons: [ { name: 'Installing the script', action: 'next', } ],                               allowAutomaticOkay: false }, {                //2                title: 'Login with your account', description: ' Or register if you don\'t have one yet... ',               onShow: gt.parseDescription, overlay: false, closeOnClickOutside: false, buttons: [ { name: '←', action: 'externalLink', url: mw.util.getUrl( 'Wikipedia:OCLC' ) + '?tour=oclcfulltext&step=1' }, {               	name: 'I am logged in', action: 'externalLink', url: mw.util.getUrl( 'Wikipedia:OCLC' ) + '?tour=oclcfulltext&step=3' }, {               	name: 'I need to login', action: 'externalLink', url: mw.util.getUrl( 'Special:UserLogin' ) + '?tour=oclcfulltext&step=3' }, {               	name: 'Register!', action: 'externalLink', url: mw.util.getUrl( 'Special:UserLogin/signup' ) + '?tour=oclcfulltext&step=3' } ],               allowAutomaticOkay: false, shouldSkip: function { return mw.config.get( 'wgUserId' ) !== null; }

}, {        	    //3                title: 'One click and you\'re done', description: ' This is easy, just click the Install button ', overlay: true, onShow: gt.parseDescription, closeOnClickOutside: false, buttons: [ { name: '←', action: 'externalLink', url: mw.util.getUrl( 'Wikipedia:OCLC' ) + '?tour=oclcfulltext&step=1' }, {                        name: 'Install script*', onclick: function {  if(!mw.config.get('wgUserName')){  alert( "Please login." );   return;   } sendMessage( 'User:' + mw.config.get( 'wgUserName' ) + '/common.js', 'Wikipedia:OCLC.js', mw.util.getUrl( 'Wikipedia:TWL/OCLC/Eswitch/Testing2' ) + '?tour=oclcfulltext&step=4'); } } ],	               allowAutomaticOkay: false }, {

//4               title: 'Try it out!', description: ' Test it out. Wait for the page to load and scroll down to look for the word LINK after each reference. Click on each one and see where it takes you. Do you need to login at your library? Does it take you to an open access version or a Resolver?', onShow: gt.parseDescription, overlay: false, closeOnClickOutside: false, buttons: [ { name: '←', action: 'externalLink', url: mw.util.getUrl( 'Wikipedia:OCLC' ) + '?tour=oclcfulltext&step=3' }, {                       name: 'I\'m done.', action: 'next', } ],               allowAutomaticOkay: false }, {

//5		 		title: 'That is it!', description: ' For more information contact Jake Orlowitz (User:Ocaasi (WMF)), jorlowitz@undefinedwikimedia.org, @JakeOrlowitz ', onShow: gt.parseDescription, overlay: false, closeOnClickOutside: true, buttons: [ { name: '←', action: 'externalLink', url: mw.util.getUrl( 'Wikipedia:OCLC' ) + '?tour=finddpla&step=4' }, {               	    name: 'That was fun. Congrats me!', action: 'end' } ], }]

} ); } (window, document, jQuery, mediaWiki, mediaWiki.guidedTour ) ) ;