some fancy stuff in readme
This commit is contained in:
parent
dfb96e6649
commit
369ce48af2
1 changed files with 92 additions and 0 deletions
92
readme/html/OxDoc.html
Normal file
92
readme/html/OxDoc.html
Normal file
|
@ -0,0 +1,92 @@
|
|||
<script>
|
||||
Ox.tmp = {
|
||||
dialog: function(id) {
|
||||
var source = Ox.decodeHTMLEntities(Ox.stripTags(
|
||||
$('#' + id).html()
|
||||
.replace(/ /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 <number> 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 <function> Returns the protocol part of a URL
|
||||
(url) -> <string> Protocol, like "https", otherwise ""
|
||||
url <string> 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 <f> Reads data from a remote URL
|
||||
(url, callback) -> <o> Request handler
|
||||
(url, options, callback) -> <o> Request handler
|
||||
cancel <f> Function to cancel the request
|
||||
url <s> Remote URL
|
||||
options <o> Optional config object
|
||||
timeout <n|60> Timeout in seconds
|
||||
type <s|'GET'> Request type ('GET', 'POST', 'PUT' or 'DELETE')
|
||||
callback <f> Callback function
|
||||
result <o> Result object
|
||||
status <n> HTTP status code
|
||||
data <s> 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 <o> Remote request utility
|
||||
@*/
|
||||
My.Request = (function()
|
||||
// ...
|
||||
r
|
||||
)();</pre>
|
Loading…
Reference in a new issue