reveal.rb 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +11 -3
  4. data/lib/reveal/templates/revealjs/css/print/paper.css +176 -0
  5. data/lib/reveal/templates/revealjs/css/theme/README.md +25 -0
  6. data/lib/reveal/templates/revealjs/css/theme/beige.css +148 -0
  7. data/lib/reveal/templates/revealjs/css/theme/blood.css +175 -0
  8. data/lib/reveal/templates/revealjs/css/theme/moon.css +148 -0
  9. data/lib/reveal/templates/revealjs/css/theme/night.css +136 -0
  10. data/lib/reveal/templates/revealjs/css/theme/serif.css +138 -0
  11. data/lib/reveal/templates/revealjs/css/theme/simple.css +138 -0
  12. data/lib/reveal/templates/revealjs/css/theme/sky.css +145 -0
  13. data/lib/reveal/templates/revealjs/css/theme/solarized.css +148 -0
  14. data/lib/reveal/templates/revealjs/css/theme/source/beige.scss +50 -0
  15. data/lib/reveal/templates/revealjs/css/theme/source/blood.scss +91 -0
  16. data/lib/reveal/templates/revealjs/css/theme/source/default.scss +42 -0
  17. data/lib/reveal/templates/revealjs/css/theme/source/moon.scss +68 -0
  18. data/lib/reveal/templates/revealjs/css/theme/source/night.scss +35 -0
  19. data/lib/reveal/templates/revealjs/css/theme/source/serif.scss +35 -0
  20. data/lib/reveal/templates/revealjs/css/theme/source/simple.scss +38 -0
  21. data/lib/reveal/templates/revealjs/css/theme/source/sky.scss +46 -0
  22. data/lib/reveal/templates/revealjs/css/theme/source/solarized.scss +74 -0
  23. data/lib/reveal/templates/revealjs/css/theme/template/mixins.scss +29 -0
  24. data/lib/reveal/templates/revealjs/css/theme/template/settings.scss +34 -0
  25. data/lib/reveal/templates/revealjs/css/theme/template/theme.scss +170 -0
  26. data/lib/reveal/templates/revealjs/lib/font/league_gothic-webfont.svg +230 -0
  27. data/lib/reveal/templates/revealjs/lib/font/league_gothic_license +2 -0
  28. data/lib/reveal/templates/revealjs/lib/js/html5shiv.js +7 -0
  29. data/lib/reveal/templates/revealjs/plugin/leap/leap.js +157 -0
  30. data/lib/reveal/templates/revealjs/plugin/markdown/example.html +129 -0
  31. data/lib/reveal/templates/revealjs/plugin/markdown/example.md +31 -0
  32. data/lib/reveal/templates/revealjs/plugin/math/math.js +64 -0
  33. data/lib/reveal/templates/revealjs/plugin/multiplex/client.js +13 -0
  34. data/lib/reveal/templates/revealjs/plugin/multiplex/index.js +56 -0
  35. data/lib/reveal/templates/revealjs/plugin/multiplex/master.js +51 -0
  36. data/lib/reveal/templates/revealjs/plugin/notes/notes.html +267 -0
  37. data/lib/reveal/templates/revealjs/plugin/notes-server/client.js +57 -0
  38. data/lib/reveal/templates/revealjs/plugin/notes-server/index.js +59 -0
  39. data/lib/reveal/templates/revealjs/plugin/notes-server/notes.html +142 -0
  40. data/lib/reveal/templates/revealjs/plugin/postmessage/example.html +39 -0
  41. data/lib/reveal/templates/revealjs/plugin/postmessage/postmessage.js +42 -0
  42. data/lib/reveal/templates/revealjs/plugin/print-pdf/print-pdf.js +44 -0
  43. data/lib/reveal/templates/revealjs/plugin/remotes/remotes.js +39 -0
  44. data/lib/reveal/templates/revealjs/plugin/search/search.js +196 -0
  45. data/lib/reveal/version.rb +1 -1
  46. metadata +43 -2
@@ -0,0 +1,51 @@
1
+ (function() {
2
+ // Don't emit events from inside of notes windows
3
+ if ( window.location.search.match( /receiver/gi ) ) { return; }
4
+
5
+ var multiplex = Reveal.getConfig().multiplex;
6
+
7
+ var socket = io.connect(multiplex.url);
8
+
9
+ var notify = function( slideElement, indexh, indexv, origin ) {
10
+ if( typeof origin === 'undefined' && origin !== 'remote' ) {
11
+ var nextindexh;
12
+ var nextindexv;
13
+
14
+ var fragmentindex = Reveal.getIndices().f;
15
+ if (typeof fragmentindex == 'undefined') {
16
+ fragmentindex = 0;
17
+ }
18
+
19
+ if (slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION') {
20
+ nextindexh = indexh;
21
+ nextindexv = indexv + 1;
22
+ } else {
23
+ nextindexh = indexh + 1;
24
+ nextindexv = 0;
25
+ }
26
+
27
+ var slideData = {
28
+ indexh : indexh,
29
+ indexv : indexv,
30
+ indexf : fragmentindex,
31
+ nextindexh : nextindexh,
32
+ nextindexv : nextindexv,
33
+ secret: multiplex.secret,
34
+ socketId : multiplex.id
35
+ };
36
+
37
+ socket.emit('slidechanged', slideData);
38
+ }
39
+ }
40
+
41
+ Reveal.addEventListener( 'slidechanged', function( event ) {
42
+ notify( event.currentSlide, event.indexh, event.indexv, event.origin );
43
+ } );
44
+
45
+ var fragmentNotify = function( event ) {
46
+ notify( Reveal.getCurrentSlide(), Reveal.getIndices().h, Reveal.getIndices().v, event.origin );
47
+ };
48
+
49
+ Reveal.addEventListener( 'fragmentshown', fragmentNotify );
50
+ Reveal.addEventListener( 'fragmenthidden', fragmentNotify );
51
+ }());
@@ -0,0 +1,267 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+
6
+ <title>reveal.js - Slide Notes</title>
7
+
8
+ <style>
9
+ body {
10
+ font-family: Helvetica;
11
+ }
12
+
13
+ #notes {
14
+ font-size: 24px;
15
+ width: 640px;
16
+ margin-top: 5px;
17
+ clear: left;
18
+ }
19
+
20
+ #wrap-current-slide {
21
+ width: 640px;
22
+ height: 512px;
23
+ float: left;
24
+ overflow: hidden;
25
+ }
26
+
27
+ #current-slide {
28
+ width: 1280px;
29
+ height: 1024px;
30
+ border: none;
31
+
32
+ -webkit-transform-origin: 0 0;
33
+ -moz-transform-origin: 0 0;
34
+ -ms-transform-origin: 0 0;
35
+ -o-transform-origin: 0 0;
36
+ transform-origin: 0 0;
37
+
38
+ -webkit-transform: scale(0.5);
39
+ -moz-transform: scale(0.5);
40
+ -ms-transform: scale(0.5);
41
+ -o-transform: scale(0.5);
42
+ transform: scale(0.5);
43
+ }
44
+
45
+ #wrap-next-slide {
46
+ width: 448px;
47
+ height: 358px;
48
+ float: left;
49
+ margin: 0 0 0 10px;
50
+ overflow: hidden;
51
+ }
52
+
53
+ #next-slide {
54
+ width: 1280px;
55
+ height: 1024px;
56
+ border: none;
57
+
58
+ -webkit-transform-origin: 0 0;
59
+ -moz-transform-origin: 0 0;
60
+ -ms-transform-origin: 0 0;
61
+ -o-transform-origin: 0 0;
62
+ transform-origin: 0 0;
63
+
64
+ -webkit-transform: scale(0.35);
65
+ -moz-transform: scale(0.35);
66
+ -ms-transform: scale(0.35);
67
+ -o-transform: scale(0.35);
68
+ transform: scale(0.35);
69
+ }
70
+
71
+ .slides {
72
+ position: relative;
73
+ margin-bottom: 10px;
74
+ border: 1px solid black;
75
+ border-radius: 2px;
76
+ background: rgb(28, 30, 32);
77
+ }
78
+
79
+ .slides span {
80
+ position: absolute;
81
+ top: 3px;
82
+ left: 3px;
83
+ font-weight: bold;
84
+ font-size: 14px;
85
+ color: rgba( 255, 255, 255, 0.9 );
86
+ }
87
+
88
+ .error {
89
+ font-weight: bold;
90
+ color: red;
91
+ font-size: 1.5em;
92
+ text-align: center;
93
+ margin-top: 10%;
94
+ }
95
+
96
+ .error code {
97
+ font-family: monospace;
98
+ }
99
+
100
+ .time {
101
+ width: 448px;
102
+ margin: 30px 0 0 10px;
103
+ float: left;
104
+ text-align: center;
105
+ opacity: 0;
106
+
107
+ -webkit-transition: opacity 0.4s;
108
+ -moz-transition: opacity 0.4s;
109
+ -o-transition: opacity 0.4s;
110
+ transition: opacity 0.4s;
111
+ }
112
+
113
+ .elapsed,
114
+ .clock {
115
+ color: #333;
116
+ font-size: 2em;
117
+ text-align: center;
118
+ display: inline-block;
119
+ padding: 0.5em;
120
+ background-color: #eee;
121
+ border-radius: 10px;
122
+ }
123
+
124
+ .elapsed h2,
125
+ .clock h2 {
126
+ font-size: 0.8em;
127
+ line-height: 100%;
128
+ margin: 0;
129
+ color: #aaa;
130
+ }
131
+
132
+ .elapsed .mute {
133
+ color: #ddd;
134
+ }
135
+
136
+ </style>
137
+ </head>
138
+
139
+ <body>
140
+
141
+ <script>
142
+ function getNotesURL( controls ) {
143
+ return window.opener.location.protocol + '//' + window.opener.location.host + window.opener.location.pathname + '?receiver&controls='+ ( controls || 'false' ) +'&progress=false&overview=false' + window.opener.location.hash;
144
+ }
145
+ var notesCurrentSlideURL = getNotesURL( true );
146
+ var notesNextSlideURL = getNotesURL( false );
147
+ </script>
148
+
149
+ <div id="wrap-current-slide" class="slides">
150
+ <script>document.write( '<iframe width="1280" height="1024" id="current-slide" src="'+ notesCurrentSlideURL +'"></iframe>' );</script>
151
+ </div>
152
+
153
+ <div id="wrap-next-slide" class="slides">
154
+ <script>document.write( '<iframe width="640" height="512" id="next-slide" src="'+ notesNextSlideURL +'"></iframe>' );</script>
155
+ <span>UPCOMING:</span>
156
+ </div>
157
+
158
+ <div class="time">
159
+ <div class="clock">
160
+ <h2>Time</h2>
161
+ <span id="clock">0:00:00 AM</span>
162
+ </div>
163
+ <div class="elapsed">
164
+ <h2>Elapsed</h2>
165
+ <span id="hours">00</span><span id="minutes">:00</span><span id="seconds">:00</span>
166
+ </div>
167
+ </div>
168
+
169
+ <div id="notes"></div>
170
+
171
+ <script src="../../plugin/markdown/marked.js"></script>
172
+ <script>
173
+
174
+ window.addEventListener( 'load', function() {
175
+
176
+ if( window.opener && window.opener.location && window.opener.location.href ) {
177
+
178
+ var notes = document.getElementById( 'notes' ),
179
+ currentSlide = document.getElementById( 'current-slide' ),
180
+ nextSlide = document.getElementById( 'next-slide' ),
181
+ silenced = false;
182
+
183
+ window.addEventListener( 'message', function( event ) {
184
+ var data = JSON.parse( event.data );
185
+
186
+ // No need for updating the notes in case of fragment changes
187
+ if ( data.notes !== undefined) {
188
+ if( data.markdown ) {
189
+ notes.innerHTML = marked( data.notes );
190
+ }
191
+ else {
192
+ notes.innerHTML = data.notes;
193
+ }
194
+ }
195
+
196
+ silenced = true;
197
+
198
+ // Update the note slides
199
+ currentSlide.contentWindow.Reveal.slide( data.indexh, data.indexv, data.indexf );
200
+ nextSlide.contentWindow.Reveal.slide( data.nextindexh, data.nextindexv );
201
+
202
+ silenced = false;
203
+
204
+ }, false );
205
+
206
+ var start = new Date(),
207
+ timeEl = document.querySelector( '.time' ),
208
+ clockEl = document.getElementById( 'clock' ),
209
+ hoursEl = document.getElementById( 'hours' ),
210
+ minutesEl = document.getElementById( 'minutes' ),
211
+ secondsEl = document.getElementById( 'seconds' );
212
+
213
+ setInterval( function() {
214
+
215
+ timeEl.style.opacity = 1;
216
+
217
+ var diff, hours, minutes, seconds,
218
+ now = new Date();
219
+
220
+ diff = now.getTime() - start.getTime();
221
+ hours = Math.floor( diff / ( 1000 * 60 * 60 ) );
222
+ minutes = Math.floor( ( diff / ( 1000 * 60 ) ) % 60 );
223
+ seconds = Math.floor( ( diff / 1000 ) % 60 );
224
+
225
+ clockEl.innerHTML = now.toLocaleTimeString();
226
+ hoursEl.innerHTML = zeroPadInteger( hours );
227
+ hoursEl.className = hours > 0 ? "" : "mute";
228
+ minutesEl.innerHTML = ":" + zeroPadInteger( minutes );
229
+ minutesEl.className = minutes > 0 ? "" : "mute";
230
+ secondsEl.innerHTML = ":" + zeroPadInteger( seconds );
231
+
232
+ }, 1000 );
233
+
234
+ // Broadcasts the state of the notes window to synchronize
235
+ // the main window
236
+ function synchronizeMainWindow() {
237
+
238
+ if( !silenced ) {
239
+ var indices = currentSlide.contentWindow.Reveal.getIndices();
240
+ window.opener.Reveal.slide( indices.h, indices.v, indices.f );
241
+ }
242
+
243
+ }
244
+
245
+ // Navigate the main window when the notes slide changes
246
+ currentSlide.contentWindow.Reveal.addEventListener( 'slidechanged', synchronizeMainWindow );
247
+ currentSlide.contentWindow.Reveal.addEventListener( 'fragmentshown', synchronizeMainWindow );
248
+ currentSlide.contentWindow.Reveal.addEventListener( 'fragmenthidden', synchronizeMainWindow );
249
+
250
+ }
251
+ else {
252
+
253
+ document.body.innerHTML = '<p class="error">Unable to access <code>window.opener.location</code>.<br>Make sure the presentation is running on a web server.</p>';
254
+
255
+ }
256
+
257
+
258
+ }, false );
259
+
260
+ function zeroPadInteger( num ) {
261
+ var str = "00" + parseInt( num );
262
+ return str.substring( str.length - 2 );
263
+ }
264
+
265
+ </script>
266
+ </body>
267
+ </html>
@@ -0,0 +1,57 @@
1
+ (function() {
2
+ // don't emit events from inside the previews themselves
3
+ if ( window.location.search.match( /receiver/gi ) ) { return; }
4
+
5
+ var socket = io.connect(window.location.origin);
6
+ var socketId = Math.random().toString().slice(2);
7
+
8
+ console.log('View slide notes at ' + window.location.origin + '/notes/' + socketId);
9
+ window.open(window.location.origin + '/notes/' + socketId, 'notes-' + socketId);
10
+
11
+ // Fires when a fragment is shown
12
+ Reveal.addEventListener( 'fragmentshown', function( event ) {
13
+ var fragmentData = {
14
+ fragment : 'next',
15
+ socketId : socketId
16
+ };
17
+ socket.emit('fragmentchanged', fragmentData);
18
+ } );
19
+
20
+ // Fires when a fragment is hidden
21
+ Reveal.addEventListener( 'fragmenthidden', function( event ) {
22
+ var fragmentData = {
23
+ fragment : 'previous',
24
+ socketId : socketId
25
+ };
26
+ socket.emit('fragmentchanged', fragmentData);
27
+ } );
28
+
29
+ // Fires when slide is changed
30
+ Reveal.addEventListener( 'slidechanged', function( event ) {
31
+ var nextindexh;
32
+ var nextindexv;
33
+ var slideElement = event.currentSlide;
34
+
35
+ if (slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION') {
36
+ nextindexh = event.indexh;
37
+ nextindexv = event.indexv + 1;
38
+ } else {
39
+ nextindexh = event.indexh + 1;
40
+ nextindexv = 0;
41
+ }
42
+
43
+ var notes = slideElement.querySelector('aside.notes');
44
+ var slideData = {
45
+ notes : notes ? notes.innerHTML : '',
46
+ indexh : event.indexh,
47
+ indexv : event.indexv,
48
+ nextindexh : nextindexh,
49
+ nextindexv : nextindexv,
50
+ socketId : socketId,
51
+ markdown : notes ? typeof notes.getAttribute('data-markdown') === 'string' : false
52
+
53
+ };
54
+
55
+ socket.emit('slidechanged', slideData);
56
+ } );
57
+ }());
@@ -0,0 +1,59 @@
1
+ var express = require('express');
2
+ var fs = require('fs');
3
+ var io = require('socket.io');
4
+ var _ = require('underscore');
5
+ var Mustache = require('mustache');
6
+
7
+ var app = express.createServer();
8
+ var staticDir = express.static;
9
+
10
+ io = io.listen(app);
11
+
12
+ var opts = {
13
+ port : 1947,
14
+ baseDir : __dirname + '/../../'
15
+ };
16
+
17
+ io.sockets.on('connection', function(socket) {
18
+ socket.on('slidechanged', function(slideData) {
19
+ socket.broadcast.emit('slidedata', slideData);
20
+ });
21
+ socket.on('fragmentchanged', function(fragmentData) {
22
+ socket.broadcast.emit('fragmentdata', fragmentData);
23
+ });
24
+ });
25
+
26
+ app.configure(function() {
27
+ [ 'css', 'js', 'images', 'plugin', 'lib' ].forEach(function(dir) {
28
+ app.use('/' + dir, staticDir(opts.baseDir + dir));
29
+ });
30
+ });
31
+
32
+ app.get("/", function(req, res) {
33
+ res.writeHead(200, {'Content-Type': 'text/html'});
34
+ fs.createReadStream(opts.baseDir + '/index.html').pipe(res);
35
+ });
36
+
37
+ app.get("/notes/:socketId", function(req, res) {
38
+
39
+ fs.readFile(opts.baseDir + 'plugin/notes-server/notes.html', function(err, data) {
40
+ res.send(Mustache.to_html(data.toString(), {
41
+ socketId : req.params.socketId
42
+ }));
43
+ });
44
+ // fs.createReadStream(opts.baseDir + 'notes-server/notes.html').pipe(res);
45
+ });
46
+
47
+ // Actually listen
48
+ app.listen(opts.port || null);
49
+
50
+ var brown = '\033[33m',
51
+ green = '\033[32m',
52
+ reset = '\033[0m';
53
+
54
+ var slidesLocation = "http://localhost" + ( opts.port ? ( ':' + opts.port ) : '' );
55
+
56
+ console.log( brown + "reveal.js - Speaker Notes" + reset );
57
+ console.log( "1. Open the slides at " + green + slidesLocation + reset );
58
+ console.log( "2. Click on the link your JS console to go to the notes page" );
59
+ console.log( "3. Advance through your slides and your notes will advance automatically" );
@@ -0,0 +1,142 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+
6
+ <meta name="viewport" content="width=1150">
7
+
8
+ <title>reveal.js - Slide Notes</title>
9
+
10
+ <style>
11
+ body {
12
+ font-family: Helvetica;
13
+ }
14
+
15
+ #notes {
16
+ font-size: 24px;
17
+ width: 640px;
18
+ margin-top: 5px;
19
+ clear: left;
20
+ }
21
+
22
+ #wrap-current-slide {
23
+ width: 640px;
24
+ height: 512px;
25
+ float: left;
26
+ overflow: hidden;
27
+ }
28
+
29
+ #current-slide {
30
+ width: 1280px;
31
+ height: 1024px;
32
+ border: none;
33
+
34
+ -webkit-transform-origin: 0 0;
35
+ -moz-transform-origin: 0 0;
36
+ -ms-transform-origin: 0 0;
37
+ -o-transform-origin: 0 0;
38
+ transform-origin: 0 0;
39
+
40
+ -webkit-transform: scale(0.5);
41
+ -moz-transform: scale(0.5);
42
+ -ms-transform: scale(0.5);
43
+ -o-transform: scale(0.5);
44
+ transform: scale(0.5);
45
+ }
46
+
47
+ #wrap-next-slide {
48
+ width: 448px;
49
+ height: 358px;
50
+ float: left;
51
+ margin: 0 0 0 10px;
52
+ overflow: hidden;
53
+ }
54
+
55
+ #next-slide {
56
+ width: 1280px;
57
+ height: 1024px;
58
+ border: none;
59
+
60
+ -webkit-transform-origin: 0 0;
61
+ -moz-transform-origin: 0 0;
62
+ -ms-transform-origin: 0 0;
63
+ -o-transform-origin: 0 0;
64
+ transform-origin: 0 0;
65
+
66
+ -webkit-transform: scale(0.35);
67
+ -moz-transform: scale(0.35);
68
+ -ms-transform: scale(0.35);
69
+ -o-transform: scale(0.35);
70
+ transform: scale(0.35);
71
+ }
72
+
73
+ .slides {
74
+ position: relative;
75
+ margin-bottom: 10px;
76
+ border: 1px solid black;
77
+ border-radius: 2px;
78
+ background: rgb(28, 30, 32);
79
+ }
80
+
81
+ .slides span {
82
+ position: absolute;
83
+ top: 3px;
84
+ left: 3px;
85
+ font-weight: bold;
86
+ font-size: 14px;
87
+ color: rgba( 255, 255, 255, 0.9 );
88
+ }
89
+ </style>
90
+ </head>
91
+
92
+ <body>
93
+
94
+ <div id="wrap-current-slide" class="slides">
95
+ <iframe src="/?receiver" width="1280" height="1024" id="current-slide"></iframe>
96
+ </div>
97
+
98
+ <div id="wrap-next-slide" class="slides">
99
+ <iframe src="/?receiver" width="640" height="512" id="next-slide"></iframe>
100
+ <span>UPCOMING:</span>
101
+ </div>
102
+ <div id="notes"></div>
103
+
104
+ <script src="/socket.io/socket.io.js"></script>
105
+ <script src="/plugin/markdown/marked.js"></script>
106
+
107
+ <script>
108
+ var socketId = '{{socketId}}';
109
+ var socket = io.connect(window.location.origin);
110
+ var notes = document.getElementById('notes');
111
+ var currentSlide = document.getElementById('current-slide');
112
+ var nextSlide = document.getElementById('next-slide');
113
+
114
+ socket.on('slidedata', function(data) {
115
+ // ignore data from sockets that aren't ours
116
+ if (data.socketId !== socketId) { return; }
117
+
118
+ if (data.markdown) {
119
+ notes.innerHTML = marked(data.notes);
120
+ }
121
+ else {
122
+ notes.innerHTML = data.notes;
123
+ }
124
+
125
+ currentSlide.contentWindow.Reveal.slide(data.indexh, data.indexv);
126
+ nextSlide.contentWindow.Reveal.slide(data.nextindexh, data.nextindexv);
127
+ });
128
+ socket.on('fragmentdata', function(data) {
129
+ // ignore data from sockets that aren't ours
130
+ if (data.socketId !== socketId) { return; }
131
+
132
+ if (data.fragment === 'next') {
133
+ currentSlide.contentWindow.Reveal.nextFragment();
134
+ }
135
+ else if (data.fragment === 'previous') {
136
+ currentSlide.contentWindow.Reveal.prevFragment();
137
+ }
138
+ });
139
+ </script>
140
+
141
+ </body>
142
+ </html>
@@ -0,0 +1,39 @@
1
+ <html>
2
+ <body>
3
+
4
+ <iframe id="reveal" src="../../index.html" style="border: 0;" width="500" height="500"></iframe>
5
+
6
+ <div>
7
+ <input id="back" type="button" value="go back"/>
8
+ <input id="ahead" type="button" value="go ahead"/>
9
+ <input id="slideto" type="button" value="slideto 2-2"/>
10
+ </div>
11
+
12
+ <script>
13
+
14
+ (function (){
15
+
16
+ var back = document.getElementById( 'back' ),
17
+ ahead = document.getElementById( 'ahead' ),
18
+ slideto = document.getElementById( 'slideto' ),
19
+ reveal = window.frames[0];
20
+
21
+ back.addEventListener( 'click', function () {
22
+
23
+ reveal.postMessage( JSON.stringify({method: 'prev', args: []}), '*' );
24
+ }, false );
25
+
26
+ ahead.addEventListener( 'click', function (){
27
+ reveal.postMessage( JSON.stringify({method: 'next', args: []}), '*' );
28
+ }, false );
29
+
30
+ slideto.addEventListener( 'click', function (){
31
+ reveal.postMessage( JSON.stringify({method: 'slide', args: [2,2]}), '*' );
32
+ }, false );
33
+
34
+ }());
35
+
36
+ </script>
37
+
38
+ </body>
39
+ </html>
@@ -0,0 +1,42 @@
1
+ /*
2
+
3
+ simple postmessage plugin
4
+
5
+ Useful when a reveal slideshow is inside an iframe.
6
+ It allows to call reveal methods from outside.
7
+
8
+ Example:
9
+ var reveal = window.frames[0];
10
+
11
+ // Reveal.prev();
12
+ reveal.postMessage(JSON.stringify({method: 'prev', args: []}), '*');
13
+ // Reveal.next();
14
+ reveal.postMessage(JSON.stringify({method: 'next', args: []}), '*');
15
+ // Reveal.slide(2, 2);
16
+ reveal.postMessage(JSON.stringify({method: 'slide', args: [2,2]}), '*');
17
+
18
+ Add to the slideshow:
19
+
20
+ dependencies: [
21
+ ...
22
+ { src: 'plugin/postmessage/postmessage.js', async: true, condition: function() { return !!document.body.classList; } }
23
+ ]
24
+
25
+ */
26
+
27
+ (function (){
28
+
29
+ window.addEventListener( "message", function ( event ) {
30
+ var data = JSON.parse( event.data ),
31
+ method = data.method,
32
+ args = data.args;
33
+
34
+ if( typeof Reveal[method] === 'function' ) {
35
+ Reveal[method].apply( Reveal, data.args );
36
+ }
37
+ }, false);
38
+
39
+ }());
40
+
41
+
42
+
@@ -0,0 +1,44 @@
1
+ /**
2
+ * phantomjs script for printing presentations to PDF.
3
+ *
4
+ * Example:
5
+ * phantomjs print-pdf.js "http://lab.hakim.se/reveal-js?print-pdf" reveal-demo.pdf
6
+ *
7
+ * By Manuel Bieh (https://github.com/manuelbieh)
8
+ */
9
+
10
+ // html2pdf.js
11
+ var page = new WebPage();
12
+ var system = require( 'system' );
13
+
14
+ page.viewportSize = {
15
+ width: 1024,
16
+ height: 768
17
+ };
18
+
19
+ page.paperSize = {
20
+ format: 'letter',
21
+ orientation: 'landscape',
22
+ margin: {
23
+ left: '0',
24
+ right: '0',
25
+ top: '0',
26
+ bottom: '0'
27
+ }
28
+ };
29
+
30
+ var revealFile = system.args[1] || 'index.html?print-pdf';
31
+ var slideFile = system.args[2] || 'slides.pdf';
32
+
33
+ if( slideFile.match( /\.pdf$/gi ) === null ) {
34
+ slideFile += '.pdf';
35
+ }
36
+
37
+ console.log( 'Printing PDF...' );
38
+
39
+ page.open( revealFile, function( status ) {
40
+ console.log( 'Printed succesfully' );
41
+ page.render( slideFile );
42
+ phantom.exit();
43
+ } );
44
+