Namespaces
- TransitionAction
Special actions to take when there's a transition (other than simply returning another step)
Classes
- IllegalArgumentError
- Error subclass for invalid arguments (that are not part of tour definition)
- StepBuilder
- A builder for defining a step of a guided tour
- Tour
- A guided tour
- TourBuilder
- A builder for defining a guided tour
- TourDefinitionError
- Error subclass for errors that occur during tour definition
- TransitionEvent
- WikitextDescription
- Wikitext to be used as a step description
- launcher
- A module for launching guided tours that has no dependencies.
Constructor
new mw.guidedTour()
#
Methods
defineTour(tourSpec) → {mw.guidedTour.TourBuilder}
#
Creates a tour based on an object specifying it, but does not show it immediately
mw.guidedTour.Tour#constructor has details on tourSpec.name, tourSpec.isSinglePage, and tourSpec.showConditionally.
Parameters:
| Name | Type | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tourSpec |
Object | object specifying tour Properties:
|
Returns:
the builder used to create the tour
Throws:
-
On invalid input
Creates a tour based on an object specifying it, but does not show it immediately
mw.guidedTour.Tour#constructor has details on tourSpec.name, tourSpec.isSinglePage, and tourSpec.showConditionally.
endTour([tourName])
#
Ends the tour, removing user's state
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
tourName |
string |
optional |
tour to end, defaulting to most recent one that showed a guider |
getPageAsDescription(guider)
#
Parses a wiki page and uses the HTML as the description.
To use this, put the page name as the description, and use this as the value of onShow.
Parameters:
| Name | Type | Description |
|---|---|---|
guider |
Object | Guider object to set description on |
- Deprecated:
- Yes
- Source:
hasQuery(queryParts, [pageName]) → {boolean}
#
Checks whether the query and pageName match the provided ones.
It will return true if and only if the actual query string has all of the mappings from queryParts (the actual query string may be a superset of the expected), and pageName (optional) is exactly equal to wgPageName.
If pageName is falsy, the page name will not be considered in any way.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
queryParts |
Object | Object mapping expected query parameter names (string) to expected values (string) |
|
pageName |
string |
optional |
Page name |
Returns:
true if and only if there is a match per above
- Type
- boolean
hideAll()
#
Hides the guider(s)
isEditing() → {boolean}
#
Checks if the user is editing, with either wikitext or the VisualEditor. Does not include previewing.
Returns:
true if and only if they are actively editing
- Type
- boolean
Checks if the user is editing, with either wikitext or the VisualEditor.
isEditingWithVisualEditor() → {boolean}
#
Checks if the user is editing with VisualEditor. This is only true if the surface is actually open for edits.
Use isVisualEditorOpen instead if you want to check if there is a VisualEditor instance on the page.
- Source:
- See:
Returns:
true if and only if they are actively editing with VisualEditor
- Type
- boolean
isEditingWithWikitext() → {boolean}
#
Checks if the user is editing with wikitext. Does not include previewing.
Returns:
true if and only if they are on the edit action
- Type
- boolean
isPage(pageName) → {boolean}
#
Checks whether user is on a particular wiki page.
Parameters:
| Name | Type | Description |
|---|---|---|
pageName |
string | Expected page name |
Returns:
true if the page name is a strict match, false otherwise
- Type
- boolean
isPostEdit() → {boolean}
#
Checks whether the user just saved an edit.
You can also handle the 'postEdit' mw.hook in a mw.guidedTour.StepBuilder#transition handler.
This method is not necessary if post-edit is the only criterion for the transition.
Returns:
true if they just saved an edit, false otherwise
- Type
- boolean
isReviewing() → {boolean}
#
Checks whether the user is previewing or reviewing changes (after clicking "Show changes")
Returns:
true if and only if they are reviewing
- Type
- boolean
Checks whether the user is previewing or reviewing changes (after clicking "Show changes")
isReviewingWithWikitext() → {boolean}
#
Checks whether the user is previewing or reviewing wikitext changes (the latter meaning the screen after clicking "Show changes")
Returns:
true if and only if they are reviewing wikitext
- Type
- boolean
Checks whether the user is previewing or reviewing wikitext changes (the latter meaning the screen after clicking "Show changes")
isVisualEditorOpen() → {boolean}
#
Checks whether VisualEditor is open
Returns:
true if and only if there is a VisualEditor instance on the page
- Type
- boolean
launchTourFromEnvironment()
#
Attempts to automatically launch a tour based on the environment
If the query string has a tour parameter, the method attempts to use that.
Otherwise, the method tries to use the GuidedTour cookie. It checks which tours are applicable to the current page. If more than one is, this method loads the most recently started tour.
If both fail, it does nothing.
Attempts to automatically launch a tour based on the environment
If the query string has a tour parameter, the method attempts to use that.
launchTourFromQueryString() → {boolean}
#
Attempts to launch a tour from the query string (tour parameter)
Returns:
Whether a tour was launched
- Type
- boolean
launchTourFromUserState() → {boolean}
#
Attempts to launch a tour from combined user state (cookie + tours launched directly by server)
Returns:
Whether a tour was launched
- Type
- boolean
Attempts to launch a tour from combined user state (cookie + tours launched directly by server)
makeTourId(tourInfo) → {string|null}
#
null}
#
Serializes tour information into a string
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
tourInfo |
Object |
Properties:
|
Returns:
ID of tour, or null if invalid input
- Type
-
string
|
null
parseDescription(guider)
#
Parses description as wikitext
Add this to onShow.
Parameters:
| Name | Type | Description |
|---|---|---|
guider |
Object | Guider object to set description on |
- Deprecated:
- Yes
- Source:
Parses description as wikitext
Add this to onShow.
parseTourId(tourId) → {Object|null|string|string}
#
null|string|string}
#
Parses tour ID into an object with name and step keys.
Parameters:
| Name | Type | Description |
|---|---|---|
tourId |
string | ID of tour/step combination |
Returns:
-
Tour info object, or null if invalid input
- Type
-
Object
|
null
-
return.name Tour name
- Type
- string
-
return.step Tour step, always a string, but either textual (e.g. 'preview') or numeric (e.g. '5')
- Type
- string
resumeTour(tourName, [step])
#
Resumes a loaded tour, specifying a tour and (optionally) a step.
If no step is provided, it will first try to get a step from the URL.
If that fails, it will try to resume from the cookie.
Finally, it will default to step 1.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
tourName |
string | Tour name |
|
step |
number | string |
optional |
Step, defaulting to the cookie or first step of tour. |
setTourCookie(name, [step])
#
Sets the tour cookie, given a tour name and optionally, a step.
You can use this when you want the tour to be displayed on a future page. If there is currently no cookie, it will set the start time. This will not be done if only the step is changing.
This does not take into account isSinglePage.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name |
string | Tour name |
||
step |
number | string |
optional |
1 | Tour step |
transition(transitionEvent)static
#
Checks for a transition after a minimal timeout
Parameters:
| Name | Type | Description |
|---|---|---|
transitionEvent |
mw.guidedTour.TransitionEvent | event that triggered the check |