forked from gibber-cc/gibberish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docs.html
143 lines (134 loc) · 3.86 KB
/
docs.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<html>
<head>
<title>Gibberish Reference</title>
<script src="./build/gibberish.js"></script>
<script src="./scripts/documentation_output.js"></script>
<script src="./scripts/zepto.js"></script>
<style>
pre {
margin-left: 10px;
}
body {
font-family: "HelveticaNeue-Light", sans-serif;
background:#fff;
}
h1, h2 {
font-weight: normal;
}
h3 { color :#666; }
ul {
padding:0;
list-decoration:none;
}
</style>
<script>
window.displayTOC = function() {
$("#toc").empty();
for (var key in Gibberish.toc) {
var cat = Gibberish.toc[key];
if (cat.length > 0) {
var ul = $("<ul style='list-style:none; padding: 0px 5px;'>");
var h2 = $("<h2>" + key + "</h2>");
for (var i = 0; i < cat.length; i++) {
var li = $("<li>");
var a = $("<a style='cursor:pointer'>");
(function() {
var text = cat[i];
a.text(text);
a.click(function() {
displayDocs(text);
});
})();
$(li).append(a);
$(ul).append(li);
}
$("#toc").append(h2);
$("#toc").append(ul);
}
}
};
window.displayDocs = function(obj) {
if (typeof Gibberish.docs[obj] === "undefined") return;
$("#docs").html(Gibberish.docs[obj].text);
$("#docs").append("<h2>Methods</h2>");
var count = 0;
for (var key in Gibberish.docs[obj].methods) {
var html = $("<div style='padding-top:5px'>" + Gibberish.docs[obj].methods[key] + "</div>");
var bgColor = count++ % 2 === 0 ? "#eee" : "#fff";
$(html).css({
"background-color": bgColor,
"border-color": "#ccc",
"border-width": "0px 0px 1px 0px",
"border-style": "solid",
});
$("#docs").append(html);
}
$("#docs").append("<h2>Properties</h2>");
for (var key in Gibberish.docs[obj].properties) {
var html = $("<div style='padding-top:5px'>" + Gibberish.docs[obj].properties[key] + "</div>");
var bgColor = count++ % 2 === 0 ? "#eee" : "#fff";
$(html).css({
"background-color": bgColor,
"border-color": "#ccc",
"border-width": "0px 0px 1px 0px",
"border-style": "solid",
});
$("#docs").append(html);
}
};
$(window).on('load', function(e) {
//$("#toc").on('click', function(e){ displayTOC(); });
var tags = [];
Gibberish.toc = {};
for (var key in Gibberish.docs) {
var obj = Gibberish.docs[key];
tags.push({
text: key,
obj: key,
type: "object",
class: obj.key,
});
if (typeof Gibberish.toc[obj.type] === "undefined") {
Gibberish.toc[obj.type] = [];
}
Gibberish.toc[obj.type].push(key);
if (typeof obj.methods !== "undefined") {
for (var method in obj.methods) {
tags.push({
text: method + "( " + key + " )",
obj: key,
type: "method",
name: method,
});
}
}
if (typeof obj.properties !== "undefined") {
for (var prop in obj.properties) {
tags.push({
text: prop + "( " + key + " )",
obj: key,
type: "property",
name: prop,
});
}
}
}
Gibberish.tags = tags;
displayTOC();
});
</script>
</head>
<body>
<div id='header' style="background-color:#555;" >
<h1 style="color:white; display:inline; margin-right:3em">Gibberish Reference</h1>
<a href="index.html" style="color:#fff">back to Gibberish demo</a>
<!--<a id='toc'>TOC</a>-->
</div>
<div id='content'>
<div id='toc' style='float:left; width:20%;'>
</div>
<div id='docs' style="float:right; width:79%; border-left:1px solid #eee">
</div>
</div>
</body>
</html>