MediaWiki:Common.js/GuidedTour.js

var btScript = ''; btScript += ''; btScript += ' '; btScript += ' '; $("head").append(btScript);

if($.cookie("bt_tour") && $.cookie("bt_step")) startTour($.cookie("bt_tour"),$.cookie("bt_step"));

function startTour(tourName,step){ $.removeCookie("bt_tour"); $.removeCookie("bt_step"); var step = typeof step !== 'undefined' ? step : 0; switch(tourName){ case "createPageGuide": var tour = new Tour({			 name: "createPageGuide",			  steps: [				  {					element: "#searchInput",					placement: "bottom",					title: "Search for the page",					content: "Search for the page that you are looking for on the search bar here by entering the phrase that much your query.",					onShown: function{						var nB = $("button[data-role='next']"),							sI = $("#searchInput");						if(sI.val != ''){							nB.removeAttr('disabled');						} else {							nB.attr('disabled','disabled');						}						sI.keyup(function{ if($(this).val != '') { nB.removeAttr('disabled'); } else { nB.attr('disabled','disabled'); }						}).focus;					}				 },				  {					element: "#mw-searchButton",					placement: "bottom",					title: "Search for the page",					content: "Hit this button to search",					onNext: function{						$.cookie("bt_tour", "createPageGuide", {path:'/'});						$.cookie("bt_step", 2, {path:'/'});						var kW = $("#searchInput").val;						if(kW){							window.location.href = '/index.php?title=Special%3ASearch&search=' + kW;							return (new jQuery.Deferred).promise;						}			      	},			      	reflex: true				  },				  {					element: ".mw-search-createlink a",					placement: "bottom",					title: "Page create link",					content: "Click this link to the phrase you have used to search.",					onNext: function{						$.cookie("bt_tour", "createPageGuide", {path:'/'});						$.cookie("bt_step", 3, {path:'/'});						var rD = $(".mw-search-createlink a").attr("href");						if(rD){ window.location.href = rD; return (new jQuery.Deferred).promise; }			     	},					reflex: true },				 {					element: ".wikiEditor-ui", placement: "left", title: "Writing your content", content: "Start typing the content of your new wiki page in this text-box.", next: -1, onShown: function{ var ta = $(".wikiEditor-ui textarea"), tx = "Start writing your content here.\nYou may use formatting toolbar above to styling your content."; ta.click(function{							ta.text('');							startTour('createPageGuide',4);						}).text(tx).focus; },					reflex: true },				 {					element: "div[rel='wikiEditor-ui-view-preview'] a", placement: "top", title: "Preview", content: "Switch to this tab for content preview if needed.", reflex: true },				 {					element: "div.wikiEditor-ui-buttons button:eq(0)", placement: "top", title: "Publish", content: "Hit the publish button when done.", reflex: true, next: -1 }			 ]			});			tour.init;			tour.start(true).goTo(step);

case "editPageGuide": var tour = new Tour({			 name: "editPageGuide",			  steps: [				  {					element: "span.Sample_Page_to_Edit a",					placement: "top",					title: "Select page to edit",					content: "You may use this already made sample page for practice. Please click this link or next button.",					onNext: function{						$.cookie("bt_tour", "editPageGuide", {path:'/'});						$.cookie("bt_step", 1, {path:'/'});						var rD = $("span.Sample_Page_to_Edit a").attr("href");						if(rD){							window.location.href = rD;							return (new jQuery.Deferred).promise;						}			      	},					reflex: true				  },				  {					element: "li#ca-edit a",					placement: "bottom",					title: "Edit link",					content: "Click this edit link to open the editor.",					onNext: function{						$.cookie("bt_tour", "editPageGuide", {path:'/'});						$.cookie("bt_step", 2, {path:'/'});						var rD = $("li#ca-edit a").attr("href"); if(rD){ window.location.href = rD; return (new jQuery.Deferred).promise; }			     	},					reflex: true },				 {					element: ".wikiEditor-ui", placement: "left", title: "Editing page content", content: "Start editing this page content in this text-box.", next: -1, onShown: function{ $(".wikiEditor-ui textarea").click(function{							startTour('editPageGuide',3);						}); },					reflex: true },				 {					element: "div[rel='wikiEditor-ui-view-preview'] a", placement: "top", title: "Preview", content: "Switch to this tab for content preview if needed.", reflex: true },				 {					element: "div.wikiEditor-ui-buttons button:eq(0)", placement: "top", title: "Publish", content: "Hit the publish button when done.", reflex: true, next: -1 }				]			});			tour.init;			tour.start(true).goTo(step);

default: false; } }