maruku 0.6.1 → 0.7.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (263) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/MIT-LICENSE.txt +20 -0
  5. data/bin/maruku +153 -152
  6. data/bin/marutex +2 -29
  7. data/data/entities.xml +261 -0
  8. data/docs/math.md +14 -18
  9. data/lib/maruku.rb +65 -77
  10. data/lib/maruku/attributes.rb +109 -214
  11. data/lib/maruku/defaults.rb +45 -67
  12. data/lib/maruku/document.rb +43 -0
  13. data/lib/maruku/element.rb +112 -0
  14. data/lib/maruku/errors.rb +71 -0
  15. data/lib/maruku/ext/div.rb +105 -113
  16. data/lib/maruku/ext/fenced_code.rb +97 -0
  17. data/lib/maruku/ext/math.rb +22 -26
  18. data/lib/maruku/ext/math/elements.rb +20 -26
  19. data/lib/maruku/ext/math/mathml_engines/blahtex.rb +92 -104
  20. data/lib/maruku/ext/math/mathml_engines/itex2mml.rb +33 -26
  21. data/lib/maruku/ext/math/mathml_engines/none.rb +11 -19
  22. data/lib/maruku/ext/math/mathml_engines/ritex.rb +2 -4
  23. data/lib/maruku/ext/math/parsing.rb +107 -113
  24. data/lib/maruku/ext/math/to_html.rb +184 -187
  25. data/lib/maruku/ext/math/to_latex.rb +30 -21
  26. data/lib/maruku/helpers.rb +158 -257
  27. data/lib/maruku/html.rb +254 -0
  28. data/lib/maruku/input/charsource.rb +272 -319
  29. data/lib/maruku/input/extensions.rb +62 -63
  30. data/lib/maruku/input/html_helper.rb +220 -189
  31. data/lib/maruku/input/linesource.rb +90 -110
  32. data/lib/maruku/input/mdline.rb +129 -0
  33. data/lib/maruku/input/parse_block.rb +618 -612
  34. data/lib/maruku/input/parse_doc.rb +145 -215
  35. data/lib/maruku/input/parse_span.rb +658 -0
  36. data/lib/maruku/input/rubypants.rb +200 -128
  37. data/lib/maruku/inspect_element.rb +60 -0
  38. data/lib/maruku/maruku.rb +10 -31
  39. data/lib/maruku/output/entity_table.rb +33 -0
  40. data/lib/maruku/output/s5/fancy.rb +462 -462
  41. data/lib/maruku/output/s5/to_s5.rb +115 -135
  42. data/lib/maruku/output/to_html.rb +898 -983
  43. data/lib/maruku/output/to_latex.rb +561 -560
  44. data/lib/maruku/output/to_markdown.rb +207 -162
  45. data/lib/maruku/output/to_s.rb +11 -52
  46. data/lib/maruku/string_utils.rb +129 -179
  47. data/lib/maruku/toc.rb +185 -196
  48. data/lib/maruku/version.rb +33 -38
  49. data/spec/block_docs/abbrev.md +776 -0
  50. data/{tests/unittest → spec/block_docs}/abbreviations.md +11 -20
  51. data/{tests/unittest → spec/block_docs}/alt.md +2 -14
  52. data/{tests/unittest/pending → spec/block_docs}/amps.md +1 -13
  53. data/{tests/unittest → spec/block_docs}/attributes/att2.md +0 -12
  54. data/{tests/unittest → spec/block_docs}/attributes/att3.md +2 -14
  55. data/{tests/unittest → spec/block_docs}/attributes/attributes.md +12 -16
  56. data/{tests/unittest → spec/block_docs}/attributes/circular.md +0 -12
  57. data/{tests/unittest → spec/block_docs}/attributes/default.md +1 -13
  58. data/{tests/unittest → spec/block_docs}/blank.md +0 -12
  59. data/{tests/unittest → spec/block_docs}/blanks_in_code.md +16 -15
  60. data/{tests/unittest/loss.md → spec/block_docs/bug_def.md} +6 -18
  61. data/{tests/unittest → spec/block_docs}/bug_table.md +3 -15
  62. data/{tests/unittest → spec/block_docs}/code.md +7 -14
  63. data/{tests/unittest → spec/block_docs}/code2.md +4 -14
  64. data/{tests/unittest → spec/block_docs}/code3.md +12 -16
  65. data/{tests/unittest → spec/block_docs}/data_loss.md +2 -14
  66. data/{tests/unittest → spec/block_docs}/divs/div1.md +0 -12
  67. data/{tests/unittest → spec/block_docs}/divs/div2.md +0 -12
  68. data/{tests/unittest → spec/block_docs}/divs/div3_nest.md +3 -15
  69. data/{tests/unittest → spec/block_docs}/easy.md +1 -13
  70. data/spec/block_docs/email.md +29 -0
  71. data/{tests/unittest/pending → spec/block_docs}/empty_cells.md +3 -15
  72. data/{tests/unittest → spec/block_docs}/encoding/iso-8859-1.md +1 -14
  73. data/{tests/unittest → spec/block_docs}/encoding/utf-8.md +0 -12
  74. data/{tests/unittest → spec/block_docs}/entities.md +27 -29
  75. data/{tests/unittest/notyet → spec/block_docs}/escape.md +2 -14
  76. data/{tests/unittest → spec/block_docs}/escaping.md +11 -22
  77. data/{tests/unittest → spec/block_docs}/extra_dl.md +2 -13
  78. data/{tests/unittest → spec/block_docs}/extra_header_id.md +14 -20
  79. data/{tests/unittest → spec/block_docs}/extra_table1.md +3 -15
  80. data/spec/block_docs/fenced_code_blocks.md +66 -0
  81. data/spec/block_docs/fenced_code_blocks_highlighted.md +18 -0
  82. data/{tests/unittest → spec/block_docs}/footnotes.md +12 -24
  83. data/spec/block_docs/footnotes2.md +78 -0
  84. data/spec/block_docs/hard.md +25 -0
  85. data/spec/block_docs/header_after_par.md +62 -0
  86. data/{tests/unittest → spec/block_docs}/headers.md +10 -18
  87. data/{tests/unittest → spec/block_docs}/hex_entities.md +7 -18
  88. data/{tests/unittest → spec/block_docs}/hrule.md +5 -12
  89. data/{tests/unittest → spec/block_docs}/html3.md +1 -13
  90. data/{tests/unittest → spec/block_docs}/html4.md +2 -14
  91. data/{tests/unittest → spec/block_docs}/html5.md +2 -14
  92. data/spec/block_docs/html_block_in_para.md +22 -0
  93. data/spec/block_docs/html_inline.md +25 -0
  94. data/spec/block_docs/html_trailing.md +31 -0
  95. data/spec/block_docs/ie.md +62 -0
  96. data/spec/block_docs/iframe.md +29 -0
  97. data/{tests/unittest → spec/block_docs}/images.md +22 -28
  98. data/{tests/unittest → spec/block_docs}/images2.md +7 -17
  99. data/{tests/unittest → spec/block_docs}/inline_html.md +37 -67
  100. data/{tests/unittest → spec/block_docs}/inline_html2.md +1 -13
  101. data/spec/block_docs/inline_html_beginning.md +10 -0
  102. data/spec/block_docs/issue20.md +9 -0
  103. data/spec/block_docs/issue26.md +22 -0
  104. data/spec/block_docs/issue29.md +9 -0
  105. data/spec/block_docs/issue30.md +30 -0
  106. data/spec/block_docs/issue31.md +25 -0
  107. data/spec/block_docs/issue40.md +40 -0
  108. data/spec/block_docs/issue64.md +55 -0
  109. data/spec/block_docs/issue67.md +19 -0
  110. data/spec/block_docs/issue70.md +11 -0
  111. data/spec/block_docs/issue72.md +17 -0
  112. data/spec/block_docs/issue74.md +38 -0
  113. data/spec/block_docs/issue79.md +15 -0
  114. data/spec/block_docs/issue83.md +13 -0
  115. data/spec/block_docs/issue85.md +25 -0
  116. data/spec/block_docs/issue88.md +19 -0
  117. data/spec/block_docs/issue89.md +12 -0
  118. data/spec/block_docs/issue90.md +38 -0
  119. data/{tests/unittest/pending → spec/block_docs}/link.md +21 -18
  120. data/{tests/unittest → spec/block_docs}/links.md +33 -32
  121. data/spec/block_docs/links2.md +21 -0
  122. data/{tests/unittest → spec/block_docs}/list1.md +0 -12
  123. data/{tests/unittest → spec/block_docs}/list12.md +2 -14
  124. data/{tests/unittest → spec/block_docs}/list2.md +2 -14
  125. data/spec/block_docs/list_multipara.md +42 -0
  126. data/{tests/unittest → spec/block_docs}/lists.md +28 -29
  127. data/{tests/unittest → spec/block_docs}/lists10.md +2 -14
  128. data/spec/block_docs/lists11.md +23 -0
  129. data/spec/block_docs/lists12.md +43 -0
  130. data/spec/block_docs/lists13.md +55 -0
  131. data/spec/block_docs/lists14.md +61 -0
  132. data/spec/block_docs/lists15.md +36 -0
  133. data/spec/block_docs/lists6.md +88 -0
  134. data/spec/block_docs/lists7b.md +58 -0
  135. data/spec/block_docs/lists9.md +53 -0
  136. data/{tests/unittest → spec/block_docs}/lists_after_paragraph.md +19 -25
  137. data/spec/block_docs/lists_blank.md +35 -0
  138. data/{tests/unittest/list3.md → spec/block_docs/lists_blockquote_code.md} +2 -14
  139. data/{tests/unittest/list4.md → spec/block_docs/lists_need_blank_line.md} +50 -21
  140. data/spec/block_docs/lists_nested.md +44 -0
  141. data/spec/block_docs/lists_nested_blankline.md +28 -0
  142. data/spec/block_docs/lists_nested_deep.md +43 -0
  143. data/{tests/unittest → spec/block_docs}/lists_ol.md +37 -54
  144. data/spec/block_docs/lists_paraindent.md +47 -0
  145. data/spec/block_docs/lists_tab.md +54 -0
  146. data/spec/block_docs/loss.md +17 -0
  147. data/spec/block_docs/math-blahtex/equations.md +30 -0
  148. data/spec/block_docs/math-blahtex/inline.md +48 -0
  149. data/spec/block_docs/math-blahtex/math2.md +45 -0
  150. data/spec/block_docs/math-blahtex/table.md +25 -0
  151. data/spec/block_docs/math/embedded_invalid_svg.md +79 -0
  152. data/spec/block_docs/math/embedded_svg.md +97 -0
  153. data/spec/block_docs/math/equations.md +44 -0
  154. data/{tests/unittest → spec/block_docs}/math/inline.md +7 -19
  155. data/spec/block_docs/math/math2.md +45 -0
  156. data/{tests/unittest → spec/block_docs}/math/notmath.md +0 -12
  157. data/spec/block_docs/math/raw_mathml.md +87 -0
  158. data/spec/block_docs/math/table.md +25 -0
  159. data/{tests/unittest → spec/block_docs}/math/table2.md +5 -17
  160. data/{tests/unittest → spec/block_docs}/misc_sw.md +181 -118
  161. data/{tests/unittest → spec/block_docs}/olist.md +6 -18
  162. data/{tests/unittest → spec/block_docs}/one.md +0 -12
  163. data/{tests/unittest → spec/block_docs}/paragraph.md +0 -12
  164. data/{tests/unittest → spec/block_docs}/paragraph_rules/dont_merge_ref.md +4 -12
  165. data/{tests/unittest → spec/block_docs}/paragraph_rules/tab_is_blank.md +0 -12
  166. data/{tests/unittest → spec/block_docs}/paragraphs.md +1 -13
  167. data/{tests/unittest → spec/block_docs}/recover/recover_links.md +4 -16
  168. data/{tests/unittest/pending/ref.md → spec/block_docs/ref_with_period.md} +7 -16
  169. data/spec/block_docs/ref_with_title.md +22 -0
  170. data/{tests/unittest → spec/block_docs}/references/long_example.md +16 -23
  171. data/{tests/unittest → spec/block_docs}/references/spaces_and_numbers.md +0 -12
  172. data/{tests/unittest → spec/block_docs}/smartypants.md +24 -31
  173. data/{tests/unittest → spec/block_docs}/syntax_hl.md +13 -17
  174. data/{tests/unittest → spec/block_docs}/table_attributes.md +2 -14
  175. data/spec/block_docs/tables.md +58 -0
  176. data/{tests/unittest → spec/block_docs}/test.md +1 -13
  177. data/{tests/unittest/notyet → spec/block_docs}/ticks.md +1 -13
  178. data/spec/block_docs/toc.md +87 -0
  179. data/{tests/unittest/notyet → spec/block_docs}/triggering.md +14 -25
  180. data/{tests/unittest → spec/block_docs}/underscore_in_words.md +0 -12
  181. data/{tests/unittest → spec/block_docs}/wrapping.md +4 -16
  182. data/spec/block_docs/xml.md +33 -0
  183. data/{tests/unittest → spec/block_docs}/xml2.md +0 -12
  184. data/spec/block_docs/xml3.md +24 -0
  185. data/{tests/unittest → spec/block_docs}/xml_instruction.md +9 -20
  186. data/spec/block_spec.rb +110 -0
  187. data/spec/cli_spec.rb +8 -0
  188. data/spec/span_spec.rb +256 -0
  189. data/spec/spec_helper.rb +2 -0
  190. data/spec/to_html_utf8_spec.rb +13 -0
  191. metadata +205 -243
  192. metadata.gz.sig +3 -0
  193. data/Rakefile +0 -48
  194. data/bin/marudown +0 -29
  195. data/bin/marutest +0 -345
  196. data/docs/changelog.md +0 -334
  197. data/lib/maruku/errors_management.rb +0 -92
  198. data/lib/maruku/ext/math/latex_fix.rb +0 -12
  199. data/lib/maruku/input/parse_span_better.rb +0 -746
  200. data/lib/maruku/input/type_detection.rb +0 -147
  201. data/lib/maruku/output/to_latex_entities.rb +0 -367
  202. data/lib/maruku/output/to_latex_strings.rb +0 -64
  203. data/lib/maruku/structures.rb +0 -167
  204. data/lib/maruku/structures_inspect.rb +0 -87
  205. data/lib/maruku/structures_iterators.rb +0 -61
  206. data/lib/maruku/tests/benchmark.rb +0 -82
  207. data/lib/maruku/tests/new_parser.rb +0 -373
  208. data/lib/maruku/tests/tests.rb +0 -136
  209. data/lib/maruku/usage/example1.rb +0 -33
  210. data/tests/bugs/code_in_links.md +0 -101
  211. data/tests/bugs/complex_escaping.md +0 -38
  212. data/tests/math/syntax.md +0 -46
  213. data/tests/math_usage/document.md +0 -13
  214. data/tests/others/abbreviations.md +0 -11
  215. data/tests/others/blank.md +0 -4
  216. data/tests/others/code.md +0 -5
  217. data/tests/others/code2.md +0 -8
  218. data/tests/others/code3.md +0 -16
  219. data/tests/others/email.md +0 -4
  220. data/tests/others/entities.md +0 -19
  221. data/tests/others/escaping.md +0 -16
  222. data/tests/others/extra_dl.md +0 -101
  223. data/tests/others/extra_header_id.md +0 -13
  224. data/tests/others/extra_table1.md +0 -40
  225. data/tests/others/footnotes.md +0 -17
  226. data/tests/others/headers.md +0 -10
  227. data/tests/others/hrule.md +0 -10
  228. data/tests/others/images.md +0 -20
  229. data/tests/others/inline_html.md +0 -42
  230. data/tests/others/links.md +0 -38
  231. data/tests/others/list1.md +0 -4
  232. data/tests/others/list2.md +0 -5
  233. data/tests/others/list3.md +0 -8
  234. data/tests/others/lists.md +0 -32
  235. data/tests/others/lists_after_paragraph.md +0 -44
  236. data/tests/others/lists_ol.md +0 -39
  237. data/tests/others/misc_sw.md +0 -105
  238. data/tests/others/one.md +0 -1
  239. data/tests/others/paragraphs.md +0 -13
  240. data/tests/others/sss06.md +0 -352
  241. data/tests/others/test.md +0 -4
  242. data/tests/s5/s5profiling.md +0 -48
  243. data/tests/unittest/bug_def.md +0 -28
  244. data/tests/unittest/email.md +0 -32
  245. data/tests/unittest/html2.md +0 -34
  246. data/tests/unittest/ie.md +0 -61
  247. data/tests/unittest/links2.md +0 -34
  248. data/tests/unittest/lists11.md +0 -28
  249. data/tests/unittest/lists6.md +0 -53
  250. data/tests/unittest/lists9.md +0 -76
  251. data/tests/unittest/math/equations.md +0 -86
  252. data/tests/unittest/math/math2.md +0 -57
  253. data/tests/unittest/math/table.md +0 -37
  254. data/tests/unittest/notyet/header_after_par.md +0 -70
  255. data/tests/unittest/red_tests/abbrev.md +0 -1388
  256. data/tests/unittest/red_tests/lists7.md +0 -68
  257. data/tests/unittest/red_tests/lists7b.md +0 -128
  258. data/tests/unittest/red_tests/lists8.md +0 -76
  259. data/tests/unittest/red_tests/xml.md +0 -70
  260. data/tests/unittest/xml3.md +0 -38
  261. data/tests/utf8-files/simple.md +0 -1
  262. data/unit_test_block.sh +0 -5
  263. data/unit_test_span.sh +0 -3
