Expand all

MetadataPanel

Represents the metadata panel in the viewer

Constructor

new MetadataPanel($container, $aboveFold) #

Parameters:

Name Type Description
$container jQuery

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

$aboveFold jQuery

The brighter headline of the metadata panel (.mw-mmv-above-fold). Called "aboveFold" for historical reasons, but actually a part of the next sibling of the element is also above the fold (bottom of the screen).

Source:

Properties

MAX_RESTRICTstatic #

Maximum number of restriction icons before default icon is used

Properties:

Name Type Description
MAX_RESTRICT number
Source:
Maximum number of restriction icons before default icon is used

Methods

createRestriction(type) → {jQuery} #

Helper function that generates restriction labels

Parameters:

Name Type Description
type string

Restriction type

Returns:

jQuery object of label

Type
jQuery
Source:
Helper function that generates restriction labels

formatDate(dateString) → {string} #

Transforms a date string into localized, human-readable format. Unrecognized strings are returned unchanged.

Parameters:

Name Type Description
dateString string

Returns:

formatted date

Type
string
Source:
Transforms a date string into localized, human-readable format.

hideTruncatedText() #

Undoes changes made by revealTruncatedText().

Source:
Undoes changes made by revealTruncatedText().

initializeCredit() #

Initializes the credit elements.

Source:
Initializes the credit elements.

initializeDatetime() #

Initializes the upload date/time element.

Source:
Initializes the upload date/time element.

initializeFilename() #

Initializes the filename element.

Source:
Initializes the filename element.

initializeHeader() #

Initializes the header, which contains the title, credit, and license elements.

Source:
Initializes the header, which contains the title, credit, and license elements.
Initializes the list of image metadata on the right side of the panel.

initializeImageMetadata() #

Initializes the main body of metadata elements.

Source:
Initializes the main body of metadata elements.

initializeLicense() #

Initializes the license elements.

Source:
Initializes the license elements.

initializeLocation() #

Initializes the geolocation element.

Source:
Initializes the geolocation element.

initializeTitle() #

Initializes the title elements.

Source:
Initializes the title elements.

isFullscreened() → {boolean} #

FIXME this should be in the jquery.fullscreen plugin.

Returns:

Type
boolean
Source:
FIXME this should be in the jquery.fullscreen plugin.

resetTruncatedText() #

Hide or reveal truncated text based on whether the panel is open. This is normally handled by MetadataPanelScroller, but when the panel is reset (e.g. on a prev/next event) sometimes the panel position can change without a panel , such as on a prev/next event; in such cases this function has to be called.

Source:
Hide or reveal truncated text based on whether the panel is open.

revealTruncatedText() #

Shows truncated text in the title and credit (this also rearranges the layout a bit).

Source:
Shows truncated text in the title and credit (this also rearranges the layout a bit).

setCredit(attribution, source, author, authorCount, filepageUrl) #

Set source and author.

Parameters:

Name Type Description
attribution string

Custom attribution string

source string

With unsafe HTML

author string

With unsafe HTML

authorCount number
filepageUrl string

URL of the file page (used when other data is not available)

Source:
Set source and author.

setFileName(filename) #

Sets the file name in the panel.

Parameters:

Name Type Description
filename string

The file name to set, without prefix

Source:
Sets the file name in the panel.

setImageInfo(image, imageData) #

Set all the image information in the panel

Parameters:

Name Type Description
image LightboxImage
imageData ImageModel
Source:
Set all the image information in the panel

setLicense(license, filePageUrl) #

Sets the license display in the panel

Parameters:

Name Type Description
license License | null

license data (could be missing)

filePageUrl string

URL of the file description page

Source:
Sets the license display in the panel

setLocationData(imageData) #

Sets location data in the interface.

Parameters:

Name Type Description
imageData ImageModel
Source:
Sets location data in the interface.

setPermission(permission) #

Set an extra permission text which should be displayed.

Parameters:

Name Type Description
permission string
Source:
Set an extra permission text which should be displayed.

setRestrictions(restrictions) #

Sets any special restrictions that should be displayed.

Parameters:

Name Type Description
restrictions Array.<string>

Array of restrictions

Source:
Sets any special restrictions that should be displayed.

setTitle(image, imageData) #

Sets the image title at the top of the metadata panel. The title will be the first one available form the options below:

  • the image caption
  • the description from the filepage
  • the filename (without extension)

Parameters:

Name Type Description
image LightboxImage
imageData ImageModel
Source:
Sets the image title at the top of the metadata panel.

showError(title, error) #

Show an error message, in case the data could not be loaded

Parameters:

Name Type Description
title string

image title

error string

error message

Source:
Show an error message, in case the data could not be loaded

wrapAttribution(attribution) → {string} #

Wraps an attribution string with MediaViewer styles

Parameters:

Name Type Description
attribution string

Warning - unsafe HTML sometimes goes here

Returns:

unsafe HTML

Type
string
Source:
Wraps an attribution string with MediaViewer styles

wrapAuthor(author, authorCount, filepageUrl) → {string} #

Wraps an author string with MediaViewer styles

Parameters:

Name Type Description
author string

Warning - unsafe HTML sometimes goes here

authorCount number
filepageUrl string

URL of the file page (used when some author data is not available)

Returns:

unsafe HTML

Type
string
Source:
Wraps an author string with MediaViewer styles

wrapSource(source) → {string} #

Wraps a source string it with MediaViewer styles

Parameters:

Name Type Description
source string

Warning - unsafe HTML sometimes goes here

Returns:

unsafe HTML

Type
string
Source:
Wraps a source string it with MediaViewer styles