| Package: | CQ |
| Class: | Util |
| Extends: | Object |
| Clientlib: | cq.widgets |
| Property | Defined By | |
|---|---|---|
|
COMMENT_I18N_SUFFIX : String
<static> The parameter name suffix for translation comments for properties.
|
Util | |
|
FORMAT_ONLY : Number
<static> The mode for formatData to only format the data.
|
Util | |
|
I18N_ONLY : Number
<static> The mode for formatData to only translate the data.
|
Util | |
|
NO_I18N_SUFFIX : String
<static> The parameter name suffix for properties that should not be translated.
|
Util | |
|
ROOT_ID : String
<static> The ID of the root element harboring all
CQ-related elements.
|
Util | |
| Method | Defined By | |
|---|---|---|
addListenerToConfig( Object obj, String event, Function handler ) : void <static> Add an event listener to an obj.listeners config. This is the same as
obj.listeners[event] = handler, ...
<static> Add an event listener to an obj.listeners config. This is the same as
Added in CQ 5.6.
obj.listeners[event] = handler, but will also handle
the case if there is already a listener defined for that event.
The provided handler will be called when the event is triggered
after the function that is already defined in the config object.
This method can be used on the raw config object as read from JSON, it will automatically convert string-based functions using CQ.Util.formatData.
Parameters:
|
Util | |
applyDefaults( Object base, Object defaults ) : Object <static> Applies default properties if inexistent in the base object.
Child objects are merged recursively.
Exa...
<static> Applies default properties if inexistent in the base object.
Child objects are merged recursively.
Example: Result:
Parameters:
|
Util | |
build( Object/String data, [Boolean noFormatting], [Function callback], [Object extensions] ) : CQ.Ext.Component <static> Builds a component using the specified data object or URL.
<static> Builds a component using the specified data object or URL.
Parameters:
|
Util | |
cancelObservation( CQ.Ext.Component component, [String interval] ) : void <static> Removes a component from the list of observed components.
The interval can be one of:
VERY_SHORT_INTE...
<static> Removes a component from the list of observed components.
The interval can be one of:
Parameters:
|
Util | |
clearDocumentSelection( [Window win] ) : void Deprecated: Use CQ.DOM.clearDocumentSelection instead
<static> Clears the text selection in the document. If no window is specified,
the current window will be used.
<static> Clears the text selection in the document. If no window is specified,
the current window will be used.
Parameters:
|
Util | |
compareValues( Object v1, Object v2 ) : Number <static> Compares two values.
<static> Compares two values.
Parameters:
|
Util | |
copyObject( Object object ) : Object <static> Returns a copy of the specified object.
<static> Returns a copy of the specified object.
Parameters:
|
Util | |
createId( [String id] ) : String <static> Creates a unique ID by adding a counter to the specified ID.
<static> Creates a unique ID by adding a counter to the specified ID.
Parameters:
|
Util | |
escapePath( String path ) : String Deprecated: Use CQ.shared.HTTP.encodePath instead
<static> Escapes a path for use as a URL using the standard
encodeUriComponent function, but leaving the path
d...
<static> Escapes a path for use as a URL using the standard
encodeUriComponent function, but leaving the path
delimiters (/) as-is.
Parameters:
|
Util | |
eval( Object response ) : Object Deprecated: Use CQ.shared.HTTP.eval instead
<static> Evaluates and returns the response text of the specified response
object.
<static> Evaluates and returns the response text of the specified response
object.
Parameters:
|
Util | |
evalHTML( String html ) : Object <static> Evaluates and returns the specified HTML code.
<static> Evaluates and returns the specified HTML code.
Parameters:
|
Util | |
evalNode( Node node, [Object obj] ) : Object <static> Evaluates and returns the specified HTML node.
<static> Evaluates and returns the specified HTML node.
Parameters:
|
Util | |
externalize( String url ) : String Deprecated: Use CQ.shared.HTTP.externalize instead
<static> Makes sure the specified relative URL starts with the context path
used on the server. If an absolute ...
<static> Makes sure the specified relative URL starts with the context path
used on the server. If an absolute URL is passed, it will be returned
as-is.
Parameters:
|
Util | |
formatData( Object data, [Number mode] ) : Object <static> Formats and/or translates the given data object for
building components. See also build.
Formatting tr...
<static> Formats and/or translates the given data object for
building components. See also build.
Formatting transforms jcr:primaryType into xtype, collections into arrays, and strings of numbers or booleans (e.g. "12", "true") will be converted into their respective types. Translation looks up values of well-known text properties (e.g. title, text, fieldLabel) in the current user's language.
Parameters:
|
Util | |
formatFileSize( Number size ) : String Returns a human readable filesize including the unit, e.g "12 MB".
Returns a human readable filesize including the unit, e.g "12 MB".
Parameters:
|
Util | |
getAbsoluteParent( String path, Number level ) : String Returns the absolute parent of the given path, at the position of the given level.
Returns the absolute parent of the given path, at the position of the given level.
Parameters:
|
Util | |
|
getContextPath() : String Deprecated: Use CQ.shared.HTTP.getContextPath instead
<static> Returns the context path used on the server.
<static> Returns the context path used on the server.
Parameters:
|
Util | |
|
getFlashVersion() : void Deprecated: Use CQ.endorsed.swfobject.getFlashPlayerVersion() instead.
<static>
<static>
Parameters:
|
Util | |
getPath( String url ) : String Deprecated: Use CQ.shared.HTTP.getPath instead
<static> Removes all parts but the path from the specified URL.
Examples:/x/y.sel.html?param=abc => /x/y
htt...
<static> Removes all parts but the path from the specified URL.
Examples:
Parameters:
|
Util | |
|
getRoot() : CQ.Ext.Element <static> Returns the root element harboring all CQ-related elements.
<static> Returns the root element harboring all CQ-related elements.
Parameters:
|
Util | |
internalize( String url, [String doc] ) : String Deprecated: Use CQ.shared.HTTP.internalize instead
<static> Removes scheme, authority and context path from the specified
absolute URL if it has the same scheme a...
<static> Removes scheme, authority and context path from the specified
absolute URL if it has the same scheme and authority as the
specified document (or the current one).
Parameters:
|
Util | |
isAcceptedMimeType( String[] acceptPatternArray, String mimeType ) : Boolean <static> Checks if the specified mime type is accepted.
<static> Checks if the specified mime type is accepted.
Parameters:
|
Util | |
isEmptyObject( Object obj ) : Boolean <static> Returns true if the specified object is empty. Note that
an undefined object will not be treated as em...
<static> Returns true if the specified object is empty. Note that
an undefined object will not be treated as empty.
Parameters:
|
Util | |
isIntersecting( Object firstObj, Object secondObj, [Object exclude] ) : Boolean <static> Returns true if at least one property of the first object is
also a property of the second object.
<static> Returns true if at least one property of the first object is
also a property of the second object.
Parameters:
|
Util | |
isLiteral( String str ) : Boolean Indicates whether or not the string represents a literal.
Indicates whether or not the string represents a literal.
Parameters:
|
Util | |
|
logout() : void Deprecated: Use CQ.User.logout() instead
<static> Logs the current user out.
<static> Logs the current user out.
Parameters:
|
Util | |
merge( Object base, Object upgrade ) : Object <static> Merges one object into the other. Child objects are
merged recursively.
Example:var base = { a: "a", b...
<static> Merges one object into the other. Child objects are
merged recursively.
Example: Result:
Parameters:
|
Util | |
observeComponent( CQ.Ext.Component component, [String interval] ) : void <static> Adds a component to the list of observed components. These
components are observed regulary by calling...
<static> Adds a component to the list of observed components. These
components are observed regulary by calling their observe method.
See also runComponentObservation and
cancelObservation.
Note that the observe method can be called quite often, which potentially has an impact on performance. Make sure any action performed in the observe method is really required. The interval can be one of:
Parameters:
|
Util | |
patchText( String text, String/String[] snippets ) : String <static> Replaces occurrences of {n} in the specified text with
the texts from the snippets.
Example 1 (single ...
<static> Replaces occurrences of
{n} in the specified text with
the texts from the snippets.
Example 1 (single snippet): Result 1:
Example 2 (multiple snippets): Result 2:
Parameters:
|
Util | |
pin( CQ.Ext.Component/CQ.Ext.Element item ) : void <static> Keeps the specified component or element at its current position
on the screen, repositioning it when ...
<static> Keeps the specified component or element at its current position
on the screen, repositioning it when the document gets scrolled
to achieve the impression that it is actually pinned to the screen.
See also unpin.
Parameters:
|
Util | |
quote( String str ) : String Wraps a string in double-quotes.
Wraps a string in double-quotes.
Parameters:
|
Util | |
reload( [Window win], [String url] ) : void <static> Reloads the window or replaces its location with the specified URL.
If no window is specified, the cur...
<static> Reloads the window or replaces its location with the specified URL.
If no window is specified, the current window will be used.
Parameters:
|
Util | |
renderDate( String date ) : String <static> Returns a nicely formatted date. This function can be used
directly as a renderer for widgets.
<static> Returns a nicely formatted date. This function can be used
directly as a renderer for widgets.
Parameters:
|
Util | |
runComponentObservation( [String interval] ) : void <static> Steps through all observed components and calls their
observe method.
The interval can be one of:
VER...
<static> Steps through all observed components and calls their
observe method.
The interval can be one of:
Parameters:
|
Util | |
sortByRanking( Object[] array ) : Object[] <static> Sorts the specified array of objects by their ranking properties.
<static> Sorts the specified array of objects by their ranking properties.
Parameters:
|
Util | |
toggleComponent( CQ.Ext.Component component, boolean enableCondition ) : void <static> Enables or disable a componnent
<static> Enables or disable a componnent
Parameters:
|
Util | |
trim( String str ) : String Safely removes whitespace from a string (safe for null and undefined string parameters).
Safely removes whitespace from a string (safe for null and undefined string parameters).
Parameters:
|
Util | |
unpin( CQ.Ext.Component/CQ.Ext.Element item ) : void <static> Removes the pin from the specified component or element, letting
it scroll with the document again.
<static> Removes the pin from the specified component or element, letting
it scroll with the document again.
Parameters:
|
Util | |
unquote( String str ) : String Removes enclosing single- or double-quotes from a string.
Removes enclosing single- or double-quotes from a string.
Parameters:
|
Util | |
unwrapParens( String str ) : String Removes an enclosing pair of parentheses (and any adjoining whitespace) from a string.
Removes an enclosing pair of parentheses (and any adjoining whitespace) from a string.
Parameters:
|
Util | |