Module: util

Members

(static) addUrlParam :module:util/addUrlParam

Type:

(static, constant) ready

Replacement for $(document).ready(). Some WordPress environments do not support completely the above function when in conflict with another plugin.
See:

Methods

(static) ajax(url, settingsopt, urlopt)

Execute a jQuery request with X-WP-Nonce header.
Parameters:
Name Type Attributes Default Description
url string The url appended to ".../wp-json/realmedialibrary/v1/"
settings object <optional>
The options for jQuery.ajax
url string <optional>
'realmedialibrary/v1' The API namespace
Deprecated:
  • Will be removed in v5
Returns:
Result of jQuery.ajax

(static) applyNodeDefaults(folders)

Handle tree node defaults for loaded folder items and new items.
Parameters:
Name Type Description
folders Array.<object> The folders
Returns:
object[]

(static) basename(path)

Parameters:
Name Type Description
path string
See:

(static) dataUriToBlob(sUri) → {Blob}

Export Data URI to blob instance.
Parameters:
Name Type Description
sUri string
Returns:
Type
Blob

(static) dirname(path)

Parameters:
Name Type Description
path string
See:

(static) fetchTree(settingsopt) → {object}

Execute the REST query to fetch the category tree.
Parameters:
Name Type Attributes Description
settings object <optional>
Additional options for jQuery.ajax
Returns:
The original AJAX result and the tree result prepared for AIO
Type
object

(static) findDeep(obj, path) → {mixed|undefined}

Allows you to find an object path.
Parameters:
Name Type Description
obj object The object
path string The path
Returns:
Type
mixed | undefined

(static) getMediaDialogNextZIndex()

Get the next media modal z-index.
Returns:
int

(static) humanFileSize(bytes) → {string}

Transform bytes to humand readable string.
Parameters:
Name Type Description
bytes int The bytes
See:
Returns:
Type
string

(static) i18n(key, paramsopt, spanWrapperPropsopt) → {React.Element}

Creates a React component (span) with the translated markdown.
Parameters:
Name Type Attributes Description
key string The key in rmlOpts.lang
params object <optional>
The parameters
spanWrapperProps object | string('maxWidth') <optional>
Wraps an additinal span wrapper with custom attributes
See:
Returns:
Or null if key not found
Type
React.Element

(static) inViewPort(el) → {boolean}

Detects if an element is in view port.
Parameters:
Name Type Description
el jQuery | HTMLElement
Returns:
Type
boolean

(static) isHiddenFile(filename)

Check if a given filename is a hidden filename.
Parameters:
Name Type Description
filename string

(static) isMaterialWp() → {boolean}

Check if Material WP is activated.
Returns:
Type
boolean

(static) materialWpResizeOpposite() → {boolean}

Resize handler for opposite when Material WP is active.
Returns:
Type
boolean

(static) resolveIcon(icon)

Resolve the icon for a given string or object.
Parameters:
Name Type Description
icon string

(static) secondsFormat(totalSec) → {string}

Transform seconds to readable HH:mm:ss.
Parameters:
Name Type Description
totalSec int The seconds
Returns:
Type
string

(static) urlParam(name, urlopt) → {string|null}

Get URL parameter of current url.
Parameters:
Name Type Attributes Default Description
name string The parameter name
url string <optional>
window.location.href
Returns:
Type
string | null