mrspoonzy at gmail Cube by Noah Ellman A powerful javascript toolkit, in research © by Noah Ellman

Jwee Docs > Quick Reference

Jump to -
global  ·  Object  ·  Function  ·  Array  ·  String  ·  Number  ·  Date  ·  Math  ·  wee  ·  wee  ·  wee.dom  ·  wee  ·  wee.cookie  ·  parseURL  ·  wee.event  ·  wee.event.mouse  ·  wee.event.mouse  ·  wee.event  ·  wee  ·  wee.elem  ·  HTMLElement  ·  wee  ·  wee.AjaxClass  ·  wee  ·  wee.fx  ·  wee.fx.Tween  ·  wee.fx  ·  wee.fx.blackout  ·  wee  ·  wee.form  ·  wee.form.Form  ·  wee.flash  ·  wee.flash.Movie  ·  wee.misc  ·  wee  ·  wee.Color  ·  wee  ·  wee.tooltip  ·  wee  ·  wee.Hotbox


Also known as [window]

function wee(...)

Gets an element by ID / ensures an element has extended properties.

function $a(...)

Utility function to convert an array-like object to a plain javascript array

function isScalar(...)

Check if variable is a "primitive" type (string, number, or boolean)

function isElement(...)

Check if variable is a DOM element.`

function isNothing(...)

Check if the variable is nothing ("undefined", "null", or a empty string).

function trace(...)

Output something to debugging console or wee's console.



function extend(...)

Add all the properties/methods of the second object to the first one. (Overwrites).

function each((...)

Run function passing each key/value in the object. Like the .each for arrays.

function merge(...)

Merge the properties and values from multiple objects.

function keys()

function keysOwn()

Returns the property of the object, but only its OWN properties, not ones it came with.

function values(...)

Returns an array of all the values in the object.

function size(...)

Get the length or number of properties in the object

function recycle(...)

Delete the variable and its contents, freeing resources. (theoretically).

function toJSON(...)

Retun JSON encoding representation of the argument.

function toString()

Return string representation of the argument.


Extra methods on Javascript functions.

method bind(...)

Permanently set what the variable this refers to in the function. If you are making your own class you can use bind to lock any function to your class. Also, once you called bind, the function itself is bound when you call your function with the .fire() method.

method later(...)

Executes function after xx millaseconds.

method interval(...)

Executes this after xx millaseconds, repeatedly. Use method .cancel() to stop.

method passing(...)

Get the same function back but with your arguments permanently set.

method cancel()

Cancels the previous timeout or interval set with later()

method toSource()

Returns the source code of the function. Browser dependent.


Extra methods on Javascript Arrays.

function from(...)

Converts an array-like object to a normal array

method each(...)

Run through every item in the array and do something.

method indexOf(...)

Search the array for needle

method search(...)

Search the array for needle

method contains(...)

Search the array for needle

method last()

Get the last value in this array

method insert(...)

Insert values into this array at position. This is done in-place, preserving the array.

method random()

Get a random value from the array


Extra String methods. (Note: String methods return a new string.)

method trim()

Removes any leading or trailing whitespace (if any) from string.

method test(...)

Test is a the string matches the provided regular expression

method contains(...)

Check if passed string is contained in string.

method suffix()

Like parseInt() but the opposite, gets the alphabetic part of a string, like "px" from "200px"

method capitalize()

Capitalize the string. Makes "foObAr" into "Foobar".

method entities()

Convert special chars like “</var>” to their HTML entities, like “</var>”

method camelize()

Converts a CSS property string to its javascript equvalent, such as "font-size" to "fontSize".



method isFloat()

See if the number is a float (decimal number)

method toPaddedString(...)



function stamp()

function create(...)

Get dates by saying things like now + 1 day

method getUnixTime()

Get unix time, same as time() in PHP.



function rand(...)

Get a random number between |min| 5uand max. Accepts decimals too.



class Class()

Create new class



toolkit wee

The main JWee object.

function require(...)

function getUniqueId(...)

Create a new unique identifier with optionally supplied prefix

function addScript(...)

Add a SCRIPT tag to the page.

function addStyle(...)

Add a STYLE tag to the page.

function evalScript(...)

This is like eval() except faster and executes globally

function evalStyle(...)

Dynamically add CSS code to the document

function navigate(...)

Redirect browser to a new URL

toolkit ua

Object containing information about the browser (user agent).

toolkit dom

DOM related functions and selecting elements.

Dom (wee.dom)

DOM related functions and selecting elements.

function id(...)

Get element by ID. This is the same as wee() and the $() function if enabled.

function tag(...)

Get elements by HTML tag name.

function select(...)

Get elements by CSS selector, the same as jQuery() way.

function body()

Get the document's BODY tag

function head()

Get the document's HEAD tag

function clientHeight()

Get document (page) height

function clientWidth()

Get document (page) width

function scrollTop()

Get the window's scroll position

function scrollLeft()

Get the window's scroll position

boolean loaded

Status (or readyState) of the page. Greater then 0 means DOM is rendered.



toolkit cookie

Cookie handling functions. Setting, Getting, simple to use



function get(...)

Get a cookie.

function set(...)

Set a cookie.

function unset(...)

Delete a cookie


Parse a complex URL into an object representating with all the parts, including the individual query string variables



toolkit key

toolkit mouse

Easily get mouse position or mouse button status at any time in real-time from anywhere in your code.

object Key { }

Contains constants like Key.ENTER so you dont need to remember ascii values.

function Key()

Returns the key code of the active event.

object Keyboard { }

Not used yet


Easily get mouse position or mouse button status at any time in real-time from anywhere in your code.


Easily get mouse position or mouse button status at any time in real-time from anywhere in your code.

function start()

Start tracking mouse events. Must be called first, at least once to start the tracking.

function stop()

Stop tracking mouse events.

object point { }

Mouse coordinates as x and y

number x

Mouse X position.

number y

Mouse Y position.

boolean pressed

true if mouse button is down, false if not



function add(...)

Start observing a new event on element, document, or window.

function remove(...)

Remove an event

function onReady(...)

Run a function the moment the DOM is ready (happens before onLoad).

function onLoad(...)

This is a the classic onLoad functionality.

function onLoadLazy(...)

These functions will execute in a lazy manner a couple seconds after the page has displayed and the browser is no longer cpu hogging.

function onMouseWheel(...)

Capture mouse wheel scrolling. Special event.

function returnTrue()

Returns the event as true, not canceling default action or stopping the event chain

function returnFalse()

Returns the event as false, canceling any default browser action and haulting the event chain

function trace()

Log the event to the console, for debugging

function trace_extra()

Log the event to the console, for debugging (more details)

function onRollIn()

Special event that triggers only ONCE when mouse enters element's area

function onRollOut()

Special event that triggers only ONCE when mouse leaves element's area

function getEvent()

Get current Event object.

function getOwner()

Get the current event's owner element. This is the element the event is initially attached to.

function getTarget()

Get the current's event's target element, which may or may not be the owning element.

function getRelated()

Gets the related element if applicable.

function getKeyCode()

Get the current key event's key code.

function getKey()

Get the current event's key as a letter if applicable.

function getMousePos()

Get the current event's mouse position.



toolkit elem

All element related functions.

Elem (wee.elem)

All element related functions.

function create(...)

(Usage 1)  Create a new HTML element on the fly.

function create(...)

(Usage 4)  Create a new element just like the elementToCopy

function create(...)

(Usage 3)  Create a new element from an snippit of HTML

function createFromHTML(...)

Create new element from straight HTML code.

function addMethods(...)

Extend HTML elements with new methods. Uses DOM extensions if supported.

function absoluteCenter()

Positions the element in the absolute center of the page, taking element dimensions and page scroll into consideration.


New magic methods that Jwee adds to all

method extend()

method identify()

Returns a valid unique ID for the element. If the element already has an id attribute assigned to it then it will be returned. If no id is assigned the element it will get a new unique id assigned to it, and that will be returned.

method tag(...)

Get the element's tagName, lowercased, or compare the element against a list of tags.

method fullName()

Mostly for debugging purchases, returns a long name for the element, with its style class and id.

method truncate()

Remove all the the elements children, thus emptying the element.

method recycle()

Remove this element from the DOM.

method update(...)

Like "innerHTML", but better. Replace the html contents of a element with your argument.

method readAttribute(...)

Get the value of attribute on an element.

method writeAttribute(...)

Set an attribute on the element

method getData(...)

HTML 5.0 support element's new custom attributes,

method setData(...)

HTML 5.0 support element's new custom attributes,

method cleanWhitespace()

method observe(...)

Attach and event handler. Same as Event.add, but just a shortcut.

method stopObserving(...)

Remove an event handler you previously added with a special name.

method setText()

Sets the text inside an element. This is pure text only and any HTML will appear literally.

method animate(...)

Run a animation/tween on the element

method show()

Show element. This is a shortcut for setting style.visibility to visible.

method hide()

Hide element. This is a shorcut for setting style.visibility to hidden.

method addClass(...)

Add an additional stylesheet class name to the element.

method removeClass(...)

Remove the stylesheet class name from the element.

method hasClass(...)

Returns true if the element has this className or false if it doesn't.

method toggleClass(...)

If the element has the class, then remove it. If it doesn't, then add it.

method getStyle(...)

Retreives the computed style of attr. For fetching explicit inline styles, use the normal

method setStyle(...)

Change a element's style. This function supports additional features and style properties not supported otherwise.

method getStyles()

Gets the computed styles object. Calling this multiple times uses no overhead, as getStyles() caches itself as the currentStyle property of the element.

method css()

Update the element's style in an easy way, just using normal CSS syntax like in a stylesheet file.

method opacity(...)

Get/set/clear the opacity on the elelment.

method getOpacity(...)

method setOpacity(...)

method clearOpacity(...)

method getRect()

Get the element's global (absolute) position in pixels on the page.

method setRect(...)

method query(...)

Just like, but starting from here. Pass a css expression or tag name.

method isChildOf(...)

method isInsideOf()

method contains(...)

See if this element contains another element.

method insert()

method append()

method parent(...)

Get the parent element that contains this element, like .parentNode but better. ).

method next()

Get the next element (sibling), after this one.

method previous()

Get the previous element (sibling), before this one.

method childs()

Get an array of the element's children, elements only - whitespace or text nodes



class AjaxClass()



class AjaxClass()

The ajax class shouldn't be directly accessed except if you know what you are doing. Instead use the wee.ajax instance.

method get(...)

Make an ajax request.

method post(...)

Make an ajax request.

method getHeader(...)

Fetch a HTTP header from the ajax result.

method setHeader(...)

Set a HTTP header for the next the ajax request.

boolean running

Indicates whether an ajax call is currently running.

number status

The HTTP status returned by the web server, such as 200 for success, or 500 for server error.

object response { }

object request { }

An object of properties pertaining to your ajax request

object http { }

The actual XmlHttpRequest object, available to access directly for custom implementation.

string text

The body of the current / last ajax response you have made. This could be html, json string, or javascript code - whatever the server returned.



toolkit fx

The tweening engine and a toolkit of other special effects and animation

FX (wee.fx)

The tweening engine and a toolkit of other special effects and animation

object easing { }

Object containing all the tweening equations (motion styles, like bouncy etc)

class Tween(...)

The Tween class is the brains of the animation engine.

FX.Tween (wee.fx.Tween)


method start()

Start the animation

method stop(...)

Haults an animation in progress.

method continueTo(...)

Continue the animation with new values.

method yoyo()

Run the opposite of the last animation, just like a yoyo.

method restart()

event onComplete

You can assign a custom function to this if you want to react to this event.

event onStart

You can assign a custom function to this if you want to react to this event.

boolean running

Is the animating currently going?

property value

The animated property's current value, in real-time.

property startValue

property endValue



function shake(...)

Do the shake special effect on the specified element.



function summon(...)

Show the screen dimming effect with the color specified (black is default).

function castoff()

Fade off the screen dimming effect.



toolkit form

All form related functions.


All form related functions.

function toQueryString()

function toObject()


class Form()



method elements()

method submit()

submits the form



function getVersion()

Get the users's version of macromedia flash

function add(...)

Create the flash content easily. This function will auto-delay itself if called before page is loaded.

class Movie(...)

Display flash content easily, like SWFObject.



method create(...)

Create the flash <embed> or <object> element.

method toString()

Generate the raw <embed> or <object> HTML code for your flash.



function rgb2hex()



class Color()

Manipulate colors with this class



method lighten()

Lighten the color

method darken()

Darken the color

method toString()

Get the #RRGGBB string



toolkit tooltip

Add tooltips to any element with html attribute "tip"



function enable()

Enable tooltips. Run anytime or add to your startup scripts.

function disable()

Disable tooltips if enabled.

object tips { }

You can create an object with id and values, in javascript, and refer to them in HTML by tip="#myTipID", instead of putting large amount of text directly in the HTML attribute.

function trace(...)

For your debugging pleasure. Writes messages to browser's console or firebug, and also to jwee's own console.



class Hotbox(...)

Create a new instance of hotbox.

wee.Weebox (wee.Hotbox)


method create()

Call this to actually render and display the box.

method loadContent(...)

Loads the HTML from a URL (via ajax) and sets the hotbox content.

method setContent(...)

Set the box content to your HTML code.

method setTitle(...)

Set the title of the box (the text in the top left)

event onClose

Assign your own function to this property, to catch when the user hits the close button.

event onReady

Assign your own function to this property. Triggers when content has completely loaded and faded in.