notes.html 5.9 KB

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