Namespace: Util

OC.Util

Utility functions
Source:

Namespaces

History

Members

(static) hasSVGSupport

Returns whether the browser supports SVG
Source:

Methods

(static) formatDate(timestamp, format) → {string}

Parameters:
Name Type Description
timestamp
format
Source:
Returns:
timestamp formatted as requested
Type
string

(static) getScrollBarWidth() → {int}

Returns the width of a generic browser scrollbar
Source:
Returns:
width of scrollbar
Type
int

(static) isCookieSetToValue(name, value) → {boolean}

Checks if a cookie with the given name is present and is set to the provided value.
Parameters:
Name Type Description
name string name of the cookie
value string value of the cookie
Source:
Returns:
true if the cookie with the given name has the given value
Type
boolean

(static) isIE() → {bool}

Returns whether this is IE
Source:
Returns:
true if this is IE, false otherwise
Type
bool

(static) isIE8() → {bool}

Returns whether this is IE8
Source:
Returns:
true if this is IE8, false otherwise
Type
bool

(static) naturalSortCompare(a, b)

Compare two strings to provide a natural sort
Parameters:
Name Type Description
a first string to compare
b second string to compare
Source:
Returns:
-1 if b comes before a, 1 if a comes before b or 0 if the strings are identical

(static) relativeModifiedDate(timestamp) → {string}

Parameters:
Name Type Description
timestamp
Source:
Returns:
human readable difference from now
Type
string

(static) replaceSVG($el)

Replace SVG images in all elements that have the "svg" class set with PNG images.
Parameters:
Name Type Description
$el root element from which to search, defaults to $('body')
Source:

(static) replaceSVGIcon(file) → {string}

If SVG is not supported, replaces the given icon's extension from ".svg" to ".png". If SVG is supported, return the image path as is.
Parameters:
Name Type Description
file string image path with svg extension
Source:
Returns:
fixed image path with png extension if SVG is not supported
Type
string

(static) scaleFixForIE8($el)

Fix image scaling for IE8, since background-size is not supported. This scales the image to the element's actual size, the URL is taken from the "background-image" CSS attribute.
Parameters:
Name Type Description
$el Object image element
Source:

(static) stripTime(date) → {Date}

Remove the time component from a given date
Parameters:
Name Type Description
date Date date
Source:
Returns:
date with stripped time
Type
Date

(static) waitFor(callback, interval)

Calls the callback in a given interval until it returns true
Parameters:
Name Type Description
callback function
interval integer in milliseconds
Source: