Expand all

mw.libs.guiders

Code for rendering and low-level code of moving between steps.

You should use the public mw.guidedTour API when possible, rather then calling methods from this file directly. The API of this file will change.

Constructor

new mw.libs.guiders() #

Author:
  • jeff+pickhardt@optimizely.com
  • mflaschen@wikimedia.org
  • tychay@php.net
Source:

Methods

_attach(myGuider) → {jQuery|undefined} #

Attaches a guider

Parameters:

Name Type Description
myGuider Object

guider to attach

Source:

Returns:

jQuery node for guider's element if successful, or undefined for invalid input.

Type
jQuery | undefined
Attaches a guider

_getAttachCss(attachTo, guider, position) → {Object} #

Returns CSS for attaching a guider to its associated element

Parameters:

Name Type Description
attachTo jQuery

element to attach to

guider Object

guider object

position number

position for guider, using clock model (0-12).

Source:

Returns:

CSS properties for the attachment

Type
Object
Returns CSS for attaching a guider to its associated element

_guiderById(id) → {Object} #

Returns the guider by ID.

Add check to create and grab guider from inits if it exists there.

Parameters:

Name Type Description
id string

id of guider

Source:

Returns:

guider object

Type
Object
Returns the guider by ID.

_removeAnimations(myGuider) #

Remove all animation classes

Parameters:

Name Type Description
myGuider Object

guider to remove animations from

Source:
Remove all animation classes

_setupAnimations(myGuider, position) #

Add appropriate animation class relative to guider position

Parameters:

Name Type Description
myGuider Object

guider to add animation class to

position number

guider attachment position

Source:
Add appropriate animation class relative to guider position

back() #

Shows the 'back' step

createGuider(passedSettings) → {Object} #

Creates a guider

Parameters:

Name Type Description
passedSettings Object

settings for the guider

Source:

Returns:

guiders singleton

Type
Object
Creates a guider

doStep(direction) #

Move the guider directionally to the corresponding step. eg. next, back

Parameters:

Name Type Description
direction string

next or back

Source:
Move the guider directionally to the corresponding step.

getFlippedPosition(position, options) → {number} #

Flips a position horizontally, vertically, both, or not all. This can be used for various scenarios, such as handling right-to-left languages and flipping a position if the original one would go off screen.

It accepts both string (e.g. "top") and numeric (e.g. 12) positions.

Parameters:

Name Type Description
position string | number

position as in guider settings object

options Object

how to flip

Properties:
Name Type Description
vertical boolean

true to flip vertical (optional, defaults false)

horizontal boolean

true to flip vertical (optional, defaults false)

Source:

Returns:

position with requested flippings in numeric form

Type
number
Flips a position horizontally, vertically, both, or not all.

hideAll(omitHidingOverlay, next) → {Object} #

Hides all guiders

Parameters:

Name Type Description
omitHidingOverlay boolean | undefined

falsy to hide overlay, true not to change it

next boolean

true if caller will immediately show another guider in place of the one being hidden (optional, defaults false)

Source:

Returns:

guiders singleton

Type
Object
Hides all guiders

initGuider(passedSettings) #

This stores the guider but does no work on it. It is an alternative to createGuider() that defers the actual setup work.

Parameters:

Name Type Description
passedSettings Object

Settings

Source:
This stores the guider but does no work on it.

next() #

Shows the 'next' step

scrollToCurrent() #

Scroll to the current guider

Source:
Scroll to the current guider

show(id) → {undefined|boolean|Object} #

Show a guider

Parameters:

Name Type Description
id string

id of guider to show. The default is the last guider created.

Source:

Returns:

Undefined in case of error, return value from the guider's onShow, if that is truthy, otherwise the guiders singleton.

Type
undefined | boolean | Object
Show a guider