App

From oWiki

Jump to: navigation, search

Contents


Preference Dialog

none.

Attributes

pref.isTransparent

bool  ( r, w )
Specifies if the document background is transparent.

pref.r

int  ( r, w )
Specifies the RED component of the background color. Possible values is between 0 to 255.

pref.g

int  ( r, w )
Specifies the GREEN component of the background color. Possible values is between 0 to 255.

pref.b

int  ( r, w )
Specifies the BLUE component of the background color. Possible values is between 0 to 255.

pref.backgroundImage

string  ( r, w )
Specifies the background image's URL.

pref.backgroundPosition

string  ( r, w )
Specifies the position of the background image.

Value Description
top left
top center
top right
center left
center center
center right
bottom left
bottom center
bottom right
If you only specify one keyword, the second value will be "center".

Default value: 0% 0%

x% y% The first value is the horizontal position and the second value is the vertical. The top left corner is 0% 0%. The right bottom corner is 100% 100%. If you only specify one value, the other value will be 50%.
xpos ypos The first value is the horizontal position and the second value is the vertical. The top left corner is 0 0. Units can be pixels (0px 0px) or any other CSS units. If you only specify one value, the other value will be 50%. You can mix % and positions.

pref.backgroundRepeat

string  ( r, w )
Specifies how a background image will be repeated.

Value Description
repeat Default. The background image will be repeated vertically and horizontally
repeat-x The background image will be repeated horizontally
repeat-y The background image will be repeated vertically
no-repeat The background-image will be displayed only once

pref.backgroundAttachment

string  ( r, w )
Specifies whether a background image is fixed or scrolls with the rest of the page.

Value Description
scroll Default. The background image moves when the rest of the page scrolls
fixed The background image does not move when the rest of the page scrolls

boxes

array  ( r )
An array of droplets. Used to access individual droplet in document by index. (e.g. app.boxes[3]).

Methods

addBox( b, x, y )

b: a droplet
x: int
y: int

Add a droplet to this document at location (x, y).

findBox( x, y )

x: int
y: int
Return: a droplet

Returns the droplet under the cursor at location (x, y).

findNextBox( x, y, z )

x: int
y: int
z: int
Return: a droplet

Returns the droplet under the cursor at location (x, y) and has z-index value less than z.

findNextVisibleBox( x, y, z )

x: int
y: int
z: int
Return: a droplet

Returns the visible droplet under the cursor at location (x, y) and has z-index value less than z.

dispatchEvent( n )

n: string

Dispatch a custom DOM event with the given event name to this document.

dispatchEventWithData( n, dn, d )

n: string, event name.
dn: string, data name.
d: object, data object.

Dispatch a custom DOM event with the given event name and a data object with the given name and properties to this document.

dispatchEventToTargets( targets, n )

targets: array of string
n: string

Dispatch a custom DOM event with the given event name to a group of droplets whose names are given in an input array.

dispatchEventToTargetsWithData( targets, n, dn, d )

targets: array of string
n: string, event name.
dn: string, data name.
d: object, data object.

Dispatch a custom DOM event with the given event name and a data object with the given name and properties to a group of droplets whose names are given in an input array.

canGoForward()

Return: bool

Can this document navigate forward.

canGoBack()

Return: bool

Can this document navigate backward.

goForward()

Navigate forward.

goBack()

Navigate backward.

loadPage( url )

Loads the url.

getURL()

Return: string

Returns the current document's URL.

loadMolecule( data )

data: string
Return: a molecule

Loads a molecule in its serialized JSON format into the document. The returned molecule can then be attached to a droplet.

loadDroplet( data, x, y, b )

data: string
x: int
y: int
b: bool

Loads a droplet in its serialized JSON format into the document at location (x, y) and set its hideonload attribute as b.

loadFormation( data, b )

data: string
b: bool

Loads a formation (multiple droplets) in its serialized JSON format into the document and set all of its droplets' hideonload attribute as b.

importDroplet( url, x, y, b )

url: string
x: int
y: int
b: bool

Imports a droplet from the given URL into the document at location (x, y) and set its hideonload attribute as b.

importFormation( url, b )

url: string
b: bool

Imports a formation (multiple droplets) from the given URL into the document and set all of its droplets' hideonload attribute as b.

importDropletRaw( url )

url: string
Return: string

Retrieves the droplet at the given URL in its serialized JSON string format.

importFormationRaw( url )

url: string
Return: string

Retrieves the formation (multiple droplets) from the given URL in its serialized JSON string format.

base64Encode(s)

s: string
Return: string

Apply base64 encoding to s and return the result.

base64Decode(s)

s: string
Return: string

Apply base64 decoding to s and return the result.

clear()

Clear all content from the current document.

serialize()

Return: string

Serialize this document into its JSON representation.


Comments

To create a new droplet at runtime: var aDroplet = new droplet();
To create a new molecule at runtime: var aMolecule = new molecule(type);
where type is the type name from one of the 34 different molecules.

Personal tools