From 60f2eb9fb3c4443fbc43d387e866f383f0f70d67 Mon Sep 17 00:00:00 2001
From: Rebecca Murphey
Date: Thu, 7 Jun 2012 23:21:14 -0400
Subject: taking a stab at a presenter notes server

---
 js/slidenotes.js | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 js/slidenotes.js

(limited to 'js/slidenotes.js')

diff --git a/js/slidenotes.js b/js/slidenotes.js
new file mode 100644
index 0000000..9a4f152
--- /dev/null
+++ b/js/slidenotes.js
@@ -0,0 +1,32 @@
+(function() {
+  // don't emit events from inside the previews themselves
+  var qs = window.location.href.split('?');
+  if (qs.length > 1 && qs[1].match('receiver')) { return; }
+
+  var socket = io.connect('http://localhost:1947');
+  
+  Reveal.addEventListener( 'slidechanged', function( event ) {
+    var nextindexh;
+    var nextindexv;
+    var slideElement = event.currentSlide;
+
+    if (slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION') {
+      nextindexh = event.indexh;
+      nextindexv = event.indexv + 1;
+    } else {
+      nextindexh = event.indexh + 1;
+      nextindexv = 0;
+    }
+
+    var notes = slideElement.querySelector('aside.notes');
+    var slideData = {
+      notes : notes ? notes.innerHTML : '',
+      indexh : event.indexh,
+      indexv : event.indexv,
+      nextindexh : nextindexh,
+      nextindexv : nextindexv
+    };
+
+    socket.emit('slidechanged', slideData);
+  } );
+}());
\ No newline at end of file
-- 
cgit v1.2.3