notes.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>reveal.js - Slide Notes</title>
  6. <style>
  7. body {
  8. font-family: Helvetica;
  9. }
  10. #notes {
  11. font-size: 24px;
  12. width: 640px;
  13. margin-top: 5px;
  14. clear: left;
  15. }
  16. #wrap-current-slide {
  17. width: 640px;
  18. height: 512px;
  19. float: left;
  20. overflow: hidden;
  21. }
  22. #current-slide {
  23. width: 1280px;
  24. height: 1024px;
  25. border: none;
  26. -webkit-transform-origin: 0 0;
  27. -moz-transform-origin: 0 0;
  28. -ms-transform-origin: 0 0;
  29. -o-transform-origin: 0 0;
  30. transform-origin: 0 0;
  31. -webkit-transform: scale(0.5);
  32. -moz-transform: scale(0.5);
  33. -ms-transform: scale(0.5);
  34. -o-transform: scale(0.5);
  35. transform: scale(0.5);
  36. }
  37. #wrap-next-slide {
  38. width: 448px;
  39. height: 358px;
  40. float: left;
  41. margin: 0 0 0 10px;
  42. overflow: hidden;
  43. }
  44. #next-slide {
  45. width: 1280px;
  46. height: 1024px;
  47. border: none;
  48. -webkit-transform-origin: 0 0;
  49. -moz-transform-origin: 0 0;
  50. -ms-transform-origin: 0 0;
  51. -o-transform-origin: 0 0;
  52. transform-origin: 0 0;
  53. -webkit-transform: scale(0.35);
  54. -moz-transform: scale(0.35);
  55. -ms-transform: scale(0.35);
  56. -o-transform: scale(0.35);
  57. transform: scale(0.35);
  58. }
  59. .slides {
  60. position: relative;
  61. margin-bottom: 10px;
  62. border: 1px solid black;
  63. border-radius: 2px;
  64. background: rgb(28, 30, 32);
  65. }
  66. .slides span {
  67. position: absolute;
  68. top: 3px;
  69. left: 3px;
  70. font-weight: bold;
  71. font-size: 14px;
  72. color: rgba( 255, 255, 255, 0.9 );
  73. }
  74. .error {
  75. font-weight: bold;
  76. color: red;
  77. font-size: 1.5em;
  78. text-align: center;
  79. margin-top: 10%;
  80. }
  81. .error code {
  82. font-family: monospace;
  83. }
  84. .time {
  85. width: 448px;
  86. margin: 30px 0 0 10px;
  87. float: left;
  88. text-align: center;
  89. opacity: 0;
  90. -webkit-transition: opacity 0.4s;
  91. -moz-transition: opacity 0.4s;
  92. -o-transition: opacity 0.4s;
  93. transition: opacity 0.4s;
  94. }
  95. .elapsed,
  96. .clock {
  97. color: #333;
  98. font-size: 2em;
  99. text-align: center;
  100. display: inline-block;
  101. padding: 0.5em;
  102. background-color: #eee;
  103. border-radius: 10px;
  104. }
  105. .elapsed h2,
  106. .clock h2 {
  107. font-size: 0.8em;
  108. line-height: 100%;
  109. margin: 0;
  110. color: #aaa;
  111. }
  112. .elapsed .mute {
  113. color: #ddd;
  114. }
  115. </style>
  116. </head>
  117. <body>
  118. <script>
  119. function getNotesURL( controls ) {
  120. 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;
  121. }
  122. var notesCurrentSlideURL = getNotesURL( true );
  123. var notesNextSlideURL = getNotesURL( false );
  124. </script>
  125. <div id="wrap-current-slide" class="slides">
  126. <script>document.write( '<iframe width="1280" height="1024" id="current-slide" src="'+ notesCurrentSlideURL +'"></iframe>' );</script>
  127. </div>
  128. <div id="wrap-next-slide" class="slides">
  129. <script>document.write( '<iframe width="640" height="512" id="next-slide" src="'+ notesNextSlideURL +'"></iframe>' );</script>
  130. <span>UPCOMING:</span>
  131. </div>
  132. <div class="time">
  133. <div class="clock">
  134. <h2>Time</h2>
  135. <span id="clock">0:00:00 AM</span>
  136. </div>
  137. <div class="elapsed">
  138. <h2>Elapsed</h2>
  139. <span id="hours">00</span><span id="minutes">:00</span><span id="seconds">:00</span>
  140. </div>
  141. </div>
  142. <div id="notes"></div>
  143. <script src="../../plugin/markdown/marked.js"></script>
  144. <script>
  145. window.addEventListener( 'load', function() {
  146. if( window.opener && window.opener.location && window.opener.location.href ) {
  147. var notes = document.getElementById( 'notes' ),
  148. currentSlide = document.getElementById( 'current-slide' ),
  149. nextSlide = document.getElementById( 'next-slide' ),
  150. silenced = false;
  151. window.addEventListener( 'message', function( event ) {
  152. var data = JSON.parse( event.data );
  153. // No need for updating the notes in case of fragment changes
  154. if ( data.notes !== undefined) {
  155. if( data.markdown ) {
  156. notes.innerHTML = marked( data.notes );
  157. }
  158. else {
  159. notes.innerHTML = data.notes;
  160. }
  161. }
  162. silenced = true;
  163. // Update the note slides
  164. currentSlide.contentWindow.Reveal.slide( data.indexh, data.indexv, data.indexf );
  165. nextSlide.contentWindow.Reveal.slide( data.nextindexh, data.nextindexv );
  166. silenced = false;
  167. }, false );
  168. var start = new Date(),
  169. timeEl = document.querySelector( '.time' ),
  170. clockEl = document.getElementById( 'clock' ),
  171. hoursEl = document.getElementById( 'hours' ),
  172. minutesEl = document.getElementById( 'minutes' ),
  173. secondsEl = document.getElementById( 'seconds' );
  174. setInterval( function() {
  175. timeEl.style.opacity = 1;
  176. var diff, hours, minutes, seconds,
  177. now = new Date();
  178. diff = now.getTime() - start.getTime();
  179. hours = Math.floor( diff / ( 1000 * 60 * 60 ) );
  180. minutes = Math.floor( ( diff / ( 1000 * 60 ) ) % 60 );
  181. seconds = Math.floor( ( diff / 1000 ) % 60 );
  182. clockEl.innerHTML = now.toLocaleTimeString();
  183. hoursEl.innerHTML = zeroPadInteger( hours );
  184. hoursEl.className = hours > 0 ? "" : "mute";
  185. minutesEl.innerHTML = ":" + zeroPadInteger( minutes );
  186. minutesEl.className = minutes > 0 ? "" : "mute";
  187. secondsEl.innerHTML = ":" + zeroPadInteger( seconds );
  188. }, 1000 );
  189. // Broadcasts the state of the notes window to synchronize
  190. // the main window
  191. function synchronizeMainWindow() {
  192. if( !silenced ) {
  193. var indices = currentSlide.contentWindow.Reveal.getIndices();
  194. window.opener.Reveal.slide( indices.h, indices.v, indices.f );
  195. }
  196. }
  197. // Navigate the main window when the notes slide changes
  198. currentSlide.contentWindow.Reveal.addEventListener( 'slidechanged', synchronizeMainWindow );
  199. currentSlide.contentWindow.Reveal.addEventListener( 'fragmentshown', synchronizeMainWindow );
  200. currentSlide.contentWindow.Reveal.addEventListener( 'fragmenthidden', synchronizeMainWindow );
  201. }
  202. else {
  203. 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>';
  204. }
  205. }, false );
  206. function zeroPadInteger( num ) {
  207. var str = "00" + parseInt( num );
  208. return str.substring( str.length - 2 );
  209. }
  210. </script>
  211. </body>
  212. </html>