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:
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:
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:
hideTruncatedText()
#
Undoes changes made by revealTruncatedText().
- Source:
initializeCredit()
#
Initializes the credit elements.
- Source:
initializeDatetime()
#
Initializes the upload date/time element.
- Source:
initializeFilename()
#
Initializes the filename element.
- Source:
initializeHeader()
#
Initializes the header, which contains the title, credit, and license elements.
- Source:
initializeImageLinks()
#
Initializes the list of image metadata on the right side of the panel.
- Source:
initializeImageMetadata()
#
Initializes the main body of metadata elements.
- Source:
initializeLicense()
#
Initializes the license elements.
- Source:
initializeLocation()
#
Initializes the geolocation element.
- Source:
initializeTitle()
#
Initializes the title elements.
- Source:
isFullscreened() → {boolean}
#
FIXME this should be in the jquery.fullscreen plugin.
Returns:
- Type
- boolean
- Source:
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:
revealTruncatedText()
#
Shows truncated text in the title and credit (this also rearranges the layout a bit).
- Source:
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:
setFileName(filename)
#
Sets the file name in the panel.
Parameters:
| Name | Type | Description |
|---|---|---|
filename |
string | The file name to set, without prefix |
- Source:
setImageInfo(image, imageData)
#
Set all the image information in the panel
Parameters:
| Name | Type | Description |
|---|---|---|
image |
LightboxImage | |
imageData |
ImageModel |
- Source:
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:
setLocationData(imageData)
#
setPermission(permission)
#
Set an extra permission text which should be displayed.
Parameters:
| Name | Type | Description |
|---|---|---|
permission |
string |
- Source:
setRestrictions(restrictions)
#
Sets any special restrictions that should be displayed.
Parameters:
| Name | Type | Description |
|---|---|---|
restrictions |
Array.<string> | Array of restrictions |
- Source:
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:
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:
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:
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:
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: