starkfish 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +26 -0
  3. data/lib/rdoc/discover.rb +30 -0
  4. data/lib/rdoc/generator/starkfish.rb +523 -0
  5. data/lib/rdoc/generator/template/starkfish/classpage.rhtml +305 -0
  6. data/lib/rdoc/generator/template/starkfish/filepage.rhtml +113 -0
  7. data/lib/rdoc/generator/template/starkfish/images/brick.png +0 -0
  8. data/lib/rdoc/generator/template/starkfish/images/brick_link.png +0 -0
  9. data/lib/rdoc/generator/template/starkfish/images/bug.png +0 -0
  10. data/lib/rdoc/generator/template/starkfish/images/bullet_black.png +0 -0
  11. data/lib/rdoc/generator/template/starkfish/images/bullet_toggle_minus.png +0 -0
  12. data/lib/rdoc/generator/template/starkfish/images/bullet_toggle_plus.png +0 -0
  13. data/lib/rdoc/generator/template/starkfish/images/date.png +0 -0
  14. data/lib/rdoc/generator/template/starkfish/images/find.png +0 -0
  15. data/lib/rdoc/generator/template/starkfish/images/loadingAnimation.gif +0 -0
  16. data/lib/rdoc/generator/template/starkfish/images/macFFBgHack.png +0 -0
  17. data/lib/rdoc/generator/template/starkfish/images/package.png +0 -0
  18. data/lib/rdoc/generator/template/starkfish/images/page_green.png +0 -0
  19. data/lib/rdoc/generator/template/starkfish/images/page_white_text.png +0 -0
  20. data/lib/rdoc/generator/template/starkfish/images/page_white_width.png +0 -0
  21. data/lib/rdoc/generator/template/starkfish/images/plugin.png +0 -0
  22. data/lib/rdoc/generator/template/starkfish/images/ruby.png +0 -0
  23. data/lib/rdoc/generator/template/starkfish/images/tag_green.png +0 -0
  24. data/lib/rdoc/generator/template/starkfish/images/wrench.png +0 -0
  25. data/lib/rdoc/generator/template/starkfish/images/wrench_orange.png +0 -0
  26. data/lib/rdoc/generator/template/starkfish/images/zoom.png +0 -0
  27. data/lib/rdoc/generator/template/starkfish/index.rhtml +57 -0
  28. data/lib/rdoc/generator/template/starkfish/js/darkfish.js +116 -0
  29. data/lib/rdoc/generator/template/starkfish/js/jquery.js +32 -0
  30. data/lib/rdoc/generator/template/starkfish/js/quicksearch.js +114 -0
  31. data/lib/rdoc/generator/template/starkfish/js/thickbox-compressed.js +10 -0
  32. data/lib/rdoc/generator/template/starkfish/rdoc.css +597 -0
  33. data/lib/rdoc/generator/template/starkfish.rhtml +3 -0
  34. metadata +90 -0