@@ -1,33 +1,12 @@
1
- #--
2
- # Copyright (C) 2006 Andrea Censi <andrea (at) rubyforge.org>
1
+ # The public interface for Maruku.
3
2
  #
4
- # This file is part of Maruku.
5
- #
6
- # Maruku is free software; you can redistribute it and/or modify
7
- # it under the terms of the GNU General Public License as published by
8
- # the Free Software Foundation; either version 2 of the License, or
9
- # (at your option) any later version.
10
- #
11
- # Maruku is distributed in the hope that it will be useful,
12
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- # GNU General Public License for more details.
15
- #
16
- # You should have received a copy of the GNU General Public License
17
- # along with Maruku; if not, write to the Free Software
18
- # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
- #++
20
-
21
-
22
- # The Maruku class is the public interface
23
- #
24
-
25
- class Maruku
26
- def initialize(s=nil, meta={})
27
- super(nil)
28
- self.attributes.merge! meta
29
- if s
30
- parse_doc(s)
31
- end
32
- end
3
+ # @example Render a document fragment
4
+ # Maruku.new("## Header ##").to_html
5
+ # # => "<h2 id='header'>header</h2>"
6
+ class Maruku < MaRuKu::MDDocument
7
+ def initialize(s = nil, meta = {})
8
+ super(nil)
9
+ self.attributes.merge! meta
10
+ parse_doc(s) if s
11
+ end
33
12
  end
