slideshow 0.4.2 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
data/lib/slideshow.rb CHANGED
@@ -4,6 +4,7 @@ require 'redcloth'
4
4
  require 'maruku'
5
5
  require 'logger'
6
6
  require 'fileutils'
7
+ require 'ftools'
7
8
  require 'hpricot'
8
9
  require 'uv'
9
10
 
@@ -53,9 +54,17 @@ end
53
54
 
54
55
  def Slideshow.create_slideshow( fn )
55
56
 
56
- headerdoc = load_template( 'header.html.erb' )
57
- footerdoc = load_template( 'footer.html.erb' )
58
- styledoc = load_template( 'style.css.erb' )
57
+ if get_boolean_option( 's5', false )
58
+ headerdoc = load_template( 's5/header.html.erb' )
59
+ footerdoc = load_template( 's5/footer.html.erb' )
60
+ styledoc = load_template( 's5/style.css.erb' )
61
+ else
62
+ headerdoc = load_template( 'header.html.erb' )
63
+ footerdoc = load_template( 'footer.html.erb' )
64
+ styledoc = load_template( 'style.css.erb' )
65
+ end
66
+
67
+ # background theming shared between s5/s9
59
68
  gradientdoc = load_template( 'gradient.svg.erb' )
60
69
 
61
70
  basename = File.basename( fn, '.*' )
@@ -227,6 +236,21 @@ def Slideshow.create_slideshow( fn )
227
236
  out.flush
228
237
  out.close
229
238
 
239
+ # copy s5 machinery to s5 folder
240
+
241
+ if get_boolean_option( 's5', false )
242
+ # todo/fix: is there a better way to check if the dir exists?
243
+ Dir.mkdir( 's5' ) unless File.directory?( 's5' )
244
+
245
+ [ 'opera.css', 'outline.css', 'print.css', 's5-core.css', 'slides.js' ].each do |name|
246
+
247
+ source = "#{File.dirname(__FILE__)}/templates/s5/#{name}"
248
+ dest = "s5/#{name}"
249
+
250
+ logger.debug "copying '#{source} ' to '#{dest}'"
251
+ File.copy( source, dest )
252
+ end
253
+ end
230
254
 
231
255
  puts "Done."
232
256
  end
@@ -289,7 +313,7 @@ def Slideshow.get_boolean_option( key, default )
289
313
  if value.nil?
290
314
  default
291
315
  else
292
- if( value.downcase == 'true' || value.downcase == 'yes' || value.downcase == 'on' )
316
+ if( value == true || value.downcase == 'true' || value.downcase == 'yes' || value.downcase == 'on' )
293
317
  true
294
318
  else
295
319
  false
@@ -306,6 +330,10 @@ def Slideshow.main
306
330
 
307
331
  opt=OptionParser.new do |opts|
308
332
  opts.banner = "Usage: slideshow [options] name"
333
+
334
+ #todo/fix: use -s5 option without optional hack? possible with OptionParser package/lib?
335
+ # use -5 switch instead?
336
+ opts.on( '-s[OPTIONAL]', '--s5', 'S5 Compatible Slide Show' ) { $options[ 's5' ] = true; }
309
337
  # opts.on( "-s", "--style STYLE", "Select Stylesheet" ) { |s| $options[:style]=s }
310
338
  # opts.on( "-v", "--version", "Show version" ) {}
311
339
  opts.on( "-t", "--trace", "Show debug trace" ) {
@@ -321,6 +349,7 @@ def Slideshow.main
321
349
  puts "Examples:"
322
350
  puts " slideshow microformats"
323
351
  puts " slideshow microformats.textile"
352
+ puts " slideshow -s5 microformats # S5 compatible"
324
353
  puts
325
354
  puts "Further information:"
326
355
  puts " http://slideshow.rubyforge.org"
@@ -330,7 +359,7 @@ def Slideshow.main
330
359
 
331
360
  opt.parse!
332
361
 
333
- puts "Slide Show (S9) Version: 0.4.2 on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
362
+ puts "Slide Show (S9) Version: 0.5 on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
334
363
 
335
364
  ARGV.each { |fn| Slideshow.create_slideshow( fn ) }
336
365
  end
@@ -0,0 +1,4 @@
1
+
2
+ </div> <!-- presentation -->
3
+ </body>
4
+ </html>
@@ -0,0 +1,40 @@
1
+ <html>
2
+
3
+ <head>
4
+
5
+ <title><%= @headers['title'] %></title>
6
+
7
+ <!-- configuration parameters -->
8
+ <meta name="defaultView" content="slideshow" />
9
+ <meta name="controlVis" content="hidden" />
10
+ <!-- style sheet links -->
11
+ <link rel="stylesheet" href="<%= @cssname %>" type="text/css" media="projection" id="slideProj" />
12
+ <link rel="stylesheet" href="s5/outline.css" type="text/css" media="screen" id="outlineStyle" />
13
+ <link rel="stylesheet" href="s5/print.css" type="text/css" media="print" id="slidePrint" />
14
+ <link rel="stylesheet" href="s5/opera.css" type="text/css" media="projection" id="operaFix" />
15
+
16
+ <!-- S5 JS -->
17
+ <script src="s5/slides.js" type="text/javascript"></script>
18
+
19
+
20
+ </head>
21
+ <body>
22
+
23
+ <div class="layout">
24
+
25
+ <div class="background">
26
+ <object data="<%= @svgname %>" width="100%" height="100%">
27
+ </div>
28
+
29
+ <div id="controls"><!-- DO NOT EDIT --></div>
30
+ <div id="currentSlide"><!-- DO NOT EDIT --></div>
31
+ <div id="header"></div>
32
+ <div id="footer">
33
+ <h1><%= @headers['footer'] %></h1>
34
+ <h2><%= @headers['subfooter'] %></h2>
35
+ </div>
36
+
37
+ </div>
38
+
39
+
40
+ <div class="presentation">
@@ -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 @@
1
+ /* The following rule is necessary to have all slides appear in print! DO NOT REMOVE IT! */
@@ -0,0 +1,76 @@
1
+ /* Do not edit or override these styles! The system will likely break if you do. */
2
+
3
+ .slide {position: absolute;}
4
+ html>body div#header, html>body div#footer,
5
+ html>body div#controls {position: fixed;}
6
+ .handout {display: none;}
7
+ .layout {display: block;}
8
+ .slide, .hideme, .incremental {visibility: hidden;}
9
+ #slide0 {visibility: visible;}
10
+
11
+
12
+ /*** framing.css - sets basic placement and size of slide components *****/
13
+
14
+ /* The following styles size, place, and layer the slide components.
15
+ Edit these if you want to change the overall slide layout.
16
+ The commented lines can be uncommented (and modified, if necessary)
17
+ to help you with the rearrangement process. */
18
+
19
+ /* target = 1024x768 */
20
+
21
+ div#header, div#footer, .slide { width: 100%; top: 0; left: 0; }
22
+ div#header { top: 0; height: 0.5em; z-index: 1;}
23
+ div#footer { top: auto; bottom: 0; height: 1em; z-index: 5;}
24
+ div#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;}
25
+ div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;
26
+ margin: 0;}
27
+ #currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; z-index: 10;}
28
+ html>body #currentSlide {position: fixed;}
29
+
30
+ .presentation { margin: 0; padding: 0; }
31
+ .slide { margin: 0 0 0 0; height: 96%; }
32
+ .slide { overflow-x: hidden; overflow-y: auto; }
33
+ .slide { top: 0; width: 92%; padding: 2% 4% 0 4%; z-index: 2; list-style: none;}
34
+
35
+
36
+ /* enable svg backgrounds for gradient themes */
37
+ div.background { position: fixed; left: 0px; right: 0px; top: 0px; bottom: 0px; z-index: -1; }
38
+ body { opacity: .99; }
39
+
40
+ html, body { margin: 0; padding: 0; }
41
+
42
+ div#footer { font-size: 100%; font-weight: bold; padding: 1em 0;}
43
+ #footer h1 { display: block; margin: 0; padding: 0 1em; font-size: 0.5em; }
44
+ #footer h2 { display: block; margin: 0; padding: 0 1em; font-size: 0.5em; font-style: italic; }
45
+
46
+ #currentSlide {text-align: center; font-size: 0.5em; }
47
+
48
+
49
+ /*
50
+ div#header {background: #FCC;}
51
+ div#footer {background: #CCF;}
52
+ div#controls {background: #BBD;}
53
+ div#currentSlide {background: #FFC;}
54
+ */
55
+
56
+ /***** pretty.css - stuff that makes the slides look better than blah ****/
57
+
58
+ #controls :focus { outline: 1px dotted white;}
59
+
60
+ div#controls { position: absolute; left: 50%; bottom: 0; width: 50%;
61
+ text-align: right; font: bold 0.9em Verdana, Helvetica, sans-serif;}
62
+
63
+ html>body div#controls { position: fixed; padding: 0 0 1em 0; top: auto;}
64
+ div#controls form { position: absolute; bottom: 0; right: 0; width: 100%;
65
+ margin: 0; padding: 0;}
66
+ #controls #navLinks a { padding: 0; margin: 0 0.5em;
67
+ border: none; cursor: pointer;}
68
+ #controls #navLinks :link,
69
+ #controls #navLinks :visited {text-decoration: none; }
70
+
71
+ #controls #navList {height: 1em;}
72
+ #controls #navList #jumplist {position: absolute; bottom: 0; right: 0; background: white; color: black;}
73
+
74
+
75
+ .note { display: none; }
76
+
@@ -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);}
@@ -0,0 +1,27 @@
1
+ @import url(s5/s5-core.css); /* required to make the slide show run at all */
2
+
3
+ html, body { color: white;
4
+ font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; }
5
+
6
+ a:link, a:visited { color: white; }
7
+
8
+ h1 { font-size: 30pt; }
9
+ h2 { font-size: 28pt; }
10
+ h3 { font-size: 25pt; }
11
+ p, li, td, th { font-size: 18pt; }
12
+
13
+ pre { font-size: 16pt; }
14
+
15
+ pre.code {
16
+ background-color: black;
17
+ padding: 5px;
18
+ border: silver thick groove;
19
+ -moz-border-radius: 11px;
20
+ }
21
+
22
+
23
+ div#header, div#footer { color: silver; }
24
+
25
+ #currentSlide { color: silver;}
26
+
27
+ #controls #navLinks a { color: silver; }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slideshow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: "0.5"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
@@ -9,11 +9,12 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-05-20 00:00:00 -07:00
12
+ date: 2008-07-02 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: RedCloth
17
+ type: :runtime
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
@@ -23,6 +24,7 @@ dependencies:
23
24
  version:
24
25
  - !ruby/object:Gem::Dependency
25
26
  name: maruku
27
+ type: :runtime
26
28
  version_requirement:
27
29
  version_requirements: !ruby/object:Gem::Requirement
28
30
  requirements:
@@ -32,6 +34,7 @@ dependencies:
32
34
  version:
33
35
  - !ruby/object:Gem::Dependency
34
36
  name: hpricot
37
+ type: :runtime
35
38
  version_requirement:
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
@@ -41,6 +44,7 @@ dependencies:
41
44
  version:
42
45
  - !ruby/object:Gem::Dependency
43
46
  name: ultraviolet
47
+ type: :runtime
44
48
  version_requirement:
45
49
  version_requirements: !ruby/object:Gem::Requirement
46
50
  requirements:
@@ -62,6 +66,15 @@ files:
62
66
  - lib/templates/footer.html.erb
63
67
  - lib/templates/gradient.svg.erb
64
68
  - lib/templates/header.html.erb
69
+ - lib/templates/s5
70
+ - lib/templates/s5/footer.html.erb
71
+ - lib/templates/s5/header.html.erb
72
+ - lib/templates/s5/opera.css
73
+ - lib/templates/s5/outline.css
74
+ - lib/templates/s5/print.css
75
+ - lib/templates/s5/s5-core.css
76
+ - lib/templates/s5/slides.js
77
+ - lib/templates/s5/style.css.erb
65
78
  - lib/templates/style.css.erb
66
79
  - bin/slideshow
67
80
  has_rdoc: false
@@ -86,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
99
  requirements: []
87
100
 
88
101
  rubyforge_project: slideshow
89
- rubygems_version: 1.0.1
102
+ rubygems_version: 1.2.0
90
103
  signing_key:
91
104
  specification_version: 2
92
105
  summary: Slide Show (S9) - A Free Web Alternative to PowerPoint and KeyNote in Ruby