Updated the docs for a number of methods.
[jquery.git] / docs / doc.js
1 var rules = {
2         self: "{$}",
3         type: function(a){ /*console.log( a, types[a] );*/ return types[a]; },
4         "self[*]": "<li><span class='type'><span title='{@type($.type)}'>{$.type}</span></span> <span class='fn'>" + 
5                 "<a href='#{$.name}' class='name' title='{$.name}: {$.short}'>{$.name}</a>({$.params})</span>" + 
6                 "<div class='short'>{$.short}</div><div class='more'><div class='desc'>{$.desc}</div>{$.examples}</div></li>",
7         "self[*].params[*]": " <span class='arg-type' title='{@type($.type)}'>{$.type}</span> <span class='arg-name' title='{$.desc}'>{$.name}</span> ",
8         "self[*].examples[*]": "<div class='example'><h5>Example:</h5><p>{$.desc}</p><pre>{$.code}</pre><b>HTML:</b><pre>{$.before}</pre><b>Result:</b><pre>{$.result}</pre></div>"
9 };
10
11 var types = {
12         jQuery: "A jQuery object.",
13         Object: "A simple Javascript object. For example, it could be a String or a Number.",
14         String: "A string of characters.",
15         Number: "A numeric valid.",
16         Element: "The Javascript object representation of a DOM Element.",
17         Hash: "A Javascript object that contains key/value pairs in the form of properties and values.",
18         "Array&lt;Element&gt;": "An Array of DOM Elements.",
19         "Array&lt;String&gt;": "An Array of strings.",
20         Function: "A reference to a Javascript function."
21 };
22
23 function docsLoaded(docs) {
24         // Make sure that there are no private functions
25         docs = jQuery.grep( docs, "!a.private" )
26                 // Sort by function name
27                 .sort(function(a,b){
28                         if ( a.name < b.name ) return -1;
29                         else if ( a.name == b.name ) {
30                                 // Sort by number of parameters
31                                 if ( a.params.length < b.params.length ) return -1;
32                                 else if ( a.params.length == b.params.length ) return 0;
33                                 else return 1;
34                         } else return 1;
35                 });
36
37         // Put in the DOM, when it's ready
38         $(document).ready(function(){
39                 $("#docs").html( jsonT( docs, rules ) );
40                 setTimeout(function(){
41                 $("#docs").pager( function(){return this.firstChild.nextSibling.nextSibling.firstChild.innerHTML;}, function(s,e){
42                         $(this).html( jsonT( docs.slice( s, e ), rules ) );
43                         /*$(this).slideUp("slow",function(){
44                                 this.style.opacity = 1;
45                                 this.style.width = "";
46                                 this.style.height = "";
47                                 $(this).html( jsonT( docs.slice( s, e ), rules ) );
48                                 $(this).slideDown("slow");
49                         });*/
50                         $("span",this).filter("[@title]").addClass("tooltip").ToolTipDemo('#fff');
51                         $("a.name",this).click(function(){
52                                 $("div.more,div.short",this.parentNode.parentNode).toggle();
53                                 return false;
54                         });
55                 });
56                 }, 13);
57         });
58 }