Candy | Chats are not dead yet. |
© 2011 Amiado Group AG. All rights reserved. © 2012-2014 Patrick Stadler & Michael Weibel. All rights reserved.
util.js | |
Candy.Util | Candy utils |
Functions | |
jidToId | Translates a jid to a MD5-Id |
escapeJid | Escapes a jid (node & resource get escaped) |
unescapeJid | Unescapes a jid (node & resource get unescaped) |
crop | Crop a string with the specified length |
parseAndCropXhtml | Parses the XHTML and applies various Candy related filters to it. |
setCookie | Sets a new cookie |
cookieExists | Tests if a cookie with the given name exists |
getCookie | Returns the cookie value if there’s one with this name, otherwise returns undefined |
deleteCookie | Deletes a cookie with the given name |
getPosLeftAccordingToWindowBounds | Fetches the window width and element width and checks if specified position + element width is bigger than the window width. |
getPosTopAccordingToWindowBounds | Fetches the window height and element height and checks if specified position + element height is bigger than the window height. |
localizedTime | Localizes ISO-8610 Date with the time/dateformat specified in the translation. |
iso8610toDate | Parses a ISO-8610 Date to a Date-Object. |
isEmptyObject | IE7 doesn’t work with jQuery.isEmptyObject (<=1.5.1), workaround. |
forceRedraw | Fix IE7 not redrawing under some circumstances. |
getIeVersion | Returns local variable `ie` which you can use to detect which IE version is available. |
Candy. | Parser for emoticons, links and also supports escaping. |
Functions | |
setEmoticonPath | Set emoticons location. |
Variables | |
emoticons | Array containing emoticons to be replaced by their images. |
Functions | |
emotify | Replaces text-emoticons with their image equivalent. |
linkify | Replaces URLs with a HTML-link. |
escape | Escapes a text using a jQuery function (like htmlspecialchars in PHP) |
nl2br | replaces newline characters with a <br/> to make multi line messages look nice |
all | Does everything of the parser: escaping, linkifying and emotifying. |
createHtml | Copy an HTML DOM element into an XML DOM. |
Candy utils
(Candy.Util) self | itself |
(jQuery) $ | jQuery |
Functions | |
jidToId | Translates a jid to a MD5-Id |
escapeJid | Escapes a jid (node & resource get escaped) |
unescapeJid | Unescapes a jid (node & resource get unescaped) |
crop | Crop a string with the specified length |
parseAndCropXhtml | Parses the XHTML and applies various Candy related filters to it. |
setCookie | Sets a new cookie |
cookieExists | Tests if a cookie with the given name exists |
getCookie | Returns the cookie value if there’s one with this name, otherwise returns undefined |
deleteCookie | Deletes a cookie with the given name |
getPosLeftAccordingToWindowBounds | Fetches the window width and element width and checks if specified position + element width is bigger than the window width. |
getPosTopAccordingToWindowBounds | Fetches the window height and element height and checks if specified position + element height is bigger than the window height. |
localizedTime | Localizes ISO-8610 Date with the time/dateformat specified in the translation. |
iso8610toDate | Parses a ISO-8610 Date to a Date-Object. |
isEmptyObject | IE7 doesn’t work with jQuery.isEmptyObject (<=1.5.1), workaround. |
forceRedraw | Fix IE7 not redrawing under some circumstances. |
getIeVersion | Returns local variable `ie` which you can use to detect which IE version is available. |
self.getPosLeftAccordingToWindowBounds = function( elem, pos )
Fetches the window width and element width and checks if specified position + element width is bigger than the window width.
If this evaluates to true, the position gets substracted by the element width.
(jQuery.Element) elem | Element to position |
(Integer) pos | Position left |
Object containing `px` (calculated position in pixel) and `alignment` (alignment of the element in relation to pos, either ‘left’ or ‘right’)
self.getPosTopAccordingToWindowBounds = function( elem, pos )
Fetches the window height and element height and checks if specified position + element height is bigger than the window height.
If this evaluates to true, the position gets substracted by the element height.
(jQuery.Element) elem | Element to position |
(Integer) pos | Position top |
Object containing `px` (calculated position in pixel) and `alignment` (alignment of the element in relation to pos, either ‘top’ or ‘bottom’)
self.localizedTime = function( dateTime )
Localizes ISO-8610 Date with the time/dateformat specified in the translation.
See: libs/dateformat/dateFormat.js See: src/view/translation.js See: jquery-i18n/jquery.i18n.js
(String) dateTime | ISO-8610 Datetime |
If current date is equal to the date supplied, format with timeFormat, otherwise with dateFormat
Parses a ISO-8610 Date to a Date-Object.
Uses a fallback if the client’s browser doesn’t support it.
ECMAScript revision 5 adds native support for ISO-8601 dates in the Date.parse method, but many browsers currently on the market (Safari 4, Chrome 4, IE 6-8) do not support it.
(String) date | ISO-8610 Date |
Date-Object
Parser for emoticons, links and also supports escaping.
Functions | |
setEmoticonPath | Set emoticons location. |
Variables | |
emoticons | Array containing emoticons to be replaced by their images. |
Functions | |
emotify | Replaces text-emoticons with their image equivalent. |
linkify | Replaces URLs with a HTML-link. |
escape | Escapes a text using a jQuery function (like htmlspecialchars in PHP) |
nl2br | replaces newline characters with a <br/> to make multi line messages look nice |
all | Does everything of the parser: escaping, linkifying and emotifying. |
createHtml | Copy an HTML DOM element into an XML DOM. |
self.createHtml = function( elem, maxLength, currentLength )
Copy an HTML DOM element into an XML DOM.
This function copies a DOM element and all its descendants and returns the new copy.
It’s a function copied & adapted from [Strophe.js core.js](https://github.com
(HTMLElement) elem | A DOM element. |
(Integer) maxLength | Max length of text |
(Integer) currentLength | Current accumulated text length |
A new, copied DOM element tree.
Translates a jid to a MD5-Id
self.jidToId = function( jid )
Escapes a jid (node & resource get escaped)
self.escapeJid = function( jid )
Unescapes a jid (node & resource get unescaped)
self.unescapeJid = function( jid )
Crop a string with the specified length
self.crop = function( str, len )
Parses the XHTML and applies various Candy related filters to it.
self.parseAndCropXhtml = function( str, len )
Sets a new cookie
self.setCookie = function( name, value, lifetime_days )
Tests if a cookie with the given name exists
self.cookieExists = function( name )
Returns the cookie value if there’s one with this name, otherwise returns undefined
self.getCookie = function( name )
Deletes a cookie with the given name
self.deleteCookie = function( name )
Fetches the window width and element width and checks if specified position + element width is bigger than the window width.
self.getPosLeftAccordingToWindowBounds = function( elem, pos )
Fetches the window height and element height and checks if specified position + element height is bigger than the window height.
self.getPosTopAccordingToWindowBounds = function( elem, pos )
Localizes ISO-8610 Date with the time/dateformat specified in the translation.
self.localizedTime = function( dateTime )
IE7 doesn’t work with jQuery.isEmptyObject (<=1.5.1), workaround.
self.isEmptyObject = function( obj )
Fix IE7 not redrawing under some circumstances.
self.forceRedraw = function( elem )
Returns local variable `ie` which you can use to detect which IE version is available.
self.getIeVersion = function()
Set emoticons location.
setEmoticonPath: function( path )
Replaces text-emoticons with their image equivalent.
emotify: function( text )
Replaces URLs with a HTML-link.
linkify: function( text )
Escapes a text using a jQuery function (like htmlspecialchars in PHP)
escape: function( text )
replaces newline characters with a br/ to make multi line messages look nice
nl2br: function( text )
Does everything of the parser: escaping, linkifying and emotifying.
all: function( text )
Copy an HTML DOM element into an XML DOM.
self.createHtml = function( elem, maxLength, currentLength )