@@ -0,0 +1,305 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7
+
8
+ <title><%= classinfo[:classmod] %>: <%= classinfo[:full_name] %></title>
9
+
10
+ <link rel="stylesheet" href="<%= rel_prefix %>/rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="<%= rel_prefix %>/js/jquery.js" type="text/javascript"
13
+ charset="utf-8"></script>
14
+ <script src="<%= rel_prefix %>/js/thickbox-compressed.js" type="text/javascript"
15
+ charset="utf-8"></script>
16
+ <script src="<%= rel_prefix %>/js/quicksearch.js" type="text/javascript"
17
+ charset="utf-8"></script>
18
+ <script src="<%= rel_prefix %>/js/darkfish.js" type="text/javascript"
19
+ charset="utf-8"></script>
20
+
21
+ </head>
22
+ <body class="<%= classinfo[:classmod].downcase %>">
23
+
24
+ <div id="metadata">
25
+ <div id="file-metadata">
26
+ <div id="file-list-section" class="section">
27
+ <h3 class="section-header">In Files</h3>
28
+ <div class="section-body">
29
+ <ul>
30
+ <% classinfo[:infiles].each do |file| %>
31
+ <li><a href="<%= rel_prefix %>/<%= file[:full_path] %>.html?TB_iframe=true&amp;height=550&amp;width=785"
32
+ class="thickbox" title="<%= file[:full_path] %>"><%= file[:full_path] %></a></li>
33
+ <% end %>
34
+ </ul>
35
+ </div>
36
+ </div>
37
+
38
+ <% if !svninfo.empty? %>
39
+ <div id="file-svninfo-section" class="section">
40
+ <h3 class="section-header">Subversion Info</h3>
41
+ <div class="section-body">
42
+ <dl class="svninfo">
43
+ <dt>Rev</dt>
44
+ <dd><%= svninfo[:rev] %></dd>
45
+
46
+ <dt>Last Checked In</dt>
47
+ <dd><%= svninfo[:commitdate].strftime('%Y-%m-%d %H:%M:%S') %>
48
+ (<%= svninfo[:commitdelta] %> ago)</dd>
49
+
50
+ <dt>Checked in by</dt>
51
+ <dd><%= svninfo[:committer] %></dd>
52
+ </dl>
53
+ </div>
54
+ </div>
55
+ <% end %>
56
+ </div>
57
+
58
+ <div id="class-metadata">
59
+
60
+ <!-- Parent Class -->
61
+ <% if classinfo[:classmod] == 'Class' %>
62
+ <div id="parent-class-section" class="section">
63
+ <h3 class="section-header">Parent</h3>
64
+ <% if classinfo[:par_url] %>
65
+ <p class="link"><a href="<%= classinfo[:par_url] %>"><%= classinfo[:parent] %></a></p>
66
+ <% else %>
67
+ <p class="link"><%= classinfo[:parent] %></p>
68
+ <% end %>
69
+ </div>
70
+ <% end %>
71
+
72
+ <!-- Namespace Contents -->
73
+ <% if classinfo[:sections].first.key?( :classlist ) %>
74
+ <div id="namespace-list-section" class="section">
75
+ <h3 class="section-header">Namespace</h3>
76
+ <ul class="link-list">
77
+ <% classinfo[:sections].first[:classlist].each do |desc| %>
78
+ <li><%= desc.sub(/^(\w+)/, %Q{<span class="type">\\1</span>}) %></li>
79
+ <% end %>
80
+ </ul>
81
+ </div>
82
+ <% end %>
83
+
84
+ <!-- Method Quickref -->
85
+ <% if classinfo.key?( :methods ) %>
86
+ <div id="method-list-section" class="section">
87
+ <h3 class="section-header">Methods</h3>
88
+ <ul class="link-list">
89
+ <% classinfo[:methods].each do |meth| %>
90
+ <li><a href="#<%= meth[:name] %>"><%= meth[:name] %></a></li>
91
+ <% end %>
92
+ </ul>
93
+ </div>
94
+ <% end %>
95
+
96
+ <!-- Included Modules -->
97
+ <% if classinfo[:includes] %>
98
+ <div id="includes-section" class="section">
99
+ <h3 class="section-header">Included Modules</h3>
100
+ <ul class="link-list">
101
+ <% classinfo[:includes].each do |inc| %>
102
+ <% if inc[:aref].nil? %>
103
+ <li><span class="include"><%= inc[:name] %></span></li>
104
+ <% else %>
105
+ <li><a class="include" href="<%= inc[:aref] %>"><%= inc[:name] %></a></li>
106
+ <% end %>
107
+ <% end %>
108
+ </ul>
109
+ </div>
110
+ <% end %>
111
+ </div>
112
+
113
+ <div id="project-metadata">
114
+ <% simple_files = files.select {|_, file| file[:parser] == RDoc::Parser::Simple } %>
115
+ <% unless simple_files.empty? then %>
116
+ <div id="fileindex-section" class="section project-section">
117
+ <h3 class="section-header">Files</h3>
118
+ <ul>
119
+ <% simple_files.sort_by {|name,_| name }.each do |name, file| %>
120
+ <li class="file"><a href="<%= rel_prefix %>/<%= file[:short_name] %>.html"><%= h file[:short_name] %></a></li>
121
+ <% end %>
122
+ </ul>
123
+ </div>
124
+ <% end %>
125
+
126
+ <div id="classindex-section" class="section project-section">
127
+ <h3 class="section-header">Class Index
128
+ <span class="search-toggle"><img src="<%= rel_prefix %>/images/find.png"
129
+ height="16" width="16" alt="[+]"
130
+ title="show/hide quicksearch" /></span></h3>
131
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
132
+ <fieldset>
133
+ <legend>Quicksearch</legend>
134
+ <input type="text" name="quicksearch" value=""
135
+ class="quicksearch-field" />
136
+ </fieldset>
137
+ </form>
138
+
139
+ <ul class="link-list">
140
+ <% modsort.each do |cname| %>
141
+ <% cinfo = classes[cname] %>
142
+ <li><a href="<%= rel_prefix %>/<%= cinfo[:outfile] %>"><%= cname %></a></li>
143
+ <% end %>
144
+ </ul>
145
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
146
+ </div>
147
+
148
+ <% if $DEBUG %>
149
+ <div id="debugging-toggle"><img src="<%= rel_prefix %>/images/bug.png"
150
+ alt="toggle debugging" height="16" width="16" /></div>
151
+ <% end %>
152
+ </div>
153
+ </div>
154
+
155
+ <div id="documentation">
156
+ <% if classinfo[:classmod] == 'Class' %>
157
+ <h1 class="class"><%= classinfo[:full_name] %></h1>
158
+ <% else %>
159
+ <h1 class="module"><%= classinfo[:full_name] %></h1>
160
+ <% end %>
161
+
162
+ <div id="description">
163
+ <%= classinfo[:description] %>
164
+ </div>
165
+
166
+
167
+ <!-- Constants -->
168
+ <% if classinfo[:sections].first[:constants] %>
169
+ <div id="constants-list" class="section">
170
+ <h3 class="section-header">Constants</h3>
171
+ <dl>
172
+ <% classinfo[:sections].first[:constants].each do |const| %>
173
+ <dt><a name="<%= const[:name] %>"><%= const[:name] %></a></dt>
174
+ <% if const[:desc] %>
175
+ <dd class="description"><%= const[:desc].strip %></dd>
176
+ <% else %>
177
+ <dd class="description missing-docs">(Not documented)</dd>
178
+ <% end %>
179
+ <% end %>
180
+ </dl>
181
+ </div>
182
+ <% end %>
183
+
184
+ <!-- Attributes -->
185
+ <% if classinfo[:sections].first[:attributes] %>
186
+ <div id="attribute-method-details" class="method-section section">
187
+ <h3 class="section-header">Attributes</h3>
188
+
189
+ <% classinfo[:sections].first[:attributes].each do |attrib| %>
190
+ <div id="<%= attrib[:name].downcase.gsub(/[^a-z]+/, '-') %>-attribute-method" class="method-detail">
191
+ <a name="<%= attrib[:name] %>"></a>
192
+ <% if attrib[:rw] =~ /w/i %>
193
+ <a name="<%= attrib[:name] %>="></a>
194
+ <% end %>
195
+ <div class="method-heading attribute-method-heading">
196
+ <span class="method-name"><%= h attrib[:name] %></span><span
197
+ class="attribute-access-type">[<%= attrib[:rw] %>]</span>
198
+ </div>
199
+
200
+ <div class="method-description">
201
+ <% if attrib[:a_desc] && !attrib[:a_desc].empty? %>
202
+ <%= attrib[:a_desc].strip %>
203
+ <% else %>
204
+ <p class="missing-docs">(Not documented)</p>
205
+ <% end %>
206
+ </div>
207
+ </div>
208
+ <% end %>
209
+ </div>
210
+ <% end %>
211
+
212
+ <!-- Methods -->
213
+ <% if classinfo[:sections].first[:method_list] %>
214
+ <% classinfo[:sections].first[:method_list].each do |methodlist| %>
215
+ <div id="<%= methodlist[:type].downcase %>-<%= methodlist[:category].downcase %>-method-details" class="method-section section">
216
+ <h3 class="section-header"><%= methodlist[:type] %> <%= methodlist[:category] %> Methods</h3>
217
+
218
+ <% methodlist[:methods].each do |methodinfo| %>
219
+
220
+ <%
221
+ # If the method doesn't have a 'name' attribute, it's defined in C, so make one out of the
222
+ # first method name in the callseq.
223
+ unless methodinfo[:name]
224
+ methodinfo[:name] = methodinfo[:callseq][/^.*?\.(\w+)/, 1] || methodinfo[:callseq]
225
+ end
226
+
227
+ %>
228
+ <% if methodinfo[:m_desc] =~ /Alias for/ %>
229
+ <div id="<%= methodinfo[:name].gsub( /[^a-z]+/, '-' ) %>-method" class="method-detail method-alias">
230
+ <% else %>
231
+ <div id="<%= methodinfo[:name].gsub( /[^a-z]+/, '-' ) %>-method" class="method-detail">
232
+ <% end %>
233
+ <a name="<%= methodinfo[:name] %>"></a>
234
+
235
+ <div class="method-heading">
236
+ <% if methodinfo[:callseq] %>
237
+ <span class="method-callseq"><%= methodinfo[:callseq].strip.gsub( /^\w.*?\./m, '') %></span>
238
+ <span class="method-click-advice">click to toggle source</span>
239
+ <% else %>
240
+ <span class="method-name"><%= methodinfo[:name] %></span><span
241
+ class="method-args"><%= methodinfo[:params] %></span>
242
+ <span class="method-click-advice">click to toggle source</span>
243
+ <% end %>
244
+ </div>
245
+
246
+ <div class="method-description">
247
+ <% if methodinfo[:m_desc] %>
248
+ <%= methodinfo[:m_desc].strip.gsub(%r{<a href="(.*?)#\w+">(.*?)</a>}) do |m|
249
+ %{<a class="xref" href="#$1#$2">#$2</a>}
250
+ end
251
+ %>
252
+ <% else %>
253
+ <p class="missing-docs">(Not documented)</p>
254
+ <% end %>
255
+
256
+ <% if methodinfo[:sourcecode] %>
257
+ <div class="method-source-code"
258
+ id="<%= methodinfo[:name].gsub( /[^a-z]+/, '-' ) %>-source">
259
+ <pre>
260
+ <%= methodinfo[:sourcecode] %>
261
+ </pre>
262
+ </div>
263
+ <% end %>
264
+ </div>
265
+
266
+ <% if methodinfo[:aka] %>
267
+ <div class="aliases">
268
+ Also aliased as: <%= methodinfo[:aka].collect do |aliasinfo|
269
+ %{<a class="xref alias" href="##{aliasinfo[:name]}">##{aliasinfo[:name]}</a>}
270
+ end.join(", ") %>
271
+ </div>
272
+ <% end %>
273
+ </div>
274
+
275
+ <% end %>
276
+ </div>
277
+ <% end %>
278
+ <% end %>
279
+
280
+ </div>
281
+
282
+
283
+ <div id="rdoc-debugging-section-dump" class="debugging-section">
284
+ <% if $DEBUG %>
285
+ <% classinfo[:sections].first.keys.each do |section| %>
286
+ <div class="section">
287
+ <h2 class="section-header"><%= section %></h2>
288
+
289
+ <pre><%= h classinfo[:sections].first[section].to_yaml %></pre>
290
+ </div>
291
+ <% end %>
292
+ <% else %>
293
+ <p>Disabled; run with $DEBUG to generate this.</p>
294
+ <% end %>
295
+ </div>
296
+
297
+ <div id="validator-badges">
298
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
299
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
300
+ Rdoc Generator</a> <%= RDoc::Generator::Darkfish::VERSION %></small>.</p>
301
+ </div>
302
+
303
+ </body>
304
+ </html>
305
+
@@ -0,0 +1,113 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
+ <head>
7
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
8
+
9
+ <title><%= fileinfo[:title] %></title>
10
+
11
+ <link type="text/css" media="screen" href="<%= rel_prefix %>/rdoc.css" rel="stylesheet" />
12
+
13
+ <script src="<%= rel_prefix %>/js/jquery.js" type="text/javascript"
14
+ charset="utf-8"></script>
15
+ <script src="<%= rel_prefix %>/js/thickbox-compressed.js" type="text/javascript"
16
+ charset="utf-8"></script>
17
+ <script src="<%= rel_prefix %>/js/quicksearch.js" type="text/javascript"
18
+ charset="utf-8"></script>
19
+ <script src="<%= rel_prefix %>/js/darkfish.js" type="text/javascript"
20
+ charset="utf-8"></script>
21
+ </head>
22
+
23
+ <% if fileinfo[:parser] == RDoc::Parser::Simple %>
24
+ <body class="file">
25
+ <div id="metadata">
26
+ <div id="project-metadata">
27
+ <% simple_files = files.select {|_, file| file[:parser] == RDoc::Parser::Simple } %>
28
+ <% unless simple_files.empty? then %>
29
+ <div id="fileindex-section" class="section project-section">
30
+ <h3 class="section-header">Files</h3>
31
+ <ul>
32
+ <% simple_files.sort_by {|name,_| name }.each do |name, file| %>
33
+ <li class="file"><a href="<%= rel_prefix %>/<%=
34
+ file[:short_name] %>.html"><%= h file[:short_name] %></a></li>
35
+ <% end %>
36
+ </ul>
37
+ </div>
38
+ <% end %>
39
+
40
+ <div id="classindex-section" class="section project-section">
41
+ <h3 class="section-header">Class Index
42
+ <span class="search-toggle"><img src="<%= rel_prefix %>/images/find.png"
43
+ height="16" width="16" alt="[+]"
44
+ title="show/hide quicksearch" /></span></h3>
45
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
46
+ <fieldset>
47
+ <legend>Quicksearch</legend>
48
+ <input type="text" name="quicksearch" value=""
49
+ class="quicksearch-field" />
50
+ </fieldset>
51
+ </form>
52
+
53
+ <ul class="link-list">
54
+ <% modsort.each do |cname| %>
55
+ <% cinfo = classes[cname] %>
56
+ <li><a href="<%= rel_prefix %>/<%= cinfo[:outfile] %>"><%= cname %></a></li>
57
+ <% end %>
58
+ </ul>
59
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
60
+ </div>
61
+
62
+ <% if $DEBUG %>
63
+ <div id="debugging-toggle"><img src="<%= rel_prefix %>/images/bug.png"
64
+ alt="toggle debugging" height="16" width="16" /></div>
65
+ <% end %>
66
+ </div>
67
+ </div>
68
+
69
+ <div id="documentation">
70
+ <%= fileinfo[:description] %>
71
+ </div>
72
+
73
+ <div id="validator-badges">
74
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
75
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
76
+ Rdoc Generator</a> <%= RDoc::Generator::Darkfish::VERSION %></small>.</p>
77
+ </div>
78
+ </body>
79
+ <% else %>
80
+ <body class="file file-popup">
81
+ <div id="metadata">
82
+ <dl>
83
+ <dt class="modified-date">Last Modified</dt>
84
+ <dd class="modified-date"><%= fileinfo[:dtm_modified] %></dd>
85
+
86
+ <% if fileinfo[:requires] %>
87
+ <dt class="requires">Requires</dt>
88
+ <dd class="requires">
89
+ <ul>
90
+ <% fileinfo[:requires].each do |dependency| %>
91
+ <li><%= dependency[:name] %></li>
92
+ <% end %>
93
+ </ul>
94
+ </dd>
95
+ <% end %>
96
+
97
+ <% if fileinfo[:cvsurl] %>
98
+ <dt class="scs-url">Trac URL</dt>
99
+ <dd class="scs-url"><a target="_top"
100
+ href="<%= fileinfo[:cvsurl] %>"><%= fileinfo[:cvsurl] %></a></dd>
101
+ <% end %>
102
+ </dl>
103
+
104
+ <% if fileinfo[:description] %>
105
+ <div class="description">
106
+ <h2>Description</h2>
107
+ <%= fileinfo[:description] %>
108
+ </div>
109
+ <% end %>
110
+ </div>
111
+ </body>
112
+ <% end %>
113
+ </html>
@@ -0,0 +1,57 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
6
+ <head>
7
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
8
+
9
+ <title><%= h options.title %></title>
10
+
11
+ <link type="text/css" media="screen" href="<%= options.css %>" rel="stylesheet" />
12
+
13
+ <script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
15
+ <script src="js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
16
+ <script src="js/darkfish.js" type="text/javascript" charset="utf-8"></script>
17
+
18
+ </head>
19
+ <body class="indexpage">
20
+
21
+ <% $stderr.sync = true %>
22
+ <h1><%= h options.title %></h1>
23
+
24
+ <% if options.main_page && files.key?( options.main_page ) %>
25
+ <div id="main">
26
+ <%= files[ options.main_page ][:description].sub(%r{^\s*<h1.*?/h1>}i, '') %>
27
+ </div>
28
+ <% else %>
29
+ <p>This is the API documentation for '<%= options.title %>'.</p>
30
+ <% end %>
31
+
32
+ <% simple_files = files.select {|_, file| file[:parser] == RDoc::Parser::Simple } %>
33
+ <% unless simple_files.empty? then %>
34
+ <h2>Files</h2>
35
+ <ul>
36
+ <% simple_files.sort_by {|name,_| name }.each do |name, file| %>
37
+ <li class="file"><a href="<%= file[:short_name] %>.html"><%= h file[:short_name] %></a></li>
38
+ <% end %>
39
+ </ul>
40
+ <% end %>
41
+
42
+ <h2>Classes/Modules</h2>
43
+ <ul>
44
+ <% modsort.each do |classname| %>
45
+ <% classdata = classes[classname] %>
46
+ <li class="<%= classdata[:classmod].downcase %>"><a
47
+ href="<%= classdata[:full_name].gsub( /::/, '/' ) + '.html' %>"><%= classdata[:full_name] %></a></li>
48
+ <% end %>
49
+ </ul>
50
+
51
+ <div id="validator-badges">
52
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
53
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
54
+ Rdoc Generator</a> <%= RDoc::Generator::Darkfish::VERSION %></small>.</p>
55
+ </div>
56
+ </body>
57
+ </html>
@@ -0,0 +1,116 @@
1
+ /**
2
+ *
3
+ * Darkfish Page Functions
4
+ * $Id$
5
+ *
6
+ * Author: Michael Granger <mgranger@laika.com>
7
+ *
8
+ */
9
+
10
+ /* Provide console simulation for firebug-less environments */
11
+ if (!("console" in window) || !("firebug" in console)) {
12
+ var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
13
+ "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
14
+
15
+ window.console = {};
16
+ for (var i = 0; i < names.length; ++i)
17
+ window.console[names[i]] = function() {};
18
+ };
19
+
20
+
21
+ /**
22
+ * Unwrap the first element that matches the given @expr@ from the targets and return them.
23
+ */
24
+ $.fn.unwrap = function( expr ) {
25
+ return this.each( function() {
26
+ $(this).parents( expr ).eq( 0 ).after( this ).remove();
27
+ });
28
+ };
29
+
30
+
31
+ function showSource( e ) {
32
+ var target = e.target;
33
+ var codeSections = $(target).
34
+ parents('.method-detail').
35
+ find('.method-source-code');
36
+
37
+ $(target).
38
+ parents('.method-detail').
39
+ find('.method-source-code').
40
+ slideToggle();
41
+ };
42
+
43
+ function hookSourceViews() {
44
+ $('.method-description,.method-heading').click( showSource );
45
+ };
46
+
47
+ function toggleDebuggingSection() {
48
+ $('.debugging-section').slideToggle();
49
+ };
50
+
51
+ function hookDebuggingToggle() {
52
+ $('#debugging-toggle img').click( toggleDebuggingSection );
53
+ };
54
+
55
+ function hookQuickSearch() {
56
+ $('.quicksearch-field').each( function() {
57
+ var searchElems = $(this).parents('.section').find( 'li' );
58
+ var toggle = $(this).parents('.section').find('h3 .search-toggle');
59
+ // console.debug( "Toggle is: %o", toggle );
60
+ var qsbox = $(this).parents('form').get( 0 );
61
+
62
+ $(this).quicksearch( this, searchElems, {
63
+ noSearchResultsIndicator: 'no-class-search-results',
64
+ focusOnLoad: false
65
+ });
66
+ $(toggle).click( function() {
67
+ // console.debug( "Toggling qsbox: %o", qsbox );
68
+ $(qsbox).toggle();
69
+ });
70
+ });
71
+ };
72
+
73
+ function highlightTarget( anchor ) {
74
+ console.debug( "Highlighting target '%s'.", anchor );
75
+
76
+ $("a[name=" + anchor + "]").each( function() {
77
+ if ( !$(this).parent().parent().hasClass('target-section') ) {
78
+ console.debug( "Wrapping the target-section" );
79
+ $('div.method-detail').unwrap( 'div.target-section' );
80
+ $(this).parent().wrap( '<div class="target-section"></div>' );
81
+ } else {
82
+ console.debug( "Already wrapped." );
83
+ }
84
+ });
85
+ };
86
+
87
+ function highlightLocationTarget() {
88
+ console.debug( "Location hash: %s", window.location.hash );
89
+ if ( ! window.location.hash || window.location.hash.length == 0 ) return;
90
+
91
+ var anchor = window.location.hash.substring(1);
92
+ console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" );
93
+
94
+ highlightTarget( anchor );
95
+ };
96
+
97
+ function highlightClickTarget( event ) {
98
+ console.debug( "Highlighting click target for event %o", event.target );
99
+ try {
100
+ var anchor = $(event.target).attr( 'href' ).substring(1);
101
+ console.debug( "Found target anchor: %s", anchor );
102
+ highlightTarget( anchor );
103
+ } catch ( err ) {
104
+ console.error( "Exception while highlighting: %o", err );
105
+ };
106
+ };
107
+
108
+
109
+ $(document).ready( function() {
110
+ hookSourceViews();
111
+ hookDebuggingToggle();
112
+ hookQuickSearch();
113
+ highlightLocationTarget();
114
+
115
+ $('ul.link-list a, a.xref').bind( "click", highlightClickTarget );
116
+ });