Expand all

Utils

A helper class for reuse logic.

Constructor

new Utils() #

Methods

createHeader(text) → {jQuery}static #

Creates header from given options.

Parameters:

Name Type Description
text string

Returns:

Type
jQuery
Source:
Creates header from given options.

createInputWithCopy(title, placeholder) → {Array.<jQuery>}static #

Creates input element with copy button from given options.

Parameters:

Name Type Description
title string
placeholder string

Returns:

[$input, $div]

Type
Array.<jQuery>
Source:
Creates input element with copy button from given options.

createSelectMenu(options, def) → {jQuery}static #

Creates select menu from given options.

Parameters:

Name Type Description
options Array.<string>
def string

Returns:

Type
jQuery
Source:
Creates select menu from given options.

getDimensionsMessageHtml(sizeLabel, width, height) → {string}static #

Generates an i18n message for a label, given a size label and image dimensions

Parameters:

Name Type Description
sizeLabel string
width number
height number

Returns:

i18n label html

Type
string
Source:
Generates an i18n message for a label, given a size label and image dimensions

getPossibleImageSizesForHtml(width, height) → {Utils.ImageSizes}static #

Calculates possible image sizes for html snippets. It returns up to three possible snippet frame sizes (small, medium, large) plus the original image size.

Parameters:

Name Type Description
width number
height number

Returns:

Type
Utils.ImageSizes
Source:
Calculates possible image sizes for html snippets.

getThumbnailUrlPromise(width) → {jQuery.Promise.<string>}static #

Gets a promise for the large thumbnail URL. This is needed because thumbnail URLs cannot be reliably guessed, even if we know the full size of the image - most of the time replacing the size in another thumbnail URL works (as long as the new size is not larger than the full size), but if the file name is very long and with the larger size the URL length would exceed a certain threshold, a different schema is used instead.

Parameters:

Name Type Description
width number

Returns:

Type
jQuery.Promise.<string>

Fires:

Source:
Gets a promise for the large thumbnail URL.

Type Definitions

Dimensions #

Type:

Properties:

Name Type Description
width number
height number
Source:

ImageSizes #

Type:

Properties:

Name Type Attributes Description
small Utils.Dimensions
medium Utils.Dimensions
large Utils.Dimensions
xl Utils.Dimensions optional

Only present in HTML

original Utils.Dimensions optional

Only present in HTML

Source: