css_inliner 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. data/.gitignore +8 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE +21 -0
  4. data/README +46 -0
  5. data/Rakefile +23 -0
  6. data/bin/css-inliner +27 -0
  7. data/bin/css-inliner-multifile +29 -0
  8. data/css_inliner.gemspec +29 -0
  9. data/lib/css_inliner.rb +15 -0
  10. data/lib/css_inliner/extractor.rb +58 -0
  11. data/lib/css_inliner/inliner.rb +42 -0
  12. data/lib/css_inliner/version.rb +3 -0
  13. data/setup.rb +1585 -0
  14. data/test/fixtures/sample1/CSSInliner.html +197 -0
  15. data/test/fixtures/sample1/created.rid +3 -0
  16. data/test/fixtures/sample1/images/brick.png +0 -0
  17. data/test/fixtures/sample1/images/brick_link.png +0 -0
  18. data/test/fixtures/sample1/images/bug.png +0 -0
  19. data/test/fixtures/sample1/images/bullet_black.png +0 -0
  20. data/test/fixtures/sample1/images/bullet_toggle_minus.png +0 -0
  21. data/test/fixtures/sample1/images/bullet_toggle_plus.png +0 -0
  22. data/test/fixtures/sample1/images/date.png +0 -0
  23. data/test/fixtures/sample1/images/find.png +0 -0
  24. data/test/fixtures/sample1/images/loadingAnimation.gif +0 -0
  25. data/test/fixtures/sample1/images/macFFBgHack.png +0 -0
  26. data/test/fixtures/sample1/images/package.png +0 -0
  27. data/test/fixtures/sample1/images/page_green.png +0 -0
  28. data/test/fixtures/sample1/images/page_white_text.png +0 -0
  29. data/test/fixtures/sample1/images/page_white_width.png +0 -0
  30. data/test/fixtures/sample1/images/plugin.png +0 -0
  31. data/test/fixtures/sample1/images/ruby.png +0 -0
  32. data/test/fixtures/sample1/images/tag_green.png +0 -0
  33. data/test/fixtures/sample1/images/wrench.png +0 -0
  34. data/test/fixtures/sample1/images/wrench_orange.png +0 -0
  35. data/test/fixtures/sample1/images/zoom.png +0 -0
  36. data/test/fixtures/sample1/index.html +51 -0
  37. data/test/fixtures/sample1/index.inlined.html +36 -0
  38. data/test/fixtures/sample1/js/darkfish.js +116 -0
  39. data/test/fixtures/sample1/js/jquery.js +32 -0
  40. data/test/fixtures/sample1/js/quicksearch.js +114 -0
  41. data/test/fixtures/sample1/js/thickbox-compressed.js +10 -0
  42. data/test/fixtures/sample1/lib/css_inliner/version_rb.html +52 -0
  43. data/test/fixtures/sample1/lib/css_inliner_rb.html +64 -0
  44. data/test/fixtures/sample1/rdoc.css +763 -0
  45. data/test/fixtures/sample2/CSSInliner.html +197 -0
  46. data/test/fixtures/sample2/created.rid +3 -0
  47. data/test/fixtures/sample2/images/brick.png +0 -0
  48. data/test/fixtures/sample2/images/brick_link.png +0 -0
  49. data/test/fixtures/sample2/images/bug.png +0 -0
  50. data/test/fixtures/sample2/images/bullet_black.png +0 -0
  51. data/test/fixtures/sample2/images/bullet_toggle_minus.png +0 -0
  52. data/test/fixtures/sample2/images/bullet_toggle_plus.png +0 -0
  53. data/test/fixtures/sample2/images/date.png +0 -0
  54. data/test/fixtures/sample2/images/find.png +0 -0
  55. data/test/fixtures/sample2/images/loadingAnimation.gif +0 -0
  56. data/test/fixtures/sample2/images/macFFBgHack.png +0 -0
  57. data/test/fixtures/sample2/images/package.png +0 -0
  58. data/test/fixtures/sample2/images/page_green.png +0 -0
  59. data/test/fixtures/sample2/images/page_white_text.png +0 -0
  60. data/test/fixtures/sample2/images/page_white_width.png +0 -0
  61. data/test/fixtures/sample2/images/plugin.png +0 -0
  62. data/test/fixtures/sample2/images/ruby.png +0 -0
  63. data/test/fixtures/sample2/images/tag_green.png +0 -0
  64. data/test/fixtures/sample2/images/wrench.png +0 -0
  65. data/test/fixtures/sample2/images/wrench_orange.png +0 -0
  66. data/test/fixtures/sample2/images/zoom.png +0 -0
  67. data/test/fixtures/sample2/index.html +51 -0
  68. data/test/fixtures/sample2/index.html~ +51 -0
  69. data/test/fixtures/sample2/index.inlined.html +36 -0
  70. data/test/fixtures/sample2/index.inlined.html~ +36 -0
  71. data/test/fixtures/sample2/js/darkfish.js +116 -0
  72. data/test/fixtures/sample2/js/jquery.js +32 -0
  73. data/test/fixtures/sample2/js/quicksearch.js +114 -0
  74. data/test/fixtures/sample2/js/thickbox-compressed.js +10 -0
  75. data/test/fixtures/sample2/lib/css_inliner/version_rb.html +52 -0
  76. data/test/fixtures/sample2/lib/css_inliner_rb.html +64 -0
  77. data/test/fixtures/sample2/rdoc.css +763 -0
  78. data/test/fixtures/sample3/CSSInliner.html +197 -0
  79. data/test/fixtures/sample3/created.rid +3 -0
  80. data/test/fixtures/sample3/images/brick.png +0 -0
  81. data/test/fixtures/sample3/images/brick_link.png +0 -0
  82. data/test/fixtures/sample3/images/bug.png +0 -0
  83. data/test/fixtures/sample3/images/bullet_black.png +0 -0
  84. data/test/fixtures/sample3/images/bullet_toggle_minus.png +0 -0
  85. data/test/fixtures/sample3/images/bullet_toggle_plus.png +0 -0
  86. data/test/fixtures/sample3/images/date.png +0 -0
  87. data/test/fixtures/sample3/images/find.png +0 -0
  88. data/test/fixtures/sample3/images/loadingAnimation.gif +0 -0
  89. data/test/fixtures/sample3/images/macFFBgHack.png +0 -0
  90. data/test/fixtures/sample3/images/package.png +0 -0
  91. data/test/fixtures/sample3/images/page_green.png +0 -0
  92. data/test/fixtures/sample3/images/page_white_text.png +0 -0
  93. data/test/fixtures/sample3/images/page_white_width.png +0 -0
  94. data/test/fixtures/sample3/images/plugin.png +0 -0
  95. data/test/fixtures/sample3/images/ruby.png +0 -0
  96. data/test/fixtures/sample3/images/tag_green.png +0 -0
  97. data/test/fixtures/sample3/images/wrench.png +0 -0
  98. data/test/fixtures/sample3/images/wrench_orange.png +0 -0
  99. data/test/fixtures/sample3/images/zoom.png +0 -0
  100. data/test/fixtures/sample3/index.html +55 -0
  101. data/test/fixtures/sample3/index.inlined.html +36 -0
  102. data/test/fixtures/sample3/js/darkfish.js +116 -0
  103. data/test/fixtures/sample3/js/jquery.js +32 -0
  104. data/test/fixtures/sample3/js/quicksearch.js +114 -0
  105. data/test/fixtures/sample3/js/thickbox-compressed.js +10 -0
  106. data/test/fixtures/sample3/lib/css_inliner/version_rb.html +52 -0
  107. data/test/fixtures/sample3/lib/css_inliner_rb.html +64 -0
  108. data/test/fixtures/sample3/rdoc.css +763 -0
  109. data/test/fixtures/sample4/CSSInliner.html +197 -0
  110. data/test/fixtures/sample4/created.rid +3 -0
  111. data/test/fixtures/sample4/images/brick.png +0 -0
  112. data/test/fixtures/sample4/images/brick_link.png +0 -0
  113. data/test/fixtures/sample4/images/bug.png +0 -0
  114. data/test/fixtures/sample4/images/bullet_black.png +0 -0
  115. data/test/fixtures/sample4/images/bullet_toggle_minus.png +0 -0
  116. data/test/fixtures/sample4/images/bullet_toggle_plus.png +0 -0
  117. data/test/fixtures/sample4/images/date.png +0 -0
  118. data/test/fixtures/sample4/images/find.png +0 -0
  119. data/test/fixtures/sample4/images/loadingAnimation.gif +0 -0
  120. data/test/fixtures/sample4/images/macFFBgHack.png +0 -0
  121. data/test/fixtures/sample4/images/package.png +0 -0
  122. data/test/fixtures/sample4/images/page_green.png +0 -0
  123. data/test/fixtures/sample4/images/page_white_text.png +0 -0
  124. data/test/fixtures/sample4/images/page_white_width.png +0 -0
  125. data/test/fixtures/sample4/images/plugin.png +0 -0
  126. data/test/fixtures/sample4/images/ruby.png +0 -0
  127. data/test/fixtures/sample4/images/tag_green.png +0 -0
  128. data/test/fixtures/sample4/images/wrench.png +0 -0
  129. data/test/fixtures/sample4/images/wrench_orange.png +0 -0
  130. data/test/fixtures/sample4/images/zoom.png +0 -0
  131. data/test/fixtures/sample4/index.html +55 -0
  132. data/test/fixtures/sample4/index.inlined.html +36 -0
  133. data/test/fixtures/sample4/js/darkfish.js +116 -0
  134. data/test/fixtures/sample4/js/jquery.js +32 -0
  135. data/test/fixtures/sample4/js/quicksearch.js +114 -0
  136. data/test/fixtures/sample4/js/thickbox-compressed.js +10 -0
  137. data/test/fixtures/sample4/lib/css_inliner/version_rb.html +52 -0
  138. data/test/fixtures/sample4/lib/css_inliner_rb.html +64 -0
  139. data/test/fixtures/sample4/rdoc.css +763 -0
  140. data/test/helper.rb +27 -0
  141. data/test/test_css_inliner.rb +22 -0
  142. data/test/test_extractor.rb +54 -0
  143. metadata +234 -0
@@ -0,0 +1,197 @@
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>Module: CSSInliner</title>
9
+
10
+ <link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="./js/jquery.js" type="text/javascript" charset="utf-8"></script>
13
+ <script src="./js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="./js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
15
+ <script src="./js/darkfish.js" type="text/javascript" charset="utf-8"></script>
16
+
17
+ </head>
18
+ <body id="top" class="module">
19
+
20
+ <div id="metadata">
21
+ <div id="home-metadata">
22
+ <div id="home-section" class="section">
23
+ <h3 class="section-header">
24
+ <a href="./index.html">Home</a>
25
+ <a href="./index.html#classes">Classes</a>
26
+ <a href="./index.html#methods">Methods</a>
27
+ </h3>
28
+ </div>
29
+ </div>
30
+
31
+ <div id="file-metadata">
32
+ <div id="file-list-section" class="section">
33
+ <h3 class="section-header">In Files</h3>
34
+ <div class="section-body">
35
+ <ul>
36
+
37
+ <li><a href="./lib/css_inliner/version_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
38
+ class="thickbox" title="lib/css_inliner/version.rb">lib/css_inliner/version.rb</a></li>
39
+
40
+ <li><a href="./lib/css_inliner_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
41
+ class="thickbox" title="lib/css_inliner.rb">lib/css_inliner.rb</a></li>
42
+
43
+ </ul>
44
+ </div>
45
+ </div>
46
+
47
+
48
+ </div>
49
+
50
+ <div id="class-metadata">
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+ <!-- Method Quickref -->
59
+ <div id="method-list-section" class="section">
60
+ <h3 class="section-header">Methods</h3>
61
+ <ul class="link-list">
62
+
63
+ <li><a href="#method-c-process">::process</a></li>
64
+
65
+ </ul>
66
+ </div>
67
+
68
+
69
+
70
+ </div>
71
+
72
+ <div id="project-metadata">
73
+
74
+
75
+
76
+ <div id="classindex-section" class="section project-section">
77
+ <h3 class="section-header">Class/Module Index
78
+ <span class="search-toggle"><img src="./images/find.png"
79
+ height="16" width="16" alt="[+]"
80
+ title="show/hide quicksearch" /></span></h3>
81
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
82
+ <fieldset>
83
+ <legend>Quicksearch</legend>
84
+ <input type="text" name="quicksearch" value=""
85
+ class="quicksearch-field" />
86
+ </fieldset>
87
+ </form>
88
+
89
+ <ul class="link-list">
90
+
91
+ <li><a href="./CSSInliner.html">CSSInliner</a></li>
92
+
93
+ </ul>
94
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
95
+ </div>
96
+
97
+
98
+ </div>
99
+ </div>
100
+
101
+ <div id="documentation">
102
+ <h1 class="module">CSSInliner</h1>
103
+
104
+ <div id="description" class="description">
105
+
106
+ </div><!-- description -->
107
+
108
+
109
+
110
+
111
+ <div id="5Buntitled-5D" class="documentation-section">
112
+
113
+
114
+
115
+
116
+
117
+ <!-- Constants -->
118
+ <div id="constants-list" class="section">
119
+ <h3 class="section-header">Constants</h3>
120
+ <dl>
121
+
122
+ <dt><a name="VERSION">VERSION</a></dt>
123
+
124
+ <dd class="description"></dd>
125
+
126
+
127
+ </dl>
128
+ </div>
129
+
130
+
131
+
132
+
133
+ <!-- Methods -->
134
+
135
+ <div id="public-class-method-details" class="method-section section">
136
+ <h3 class="section-header">Public Class Methods</h3>
137
+
138
+
139
+ <div id="process-method" class="method-detail ">
140
+ <a name="method-c-process"></a>
141
+
142
+
143
+ <div class="method-heading">
144
+ <span class="method-name">process</span><span
145
+ class="method-args">(html, basedir = '.')</span>
146
+ <span class="method-click-advice">click to toggle source</span>
147
+ </div>
148
+
149
+
150
+ <div class="method-description">
151
+
152
+
153
+
154
+
155
+
156
+ <div class="method-source-code" id="process-source">
157
+ <pre>
158
+ <span class="ruby-comment"># File lib/css_inliner.rb, line 10</span>
159
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">process</span>(<span class="ruby-identifier">html</span>, <span class="ruby-identifier">basedir</span> = <span class="ruby-string">'.'</span>)
160
+ <span class="ruby-comment"># Make DOM</span>
161
+ <span class="ruby-identifier">doc</span> = <span class="ruby-constant">Nokogiri</span>.<span class="ruby-constant">HTML</span> <span class="ruby-identifier">html</span>
162
+
163
+ <span class="ruby-comment"># Structure CSS</span>
164
+ <span class="ruby-identifier">csss</span> = <span class="ruby-identifier">find_css</span> <span class="ruby-identifier">doc</span>, <span class="ruby-identifier">basedir</span>
165
+ <span class="ruby-identifier">css_parser</span> = <span class="ruby-constant">CssParser</span><span class="ruby-operator">::</span><span class="ruby-constant">Parser</span>.<span class="ruby-identifier">new</span>
166
+ <span class="ruby-identifier">csss</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">css</span><span class="ruby-operator">|</span> <span class="ruby-identifier">css_parser</span>.<span class="ruby-identifier">add_block!</span> <span class="ruby-identifier">css</span>}
167
+ <span class="ruby-identifier">css_map</span> = <span class="ruby-identifier">create_css_map</span> <span class="ruby-identifier">css_parser</span>
168
+
169
+ <span class="ruby-comment"># Inline CSS</span>
170
+ <span class="ruby-identifier">inline</span>(<span class="ruby-identifier">doc</span>, <span class="ruby-identifier">css_map</span>).<span class="ruby-identifier">to_s</span>
171
+ <span class="ruby-keyword">end</span></pre>
172
+ </div><!-- process-source -->
173
+
174
+ </div>
175
+
176
+
177
+
178
+
179
+ </div><!-- process-method -->
180
+
181
+
182
+ </div><!-- public-class-method-details -->
183
+
184
+ </div><!-- 5Buntitled-5D -->
185
+
186
+
187
+ </div><!-- documentation -->
188
+
189
+ <div id="validator-badges">
190
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
191
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
192
+ Rdoc Generator</a> 2</small>.</p>
193
+ </div>
194
+
195
+ </body>
196
+ </html>
197
+
@@ -0,0 +1,3 @@
1
+ Sun, 14 Aug 2011 20:30:52 +0900
2
+ lib/css_inliner/version.rb Sun, 14 Aug 2011 20:30:50 +0900
3
+ lib/css_inliner.rb Sun, 14 Aug 2011 20:30:50 +0900
@@ -0,0 +1,55 @@
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>css_inliner-0.0.1 Documentation</title>
10
+
11
+ <link type="text/css" media="screen" href="rdoc.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
+ <style type="text/css">
19
+ h2 {color: gray;}
20
+ </style>
21
+
22
+ </head>
23
+ <body class="indexpage">
24
+
25
+
26
+ <h1>css_inliner-0.0.1 Documentation</h1>
27
+
28
+
29
+ <p>This is the API documentation for 'css_inliner-0.0.1 Documentation'.</p>
30
+
31
+
32
+
33
+
34
+
35
+ <h2 id="classes">Classes/Modules</h2>
36
+ <ul>
37
+
38
+ <li class="module"><a href="CSSInliner.html">CSSInliner</a></li>
39
+
40
+ </ul>
41
+
42
+ <h2 id="methods">Methods</h2>
43
+ <ul>
44
+
45
+ <li><a href="CSSInliner.html#method-c-process">::process &mdash; CSSInliner</a></li>
46
+
47
+ </ul>
48
+
49
+ <div id="validator-badges">
50
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
51
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
52
+ Rdoc Generator</a> 2</small>.</p>
53
+ </div>
54
+ </body>
55
+ </html>
@@ -0,0 +1,36 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2
+ <?xml version="1.0" encoding="UTF-8"?><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
3
+ <head>
4
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
5
+ <title>css_inliner-0.0.1 Documentation</title>
6
+ <script src="js/jquery.js" type="text/javascript" charset="utf-8"></script><script src="js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script><script src="js/quicksearch.js" type="text/javascript" charset="utf-8"></script><script src="js/darkfish.js" type="text/javascript" charset="utf-8"></script>
7
+ </head>
8
+ <body class="indexpage" style='background: #efefef; margin: 1em 3em; padding: 0; font: 14px "Helvetica Neue", Helvetica, Tahoma, sans-serif;'>
9
+
10
+
11
+ <h1 style="font-size: 300%; text-shadow: rgba(135,145,135,0.65) 2px 2px 3px; color: #6C8C22; margin: 0; padding: 0;">css_inliner-0.0.1 Documentation</h1>
12
+
13
+
14
+ <p style="margin: 1em 0; padding: 0;">This is the API documentation for 'css_inliner-0.0.1 Documentation'.</p>
15
+
16
+
17
+
18
+
19
+
20
+ <h2 id="classes" style="color: gray; margin: 1.5em 0 0; padding: 0;">Classes/Modules</h2>
21
+ <ul style="line-height: 160%; list-style: none; margin: 0; padding: 0;">
22
+ <li class="module" style="background: url(images/package.png) no-repeat left 4px; margin: 0; padding: 0 0 0 20px;"><a href="CSSInliner.html" style="margin: 0; padding: 0;">CSSInliner</a></li>
23
+
24
+ </ul>
25
+ <h2 id="methods" style="color: gray; margin: 1.5em 0 0; padding: 0;">Methods</h2>
26
+ <ul style="line-height: 160%; list-style: none; margin: 0; padding: 0;">
27
+ <li style="background: url(images/bullet_black.png) no-repeat left 4px; margin: 0; padding: 0 0 0 20px;"><a href="CSSInliner.html#method-c-process" style="margin: 0; padding: 0;">::process — CSSInliner</a></li>
28
+
29
+ </ul>
30
+ <div id="validator-badges" style="clear: both; margin: 1em 1em 2em; padding: 0;">
31
+ <p style="margin: 1em 0; padding: 0;"><small style="margin: 0; padding: 0;"><a href="http://validator.w3.org/check/referer" style="margin: 0; padding: 0;">[Validate]</a></small></p>
32
+ <p style="margin: 1em 0; padding: 0;"><small style="margin: 0; padding: 0;">Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/" style="margin: 0; padding: 0;">Darkfish
33
+ Rdoc Generator</a> 2</small>.</p>
34
+ </div>
35
+ </body>
36
+ </html>
@@ -0,0 +1,116 @@
1
+ /**
2
+ *
3
+ * Darkfish Page Functions
4
+ * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $
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').bind( "click", highlightClickTarget );
116
+ });