X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=docs%2Fdoc.js;fp=docs%2Fdoc.js;h=d2561148712164ce83e24ebbcfa5eb11b54a7547;hb=f2d4bffcc760eb03dae13a9d9e7f0bbd8ec33c1e;hp=0000000000000000000000000000000000000000;hpb=49747af6b1feceb4b9ca96815bfefc214df13abc;p=jquery.git
diff --git a/docs/doc.js b/docs/doc.js
new file mode 100644
index 0000000..d256114
--- /dev/null
+++ b/docs/doc.js
@@ -0,0 +1,58 @@
+var rules = {
+ self: "{$}",
+ type: function(a){ /*console.log( a, types[a] );*/ return types[a]; },
+ "self[*]": "
{$.type} " +
+ "{$.name}({$.params})" +
+ "{$.short}
",
+ "self[*].params[*]": " {$.type} {$.name} ",
+ "self[*].examples[*]": "Example:
{$.desc}
{$.code}
HTML:{$.before}
Result:{$.result}
"
+};
+
+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<Element>": "An Array of DOM Elements.",
+ "Array<String>": "An Array of strings.",
+ Function: "A reference to a Javascript function."
+};
+
+function docsLoaded(docs) {
+ // Make sure that there are no private functions
+ docs = jQuery.grep( docs, "!a.private" )
+ // Sort by function name
+ .sort(function(a,b){
+ if ( a.name < b.name ) return -1;
+ else if ( a.name == b.name ) {
+ // Sort by number of parameters
+ if ( a.params.length < b.params.length ) return -1;
+ else if ( a.params.length == b.params.length ) return 0;
+ else return 1;
+ } else return 1;
+ });
+
+ // Put in the DOM, when it's ready
+ $(document).ready(function(){
+ $("#docs").html( jsonT( docs, rules ) );
+ setTimeout(function(){
+ $("#docs").pager( function(){return this.firstChild.nextSibling.nextSibling.firstChild.innerHTML;}, function(s,e){
+ $(this).html( jsonT( docs.slice( s, e ), rules ) );
+ /*$(this).slideUp("slow",function(){
+ this.style.opacity = 1;
+ this.style.width = "";
+ this.style.height = "";
+ $(this).html( jsonT( docs.slice( s, e ), rules ) );
+ $(this).slideDown("slow");
+ });*/
+ $("span",this).filter("[@title]").addClass("tooltip").ToolTipDemo('#fff');
+ $("a.name",this).click(function(){
+ $("div.more,div.short",this.parentNode.parentNode).toggle();
+ return false;
+ });
+ });
+ }, 13);
+ });
+}