2012-10-21 02:40:52 +02:00
|
|
|
<!doctype html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
|
|
|
<title>reveal.js - Slide Notes</title>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
font-family: Helvetica;
|
|
|
|
}
|
|
|
|
|
2014-04-20 10:26:00 +02:00
|
|
|
#current-slide,
|
2014-04-22 14:14:21 +02:00
|
|
|
#upcoming-slide,
|
2014-04-20 10:26:00 +02:00
|
|
|
#speaker-controls {
|
|
|
|
padding: 6px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
-moz-box-sizing: border-box;
|
2012-10-21 02:40:52 +02:00
|
|
|
}
|
|
|
|
|
2014-04-20 10:26:00 +02:00
|
|
|
#current-slide iframe,
|
2014-04-22 14:14:21 +02:00
|
|
|
#upcoming-slide iframe {
|
2014-04-20 10:26:00 +02:00
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
border: 1px solid #ddd;
|
2012-10-21 02:40:52 +02:00
|
|
|
}
|
|
|
|
|
2014-04-20 10:26:00 +02:00
|
|
|
#current-slide .label,
|
2014-04-22 14:14:21 +02:00
|
|
|
#upcoming-slide .label {
|
2014-04-20 10:26:00 +02:00
|
|
|
position: absolute;
|
|
|
|
top: 10px;
|
|
|
|
left: 10px;
|
|
|
|
font-weight: bold;
|
|
|
|
font-size: 14px;
|
|
|
|
z-index: 2;
|
|
|
|
color: rgba( 255, 255, 255, 0.9 );
|
2012-10-21 02:40:52 +02:00
|
|
|
}
|
|
|
|
|
2014-04-20 10:26:00 +02:00
|
|
|
#current-slide {
|
|
|
|
position: absolute;
|
|
|
|
width: 65%;
|
|
|
|
height: 100%;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
padding-right: 0;
|
2012-10-21 02:40:52 +02:00
|
|
|
}
|
|
|
|
|
2014-04-22 14:14:21 +02:00
|
|
|
#upcoming-slide {
|
2014-04-20 10:26:00 +02:00
|
|
|
position: absolute;
|
|
|
|
width: 35%;
|
|
|
|
height: 40%;
|
|
|
|
right: 0;
|
|
|
|
top: 0;
|
2012-10-21 02:40:52 +02:00
|
|
|
}
|
|
|
|
|
2014-04-20 10:26:00 +02:00
|
|
|
#speaker-controls {
|
2012-10-21 02:40:52 +02:00
|
|
|
position: absolute;
|
2014-04-20 10:26:00 +02:00
|
|
|
top: 40%;
|
|
|
|
right: 0;
|
|
|
|
width: 35%;
|
|
|
|
height: 60%;
|
2014-10-16 13:09:54 +02:00
|
|
|
overflow: auto;
|
2013-01-23 17:04:04 +01:00
|
|
|
|
2014-04-20 10:26:00 +02:00
|
|
|
font-size: 18px;
|
2013-01-23 17:04:04 +01:00
|
|
|
}
|
|
|
|
|
2014-04-20 10:26:00 +02:00
|
|
|
.speaker-controls-time.hidden,
|
|
|
|
.speaker-controls-notes.hidden {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.speaker-controls-time .label,
|
|
|
|
.speaker-controls-notes .label {
|
|
|
|
text-transform: uppercase;
|
|
|
|
font-weight: normal;
|
|
|
|
font-size: 0.66em;
|
|
|
|
color: #666;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.speaker-controls-time {
|
|
|
|
border-bottom: 1px solid rgba( 200, 200, 200, 0.5 );
|
|
|
|
margin-bottom: 10px;
|
|
|
|
padding: 10px 16px;
|
|
|
|
padding-bottom: 20px;
|
2014-05-04 08:13:03 +02:00
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
.speaker-controls-time .reset-button {
|
|
|
|
opacity: 0;
|
|
|
|
float: right;
|
|
|
|
color: #666;
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
.speaker-controls-time:hover .reset-button {
|
|
|
|
opacity: 1;
|
2014-04-20 10:26:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.speaker-controls-time .timer,
|
|
|
|
.speaker-controls-time .clock {
|
|
|
|
width: 50%;
|
|
|
|
font-size: 1.9em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.speaker-controls-time .timer {
|
|
|
|
float: left;
|
|
|
|
}
|
2013-01-26 19:32:07 +01:00
|
|
|
|
2014-04-20 10:26:00 +02:00
|
|
|
.speaker-controls-time .clock {
|
|
|
|
float: right;
|
|
|
|
text-align: right;
|
|
|
|
}
|
|
|
|
|
|
|
|
.speaker-controls-time span.mute {
|
|
|
|
color: #bbb;
|
|
|
|
}
|
|
|
|
|
|
|
|
.speaker-controls-notes {
|
|
|
|
padding: 10px 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.speaker-controls-notes .value {
|
|
|
|
margin-top: 5px;
|
|
|
|
line-height: 1.4;
|
|
|
|
font-size: 1.2em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.clear {
|
|
|
|
clear: both;
|
2013-01-26 17:49:19 +01:00
|
|
|
}
|
2013-01-26 19:32:07 +01:00
|
|
|
|
2014-04-20 10:26:00 +02:00
|
|
|
@media screen and (max-width: 1080px) {
|
|
|
|
#speaker-controls {
|
|
|
|
font-size: 16px;
|
|
|
|
}
|
2013-01-26 17:49:19 +01:00
|
|
|
}
|
2013-01-26 19:32:07 +01:00
|
|
|
|
2014-04-20 10:26:00 +02:00
|
|
|
@media screen and (max-width: 900px) {
|
|
|
|
#speaker-controls {
|
|
|
|
font-size: 14px;
|
|
|
|
}
|
2013-01-26 17:49:19 +01:00
|
|
|
}
|
2013-01-26 19:32:07 +01:00
|
|
|
|
2014-04-20 10:26:00 +02:00
|
|
|
@media screen and (max-width: 800px) {
|
|
|
|
#speaker-controls {
|
|
|
|
font-size: 12px;
|
|
|
|
}
|
2013-01-26 17:49:19 +01:00
|
|
|
}
|
|
|
|
|
2012-10-21 02:40:52 +02:00
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
2014-04-20 10:26:00 +02:00
|
|
|
<div id="current-slide"></div>
|
2014-04-22 14:14:21 +02:00
|
|
|
<div id="upcoming-slide"><span class="label">UPCOMING:</span></div>
|
2014-04-20 10:26:00 +02:00
|
|
|
<div id="speaker-controls">
|
|
|
|
<div class="speaker-controls-time">
|
2014-05-04 08:13:03 +02:00
|
|
|
<h4 class="label">Time <span class="reset-button">Click to Reset</span></h4>
|
2014-04-20 10:26:00 +02:00
|
|
|
<div class="clock">
|
|
|
|
<span class="clock-value">0:00 AM</span>
|
|
|
|
</div>
|
|
|
|
<div class="timer">
|
|
|
|
<span class="hours-value">00</span><span class="minutes-value">:00</span><span class="seconds-value">:00</span>
|
|
|
|
</div>
|
|
|
|
<div class="clear"></div>
|
2013-01-26 17:49:19 +01:00
|
|
|
</div>
|
2014-04-20 10:26:00 +02:00
|
|
|
|
|
|
|
<div class="speaker-controls-notes hidden">
|
|
|
|
<h4 class="label">Notes</h4>
|
|
|
|
<div class="value"></div>
|
2013-01-26 17:49:19 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2013-01-26 19:32:07 +01:00
|
|
|
|
2013-05-01 22:10:31 +02:00
|
|
|
<script src="../../plugin/markdown/marked.js"></script>
|
2012-10-21 02:40:52 +02:00
|
|
|
<script>
|
2013-01-26 19:32:07 +01:00
|
|
|
|
2014-04-19 10:54:14 +02:00
|
|
|
(function() {
|
|
|
|
|
|
|
|
var notes,
|
2014-04-20 10:26:00 +02:00
|
|
|
notesValue,
|
2014-04-19 10:54:14 +02:00
|
|
|
currentState,
|
|
|
|
currentSlide,
|
2014-04-22 14:14:21 +02:00
|
|
|
upcomingSlide,
|
2014-04-19 10:54:14 +02:00
|
|
|
connected = false;
|
|
|
|
|
|
|
|
window.addEventListener( 'message', function( event ) {
|
|
|
|
|
|
|
|
var data = JSON.parse( event.data );
|
|
|
|
|
|
|
|
// Messages sent by the notes plugin inside of the main window
|
|
|
|
if( data && data.namespace === 'reveal-notes' ) {
|
|
|
|
if( data.type === 'connect' ) {
|
|
|
|
handleConnectMessage( data );
|
|
|
|
}
|
|
|
|
else if( data.type === 'state' ) {
|
|
|
|
handleStateMessage( data );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Messages sent by the reveal.js inside of the current slide preview
|
|
|
|
else if( data && data.namespace === 'reveal' ) {
|
|
|
|
if( /ready/.test( data.eventName ) ) {
|
|
|
|
// Send a message back to notify that the handshake is complete
|
|
|
|
window.opener.postMessage( JSON.stringify({ namespace: 'reveal-notes', type: 'connected'} ), '*' );
|
|
|
|
}
|
|
|
|
else if( /slidechanged|fragmentshown|fragmenthidden|overviewshown|overviewhidden|paused|resumed/.test( data.eventName ) && currentState !== JSON.stringify( data.state ) ) {
|
|
|
|
window.opener.postMessage( JSON.stringify({ method: 'setState', args: [ data.state ]} ), '*' );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when the main window is trying to establish a
|
|
|
|
* connection.
|
|
|
|
*/
|
|
|
|
function handleConnectMessage( data ) {
|
|
|
|
|
|
|
|
if( connected === false ) {
|
|
|
|
connected = true;
|
|
|
|
|
|
|
|
setupIframes( data );
|
2014-04-26 11:35:55 +02:00
|
|
|
setupKeyboard();
|
2014-04-20 10:26:00 +02:00
|
|
|
setupNotes();
|
2014-04-19 10:54:14 +02:00
|
|
|
setupTimer();
|
|
|
|
}
|
2012-10-21 02:40:52 +02:00
|
|
|
|
2014-04-19 10:54:14 +02:00
|
|
|
}
|
2013-01-23 17:04:04 +01:00
|
|
|
|
2014-04-19 10:54:14 +02:00
|
|
|
/**
|
|
|
|
* Called when the main window sends an updated state.
|
|
|
|
*/
|
|
|
|
function handleStateMessage( data ) {
|
2013-01-23 17:04:04 +01:00
|
|
|
|
2014-04-19 10:54:14 +02:00
|
|
|
// Store the most recently set state to avoid circular loops
|
|
|
|
// applying the same state
|
|
|
|
currentState = JSON.stringify( data.state );
|
2013-07-26 15:48:21 +02:00
|
|
|
|
2014-04-19 10:54:14 +02:00
|
|
|
// No need for updating the notes in case of fragment changes
|
2014-04-20 10:26:00 +02:00
|
|
|
if ( data.notes ) {
|
|
|
|
notes.classList.remove( 'hidden' );
|
2015-09-25 09:41:05 +02:00
|
|
|
notesValue.style.whiteSpace = data.whitespace;
|
2014-04-19 10:54:14 +02:00
|
|
|
if( data.markdown ) {
|
2014-04-20 10:26:00 +02:00
|
|
|
notesValue.innerHTML = marked( data.notes );
|
2014-04-19 10:54:14 +02:00
|
|
|
}
|
|
|
|
else {
|
2014-04-20 10:26:00 +02:00
|
|
|
notesValue.innerHTML = data.notes;
|
2013-01-26 19:32:07 +01:00
|
|
|
}
|
2014-04-19 10:54:14 +02:00
|
|
|
}
|
2014-04-20 10:26:00 +02:00
|
|
|
else {
|
|
|
|
notes.classList.add( 'hidden' );
|
|
|
|
}
|
2014-04-19 10:54:14 +02:00
|
|
|
|
|
|
|
// Update the note slides
|
|
|
|
currentSlide.contentWindow.postMessage( JSON.stringify({ method: 'setState', args: [ data.state ] }), '*' );
|
2014-04-22 14:14:21 +02:00
|
|
|
upcomingSlide.contentWindow.postMessage( JSON.stringify({ method: 'setState', args: [ data.state ] }), '*' );
|
|
|
|
upcomingSlide.contentWindow.postMessage( JSON.stringify({ method: 'next' }), '*' );
|
2013-01-26 19:32:07 +01:00
|
|
|
|
2014-04-19 10:54:14 +02:00
|
|
|
}
|
2013-07-26 16:03:59 +02:00
|
|
|
|
2014-04-22 14:50:50 +02:00
|
|
|
// Limit to max one state update per X ms
|
|
|
|
handleStateMessage = debounce( handleStateMessage, 200 );
|
|
|
|
|
2014-04-26 11:35:55 +02:00
|
|
|
/**
|
|
|
|
* Forward keyboard events to the current slide window.
|
|
|
|
* This enables keyboard events to work even if focus
|
|
|
|
* isn't set on the current slide iframe.
|
|
|
|
*/
|
|
|
|
function setupKeyboard() {
|
|
|
|
|
|
|
|
document.addEventListener( 'keydown', function( event ) {
|
|
|
|
currentSlide.contentWindow.postMessage( JSON.stringify({ method: 'triggerKey', args: [ event.keyCode ] }), '*' );
|
|
|
|
} );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-04-19 10:54:14 +02:00
|
|
|
/**
|
|
|
|
* Creates the preview iframes.
|
|
|
|
*/
|
|
|
|
function setupIframes( data ) {
|
2013-01-26 19:32:07 +01:00
|
|
|
|
2014-04-22 15:05:06 +02:00
|
|
|
var params = [
|
2014-04-22 14:06:58 +02:00
|
|
|
'receiver',
|
|
|
|
'progress=false',
|
2014-04-22 14:14:21 +02:00
|
|
|
'history=false',
|
|
|
|
'transition=none',
|
2014-09-28 17:13:49 +02:00
|
|
|
'autoSlide=0',
|
2014-04-22 14:14:21 +02:00
|
|
|
'backgroundTransition=none'
|
|
|
|
].join( '&' );
|
2014-04-22 14:06:58 +02:00
|
|
|
|
2014-04-19 10:54:14 +02:00
|
|
|
var hash = '#/' + data.state.indexh + '/' + data.state.indexv;
|
2014-04-22 15:05:06 +02:00
|
|
|
var currentURL = data.url + '?' + params + '&postMessageEvents=true' + hash;
|
|
|
|
var upcomingURL = data.url + '?' + params + '&controls=false' + hash;
|
2014-04-19 10:54:14 +02:00
|
|
|
|
|
|
|
currentSlide = document.createElement( 'iframe' );
|
|
|
|
currentSlide.setAttribute( 'width', 1280 );
|
|
|
|
currentSlide.setAttribute( 'height', 1024 );
|
2014-04-22 14:14:21 +02:00
|
|
|
currentSlide.setAttribute( 'src', currentURL );
|
2014-04-20 10:26:00 +02:00
|
|
|
document.querySelector( '#current-slide' ).appendChild( currentSlide );
|
2014-04-19 10:54:14 +02:00
|
|
|
|
2014-04-22 14:14:21 +02:00
|
|
|
upcomingSlide = document.createElement( 'iframe' );
|
|
|
|
upcomingSlide.setAttribute( 'width', 640 );
|
|
|
|
upcomingSlide.setAttribute( 'height', 512 );
|
|
|
|
upcomingSlide.setAttribute( 'src', upcomingURL );
|
|
|
|
document.querySelector( '#upcoming-slide' ).appendChild( upcomingSlide );
|
2014-04-20 10:26:00 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Setup the notes UI.
|
|
|
|
*/
|
|
|
|
function setupNotes() {
|
|
|
|
|
|
|
|
notes = document.querySelector( '.speaker-controls-notes' );
|
|
|
|
notesValue = document.querySelector( '.speaker-controls-notes .value' );
|
2014-04-19 10:54:14 +02:00
|
|
|
|
|
|
|
}
|
2013-07-26 16:03:59 +02:00
|
|
|
|
2014-04-19 10:54:14 +02:00
|
|
|
/**
|
|
|
|
* Create the timer and clock and start updating them
|
|
|
|
* at an interval.
|
|
|
|
*/
|
|
|
|
function setupTimer() {
|
2013-01-26 19:32:07 +01:00
|
|
|
|
|
|
|
var start = new Date(),
|
2014-04-20 10:26:00 +02:00
|
|
|
timeEl = document.querySelector( '.speaker-controls-time' ),
|
|
|
|
clockEl = timeEl.querySelector( '.clock-value' ),
|
|
|
|
hoursEl = timeEl.querySelector( '.hours-value' ),
|
|
|
|
minutesEl = timeEl.querySelector( '.minutes-value' ),
|
|
|
|
secondsEl = timeEl.querySelector( '.seconds-value' );
|
2013-01-26 19:32:07 +01:00
|
|
|
|
2014-04-20 10:26:00 +02:00
|
|
|
function _updateTimer() {
|
2013-01-26 19:32:07 +01:00
|
|
|
|
|
|
|
var diff, hours, minutes, seconds,
|
|
|
|
now = new Date();
|
|
|
|
|
|
|
|
diff = now.getTime() - start.getTime();
|
2013-06-02 11:02:53 +02:00
|
|
|
hours = Math.floor( diff / ( 1000 * 60 * 60 ) );
|
|
|
|
minutes = Math.floor( ( diff / ( 1000 * 60 ) ) % 60 );
|
|
|
|
seconds = Math.floor( ( diff / 1000 ) % 60 );
|
2013-01-26 19:32:07 +01:00
|
|
|
|
2014-04-20 10:26:00 +02:00
|
|
|
clockEl.innerHTML = now.toLocaleTimeString( 'en-US', { hour12: true, hour: '2-digit', minute:'2-digit' } );
|
2013-01-26 19:32:07 +01:00
|
|
|
hoursEl.innerHTML = zeroPadInteger( hours );
|
2014-04-19 10:54:14 +02:00
|
|
|
hoursEl.className = hours > 0 ? '' : 'mute';
|
|
|
|
minutesEl.innerHTML = ':' + zeroPadInteger( minutes );
|
|
|
|
minutesEl.className = minutes > 0 ? '' : 'mute';
|
|
|
|
secondsEl.innerHTML = ':' + zeroPadInteger( seconds );
|
2013-01-26 19:32:07 +01:00
|
|
|
|
2014-04-20 10:26:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Update once directly
|
|
|
|
_updateTimer();
|
|
|
|
|
|
|
|
// Then update every second
|
|
|
|
setInterval( _updateTimer, 1000 );
|
2013-01-23 17:04:04 +01:00
|
|
|
|
2014-05-04 08:13:03 +02:00
|
|
|
timeEl.addEventListener( 'click', function() {
|
|
|
|
start = new Date();
|
|
|
|
_updateTimer();
|
|
|
|
return false;
|
|
|
|
} );
|
|
|
|
|
2013-01-23 17:04:04 +01:00
|
|
|
}
|
|
|
|
|
2014-04-19 10:54:14 +02:00
|
|
|
function zeroPadInteger( num ) {
|
2012-10-21 02:40:52 +02:00
|
|
|
|
2014-04-19 10:54:14 +02:00
|
|
|
var str = '00' + parseInt( num );
|
|
|
|
return str.substring( str.length - 2 );
|
2013-01-26 17:49:19 +01:00
|
|
|
|
2014-04-19 10:54:14 +02:00
|
|
|
}
|
2012-10-21 02:40:52 +02:00
|
|
|
|
2014-04-22 14:50:50 +02:00
|
|
|
/**
|
|
|
|
* Limits the frequency at which a function can be called.
|
|
|
|
*/
|
|
|
|
function debounce( fn, ms ) {
|
|
|
|
|
|
|
|
var lastTime = 0,
|
|
|
|
timeout;
|
|
|
|
|
|
|
|
return function() {
|
|
|
|
|
|
|
|
var args = arguments;
|
|
|
|
var context = this;
|
|
|
|
|
|
|
|
clearTimeout( timeout );
|
|
|
|
|
|
|
|
var timeSinceLastCall = Date.now() - lastTime;
|
|
|
|
if( timeSinceLastCall > ms ) {
|
|
|
|
fn.apply( context, args );
|
|
|
|
lastTime = Date.now();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
timeout = setTimeout( function() {
|
|
|
|
fn.apply( context, args );
|
|
|
|
lastTime = Date.now();
|
|
|
|
}, ms - timeSinceLastCall );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-04-19 10:54:14 +02:00
|
|
|
})();
|
2013-01-26 19:32:07 +01:00
|
|
|
|
2012-10-21 02:40:52 +02:00
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|