@@ -0,0 +1,33 @@
1
+ require 'rexml/document'
2
+ require 'singleton'
3
+
4
+ module MaRuKu::Out
5
+ Entity = Struct.new(:html_num, :html_entity, :latex_string, :latex_package)
6
+
7
+ class EntityTable
8
+ # Sad but true
9
+ include Singleton
10
+
11
+ def initialize
12
+ @entity_table = {}
13
+
14
+ xml = File.new(File.join(File.dirname(__FILE__), '..', '..', '..', 'data', 'entities.xml'))
15
+ doc = REXML::Document.new(xml)
16
+ doc.elements.each("//char") do |c|
17
+ num = c.attributes['num'].to_i
18
+ name = c.attributes['name']
19
+ convert = c.attributes['convertTo']
20
+ package = c.attributes['package']
21
+
22
+ e = Entity.new(num, name, convert, package)
23
+ @entity_table[name] = e
24
+ @entity_table[num] = e
25
+ end
26
+ end
27
+
28
+ def entity(name)
29
+ @entity_table[name]
30
+ end
31
+ end
32
+ end
33
+
@@ -1,17 +1,17 @@
1
1
  module MaRuKu
2
- S5_external =<<EOF
3
-
4
- <meta name="defaultView" content="slideshow" />
5
- <meta name="controlVis" content="hidden" />
6
- <link rel="stylesheet" href="ui/default/slides.css" type="text/css" media="projection" id="slideProj" />
7
- <link rel="stylesheet" href="ui/default/outline.css" type="text/css" media="screen" id="outlineStyle" />
8
- <link rel="stylesheet" href="ui/default/print.css" type="text/css" media="print" id="slidePrint" />
9
- <link rel="stylesheet" href="ui/default/opera.css" type="text/css" media="projection" id="operaFix" />
10
- <script src="ui/default/slides.js" type="text/javascript"> </script>
2
+ S5_external =<<EOF
3
+
4
+ <meta name="defaultView" content="slideshow" />
5
+ <meta name="controlVis" content="hidden" />
6
+ <link rel="stylesheet" href="ui/default/slides.css" type="text/css" media="projection" id="slideProj" />
7
+ <link rel="stylesheet" href="ui/default/outline.css" type="text/css" media="screen" id="outlineStyle" />
8
+ <link rel="stylesheet" href="ui/default/print.css" type="text/css" media="print" id="slidePrint" />
9
+ <link rel="stylesheet" href="ui/default/opera.css" type="text/css" media="projection" id="operaFix" />
10
+ <script src="ui/default/slides.js" type="text/javascript"> </script>
11
11
  EOF
12
12
 
13
13
 
14
- S5_Fancy =<<EOF
14
+ S5_Fancy =<<EOF
15
15
 
16
16
  <meta name="defaultView" content="slideshow" />
17
17
  <meta name="controlVis" content="hidden" />
@@ -20,7 +20,7 @@ EOF
20
20
  /* Do not edit or override these styles! The system will likely break if you do. */
21
21
 
22
22
  div#header, div#footer, div#controls, .slide {position: absolute;}
23
- html>body div#header, html>body div#footer,
23
+ html>body div#header, html>body div#footer,
24
24
  html>body div#controls, html>body .slide {position: fixed;}
25
25
  .handout {display: none;}
26
26
  .layout {display: block;}
@@ -29,7 +29,7 @@ html>body div#header, html>body div#footer,
29
29
 
30
30
  /* The following styles size, place, and layer the slide components.
31
31
  Edit these if you want to change the overall slide layout.
32
- The commented lines can be uncommented (and modified, if necessary)
32
+ The commented lines can be uncommented (and modified, if necessary)
33
33
  to help you with the rearrangement process. */
34
34
 
35
35
  /* target = 1024x768 */
@@ -105,8 +105,8 @@ html>body div#controls {position: fixed; padding: 0 0 1em 0;
105
105
  top: auto;}
106
106
  div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;
107
107
  margin: 0; padding: 0;}
108
- #controls #navLinks a {padding: 0; margin: 0 0.5em;
109
- background: #005; border: none; color: #779;
108
+ #controls #navLinks a {padding: 0; margin: 0 0.5em;
109
+ background: #005; border: none; color: #779;
110
110
  cursor: pointer;}
111
111
  #controls #navList {height: 1em;}
112
112
  #controls #navList #jumplist {position: absolute; bottom: 0; right: 0; background: #DDD; color: #227;}
