From c6acc10588c08625fb5d7cc257375d463530976d Mon Sep 17 00:00:00 2001 From: sheldonlendrum Date: Sat, 16 Jul 2011 10:28:43 +1200 Subject: [PATCH] Styling - to be ignored, Request( & HTML) examples and text. --- Source/Docs/Fx/Fx.md | 2 +- Source/Docs/Request/Request.HTML.md | 20 +++++++++-- Source/Docs/Request/Request.md | 51 ++++++++++++++++++++--------- assets/css/docs.css | 9 +++++ 4 files changed, 63 insertions(+), 19 deletions(-) diff --git a/Source/Docs/Fx/Fx.md b/Source/Docs/Fx/Fx.md index 976c208..5a37d37 100644 --- a/Source/Docs/Fx/Fx.md +++ b/Source/Docs/Fx/Fx.md @@ -33,7 +33,7 @@ Fx Method: constructor {#Fx:constructor} * -'short' - 250ms * -'normal' - 500ms * -'long' - 1000ms -* __ransition__ - (*function*: defaults to ['sine:in:out'](/Fx/Fx.Transitions) The equation to use for the effect see [Fx.Transitions](/Fx/Fx.Transitions). Also accepts a string in the following form: +* __Transition__ - (*function*: defaults to ['sine:in:out'](/Fx/Fx.Transitions) The equation to use for the effect see [Fx.Transitions](/Fx/Fx.Transitions). Also accepts a string in the following form: transition\[:in\]\[:out\] - for example, 'linear', 'quad:in', 'back:in', 'bounce:out', 'elastic:out', 'sine:in:out' diff --git a/Source/Docs/Request/Request.HTML.md b/Source/Docs/Request/Request.HTML.md index a17edbc..dd19268 100644 --- a/Source/Docs/Request/Request.HTML.md +++ b/Source/Docs/Request/Request.HTML.md @@ -45,6 +45,20 @@ Request Specifically made for receiving HTML. ### Examples: + var myHTMLRequest = new Request.HTML({ + url: 'ajax.php', + onComplete: function(responseTree, responseElements, responseHTML, responseJavaScript) { + + // update our container with the returned HTML. + document.id('myContainer').set('html', responseHTML); + + // fire the Javascript returned in the request. + $exec(responseJavaScript); + + } + }).send(); + + #### Simple GET Request: var myHTMLRequest = new Request.HTML().get('myPage.html'); @@ -62,18 +76,20 @@ Request Specifically made for receiving HTML. ##### HTML -
+ +

Search: Search in description:

+ ##### JavaScript //Needs to be in a submit event or the form handler. - var myHTMLRequest = new Request.HTML({url:'save/'}).post($('user-form')); + var myHTMLRequest = new Request.HTML({ url: $('user-form').get('action') }).post($('user-form')); ### See Also: diff --git a/Source/Docs/Request/Request.md b/Source/Docs/Request/Request.md index cf2bb9c..c58ca47 100644 --- a/Source/Docs/Request/Request.md +++ b/Source/Docs/Request/Request.md @@ -17,25 +17,25 @@ An XMLHttpRequest Wrapper. ### Options: -* url - (*string*: defaults to null) The URL to request. (Note, this can also be an instance of [URI][]) -* method - (*string*: defaults to 'post') The HTTP method for the request, can be either 'post' or 'get'. -* data - (*string*: defaults to '') The default data for [Request:send][], used when no data is given. -* link - (*string*: defaults to 'ignore') Can be 'ignore', 'cancel' and 'chain'. +* __url__ - (*string*: defaults to null) The URL to request. (Note, this can also be an instance of [URI][]) +* __method__ - (*string*: defaults to 'post') The HTTP method for the request, can be either 'post' or 'get'. +* __data__ - (*string*: defaults to '') The default data for [Request:send][], used when no data is given. +* __link__ - (*string*: defaults to 'ignore') Can be 'ignore', 'cancel' and 'chain'. * 'ignore' - Any calls made to start while the request is running will be ignored. (Synonymous with 'wait': true from 1.11) * 'cancel' - Any calls made to start while the request is running will take precedence over the currently running request. The new request will start immediately, canceling the one that is currently running. (Synonymous with 'wait': false from 1.11) * 'chain' - Any calls made to start while the request is running will be chained up, and will take place as soon as the current request has finished, one after another. -* async - (*boolean*: defaults to true) If set to false, the requests will be synchronous and freeze the browser during request. -* encoding - (*string*: defaults to 'utf-8') The encoding to be set in the request header. -* headers - (*object*) An object to use in order to set the request headers. -* isSuccess - (*function*) Overrides the built-in isSuccess function. -* evalScripts - (*boolean*: defaults to false) If set to true, `script` tags inside the response will be evaluated. -* evalResponse - (*boolean*: defaults to false) If set to true, the entire response will be evaluated. Responses with javascript content-type will be evaluated automatically. -* emulation - (*boolean*: defaults to true) If set to true, other methods than 'post' or 'get' are appended as post-data named '\_method' (used in rails) -* urlEncoded - (*boolean*: defaults to true) If set to true, the content-type header is set to www-form-urlencoded + encoding -* timeout - (*integer*: defaults to 0) In conjunction with `onTimeout` event, it determines the amount of milliseconds before considering a connection timed out. (It's suggested to not use timeout with big files and only when knowing what's expected.) -* noCache - (*boolean*; defaults to false) If *true*, appends a unique *noCache* value to the request to prevent caching. (IE has a bad habit of caching ajax request values. Including this script and setting the *noCache* value to true will prevent it from caching. The server should ignore the *noCache* value.) -* user - (*string*: defaults to undefined) When username is set the Request will open with credentials and try to authenticate. -* password - (*string*: defaults to undefined) You can use this option together with the `user` option to set authentication credentials when necessary. Note that the password will be passed as plain text and is therefore readable by anyone through the source code. It is therefore encouraged to use this option carefully +* __async__ - (*boolean*: defaults to true) If set to false, the requests will be synchronous and freeze the browser during request. +* __encoding__ - (*string*: defaults to 'utf-8') The encoding to be set in the request header. +* __headers__ - (*object*) An object to use in order to set the request headers. +* __isSuccess__ - (*function*) Overrides the built-in isSuccess function. +* __evalScripts__ - (*boolean*: defaults to false) If set to true, `script` tags inside the response will be evaluated. +* __evalResponse__ - (*boolean*: defaults to false) If set to true, the entire response will be evaluated. Responses with javascript content-type will be evaluated automatically. +* __emulation__ - (*boolean*: defaults to true) If set to true, other methods than 'post' or 'get' are appended as post-data named '\_method' (used in rails) +* __urlEncoded__ - (*boolean*: defaults to true) If set to true, the content-type header is set to www-form-urlencoded + encoding +* __timeout__ - (*integer*: defaults to 0) In conjunction with `onTimeout` event, it determines the amount of milliseconds before considering a connection timed out. (It's suggested to not use timeout with big files and only when knowing what's expected.) +* __noCache__ - (*boolean*; defaults to false) If *true*, appends a unique *noCache* value to the request to prevent caching. (IE has a bad habit of caching ajax request values. Including this script and setting the *noCache* value to true will prevent it from caching. The server should ignore the *noCache* value.) +* __user__ - (*string*: defaults to undefined) When username is set the Request will open with credentials and try to authenticate. +* __password__ - (*string*: defaults to undefined) You can use this option together with the `user` option to set authentication credentials when necessary. Note that the password will be passed as plain text and is therefore readable by anyone through the source code. It is therefore encouraged to use this option carefully ### Events: @@ -86,6 +86,25 @@ Fired when the Request is making progresses in the download or upload. (This is myRequest.send(); +#### Complete: + +Fired when the Request has completed, The response is returned as the first argument. + +##### Arguments: + +1. response - (XMLHttpRequest) The response. + +### Example: + + var myRequest = new Request({ + url: 'ajax.php', + onComplete: function(response) { + + document.id('myContainer').set('text', response); + + } + }).send(); + ### See Also: - [MDC: nsIDOMProgressEvent](https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIDOMProgressEvent) diff --git a/assets/css/docs.css b/assets/css/docs.css index 53f54f8..fb4263f 100644 --- a/assets/css/docs.css +++ b/assets/css/docs.css @@ -27,6 +27,15 @@ H2 { #rightcolumn HR { clear: both; } + + #rightcolumn ul li strong { + display: inline-block; + min-width: 50px; + } + + #rightcolumn ul li ul li { + padding-left: 60px; + } SECTION { padding: 30px 0 0;