notes.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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. <div id="wrap-current-slide" class="slides">
  119. <script>document.write( '<iframe width="1280" height="1024" id="current-slide" src="'+ window.opener.location.href +'"></iframe>' );</script>
  120. </div>
  121. <div id="wrap-next-slide" class="slides">
  122. <script>document.write( '<iframe width="640" height="512" id="next-slide" src="'+ window.opener.location.href +'"></iframe>' );</script>
  123. <span>UPCOMING:</span>
  124. </div>
  125. <div class="time">
  126. <div class="clock">
  127. <h2>Time</h2>
  128. <span id="clock">0:00:00 AM</span>
  129. </div>
  130. <div class="elapsed">
  131. <h2>Elapsed</h2>
  132. <span id="hours">00</span><span id="minutes">:00</span><span id="seconds">:00</span>
  133. </div>
  134. </div>
  135. <div id="notes"></div>
  136. <script src="../../plugin/markdown/marked.js"></script>
  137. <script>
  138. window.addEventListener( 'load', function() {
  139. if( window.opener && window.opener.location && window.opener.location.href ) {
  140. var notes = document.getElementById( 'notes' ),
  141. currentSlide = document.getElementById( 'current-slide' ),
  142. nextSlide = document.getElementById( 'next-slide' ),
  143. silenced = false;
  144. window.addEventListener( 'message', function( event ) {
  145. var data = JSON.parse( event.data );
  146. // No need for updating the notes in case of fragment changes
  147. if ( data.notes !== undefined) {
  148. if( data.markdown ) {
  149. notes.innerHTML = marked( data.notes );
  150. }
  151. else {
  152. notes.innerHTML = data.notes;
  153. }
  154. }
  155. silenced = true;
  156. // Update the note slides
  157. currentSlide.contentWindow.Reveal.slide( data.indexh, data.indexv, data.indexf );
  158. nextSlide.contentWindow.Reveal.slide( data.nextindexh, data.nextindexv );
  159. silenced = false;
  160. }, false );
  161. var start = new Date(),
  162. timeEl = document.querySelector( '.time' ),
  163. clockEl = document.getElementById( 'clock' ),
  164. hoursEl = document.getElementById( 'hours' ),
  165. minutesEl = document.getElementById( 'minutes' ),
  166. secondsEl = document.getElementById( 'seconds' );
  167. setInterval( function() {
  168. timeEl.style.opacity = 1;
  169. var diff, hours, minutes, seconds,
  170. now = new Date();
  171. diff = now.getTime() - start.getTime();
  172. hours = Math.floor( diff / ( 1000 * 60 * 60 ) );
  173. minutes = Math.floor( ( diff / ( 1000 * 60 ) ) % 60 );
  174. seconds = Math.floor( ( diff / 1000 ) % 60 );
  175. clockEl.innerHTML = now.toLocaleTimeString();
  176. hoursEl.innerHTML = zeroPadInteger( hours );
  177. hoursEl.className = hours > 0 ? "" : "mute";
  178. minutesEl.innerHTML = ":" + zeroPadInteger( minutes );
  179. minutesEl.className = minutes > 0 ? "" : "mute";
  180. secondsEl.innerHTML = ":" + zeroPadInteger( seconds );
  181. }, 1000 );
  182. // Broadcasts the state of the notes window to synchronize
  183. // the main window
  184. function synchronizeMainWindow() {
  185. if( !silenced ) {
  186. var indices = currentSlide.contentWindow.Reveal.getIndices();
  187. window.opener.Reveal.slide( indices.h, indices.v, indices.f );
  188. }
  189. }
  190. // Navigate the main window when the notes slide changes
  191. currentSlide.contentWindow.Reveal.addEventListener( 'slidechanged', synchronizeMainWindow );
  192. currentSlide.contentWindow.Reveal.addEventListener( 'fragmentshown', synchronizeMainWindow );
  193. currentSlide.contentWindow.Reveal.addEventListener( 'fragmenthidden', synchronizeMainWindow );
  194. }
  195. else {
  196. 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>';
  197. }
  198. }, false );
  199. function zeroPadInteger( num ) {
  200. var str = "00" + parseInt( num );
  201. return str.substring( str.length - 2 );
  202. }
  203. </script>
  204. </body>
  205. </html>