@@ -141,9 +141,9 @@ li:after {content: " [" attr(class) "]"; color: #F88;}
141
141
  <style type="text/css" media="projection" id="operaFix">
142
142
  /* DO NOT CHANGE THESE unless you really want to break Opera Show */
143
143
  .slide {
144
- visibility: visible !important;
145
- position: static !important;
146
- page-break-before: always;
144
+ visibility: visible !important;
145
+ position: static !important;
146
+ page-break-before: always;
147
147
  }
148
148
  #slide0 {page-break-before: avoid;}
149
149
 
@@ -197,7 +197,7 @@ p.example {display: none;}
197
197
  <![CDATA[
198
198
  // S5 v1.1 slides.js -- released into the Public Domain
199
199
  //
200
- // Please see http://www.meyerweb.com/eric/tools/s5/credits.html for information
200
+ // Please see http://www.meyerweb.com/eric/tools/s5/credits.html for information
201
201
  // about all the wonderful and talented contributors to this code!
202
202
 
203
203
  var undef;
@@ -215,535 +215,535 @@ var isOp = navigator.userAgent.indexOf('Opera') > -1 ? 1 : 0;
215
215
  var isGe = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') < 1 ? 1 : 0;
216
216
 
217
217
  function hasClass(object, className) {
218
- if (!object.className) return false;
219
- return (object.className.search('(^|\\s)' + className + '(\\s|$)') != -1);
218
+ if (!object.className) return false;
219
+ return (object.className.search('(^|\\s)' + className + '(\\s|$)') != -1);
220
220
  }
221
221
 
222
222
  function hasValue(object, value) {
223
- if (!object) return false;
224
- return (object.search('(^|\\s)' + value + '(\\s|$)') != -1);
223
+ if (!object) return false;
224
+ return (object.search('(^|\\s)' + value + '(\\s|$)') != -1);
225
225
  }
226
226
 
227
227
  function removeClass(object,className) {
228
- if (!object) return;
229
- object.className = object.className.replace(new RegExp('(^|\\s)'+className+'(\\s|$)'), RegExp.$1+RegExp.$2);
228
+ if (!object) return;
229
+ object.className = object.className.replace(new RegExp('(^|\\s)'+className+'(\\s|$)'), RegExp.$1+RegExp.$2);
230
230
  }
231
231
 
232
232
  function addClass(object,className) {
233
- if (!object || hasClass(object, className)) return;
234
- if (object.className) {
235
- object.className += ' '+className;
236
- } else {
237
- object.className = className;
238
- }
233
+ if (!object || hasClass(object, className)) return;
234
+ if (object.className) {
235
+ object.className += ' '+className;
236
+ } else {
237
+ object.className = className;
238
+ }
239
239
  }
240
240
 
241
241
  function GetElementsWithClassName(elementName,className) {
242
- var allElements = document.getElementsByTagName(elementName);
243
- var elemColl = new Array();
244
- for (var i = 0; i< allElements.length; i++) {
245
- if (hasClass(allElements[i], className)) {
246
- elemColl[elemColl.length] = allElements[i];
247
- }
248
- }
249
- return elemColl;
242
+ var allElements = document.getElementsByTagName(elementName);
243
+ var elemColl = new Array();
244
+ for (var i = 0; i< allElements.length; i++) {
245
+ if (hasClass(allElements[i], className)) {
246
+ elemColl[elemColl.length] = allElements[i];
247
+ }
248
+ }
249
+ return elemColl;
250
250
  }
251
251
 
252
252
  function isParentOrSelf(element, id) {
253
- if (element == null || element.nodeName=='BODY') return false;
254
- else if (element.id == id) return true;
255
- else return isParentOrSelf(element.parentNode, id);
253
+ if (element == null || element.nodeName=='BODY') return false;
254
+ else if (element.id == id) return true;
255
+ else return isParentOrSelf(element.parentNode, id);
256
256
  }
257
257
 
258
258
  function nodeValue(node) {
259
- var result = "";
260
- if (node.nodeType == 1) {
261
- var children = node.childNodes;
262
- for (var i = 0; i < children.length; ++i) {
263
- result += nodeValue(children[i]);
264
- }
265
- }
266
- else if (node.nodeType == 3) {
267
- result = node.nodeValue;
268
- }
269
- return(result);
259
+ var result = "";
260
+ if (node.nodeType == 1) {
261
+ var children = node.childNodes;
262
+ for (var i = 0; i < children.length; ++i) {
263
+ result += nodeValue(children[i]);
264
+ }
265
+ }
266
+ else if (node.nodeType == 3) {
267
+ result = node.nodeValue;
268
+ }
269
+ return(result);
270
270
  }
271
271
 
272
272
  function slideLabel() {
273
- var slideColl = GetElementsWithClassName('*','slide');
274
- var list = document.getElementById('jumplist');
275
- smax = slideColl.length;
276
- for (var n = 0; n < smax; n++) {
277
- var obj = slideColl[n];
278
-
279
- var did = 'slide' + n.toString();
280
- obj.setAttribute('id',did);
281
- if (isOp) continue;
282
-
283
- var otext = '';
284
- var menu = obj.firstChild;
285
- if (!menu) continue; // to cope with empty slides
286
- while (menu && menu.nodeType == 3) {
287
- menu = menu.nextSibling;
288
- }
289
- if (!menu) continue; // to cope with slides with only text nodes
290
-
291
- var menunodes = menu.childNodes;
292
- for (var o = 0; o < menunodes.length; o++) {
293
- otext += nodeValue(menunodes[o]);
294
- }
295
- list.options[list.length] = new Option(n + ' : ' + otext, n);
296
- }
273
+ var slideColl = GetElementsWithClassName('*','slide');
274
+ var list = document.getElementById('jumplist');
275
+ smax = slideColl.length;
276
+ for (var n = 0; n < smax; n++) {
277
+ var obj = slideColl[n];
278
+
279
+ var did = 'slide' + n.toString();
280
+ obj.setAttribute('id',did);
281
+ if (isOp) continue;
282
+
283
+ var otext = '';
284
+ var menu = obj.firstChild;
285
+ if (!menu) continue; // to cope with empty slides
286
+ while (menu && menu.nodeType == 3) {
287
+ menu = menu.nextSibling;
288
+ }
289
+ if (!menu) continue; // to cope with slides with only text nodes
290
+
291
+ var menunodes = menu.childNodes;
292
+ for (var o = 0; o < menunodes.length; o++) {
293
+ otext += nodeValue(menunodes[o]);
294
+ }
295
+ list.options[list.length] = new Option(n + ' : ' + otext, n);
296
+ }
297
297
  }
298
298
 
299
299
  function currentSlide() {
300
- var cs;
301
- if (document.getElementById) {
302
- cs = document.getElementById('currentSlide');
303
- } else {
304
- cs = document.currentSlide;
305
- }
306
- cs.innerHTML = '<span id="csHere">' + snum + '<\/span> ' +
307
- '<span id="csSep">\/<\/span> ' +
308
- '<span id="csTotal">' + (smax-1) + '<\/span>';
309
- if (snum == 0) {
310
- cs.style.visibility = 'hidden';
311
- } else {
312
- cs.style.visibility = 'visible';
313
- }
300
+ var cs;
301
+ if (document.getElementById) {
302
+ cs = document.getElementById('currentSlide');
303
+ } else {
304
+ cs = document.currentSlide;
305
+ }
306
+ cs.innerHTML = '<span id="csHere">' + snum + '<\/span> ' +
307
+ '<span id="csSep">\/<\/span> ' +
308
+ '<span id="csTotal">' + (smax-1) + '<\/span>';
309
+ if (snum == 0) {
310
+ cs.style.visibility = 'hidden';
311
+ } else {
312
+ cs.style.visibility = 'visible';
313
+ }
314
314
  }
315
315
 
316
316
  function go(step) {
317
- if (document.getElementById('slideProj').disabled || step == 0) return;
318
- var jl = document.getElementById('jumplist');
319
- var cid = 'slide' + snum;
320
- var ce = document.getElementById(cid);
321
- if (incrementals[snum].length > 0) {
322
- for (var i = 0; i < incrementals[snum].length; i++) {
323
- removeClass(incrementals[snum][i], 'current');
324
- removeClass(incrementals[snum][i], 'incremental');
325
- }
326
- }
327
- if (step != 'j') {
328
- snum += step;
329
- lmax = smax - 1;
330
- if (snum > lmax) snum = lmax;
331
- if (snum < 0) snum = 0;
332
- } else
333
- snum = parseInt(jl.value);
334
- var nid = 'slide' + snum;
335
- var ne = document.getElementById(nid);
336
- if (!ne) {
337
- ne = document.getElementById('slide0');
338
- snum = 0;
339
- }
340
- if (step < 0) {incpos = incrementals[snum].length} else {incpos = 0;}
341
- if (incrementals[snum].length > 0 && incpos == 0) {
342
- for (var i = 0; i < incrementals[snum].length; i++) {
343
- if (hasClass(incrementals[snum][i], 'current'))
344
- incpos = i + 1;
345
- else
346
- addClass(incrementals[snum][i], 'incremental');
347
- }
348
- }
349
- if (incrementals[snum].length > 0 && incpos > 0)
350
- addClass(incrementals[snum][incpos - 1], 'current');
351
- ce.style.visibility = 'hidden';
352
- ne.style.visibility = 'visible';
353
- jl.selectedIndex = snum;
354
- currentSlide();
355
- number = 0;
317
+ if (document.getElementById('slideProj').disabled || step == 0) return;
318
+ var jl = document.getElementById('jumplist');
319
+ var cid = 'slide' + snum;
320
+ var ce = document.getElementById(cid);
321
+ if (incrementals[snum].length > 0) {
322
+ for (var i = 0; i < incrementals[snum].length; i++) {
323
+ removeClass(incrementals[snum][i], 'current');
324
+ removeClass(incrementals[snum][i], 'incremental');
325
+ }
326
+ }
327
+ if (step != 'j') {
328
+ snum += step;
329
+ lmax = smax - 1;
330
+ if (snum > lmax) snum = lmax;
331
+ if (snum < 0) snum = 0;
332
+ } else
333
+ snum = parseInt(jl.value);
334
+ var nid = 'slide' + snum;
335
+ var ne = document.getElementById(nid);
336
+ if (!ne) {
337
+ ne = document.getElementById('slide0');
338
+ snum = 0;
339
+ }
340
+ if (step < 0) {incpos = incrementals[snum].length} else {incpos = 0;}
341
+ if (incrementals[snum].length > 0 && incpos == 0) {
342
+ for (var i = 0; i < incrementals[snum].length; i++) {
343
+ if (hasClass(incrementals[snum][i], 'current'))
344
+ incpos = i + 1;
345
+ else
346
+ addClass(incrementals[snum][i], 'incremental');
347
+ }
348
+ }
349
+ if (incrementals[snum].length > 0 && incpos > 0)
350
+ addClass(incrementals[snum][incpos - 1], 'current');
351
+ ce.style.visibility = 'hidden';
352
+ ne.style.visibility = 'visible';
353
+ jl.selectedIndex = snum;
354
+ currentSlide();
355
+ number = 0;
356
356
  }
357
357
 
358
358
  function goTo(target) {
359
- if (target >= smax || target == snum) return;
360
- go(target - snum);
359
+ if (target >= smax || target == snum) return;
360
+ go(target - snum);
361
361
  }
362
362
 
363
363
  function subgo(step) {
364
- if (step > 0) {
365
- removeClass(incrementals[snum][incpos - 1],'current');
366
- removeClass(incrementals[snum][incpos], 'incremental');
367
- addClass(incrementals[snum][incpos],'current');
368
- incpos++;
369
- } else {
370
- incpos--;
371
- removeClass(incrementals[snum][incpos],'current');
372
- addClass(incrementals[snum][incpos], 'incremental');
373
- addClass(incrementals[snum][incpos - 1],'current');
374
- }
364
+ if (step > 0) {
365
+ removeClass(incrementals[snum][incpos - 1],'current');
366
+ removeClass(incrementals[snum][incpos], 'incremental');
367
+ addClass(incrementals[snum][incpos],'current');
368
+ incpos++;
369
+ } else {
370
+ incpos--;
371
+ removeClass(incrementals[snum][incpos],'current');
372
+ addClass(incrementals[snum][incpos], 'incremental');
373
+ addClass(incrementals[snum][incpos - 1],'current');
374
+ }
375
375
  }
376
376
 
377
377
  function toggle() {
378
- var slideColl = GetElementsWithClassName('*','slide');
379
- var slides = document.getElementById('slideProj');
380
- var outline = document.getElementById('outlineStyle');
381
- if (!slides.disabled) {
382
- slides.disabled = true;
383
- outline.disabled = false;
384
- s5mode = false;
385
- fontSize('1em');
386
- for (var n = 0; n < smax; n++) {
387
- var slide = slideColl[n];
388
- slide.style.visibility = 'visible';
389
- }
390
- } else {
391
- slides.disabled = false;
392
- outline.disabled = true;
393
- s5mode = true;
394
- fontScale();
395
- for (var n = 0; n < smax; n++) {
396
- var slide = slideColl[n];
397
- slide.style.visibility = 'hidden';
398
- }
399
- slideColl[snum].style.visibility = 'visible';
400
- }
378
+ var slideColl = GetElementsWithClassName('*','slide');
379
+ var slides = document.getElementById('slideProj');
380
+ var outline = document.getElementById('outlineStyle');
381
+ if (!slides.disabled) {
382
+ slides.disabled = true;
383
+ outline.disabled = false;
384
+ s5mode = false;
385
+ fontSize('1em');
386
+ for (var n = 0; n < smax; n++) {
387
+ var slide = slideColl[n];
388
+ slide.style.visibility = 'visible';
389
+ }
390
+ } else {
391
+ slides.disabled = false;
392
+ outline.disabled = true;
393
+ s5mode = true;
394
+ fontScale();
395
+ for (var n = 0; n < smax; n++) {
396
+ var slide = slideColl[n];
397
+ slide.style.visibility = 'hidden';
398
+ }
399
+ slideColl[snum].style.visibility = 'visible';
400
+ }
401
401
  }
402
402
 
403
403
  function showHide(action) {
404
- var obj = GetElementsWithClassName('*','hideme')[0];
405
- switch (action) {
406
- case 's': obj.style.visibility = 'visible'; break;
407
- case 'h': obj.style.visibility = 'hidden'; break;
408
- case 'k':
409
- if (obj.style.visibility != 'visible') {
410
- obj.style.visibility = 'visible';
411
- } else {
412
- obj.style.visibility = 'hidden';
413
- }
414
- break;
415
- }
404
+ var obj = GetElementsWithClassName('*','hideme')[0];
405
+ switch (action) {
406
+ case 's': obj.style.visibility = 'visible'; break;
407
+ case 'h': obj.style.visibility = 'hidden'; break;
408
+ case 'k':
409
+ if (obj.style.visibility != 'visible') {
410
+ obj.style.visibility = 'visible';
411
+ } else {
412
+ obj.style.visibility = 'hidden';
413
+ }
414
+ break;
415
+ }
416
416
  }
417
417
 
418
418
  // 'keys' code adapted from MozPoint (http://mozpoint.mozdev.org/)
419
419
  function keys(key) {
420
- if (!key) {
421
- key = event;
422
- key.which = key.keyCode;
423
- }
424
- if (key.which == 84) {
425
- toggle();
426
- return;
427
- }
428
- if (s5mode) {
429
- switch (key.which) {
430
- case 10: // return
431
- case 13: // enter
432
- if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
433
- if (key.target && isParentOrSelf(key.target, 'controls')) return;
434
- if(number != undef) {
435
- goTo(number);
436
- break;
437
- }
438
- case 32: // spacebar
439
- case 34: // page down
440
- case 39: // rightkey
441
- case 40: // downkey
442
- if(number != undef) {
443
- go(number);
444
- } else if (!incrementals[snum] || incpos >= incrementals[snum].length) {
445
- go(1);
446
- } else {
447
- subgo(1);
448
- }
449
- break;
450
- case 33: // page up
451
- case 37: // leftkey
452
- case 38: // upkey
453
- if(number != undef) {
454
- go(-1 * number);
455
- } else if (!incrementals[snum] || incpos <= 0) {
456
- go(-1);
457
- } else {
458
- subgo(-1);
459
- }
460
- break;
461
- case 36: // home
462
- goTo(0);
463
- break;
464
- case 35: // end
465
- goTo(smax-1);
466
- break;
467
- case 67: // c
468
- showHide('k');
469
- break;
470
- }
471
- if (key.which < 48 || key.which > 57) {
472
- number = undef;
473
- } else {
474
- if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
475
- if (key.target && isParentOrSelf(key.target, 'controls')) return;
476
- number = (((number != undef) ? number : 0) * 10) + (key.which - 48);
477
- }
478
- }
479
- return false;
420
+ if (!key) {
421
+ key = event;
422
+ key.which = key.keyCode;
423
+ }
424
+ if (key.which == 84) {
425
+ toggle();
426
+ return;
427
+ }
428
+ if (s5mode) {
429
+ switch (key.which) {
430
+ case 10: // return
431
+ case 13: // enter
432
+ if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
433
+ if (key.target && isParentOrSelf(key.target, 'controls')) return;
434
+ if(number != undef) {
435
+ goTo(number);
436
+ break;
437
+ }
438
+ case 32: // spacebar
439
+ case 34: // page down
440
+ case 39: // rightkey
441
+ case 40: // downkey
442
+ if(number != undef) {
443
+ go(number);
444
+ } else if (!incrementals[snum] || incpos >= incrementals[snum].length) {
445
+ go(1);
446
+ } else {
447
+ subgo(1);
448
+ }
449
+ break;
450
+ case 33: // page up
451
+ case 37: // leftkey
452
+ case 38: // upkey
453
+ if(number != undef) {
454
+ go(-1 * number);
455
+ } else if (!incrementals[snum] || incpos <= 0) {
456
+ go(-1);
457
+ } else {
458
+ subgo(-1);
459
+ }
460
+ break;
461
+ case 36: // home
462
+ goTo(0);
463
+ break;
464
+ case 35: // end
465
+ goTo(smax-1);
466
+ break;
467
+ case 67: // c
468
+ showHide('k');
469
+ break;
470
+ }
471
+ if (key.which < 48 || key.which > 57) {
472
+ number = undef;
473
+ } else {
474
+ if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
475
+ if (key.target && isParentOrSelf(key.target, 'controls')) return;
476
+ number = (((number != undef) ? number : 0) * 10) + (key.which - 48);
477
+ }
478
+ }
479
+ return false;
480
480
  }
481
481
 
482
482
  function clicker(e) {
483
- number = undef;
484
- var target;
485
- if (window.event) {
486
- target = window.event.srcElement;
487
- e = window.event;
488
- } else target = e.target;
489
- if (target.getAttribute('href') != null || hasValue(target.rel, 'external') || isParentOrSelf(target, 'controls') || isParentOrSelf(target,'embed') || isParentOrSelf(target,'object')) return true;
490
- if (!e.which || e.which == 1) {
491
- if (!incrementals[snum] || incpos >= incrementals[snum].length) {
492
- go(1);
493
- } else {
494
- subgo(1);
495
- }
496
- }
483
+ number = undef;
484
+ var target;
485
+ if (window.event) {
486
+ target = window.event.srcElement;
487
+ e = window.event;
488
+ } else target = e.target;
489
+ if (target.getAttribute('href') != null || hasValue(target.rel, 'external') || isParentOrSelf(target, 'controls') || isParentOrSelf(target,'embed') || isParentOrSelf(target,'object')) return true;
490
+ if (!e.which || e.which == 1) {
491
+ if (!incrementals[snum] || incpos >= incrementals[snum].length) {
492
+ go(1);
493
+ } else {
494
+ subgo(1);
495
+ }
496
+ }
497
497
  }
498
498
 
499
499
  function findSlide(hash) {
500
- var target = null;
501
- var slides = GetElementsWithClassName('*','slide');
502
- for (var i = 0; i < slides.length; i++) {
503
- var targetSlide = slides[i];
504
- if ( (targetSlide.name && targetSlide.name == hash)
505
- || (targetSlide.id && targetSlide.id == hash) ) {
506
- target = targetSlide;
507
- break;
508
- }
509
- }
510
- while(target != null && target.nodeName != 'BODY') {
511
- if (hasClass(target, 'slide')) {
512
- return parseInt(target.id.slice(5));
513
- }
514
- target = target.parentNode;
515
- }
516
- return null;
500
+ var target = null;
501
+ var slides = GetElementsWithClassName('*','slide');
502
+ for (var i = 0; i < slides.length; i++) {
503
+ var targetSlide = slides[i];
504
+ if ( (targetSlide.name && targetSlide.name == hash)
505
+ || (targetSlide.id && targetSlide.id == hash) ) {
506
+ target = targetSlide;
507
+ break;
508
+ }
509
+ }
510
+ while(target != null && target.nodeName != 'BODY') {
511
+ if (hasClass(target, 'slide')) {
512
+ return parseInt(target.id.slice(5));
513
+ }
514
+ target = target.parentNode;
515
+ }
516
+ return null;
517
517
  }
518
518
 
519
519
  function slideJump() {
520
- if (window.location.hash == null) return;
521
- var sregex = /^#slide(\d+)$/;
522
- var matches = sregex.exec(window.location.hash);
523
- var dest = null;
524
- if (matches != null) {
525
- dest = parseInt(matches[1]);
526
- } else {
527
- dest = findSlide(window.location.hash.slice(1));
528
- }
529
- if (dest != null)
530
- go(dest - snum);
520
+ if (window.location.hash == null) return;
521
+ var sregex = /^#slide(\d+)$/;
522
+ var matches = sregex.exec(window.location.hash);
523
+ var dest = null;
524
+ if (matches != null) {
525
+ dest = parseInt(matches[1]);
526
+ } else {
527
+ dest = findSlide(window.location.hash.slice(1));
528
+ }
529
+ if (dest != null)
530
+ go(dest - snum);
531
531
  }
532
532
 
533
533
  function fixLinks() {
534
- var thisUri = window.location.href;
535
- thisUri = thisUri.slice(0, thisUri.length - window.location.hash.length);
536
- var aelements = document.getElementsByTagName('A');
537
- for (var i = 0; i < aelements.length; i++) {
538
- var a = aelements[i].href;
539
- var slideID = a.match('\#slide[0-9]{1,2}');
540
- if ((slideID) && (slideID[0].slice(0,1) == '#')) {
541
- var dest = findSlide(slideID[0].slice(1));
542
- if (dest != null) {
543
- if (aelements[i].addEventListener) {
544
- aelements[i].addEventListener("click", new Function("e",
545
- "if (document.getElementById('slideProj').disabled) return;" +
546
- "go("+dest+" - snum); " +
547
- "if (e.preventDefault) e.preventDefault();"), true);
548
- } else if (aelements[i].attachEvent) {
549
- aelements[i].attachEvent("onclick", new Function("",
550
- "if (document.getElementById('slideProj').disabled) return;" +
551
- "go("+dest+" - snum); " +
552
- "event.returnValue = false;"));
553
- }
554
- }
555
- }
556
- }
534
+ var thisUri = window.location.href;
535
+ thisUri = thisUri.slice(0, thisUri.length - window.location.hash.length);
536
+ var aelements = document.getElementsByTagName('A');
537
+ for (var i = 0; i < aelements.length; i++) {
538
+ var a = aelements[i].href;
539
+ var slideID = a.match('\#slide[0-9]{1,2}');
540
+ if ((slideID) && (slideID[0].slice(0,1) == '#')) {
541
+ var dest = findSlide(slideID[0].slice(1));
542
+ if (dest != null) {
543
+ if (aelements[i].addEventListener) {
544
+ aelements[i].addEventListener("click", new Function("e",
545
+ "if (document.getElementById('slideProj').disabled) return;" +
546
+ "go("+dest+" - snum); " +
547
+ "if (e.preventDefault) e.preventDefault();"), true);
548
+ } else if (aelements[i].attachEvent) {
549
+ aelements[i].attachEvent("onclick", new Function("",
550
+ "if (document.getElementById('slideProj').disabled) return;" +
551
+ "go("+dest+" - snum); " +
552
+ "event.returnValue = false;"));
553
+ }
554
+ }
555
+ }
556
+ }
557
557
  }
558
558
 
559
559
  function externalLinks() {
560
- if (!document.getElementsByTagName) return;
561
- var anchors = document.getElementsByTagName('a');
562
- for (var i=0; i<anchors.length; i++) {
563
- var anchor = anchors[i];
564
- if (anchor.getAttribute('href') && hasValue(anchor.rel, 'external')) {
565
- anchor.target = '_blank';
566
- addClass(anchor,'external');
567
- }
568
- }
560
+ if (!document.getElementsByTagName) return;
561
+ var anchors = document.getElementsByTagName('a');
562
+ for (var i=0; i<anchors.length; i++) {
563
+ var anchor = anchors[i];
564
+ if (anchor.getAttribute('href') && hasValue(anchor.rel, 'external')) {
565
+ anchor.target = '_blank';
566
+ addClass(anchor,'external');
567
+ }
568
+ }
569
569
  }
570
570
 
571
571
  function createControls() {
572
- var controlsDiv = document.getElementById("controls");
573
- if (!controlsDiv) return;
574
- var hider = ' onmouseover="showHide(\'s\');" onmouseout="showHide(\'h\');"';
575
- var hideDiv, hideList = '';
576
- if (controlVis == 'hidden') {
577
- hideDiv = hider;
578
- } else {
579
- hideList = hider;
580
- }
581
- controlsDiv.innerHTML = '<form action="#" id="controlForm"' + hideDiv + '>' +
582
- '<div id="navLinks">' +
583
- '<a accesskey="t" id="toggle" href="javascript:toggle();">&#216;<\/a>' +
584
- '<a accesskey="z" id="prev" href="javascript:go(-1);">&laquo;<\/a>' +
585
- '<a accesskey="x" id="next" href="javascript:go(1);">&raquo;<\/a>' +
586
- '<div id="navList"' + hideList + '><select id="jumplist" onchange="go(\'j\');"><\/select><\/div>' +
587
- '<\/div><\/form>';
588
- if (controlVis == 'hidden') {
589
- var hidden = document.getElementById('navLinks');
590
- } else {
591
- var hidden = document.getElementById('jumplist');
592
- }
593
- addClass(hidden,'hideme');
572
+ var controlsDiv = document.getElementById("controls");
573
+ if (!controlsDiv) return;
574
+ var hider = ' onmouseover="showHide(\'s\');" onmouseout="showHide(\'h\');"';
575
+ var hideDiv, hideList = '';
576
+ if (controlVis == 'hidden') {
577
+ hideDiv = hider;
578
+ } else {
579
+ hideList = hider;
580
+ }
581
+ controlsDiv.innerHTML = '<form action="#" id="controlForm"' + hideDiv + '>' +
582
+ '<div id="navLinks">' +
583
+ '<a accesskey="t" id="toggle" href="javascript:toggle();">&#216;<\/a>' +
584
+ '<a accesskey="z" id="prev" href="javascript:go(-1);">&laquo;<\/a>' +
585
+ '<a accesskey="x" id="next" href="javascript:go(1);">&raquo;<\/a>' +
586
+ '<div id="navList"' + hideList + '><select id="jumplist" onchange="go(\'j\');"><\/select><\/div>' +
587
+ '<\/div><\/form>';
588
+ if (controlVis == 'hidden') {
589
+ var hidden = document.getElementById('navLinks');
590
+ } else {
591
+ var hidden = document.getElementById('jumplist');
592
+ }
593
+ addClass(hidden,'hideme');
594
594
  }
595
595
 
596
596
  function fontScale() { // causes layout problems in FireFox that get fixed if browser's Reload is used; same may be true of other Gecko-based browsers
597
- if (!s5mode) return false;
598
- var vScale = 22; // both yield 32 (after rounding) at 1024x768
599
- var hScale = 32; // perhaps should auto-calculate based on theme's declared value?
600
- if (window.innerHeight) {
601
- var vSize = window.innerHeight;
602
- var hSize = window.innerWidth;
603
- } else if (document.documentElement.clientHeight) {
604
- var vSize = document.documentElement.clientHeight;
605
- var hSize = document.documentElement.clientWidth;
606
- } else if (document.body.clientHeight) {
607
- var vSize = document.body.clientHeight;
608
- var hSize = document.body.clientWidth;
609
- } else {
610
- var vSize = 700; // assuming 1024x768, minus chrome and such
611
- var hSize = 1024; // these do not account for kiosk mode or Opera Show
612
- }
613
- var newSize = Math.min(Math.round(vSize/vScale),Math.round(hSize/hScale));
614
- fontSize(newSize + 'px');
615
- if (isGe) { // hack to counter incremental reflow bugs
616
- var obj = document.getElementsByTagName('body')[0];
617
- obj.style.display = 'none';
618
- obj.style.display = 'block';
619
- }
597
+ if (!s5mode) return false;
598
+ var vScale = 22; // both yield 32 (after rounding) at 1024x768
599
+ var hScale = 32; // perhaps should auto-calculate based on theme's declared value?
600
+ if (window.innerHeight) {
601
+ var vSize = window.innerHeight;
602
+ var hSize = window.innerWidth;
603
+ } else if (document.documentElement.clientHeight) {
604
+ var vSize = document.documentElement.clientHeight;
605
+ var hSize = document.documentElement.clientWidth;
606
+ } else if (document.body.clientHeight) {
607
+ var vSize = document.body.clientHeight;
608
+ var hSize = document.body.clientWidth;
609
+ } else {
610
+ var vSize = 700; // assuming 1024x768, minus chrome and such
611
+ var hSize = 1024; // these do not account for kiosk mode or Opera Show
612
+ }
613
+ var newSize = Math.min(Math.round(vSize/vScale),Math.round(hSize/hScale));
614
+ fontSize(newSize + 'px');
615
+ if (isGe) { // hack to counter incremental reflow bugs
616
+ var obj = document.getElementsByTagName('body')[0];
617
+ obj.style.display = 'none';
618
+ obj.style.display = 'block';
619
+ }
620
620
  }
621
621
 
622
622
  function fontSize(value) {
623
- if (!(s5ss = document.getElementById('s5ss'))) {
624
- if (!isIE) {
625
- document.getElementsByTagName('head')[0].appendChild(s5ss = document.createElement('style'));
626
- s5ss.setAttribute('media','screen, projection');
627
- s5ss.setAttribute('id','s5ss');
628
- } else {
629
- document.createStyleSheet();
630
- document.s5ss = document.styleSheets[document.styleSheets.length - 1];
631
- }
632
- }
633
- if (!isIE) {
634
- while (s5ss.lastChild) s5ss.removeChild(s5ss.lastChild);
635
- s5ss.appendChild(document.createTextNode('body {font-size: ' + value + ' !important;}'));
636
- } else {
637
- document.s5ss.addRule('body','font-size: ' + value + ' !important;');
638
- }
623
+ if (!(s5ss = document.getElementById('s5ss'))) {
624
+ if (!isIE) {
625
+ document.getElementsByTagName('head')[0].appendChild(s5ss = document.createElement('style'));
626
+ s5ss.setAttribute('media','screen, projection');
627
+ s5ss.setAttribute('id','s5ss');
628
+ } else {
629
+ document.createStyleSheet();
630
+ document.s5ss = document.styleSheets[document.styleSheets.length - 1];
631
+ }
632
+ }
633
+ if (!isIE) {
634
+ while (s5ss.lastChild) s5ss.removeChild(s5ss.lastChild);
635
+ s5ss.appendChild(document.createTextNode('body {font-size: ' + value + ' !important;}'));
636
+ } else {
637
+ document.s5ss.addRule('body','font-size: ' + value + ' !important;');
638
+ }
639
639
  }
640
640
 
641
641
  function notOperaFix() {
642
- slideCSS = document.getElementById('slideProj').href;
643
- var slides = document.getElementById('slideProj');
644
- var outline = document.getElementById('outlineStyle');
645
- slides.setAttribute('media','screen');
646
- outline.disabled = true;
647
- if (isGe) {
648
- slides.setAttribute('href','null'); // Gecko fix
649
- slides.setAttribute('href',slideCSS); // Gecko fix
650
- }
651
- if (isIE && document.styleSheets && document.styleSheets[0]) {
652
- document.styleSheets[0].addRule('img', 'behavior: url(ui/default/iepngfix.htc)');
653
- document.styleSheets[0].addRule('div', 'behavior: url(ui/default/iepngfix.htc)');
654
- document.styleSheets[0].addRule('.slide', 'behavior: url(ui/default/iepngfix.htc)');
655
- }
642
+ slideCSS = document.getElementById('slideProj').href;
643
+ var slides = document.getElementById('slideProj');
644
+ var outline = document.getElementById('outlineStyle');
645
+ slides.setAttribute('media','screen');
646
+ outline.disabled = true;
647
+ if (isGe) {
648
+ slides.setAttribute('href','null'); // Gecko fix
649
+ slides.setAttribute('href',slideCSS); // Gecko fix
650
+ }
651
+ if (isIE && document.styleSheets && document.styleSheets[0]) {
652
+ document.styleSheets[0].addRule('img', 'behavior: url(ui/default/iepngfix.htc)');
653
+ document.styleSheets[0].addRule('div', 'behavior: url(ui/default/iepngfix.htc)');
654
+ document.styleSheets[0].addRule('.slide', 'behavior: url(ui/default/iepngfix.htc)');
655
+ }
656
656
  }
657
657
 
658
658
  function getIncrementals(obj) {
659
- var incrementals = new Array();
660
- if (!obj)
661
- return incrementals;
662
- var children = obj.childNodes;
663
- for (var i = 0; i < children.length; i++) {
664
- var child = children[i];
665
- if (hasClass(child, 'incremental')) {
666
- if (child.nodeName == 'OL' || child.nodeName == 'UL') {
667
- removeClass(child, 'incremental');
668
- for (var j = 0; j < child.childNodes.length; j++) {
669
- if (child.childNodes[j].nodeType == 1) {
670
- addClass(child.childNodes[j], 'incremental');
671
- }
672
- }
673
- } else {
674
- incrementals[incrementals.length] = child;
675
- removeClass(child,'incremental');
676
- }
677
- }
678
- if (hasClass(child, 'show-first')) {
679
- if (child.nodeName == 'OL' || child.nodeName == 'UL') {
680
- removeClass(child, 'show-first');
681
- if (child.childNodes[isGe].nodeType == 1) {
682
- removeClass(child.childNodes[isGe], 'incremental');
683
- }
684
- } else {
685
- incrementals[incrementals.length] = child;
686
- }
687
- }
688
- incrementals = incrementals.concat(getIncrementals(child));
689
- }
690
- return incrementals;
659
+ var incrementals = new Array();
660
+ if (!obj)
661
+ return incrementals;
662
+ var children = obj.childNodes;
663
+ for (var i = 0; i < children.length; i++) {
664
+ var child = children[i];
665
+ if (hasClass(child, 'incremental')) {
666
+ if (child.nodeName == 'OL' || child.nodeName == 'UL') {
667
+ removeClass(child, 'incremental');
668
+ for (var j = 0; j < child.childNodes.length; j++) {
669
+ if (child.childNodes[j].nodeType == 1) {
670
+ addClass(child.childNodes[j], 'incremental');
671
+ }
672
+ }
673
+ } else {
674
+ incrementals[incrementals.length] = child;
675
+ removeClass(child,'incremental');
676
+ }
677
+ }
678
+ if (hasClass(child, 'show-first')) {
679
+ if (child.nodeName == 'OL' || child.nodeName == 'UL') {
680
+ removeClass(child, 'show-first');
681
+ if (child.childNodes[isGe].nodeType == 1) {
682
+ removeClass(child.childNodes[isGe], 'incremental');
683
+ }
684
+ } else {
685
+ incrementals[incrementals.length] = child;
686
+ }
687
+ }
688
+ incrementals = incrementals.concat(getIncrementals(child));
689
+ }
690
+ return incrementals;
691
691
  }
692
692
 
693
693
  function createIncrementals() {
694
- var incrementals = new Array();
695
- for (var i = 0; i < smax; i++) {
696
- incrementals[i] = getIncrementals(document.getElementById('slide'+i));
697
- }
698
- return incrementals;
694
+ var incrementals = new Array();
695
+ for (var i = 0; i < smax; i++) {
696
+ incrementals[i] = getIncrementals(document.getElementById('slide'+i));
697
+ }
698
+ return incrementals;
699
699
  }
700
700
 
701
701
  function defaultCheck() {
702
- var allMetas = document.getElementsByTagName('meta');
703
- for (var i = 0; i< allMetas.length; i++) {
704
- if (allMetas[i].name == 'defaultView') {
705
- defaultView = allMetas[i].content;
706
- }
707
- if (allMetas[i].name == 'controlVis') {
708
- controlVis = allMetas[i].content;
709
- }
710
- }
702
+ var allMetas = document.getElementsByTagName('meta');
703
+ for (var i = 0; i< allMetas.length; i++) {
704
+ if (allMetas[i].name == 'defaultView') {
705
+ defaultView = allMetas[i].content;
706
+ }
707
+ if (allMetas[i].name == 'controlVis') {
708
+ controlVis = allMetas[i].content;
709
+ }
710
+ }
711
711
  }
712
712
 
713
713
  // Key trap fix, new function body for trap()
714
714
  function trap(e) {
715
- if (!e) {
716
- e = event;
717
- e.which = e.keyCode;
718
- }
719
- try {
720
- modifierKey = e.ctrlKey || e.altKey || e.metaKey;
721
- }
722
- catch(e) {
723
- modifierKey = false;
724
- }
725
- return modifierKey || e.which == 0;
715
+ if (!e) {
716
+ e = event;
717
+ e.which = e.keyCode;
718
+ }
719
+ try {
720
+ modifierKey = e.ctrlKey || e.altKey || e.metaKey;
721
+ }
722
+ catch(e) {
723
+ modifierKey = false;
724
+ }
725
+ return modifierKey || e.which == 0;
726
726
  }
727
727
 
728
728
  function startup() {
729
- defaultCheck();
730
- if (!isOp)
731
- createControls();
732
- slideLabel();
733
- fixLinks();
734
- externalLinks();
735
- fontScale();
736
- if (!isOp) {
737
- notOperaFix();
738
- incrementals = createIncrementals();
739
- slideJump();
740
- if (defaultView == 'outline') {
741
- toggle();
742
- }
743
- document.onkeyup = keys;
744
- document.onkeypress = trap;
745
- document.onclick = clicker;
746
- }
729
+ defaultCheck();
730
+ if (!isOp)
731
+ createControls();
732
+ slideLabel();
733
+ fixLinks();
734
+ externalLinks();
735
+ fontScale();
736
+ if (!isOp) {
737
+ notOperaFix();
738
+ incrementals = createIncrementals();
739
+ slideJump();
740
+ if (defaultView == 'outline') {
741
+ toggle();
742
+ }
743
+ document.onkeyup = keys;
744
+ document.onkeypress = trap;
745
+ document.onclick = clicker;
746
+ }
747
747
  }
748
748
 
749
749
  window.onload = startup;
@@ -752,5 +752,5 @@ window.onresize = function(){setTimeout('fontScale()', 50);}
752
752
 
753
753
  EOF
754
754
 
755
- end
755
+ end
756
756