slideshow 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
data/History.rdoc CHANGED
@@ -1,3 +1,15 @@
1
+ === 0.9.6 / 2010-07-18
2
+
3
+ * Update builtin S6 blank templates (adding autoplay, custom transitions, custom title selector, and more)
4
+
5
+ === 0.9.5 / 2010-07-14
6
+
7
+ * Minor fix (for custom converter methods)
8
+
9
+ === 0.9.4 / 2010-07-14
10
+
11
+ * Added support for custom converter methods (for Markdown processing)
12
+
1
13
  === 0.9.3 / 2010-07-13
2
14
 
3
15
  * Added support for pandoc-ruby (for Markdown processing); skip %-filters; break slides using div/h1 rule [Thanks David Sanson]
data/Manifest.txt CHANGED
@@ -31,11 +31,11 @@ lib/slideshow/textile.rb
31
31
  templates/s6.txt
32
32
  templates/s6.txt.gen
33
33
  templates/s6/jquery.js
34
- templates/s6/outline.css
34
+ templates/s6/jquery.microsoft.js
35
+ templates/s6/jquery.slideshow.js
35
36
  templates/s6/print.css
36
- templates/s6/slides.core.js
37
- templates/s6/slides.css
38
- templates/s6/slides.js
37
+ templates/s6/projection.css
38
+ templates/s6/screen.css
39
39
  templates/slides.html.erb
40
40
  templates/slides.pdf.html.erb
41
41
  templates/style.css.erb
data/lib/slideshow.rb CHANGED
@@ -51,7 +51,7 @@ require 'slideshow/filters/slide_filter'
51
51
 
52
52
  module Slideshow
53
53
 
54
- VERSION = '0.9.5'
54
+ VERSION = '0.9.6'
55
55
 
56
56
  # version string for generator meta tag (includes ruby version)
57
57
  def Slideshow.generator
@@ -29,7 +29,7 @@ module Slideshow
29
29
  content = content.gsub(/class="incremental"/,'class="step"')
30
30
  content = content.to_a[13..-1].join # remove the layout div
31
31
  end
32
-
32
+
33
33
  def rdiscount_to_html( content )
34
34
  RDiscount.new( content ).to_html
35
35
  end
data/templates/s6.txt CHANGED
@@ -10,15 +10,15 @@ __file__.css style.css.erb
10
10
 
11
11
  # styles
12
12
 
13
- s6/outline.css
13
+ s6/projection.css
14
14
  s6/print.css
15
- s6/slides.css
15
+ s6/screen.css
16
16
 
17
17
  # javascript machinery
18
18
 
19
19
  s6/jquery.js
20
- s6/slides.js
21
- s6/slides.core.js
20
+ s6/jquery.microsoft.js
21
+ s6/jquery.slideshow.js
22
22
 
23
23
  # template for pdf generation
24
24
  # -- use html-to-pdf tool (such as wkhtmltopdf, prince, etc) to generate pdf
data/templates/s6.txt.gen CHANGED
@@ -6,9 +6,14 @@ slides.html.erb
6
6
  slides.pdf.html.erb
7
7
  style.css.erb
8
8
 
9
- s6/outline.css
9
+ # styles
10
+
11
+ s6/projection.css
10
12
  s6/print.css
11
- s6/slides.css
13
+ s6/screen.css
14
+
15
+ # javascript machinery
16
+
12
17
  s6/jquery.js
13
- s6/slides.core.js
14
- s6/slides.js
18
+ s6/jquery.microsoft.js
19
+ s6/jquery.slideshow.js
@@ -0,0 +1,31 @@
1
+
2
+
3
+ $(document).ready( function() {
4
+
5
+ // 1) remove all content
6
+ $( 'body > *' ).remove();
7
+
8
+ // 2) show banner
9
+ $( "<div>" ).html(
10
+ "<p>"
11
+ + "Microsoft's Internet Explorer browser has no built-in vector graphics machinery "
12
+ + "required for 'loss-free' gradient background themes."
13
+ + "</p>"
14
+ + "<p>"
15
+ + "Please <span style='background: yellow'>upgrade to a better browser</span> "
16
+ + "such as <a href='http://getfirefox.com'>Firefox</a>, <a href='http://www.opera.com/download'>Opera</a>, "
17
+ + "<a href='http://google.com/chrome'>Chrome</a>, <a href='http://apple.com/safari/download'>Safari</a> or others "
18
+ + "with built-in vector graphics machinery and much more. "
19
+ + "(Learn more or post questions or comments "
20
+ + "at the <a href='http://slideshow.rubyforge.org'>Slide Show (S9)</a> project site. Thanks!)"
21
+ + "</p>"
22
+ )
23
+ .css( {
24
+ border: 'red solid thick',
25
+ padding: '1em',
26
+ fontFamily: 'sans-serif',
27
+ fontWeight: 'bold' } )
28
+ .prependTo( 'body' );
29
+ }
30
+ );
31
+
@@ -0,0 +1,466 @@
1
+
2
+ var Slideshow = {};
3
+
4
+
5
+ /************************************
6
+ * lets you define your own "global" transition function
7
+ * passes in a reference to from and to slide wrapped in jQuery wrapper
8
+ */
9
+
10
+ Slideshow.transition = function( $from, $to ) {
11
+ $from.hide();
12
+ $to.show();
13
+ }
14
+
15
+ /***********************
16
+ * sample custom transition using scrollUp effect
17
+ * inspired by Karl Swedberg's Scroll Up Headline Reader jQuery Tutorial[1]
18
+ * [1] http://docs.jquery.com/Tutorials:Scroll_Up_Headline_Reader
19
+ */
20
+ function transitionScrollUp( $from, $to ) {
21
+ var cheight = $from.outerHeight();
22
+
23
+ // hide scrollbar during animation
24
+ $( 'body' ).css( 'overflow-y', 'hidden' );
25
+
26
+ $to.css( 'top', cheight+'px' );
27
+ $to.show();
28
+
29
+ $from.animate( {top: -cheight}, 'slow' );
30
+ $to.animate( {top: 0}, 'slow', function() {
31
+ $from.hide().css( 'top', '0px');
32
+
33
+ // restore possible scrollbar
34
+ $( 'body' ).css( 'overflow-y', 'auto' );
35
+ });
36
+ }
37
+
38
+ Slideshow.init = function( options ) {
39
+
40
+ var settings = $.extend({
41
+ mode : 'slideshow', // slideshow | outline | autoplay
42
+ projectionStyleId : '#styleProjection',
43
+ screenStyleId : '#styleScreen',
44
+ titleSelector : 'h1',
45
+ slideSelector : '.slide', // dummy (not yet working)
46
+ stepSelector : '.step', // dummy (not yet working)
47
+ debug : false
48
+ }, options || {});
49
+
50
+ settings.isProjection = true; // are we in projection (slideshow) mode (in contrast to screen (outline) mode)?
51
+ settings.snum = 1; // current slide # (non-zero based index e.g. starting with 1)
52
+ settings.smax = 1; // max number of slides
53
+ settings.incpos = 0; // current step in slide
54
+ settings.steps = null;
55
+ settings.autoplayInterval = null;
56
+
57
+ function debug( msg )
58
+ {
59
+ if( window.console && window.console.log )
60
+ window.console.log( '[debug] ' + msg );
61
+ }
62
+
63
+ function showHide( action )
64
+ {
65
+ var $navLinks = $( '#navLinks' )
66
+
67
+ switch( action ) {
68
+ case 's': $navLinks.css( 'visibility', 'visible' ); break;
69
+ case 'h': $navLinks.css( 'visibility', 'hidden' ); break;
70
+ case 'c': /* toggle control panel */
71
+ if( $navLinks.css( 'visibility' ) != 'visible' )
72
+ $navLinks.css( 'visibility', 'visible' );
73
+ else
74
+ $navLinks.css( 'visibility', 'hidden' );
75
+ break;
76
+ }
77
+ }
78
+
79
+ function updateCurrentSlideCounter()
80
+ {
81
+ $( '#currentSlide' ).html( '<a id="plink" href="">'
82
+ + '<span id="csHere">' + settings.snum + '<\/span> '
83
+ + '<span id="csSep">\/<\/span> '
84
+ + '<span id="csTotal">' + settings.smax + '<\/span>'
85
+ + '<\/a>' );
86
+ }
87
+
88
+ function updateJumpList()
89
+ {
90
+ $('#jumplist').get(0).selectedIndex = (settings.snum-1);
91
+ }
92
+
93
+ function updatePermaLink()
94
+ {
95
+ $('#plink').get(0).href = window.location.pathname + '#slide' + settings.snum;
96
+
97
+ // todo: unify hash marks??; use #1 for div ids instead of #slide1?
98
+ window.location.hash = '#'+settings.snum;
99
+ }
100
+
101
+ function goTo( target )
102
+ {
103
+ if( target > settings.smax || target == settings.snum ) return;
104
+ go( target - settings.snum );
105
+ }
106
+
107
+ function go( dir )
108
+ {
109
+ debug( 'go: ' + dir );
110
+
111
+ if( dir == 0 ) return; /* same slide; nothing to do */
112
+
113
+ var cid = '#slide' + settings.snum; /* current slide (selector) id */
114
+ var csteps = settings.steps[settings.snum-1]; /* current slide steps array */
115
+
116
+ /* remove all step and stepcurrent classes from current slide */
117
+ if( csteps.length > 0) {
118
+ $( csteps ).each( function() {
119
+ $(this).removeClass( 'step' ).removeClass( 'stepcurrent' );
120
+ } );
121
+ }
122
+
123
+ /* set snum to next slide */
124
+ settings.snum += dir;
125
+ if( settings.snum > settings.smax ) settings.snum = settings.smax;
126
+ if( settings.snum < 1 ) settings.snum = 1;
127
+
128
+ var nid = '#slide' + settings.snum; /* next slide (selector) id */
129
+ var nsteps = settings.steps[settings.snum-1]; /* next slide steps array */
130
+
131
+ if( dir < 0 ) /* go backwards? */
132
+ {
133
+ settings.incpos = nsteps.length;
134
+ /* mark last step as current step */
135
+ if( nsteps.length > 0 )
136
+ $( nsteps[settings.incpos-1] ).addClass( 'stepcurrent' );
137
+ }
138
+ else /* go forwards? */
139
+ {
140
+ settings.incpos = 0;
141
+ if( nsteps.length > 0 ) {
142
+ $( nsteps ).each( function() {
143
+ $(this).addClass( 'step' ).removeClass( 'stepcurrent' );
144
+ } );
145
+ }
146
+ }
147
+
148
+ if( !(cid == nid) ) {
149
+ debug( "transition from " + cid + " to " + nid );
150
+ Slideshow.transition( $( cid ), $( nid ) );
151
+ }
152
+
153
+ updateJumpList();
154
+ updateCurrentSlideCounter();
155
+ updatePermaLink();
156
+ }
157
+
158
+ function subgo( dir )
159
+ {
160
+ debug( 'subgo: ' + dir + ', incpos before: ' + settings.incpos + ', after: ' + (settings.incpos+dir) );
161
+
162
+ var csteps = settings.steps[settings.snum-1]; /* current slide steps array */
163
+
164
+ if( dir > 0)
165
+ { /* go forward? */
166
+ if( settings.incpos > 0 )
167
+ $( csteps[settings.incpos-1] ).removeClass( 'stepcurrent' );
168
+ $( csteps[settings.incpos] ).removeClass( 'step').addClass( 'stepcurrent' );
169
+ settings.incpos++;
170
+ }
171
+ else
172
+ { /* go backwards? */
173
+ settings.incpos--;
174
+ $( csteps[settings.incpos] ).removeClass( 'stepcurrent' ).addClass( 'step' );
175
+ if( settings.incpos > 0 )
176
+ $( csteps[settings.incpos-1] ).addClass( 'stepcurrent' );
177
+ }
178
+ }
179
+
180
+
181
+ function notOperaFix()
182
+ {
183
+ $( settings.projectionStyleId ).attr( 'media','screen' );
184
+
185
+ var styleScreen = $( settings.screenStyleId ).get(0);
186
+ styleScreen.disabled = true;
187
+ }
188
+
189
+
190
+ function toggle()
191
+ {
192
+ // toggle between projection (slide show) mode
193
+ // and screen (outline) mode
194
+
195
+ // get stylesheets
196
+ var styleProjection = $( settings.projectionStyleId ).get(0);
197
+ var styleScreen = $( settings.screenStyleId ).get(0);
198
+
199
+ if( !styleProjection.disabled )
200
+ {
201
+ styleProjection.disabled = true;
202
+ styleScreen.disabled = false;
203
+ settings.isProjection = false;
204
+ $('.slide').each( function() { $(this).show(); } );
205
+ }
206
+ else
207
+ {
208
+ styleProjection.disabled = false;
209
+ styleScreen.disabled = true;
210
+ settings.isProjection = true;
211
+ $('.slide').each( function(i) {
212
+ if( i == (settings.snum-1) )
213
+ $(this).show();
214
+ else
215
+ $(this).hide();
216
+ });
217
+ }
218
+ }
219
+
220
+ function populateJumpList() {
221
+
222
+ var list = $('#jumplist').get(0);
223
+
224
+ $( '.slide' ).each( function(i) {
225
+ var text = $(this).find( settings.titleSelector ).text();
226
+ list.options[list.length] = new Option( (i+1)+' : '+ text, (i+1) );
227
+ });
228
+ }
229
+
230
+ function createControls()
231
+ {
232
+
233
+ $( '.layout' )
234
+ .append( "<div id='controls'>" )
235
+ .append( "<div id='currentSlide'>" );
236
+
237
+ var $controls = $( '#controls' )
238
+
239
+ $controls.html( '<div id="navLinks">'
240
+ + '<a accesskey="t" id="toggle" href="#">&#216;<\/a>'
241
+ + '<a accesskey="z" id="prev" href="#">&laquo;<\/a>'
242
+ + '<a accesskey="x" id="next" href="#">&raquo;<\/a>'
243
+ + '<div id="navList"><select id="jumplist" /><\/div>'
244
+ + '<\/div>' );
245
+
246
+ $controls.hover( function() { showHide('s') }, function() { showHide('h') });
247
+ $('#toggle').click( function() { toggle(); } );
248
+ $('#prev').click( function() { go(-1); } );
249
+ $('#next').click( function() { go(1); } );
250
+
251
+ $('#jumplist').change( function() { goTo( parseInt( $( '#jumplist' ).val() )); } );
252
+
253
+ populateJumpList();
254
+ updateCurrentSlideCounter();
255
+ updatePermaLink();
256
+ }
257
+
258
+ function toggleFooter()
259
+ {
260
+ $( '#footer').toggle();
261
+ }
262
+
263
+
264
+ function keys(key)
265
+ {
266
+ if (!key) {
267
+ key = event;
268
+ key.which = key.keyCode;
269
+ }
270
+ if (key.which == 84) {
271
+ toggle();
272
+ return;
273
+ }
274
+ if( settings.isProjection ) {
275
+ switch (key.which) {
276
+ case 32: // spacebar
277
+ case 34: // page down
278
+ case 39: // rightkey
279
+ case 40: // downkey
280
+
281
+ var csteps = settings.steps[settings.snum-1]; /* current slide steps array */
282
+
283
+ if ( !csteps || settings.incpos >= csteps.length ) {
284
+ go(1);
285
+ } else {
286
+ subgo(1);
287
+ }
288
+ break;
289
+ case 33: // page up
290
+ case 37: // leftkey
291
+ case 38: // upkey
292
+
293
+ if( !settings.steps[settings.snum-1] || settings.incpos <= 0 ) {
294
+ go(-1);
295
+ } else {
296
+ subgo(-1);
297
+ }
298
+ break;
299
+ case 36: // home
300
+ goTo(1);
301
+ break;
302
+ case 35: // end
303
+ goTo(settings.smax);
304
+ break;
305
+ case 67: // c
306
+ showHide('c');
307
+ break;
308
+ case 65: //a
309
+ case 80: //p
310
+ case 83: //s
311
+ toggleAutoplay();
312
+ break;
313
+ case 70: //f
314
+ toggleFooter();
315
+ break;
316
+ }
317
+ }
318
+ }
319
+
320
+ function autoplay()
321
+ {
322
+ // suspend autoplay in outline view (just slideshow view)
323
+ if( !settings.isProjection )
324
+ return;
325
+
326
+ // next slide/step, please
327
+ var csteps = settings.steps[settings.snum-1]; // current slide steps array
328
+ if( !csteps || settings.incpos >= csteps.length ) {
329
+ if( settings.snum >= settings.smax )
330
+ goTo( 1 ); // reached end of show? start with 1st slide again (for endless cycle)
331
+ else
332
+ go(1);
333
+ }
334
+ else {
335
+ subgo(1);
336
+ }
337
+ }
338
+
339
+
340
+ function toggleAutoplay()
341
+ {
342
+ if( settings.autoplayInterval )
343
+ {
344
+ clearInterval( settings.autoplayInterval );
345
+ settings.autoplayInterval = null;
346
+ }
347
+ else
348
+ {
349
+ settings.autoplayInterval = setInterval ( autoplay, 2000 );
350
+ }
351
+ }
352
+
353
+
354
+
355
+ function collectStepsWorker(obj) {
356
+
357
+ var steps = new Array();
358
+ if( !obj )
359
+ return steps;
360
+
361
+ $(obj).children().each( function() {
362
+ if( $(this).hasClass( 'step' ) ) {
363
+
364
+ debug( 'step found for ' + this.tagName );
365
+ $(this).removeClass( 'step' );
366
+
367
+ /* don't add enclosing list; instead add step class to all list items/children */
368
+ if( $(this).is( 'ol,ul' ) ) {
369
+ debug( ' ol or ul found; adding auto steps' );
370
+ $(this).children().addClass( 'step' );
371
+ }
372
+ else
373
+ {
374
+ steps.push( this )
375
+ }
376
+ }
377
+
378
+ steps = steps.concat( collectStepsWorker(this) );
379
+ });
380
+
381
+ return steps;
382
+ }
383
+
384
+ function collectSteps() {
385
+
386
+ var steps = new Array();
387
+
388
+ $slides.each( function(i) {
389
+ debug ( 'collectSteps for ' + this.id + ':' );
390
+ steps[i] = collectStepsWorker( this );
391
+ });
392
+
393
+ $( steps ).each( function(i) {
394
+ debug( 'slide ' + (i+1) + ': found ' + this.length + ' steps' );
395
+ });
396
+
397
+ return steps;
398
+ }
399
+
400
+
401
+ function addClicker() {
402
+ // if you click on heading of slide -> go to next slide (or next step)
403
+
404
+ $( settings.titleSelector, $slides ).click( function() {
405
+ if( !settings.isProjection ) // suspend clicker in outline view (just slideshow view)
406
+ return;
407
+
408
+ var csteps = settings.steps[settings.snum-1]; // current slide steps array
409
+ if ( !csteps || settings.incpos >= csteps.length )
410
+ go(1);
411
+ else
412
+ subgo(1);
413
+ } );
414
+ }
415
+
416
+ function addSlideIds() {
417
+ $slides.each( function(i) {
418
+ this.id = 'slide'+(i+1);
419
+ });
420
+ }
421
+
422
+ // init code here
423
+
424
+ // store possible slidenumber from hash */
425
+ // todo: use regex to extract number
426
+ // might be #slide1 or just #1
427
+
428
+ var gotoSlideNum = parseInt( window.location.hash.substring(1) );
429
+ debug( "gotoSlideNum=" + gotoSlideNum );
430
+
431
+ var $slides = $( '.slide' );
432
+ settings.smax = $slides.length;
433
+
434
+ addSlideIds();
435
+ settings.steps = collectSteps();
436
+
437
+ createControls();
438
+
439
+ addClicker();
440
+
441
+ /* opera is the only browser currently supporting css projection mode */
442
+ /* if( !$.browser.opera ) */
443
+ notOperaFix();
444
+
445
+ if( !isNaN( gotoSlideNum ))
446
+ {
447
+ debug( "restoring slide on (re)load #: " + gotoSlideNum );
448
+ goTo( gotoSlideNum );
449
+ }
450
+
451
+ if( settings.mode == 'outline' )
452
+ toggle();
453
+ else if( settings.mode == 'autoplay' )
454
+ toggleAutoplay();
455
+
456
+ if( settings.debug == true )
457
+ {
458
+ $( '#header' ).css( 'background', '#FCC' );
459
+ $( '#footer' ).css( 'background', '#CCF' );
460
+ $( '#controls' ).css( 'background', '#BBD' );
461
+ $( '#currentSlide' ).css( 'background', '#FFC' );
462
+ }
463
+
464
+ document.onkeyup = keys;
465
+
466
+ } // end Slideshow
@@ -1 +1 @@
1
- /* The following rule is necessary to have all slides appear in print! DO NOT REMOVE IT! */
1
+ /*********************************
2
2
  * CSS @media print rules (not projection or screen)
3
3
  */
4
4
  * Make sure all slides are visible (to make them all appear in prin)
5
5
  */
6
6
  display: block !important;
7
7
  }
8
8
  * Extra styling for first slide (title slide)
9
9
  */
10
10
  border-bottom: 1px dotted silver;
11
11
  }
12
12
  * Turn on print-specific stuff/classes
13
13
  */
14
14
  * Turn off online (screen/projection)-specific stuff/classes
15
15
  */
16
16
  * The following rule keeps the layout stuff out of print.
17
17
  * Remove at your own risk!
18
18
  */
@@ -0,0 +1,109 @@
1
+ /*********************************
2
+ * CSS @media projection rules (not print or screen)
3
+ *
4
+ * 1) projection -> slideshow mode (display one slide at-a-time; hide all others)
5
+ * 2) screen -> outline mode (display all slides-at-once on screen)
6
+ * 3) print -> print (and print preview)
7
+ *
8
+ * toogle between slideshow/outline mode using t-key
9
+ */
10
+
11
+ html,
12
+ body,
13
+ .presentation { margin: 0; padding: 0; }
14
+
15
+
16
+ .slide { display: none;
17
+ position: absolute;
18
+ top: 0; left: 0;
19
+ margin: 0;
20
+ padding: 2% 4% 0% 4%; /* css note: order is => top right bottom left */
21
+ width: 92%; height: 95%; /* css note: to get to 100% add padding/border/margin */
22
+ overflow-x: hidden; overflow-y: auto;
23
+ z-index: 2;
24
+ }
25
+
26
+ #slide1 { display: block; }
27
+
28
+ .notes { display: none; } /* handout notes/note (use note? handout? notes? */
29
+
30
+
31
+ /********* format layout block
32
+ *
33
+ * .layout
34
+ * > #header
35
+ * > #footer
36
+ * > #controls (holding navigation controls)
37
+ * > #navLinks
38
+ * > #toggle
39
+ * > #navList
40
+ * > #jumplist
41
+ * > #currentSlide (e.g. 1/7)
42
+ *
43
+ */
44
+
45
+ .layout { display: block; }
46
+
47
+ #header { position: fixed;
48
+ top: 0; left: 0;
49
+ width: 100%; height: 0.5em;
50
+ z-index: 1;
51
+ }
52
+
53
+ #footer { position: fixed;
54
+ top: auto; bottom: 0;
55
+ padding: 1em 0; /* css note: order is => 1st top,bottom; 2nd right,left */
56
+ width: 100%; height: 1em;
57
+ z-index: 5;
58
+
59
+ /* todo: move font-size and font-style to blank.css */
60
+ font-size: 100%; font-weight: bold;
61
+ }
62
+
63
+ /* todo: move font-size and font-style to blank.css */
64
+
65
+ #footer h1 { display: block; margin: 0; padding: 0 1em; font-size: 0.5em; }
66
+ #footer h2 { display: block; margin: 0; padding: 0 1em; font-size: 0.5em; font-style: italic; }
67
+
68
+
69
+ /*************************
70
+ * format for navigation controls
71
+ */
72
+
73
+
74
+ #controls { position: fixed;
75
+ left: 60%; bottom: 0;
76
+ width: 40%;
77
+ z-index: 100;
78
+ text-align: right;
79
+ font: bold 1.2em Verdana, Helvetica, sans-serif;
80
+ }
81
+
82
+ #controls :focus { outline: 1px dotted white;}
83
+
84
+ #controls #navLinks { text-align: right; margin: 0; visibility: hidden; }
85
+
86
+ #controls #navLinks a { padding: 0; margin: 0 0.5em; cursor: pointer; border: none; }
87
+
88
+ #controls #navLinks :link,
89
+ #controls #navLinks :visited {text-decoration: none; }
90
+
91
+ #controls #navList #jumplist { background: white; color: black; }
92
+
93
+ /*************************
94
+ * format for
95
+ * currentSlide block ( e.g. 2/20 )
96
+ */
97
+
98
+ #currentSlide { position: fixed;
99
+ left: 45%; bottom: 1em;
100
+ width: 10%;
101
+ z-index: 10;
102
+ text-align: center;
103
+ font-size: 0.8em;
104
+ }
105
+
106
+ #currentSlide :link,
107
+ #currentSlide :visited { text-decoration: none; }
108
+
109
+
@@ -0,0 +1,48 @@
1
+ /*********************************
2
+ * CSS @media screen (not projection or print)
3
+ *
4
+ * 1) projection -> slideshow mode (display one slide at-a-time; hide all others)
5
+ * 2) screen -> outline mode (display all slides-at-once on screen)
6
+ * 3) print -> print (and print preview)
7
+ *
8
+ * toogle between slideshow/outline mode using t-key
9
+ */
10
+
11
+
12
+ /****
13
+ * hide layout stuff (header, footer, navLinks, navList etc.)
14
+ */
15
+
16
+ .layout * { display: none; }
17
+
18
+ /*************
19
+ * make toggle button visible and reposition to upper right corner *
20
+ * note: toogle button is nested inside #controls > #navLinks > #toogle
21
+ */
22
+
23
+ #controls,
24
+ #navLinks,
25
+ #toggle { display: block;
26
+ visibility: visible;
27
+ margin: 0; padding: 0;
28
+ }
29
+
30
+ #toggle { position: fixed;
31
+ top: 0; right: 0;
32
+ padding: 0.5em;
33
+ border-left: 1px solid;
34
+ border-bottom: 1px solid;
35
+ background: white;
36
+ }
37
+
38
+
39
+ /*************
40
+ * making the outline look pretty-ish
41
+ */
42
+
43
+ #slide1, #slide1 h1, #slide1 h2, #slide1 h3, #slide1 h4 {border: none; margin: 0;}
44
+ #slide1 h1 {padding-top: 1.5em;}
45
+
46
+ .slide { margin: 1.5em 0 0; border-top: 1px solid #888; }
47
+ .slide h1 { border-bottom: 1px solid #AAA; }
48
+
@@ -7,55 +7,39 @@
7
7
  <meta name="generator" content="<%= @headers['generator'] %>">
8
8
  <meta name="author" content="<%= @headers['author']%>" >
9
9
 
10
- <!-- S6 configuration parameters -->
11
- <meta name="defaultView" content="slideshow">
12
-
13
10
  <!-- S6 style sheet links -->
14
- <link rel="stylesheet" href="<%= "#{@name}.css" %>" type="text/css" media="projection" id="slideProj">
15
- <link rel="stylesheet" href="s6/outline.css" type="text/css" media="screen" id="outlineStyle">
16
- <link rel="stylesheet" href="s6/print.css" type="text/css" media="print" id="slidePrint">
11
+ <link rel="stylesheet" href="<%= "#{@name}.css" %>" type="text/css" media="projection" id="styleProjection">
12
+ <link rel="stylesheet" href="s6/screen.css" type="text/css" media="screen" id="styleScreen">
13
+ <link rel="stylesheet" href="s6/print.css" type="text/css" media="print">
17
14
 
18
15
  <!-- S6 JS -->
19
- <script src="s6/jquery.js" type="text/javascript"></script>
20
- <script src="s6/slides.js" type="text/javascript"></script>
21
-
16
+ <script src="s6/jquery.js"></script>
17
+ <script src="s6/jquery.slideshow.js"></script>
18
+ <script>
19
+ $(document).ready( function() {
20
+ Slideshow.init();
21
+ } );
22
22
 
23
- <script type="text/javascript">
24
23
  <%= content_for :js %>
25
24
  </script>
26
25
 
26
+ <!-- Better Browser Banner for Microsoft Internet Explorer (IE) -->
27
+ <!--[if IE]>
28
+ <script src="s6/jquery.microsoft.js"></script>
29
+ <![endif]-->
30
+
27
31
  <%= content_for :head %>
28
32
 
29
33
  </head>
30
34
  <body>
31
35
 
32
36
  <div class="layout">
33
- <div id="controls"><!-- DO NOT EDIT --></div>
34
- <div id="currentSlide"><!-- DO NOT EDIT --></div>
35
37
  <div id="header"></div>
36
38
  <div id="footer">
37
39
  <h1><%= @headers['footer'] %></h1>
38
40
  <h2><%= @headers['subfooter'] %></h2>
39
41
  </div>
40
-
41
- <div id='microsoft'>
42
- <p>
43
- Microsoft's Internet Explorer browser
44
- has no built-in vector graphics machinery
45
- required for "loss-free" gradient background themes.
46
- </p>
47
- <p>
48
- Please upgrade to a better browser
49
- such as <a href='http://getfirefox.com'>Firefox</a>, <a href='http://www.opera.com/download'>Opera</a>,
50
- <a href='http://google.com/chrome'>Chrome</a>, <a href='http://apple.com/safari/download'>Safari</a> or others
51
- with built-in vector graphics machinery and much more.
52
-
53
- (Learn more or post questions or comments
54
- at the <a href='http://slideshow.rubyforge.org'>Slide Show (S9)</a>
55
- project site. Thanks!)
56
- </p>
57
- </div>
58
- </div><!-- layout -->
42
+ </div>
59
43
 
60
44
  <div class="presentation">
61
45
 
@@ -1,4 +1,4 @@
1
- @import url(s6/slides.css); /* required to make the slide show run at all */
1
+ @import url(s6/projection.css); /* required to make the slide show run at all */
2
2
 
3
3
  html, body { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; }
4
4
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slideshow
3
3
  version: !ruby/object:Gem::Version
4
- hash: 49
4
+ hash: 55
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 5
10
- version: 0.9.5
9
+ - 6
10
+ version: 0.9.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gerald Bauer
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-14 00:00:00 +02:00
18
+ date: 2010-07-18 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -129,11 +129,11 @@ files:
129
129
  - templates/s6.txt
130
130
  - templates/s6.txt.gen
131
131
  - templates/s6/jquery.js
132
- - templates/s6/outline.css
132
+ - templates/s6/jquery.microsoft.js
133
+ - templates/s6/jquery.slideshow.js
133
134
  - templates/s6/print.css
134
- - templates/s6/slides.core.js
135
- - templates/s6/slides.css
136
- - templates/s6/slides.js
135
+ - templates/s6/projection.css
136
+ - templates/s6/screen.css
137
137
  - templates/slides.html.erb
138
138
  - templates/slides.pdf.html.erb
139
139
  - templates/style.css.erb
@@ -1,27 +0,0 @@
1
- /* don't change this unless you want the layout stuff to show up in the outline view! */
2
-
3
- .layout > *, #controls *, #footer *, #navLinks * { display: none; }
4
-
5
- #controls, #navLinks, #toggle {
6
- display: block; visibility: visible; margin: 0; padding: 0;}
7
-
8
- #toggle { position: fixed; top: 0; right: 0; padding: 0.5em; }
9
- #toggle {border: 1px solid; border-width: 0 0 1px 1px; background: #FFF;}
10
-
11
-
12
- /* making the outline look pretty-ish */
13
-
14
- #slide1, #slide1 h1, #slide1 h2, #slide1 h3, #slide1 h4 {border: none; margin: 0;}
15
- #slide1 h1 {padding-top: 1.5em;}
16
-
17
- .slide { margin: 1.5em 0 0; border-top: 1px solid #888; }
18
- .slide h1 { border-bottom: 1px solid #AAA; }
19
-
20
- #microsoft {
21
- display: none;
22
- border: red solid thick;
23
- padding: 1em;
24
- font-family: sans-serif;
25
- font-weight: bold;
26
- margin-bottom: 2em;
27
- }
@@ -1,289 +0,0 @@
1
- var snum = 1; /* current slide # (non-zero based index e.g. starting with 1) */
2
- var smax = 1; /* max number of slides */
3
- var incpos = 0; /* current step in slide */
4
- var s6mode = true; /* are we in slide mode (in contrast to outline mode)? */
5
- var defaultView = 'slideshow'; /* slideshow | outline */
6
-
7
-
8
- function debug( msg )
9
- {
10
- if( window.console )
11
- console.log( '[debug] ' + msg );
12
- }
13
-
14
- function showHide(action)
15
- {
16
- switch( action ) {
17
- case 's': $( '#navLinks' ).css( 'visibility', 'visible' ); break;
18
- case 'h': $( '#navLinks' ).css( 'visibility', 'hidden' ); break;
19
- case 'c': /* toggle control panel */
20
- if( $( '#navLinks' ).css( 'visibility' ) != 'visible' )
21
- $( '#navLinks' ).css( 'visibility', 'visible' );
22
- else
23
- $( '#navLinks' ).css( 'visibility', 'hidden' );
24
- break;
25
- }
26
- }
27
-
28
- function updateCurrentSlideCounter() {
29
-
30
- $( '#currentSlide' ).html( '<a id="plink" href="">' +
31
- '<span id="csHere">' + snum + '<\/span> ' +
32
- '<span id="csSep">\/<\/span> ' +
33
- '<span id="csTotal">' + smax + '<\/span>' +
34
- '<\/a>' );
35
- }
36
-
37
-
38
- function updatePermaLink() {
39
- $('#plink').get(0).href = window.location.pathname + '#slide' + snum;
40
-
41
- /* todo: unify hash marks??; use #1 for div ids instead of #slide1? */
42
- window.location.hash = '#'+snum;
43
- }
44
-
45
- function goTo( target ) {
46
- if( target > smax || target == snum ) return;
47
- go( target - snum );
48
- }
49
-
50
- function go( dir ) {
51
-
52
- debug( 'go: ' + dir );
53
-
54
- if( dir == 0 ) return; /* same slide; nothing to do */
55
-
56
- var cid = '#slide' + snum; /* current slide (selector) id */
57
- var csteps = steps[snum-1]; /* current slide steps array */
58
-
59
- /* remove all step and stepcurrent classes from current slide */
60
- if( csteps.length > 0) {
61
- $( csteps ).each( function() {
62
- $( this ).removeClass( 'step' ).removeClass( 'stepcurrent' );
63
- } );
64
- }
65
-
66
- /* set snum to next slide */
67
- snum += dir;
68
- if( snum > smax ) snum = smax;
69
- if (snum < 1) snum = 1;
70
-
71
- var nid = '#slide' + snum; /* next slide (selector) id */
72
- var nsteps = steps[snum-1]; /* next slide steps array */
73
-
74
- if( dir < 0 ) /* go backwards? */
75
- {
76
- incpos = nsteps.length;
77
- /* mark last step as current step */
78
- if( nsteps.length > 0 )
79
- $( nsteps[incpos-1] ).addClass( 'stepcurrent' );
80
- }
81
- else /* go forwards? */
82
- {
83
- incpos = 0;
84
- if( nsteps.length > 0 ) {
85
- $( nsteps ).each( function() {
86
- $(this).addClass( 'step' ).removeClass( 'stepcurrent' );
87
- } );
88
- }
89
- }
90
-
91
- $( cid ).hide();
92
- $( nid ).show();
93
-
94
- $('#jumplist').get(0).selectedIndex = (snum-1);
95
- updateCurrentSlideCounter();
96
- updatePermaLink();
97
- }
98
-
99
- function subgo( dir ) {
100
-
101
- debug( 'subgo: ' + dir + ', incpos before: ' + incpos + ', after: ' + (incpos+dir) );
102
-
103
- var csteps = steps[snum-1]; /* current slide steps array */
104
-
105
- if( dir > 0) { /* go forward? */
106
- if( incpos > 0 ) $( csteps[incpos-1] ).removeClass( 'stepcurrent' );
107
- $( csteps[incpos] ).removeClass( 'step').addClass( 'stepcurrent' );
108
- incpos++;
109
- } else { /* go backwards? */
110
- incpos--;
111
- $( csteps[incpos] ).removeClass( 'stepcurrent' ).addClass( 'step' );
112
- if( incpos > 0 ) $( csteps[incpos-1] ).addClass( 'stepcurrent' );
113
- }
114
- }
115
-
116
-
117
-
118
- function toggle() {
119
-
120
- /* get stylesheets */
121
- var slides = $('#slideProj').get(0);
122
- var outline = $('#outlineStyle').get(0);
123
-
124
- if( !slides.disabled ) {
125
- slides.disabled = true;
126
- outline.disabled = false;
127
- s6mode = false;
128
- $('.slide').each( function() { $(this).show(); } );
129
- } else {
130
- slides.disabled = false;
131
- outline.disabled = true;
132
- s6mode = true;
133
- $('.slide').each( function(i) {
134
- if( i == (snum-1) )
135
- $(this).show();
136
- else
137
- $(this).hide();
138
- });
139
- }
140
- }
141
-
142
-
143
- function populateJumpList() {
144
-
145
- var list = $('#jumplist').get(0);
146
-
147
- $( '.slide' ).each( function(i) {
148
- list.options[list.length] = new Option( (i+1)+' : '+ $(this).find('h1').text(), (i+1) );
149
- });
150
- }
151
-
152
- function createControls() {
153
-
154
- $('#controls').html( '<div id="navLinks">' +
155
- '<a accesskey="t" id="toggle" href="#">&#216;<\/a>' +
156
- '<a accesskey="z" id="prev" href="#">&laquo;<\/a>' +
157
- '<a accesskey="x" id="next" href="#">&raquo;<\/a>' +
158
- '<div id="navList"><select id="jumplist" /><\/div>' +
159
- '<\/div>' );
160
-
161
- $('#controls').mouseover( function() { showHide('s'); } );
162
- $('#controls').mouseout( function() { showHide('h'); } );
163
- $('#toggle').click( function() { toggle(); } );
164
- $('#prev').click( function() { go(-1); } );
165
- $('#next').click( function() { go(1); } );
166
-
167
- $('#jumplist').change( function() { goTo( parseInt( $( '#jumplist' ).val() )); } );
168
-
169
- populateJumpList();
170
- updateCurrentSlideCounter();
171
- updatePermaLink();
172
- }
173
-
174
- function addSlideIds() {
175
- $( '.slide' ).each( function(i) {
176
- $(this).attr( 'id', 'slide'+(i+1) );
177
- });
178
-
179
- smax = $( '.slide' ).length;
180
- }
181
-
182
- function notOperaFix() {
183
-
184
- $('#slideProj').attr( 'media','screen' );
185
-
186
- var outline = $('#outlineStyle').get(0);
187
- outline.disabled = true;
188
- }
189
-
190
-
191
- function defaultCheck() {
192
- $( 'meta' ).each( function() {
193
- if( $(this).attr( 'name' ) == 'defaultView' )
194
- defaultView = $(this).attr( 'content' );
195
- } );
196
- }
197
-
198
- function keys(key) {
199
- if (!key) {
200
- key = event;
201
- key.which = key.keyCode;
202
- }
203
- if (key.which == 84) {
204
- toggle();
205
- return;
206
- }
207
- if (s6mode) {
208
- switch (key.which) {
209
- case 32: // spacebar
210
- case 34: // page down
211
- case 39: // rightkey
212
- case 40: // downkey
213
-
214
- if (!steps[snum-1] || incpos >= steps[snum-1].length) {
215
- go(1);
216
- } else {
217
- subgo(1);
218
- }
219
- break;
220
- case 33: // page up
221
- case 37: // leftkey
222
- case 38: // upkey
223
-
224
- if( !steps[snum-1] || incpos <= 0 ) {
225
- go(-1);
226
- } else {
227
- subgo(-1);
228
- }
229
- break;
230
- case 36: // home
231
- goTo(1);
232
- break;
233
- case 35: // end
234
- goTo(smax);
235
- break;
236
- case 67: // c
237
- showHide('c');
238
- break;
239
- }
240
- }
241
- return false;
242
- }
243
-
244
-
245
- function collectStepsWorker(obj) {
246
-
247
- var steps = new Array();
248
- if( !obj )
249
- return steps;
250
-
251
- $(obj).children().each( function() {
252
- if( $(this).hasClass( 'step' ) ) {
253
-
254
- debug( 'step found for ' + this.tagName );
255
- $(this).removeClass( 'step' );
256
-
257
- /* don't add enclosing list; instead add step class to all list items/children */
258
- if( $(this).is( 'ol,ul' ) ) {
259
- debug( ' ol or ul found; adding auto steps' );
260
- $(this).children().addClass( 'step' );
261
- }
262
- else
263
- {
264
- steps.push( this )
265
- }
266
- }
267
-
268
- steps = steps.concat( collectStepsWorker(this) );
269
- });
270
-
271
- return steps;
272
- }
273
-
274
- function collectSteps() {
275
-
276
- var steps = new Array();
277
-
278
- $( '.slide' ).each( function(i) {
279
- debug ( $(this).attr( 'id' ) + ':' );
280
- steps[i] = collectStepsWorker( this );
281
- });
282
-
283
- $( steps ).each( function(i) {
284
- debug( 'slide ' + (i+1) + ': found ' + this.length + ' steps' );
285
- });
286
-
287
- return steps;
288
- }
289
-
@@ -1,73 +0,0 @@
1
- .slide { display: none; }
2
- #slide1 { display: block; }
3
- #microsoft { display: none; }
4
-
5
- .slide { position: absolute; }
6
- #header, #footer { position: fixed; }
7
-
8
- .layout { display: block; }
9
- .notes { display: none; } /* handout notes/note (use note? handout? notes? */
10
-
11
- #header, #footer, .slide { width: 100%; top: 0; left: 0; }
12
- #header { top: 0; height: 0.5em; z-index: 1;}
13
-
14
- #footer { top: auto; bottom: 0; height: 1em; z-index: 5;}
15
- #footer { font-size: 100%; font-weight: bold; padding: 1em 0;}
16
- #footer h1 { display: block; margin: 0; padding: 0 1em; font-size: 0.5em; }
17
- #footer h2 { display: block; margin: 0; padding: 0 1em; font-size: 0.5em; font-style: italic; }
18
-
19
-
20
-
21
- #controls { position: fixed; left: 60%; bottom: 0; width: 40%; z-index: 100;
22
- text-align: right;
23
- font: bold 1.2em Verdana, Helvetica, sans-serif; }
24
-
25
- #controls :focus { outline: 1px dotted white;}
26
-
27
- #controls #navLinks { text-align: right; margin: 0; visibility: hidden; }
28
-
29
- #controls #navLinks a { padding: 0; margin: 0 0.5em; cursor: pointer; border: none; }
30
-
31
- #controls #navLinks :link,
32
- #controls #navLinks :visited {text-decoration: none; }
33
-
34
- #controls #navList #jumplist { background: white; color: black; }
35
-
36
-
37
- #currentSlide { position: fixed; width: 10%; left: 45%; bottom: 1em; z-index: 10;}
38
- #currentSlide { text-align: center; font-size: 0.8em; }
39
- #currentSlide :link,
40
- #currentSlide :visited {text-decoration: none; }
41
-
42
- .presentation { margin: 0; padding: 0; }
43
- .slide { margin: 0 0 0 0; height: 96%; }
44
- .slide { overflow-x: hidden; overflow-y: auto; }
45
- .slide { top: 0; width: 92%; padding: 2% 4% 0 4%; z-index: 2; list-style: none;}
46
-
47
- /* .step { visibility: hidden; } */
48
-
49
-
50
- html, body { margin: 0; padding: 0; }
51
-
52
-
53
-
54
-
55
- /*
56
- div#header {background: #FCC;}
57
- div#footer {background: #CCF;}
58
- div#controls {background: #BBD;}
59
- div#currentSlide {background: #FFC;}
60
- */
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
@@ -1,59 +0,0 @@
1
- /* Just an example for an all-in-one convenience include
2
-
3
- create your own slide.js to include your own extensions and
4
- change the startup (document ready) code as needed
5
-
6
- Tell us about your extentions or changes on the forum. Thank!
7
- Find the forum @ http://groups.google.com/group/webslideshow
8
- */
9
-
10
-
11
- $.ajaxSetup({async: false});
12
- $.getScript( 's6/slides.core.js' );
13
- $.ajaxSetup({async: true});
14
-
15
- $(document).ready(function(){
16
-
17
- if( $.browser.msie )
18
- {
19
- $( '.layout > *').hide();
20
- $( '.presentation').hide();
21
-
22
- $( '#microsoft' ).show();
23
- }
24
- else
25
- {
26
-
27
- /* store possible slidenumber from hash */
28
- /* todo: use regex to extract number
29
- might be #slide1 or just #1
30
- */
31
- var gotoSlideNum = parseInt( window.location.hash.substring(1) );
32
- debug( "gotoSlideNum=" + gotoSlideNum );
33
-
34
- defaultCheck();
35
- addSlideIds();
36
- createControls();
37
-
38
- /* opera is the only browser currently supporting css projection mode */
39
- /* if( !$.browser.opera ) */
40
- notOperaFix();
41
-
42
- steps = collectSteps();
43
-
44
- if( !isNaN( gotoSlideNum ))
45
- {
46
- debug( "restoring slide on (re)load #: " + gotoSlideNum );
47
- goTo( gotoSlideNum );
48
- }
49
-
50
-
51
- if( defaultView == 'outline' )
52
- toggle();
53
-
54
-
55
-
56
-
57
- document.onkeyup = keys;
58
- }
59
- });