oxjs/readme/html/OxDoc.html
2012-04-07 16:43:41 +02:00

92 lines
No EOL
2.8 KiB
HTML

<script>
Ox.tmp = {
dialog: function(id) {
var source = Ox.decodeHTMLEntities(Ox.stripTags(
$('#' + id).html()
.replace(/&nbsp;/g, ' ')
.replace(/<br>/g, '\n')
)),
doc = Ox.doc(source);
Ox.Dialog({
closeButton: true,
content: Ox.TabPanel({
content: {
source: Ox.SyntaxHighlighter({
showLineNumbers: true,
source: source
}),
doc: Ox.TreeList({
data: doc,
width: 640
}).css({height: 360}),
docpage: Ox.DocPage({
item: doc[0]
})
},
tabs: [
{id: 'source', title: 'source'},
{id: 'doc', title: 'Ox.doc(source)'},
{id: 'docpage', title: 'Ox.DocPage(doc[0])'}
]
}),
height: 360,
title: 'OxDoc',
width: 640
}).open();
}
}
</script>
<h1>Ox.doc - A JavaScript Documentation Language</h1>
<p>foo bar</p>
<pre class="code" id="foo">//@ My.TYPES &lt;number&gt; Request timeout, in seconds
My.REQUEST_TIMEOUT = 60;</pre>
<a href="javascript:Ox.tmp.dialog('foo')">try it out</a>
<p>foo bar</p>
<pre class="code">/*@
My.getProtocol &lt;function&gt; Returns the protocol part of a URL
(url) -&gt; &lt;string&gt; Protocol, like "https", otherwise ""
url &lt;string&gt; Just some URL
@*/
My.getProtocol = function(url) {
var match = url.match(/^(.+):\/\//);
return match ? match[1] : '';
};</pre>
<p>foo bar</p>
<pre class="code" id="xxx">/*@
My.readURL &lt;f&gt; Reads data from a remote URL
(url, callback) -&gt; &lt;o&gt; Request handler
(url, options, callback) -&gt; &lt;o&gt; Request handler
cancel &lt;f&gt; Function to cancel the request
url &lt;s&gt; Remote URL
options &lt;o&gt; Optional config object
timeout &lt;n|60&gt; Timeout in seconds
type &lt;s|'GET'&gt; Request type ('GET', 'POST', 'PUT' or 'DELETE')
callback &lt;f&gt; Callback function
result &lt;o> Result object
status &lt;n&gt; HTTP status code
data &lt;s&gt; Data read from URL, or empty string
@*/
My.readURL = function(url, options, callback) {
if (arguments.length == 2) {
callback = options;
options = {timeout: 60, type: 'GET'};
}
};</pre>
<a href="javascript:Ox.tmp.dialog('xxx')">try it out</a>
<p>foo bar</p>
<pre class="code">/*@
My.Request &lt;o&gt; Remote request utility
@*/
My.Request = (function()
// ...
r
)();</pre>