notes.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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. window.addEventListener( 'message', function( event ) {
  144. var data = JSON.parse( event.data );
  145. // No need for updating the notes in case of fragment changes
  146. if ( data.notes !== undefined) {
  147. if( data.markdown ) {
  148. notes.innerHTML = marked( data.notes );
  149. }
  150. else {
  151. notes.innerHTML = data.notes;
  152. }
  153. }
  154. // Showing and hiding fragments
  155. if( data.fragment === 'next' ) {
  156. currentSlide.contentWindow.Reveal.nextFragment();
  157. }
  158. else if( data.fragment === 'prev' ) {
  159. currentSlide.contentWindow.Reveal.prevFragment();
  160. }
  161. else {
  162. // Update the note slides
  163. currentSlide.contentWindow.Reveal.slide( data.indexh, data.indexv );
  164. nextSlide.contentWindow.Reveal.slide( data.nextindexh, data.nextindexv );
  165. }
  166. }, false );
  167. var start = new Date(),
  168. timeEl = document.querySelector( '.time' ),
  169. clockEl = document.getElementById( 'clock' ),
  170. hoursEl = document.getElementById( 'hours' ),
  171. minutesEl = document.getElementById( 'minutes' ),
  172. secondsEl = document.getElementById( 'seconds' );
  173. setInterval( function() {
  174. timeEl.style.opacity = 1;
  175. var diff, hours, minutes, seconds,
  176. now = new Date();
  177. diff = now.getTime() - start.getTime();
  178. hours = parseInt( diff / ( 1000 * 60 * 60 ) );
  179. minutes = parseInt( ( diff / ( 1000 * 60 ) ) % 60 );
  180. seconds = parseInt( ( diff / 1000 ) % 60 );
  181. clockEl.innerHTML = now.toLocaleTimeString();
  182. hoursEl.innerHTML = zeroPadInteger( hours );
  183. hoursEl.className = hours > 0 ? "" : "mute";
  184. minutesEl.innerHTML = ":" + zeroPadInteger( minutes );
  185. minutesEl.className = minutes > 0 ? "" : "mute";
  186. secondsEl.innerHTML = ":" + zeroPadInteger( seconds );
  187. }, 1000 );
  188. // Navigate the main window when the notes slide changes
  189. currentSlide.contentWindow.Reveal.addEventListener( 'slidechanged', function( event ) {
  190. window.opener.Reveal.slide( event.indexh, event.indexv );
  191. } );
  192. }
  193. else {
  194. 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>';
  195. }
  196. }, false );
  197. function zeroPadInteger( num ) {
  198. var str = "00" + parseInt( num );
  199. return str.substring( str.length - 2 );
  200. }
  201. </script>
  202. </body>
  203. </html>