reveal-ck 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. data/.gitmodules +3 -0
  2. data/.rspec +2 -0
  3. data/.rvmrc +16 -0
  4. data/.travis.yml +4 -0
  5. data/Gemfile +15 -0
  6. data/Gemfile.lock +52 -0
  7. data/LICENSE +20 -0
  8. data/README.md +103 -0
  9. data/Rakefile +16 -0
  10. data/VERSION +1 -0
  11. data/bin/reveal-ck +46 -0
  12. data/features/data/images/ruby100.png +0 -0
  13. data/features/generate.feature +63 -0
  14. data/features/help.feature +18 -0
  15. data/features/step_definitions/file_management_steps.rb +3 -0
  16. data/features/support/env.rb +15 -0
  17. data/features/support/file_management.rb +16 -0
  18. data/lib/reveal-ck.rb +4 -0
  19. data/lib/reveal-ck/file_slicer.rb +23 -0
  20. data/lib/reveal-ck/file_splicer.rb +39 -0
  21. data/lib/reveal-ck/haml_processor.rb +24 -0
  22. data/lib/reveal-ck/version.rb +4 -0
  23. data/rakelib/cucumber.rake +2 -0
  24. data/rakelib/jeweler.rake +12 -0
  25. data/rakelib/presentation.rake +40 -0
  26. data/rakelib/reveal.rake +15 -0
  27. data/rakelib/rspec.rake +5 -0
  28. data/reveal-ck.gemspec +152 -0
  29. data/reveal.js/LICENSE +19 -0
  30. data/reveal.js/README.md +374 -0
  31. data/reveal.js/css/print/paper.css +176 -0
  32. data/reveal.js/css/print/pdf.css +160 -0
  33. data/reveal.js/css/reveal.css +1312 -0
  34. data/reveal.js/css/reveal.min.css +7 -0
  35. data/reveal.js/css/shaders/tile-flip.fs +64 -0
  36. data/reveal.js/css/shaders/tile-flip.vs +141 -0
  37. data/reveal.js/css/theme/README.md +25 -0
  38. data/reveal.js/css/theme/beige.css +163 -0
  39. data/reveal.js/css/theme/default.css +163 -0
  40. data/reveal.js/css/theme/night.css +150 -0
  41. data/reveal.js/css/theme/serif.css +150 -0
  42. data/reveal.js/css/theme/simple.css +152 -0
  43. data/reveal.js/css/theme/sky.css +156 -0
  44. data/reveal.js/css/theme/source/beige.scss +50 -0
  45. data/reveal.js/css/theme/source/default.scss +42 -0
  46. data/reveal.js/css/theme/source/night.scss +35 -0
  47. data/reveal.js/css/theme/source/serif.scss +33 -0
  48. data/reveal.js/css/theme/source/simple.scss +38 -0
  49. data/reveal.js/css/theme/source/sky.scss +41 -0
  50. data/reveal.js/css/theme/template/mixins.scss +29 -0
  51. data/reveal.js/css/theme/template/settings.scss +33 -0
  52. data/reveal.js/css/theme/template/theme.scss +163 -0
  53. data/reveal.js/grunt.js +84 -0
  54. data/reveal.js/index.html +375 -0
  55. data/reveal.js/js/reveal.js +1796 -0
  56. data/reveal.js/js/reveal.min.js +8 -0
  57. data/reveal.js/lib/css/zenburn.css +115 -0
  58. data/reveal.js/lib/font/league_gothic-webfont.eot +0 -0
  59. data/reveal.js/lib/font/league_gothic-webfont.svg +230 -0
  60. data/reveal.js/lib/font/league_gothic-webfont.ttf +0 -0
  61. data/reveal.js/lib/font/league_gothic-webfont.woff +0 -0
  62. data/reveal.js/lib/font/league_gothic_license +2 -0
  63. data/reveal.js/lib/js/classList.js +2 -0
  64. data/reveal.js/lib/js/head.min.js +8 -0
  65. data/reveal.js/lib/js/html5shiv.js +7 -0
  66. data/reveal.js/package.json +31 -0
  67. data/reveal.js/plugin/highlight/highlight.js +9 -0
  68. data/reveal.js/plugin/markdown/markdown.js +37 -0
  69. data/reveal.js/plugin/markdown/showdown.js +62 -0
  70. data/reveal.js/plugin/notes-server/client.js +57 -0
  71. data/reveal.js/plugin/notes-server/index.js +58 -0
  72. data/reveal.js/plugin/notes-server/notes.html +139 -0
  73. data/reveal.js/plugin/notes/notes.html +164 -0
  74. data/reveal.js/plugin/notes/notes.js +98 -0
  75. data/reveal.js/plugin/postmessage/example.html +39 -0
  76. data/reveal.js/plugin/postmessage/postmessage.js +42 -0
  77. data/reveal.js/plugin/print-pdf/print-pdf.js +39 -0
  78. data/reveal.js/plugin/remotes/remotes.js +30 -0
  79. data/reveal.js/plugin/zoom-js/zoom.js +251 -0
  80. data/spec/data/haml/basic.haml +7 -0
  81. data/spec/data/html/converted_basic_haml.html +10 -0
  82. data/spec/data/html/reveal-js-index.html +375 -0
  83. data/spec/data/slicer/after_remove +6 -0
  84. data/spec/data/slicer/before_remove +10 -0
  85. data/spec/data/splicer/abcd +4 -0
  86. data/spec/data/splicer/after_insert +14 -0
  87. data/spec/data/splicer/before_insert +10 -0
  88. data/spec/lib/reveal-ck/file_slicer_spec.rb +42 -0
  89. data/spec/lib/reveal-ck/file_splicer_spec.rb +41 -0
  90. data/spec/lib/reveal-ck/haml_processor_spec.rb +38 -0
  91. data/spec/spec_helper.rb +27 -0
  92. metadata +271 -0
