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 delegate
The 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.value
Parameters:
Name Type Description options
Element | Object Options or an element
style
String The css property
value
String The css value
duration
Number The duration in milisecons
delegate
Object 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 name
String The name of the new element (. adds class)
options
Object The options
Properties
Name Type Description html
String Inner HTML
text
String Inner text
className
String class
String style
Object Map of styles (see: hui.style.set)
parent
Element parentFirst
Element before
Element doc
Document (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 func
function The function to defer
?bind
Object Optional, the object to bind "this" to
-
<static> define(name, obj)
-
Register code as ready
Parameters:
Name Type Description name
The name of the module
obj
The 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 items
Object | Array The object or array to loop through
func
function 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 event
The 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 box
Object The box to scale {width : 200, height : 100}
container
Object 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 str
String 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 obj
Object The object to check
-
<static> isBlank(str)
-
Checks if a string has non-whitespace characters
Parameters:
Name Type Description str
String The string
-
<static> isDefined(obj)
-
Checks that an object is not null and not undefined
Parameters:
Name Type Description obj
Object The object to check
-
<static> isNumber(obj)
-
Checks if an object is a number
Parameters:
Name Type Description obj
Object The object to check
-
<static> isString(obj)
-
Checks if an object is a string
Parameters:
Name Type Description obj
Object The object to check
-
<static> listen(element, type, listener, ?bindTo)
-
Add an event listener to an element
Parameters:
Name Type Description element
Element The element to listen on
type
String The event to listen for
listener
function The function to be called
?bindTo
object 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 element
Element The element to listen on
type
String The event to listen for
listener
function The function to be called
-
<static> log(obj)
-
Log something
Parameters:
Name Type Description obj
Object 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 original
Object The object to override
subject
Object 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 options
The options
Returns:
The transport
- Type
- XMLHttpRequest
-
<static> stop(event)
-
Stops an event from propagating
Parameters:
Name Type Description event
A standard DOM event, NOT an hui.Event
-
<static> unListen(element, type, listener, useCapture)
-
Remove an event listener from an element
Parameters:
Name Type Description element
Element The element to remove listener from
type
String The event to remove
listener
function The function to remove
useCapture
boolean If the listener should "capture"
-
<static> when(condition, text)
-
Return text if condition is met
Parameters:
Name Type Description condition
Object The condition to test
text
String The text to return when condition evaluates to true