jquery/docs/js/doc.js

35 lines
1.6 KiB
JavaScript
Raw Normal View History

2006-08-09 07:44:05 +02:00
var rules = {
self: "{$}",
type: function(a){ /*console.log( a, types[a] );*/ return types[a]; },
"self[*]": "<li><span class='type'><span title='{@type($.type)}'>{$.type}</span></span> <span class='fn'>" +
"<a href='#{$.name}' class='name' title='{$.name}: {$.short}'>{$.name}</a>({$.params})</span>" +
"<div class='short'>{$.short}</div><div class='more'><div class='desc'>{$.desc}</div>{$.examples}</div></li>",
2006-08-13 05:05:31 +02:00
trim: function(a){ console.log( a ); return !a || a.replace(/, $/); },
"self[*].params[*]": " <span class='arg-type' title='{@type($.type)}'>{$.type}</span> <span class='arg-name' title='{$.desc}'>{$.name}</span>, ",
2006-08-09 07:44:05 +02:00
"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>"
};
var types = {
jQuery: "A jQuery object.",
Object: "A simple Javascript object. For example, it could be a String or a Number.",
String: "A string of characters.",
Number: "A numeric valid.",
Element: "The Javascript object representation of a DOM Element.",
Hash: "A Javascript object that contains key/value pairs in the form of properties and values.",
"Array&lt;Element&gt;": "An Array of DOM Elements.",
"Array&lt;String&gt;": "An Array of strings.",
Function: "A reference to a Javascript function."
};
2006-08-13 05:05:31 +02:00
$(document).ready(function(){
$("span[@title]").addClass("tooltip").ToolTipDemo('#fff');
$("a.name").click(function(){
$("div.more,div.short",this.parentNode.parentNode).toggle().find("div.desc",function(){
$(this).html( $(this).html().replace(/\n\n/g, "<br/><br/>") );
2006-08-09 07:44:05 +02:00
});
2006-08-13 05:05:31 +02:00
return false;
2006-08-09 07:44:05 +02:00
});
2006-08-13 05:05:31 +02:00
$("#docs").alphaPager( 1 );
});