summaryrefslogtreecommitdiffhomepage
path: root/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'plugin')
-rw-r--r--plugin/markdown/markdown.js5
-rw-r--r--plugin/notes/notes.html9
-rw-r--r--plugin/postmessage/example.html39
-rw-r--r--plugin/postmessage/postmessage.js42
-rw-r--r--plugin/remotes/remotes.js19
5 files changed, 110 insertions, 4 deletions
diff --git a/plugin/markdown/markdown.js b/plugin/markdown/markdown.js
index 07ffd80..b1660a1 100644
--- a/plugin/markdown/markdown.js
+++ b/plugin/markdown/markdown.js
@@ -10,6 +10,7 @@
for( var i = 0, len = sections.length; i < len; i++ ) {
var section = sections[i];
+ var notes = section.querySelector( 'aside.notes' );
var template = section.querySelector( 'script' );
@@ -27,6 +28,10 @@
}
section.innerHTML = (new Showdown.converter()).makeHtml(text);
+
+ if( notes ) {
+ section.appendChild( notes );
+ }
}
})(); \ No newline at end of file
diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html
index 8763056..64b921c 100644
--- a/plugin/notes/notes.html
+++ b/plugin/notes/notes.html
@@ -119,10 +119,6 @@
}
}
- // Update the note slides
- currentSlide.contentWindow.Reveal.slide( data.indexh, data.indexv );
- nextSlide.contentWindow.Reveal.slide( data.nextindexh, data.nextindexv );
-
// Showing and hiding fragments
if( data.fragment === 'next' ) {
currentSlide.contentWindow.Reveal.nextFragment();
@@ -130,6 +126,11 @@
else if( data.fragment === 'prev' ) {
currentSlide.contentWindow.Reveal.prevFragment();
}
+ else {
+ // Update the note slides
+ currentSlide.contentWindow.Reveal.slide( data.indexh, data.indexv );
+ nextSlide.contentWindow.Reveal.slide( data.nextindexh, data.nextindexv );
+ }
}, false );
diff --git a/plugin/postmessage/example.html b/plugin/postmessage/example.html
new file mode 100644
index 0000000..cc57a7b
--- /dev/null
+++ b/plugin/postmessage/example.html
@@ -0,0 +1,39 @@
+<html>
+ <body>
+
+ <iframe id="reveal" src="../../index.html" style="border: 0;" width="500" height="500"></iframe>
+
+ <div>
+ <input id="back" type="button" value="go back"/>
+ <input id="ahead" type="button" value="go ahead"/>
+ <input id="slideto" type="button" value="slideto 2-2"/>
+ </div>
+
+ <script>
+
+ (function (){
+
+ var back = document.getElementById( 'back' ),
+ ahead = document.getElementById( 'ahead' ),
+ slideto = document.getElementById( 'slideto' ),
+ reveal = window.frames[0];
+
+ back.addEventListener( 'click', function () {
+
+ reveal.postMessage( JSON.stringify({method: 'prev', args: []}), '*' );
+ }, false );
+
+ ahead.addEventListener( 'click', function (){
+ reveal.postMessage( JSON.stringify({method: 'next', args: []}), '*' );
+ }, false );
+
+ slideto.addEventListener( 'click', function (){
+ reveal.postMessage( JSON.stringify({method: 'slide', args: [2,2]}), '*' );
+ }, false );
+
+ }());
+
+ </script>
+
+ </body>
+</html>
diff --git a/plugin/postmessage/postmessage.js b/plugin/postmessage/postmessage.js
new file mode 100644
index 0000000..d0f4140
--- /dev/null
+++ b/plugin/postmessage/postmessage.js
@@ -0,0 +1,42 @@
+/*
+
+ simple postmessage plugin
+
+ Useful when a reveal slideshow is inside an iframe.
+ It allows to call reveal methods from outside.
+
+ Example:
+ var reveal = window.frames[0];
+
+ // Reveal.prev();
+ reveal.postMessage(JSON.stringify({method: 'prev', args: []}), '*');
+ // Reveal.next();
+ reveal.postMessage(JSON.stringify({method: 'next', args: []}), '*');
+ // Reveal.slide(2, 2);
+ reveal.postMessage(JSON.stringify({method: 'slide', args: [2,2]}), '*');
+
+ Add to the slideshow:
+
+ dependencies: [
+ ...
+ { src: 'plugin/postmessage/postmessage.js', async: true, condition: function() { return !!document.body.classList; } }
+ ]
+
+*/
+
+(function (){
+
+ window.addEventListener( "message", function ( event ) {
+ var data = JSON.parse( event.data ),
+ method = data.method,
+ args = data.args;
+
+ if( typeof Reveal[method] === 'function' ) {
+ Reveal[method].apply( Reveal, data.args );
+ }
+ }, false);
+
+}());
+
+
+
diff --git a/plugin/remotes/remotes.js b/plugin/remotes/remotes.js
new file mode 100644
index 0000000..a739bb2
--- /dev/null
+++ b/plugin/remotes/remotes.js
@@ -0,0 +1,19 @@
+/**
+ * Touch-based remote controller for your presentation courtesy
+ * of the folks at http://remotes.io
+ */
+
+head.ready( 'remotes.ne.min.js', function() {
+
+ new Remotes("preview")
+ .on("swipe-left", function(e){ Reveal.right(); })
+ .on("swipe-right", function(e){ Reveal.left(); })
+ .on("swipe-up", function(e){ Reveal.down(); })
+ .on("swipe-down", function(e){ Reveal.up(); })
+ .on("tap", function(e){
+ Reveal.toggleOverview();
+ });
+
+} );
+
+head.js( 'https://raw.github.com/Remotes/Remotes/master/dist/remotes.ne.min.js' ); \ No newline at end of file