Constructor
new MultimediaViewer()
#
- Source:
Properties
currentIndex
#
documentTitle
#
Properties:
| Name | Type | Description |
|---|---|---|
documentTitle |
string | base document title, MediaViewer will expand this |
- Source:
metadataPreloadQueue
#
Stores image metadata preloads, so they can be cancelled.
Properties:
| Type | Description |
|---|---|
| TaskQueue |
- Source:
preloadDistance
#
Preload this many prev/next images to speed up navigation. (E.g. preloadDistance = 3 means that the previous 3 and the next 3 images will be loaded.) Preloading only happens when the viewer is open.
Properties:
| Type | Description |
|---|---|
| number |
- Source:
realThumbnailShown
#
Stores whether the real image was loaded and displayed already. This is reset when paging, so it is not necessarily accurate.
Properties:
| Type | Description |
|---|---|
| boolean |
- Source:
router
#
thumbnailPreloadQueue
#
Stores image thumbnail preloads, so they can be cancelled.
Properties:
| Type | Description |
|---|---|
| TaskQueue |
- Source:
viewLogger
#
Methods
cancelImageMetadataPreloading()
#
Cancels in-progress image metadata preloading.
- Source:
cancelThumbnailsPreloading()
#
Cancels in-progress image thumbnail preloading.
- Source:
cleanupEventHandlers()
#
Unregisters all event handlers. Currently only used in tests.
- Source:
close()
#
Handles close event coming from the lightbox
- Source:
createDocumentTitle(imageTitle) → {string}
#
Creates a string which can be shown as document title (the text at the top of the browser window).
Parameters:
| Name | Type | Description |
|---|---|---|
imageTitle |
mw.Title
|
null
|
the title object for the image which is displayed; null when the viewer is being closed |
Returns:
- Type
- string
- Source:
displayPlaceholderThumbnail(image, $initialImage, imageWidths, [recursion])
#
Display the thumbnail from the page
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
image |
LightboxImage | |||
$initialImage |
jQuery | The thumbnail from the page |
||
imageWidths |
ThumbnailWidth | |||
recursion |
boolean |
optional |
false | for internal use, never set this when calling from outside |
- Source:
displayRealThumbnail(thumbnail, imageElement, imageWidths)
#
Display the real, full-resolution, thumbnail that was fetched with fetchThumbnail
Parameters:
| Name | Type | Description |
|---|---|---|
thumbnail |
Thumbnail | |
imageElement |
HTMLImageElement | |
imageWidths |
ThumbnailWidth |
- Source:
fetchSizeIndependentLightboxInfo(fileTitle) → {jQuery.Promise.<ImageModel>}
#
Loads all the size-independent information needed by the lightbox (image metadata, repo information).
Parameters:
| Name | Type | Description |
|---|---|---|
fileTitle |
mw.Title | Title of the file page for the image. |
Returns:
- Type
- jQuery.Promise.<ImageModel>
- Source:
Loads all the size-independent information needed by the lightbox (image metadata, repo information).
fetchThumbnail(fileTitle, width, [sampleUrl], [originalWidth], [originalHeight], [useThumbnailGuessing0]) → {jQuery.Promise.<Thumbnail, HTMLImageElement>}
#
Loads size-dependent components of a lightbox - the thumbnail model and the image itself.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
fileTitle |
mw.Title | ||
width |
number | the width of the requested thumbnail |
|
sampleUrl |
string |
optional |
a thumbnail URL for the same file (but with different size) (might be missing) |
originalWidth |
number |
optional |
the width of the original, full-sized file (might be missing) |
originalHeight |
number |
optional |
the height of the original, full-sized file (might be missing) |
useThumbnailGuessing0 |
boolean |
optional |
the useThumbnailGuessing flag |
Returns:
A promise resolving to
a thumbnail model and an element. It might or might not have progress events which
return a single number.
- Type
- jQuery.Promise.<Thumbnail, HTMLImageElement>
- Source:
fetchThumbnailForLightboxImage(image, width) → {jQuery.Promise.<Thumbnail, HTMLImageElement>}
#
Loads size-dependent components of a lightbox - the thumbnail model and the image itself.
Parameters:
| Name | Type | Description |
|---|---|---|
image |
LightboxImage | |
width |
number | the width of the requested thumbnail |
Returns:
- Type
- jQuery.Promise.<Thumbnail, HTMLImageElement>
- Source:
firstImage()
#
Opens the last image
- Source:
initWithThumbs(thumbs)
#
Initialize the lightbox interface given an array of thumbnail objects.
Parameters:
| Name | Type | Description |
|---|---|---|
thumbs |
Array.<LightboxImage> |
- Source:
Initialize the lightbox interface given an array of thumbnail objects.
lastImage()
#
Opens the last image
- Source:
loadExtensionPlugins(extension) → {jQuery.Promise}
#
Loads the RL module defined for a given file extension, if any
Parameters:
| Name | Type | Description |
|---|---|---|
extension |
string | File extension |
Returns:
- Type
- jQuery.Promise
- Source:
loadImage(image)
#
loadImageByTitle(title, [position])
#
Loads an image by its title
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
title |
mw.Title | ||
position |
number |
optional |
- Source:
loadIndex(index)
#
Loads an image at a specified index in the viewer's thumbnail array.
Parameters:
| Name | Type | Description |
|---|---|---|
index |
number |
- Source:
nextImage()
#
Opens the next image
- Source:
preloadImagesMetadata()
#
Preload metadata for next and prev N image (N = MMVP.preloadDistance). Two images will be loaded at a time (one forward, one backward), with closer images being loaded sooner.
- Source:
preloadThumbnails()
#
Preload thumbnails for next and prev N image (N = MMVP.preloadDistance). Two images will be loaded at a time (one forward, one backward), with closer images being loaded sooner.
- Source:
prevImage()
#
Opens the previous image
- Source:
resetThumbnailStates()
#
Resets the cross-request states needed to handle the thumbnail logic.
- Source:
resize()
#
Handles resize events in viewer.
- Source:
setImage(thumbnail, imageElement, imageWidths)
#
Loads and sets the specified image. It also updates the controls.
Parameters:
| Name | Type | Description |
|---|---|---|
thumbnail |
Thumbnail | thumbnail information |
imageElement |
HTMLImageElement | |
imageWidths |
ThumbnailWidth |
- Source:
setTitle()
#
Updates the page title to reflect the current title.
- Source:
setupEventHandlers()
#
Registers all event handlers
- Source:
setupProgressBar(image, imagePromise, imageWidth)
#
Displays a progress bar for the image loading, if necessary, and sets up handling of all the related callbacks.
Parameters:
| Name | Type | Description |
|---|---|---|
image |
LightboxImage | |
imagePromise |
jQuery.Promise.<Thumbnail, HTMLImageElement> | |
imageWidth |
number | needed for caching progress (FIXME) |
- Source:
Displays a progress bar for the image loading, if necessary, and sets up handling of all the related callbacks.
Events
mmv-close()
#
Fired when the viewer is closed. This is used by the lightbox to notify the main app.
- Source:
mmv-next()
#
Fired when the user requests the next image.
- Source:
mmv-prev()
#
Fired when the user requests the previous image.
- Source:
mmv-request-thumbnail(size)
#
Used by components to request a thumbnail URL for the current thumbnail, with a given size.
Parameters:
| Name | Type | Description |
|---|---|---|
size |
number |
- Source:
mmv-resize-end()
#
Fired when the screen size changes. Debounced to avoid continuous triggering while resizing with a mouse.
- Source:
mmv-resize-end()
#
Fired when the screen size changes. Debounced to avoid continuous triggering while resizing with a mouse.
- Source: