slippery 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.travis.yml +27 -0
- data/Gemfile +10 -0
- data/Gemfile.devtools +59 -0
- data/Gemfile.lock +220 -0
- data/LICENSE +9 -0
- data/README.md +122 -0
- data/Rakefile +2 -0
- data/assets/impress.js/css/impress-demo.css +703 -0
- data/assets/impress.js/js/impress.js +800 -0
- data/assets/reveal.js/css/print/paper.css +176 -0
- data/assets/reveal.js/css/print/pdf.css +190 -0
- data/assets/reveal.js/css/reveal.css +1616 -0
- data/assets/reveal.js/css/reveal.min.css +7 -0
- data/assets/reveal.js/css/theme/README.md +23 -0
- data/assets/reveal.js/css/theme/beige.css +142 -0
- data/assets/reveal.js/css/theme/default.css +142 -0
- data/assets/reveal.js/css/theme/moon.css +142 -0
- data/assets/reveal.js/css/theme/night.css +130 -0
- data/assets/reveal.js/css/theme/serif.css +132 -0
- data/assets/reveal.js/css/theme/simple.css +132 -0
- data/assets/reveal.js/css/theme/sky.css +139 -0
- data/assets/reveal.js/css/theme/solarized.css +142 -0
- data/assets/reveal.js/css/theme/source/beige.scss +50 -0
- data/assets/reveal.js/css/theme/source/default.scss +42 -0
- data/assets/reveal.js/css/theme/source/moon.scss +68 -0
- data/assets/reveal.js/css/theme/source/night.scss +35 -0
- data/assets/reveal.js/css/theme/source/serif.scss +35 -0
- data/assets/reveal.js/css/theme/source/simple.scss +38 -0
- data/assets/reveal.js/css/theme/source/sky.scss +46 -0
- data/assets/reveal.js/css/theme/source/solarized.scss +74 -0
- data/assets/reveal.js/css/theme/template/mixins.scss +29 -0
- data/assets/reveal.js/css/theme/template/settings.scss +33 -0
- data/assets/reveal.js/css/theme/template/theme.scss +163 -0
- data/assets/reveal.js/js/head.min.js +8 -0
- data/assets/reveal.js/js/reveal.js +2577 -0
- data/assets/reveal.js/js/reveal.min.js +8 -0
- data/assets/reveal.js/lib/css/zenburn.css +115 -0
- data/assets/reveal.js/lib/font/league_gothic-webfont.eot +0 -0
- data/assets/reveal.js/lib/font/league_gothic-webfont.svg +230 -0
- data/assets/reveal.js/lib/font/league_gothic-webfont.ttf +0 -0
- data/assets/reveal.js/lib/font/league_gothic-webfont.woff +0 -0
- data/assets/reveal.js/lib/font/league_gothic_license +2 -0
- data/assets/reveal.js/lib/js/classList.js +2 -0
- data/assets/reveal.js/lib/js/head.min.js +8 -0
- data/assets/reveal.js/lib/js/html5shiv.js +7 -0
- data/assets/reveal.js/plugin/highlight/highlight.js +31 -0
- data/assets/reveal.js/plugin/leap/leap.js +154 -0
- data/assets/reveal.js/plugin/markdown/example.html +97 -0
- data/assets/reveal.js/plugin/markdown/example.md +29 -0
- data/assets/reveal.js/plugin/markdown/markdown.js +190 -0
- data/assets/reveal.js/plugin/markdown/marked.js +37 -0
- data/assets/reveal.js/plugin/multiplex/client.js +13 -0
- data/assets/reveal.js/plugin/multiplex/index.js +56 -0
- data/assets/reveal.js/plugin/multiplex/master.js +50 -0
- data/assets/reveal.js/plugin/notes/notes.html +253 -0
- data/assets/reveal.js/plugin/notes/notes.js +100 -0
- data/assets/reveal.js/plugin/notes-server/client.js +57 -0
- data/assets/reveal.js/plugin/notes-server/index.js +59 -0
- data/assets/reveal.js/plugin/notes-server/notes.html +142 -0
- data/assets/reveal.js/plugin/postmessage/example.html +39 -0
- data/assets/reveal.js/plugin/postmessage/postmessage.js +42 -0
- data/assets/reveal.js/plugin/print-pdf/print-pdf.js +44 -0
- data/assets/reveal.js/plugin/remotes/remotes.js +39 -0
- data/assets/reveal.js/plugin/search/search.js +196 -0
- data/assets/reveal.js/plugin/zoom-js/zoom.js +256 -0
- data/config/flay.yml +3 -0
- data/config/flog.yml +2 -0
- data/config/mutant.yml +3 -0
- data/config/reek.yml +108 -0
- data/config/rubocop.yml +71 -0
- data/config/yardstick.yml +2 -0
- data/lib/slippery/converter.rb +130 -0
- data/lib/slippery/document.rb +20 -0
- data/lib/slippery/presentation.rb +36 -0
- data/lib/slippery/processor_helpers.rb +43 -0
- data/lib/slippery/processors/add_google_font.rb +27 -0
- data/lib/slippery/processors/graphviz_dot.rb +46 -0
- data/lib/slippery/processors/hr_to_sections.rb +36 -0
- data/lib/slippery/processors/impress_js/add_impress_js.rb +30 -0
- data/lib/slippery/processors/impress_js/auto_offsets.rb +25 -0
- data/lib/slippery/processors/reveal_js/add_reveal_js.rb +78 -0
- data/lib/slippery/processors/self_contained.rb +62 -0
- data/lib/slippery/version.rb +3 -0
- data/lib/slippery.rb +42 -0
- data/slippery.gemspec +25 -0
- data/spec/fixtures/blockquotes.md +6 -0
- data/spec/fixtures/code_blocks.md +9 -0
- data/spec/fixtures/definition_lists.md +2 -0
- data/spec/fixtures/header_and_paragraph.md +2 -0
- data/spec/fixtures/headers.md +13 -0
- data/spec/fixtures/ordered_list.md +3 -0
- data/spec/fixtures/unordered_list.md +3 -0
- data/spec/slippery/converter_spec.rb +67 -0
- data/spec/slippery_spec.rb +0 -0
- data/spec/spec_helper.rb +20 -0
- metadata +208 -0
@@ -0,0 +1,100 @@
|
|
1
|
+
/**
|
2
|
+
* Handles opening of and synchronization with the reveal.js
|
3
|
+
* notes window.
|
4
|
+
*/
|
5
|
+
var RevealNotes = (function() {
|
6
|
+
|
7
|
+
function openNotes() {
|
8
|
+
var jsFileLocation = document.querySelector('script[src$="notes.js"]').src; // this js file path
|
9
|
+
jsFileLocation = jsFileLocation.replace(/notes\.js(\?.*)?$/, ''); // the js folder path
|
10
|
+
var notesPopup = window.open( jsFileLocation + 'notes.html', 'reveal.js - Notes', 'width=1120,height=850' );
|
11
|
+
|
12
|
+
// Fires when slide is changed
|
13
|
+
Reveal.addEventListener( 'slidechanged', function( event ) {
|
14
|
+
post('slidechanged');
|
15
|
+
} );
|
16
|
+
|
17
|
+
// Fires when a fragment is shown
|
18
|
+
Reveal.addEventListener( 'fragmentshown', function( event ) {
|
19
|
+
post('fragmentshown');
|
20
|
+
} );
|
21
|
+
|
22
|
+
// Fires when a fragment is hidden
|
23
|
+
Reveal.addEventListener( 'fragmenthidden', function( event ) {
|
24
|
+
post('fragmenthidden');
|
25
|
+
} );
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Posts the current slide data to the notes window
|
29
|
+
*
|
30
|
+
* @param {String} eventType Expecting 'slidechanged', 'fragmentshown'
|
31
|
+
* or 'fragmenthidden' set in the events above to define the needed
|
32
|
+
* slideDate.
|
33
|
+
*/
|
34
|
+
function post( eventType ) {
|
35
|
+
var slideElement = Reveal.getCurrentSlide(),
|
36
|
+
messageData;
|
37
|
+
|
38
|
+
if( eventType === 'slidechanged' ) {
|
39
|
+
var notes = slideElement.querySelector( 'aside.notes' ),
|
40
|
+
indexh = Reveal.getIndices().h,
|
41
|
+
indexv = Reveal.getIndices().v,
|
42
|
+
nextindexh,
|
43
|
+
nextindexv;
|
44
|
+
|
45
|
+
if( slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION' ) {
|
46
|
+
nextindexh = indexh;
|
47
|
+
nextindexv = indexv + 1;
|
48
|
+
} else {
|
49
|
+
nextindexh = indexh + 1;
|
50
|
+
nextindexv = 0;
|
51
|
+
}
|
52
|
+
|
53
|
+
messageData = {
|
54
|
+
notes : notes ? notes.innerHTML : '',
|
55
|
+
indexh : indexh,
|
56
|
+
indexv : indexv,
|
57
|
+
nextindexh : nextindexh,
|
58
|
+
nextindexv : nextindexv,
|
59
|
+
markdown : notes ? typeof notes.getAttribute( 'data-markdown' ) === 'string' : false
|
60
|
+
};
|
61
|
+
}
|
62
|
+
else if( eventType === 'fragmentshown' ) {
|
63
|
+
messageData = {
|
64
|
+
fragment : 'next'
|
65
|
+
};
|
66
|
+
}
|
67
|
+
else if( eventType === 'fragmenthidden' ) {
|
68
|
+
messageData = {
|
69
|
+
fragment : 'prev'
|
70
|
+
};
|
71
|
+
}
|
72
|
+
|
73
|
+
notesPopup.postMessage( JSON.stringify( messageData ), '*' );
|
74
|
+
}
|
75
|
+
|
76
|
+
// Navigate to the current slide when the notes are loaded
|
77
|
+
notesPopup.addEventListener( 'load', function( event ) {
|
78
|
+
post('slidechanged');
|
79
|
+
}, false );
|
80
|
+
}
|
81
|
+
|
82
|
+
// If the there's a 'notes' query set, open directly
|
83
|
+
if( window.location.search.match( /(\?|\&)notes/gi ) !== null ) {
|
84
|
+
openNotes();
|
85
|
+
}
|
86
|
+
|
87
|
+
// Open the notes when the 's' key is hit
|
88
|
+
document.addEventListener( 'keydown', function( event ) {
|
89
|
+
// Disregard the event if the target is editable or a
|
90
|
+
// modifier is present
|
91
|
+
if ( document.querySelector( ':focus' ) !== null || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return;
|
92
|
+
|
93
|
+
if( event.keyCode === 83 ) {
|
94
|
+
event.preventDefault();
|
95
|
+
openNotes();
|
96
|
+
}
|
97
|
+
}, false );
|
98
|
+
|
99
|
+
return { open: openNotes };
|
100
|
+
})();
|
@@ -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
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/**
|
2
|
+
* Touch-based remote controller for your presentation courtesy
|
3
|
+
* of the folks at http://remotes.io
|
4
|
+
*/
|
5
|
+
|
6
|
+
(function(window){
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Detects if we are dealing with a touch enabled device (with some false positives)
|
10
|
+
* Borrowed from modernizr: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touch.js
|
11
|
+
*/
|
12
|
+
var hasTouch = (function(){
|
13
|
+
return ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch;
|
14
|
+
})();
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Detects if notes are enable and the current page is opened inside an /iframe
|
18
|
+
* this prevents loading Remotes.io several times
|
19
|
+
*/
|
20
|
+
var remotesAndIsNotes = (function(){
|
21
|
+
return !(window.RevealNotes && self == top);
|
22
|
+
})();
|
23
|
+
|
24
|
+
if(!hasTouch && !remotesAndIsNotes){
|
25
|
+
head.ready( 'remotes.ne.min.js', function() {
|
26
|
+
new Remotes("preview")
|
27
|
+
.on("swipe-left", function(e){ Reveal.right(); })
|
28
|
+
.on("swipe-right", function(e){ Reveal.left(); })
|
29
|
+
.on("swipe-up", function(e){ Reveal.down(); })
|
30
|
+
.on("swipe-down", function(e){ Reveal.up(); })
|
31
|
+
.on("tap", function(e){ Reveal.next(); })
|
32
|
+
.on("zoom-out", function(e){ Reveal.toggleOverview(true); })
|
33
|
+
.on("zoom-in", function(e){ Reveal.toggleOverview(false); })
|
34
|
+
;
|
35
|
+
} );
|
36
|
+
|
37
|
+
head.js('https://raw.github.com/Remotes/Remotes/master/dist/remotes.ne.min.js');
|
38
|
+
}
|
39
|
+
})(window);
|