Classes
Namespaces
- animation
- array
- browser
- cls
- cookie
- dom
- drag
- ease
- effect
- form
- frame
- location
- position
- selection
- string
- style
- test
- ui
- window
Methods
-
<static> _onReady(delegate)
-
Execute a function when the DOM is ready
Parameters:
Name Type Description delegateThe function to execute
-
<static> animate(options, style, value, duration, delegate)
-
Animate something
options: { node : «Element», css : { fontSize : '11px', color : '#f00', opacity : 0.5 }, duration : 1000, // 1sec ease : function(num) {}, $complete : function() {} } TODO Document options.property, options.valueParameters:
Name Type Description optionsElement | Object Options or an element
styleString The css property
valueString The css value
durationNumber The duration in milisecons
delegateObject The options if first param is an element
- Source:
-
<static> between()
-
Make sure a number is between a min / max
-
<static> build(name, options, doc)
-
Builds an element with the «name» and «options»
Parameters:
Name Type Description nameString The name of the new element (. adds class)
optionsObject The options
Properties
Name Type Description htmlString Inner HTML
textString Inner text
classNameString classString styleObject Map of styles (see: hui.style.set)
parentElement parentFirstElement beforeElement docDocument (Optional) The document to create the element for
Returns:
The new element
- Type
- Element
-
<static> defer(func, ?bind)
-
Defer a function so it will fire when the current "thread" is done
Parameters:
Name Type Description funcfunction The function to defer
?bindObject Optional, the object to bind "this" to
-
<static> define(name, obj)
-
Register code as ready
Parameters:
Name Type Description nameThe name of the module
objThe object, function, namespace
-
<static> each(items, func)
-
Loop through items in array or properties in an object.
If «items» is an array «func» is called with each item.
If «items» is an object «func» is called with each (key,value)Parameters:
Name Type Description itemsObject | Array The object or array to loop through
funcfunction The callback to handle each item
-
<static> evaluate()
-
Evaluate an expression
-
<static> event(event)
-
Creates an event wrapper for an event
Parameters:
Name Type Description eventThe DOM event
Returns:
An event wrapper
- Type
- hui.Event
-
<static> fit(box, container)
-
Fit a box inside a container while preserving aspect ratio (note: expects sane input)
Parameters:
Name Type Description boxObject The box to scale {width : 200, height : 100}
containerObject The container to fit the box inside {width : 20, height : 40}
Returns:
An object of the new box {width : 20, height : 10}
- Type
- Object
-
<static> intOrString(str)
-
Converts a string to an int if it is only digits, otherwise remains a string
Parameters:
Name Type Description strString The string to convert
Returns:
An int of the string or the same string
- Type
- Object
-
<static> isArray(obj)
-
Checks if an object is an array
Parameters:
Name Type Description objObject The object to check
-
<static> isBlank(str)
-
Checks if a string has non-whitespace characters
Parameters:
Name Type Description strString The string
-
<static> isDefined(obj)
-
Checks that an object is not null and not undefined
Parameters:
Name Type Description objObject The object to check
-
<static> isNumber(obj)
-
Checks if an object is a number
Parameters:
Name Type Description objObject The object to check
-
<static> isString(obj)
-
Checks if an object is a string
Parameters:
Name Type Description objObject The object to check
-
<static> listen(element, type, listener, ?bindTo)
-
Add an event listener to an element
Parameters:
Name Type Description elementElement The element to listen on
typeString The event to listen for
listenerfunction The function to be called
?bindToobject Bind the listener to it
-
<static> listenOnce(element, type, listener)
-
Add an event listener to an element, it will only fire once
Parameters:
Name Type Description elementElement The element to listen on
typeString The event to listen for
listenerfunction The function to be called
-
<static> log(obj)
-
Log something
Parameters:
Name Type Description objObject The object to log
-
<static> override(original, subject)
-
Override the properties on the first argument with properties from the last object
Parameters:
Name Type Description originalObject The object to override
subjectObject The object to copy the properties from
Returns:
The original
- Type
- Object
-
<static> request(options)
-
Send a HTTP request
options: { method : «'POST' | 'get' | 'rEmOVe'», async : true, headers : {Ajax : true, header : 'value'}, file : «HTML5-file», files : «HTML5-files», parameters : {key : 'value'}, $success : function(transport) { // when status is 200 }, $forbidden : function(transport) { // when status is 403 }, $abort : function(transport) { // when request is aborted }, $failure : function(transport) { // when status is not 200 (if status is 403 and $forbidden is set then $failure will not be called) }, $exception : function(exception,transport) { // When an exception has occurred while calling on«Something», If not set the exception will be thrown }, $progress : function(current,total) { // Progress for file uploads (maybe also other requests?) }, $load : functon() { // When file upload is transfered? } }Parameters:
Name Type Description optionsThe options
Returns:
The transport
- Type
- XMLHttpRequest
-
<static> stop(event)
-
Stops an event from propagating
Parameters:
Name Type Description eventA standard DOM event, NOT an hui.Event
-
<static> unListen(element, type, listener, useCapture)
-
Remove an event listener from an element
Parameters:
Name Type Description elementElement The element to remove listener from
typeString The event to remove
listenerfunction The function to remove
useCaptureboolean If the listener should "capture"
-
<static> when(condition, text)
-
Return text if condition is met
Parameters:
Name Type Description conditionObject The condition to test
textString The text to return when condition evaluates to true