Expand all

MetadataPanelScroller

Handles scrolling behavior of the metadata panel.

Constructor

new MetadataPanelScroller($container, $aboveFold) #

Parameters:

Name Type Description
$container jQuery

The container for the panel (.mw-mmv-post-image).

$aboveFold jQuery

The control bar element (.mw-mmv-above-fold).

Source:

Properties

hasOpenedMetadata :boolean #

Whether this user has ever opened the metadata panel. Based on a localstorage flag; will be set to true if the client does not support localstorage.

Type:

  • boolean
Source:
Whether this user has ever opened the metadata panel.

panelWasOpen #

Properties:

Name Type Description
panelWasOpen boolean

state flag which will be used to detect open <-> closed transitions

Source:

Methods

animateMetadataOnce() #

Animates the metadata area when the viewer is first opened.

Source:
Animates the metadata area when the viewer is first opened.

freezeHeight() #

Makes sure the panel does not contract when it is emptied and thus keeps its position as much as possible. This should be called when switching images, before the panel is emptied, and should be undone with unfreezeHeight after the panel has been populated with the new metadata.

Source:
Makes sure the panel does not contract when it is emptied and thus keeps its position as much as possible.

getScrollTopWhenOpen() → {number} #

Returns scroll top position when the panel is fully open. (In other words, the height of the area that is outside the screen, in pixels.)

Returns:

Type
number
Source:
Returns scroll top position when the panel is fully open.

keydown(e) #

Handles keydown events for this element.

Parameters:

Name Type Description
e jQuery.Event

Key down event

Source:
Handles keydown events for this element.

panelIsOpen() → {boolean} #

Returns whether the metadata panel is open. (Partially open is considered to be open.)

Returns:

Type
boolean
Source:
Returns whether the metadata panel is open.

scroll() #

Receives the window's scroll events and and turns them into business logic events

Fires:

Source:
Receives the window's scroll events and and turns them into business logic events

toggle([forceDirection]) → {jQuery.Promise} #

Toggles the metadata div being totally visible.

Parameters:

Name Type Attributes Description
forceDirection string optional

'up' or 'down' makes the panel move on that direction (and is a noop if the panel is already at the upmost/bottommost position); without the parameter, the panel position is toggled. (Partially open counts as open.)

Returns:

A promise which resolves after the animation has finished.

Type
jQuery.Promise
Source:
Toggles the metadata div being totally visible.

Events

mmv-metadata-close() #

mmv-metadata-open() #