Skip to content

Commit

Permalink
Some smaller changes, mostly layout.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Beiner authored and cpojer committed Jan 10, 2011
1 parent 8aef0f6 commit 8159f42
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 76 deletions.
51 changes: 21 additions & 30 deletions Docs/Utilities/Cookie.md
@@ -1,5 +1,4 @@
Object: Cookie {#Cookie}
========================
## Object: Cookie {#Cookie}

Reads and writes a cookie.

Expand All @@ -10,79 +9,72 @@ Reads and writes a cookie.
* duration - (*number*: defaults to false) The duration of the cookie (in days) before it expires. If set to false or 0, the cookie will be a session cookie that expires when the browser is closed.
* secure - (*boolean*: defaults to false) Stored cookie information can be accessed only from a secure environment.

### Note:

In order to share the cookie with pages located in a different path, the [Cookie.options.domain][] value must be set.

Cookie Method: write {#Cookie:write}
--------------------------------
### Cookie Method: write {#Cookie:write}

Writes a cookie in the browser.

### Syntax:
#### Syntax:

var myCookie = Cookie.write(key, value[, options]);

### Arguments:
#### Arguments:

1. key - (*string*) The key (or name) of the cookie.
2. value - (*string*) The value to set. Cannot contain semicolons.
3. options - (*mixed*, optional) See [Cookie][].

### Returns:
#### Returns:

* (*object*) An object with the options, the key and the value. You can give it as first parameter to [Cookie.dispose][].

### Examples:
#### Examples:

Saves the cookie for the duration of the session:

var myCookie = Cookie.write('username', 'JackBauer');

Saves the cookie for a day:

var myCookie = Cookie.write('username', 'JackBauer', {duration: 1});
var myCookie = Cookie.write('username', 'JackBauer', {duration: 1});

#### Note:

In order to share the cookie with pages located in a different path, the [Cookie.options.domain][Cookie.options] value must be set.

Cookie Method: read {#Cookie:read}
--------------------------------
### Cookie Method: read {#Cookie:read}

Reads the value of a cookie.

### Syntax:
#### Syntax:

var myCookie = Cookie.read(name);

### Arguments:
#### Arguments:

1. name - (*string*) The name of the cookie to read.

### Returns:
#### Returns:

* (*mixed*) The cookie string value, or null if not found.

### Examples:
#### Example:

Cookie.read('username');



Cookie Method: dispose {#Cookie:dispose}
--------------------------------------
### Cookie Method: dispose {#Cookie:dispose}

Removes a cookie from the browser.

### Syntax:
#### Syntax:

var oldCookie = Cookie.dispose(name[, options]);

### Arguments:
#### Arguments:

1. name - (*string*) The name of the cookie to remove or a previously saved Cookie instance.
1. name - (*string*) The name of the cookie to remove or a previously saved Cookie instance.
2. options - (*object*, optional) See [Cookie][].

### Examples:
#### Examples:

Remove a Cookie:

Expand All @@ -97,8 +89,7 @@ Creating a cookie and removing it right away:

- Based on the functions by Peter-Paul Koch of [QuirksMode][].

[Cookie]: #Cookie
[Cookie.options]: #Cookie-options
[Cookie.options.domain]: #Cookie-options
[Cookie.dispose]: #Cookie:dispose
[Cookie.options]: #Cookie-options
[Cookie]: #Cookie
[QuirksMode]: http://www.quirksmode.org
16 changes: 7 additions & 9 deletions Docs/Utilities/DOMReady.md
@@ -1,22 +1,20 @@
Window Event: domready
========================
## Window Event: domready

Contains the window [Event][] 'domready', which executes when the DOM is loaded.

To ensure that DOM elements exist when the code attempts to access them is executed, they need to be placed within the 'domready' event.

### Note:

This event is only available to the window element.

### Example:
#### Example:

window.addEvent('domready', function() {
alert('The DOM is ready!');
});

#### Note:

This event is only available to the window element.

### See Also:
[Element.Event][]
[Element.Event][Event]

[Event]: /core/Element/Element.Event
[Element.Event]: /core/Element/Element.Event
37 changes: 16 additions & 21 deletions Docs/Utilities/JSON.md
@@ -1,61 +1,56 @@
Object: JSON {#JSON}
====================
## Object: JSON {#JSON}

JSON decoder and encoder.

### See Also:

- [JSON (JavaScript Object Notation)][]

JSON Method: encode {#JSON:encode}
----------------------------------
### JSON Method: encode {#JSON:encode}

Converts an object or array to a JSON string.

### Syntax:
#### Syntax:

var myJSON = JSON.encode(obj);

### Arguments:
#### Arguments:

1. obj - (*object*) The object to convert to string.

### Returns:
#### Returns:

* (*string*) A JSON string.

### Examples:
#### Examples:

var fruitsJSON = JSON.encode({apple: 'red', lemon: 'yellow'}); // returns: '{"apple":"red","lemon":"yellow"}'



JSON Method: decode {#JSON:decode}
----------------------------------
### JSON Method: decode {#JSON:decode}

Converts a JSON string into a JavaScript object.

### Syntax:
#### Syntax:

var object = JSON.decode(string[, secure]);

### Arguments:
#### Arguments:

1. string - (*string*) The string to evaluate.
2. secure - (*boolean*, optional: defaults to false) If set to true, checks for any hazardous syntax and returns null if any found.

### Returns:
#### Returns:

* (*object*) The object represented by the JSON string.

### Examples:
#### Examples:

var myObject = JSON.decode('{"apple":"red","lemon":"yellow"}'); // returns: {apple: 'red', lemon: 'yellow'}

### See Also:

- [JSON (JavaScript Object Notation)][]

### Credits:

- JSON test regular expression by [Douglas Crockford][] and [Tobie Langel][].

[JSON (JavaScript Object Notation)]: http://www.json.org/
[Douglas Crockford]: http://crockford.com/
[JSON (JavaScript Object Notation)]: http://www.json.org/
[Tobie Langel]: http://tobielangel.com/
30 changes: 14 additions & 16 deletions Docs/Utilities/Swiff.md
@@ -1,18 +1,17 @@
Class: Swiff {#Swiff}
=====================
## Class: Swiff {#Swiff}

Creates and returns a Flash object using supplied parameters.

### Syntax:
#### Syntax:

var mySwiff = new Swiff(path[, options]);

### Arguments:
#### Arguments:

1. path - (*string*) The path to the SWF file.
2. options - (*object*, optional) See Options below.

### Options:
#### Options:

* id - (*string*: defaults to 'Swiff\_' + unique id) The id of the SWF object.
* width - (*number*: defaults to 1) The width of the SWF object.
Expand All @@ -27,11 +26,11 @@ Creates and returns a Flash object using supplied parameters.
* vars - (*object*) Vars will be passed to the SWF as query string in flashVars.
* callBacks - (*object*) Functions to call from the SWF. These will be available globally in the movie, and bound to the object.

### Returns:
#### Returns:

* (*element*) A new HTML object element.

### Example:
#### Example:

var obj = new Swiff('myMovie.swf', {
id: 'myBeautifulMovie',
Expand All @@ -50,42 +49,41 @@ Creates and returns a Flash object using supplied parameters.
}
});

### Note:
#### Note:

1. Although Swiff returns the object, this element will NOT have any [Element][] methods applied to it.
2. The $ function on an object/embed tag will only return its reference without further processing.

Swiff Function: remote {#Swiff:remote}
--------------------------------------
### Swiff Function: remote {#Swiff:remote}

Calls an ActionScript function from JavaScript.

### Syntax:
#### Syntax:

var result = Swiff.remote(obj, fn[, arg, arg, arg ...]);

### Arguments:
#### Arguments:

1. obj - (*element*) A Swiff instance (a HTML object element).
2. fn - (*string*) The function name to execute in the SWF.
3. arg - (*mixed*) Any number of arguments to pass to the named function.

### Returns:
#### Returns:

* (*mixed*) The ActionScript function's result.

### Example:
#### Example:

var obj = new Swiff('myMovie.swf');
alert(Swiff.remote(obj, 'myFlashFn')); // alerts "This is from the .swf file!".

### Note:
#### Note:

The SWF file must be compiled with the ExternalInterface component. See the Adobe documentation on [External Interface][] for more information.

### Credits:

Flash detection and Internet Explorer/Flash Player 9 fix adapted from [SWFObject][].
- Flash detection and Internet Explorer/Flash Player 9 fix adapted from [SWFObject][].

[Element]: /core/Element/Element
[External Interface]: http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html
Expand Down

0 comments on commit 8159f42

Please sign in to comment.