Expand all

MultimediaViewerBootstrap

Bootstrap code listening to thumb clicks checking the initial location.hash Loads the mmv and opens it if necessary

Constructor

new MultimediaViewerBootstrap() #

Properties

eventHandlersHaveBeenSetUp #

Properties:

Name Type Description
eventHandlersHaveBeenSetUp boolean

tracks domready event handler state

Source:

thumbs #

Properties:

Type Description
Array.<LightboxImage>
Source:

viewerIsBroken #

This flag is set to true when we were unable to load the viewer.

Properties:

Type Description
boolean
Source:
This flag is set to true when we were unable to load the viewer.

Methods

cleanupEventHandlers() #

Cleans up event handlers, used for tests

Source:
Cleans up event handlers, used for tests

cleanupOverlay() #

Cleans up the overlay

Source:
Cleans up the overlay

click(e, image) → {boolean} #

Handles a click event on a link

Parameters:

Name Type Description
e jQuery.Event

jQuery event object

image LightboxImage

Image

Returns:

a value suitable for an event handler (ie. true if the click should be handled by the browser).

Type
boolean
Source:
Handles a click event on a link

ensureEventHandlersAreSetUp() #

Makes sure event handlers are set up properly via MultimediaViewerBootstrap.setupEventHandlers(). Called before loading the main mmv module. At this point, event handlers for MultimediaViewerBootstrap should have been set up, but due to bug 70756 it cannot be guaranteed.

Source:
Makes sure event handlers are set up properly via MultimediaViewerBootstrap.setupEventHandlers().

findCaption($thumbContainer, $link) → {string|undefined} #

Finds the caption for an image.

Parameters:

Name Type Description
$thumbContainer jQuery

The container for the thumbnail.

$link jQuery

The link that encompasses the thumbnail.

Returns:

Unsafe HTML may be present - caution

Type
string | undefined
Source:
Finds the caption for an image.

hash() #

Handles the browser location hash on pageload or hash change

Source:
Handles the browser location hash on pageload or hash change

isAllowedThumb($thumb) → {boolean} #

Check if this thumbnail should be handled by MediaViewer

Parameters:

Name Type Description
$thumb jQuery

the thumbnail (an <img> element) in question

Returns:

Type
boolean
Source:
Check if this thumbnail should be handled by MediaViewer

isValidExtension(title) → {boolean} #

Parameters:

Name Type Description
title mw.Title | null

Returns:

Type
boolean
Source:

loadViewer() → {jQuery.Promise} #

Loads the mmv module asynchronously and passes the thumb data to it

Returns:

Type
jQuery.Promise
Source:
Loads the mmv module asynchronously and passes the thumb data to it

openImage(image) #

Opens MediaViewer and loads the given thumbnail. Requires processThumb() to be called first.

Parameters:

Name Type Description
image LightboxImage

Image

Source:
Opens MediaViewer and loads the given thumbnail.

preloadAssets($thumbContainer) #

Preload JS/CSS when the mouse cursor hovers the thumb container (thumb image + caption + border)

Parameters:

Name Type Description
$thumbContainer jQuery
Source:

Preload JS/CSS when the mouse cursor hovers the thumb container (thumb image + caption + border)

processFilePageThumb($thumb, title) #

Processes the main thumbnail of a file page by adding some buttons below to open MediaViewer.

Parameters:

Name Type Description
$thumb jQuery
title mw.Title
Source:

Processes the main thumbnail of a file page by adding some buttons below to open MediaViewer.

processParsoidThumb(thumb) #

Processes a Parsoid thumb, making use of the specified structure, https://www.mediawiki.org/wiki/Specs/HTML#Media

Parameters:

Name Type Description
thumb Object
Source:

Processes a Parsoid thumb, making use of the specified structure, https://www.mediawiki.org/wiki/Specs/HTML#Media

processThumb(thumb) #

Processes a thumb

Parameters:

Name Type Description
thumb Object
Source:
Processes a thumb

processThumbs($content) #

Processes all thumbs found on the page

Parameters:

Name Type Description
$content jQuery

Element to search for thumbs

Source:
Processes all thumbs found on the page

route(fileName) #

Routes to a given file.

Parameters:

Name Type Description
fileName string
Source:
Routes to a given file.

setupEventHandlers() #

Listens to events on the window/document

Source:
Listens to events on the window/document

setupOverlay() #

Sets up the overlay while the viewer loads

Source:
Sets up the overlay while the viewer loads

setupRouter(router) #

Sets up the route handlers

Parameters:

Name Type Description
router OO.Router
Source:
Sets up the route handlers

showStatusInfo() #

Shows a popup notifying the user

Source:
Shows a popup notifying the user