a608afd5b9cdc2631d55167e1626e645cc587d42
[jquery.git] / docs / js / 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         trim: function(a){ console.log( a ); return !a || a.replace(/, $/); },
8         "self[*].params[*]": " <span class='arg-type' title='{@type($.type)}'>{$.type}</span> <span class='arg-name' title='{$.desc}'>{$.name}</span>, ",
9         "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>"
10 };
11
12 var types = {
13         jQuery: "A jQuery object.",
14         Object: "A simple Javascript object. For example, it could be a String or a Number.",
15         String: "A string of characters.",
16         Number: "A numeric valid.",
17         Element: "The Javascript object representation of a DOM Element.",
18         Hash: "A Javascript object that contains key/value pairs in the form of properties and values.",
19         "Array&lt;Element&gt;": "An Array of DOM Elements.",
20         "Array&lt;String&gt;": "An Array of strings.",
21         Function: "A reference to a Javascript function."
22 };
23
24 $(document).ready(function(){
25         $("span[@title]").addClass("tooltip").ToolTipDemo('#fff');
26         $("a.name").click(function(){
27                 $("div.more,div.short",this.parentNode.parentNode).toggle().find("div.desc",function(){
28                         $(this).html( $(this).html().replace(/\n\n/g, "<br/><br/>") );
29                 });
30                 return false;
31         });
32
33         $("#docs").alphaPager( 1 );
34 });