francois-webby 0.9.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. data/History.txt +218 -0
  2. data/README.rdoc +92 -0
  3. data/Rakefile +62 -0
  4. data/bin/webby +41 -0
  5. data/bin/webby-gen +41 -0
  6. data/examples/blog/Sitefile +7 -0
  7. data/examples/blog/tasks/blog.rake +72 -0
  8. data/examples/blog/templates/atom_feed.erb +40 -0
  9. data/examples/blog/templates/blog/month.erb +22 -0
  10. data/examples/blog/templates/blog/post.erb +16 -0
  11. data/examples/blog/templates/blog/year.erb +22 -0
  12. data/examples/presentation/Sitefile +10 -0
  13. data/examples/presentation/content/css/uv/twilight.css +137 -0
  14. data/examples/presentation/content/presentation/_sample_code.txt +10 -0
  15. data/examples/presentation/content/presentation/index.txt +63 -0
  16. data/examples/presentation/content/presentation/s5/blank.gif +0 -0
  17. data/examples/presentation/content/presentation/s5/bodybg.gif +0 -0
  18. data/examples/presentation/content/presentation/s5/framing.css +23 -0
  19. data/examples/presentation/content/presentation/s5/iepngfix.htc +42 -0
  20. data/examples/presentation/content/presentation/s5/opera.css +7 -0
  21. data/examples/presentation/content/presentation/s5/outline.css +15 -0
  22. data/examples/presentation/content/presentation/s5/pretty.css +86 -0
  23. data/examples/presentation/content/presentation/s5/print.css +25 -0
  24. data/examples/presentation/content/presentation/s5/s5-core.css +9 -0
  25. data/examples/presentation/content/presentation/s5/slides.css +3 -0
  26. data/examples/presentation/content/presentation/s5/slides.js +553 -0
  27. data/examples/presentation/layouts/presentation.txt +43 -0
  28. data/examples/presentation/templates/_code_partial.erb +13 -0
  29. data/examples/presentation/templates/presentation.erb +40 -0
  30. data/examples/tumblog/Sitefile +9 -0
  31. data/examples/tumblog/content/css/tumblog.css +308 -0
  32. data/examples/tumblog/content/images/tumblog/permalink.gif +0 -0
  33. data/examples/tumblog/content/images/tumblog/rss.gif +0 -0
  34. data/examples/tumblog/content/tumblog/200806/the-noble-chicken/index.txt +12 -0
  35. data/examples/tumblog/content/tumblog/200807/historical-perspectives-on-the-classic-chicken-joke/index.txt +12 -0
  36. data/examples/tumblog/content/tumblog/200807/mad-city-chickens/index.txt +10 -0
  37. data/examples/tumblog/content/tumblog/200807/the-wisdom-of-the-dutch/index.txt +11 -0
  38. data/examples/tumblog/content/tumblog/200807/up-a-tree/index.txt +13 -0
  39. data/examples/tumblog/content/tumblog/index.txt +37 -0
  40. data/examples/tumblog/content/tumblog/rss.txt +37 -0
  41. data/examples/tumblog/layouts/tumblog/default.txt +44 -0
  42. data/examples/tumblog/layouts/tumblog/post.txt +15 -0
  43. data/examples/tumblog/lib/tumblog_helper.rb +32 -0
  44. data/examples/tumblog/tasks/tumblog.rake +30 -0
  45. data/examples/tumblog/templates/atom_feed.erb +40 -0
  46. data/examples/tumblog/templates/tumblog/conversation.erb +12 -0
  47. data/examples/tumblog/templates/tumblog/link.erb +10 -0
  48. data/examples/tumblog/templates/tumblog/photo.erb +13 -0
  49. data/examples/tumblog/templates/tumblog/post.erb +12 -0
  50. data/examples/tumblog/templates/tumblog/quote.erb +11 -0
  51. data/examples/webby/Sitefile +19 -0
  52. data/examples/webby/content/communicate/index.txt +28 -0
  53. data/examples/webby/content/css/background.gif +0 -0
  54. data/examples/webby/content/css/blueprint/print.css +76 -0
  55. data/examples/webby/content/css/blueprint/screen.css +696 -0
  56. data/examples/webby/content/css/coderay.css +96 -0
  57. data/examples/webby/content/css/site.css +196 -0
  58. data/examples/webby/content/css/uv/twilight.css +137 -0
  59. data/examples/webby/content/index.txt +37 -0
  60. data/examples/webby/content/learn/index.txt +28 -0
  61. data/examples/webby/content/reference/index.txt +204 -0
  62. data/examples/webby/content/release-notes/index.txt +21 -0
  63. data/examples/webby/content/release-notes/rel-0-9-0/index.txt +74 -0
  64. data/examples/webby/content/release-notes/rel-0-9-1/index.txt +93 -0
  65. data/examples/webby/content/release-notes/rel-0-9-2/index.txt +14 -0
  66. data/examples/webby/content/release-notes/rel-0-9-3/index.txt +47 -0
  67. data/examples/webby/content/robots.txt +6 -0
  68. data/examples/webby/content/script/jquery.corner.js +152 -0
  69. data/examples/webby/content/script/jquery.js +31 -0
  70. data/examples/webby/content/sitemap.txt +31 -0
  71. data/examples/webby/content/tips_and_tricks/index.txt +97 -0
  72. data/examples/webby/content/tutorial/index.txt +135 -0
  73. data/examples/webby/content/user-manual/index.txt +419 -0
  74. data/examples/webby/layouts/default.txt +49 -0
  75. data/examples/webby/templates/page.erb +10 -0
  76. data/examples/website/Sitefile +7 -0
  77. data/examples/website/content/css/blueprint/ie.css +26 -0
  78. data/examples/website/content/css/blueprint/plugins/buttons/icons/cross.png +0 -0
  79. data/examples/website/content/css/blueprint/plugins/buttons/icons/key.png +0 -0
  80. data/examples/website/content/css/blueprint/plugins/buttons/icons/tick.png +0 -0
  81. data/examples/website/content/css/blueprint/plugins/buttons/readme.txt +32 -0
  82. data/examples/website/content/css/blueprint/plugins/buttons/screen.css +97 -0
  83. data/examples/website/content/css/blueprint/plugins/fancy-type/readme.txt +14 -0
  84. data/examples/website/content/css/blueprint/plugins/fancy-type/screen.css +71 -0
  85. data/examples/website/content/css/blueprint/plugins/link-icons/icons/doc.png +0 -0
  86. data/examples/website/content/css/blueprint/plugins/link-icons/icons/email.png +0 -0
  87. data/examples/website/content/css/blueprint/plugins/link-icons/icons/external.png +0 -0
  88. data/examples/website/content/css/blueprint/plugins/link-icons/icons/feed.png +0 -0
  89. data/examples/website/content/css/blueprint/plugins/link-icons/icons/im.png +0 -0
  90. data/examples/website/content/css/blueprint/plugins/link-icons/icons/pdf.png +0 -0
  91. data/examples/website/content/css/blueprint/plugins/link-icons/icons/visited.png +0 -0
  92. data/examples/website/content/css/blueprint/plugins/link-icons/icons/xls.png +0 -0
  93. data/examples/website/content/css/blueprint/plugins/link-icons/readme.txt +18 -0
  94. data/examples/website/content/css/blueprint/plugins/link-icons/screen.css +40 -0
  95. data/examples/website/content/css/blueprint/plugins/rtl/readme.txt +10 -0
  96. data/examples/website/content/css/blueprint/plugins/rtl/screen.css +109 -0
  97. data/examples/website/content/css/blueprint/print.css +30 -0
  98. data/examples/website/content/css/blueprint/screen.css +251 -0
  99. data/examples/website/content/css/blueprint/src/forms.css +49 -0
  100. data/examples/website/content/css/blueprint/src/grid.css +212 -0
  101. data/examples/website/content/css/blueprint/src/grid.png +0 -0
  102. data/examples/website/content/css/blueprint/src/ie.css +59 -0
  103. data/examples/website/content/css/blueprint/src/print.css +85 -0
  104. data/examples/website/content/css/blueprint/src/reset.css +38 -0
  105. data/examples/website/content/css/blueprint/src/typography.css +105 -0
  106. data/examples/website/content/css/coderay.css +111 -0
  107. data/examples/website/content/css/site.css +67 -0
  108. data/examples/website/content/index.txt +19 -0
  109. data/examples/website/layouts/default.txt +61 -0
  110. data/examples/website/lib/breadcrumbs.rb +28 -0
  111. data/examples/website/templates/_partial.erb +10 -0
  112. data/examples/website/templates/page.erb +18 -0
  113. data/lib/webby/apps/generator.rb +276 -0
  114. data/lib/webby/apps/main.rb +258 -0
  115. data/lib/webby/apps.rb +12 -0
  116. data/lib/webby/auto_builder.rb +157 -0
  117. data/lib/webby/builder.rb +172 -0
  118. data/lib/webby/core_ext/enumerable.rb +11 -0
  119. data/lib/webby/core_ext/hash.rb +28 -0
  120. data/lib/webby/core_ext/kernel.rb +26 -0
  121. data/lib/webby/core_ext/string.rb +163 -0
  122. data/lib/webby/core_ext/time.rb +9 -0
  123. data/lib/webby/filters/basepath.rb +97 -0
  124. data/lib/webby/filters/erb.rb +9 -0
  125. data/lib/webby/filters/haml.rb +18 -0
  126. data/lib/webby/filters/markdown.rb +16 -0
  127. data/lib/webby/filters/maruku.rb +16 -0
  128. data/lib/webby/filters/outline.rb +309 -0
  129. data/lib/webby/filters/sass.rb +17 -0
  130. data/lib/webby/filters/slides.rb +56 -0
  131. data/lib/webby/filters/textile.rb +16 -0
  132. data/lib/webby/filters/tidy.rb +76 -0
  133. data/lib/webby/filters/wiki_words.rb +14 -0
  134. data/lib/webby/filters.rb +85 -0
  135. data/lib/webby/helpers/capture_helper.rb +141 -0
  136. data/lib/webby/helpers/coderay_helper.rb +69 -0
  137. data/lib/webby/helpers/graphviz_helper.rb +136 -0
  138. data/lib/webby/helpers/tag_helper.rb +65 -0
  139. data/lib/webby/helpers/tex_img_helper.rb +133 -0
  140. data/lib/webby/helpers/ultraviolet_helper.rb +63 -0
  141. data/lib/webby/helpers/url_helper.rb +241 -0
  142. data/lib/webby/helpers.rb +30 -0
  143. data/lib/webby/journal.rb +126 -0
  144. data/lib/webby/link_validator.rb +160 -0
  145. data/lib/webby/renderer.rb +389 -0
  146. data/lib/webby/resources/db.rb +251 -0
  147. data/lib/webby/resources/layout.rb +54 -0
  148. data/lib/webby/resources/meta_file.rb +211 -0
  149. data/lib/webby/resources/page.rb +81 -0
  150. data/lib/webby/resources/partial.rb +85 -0
  151. data/lib/webby/resources/resource.rb +201 -0
  152. data/lib/webby/resources/static.rb +36 -0
  153. data/lib/webby/resources.rb +137 -0
  154. data/lib/webby/stelan/mktemp.rb +135 -0
  155. data/lib/webby/stelan/paginator.rb +165 -0
  156. data/lib/webby/tasks/build.rake +27 -0
  157. data/lib/webby/tasks/create.rake +25 -0
  158. data/lib/webby/tasks/deploy.rake +22 -0
  159. data/lib/webby/tasks/growl.rake +16 -0
  160. data/lib/webby/tasks/validate.rake +19 -0
  161. data/lib/webby.rb +232 -0
  162. data/spec/core_ext/hash_spec.rb +47 -0
  163. data/spec/core_ext/string_spec.rb +110 -0
  164. data/spec/core_ext/time_spec.rb +19 -0
  165. data/spec/data/hooligans/bad_meta_data_1.txt +34 -0
  166. data/spec/data/hooligans/bad_meta_data_2.txt +34 -0
  167. data/spec/data/html/anchor.html +11 -0
  168. data/spec/data/html/external.html +10 -0
  169. data/spec/data/html/invalid-relative.html +10 -0
  170. data/spec/data/html/relative-anchor.html +10 -0
  171. data/spec/data/html/relative-invalid-anchor.html +10 -0
  172. data/spec/data/html/relative.html +10 -0
  173. data/spec/data/outline/basic.out +81 -0
  174. data/spec/data/outline/basic.txt +25 -0
  175. data/spec/data/outline/no_clobber.out +86 -0
  176. data/spec/data/outline/numbering.out +81 -0
  177. data/spec/data/outline/numbering_only.out +21 -0
  178. data/spec/data/outline/toc_range_1.out +66 -0
  179. data/spec/data/outline/toc_range_2.out +55 -0
  180. data/spec/data/outline/toc_style.out +81 -0
  181. data/spec/data/site/Sitefile +9 -0
  182. data/spec/data/site/content/_partial.txt +10 -0
  183. data/spec/data/site/content/css/coderay.css +111 -0
  184. data/spec/data/site/content/css/site.css +67 -0
  185. data/spec/data/site/content/css/tumblog.css +308 -0
  186. data/spec/data/site/content/images/tumblog/permalink.gif +0 -0
  187. data/spec/data/site/content/images/tumblog/rss.gif +0 -0
  188. data/spec/data/site/content/index.txt +19 -0
  189. data/spec/data/site/content/photos.txt +21 -0
  190. data/spec/data/site/content/tumblog/200806/the-noble-chicken/index.txt +12 -0
  191. data/spec/data/site/content/tumblog/200807/historical-perspectives-on-the-classic-chicken-joke/index.txt +12 -0
  192. data/spec/data/site/content/tumblog/200807/mad-city-chickens/index.txt +10 -0
  193. data/spec/data/site/content/tumblog/200807/the-wisdom-of-the-dutch/index.txt +11 -0
  194. data/spec/data/site/content/tumblog/200807/up-a-tree/index.txt +13 -0
  195. data/spec/data/site/content/tumblog/index.txt +37 -0
  196. data/spec/data/site/content/tumblog/rss.txt +37 -0
  197. data/spec/data/site/layouts/default.txt +58 -0
  198. data/spec/data/site/layouts/tumblog/default.txt +44 -0
  199. data/spec/data/site/layouts/tumblog/post.txt +15 -0
  200. data/spec/data/site/lib/breadcrumbs.rb +28 -0
  201. data/spec/data/site/lib/tumblog_helper.rb +32 -0
  202. data/spec/data/site/tasks/tumblog.rake +30 -0
  203. data/spec/data/site/templates/_partial.erb +10 -0
  204. data/spec/data/site/templates/atom_feed.erb +40 -0
  205. data/spec/data/site/templates/page.erb +18 -0
  206. data/spec/data/site/templates/presentation.erb +40 -0
  207. data/spec/data/site/templates/tumblog/conversation.erb +12 -0
  208. data/spec/data/site/templates/tumblog/link.erb +10 -0
  209. data/spec/data/site/templates/tumblog/photo.erb +13 -0
  210. data/spec/data/site/templates/tumblog/post.erb +12 -0
  211. data/spec/data/site/templates/tumblog/quote.erb +11 -0
  212. data/spec/spec.opts +1 -0
  213. data/spec/spec_helper.rb +58 -0
  214. data/spec/webby/apps/generator_spec.rb +117 -0
  215. data/spec/webby/apps/main_spec.rb +88 -0
  216. data/spec/webby/filters/basepath_spec.rb +167 -0
  217. data/spec/webby/filters/maruku_spec.rb +31 -0
  218. data/spec/webby/filters/outline_spec.rb +92 -0
  219. data/spec/webby/filters/textile_spec.rb +31 -0
  220. data/spec/webby/helpers/capture_helper_spec.rb +56 -0
  221. data/spec/webby/link_validator_spec.rb +154 -0
  222. data/spec/webby/renderer_spec.rb +139 -0
  223. data/spec/webby/resources/db_spec.rb +250 -0
  224. data/spec/webby/resources/layout_spec.rb +83 -0
  225. data/spec/webby/resources/meta_file_spec.rb +171 -0
  226. data/spec/webby/resources/page_spec.rb +111 -0
  227. data/spec/webby/resources/partial_spec.rb +58 -0
  228. data/spec/webby/resources/resource_spec.rb +219 -0
  229. data/spec/webby/resources/static_spec.rb +49 -0
  230. data/spec/webby/resources_spec.rb +69 -0
  231. data/tasks/mswin32.rake +38 -0
  232. data/tasks/website.rake +37 -0
  233. metadata +372 -0
@@ -0,0 +1,7 @@
1
+ /* DO NOT CHANGE THESE unless you really want to break Opera Show */
2
+ .slide {
3
+ visibility: visible !important;
4
+ position: static !important;
5
+ page-break-before: always;
6
+ }
7
+ #slide0 {page-break-before: avoid;}
@@ -0,0 +1,15 @@
1
+ /* don't change this unless you want the layout stuff to show up in the outline view! */
2
+
3
+ .layout div, #footer *, #controlForm * {display: none;}
4
+ #footer, #controls, #controlForm, #navLinks, #toggle {
5
+ display: block; visibility: visible; margin: 0; padding: 0;}
6
+ #toggle {float: right; padding: 0.5em;}
7
+ html>body #toggle {position: fixed; top: 0; right: 0;}
8
+
9
+ /* making the outline look pretty-ish */
10
+
11
+ #slide0 h1, #slide0 h2, #slide0 h3, #slide0 h4 {border: none; margin: 0;}
12
+ #slide0 h1 {padding-top: 1.5em;}
13
+ .slide h1 {margin: 1.5em 0 0; padding-top: 0.25em;
14
+ border-top: 1px solid #888; border-bottom: 1px solid #AAA;}
15
+ #toggle {border: 1px solid; border-width: 0 0 1px 1px; background: #FFF;}
@@ -0,0 +1,86 @@
1
+ /* Following are the presentation styles -- edit away! */
2
+
3
+ body {background: #FFF url(bodybg.gif) -16px 0 no-repeat; color: #000; font-size: 2em;}
4
+ :link, :visited {text-decoration: none; color: #00C;}
5
+ #controls :active {color: #88A !important;}
6
+ #controls :focus {outline: 1px dotted #227;}
7
+ h1, h2, h3, h4 {font-size: 100%; margin: 0; padding: 0; font-weight: inherit;}
8
+ ul, pre {margin: 0; line-height: 1em;}
9
+ html, body {margin: 0; padding: 0;}
10
+
11
+ blockquote, q {font-style: italic;}
12
+ blockquote {padding: 0 2em 0.5em; margin: 0 1.5em 0.5em; text-align: center; font-size: 1em;}
13
+ blockquote p {margin: 0;}
14
+ blockquote i {font-style: normal;}
15
+ blockquote b {display: block; margin-top: 0.5em; font-weight: normal; font-size: smaller; font-style: normal;}
16
+ blockquote b i {font-style: italic;}
17
+
18
+ kbd {font-weight: bold; font-size: 1em;}
19
+ sup {font-size: smaller; line-height: 1px;}
20
+
21
+ .slide code {padding: 2px 0.25em; font-weight: bold; color: #533;}
22
+ .slide code.bad, code del {color: red;}
23
+ .slide code.old {color: silver;}
24
+ .slide pre {padding: 0; margin: 0.25em 0 0.5em 0.5em; color: #533; font-size: 90%;}
25
+ .slide pre code {display: block;}
26
+ .slide ul {margin-left: 5%; margin-right: 7%; list-style: disc;}
27
+ .slide li {margin-top: 0.75em; margin-right: 0;}
28
+ .slide ul ul {line-height: 1;}
29
+ .slide ul ul li {margin: .2em; font-size: 85%; list-style: square;}
30
+ .slide img.leader {display: block; margin: 0 auto;}
31
+
32
+ div#header, div#footer {background: #005; color: #AAB;
33
+ font-family: Verdana, Helvetica, sans-serif;}
34
+ div#header {background: #005 url(bodybg.gif) -16px 0 no-repeat;
35
+ line-height: 1px;}
36
+ div#footer {font-size: 0.5em; font-weight: bold; padding: 1em 0;}
37
+ #footer h1, #footer h2 {display: block; padding: 0 1em;}
38
+ #footer h2 {font-style: italic;}
39
+
40
+ div.long {font-size: 0.75em;}
41
+ .slide h1 {position: absolute; top: 0.7em; left: 87px; z-index: 1;
42
+ margin: 0; padding: 0.3em 0 0 50px; white-space: nowrap;
43
+ font: bold 150%/1em Helvetica, sans-serif; text-transform: capitalize;
44
+ color: #DDE; background: #005;}
45
+ .slide h3 {font-size: 130%;}
46
+ h1 abbr {font-variant: small-caps;}
47
+
48
+ div#controls {position: absolute; left: 50%; bottom: 0;
49
+ width: 50%;
50
+ text-align: right; font: bold 0.9em Verdana, Helvetica, sans-serif;}
51
+ html>body div#controls {position: fixed; padding: 0 0 1em 0;
52
+ top: auto;}
53
+ div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;
54
+ margin: 0; padding: 0;}
55
+ #controls #navLinks a {padding: 0; margin: 0 0.5em;
56
+ background: #005; border: none; color: #779;
57
+ cursor: pointer;}
58
+ #controls #navList {height: 1em;}
59
+ #controls #navList #jumplist {position: absolute; bottom: 0; right: 0; background: #DDD; color: #227;}
60
+
61
+ #currentSlide {text-align: center; font-size: 0.5em; color: #449;}
62
+
63
+ #slide0 {padding-top: 3.5em; font-size: 90%;}
64
+ #slide0 h1 {position: static; margin: 1em 0 0; padding: 0;
65
+ font: bold 2em Helvetica, sans-serif; white-space: normal;
66
+ color: #000; background: transparent;}
67
+ #slide0 h2 {font: bold italic 1em Helvetica, sans-serif; margin: 0.25em;}
68
+ #slide0 h3 {margin-top: 1.5em; font-size: 1.5em;}
69
+ #slide0 h4 {margin-top: 0; font-size: 1em;}
70
+
71
+ ul.urls {list-style: none; display: inline; margin: 0;}
72
+ .urls li {display: inline; margin: 0;}
73
+ .note {display: none;}
74
+ .external {border-bottom: 1px dotted gray;}
75
+ html>body .external {border-bottom: none;}
76
+ .external:after {content: " \274F"; font-size: smaller; color: #77B;}
77
+
78
+ .incremental, .incremental *, .incremental *:after {color: #DDE; visibility: visible;}
79
+ img.incremental {visibility: hidden;}
80
+ .slide .current {color: #B02;}
81
+
82
+
83
+ /* diagnostics
84
+
85
+ li:after {content: " [" attr(class) "]"; color: #F88;}
86
+ */
@@ -0,0 +1,25 @@
1
+ /* The following rule is necessary to have all slides appear in print! DO NOT REMOVE IT! */
2
+ .slide, ul {page-break-inside: avoid; visibility: visible !important;}
3
+ h1 {page-break-after: avoid;}
4
+
5
+ body {font-size: 12pt; background: white;}
6
+ * {color: black;}
7
+
8
+ #slide0 h1 {font-size: 200%; border: none; margin: 0.5em 0 0.25em;}
9
+ #slide0 h3 {margin: 0; padding: 0;}
10
+ #slide0 h4 {margin: 0 0 0.5em; padding: 0;}
11
+ #slide0 {margin-bottom: 3em;}
12
+
13
+ h1 {border-top: 2pt solid gray; border-bottom: 1px dotted silver;}
14
+ .extra {background: transparent !important;}
15
+ div.extra, pre.extra, .example {font-size: 10pt; color: #333;}
16
+ ul.extra a {font-weight: bold;}
17
+ p.example {display: none;}
18
+
19
+ #header {display: none;}
20
+ #footer h1 {margin: 0; border-bottom: 1px solid; color: gray; font-style: italic;}
21
+ #footer h2, #controls {display: none;}
22
+
23
+ /* The following rule keeps the layout stuff out of print. Remove at your own risk! */
24
+ .layout, .layout * {display: none !important;}
25
+
@@ -0,0 +1,9 @@
1
+ /* Do not edit or override these styles! The system will likely break if you do. */
2
+
3
+ div#header, div#footer, div#controls, .slide {position: absolute;}
4
+ html>body div#header, html>body div#footer,
5
+ html>body div#controls, html>body .slide {position: fixed;}
6
+ .handout {display: none;}
7
+ .layout {display: block;}
8
+ .slide, .hideme, .incremental {visibility: hidden;}
9
+ #slide0 {visibility: visible;}
@@ -0,0 +1,3 @@
1
+ @import url(s5-core.css); /* required to make the slide show run at all */
2
+ @import url(framing.css); /* sets basic placement and size of slide components */
3
+ @import url(pretty.css); /* stuff that makes the slides look better than blah */
@@ -0,0 +1,553 @@
1
+ // S5 v1.1 slides.js -- released into the Public Domain
2
+ //
3
+ // Please see http://www.meyerweb.com/eric/tools/s5/credits.html for information
4
+ // about all the wonderful and talented contributors to this code!
5
+
6
+ var undef;
7
+ var slideCSS = '';
8
+ var snum = 0;
9
+ var smax = 1;
10
+ var incpos = 0;
11
+ var number = undef;
12
+ var s5mode = true;
13
+ var defaultView = 'slideshow';
14
+ var controlVis = 'visible';
15
+
16
+ var isIE = navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Opera') < 1 ? 1 : 0;
17
+ var isOp = navigator.userAgent.indexOf('Opera') > -1 ? 1 : 0;
18
+ var isGe = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') < 1 ? 1 : 0;
19
+
20
+ function hasClass(object, className) {
21
+ if (!object.className) return false;
22
+ return (object.className.search('(^|\\s)' + className + '(\\s|$)') != -1);
23
+ }
24
+
25
+ function hasValue(object, value) {
26
+ if (!object) return false;
27
+ return (object.search('(^|\\s)' + value + '(\\s|$)') != -1);
28
+ }
29
+
30
+ function removeClass(object,className) {
31
+ if (!object) return;
32
+ object.className = object.className.replace(new RegExp('(^|\\s)'+className+'(\\s|$)'), RegExp.$1+RegExp.$2);
33
+ }
34
+
35
+ function addClass(object,className) {
36
+ if (!object || hasClass(object, className)) return;
37
+ if (object.className) {
38
+ object.className += ' '+className;
39
+ } else {
40
+ object.className = className;
41
+ }
42
+ }
43
+
44
+ function GetElementsWithClassName(elementName,className) {
45
+ var allElements = document.getElementsByTagName(elementName);
46
+ var elemColl = new Array();
47
+ for (var i = 0; i< allElements.length; i++) {
48
+ if (hasClass(allElements[i], className)) {
49
+ elemColl[elemColl.length] = allElements[i];
50
+ }
51
+ }
52
+ return elemColl;
53
+ }
54
+
55
+ function isParentOrSelf(element, id) {
56
+ if (element == null || element.nodeName=='BODY') return false;
57
+ else if (element.id == id) return true;
58
+ else return isParentOrSelf(element.parentNode, id);
59
+ }
60
+
61
+ function nodeValue(node) {
62
+ var result = "";
63
+ if (node.nodeType == 1) {
64
+ var children = node.childNodes;
65
+ for (var i = 0; i < children.length; ++i) {
66
+ result += nodeValue(children[i]);
67
+ }
68
+ }
69
+ else if (node.nodeType == 3) {
70
+ result = node.nodeValue;
71
+ }
72
+ return(result);
73
+ }
74
+
75
+ function slideLabel() {
76
+ var slideColl = GetElementsWithClassName('*','slide');
77
+ var list = document.getElementById('jumplist');
78
+ smax = slideColl.length;
79
+ for (var n = 0; n < smax; n++) {
80
+ var obj = slideColl[n];
81
+
82
+ var did = 'slide' + n.toString();
83
+ obj.setAttribute('id',did);
84
+ if (isOp) continue;
85
+
86
+ var otext = '';
87
+ var menu = obj.firstChild;
88
+ if (!menu) continue; // to cope with empty slides
89
+ while (menu && menu.nodeType == 3) {
90
+ menu = menu.nextSibling;
91
+ }
92
+ if (!menu) continue; // to cope with slides with only text nodes
93
+
94
+ var menunodes = menu.childNodes;
95
+ for (var o = 0; o < menunodes.length; o++) {
96
+ otext += nodeValue(menunodes[o]);
97
+ }
98
+ list.options[list.length] = new Option(n + ' : ' + otext, n);
99
+ }
100
+ }
101
+
102
+ function currentSlide() {
103
+ var cs;
104
+ if (document.getElementById) {
105
+ cs = document.getElementById('currentSlide');
106
+ } else {
107
+ cs = document.currentSlide;
108
+ }
109
+ cs.innerHTML = '<span id="csHere">' + snum + '<\/span> ' +
110
+ '<span id="csSep">\/<\/span> ' +
111
+ '<span id="csTotal">' + (smax-1) + '<\/span>';
112
+ if (snum == 0) {
113
+ cs.style.visibility = 'hidden';
114
+ } else {
115
+ cs.style.visibility = 'visible';
116
+ }
117
+ }
118
+
119
+ function go(step) {
120
+ if (document.getElementById('slideProj').disabled || step == 0) return;
121
+ var jl = document.getElementById('jumplist');
122
+ var cid = 'slide' + snum;
123
+ var ce = document.getElementById(cid);
124
+ if (incrementals[snum].length > 0) {
125
+ for (var i = 0; i < incrementals[snum].length; i++) {
126
+ removeClass(incrementals[snum][i], 'current');
127
+ removeClass(incrementals[snum][i], 'incremental');
128
+ }
129
+ }
130
+ if (step != 'j') {
131
+ snum += step;
132
+ lmax = smax - 1;
133
+ if (snum > lmax) snum = lmax;
134
+ if (snum < 0) snum = 0;
135
+ } else
136
+ snum = parseInt(jl.value);
137
+ var nid = 'slide' + snum;
138
+ var ne = document.getElementById(nid);
139
+ if (!ne) {
140
+ ne = document.getElementById('slide0');
141
+ snum = 0;
142
+ }
143
+ if (step < 0) {incpos = incrementals[snum].length} else {incpos = 0;}
144
+ if (incrementals[snum].length > 0 && incpos == 0) {
145
+ for (var i = 0; i < incrementals[snum].length; i++) {
146
+ if (hasClass(incrementals[snum][i], 'current'))
147
+ incpos = i + 1;
148
+ else
149
+ addClass(incrementals[snum][i], 'incremental');
150
+ }
151
+ }
152
+ if (incrementals[snum].length > 0 && incpos > 0)
153
+ addClass(incrementals[snum][incpos - 1], 'current');
154
+ ce.style.visibility = 'hidden';
155
+ ne.style.visibility = 'visible';
156
+ jl.selectedIndex = snum;
157
+ currentSlide();
158
+ number = 0;
159
+ }
160
+
161
+ function goTo(target) {
162
+ if (target >= smax || target == snum) return;
163
+ go(target - snum);
164
+ }
165
+
166
+ function subgo(step) {
167
+ if (step > 0) {
168
+ removeClass(incrementals[snum][incpos - 1],'current');
169
+ removeClass(incrementals[snum][incpos], 'incremental');
170
+ addClass(incrementals[snum][incpos],'current');
171
+ incpos++;
172
+ } else {
173
+ incpos--;
174
+ removeClass(incrementals[snum][incpos],'current');
175
+ addClass(incrementals[snum][incpos], 'incremental');
176
+ addClass(incrementals[snum][incpos - 1],'current');
177
+ }
178
+ }
179
+
180
+ function toggle() {
181
+ var slideColl = GetElementsWithClassName('*','slide');
182
+ var slides = document.getElementById('slideProj');
183
+ var outline = document.getElementById('outlineStyle');
184
+ if (!slides.disabled) {
185
+ slides.disabled = true;
186
+ outline.disabled = false;
187
+ s5mode = false;
188
+ fontSize('1em');
189
+ for (var n = 0; n < smax; n++) {
190
+ var slide = slideColl[n];
191
+ slide.style.visibility = 'visible';
192
+ }
193
+ } else {
194
+ slides.disabled = false;
195
+ outline.disabled = true;
196
+ s5mode = true;
197
+ fontScale();
198
+ for (var n = 0; n < smax; n++) {
199
+ var slide = slideColl[n];
200
+ slide.style.visibility = 'hidden';
201
+ }
202
+ slideColl[snum].style.visibility = 'visible';
203
+ }
204
+ }
205
+
206
+ function showHide(action) {
207
+ var obj = GetElementsWithClassName('*','hideme')[0];
208
+ switch (action) {
209
+ case 's': obj.style.visibility = 'visible'; break;
210
+ case 'h': obj.style.visibility = 'hidden'; break;
211
+ case 'k':
212
+ if (obj.style.visibility != 'visible') {
213
+ obj.style.visibility = 'visible';
214
+ } else {
215
+ obj.style.visibility = 'hidden';
216
+ }
217
+ break;
218
+ }
219
+ }
220
+
221
+ // 'keys' code adapted from MozPoint (http://mozpoint.mozdev.org/)
222
+ function keys(key) {
223
+ if (!key) {
224
+ key = event;
225
+ key.which = key.keyCode;
226
+ }
227
+ if (key.which == 84) {
228
+ toggle();
229
+ return;
230
+ }
231
+ if (s5mode) {
232
+ switch (key.which) {
233
+ case 10: // return
234
+ case 13: // enter
235
+ if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
236
+ if (key.target && isParentOrSelf(key.target, 'controls')) return;
237
+ if(number != undef) {
238
+ goTo(number);
239
+ break;
240
+ }
241
+ case 32: // spacebar
242
+ case 34: // page down
243
+ case 39: // rightkey
244
+ case 40: // downkey
245
+ if(number != undef) {
246
+ go(number);
247
+ } else if (!incrementals[snum] || incpos >= incrementals[snum].length) {
248
+ go(1);
249
+ } else {
250
+ subgo(1);
251
+ }
252
+ break;
253
+ case 33: // page up
254
+ case 37: // leftkey
255
+ case 38: // upkey
256
+ if(number != undef) {
257
+ go(-1 * number);
258
+ } else if (!incrementals[snum] || incpos <= 0) {
259
+ go(-1);
260
+ } else {
261
+ subgo(-1);
262
+ }
263
+ break;
264
+ case 36: // home
265
+ goTo(0);
266
+ break;
267
+ case 35: // end
268
+ goTo(smax-1);
269
+ break;
270
+ case 67: // c
271
+ showHide('k');
272
+ break;
273
+ }
274
+ if (key.which < 48 || key.which > 57) {
275
+ number = undef;
276
+ } else {
277
+ if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
278
+ if (key.target && isParentOrSelf(key.target, 'controls')) return;
279
+ number = (((number != undef) ? number : 0) * 10) + (key.which - 48);
280
+ }
281
+ }
282
+ return false;
283
+ }
284
+
285
+ function clicker(e) {
286
+ number = undef;
287
+ var target;
288
+ if (window.event) {
289
+ target = window.event.srcElement;
290
+ e = window.event;
291
+ } else target = e.target;
292
+ if (target.getAttribute('href') != null || hasValue(target.rel, 'external') || isParentOrSelf(target, 'controls') || isParentOrSelf(target,'embed') || isParentOrSelf(target,'object')) return true;
293
+ if (!e.which || e.which == 1) {
294
+ if (!incrementals[snum] || incpos >= incrementals[snum].length) {
295
+ go(1);
296
+ } else {
297
+ subgo(1);
298
+ }
299
+ }
300
+ }
301
+
302
+ function findSlide(hash) {
303
+ var target = null;
304
+ var slides = GetElementsWithClassName('*','slide');
305
+ for (var i = 0; i < slides.length; i++) {
306
+ var targetSlide = slides[i];
307
+ if ( (targetSlide.name && targetSlide.name == hash)
308
+ || (targetSlide.id && targetSlide.id == hash) ) {
309
+ target = targetSlide;
310
+ break;
311
+ }
312
+ }
313
+ while(target != null && target.nodeName != 'BODY') {
314
+ if (hasClass(target, 'slide')) {
315
+ return parseInt(target.id.slice(5));
316
+ }
317
+ target = target.parentNode;
318
+ }
319
+ return null;
320
+ }
321
+
322
+ function slideJump() {
323
+ if (window.location.hash == null) return;
324
+ var sregex = /^#slide(\d+)$/;
325
+ var matches = sregex.exec(window.location.hash);
326
+ var dest = null;
327
+ if (matches != null) {
328
+ dest = parseInt(matches[1]);
329
+ } else {
330
+ dest = findSlide(window.location.hash.slice(1));
331
+ }
332
+ if (dest != null)
333
+ go(dest - snum);
334
+ }
335
+
336
+ function fixLinks() {
337
+ var thisUri = window.location.href;
338
+ thisUri = thisUri.slice(0, thisUri.length - window.location.hash.length);
339
+ var aelements = document.getElementsByTagName('A');
340
+ for (var i = 0; i < aelements.length; i++) {
341
+ var a = aelements[i].href;
342
+ var slideID = a.match('\#slide[0-9]{1,2}');
343
+ if ((slideID) && (slideID[0].slice(0,1) == '#')) {
344
+ var dest = findSlide(slideID[0].slice(1));
345
+ if (dest != null) {
346
+ if (aelements[i].addEventListener) {
347
+ aelements[i].addEventListener("click", new Function("e",
348
+ "if (document.getElementById('slideProj').disabled) return;" +
349
+ "go("+dest+" - snum); " +
350
+ "if (e.preventDefault) e.preventDefault();"), true);
351
+ } else if (aelements[i].attachEvent) {
352
+ aelements[i].attachEvent("onclick", new Function("",
353
+ "if (document.getElementById('slideProj').disabled) return;" +
354
+ "go("+dest+" - snum); " +
355
+ "event.returnValue = false;"));
356
+ }
357
+ }
358
+ }
359
+ }
360
+ }
361
+
362
+ function externalLinks() {
363
+ if (!document.getElementsByTagName) return;
364
+ var anchors = document.getElementsByTagName('a');
365
+ for (var i=0; i<anchors.length; i++) {
366
+ var anchor = anchors[i];
367
+ if (anchor.getAttribute('href') && hasValue(anchor.rel, 'external')) {
368
+ anchor.target = '_blank';
369
+ addClass(anchor,'external');
370
+ }
371
+ }
372
+ }
373
+
374
+ function createControls() {
375
+ var controlsDiv = document.getElementById("controls");
376
+ if (!controlsDiv) return;
377
+ var hider = ' onmouseover="showHide(\'s\');" onmouseout="showHide(\'h\');"';
378
+ var hideDiv, hideList = '';
379
+ if (controlVis == 'hidden') {
380
+ hideDiv = hider;
381
+ } else {
382
+ hideList = hider;
383
+ }
384
+ controlsDiv.innerHTML = '<form action="#" id="controlForm"' + hideDiv + '>' +
385
+ '<div id="navLinks">' +
386
+ '<a accesskey="t" id="toggle" href="javascript:toggle();">&#216;<\/a>' +
387
+ '<a accesskey="z" id="prev" href="javascript:go(-1);">&laquo;<\/a>' +
388
+ '<a accesskey="x" id="next" href="javascript:go(1);">&raquo;<\/a>' +
389
+ '<div id="navList"' + hideList + '><select id="jumplist" onchange="go(\'j\');"><\/select><\/div>' +
390
+ '<\/div><\/form>';
391
+ if (controlVis == 'hidden') {
392
+ var hidden = document.getElementById('navLinks');
393
+ } else {
394
+ var hidden = document.getElementById('jumplist');
395
+ }
396
+ addClass(hidden,'hideme');
397
+ }
398
+
399
+ 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
400
+ if (!s5mode) return false;
401
+ var vScale = 22; // both yield 32 (after rounding) at 1024x768
402
+ var hScale = 32; // perhaps should auto-calculate based on theme's declared value?
403
+ if (window.innerHeight) {
404
+ var vSize = window.innerHeight;
405
+ var hSize = window.innerWidth;
406
+ } else if (document.documentElement.clientHeight) {
407
+ var vSize = document.documentElement.clientHeight;
408
+ var hSize = document.documentElement.clientWidth;
409
+ } else if (document.body.clientHeight) {
410
+ var vSize = document.body.clientHeight;
411
+ var hSize = document.body.clientWidth;
412
+ } else {
413
+ var vSize = 700; // assuming 1024x768, minus chrome and such
414
+ var hSize = 1024; // these do not account for kiosk mode or Opera Show
415
+ }
416
+ var newSize = Math.min(Math.round(vSize/vScale),Math.round(hSize/hScale));
417
+ fontSize(newSize + 'px');
418
+ if (isGe) { // hack to counter incremental reflow bugs
419
+ var obj = document.getElementsByTagName('body')[0];
420
+ obj.style.display = 'none';
421
+ obj.style.display = 'block';
422
+ }
423
+ }
424
+
425
+ function fontSize(value) {
426
+ if (!(s5ss = document.getElementById('s5ss'))) {
427
+ if (!isIE) {
428
+ document.getElementsByTagName('head')[0].appendChild(s5ss = document.createElement('style'));
429
+ s5ss.setAttribute('media','screen, projection');
430
+ s5ss.setAttribute('id','s5ss');
431
+ } else {
432
+ document.createStyleSheet();
433
+ document.s5ss = document.styleSheets[document.styleSheets.length - 1];
434
+ }
435
+ }
436
+ if (!isIE) {
437
+ while (s5ss.lastChild) s5ss.removeChild(s5ss.lastChild);
438
+ s5ss.appendChild(document.createTextNode('body {font-size: ' + value + ' !important;}'));
439
+ } else {
440
+ document.s5ss.addRule('body','font-size: ' + value + ' !important;');
441
+ }
442
+ }
443
+
444
+ function notOperaFix() {
445
+ slideCSS = document.getElementById('slideProj').href;
446
+ var slides = document.getElementById('slideProj');
447
+ var outline = document.getElementById('outlineStyle');
448
+ slides.setAttribute('media','screen');
449
+ outline.disabled = true;
450
+ if (isGe) {
451
+ slides.setAttribute('href','null'); // Gecko fix
452
+ slides.setAttribute('href',slideCSS); // Gecko fix
453
+ }
454
+ if (isIE && document.styleSheets && document.styleSheets[0]) {
455
+ document.styleSheets[0].addRule('img', 'behavior: url(ui/default/iepngfix.htc)');
456
+ document.styleSheets[0].addRule('div', 'behavior: url(ui/default/iepngfix.htc)');
457
+ document.styleSheets[0].addRule('.slide', 'behavior: url(ui/default/iepngfix.htc)');
458
+ }
459
+ }
460
+
461
+ function getIncrementals(obj) {
462
+ var incrementals = new Array();
463
+ if (!obj)
464
+ return incrementals;
465
+ var children = obj.childNodes;
466
+ for (var i = 0; i < children.length; i++) {
467
+ var child = children[i];
468
+ if (hasClass(child, 'incremental')) {
469
+ if (child.nodeName == 'OL' || child.nodeName == 'UL') {
470
+ removeClass(child, 'incremental');
471
+ for (var j = 0; j < child.childNodes.length; j++) {
472
+ if (child.childNodes[j].nodeType == 1) {
473
+ addClass(child.childNodes[j], 'incremental');
474
+ }
475
+ }
476
+ } else {
477
+ incrementals[incrementals.length] = child;
478
+ removeClass(child,'incremental');
479
+ }
480
+ }
481
+ if (hasClass(child, 'show-first')) {
482
+ if (child.nodeName == 'OL' || child.nodeName == 'UL') {
483
+ removeClass(child, 'show-first');
484
+ if (child.childNodes[isGe].nodeType == 1) {
485
+ removeClass(child.childNodes[isGe], 'incremental');
486
+ }
487
+ } else {
488
+ incrementals[incrementals.length] = child;
489
+ }
490
+ }
491
+ incrementals = incrementals.concat(getIncrementals(child));
492
+ }
493
+ return incrementals;
494
+ }
495
+
496
+ function createIncrementals() {
497
+ var incrementals = new Array();
498
+ for (var i = 0; i < smax; i++) {
499
+ incrementals[i] = getIncrementals(document.getElementById('slide'+i));
500
+ }
501
+ return incrementals;
502
+ }
503
+
504
+ function defaultCheck() {
505
+ var allMetas = document.getElementsByTagName('meta');
506
+ for (var i = 0; i< allMetas.length; i++) {
507
+ if (allMetas[i].name == 'defaultView') {
508
+ defaultView = allMetas[i].content;
509
+ }
510
+ if (allMetas[i].name == 'controlVis') {
511
+ controlVis = allMetas[i].content;
512
+ }
513
+ }
514
+ }
515
+
516
+ // Key trap fix, new function body for trap()
517
+ function trap(e) {
518
+ if (!e) {
519
+ e = event;
520
+ e.which = e.keyCode;
521
+ }
522
+ try {
523
+ modifierKey = e.ctrlKey || e.altKey || e.metaKey;
524
+ }
525
+ catch(e) {
526
+ modifierKey = false;
527
+ }
528
+ return modifierKey || e.which == 0;
529
+ }
530
+
531
+ function startup() {
532
+ defaultCheck();
533
+ if (!isOp)
534
+ createControls();
535
+ slideLabel();
536
+ fixLinks();
537
+ externalLinks();
538
+ fontScale();
539
+ if (!isOp) {
540
+ notOperaFix();
541
+ incrementals = createIncrementals();
542
+ slideJump();
543
+ if (defaultView == 'outline') {
544
+ toggle();
545
+ }
546
+ document.onkeyup = keys;
547
+ document.onkeypress = trap;
548
+ document.onclick = clicker;
549
+ }
550
+ }
551
+
552
+ window.onload = startup;
553
+ window.onresize = function(){setTimeout('fontScale()', 50);}