@@ -0,0 +1,62 @@
1
+ //
2
+ // showdown.js -- A javascript port of Markdown.
3
+ //
4
+ // Copyright (c) 2007 John Fraser.
5
+ //
6
+ // Original Markdown Copyright (c) 2004-2005 John Gruber
7
+ // <http://daringfireball.net/projects/markdown/>
8
+ //
9
+ // Redistributable under a BSD-style open source license.
10
+ // See license.txt for more information.
11
+ //
12
+ // The full source distribution is at:
13
+ //
14
+ // A A L
15
+ // T C A
16
+ // T K B
17
+ //
18
+ // <http://www.attacklab.net/>
19
+ //
20
+ //
21
+ // Wherever possible, Showdown is a straight, line-by-line port
22
+ // of the Perl version of Markdown.
23
+ //
24
+ // This is not a normal parser design; it's basically just a
25
+ // series of string substitutions. It's hard to read and
26
+ // maintain this way, but keeping Showdown close to the original
27
+ // design makes it easier to port new features.
28
+ //
29
+ // More importantly, Showdown behaves like markdown.pl in most
30
+ // edge cases. So web applications can do client-side preview
31
+ // in Javascript, and then build identical HTML on the server.
32
+ //
33
+ // This port needs the new RegExp functionality of ECMA 262,
34
+ // 3rd Edition (i.e. Javascript 1.5). Most modern web browsers
35
+ // should do fine. Even with the new regular expression features,
36
+ // We do a lot of work to emulate Perl's regex functionality.
37
+ // The tricky changes in this file mostly have the "attacklab:"
38
+ // label. Major or self-explanatory changes don't.
39
+ //
40
+ // Smart diff tools like Araxis Merge will be able to match up
41
+ // this file with markdown.pl in a useful way. A little tweaking
42
+ // helps: in a copy of markdown.pl, replace "#" with "//" and
43
+ // replace "$text" with "text". Be sure to ignore whitespace
44
+ // and line endings.
45
+ //
46
+ //
47
+ // Showdown usage:
48
+ //
49
+ // var text = "Markdown *rocks*.";
50
+ //
51
+ // var converter = new Showdown.converter();
52
+ // var html = converter.makeHtml(text);
53
+ //
54
+ // alert(html);
55
+ //
56
+ // Note: move the sample code to the bottom of this
57
+ // file before uncommenting it.
58
+ //
59
+ //
60
+ // Showdown namespace
61
+ //
62
+ var Showdown={};Showdown.converter=function(){var a,b,c,d=0;this.makeHtml=function(d){return a=new Array,b=new Array,c=new Array,d=d.replace(/~/g,"~T"),d=d.replace(/\$/g,"~D"),d=d.replace(/\r\n/g,"\n"),d=d.replace(/\r/g,"\n"),d="\n\n"+d+"\n\n",d=F(d),d=d.replace(/^[ \t]+$/mg,""),d=f(d),d=e(d),d=h(d),d=D(d),d=d.replace(/~D/g,"$$"),d=d.replace(/~T/g,"~"),d};var e=function(c){var c=c.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|\Z)/gm,function(c,d,e,f,g){return d=d.toLowerCase(),a[d]=z(e),f?f+g:(g&&(b[d]=g.replace(/"/g,"&quot;")),"")});return c},f=function(a){a=a.replace(/\n/g,"\n\n");var b="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del",c="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math";return a=a.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,g),a=a.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm,g),a=a.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,g),a=a.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,g),a=a.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,g),a=a.replace(/\n\n/g,"\n"),a},g=function(a,b){var d=b;return d=d.replace(/\n\n/g,"\n"),d=d.replace(/^\n/,""),d=d.replace(/\n+$/g,""),d="\n\n~K"+(c.push(d)-1)+"K\n\n",d},h=function(a){a=o(a);var b=t("<hr />");return a=a.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,b),a=a.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,b),a=a.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,b),a=q(a),a=s(a),a=r(a),a=x(a),a=f(a),a=y(a),a},i=function(a){return a=u(a),a=j(a),a=A(a),a=m(a),a=k(a),a=B(a),a=z(a),a=w(a),a=a.replace(/ +\n/g," <br />\n"),a},j=function(a){var b=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi;return a=a.replace(b,function(a){var b=a.replace(/(.)<\/?code>(?=.)/g,"$1`");return b=G(b,"\\`*_"),b}),a},k=function(a){return a=a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,l),a=a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,l),a=a.replace(/(\[([^\[\]]+)\])()()()()()/g,l),a},l=function(c,d,e,f,g,h,i,j){j==undefined&&(j="");var k=d,l=e,m=f.toLowerCase(),n=g,o=j;if(n==""){m==""&&(m=l.toLowerCase().replace(/ ?\n/g," ")),n="#"+m;if(a[m]!=undefined)n=a[m],b[m]!=undefined&&(o=b[m]);else{if(!(k.search(/\(\s*\)$/m)>-1))return k;n=""}}n=G(n,"*_");var p='<a href="'+n+'"';return o!=""&&(o=o.replace(/"/g,"&quot;"),o=G(o,"*_"),p+=' title="'+o+'"'),p+=">"+l+"</a>",p},m=function(a){return a=a.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,n),a=a.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,n),a},n=function(c,d,e,f,g,h,i,j){var k=d,l=e,m=f.toLowerCase(),n=g,o=j;o||(o="");if(n==""){m==""&&(m=l.toLowerCase().replace(/ ?\n/g," ")),n="#"+m;if(a[m]==undefined)return k;n=a[m],b[m]!=undefined&&(o=b[m])}l=l.replace(/"/g,"&quot;"),n=G(n,"*_");var p='<img src="'+n+'" alt="'+l+'"';return o=o.replace(/"/g,"&quot;"),o=G(o,"*_"),p+=' title="'+o+'"',p+=" />",p},o=function(a){function b(a){return a.replace(/[^\w]/g,"").toLowerCase()}return a=a.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(a,c){return t('<h1 id="'+b(c)+'">'+i(c)+"</h1>")}),a=a.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(a,c){return t('<h2 id="'+b(c)+'">'+i(c)+"</h2>")}),a=a.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(a,c,d){var e=c.length;return t("<h"+e+' id="'+b(d)+'">'+i(d)+"</h"+e+">")}),a},p,q=function(a){a+="~0";var b=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;return d?a=a.replace(b,function(a,b,c){var d=b,e=c.search(/[*+-]/g)>-1?"ul":"ol";d=d.replace(/\n{2,}/g,"\n\n\n");var f=p(d);return f=f.replace(/\s+$/,""),f="<"+e+">"+f+"</"+e+">\n",f}):(b=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g,a=a.replace(b,function(a,b,c,d){var e=b,f=c,g=d.search(/[*+-]/g)>-1?"ul":"ol",f=f.replace(/\n{2,}/g,"\n\n\n"),h=p(f);return h=e+"<"+g+">\n"+h+"</"+g+">\n",h})),a=a.replace(/~0/,""),a};p=function(a){return d++,a=a.replace(/\n{2,}$/,"\n"),a+="~0",a=a.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(a,b,c,d,e){var f=e,g=b,j=c;return g||f.search(/\n{2,}/)>-1?f=h(E(f)):(f=q(E(f)),f=f.replace(/\n$/,""),f=i(f)),"<li>"+f+"</li>\n"}),a=a.replace(/~0/g,""),d--,a};var r=function(a){return a+="~0",a=a.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(a,b,c){var d=b,e=c;return d=v(E(d)),d=F(d),d=d.replace(/^\n+/g,""),d=d.replace(/\n+$/g,""),d="<pre><code>"+d+"\n</code></pre>",t(d)+e}),a=a.replace(/~0/,""),a},s=function(a){return a+="~0",a=a.replace(/\n```(.*)\n([^`]+)\n```/g,function(a,b,c){var d=b,e=c;return e=v(e),e=F(e),e=e.replace(/^\n+/g,""),e=e.replace(/\n+$/g,""),e="<pre><code class="+d+">"+e+"\n</code></pre>",t(e)}),a=a.replace(/~0/,""),a},t=function(a){return a=a.replace(/(^\n+|\n+$)/g,""),"\n\n~K"+(c.push(a)-1)+"K\n\n"},u=function(a){return a=a.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(a,b,c,d,e){var f=d;return f=f.replace(/^([ \t]*)/g,""),f=f.replace(/[ \t]*$/g,""),f=v(f),b+"<code>"+f+"</code>"}),a},v=function(a){return a=a.replace(/&/g,"&amp;"),a=a.replace(/</g,"&lt;"),a=a.replace(/>/g,"&gt;"),a=G(a,"*_{}[]\\",!1),a},w=function(a){return a=a.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"<strong>$2</strong>"),a=a.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"<em>$2</em>"),a},x=function(a){return a=a.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(a,b){var c=b;return c=c.replace(/^[ \t]*>[ \t]?/gm,"~0"),c=c.replace(/~0/g,""),c=c.replace(/^[ \t]+$/gm,""),c=h(c),c=c.replace(/(^|\n)/g,"$1 "),c=c.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(a,b){var c=b;return c=c.replace(/^ /mg,"~0"),c=c.replace(/~0/g,""),c}),t("<blockquote>\n"+c+"\n</blockquote>")}),a},y=function(a){a=a.replace(/^\n+/g,""),a=a.replace(/\n+$/g,"");var b=a.split(/\n{2,}/g),d=new Array,e=b.length;for(var f=0;f<e;f++){var g=b[f];g.search(/~K(\d+)K/g)>=0?d.push(g):g.search(/\S/)>=0&&(g=i(g),g=g.replace(/^([ \t]*)/g,"<p>"),g+="</p>",d.push(g))}e=d.length;for(var f=0;f<e;f++)while(d[f].search(/~K(\d+)K/)>=0){var h=c[RegExp.$1];h=h.replace(/\$/g,"$$$$"),d[f]=d[f].replace(/~K\d+K/,h)}return d.join("\n\n")},z=function(a){return a=a.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&amp;"),a=a.replace(/<(?![a-z\/?\$!])/gi,"&lt;"),a},A=function(a){return a=a.replace(/\\(\\)/g,H),a=a.replace(/\\([`*_{}\[\]()>#+-.!])/g,H),a},B=function(a){return a=a.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'<a href="$1">$1</a>'),a=a.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(a,b){return C(D(b))}),a},C=function(a){function b(a){var b="0123456789ABCDEF",c=a.charCodeAt(0);return b.charAt(c>>4)+b.charAt(c&15)}var c=[function(a){return"&#"+a.charCodeAt(0)+";"},function(a){return"&#x"+b(a)+";"},function(a){return a}];return a="mailto:"+a,a=a.replace(/./g,function(a){if(a=="@")a=c[Math.floor(Math.random()*2)](a);else if(a!=":"){var b=Math.random();a=b>.9?c[2](a):b>.45?c[1](a):c[0](a)}return a}),a='<a href="'+a+'">'+a+"</a>",a=a.replace(/">.+:/g,'">'),a},D=function(a){return a=a.replace(/~E(\d+)E/g,function(a,b){var c=parseInt(b);return String.fromCharCode(c)}),a},E=function(a){return a=a.replace(/^(\t|[ ]{1,4})/gm,"~0"),a=a.replace(/~0/g,""),a},F=function(a){return a=a.replace(/\t(?=\t)/g," "),a=a.replace(/\t/g,"~A~B"),a=a.replace(/~B(.+?)~A/g,function(a,b,c){var d=b,e=4-d.length%4;for(var f=0;f<e;f++)d+=" ";return d}),a=a.replace(/~A/g," "),a=a.replace(/~B/g,""),a},G=function(a,b,c){var d="(["+b.replace(/([\[\]\\])/g,"\\$1")+"])";c&&(d="\\\\"+d);var e=new RegExp(d,"g");return a=a.replace(e,H),a},H=function(a,b){var c=b.charCodeAt(0);return"~E"+c+"E"}},typeof exports!="undefined"&&(exports=Showdown);
@@ -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,58 @@
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
+ fs.createReadStream(opts.baseDir + '/index.html').pipe(res);
34
+ });
35
+
36
+ app.get("/notes/:socketId", function(req, res) {
37
+
38
+ fs.readFile(opts.baseDir + 'plugin/notes-server/notes.html', function(err, data) {
39
+ res.send(Mustache.to_html(data.toString(), {
40
+ socketId : req.params.socketId
41
+ }));
42
+ });
43
+ // fs.createReadStream(opts.baseDir + 'notes-server/notes.html').pipe(res);
44
+ });
45
+
46
+ // Actually listen
47
+ app.listen(opts.port || null);
48
+
49
+ var brown = '\033[33m',
50
+ green = '\033[32m',
51
+ reset = '\033[0m';
52
+
53
+ var slidesLocation = "http://localhost" + ( opts.port ? ( ':' + opts.port ) : '' );
54
+
55
+ console.log( brown + "reveal.js - Speaker Notes" + reset );
56
+ console.log( "1. Open the slides at " + green + slidesLocation + reset );
57
+ console.log( "2. Click on the link your JS console to go to the notes page" );
58
+ console.log( "3. Advance through your slides and your notes will advance automatically" );
@@ -0,0 +1,139 @@
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
+ }
18
+
19
+ #wrap-current-slide {
20
+ width: 640px;
21
+ height: 512px;
22
+ float: left;
23
+ overflow: hidden;
24
+ }
25
+
26
+ #current-slide {
27
+ width: 1280px;
28
+ height: 1024px;
29
+ border: none;
30
+
31
+ -webkit-transform-origin: 0 0;
32
+ -moz-transform-origin: 0 0;
33
+ -ms-transform-origin: 0 0;
34
+ -o-transform-origin: 0 0;
35
+ transform-origin: 0 0;
36
+
37
+ -webkit-transform: scale(0.5);
38
+ -moz-transform: scale(0.5);
39
+ -ms-transform: scale(0.5);
40
+ -o-transform: scale(0.5);
41
+ transform: scale(0.5);
42
+ }
43
+
44
+ #wrap-next-slide {
45
+ width: 448px;
46
+ height: 358px;
47
+ float: left;
48
+ margin: 0 0 0 10px;
49
+ overflow: hidden;
50
+ }
51
+
52
+ #next-slide {
53
+ width: 1280px;
54
+ height: 1024px;
55
+ border: none;
56
+
57
+ -webkit-transform-origin: 0 0;
58
+ -moz-transform-origin: 0 0;
59
+ -ms-transform-origin: 0 0;
60
+ -o-transform-origin: 0 0;
61
+ transform-origin: 0 0;
62
+
63
+ -webkit-transform: scale(0.35);
64
+ -moz-transform: scale(0.35);
65
+ -ms-transform: scale(0.35);
66
+ -o-transform: scale(0.35);
67
+ transform: scale(0.35);
68
+ }
69
+
70
+ .slides {
71
+ position: relative;
72
+ margin-bottom: 10px;
73
+ border: 1px solid black;
74
+ border-radius: 2px;
75
+ background: rgb(28, 30, 32);
76
+ }
77
+
78
+ .slides span {
79
+ position: absolute;
80
+ top: 3px;
81
+ left: 3px;
82
+ font-weight: bold;
83
+ font-size: 14px;
84
+ color: rgba( 255, 255, 255, 0.9 );
85
+ }
86
+ </style>
87
+ </head>
88
+
89
+ <body>
90
+
91
+ <div id="wrap-current-slide" class="slides">
92
+ <iframe src="/?receiver" width="1280" height="1024" id="current-slide"></iframe>
93
+ </div>
94
+
95
+ <div id="wrap-next-slide" class="slides">
96
+ <iframe src="/?receiver" width="640" height="512" id="next-slide"></iframe>
97
+ <span>UPCOMING:</span>
98
+ </div>
99
+ <div id="notes"></div>
100
+
101
+ <script src="/socket.io/socket.io.js"></script>
102
+ <script src="/plugin/markdown/showdown.js"></script>
103
+
104
+ <script>
105
+ var socketId = '{{socketId}}';
106
+ var socket = io.connect(window.location.origin);
107
+ var notes = document.getElementById('notes');
108
+ var currentSlide = document.getElementById('current-slide');
109
+ var nextSlide = document.getElementById('next-slide');
110
+
111
+ socket.on('slidedata', function(data) {
112
+ // ignore data from sockets that aren't ours
113
+ if (data.socketId !== socketId) { return; }
114
+
115
+ if (data.markdown) {
116
+ notes.innerHTML = (new Showdown.converter()).makeHtml(data.notes);
117
+ }
118
+ else {
119
+ notes.innerHTML = data.notes;
120
+ }
121
+
122
+ currentSlide.contentWindow.Reveal.slide(data.indexh, data.indexv);
123
+ nextSlide.contentWindow.Reveal.slide(data.nextindexh, data.nextindexv);
124
+ });
125
+ socket.on('fragmentdata', function(data) {
126
+ // ignore data from sockets that aren't ours
127
+ if (data.socketId !== socketId) { return; }
128
+
129
+ if (data.fragment === 'next') {
130
+ currentSlide.contentWindow.Reveal.nextFragment();
131
+ }
132
+ else if (data.fragment === 'previous') {
133
+ currentSlide.contentWindow.Reveal.prevFragment();
134
+ }
135
+ });
136
+ </script>
137
+
138
+ </body>
139
+ </html>
@@ -0,0 +1,164 @@
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
+ }
18
+
19
+ #wrap-current-slide {
20
+ width: 640px;
21
+ height: 512px;
22
+ float: left;
23
+ overflow: hidden;
24
+ }
25
+
26
+ #current-slide {
27
+ width: 1280px;
28
+ height: 1024px;
29
+ border: none;
30
+
31
+ -webkit-transform-origin: 0 0;
32
+ -moz-transform-origin: 0 0;
33
+ -ms-transform-origin: 0 0;
34
+ -o-transform-origin: 0 0;
35
+ transform-origin: 0 0;
36
+
37
+ -webkit-transform: scale(0.5);
38
+ -moz-transform: scale(0.5);
39
+ -ms-transform: scale(0.5);
40
+ -o-transform: scale(0.5);
41
+ transform: scale(0.5);
42
+ }
43
+
44
+ #wrap-next-slide {
45
+ width: 448px;
46
+ height: 358px;
47
+ float: left;
48
+ margin: 0 0 0 10px;
49
+ overflow: hidden;
50
+ }
51
+
52
+ #next-slide {
53
+ width: 1280px;
54
+ height: 1024px;
55
+ border: none;
56
+
57
+ -webkit-transform-origin: 0 0;
58
+ -moz-transform-origin: 0 0;
59
+ -ms-transform-origin: 0 0;
60
+ -o-transform-origin: 0 0;
61
+ transform-origin: 0 0;
62
+
63
+ -webkit-transform: scale(0.35);
64
+ -moz-transform: scale(0.35);
65
+ -ms-transform: scale(0.35);
66
+ -o-transform: scale(0.35);
67
+ transform: scale(0.35);
68
+ }
69
+
70
+ .slides {
71
+ position: relative;
72
+ margin-bottom: 10px;
73
+ border: 1px solid black;
74
+ border-radius: 2px;
75
+ background: rgb(28, 30, 32);
76
+ }
77
+
78
+ .slides span {
79
+ position: absolute;
80
+ top: 3px;
81
+ left: 3px;
82
+ font-weight: bold;
83
+ font-size: 14px;
84
+ color: rgba( 255, 255, 255, 0.9 );
85
+ }
86
+
87
+ .error {
88
+ font-weight: bold;
89
+ color: red;
90
+ font-size: 1.5em;
91
+ text-align: center;
92
+ margin-top: 10%;
93
+ }
94
+
95
+ .error code {
96
+ font-family: monospace;
97
+ }
98
+ </style>
99
+ </head>
100
+
101
+ <body>
102
+
103
+ <div id="wrap-current-slide" class="slides">
104
+ <script>document.write( '<iframe width="1280" height="1024" id="current-slide" src="'+ window.opener.location.href +'"></iframe>' );</script>
105
+ </div>
106
+
107
+ <div id="wrap-next-slide" class="slides">
108
+ <script>document.write( '<iframe width="640" height="512" id="next-slide" src="'+ window.opener.location.href +'"></iframe>' );</script>
109
+ <span>UPCOMING:</span>
110
+ </div>
111
+ <div id="notes"></div>
112
+
113
+ <script src="../../plugin/markdown/showdown.js"></script>
114
+ <script>
115
+ window.addEventListener( 'load', function() {
116
+
117
+ if( window.opener && window.opener.location && window.opener.location.href ) {
118
+
119
+ (function( window, undefined ) {
120
+ var notes = document.getElementById( 'notes' ),
121
+ currentSlide = document.getElementById( 'current-slide' ),
122
+ nextSlide = document.getElementById( 'next-slide' );
123
+
124
+ window.addEventListener( 'message', function( event ) {
125
+ var data = JSON.parse( event.data );
126
+ // No need for updating the notes in case of fragment changes
127
+ if ( data.notes !== undefined) {
128
+ if( data.markdown ) {
129
+ notes.innerHTML = (new Showdown.converter()).makeHtml( data.notes );
130
+ }
131
+ else {
132
+ notes.innerHTML = data.notes;
133
+ }
134
+ }
135
+
136
+ // Showing and hiding fragments
137
+ if( data.fragment === 'next' ) {
138
+ currentSlide.contentWindow.Reveal.nextFragment();
139
+ }
140
+ else if( data.fragment === 'prev' ) {
141
+ currentSlide.contentWindow.Reveal.prevFragment();
142
+ }
143
+ else {
144
+ // Update the note slides
145
+ currentSlide.contentWindow.Reveal.slide( data.indexh, data.indexv );
146
+ nextSlide.contentWindow.Reveal.slide( data.nextindexh, data.nextindexv );
147
+ }
148
+
149
+ }, false );
150
+
151
+ })( window );
152
+
153
+ }
154
+ else {
155
+
156
+ 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>';
157
+
158
+ }
159
+
160
+ }, false );
161
+
162
+ </script>
163
+ </body>
164
+ </html>