Constructor
new MultimediaViewerBootstrap()
#
- Source:
Properties
eventHandlersHaveBeenSetUp :boolean
#
thumbs :Array.<LightboxImage>
#
viewerIsBroken :boolean
#
This flag is set to true when we were unable to load the viewer.
Type:
- boolean
- Source:
Methods
cleanupEventHandlers()
#
Cleans up event handlers, used for tests
- Source:
cleanupOverlay()
#
Cleans up the overlay
- Source:
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:
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:
findCaption($thumbContainer, $link) → {string|undefined}
#
undefined}
#
findGalleryCaption($thumbContainer) → {jQuery}
#
findInfoboxCaption($link) → {string|undefined}
#
undefined}
#
Finds the caption for an image that lives in an infobox (T429839).
The lookup is deliberately scoped to the image's own cell and never to the whole infobox: a caption belonging to a different image (a signature, a secondary photo) must never be shown. For the same reason we only return a caption when the cell holds exactly one image and one caption, so a shared cell (e.g. light/dark logo variants) can't attach one caption to several images. When in doubt, return nothing.
Parameters:
| Name | Type | Description |
|---|---|---|
$link |
jQuery | The link ( |
Returns:
Unsafe HTML may be present - caution
- Type
-
string
|
undefined
- Source:
findLegacyCaption($thumbContainer, $link) → {string|undefined}
#
undefined}
#
hash()
#
Handles the browser location hash on pageload or hash change
- Source:
isAllowedThumb($thumb) → {boolean}
#
Check if this thumbnail should be handled by MediaViewer
Parameters:
| Name | Type | Description |
|---|---|---|
$thumb |
jQuery | the thumbnail (an |
Returns:
- Type
- boolean
- Source:
isBetaMode() → {boolean}
#
Whether the beta UI should be used instead of the legacy viewer. Enabled by the server for mobile views when $wgMediaViewerMobileBeta is set (T428774), or by the ?mmvBeta=1 URL parameter on any skin.
Returns:
- Type
- boolean
- Source:
isValidExtension(title) → {boolean}
#
loadViewer() → {jQuery.Promise}
#
Loads the mmv module asynchronously and passes the thumb data to it
Returns:
- Type
- jQuery.Promise
- Source:
openImage(image)
#
Opens MediaViewer and loads the given thumbnail. Requires processThumb() to be called first.
Parameters:
| Name | Type | Description |
|---|---|---|
image |
LightboxImage | Image |
- Source:
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:
- Source:
Processes the main thumbnail of a file page by adding some buttons below to open MediaViewer.
processLegacyThumb(thumb)
#
processThumb(thumb)
#
Processes a thumb, making use of the specified structure, https://www.mediawiki.org/wiki/Specs/HTML#Media
Parameters:
| Name | Type | Description |
|---|---|---|
thumb |
Object |
- Source:
Processes a thumb, making use of the specified structure, https://www.mediawiki.org/wiki/Specs/HTML#Media
processThumbs($content)
#
Processes all thumbs found on the page
Parameters:
| Name | Type | Description |
|---|---|---|
$content |
jQuery | Element to search for thumbs |
- Source:
route(fileName)
#
Routes to a given file.
Parameters:
| Name | Type | Description |
|---|---|---|
fileName |
string |
- Source:
setupEventHandlers()
#
Listens to events on the window/document
- Source:
setupOverlay()
#
Sets up the overlay while the viewer loads
- Source: