Skip to content

Commit

Permalink
Tried to improve the documentation.
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 e8bb174 commit 8aef0f6
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 43 deletions.
41 changes: 19 additions & 22 deletions Docs/Utilities/Cookie.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
Object: Cookie {#Cookie}
========================

Sets and accesses cookies.

### Credits:

- Based on the functions by Peter-Paul Koch [QuirksMode][].
Reads and writes a cookie.

### Options: {#Cookie-options}

* domain - (*string*: defaults to false) The domain the Cookie belongs to.
* path - (*string*: defaults to '/') The path the Cookie belongs to.
* duration - (*number*: defaults to false) The duration of the Cookie before it expires, in days. If set to false or 0, the cookie will be a session cookie that expires when the browser is closed.
* domain - (*string*: defaults to false) The domain the cookie belongs to.
* path - (*string*: defaults to '/') The path the cookie belongs to.
* 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.

### Notes:

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

### 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}
--------------------------------
Expand All @@ -37,15 +31,15 @@ Writes a cookie in the browser.

### Returns:

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

### Examples:

Saves the Cookie for the Duration of the Session:
Saves the cookie for the duration of the session:

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

Saves the Cookie for a Day:
Saves the cookie for a day:

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

Expand All @@ -54,15 +48,15 @@ Saves the Cookie for a Day:
Cookie Method: read {#Cookie:read}
--------------------------------

Reads the value of a Cookie.
Reads the value of a cookie.

### Syntax:

var myCookie = Cookie.read(name);

### Arguments:

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

### Returns:

Expand Down Expand Up @@ -92,16 +86,19 @@ Removes a cookie from the browser.

Remove a Cookie:

Cookie.dispose('username'); //Bye-bye JackBauer! Seeya in 24 Hours.
Cookie.dispose('username'); // Bye-bye JackBauer!

Creating a Cookie and Removing it Right Away:
Creating a cookie and removing it right away:

var myCookie = Cookie.write('username', 'Aaron', {domain: 'mootools.net'});
if (Cookie.read('username') == 'Aaron') { myCookie.dispose(); }
var myCookie = Cookie.write('username', 'JackBauer', {domain: 'mootools.net'});
if (Cookie.read('username') == 'JackBauer') { myCookie.dispose(); }

### Credits:

- 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
[QuirksMode]: http://www.quirksmode.org
9 changes: 7 additions & 2 deletions Docs/Utilities/DOMReady.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
Window Event: domready
========================

Contains the window Event 'domready', which will execute when the DOM has loaded. To ensure that DOM elements exist when the code attempting to access them is executed, they should be placed within the 'domready' event.
Contains the window [Event][] 'domready', which executes when the DOM is loaded.

This event is only available to the window Element.
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:

Expand All @@ -14,4 +18,5 @@ This event is only available to the window Element.
### See Also:
[Element.Event][]

[Event]: /core/Element/Element.Event
[Element.Event]: /core/Element/Element.Event
12 changes: 8 additions & 4 deletions Docs/Utilities/JSON.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Object: JSON {#JSON}
====================

JSON parser and encoder.
JSON decoder and encoder.

### See Also:

- [JavaScript Object Notation (JSON.org)](http://www.json.org/)
- [JSON (JavaScript Object Notation)][]

JSON Method: encode {#JSON:encode}
----------------------------------
Expand Down Expand Up @@ -33,7 +33,7 @@ Converts an object or array to a JSON string.
JSON Method: decode {#JSON:decode}
----------------------------------

Converts a JSON string into an JavaScript object.
Converts a JSON string into a JavaScript object.

### Syntax:

Expand All @@ -54,4 +54,8 @@ Converts a JSON string into an JavaScript object.

### Credits:

- JSON test regexp is by [Douglas Crockford](http://crockford.com/) and [Tobie Langel](http://tobielangel.com/).
- JSON test regular expression by [Douglas Crockford][] and [Tobie Langel][].

[JSON (JavaScript Object Notation)]: http://www.json.org/
[Douglas Crockford]: http://crockford.com/
[Tobie Langel]: http://tobielangel.com/
29 changes: 14 additions & 15 deletions Docs/Utilities/Swiff.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ Class: Swiff {#Swiff}

Creates and returns a Flash object using supplied parameters.

### Credits:

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

### Syntax:

var mySwiff = new Swiff(path[, options]);
Expand All @@ -21,19 +17,19 @@ Flash detection and Internet Explorer/Flash Player 9 fix adapted from [SWFObject
* id - (*string*: defaults to 'Swiff\_' + unique id) The id of the SWF object.
* width - (*number*: defaults to 1) The width of the SWF object.
* height - (*number*: defaults to 1) The height of the SWF object.
* container - (*element*) The container into which the SWF object will be injected.
* container - (*element*) The container the SWF object gets injected in.
* params - (*object*) Parameters to be passed to the SWF object (wmode, bgcolor, allowScriptAccess, loop, etc.).
* allowScriptAccess - (*string*: defaults to always) The domain that the SWF object allows access to.
* quality - (*string*: defaults to 'high') The render quality of the movie.
* swLiveConnect - (*boolean*: defaults to true) the swLiveConnect parameter to allow remote scripting.
* wMode - (*string*: defaults to 'window') Changes the way the SWF is displayed in the browser.
* properties - (*object*) Additional attributes for the object element.
* vars - (*object*) Vars will be passed to the SWF as querystring in flashVars.
* 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:

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

### Example:

Expand All @@ -56,9 +52,8 @@ Flash detection and Internet Explorer/Flash Player 9 fix adapted from [SWFObject

### Note:

1. Although Swiff returns the object, this element will NOT have any Element methods applied to it.
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.
3. Avoid changing the wMode param to 'transparent'. It will make your page more processor intensive, especially when running in a background tab.

Swiff Function: remote {#Swiff:remote}
--------------------------------------
Expand All @@ -71,8 +66,8 @@ Calls an ActionScript function from JavaScript.

### Arguments:

1. obj - (*element*) A Swiff instance (an HTML object Element).
2. fn - (*string*) The name of the function to execute in the Flash movie.
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:
Expand All @@ -82,12 +77,16 @@ Calls an ActionScript function from JavaScript.
### Example:

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

### Note:

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

[SWFObject]: http://blog.deconcept.com/swfobject/
[External Interface]: http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001652.html
### Credits:

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
[SWFObject]: http://code.google.com/p/swfobject/

0 comments on commit 8aef0f6

Please sign in to comment.