2012-10-21 00:40:52 +00:00
|
|
|
|
<!doctype html>
|
|
|
|
|
<html lang="en">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
|
|
|
|
|
<title>reveal.js - Slide Notes</title>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
body {
|
|
|
|
|
font-family: Helvetica;
|
2016-09-21 11:54:42 +00:00
|
|
|
|
font-size: 18px;
|
2012-10-21 00:40:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-04-20 08:26:00 +00:00
|
|
|
|
#current-slide,
|
2014-04-22 12:14:21 +00:00
|
|
|
|
#upcoming-slide,
|
2014-04-20 08:26:00 +00:00
|
|
|
|
#speaker-controls {
|
|
|
|
|
padding: 6px;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
-moz-box-sizing: border-box;
|
2012-10-21 00:40:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-04-20 08:26:00 +00:00
|
|
|
|
#current-slide iframe,
|
2014-04-22 12:14:21 +00:00
|
|
|
|
#upcoming-slide iframe {
|
2014-04-20 08:26:00 +00:00
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
border: 1px solid #ddd;
|
2012-10-21 00:40:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-04-20 08:26:00 +00:00
|
|
|
|
#current-slide .label,
|
2014-04-22 12:14:21 +00:00
|
|
|
|
#upcoming-slide .label {
|
2014-04-20 08:26:00 +00:00
|
|
|
|
position: absolute;
|
|
|
|
|
top: 10px;
|
|
|
|
|
left: 10px;
|
|
|
|
|
z-index: 2;
|
2016-09-21 11:54:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.overlay-element {
|
|
|
|
|
height: 34px;
|
|
|
|
|
line-height: 34px;
|
|
|
|
|
padding: 0 10px;
|
|
|
|
|
text-shadow: none;
|
|
|
|
|
background: rgba( 220, 220, 220, 0.8 );
|
|
|
|
|
color: #222;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.overlay-element.interactive:hover {
|
|
|
|
|
background: rgba( 220, 220, 220, 1 );
|
2012-10-21 00:40:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-04-20 08:26:00 +00:00
|
|
|
|
#current-slide {
|
|
|
|
|
position: absolute;
|
2016-09-21 11:54:42 +00:00
|
|
|
|
width: 60%;
|
|
|
|
|
height: 100%;
|
2014-04-20 08:26:00 +00:00
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
padding-right: 0;
|
2012-10-21 00:40:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-04-22 12:14:21 +00:00
|
|
|
|
#upcoming-slide {
|
2014-04-20 08:26:00 +00:00
|
|
|
|
position: absolute;
|
2016-09-21 11:54:42 +00:00
|
|
|
|
width: 40%;
|
|
|
|
|
height: 40%;
|
2014-04-20 08:26:00 +00:00
|
|
|
|
right: 0;
|
|
|
|
|
top: 0;
|
2012-10-21 00:40:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-09-21 11:54:42 +00:00
|
|
|
|
/* Speaker controls */
|
2014-04-20 08:26:00 +00:00
|
|
|
|
#speaker-controls {
|
2012-10-21 00:40:52 +00:00
|
|
|
|
position: absolute;
|
2016-09-21 11:54:42 +00:00
|
|
|
|
top: 40%;
|
|
|
|
|
right: 0;
|
|
|
|
|
width: 40%;
|
|
|
|
|
height: 60%;
|
2014-10-16 11:09:54 +00:00
|
|
|
|
overflow: auto;
|
2014-04-20 08:26:00 +00:00
|
|
|
|
font-size: 18px;
|
2013-01-23 16:04:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-04-20 08:26:00 +00: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 06:13:03 +00: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 08:26:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.speaker-controls-time .timer,
|
|
|
|
|
.speaker-controls-time .clock {
|
|
|
|
|
width: 50%;
|
|
|
|
|
font-size: 1.9em;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.speaker-controls-time .timer {
|
|
|
|
|
float: left;
|
|
|
|
|
}
|
2013-01-26 18:32:07 +00:00
|
|
|
|
|
2014-04-20 08:26:00 +00:00
|
|
|
|
.speaker-controls-time .clock {
|
|
|
|
|
float: right;
|
|
|
|
|
text-align: right;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.speaker-controls-time span.mute {
|
2016-04-16 16:10:58 +00:00
|
|
|
|
opacity: 0.3;
|
2014-04-20 08:26:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.speaker-controls-notes {
|
|
|
|
|
padding: 10px 16px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.speaker-controls-notes .value {
|
|
|
|
|
margin-top: 5px;
|
|
|
|
|
line-height: 1.4;
|
|
|
|
|
font-size: 1.2em;
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-21 11:54:42 +00:00
|
|
|
|
/* Layout selector */
|
|
|
|
|
#speaker-layout {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 10px;
|
|
|
|
|
right: 10px;
|
|
|
|
|
color: #222;
|
|
|
|
|
z-index: 10;
|
|
|
|
|
}
|
|
|
|
|
#speaker-layout select {
|
|
|
|
|
position: absolute;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
border: 0;
|
|
|
|
|
box-shadow: 0;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
opacity: 0;
|
|
|
|
|
|
|
|
|
|
font-size: 1em;
|
|
|
|
|
background-color: transparent;
|
|
|
|
|
|
|
|
|
|
-moz-appearance: none;
|
|
|
|
|
-webkit-appearance: none;
|
|
|
|
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#speaker-layout select:focus {
|
|
|
|
|
outline: none;
|
|
|
|
|
box-shadow: none;
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-20 08:26:00 +00:00
|
|
|
|
.clear {
|
|
|
|
|
clear: both;
|
2013-01-26 16:49:19 +00:00
|
|
|
|
}
|
2013-01-26 18:32:07 +00:00
|
|
|
|
|
2016-09-21 11:54:42 +00:00
|
|
|
|
/* Speaker layout: Wide */
|
|
|
|
|
body[data-speaker-layout="wide"] #current-slide,
|
|
|
|
|
body[data-speaker-layout="wide"] #upcoming-slide {
|
|
|
|
|
width: 50%;
|
|
|
|
|
height: 45%;
|
|
|
|
|
padding: 6px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
body[data-speaker-layout="wide"] #current-slide {
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
body[data-speaker-layout="wide"] #upcoming-slide {
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 50%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
body[data-speaker-layout="wide"] #speaker-controls {
|
|
|
|
|
top: 45%;
|
|
|
|
|
left: 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 50%;
|
|
|
|
|
font-size: 1.25em;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Speaker layout: Tall */
|
|
|
|
|
body[data-speaker-layout="tall"] #current-slide,
|
|
|
|
|
body[data-speaker-layout="tall"] #upcoming-slide {
|
|
|
|
|
width: 45%;
|
|
|
|
|
height: 50%;
|
|
|
|
|
padding: 6px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
body[data-speaker-layout="tall"] #current-slide {
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
body[data-speaker-layout="tall"] #upcoming-slide {
|
|
|
|
|
top: 50%;
|
|
|
|
|
left: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
body[data-speaker-layout="tall"] #speaker-controls {
|
|
|
|
|
padding-top: 40px;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 45%;
|
|
|
|
|
width: 55%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
font-size: 1.25em;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Speaker layout: Notes only */
|
|
|
|
|
body[data-speaker-layout="notes-only"] #current-slide,
|
|
|
|
|
body[data-speaker-layout="notes-only"] #upcoming-slide {
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
body[data-speaker-layout="notes-only"] #speaker-controls {
|
|
|
|
|
padding-top: 40px;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
font-size: 1.25em;
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-20 08:26:00 +00:00
|
|
|
|
@media screen and (max-width: 1080px) {
|
2016-09-21 11:54:42 +00:00
|
|
|
|
body[data-speaker-layout="default"] #speaker-controls {
|
2014-04-20 08:26:00 +00:00
|
|
|
|
font-size: 16px;
|
|
|
|
|
}
|
2013-01-26 16:49:19 +00:00
|
|
|
|
}
|
2013-01-26 18:32:07 +00:00
|
|
|
|
|
2014-04-20 08:26:00 +00:00
|
|
|
|
@media screen and (max-width: 900px) {
|
2016-09-21 11:54:42 +00:00
|
|
|
|
body[data-speaker-layout="default"] #speaker-controls {
|
2014-04-20 08:26:00 +00:00
|
|
|
|
font-size: 14px;
|
|
|
|
|
}
|
2013-01-26 16:49:19 +00:00
|
|
|
|
}
|
2013-01-26 18:32:07 +00:00
|
|
|
|
|
2014-04-20 08:26:00 +00:00
|
|
|
|
@media screen and (max-width: 800px) {
|
2016-09-21 11:54:42 +00:00
|
|
|
|
body[data-speaker-layout="default"] #speaker-controls {
|
2014-04-20 08:26:00 +00:00
|
|
|
|
font-size: 12px;
|
|
|
|
|
}
|
2013-01-26 16:49:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-10-21 00:40:52 +00:00
|
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
2014-04-20 08:26:00 +00:00
|
|
|
|
<div id="current-slide"></div>
|
2016-09-21 11:54:42 +00:00
|
|
|
|
<div id="upcoming-slide"><span class="overlay-element label">Upcoming</span></div>
|
2014-04-20 08:26:00 +00:00
|
|
|
|
<div id="speaker-controls">
|
|
|
|
|
<div class="speaker-controls-time">
|
2014-05-04 06:13:03 +00:00
|
|
|
|
<h4 class="label">Time <span class="reset-button">Click to Reset</span></h4>
|
2014-04-20 08:26:00 +00: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 16:49:19 +00:00
|
|
|
|
</div>
|
2014-04-20 08:26:00 +00:00
|
|
|
|
|
|
|
|
|
<div class="speaker-controls-notes hidden">
|
|
|
|
|
<h4 class="label">Notes</h4>
|
|
|
|
|
<div class="value"></div>
|
2013-01-26 16:49:19 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2016-09-21 11:54:42 +00:00
|
|
|
|
<div id="speaker-layout" class="overlay-element interactive">
|
|
|
|
|
<span class="speaker-layout-label"></span>
|
|
|
|
|
<select class="speaker-layout-dropdown"></select>
|
|
|
|
|
</div>
|
2013-01-26 18:32:07 +00:00
|
|
|
|
|
2013-05-01 20:10:31 +00:00
|
|
|
|
<script src="../../plugin/markdown/marked.js"></script>
|
2012-10-21 00:40:52 +00:00
|
|
|
|
<script>
|
2013-01-26 18:32:07 +00:00
|
|
|
|
|
2014-04-19 08:54:14 +00:00
|
|
|
|
(function() {
|
|
|
|
|
|
|
|
|
|
var notes,
|
2014-04-20 08:26:00 +00:00
|
|
|
|
notesValue,
|
2014-04-19 08:54:14 +00:00
|
|
|
|
currentState,
|
|
|
|
|
currentSlide,
|
2014-04-22 12:14:21 +00:00
|
|
|
|
upcomingSlide,
|
2016-09-21 11:54:42 +00:00
|
|
|
|
layoutLabel,
|
|
|
|
|
layoutDropdown,
|
2014-04-19 08:54:14 +00:00
|
|
|
|
connected = false;
|
|
|
|
|
|
2016-09-21 11:54:42 +00:00
|
|
|
|
var SPEAKER_LAYOUTS = {
|
|
|
|
|
'default': 'Default',
|
|
|
|
|
'wide': 'Wide',
|
|
|
|
|
'tall': 'Tall',
|
|
|
|
|
'notes-only': 'Notes only'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
setupLayout();
|
|
|
|
|
|
2014-04-19 08:54:14 +00:00
|
|
|
|
window.addEventListener( 'message', function( event ) {
|
|
|
|
|
|
|
|
|
|
var data = JSON.parse( event.data );
|
|
|
|
|
|
2016-03-09 08:57:58 +00:00
|
|
|
|
// The overview mode is only useful to the reveal.js instance
|
|
|
|
|
// where navigation occurs so we don't sync it
|
|
|
|
|
if( data.state ) delete data.state.overview;
|
|
|
|
|
|
2014-04-19 08:54:14 +00:00
|
|
|
|
// 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'} ), '*' );
|
|
|
|
|
}
|
2016-03-09 08:57:58 +00:00
|
|
|
|
else if( /slidechanged|fragmentshown|fragmenthidden|paused|resumed/.test( data.eventName ) && currentState !== JSON.stringify( data.state ) ) {
|
|
|
|
|
|
2014-04-19 08:54:14 +00:00
|
|
|
|
window.opener.postMessage( JSON.stringify({ method: 'setState', args: [ data.state ]} ), '*' );
|
2016-03-09 08:57:58 +00:00
|
|
|
|
|
2014-04-19 08:54:14 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Called when the main window is trying to establish a
|
|
|
|
|
* connection.
|
|
|
|
|
*/
|
|
|
|
|
function handleConnectMessage( data ) {
|
|
|
|
|
|
|
|
|
|
if( connected === false ) {
|
|
|
|
|
connected = true;
|
|
|
|
|
|
|
|
|
|
setupIframes( data );
|
2014-04-26 09:35:55 +00:00
|
|
|
|
setupKeyboard();
|
2014-04-20 08:26:00 +00:00
|
|
|
|
setupNotes();
|
2014-04-19 08:54:14 +00:00
|
|
|
|
setupTimer();
|
|
|
|
|
}
|
2012-10-21 00:40:52 +00:00
|
|
|
|
|
2014-04-19 08:54:14 +00:00
|
|
|
|
}
|
2013-01-23 16:04:04 +00:00
|
|
|
|
|
2014-04-19 08:54:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* Called when the main window sends an updated state.
|
|
|
|
|
*/
|
|
|
|
|
function handleStateMessage( data ) {
|
2013-01-23 16:04:04 +00:00
|
|
|
|
|
2014-04-19 08:54:14 +00:00
|
|
|
|
// Store the most recently set state to avoid circular loops
|
|
|
|
|
// applying the same state
|
|
|
|
|
currentState = JSON.stringify( data.state );
|
2013-07-26 13:48:21 +00:00
|
|
|
|
|
2014-04-19 08:54:14 +00:00
|
|
|
|
// No need for updating the notes in case of fragment changes
|
2014-04-20 08:26:00 +00:00
|
|
|
|
if ( data.notes ) {
|
|
|
|
|
notes.classList.remove( 'hidden' );
|
2015-09-25 07:41:05 +00:00
|
|
|
|
notesValue.style.whiteSpace = data.whitespace;
|
2014-04-19 08:54:14 +00:00
|
|
|
|
if( data.markdown ) {
|
2014-04-20 08:26:00 +00:00
|
|
|
|
notesValue.innerHTML = marked( data.notes );
|
2014-04-19 08:54:14 +00:00
|
|
|
|
}
|
|
|
|
|
else {
|
2014-04-20 08:26:00 +00:00
|
|
|
|
notesValue.innerHTML = data.notes;
|
2013-01-26 18:32:07 +00:00
|
|
|
|
}
|
2014-04-19 08:54:14 +00:00
|
|
|
|
}
|
2014-04-20 08:26:00 +00:00
|
|
|
|
else {
|
|
|
|
|
notes.classList.add( 'hidden' );
|
|
|
|
|
}
|
2014-04-19 08:54:14 +00:00
|
|
|
|
|
|
|
|
|
// Update the note slides
|
|
|
|
|
currentSlide.contentWindow.postMessage( JSON.stringify({ method: 'setState', args: [ data.state ] }), '*' );
|
2014-04-22 12:14:21 +00:00
|
|
|
|
upcomingSlide.contentWindow.postMessage( JSON.stringify({ method: 'setState', args: [ data.state ] }), '*' );
|
|
|
|
|
upcomingSlide.contentWindow.postMessage( JSON.stringify({ method: 'next' }), '*' );
|
2013-01-26 18:32:07 +00:00
|
|
|
|
|
2014-04-19 08:54:14 +00:00
|
|
|
|
}
|
2013-07-26 14:03:59 +00:00
|
|
|
|
|
2014-04-22 12:50:50 +00:00
|
|
|
|
// Limit to max one state update per X ms
|
|
|
|
|
handleStateMessage = debounce( handleStateMessage, 200 );
|
|
|
|
|
|
2014-04-26 09:35:55 +00: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 08:54:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* Creates the preview iframes.
|
|
|
|
|
*/
|
|
|
|
|
function setupIframes( data ) {
|
2013-01-26 18:32:07 +00:00
|
|
|
|
|
2014-04-22 13:05:06 +00:00
|
|
|
|
var params = [
|
2014-04-22 12:06:58 +00:00
|
|
|
|
'receiver',
|
|
|
|
|
'progress=false',
|
2014-04-22 12:14:21 +00:00
|
|
|
|
'history=false',
|
|
|
|
|
'transition=none',
|
2014-09-28 15:13:49 +00:00
|
|
|
|
'autoSlide=0',
|
2014-04-22 12:14:21 +00:00
|
|
|
|
'backgroundTransition=none'
|
|
|
|
|
].join( '&' );
|
2014-04-22 12:06:58 +00:00
|
|
|
|
|
2016-03-09 08:37:10 +00:00
|
|
|
|
var urlSeparator = /\?/.test(data.url) ? '&' : '?';
|
2014-04-19 08:54:14 +00:00
|
|
|
|
var hash = '#/' + data.state.indexh + '/' + data.state.indexv;
|
2016-03-06 10:28:08 +00:00
|
|
|
|
var currentURL = data.url + urlSeparator + params + '&postMessageEvents=true' + hash;
|
|
|
|
|
var upcomingURL = data.url + urlSeparator + params + '&controls=false' + hash;
|
2014-04-19 08:54:14 +00:00
|
|
|
|
|
|
|
|
|
currentSlide = document.createElement( 'iframe' );
|
|
|
|
|
currentSlide.setAttribute( 'width', 1280 );
|
|
|
|
|
currentSlide.setAttribute( 'height', 1024 );
|
2014-04-22 12:14:21 +00:00
|
|
|
|
currentSlide.setAttribute( 'src', currentURL );
|
2014-04-20 08:26:00 +00:00
|
|
|
|
document.querySelector( '#current-slide' ).appendChild( currentSlide );
|
2014-04-19 08:54:14 +00:00
|
|
|
|
|
2014-04-22 12:14:21 +00: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 08:26:00 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Setup the notes UI.
|
|
|
|
|
*/
|
|
|
|
|
function setupNotes() {
|
|
|
|
|
|
|
|
|
|
notes = document.querySelector( '.speaker-controls-notes' );
|
|
|
|
|
notesValue = document.querySelector( '.speaker-controls-notes .value' );
|
2014-04-19 08:54:14 +00:00
|
|
|
|
|
|
|
|
|
}
|
2013-07-26 14:03:59 +00:00
|
|
|
|
|
2014-04-19 08:54:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* Create the timer and clock and start updating them
|
|
|
|
|
* at an interval.
|
|
|
|
|
*/
|
|
|
|
|
function setupTimer() {
|
2013-01-26 18:32:07 +00:00
|
|
|
|
|
|
|
|
|
var start = new Date(),
|
2014-04-20 08:26:00 +00: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 18:32:07 +00:00
|
|
|
|
|
2016-04-16 15:52:34 +00:00
|
|
|
|
function _displayTime( hrEl, minEl, secEl, time) {
|
|
|
|
|
var hours = Math.floor( time / ( 1000 * 60 * 60 ) );
|
|
|
|
|
var minutes = Math.floor( ( time / ( 1000 * 60 ) ) % 60 );
|
|
|
|
|
var seconds = Math.floor( ( time / 1000 ) % 60 );
|
|
|
|
|
hrEl.innerHTML = zeroPadInteger( hours );
|
|
|
|
|
hrEl.className = hours > 0 ? '' : 'mute';
|
|
|
|
|
minEl.innerHTML = ':' + zeroPadInteger( minutes );
|
|
|
|
|
minEl.className = minutes > 0 ? '' : 'mute';
|
|
|
|
|
secEl.innerHTML = ':' + zeroPadInteger( seconds );
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-20 08:26:00 +00:00
|
|
|
|
function _updateTimer() {
|
2013-01-26 18:32:07 +00:00
|
|
|
|
|
|
|
|
|
var diff, hours, minutes, seconds,
|
|
|
|
|
now = new Date();
|
|
|
|
|
|
|
|
|
|
diff = now.getTime() - start.getTime();
|
|
|
|
|
|
2014-04-20 08:26:00 +00:00
|
|
|
|
clockEl.innerHTML = now.toLocaleTimeString( 'en-US', { hour12: true, hour: '2-digit', minute:'2-digit' } );
|
2016-04-16 15:52:34 +00:00
|
|
|
|
_displayTime( hoursEl, minutesEl, secondsEl, diff );
|
2013-01-26 18:32:07 +00:00
|
|
|
|
|
2014-04-20 08:26:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update once directly
|
|
|
|
|
_updateTimer();
|
|
|
|
|
|
|
|
|
|
// Then update every second
|
|
|
|
|
setInterval( _updateTimer, 1000 );
|
2013-01-23 16:04:04 +00:00
|
|
|
|
|
2014-05-04 06:13:03 +00:00
|
|
|
|
timeEl.addEventListener( 'click', function() {
|
|
|
|
|
start = new Date();
|
|
|
|
|
_updateTimer();
|
|
|
|
|
return false;
|
|
|
|
|
} );
|
|
|
|
|
|
2013-01-23 16:04:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-09-21 11:54:42 +00:00
|
|
|
|
/**
|
|
|
|
|
* Sets up the speaker view layout and layout selector.
|
|
|
|
|
*/
|
|
|
|
|
function setupLayout() {
|
|
|
|
|
|
|
|
|
|
layoutDropdown = document.querySelector( '.speaker-layout-dropdown' );
|
|
|
|
|
layoutLabel = document.querySelector( '.speaker-layout-label' );
|
|
|
|
|
|
|
|
|
|
// Render the list of available layouts
|
|
|
|
|
for( var id in SPEAKER_LAYOUTS ) {
|
|
|
|
|
var option = document.createElement( 'option' );
|
|
|
|
|
option.setAttribute( 'value', id );
|
|
|
|
|
option.textContent = SPEAKER_LAYOUTS[ id ];
|
|
|
|
|
layoutDropdown.appendChild( option );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Monitor the dropdown for changes
|
|
|
|
|
layoutDropdown.addEventListener( 'change', function( event ) {
|
|
|
|
|
|
|
|
|
|
setLayout( layoutDropdown.value );
|
|
|
|
|
|
|
|
|
|
}, false );
|
|
|
|
|
|
|
|
|
|
// Restore any currently persisted layout
|
|
|
|
|
setLayout( getLayout() );
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets a new speaker view layout. The layout is persisted
|
|
|
|
|
* in local storage.
|
|
|
|
|
*/
|
|
|
|
|
function setLayout( value ) {
|
|
|
|
|
|
|
|
|
|
var title = SPEAKER_LAYOUTS[ value ];
|
|
|
|
|
|
|
|
|
|
layoutLabel.innerHTML = 'Layout' + ( title ? ( ': ' + title ) : '' );
|
|
|
|
|
layoutDropdown.value = value;
|
|
|
|
|
|
|
|
|
|
document.body.setAttribute( 'data-speaker-layout', value );
|
|
|
|
|
|
|
|
|
|
// Persist locally
|
|
|
|
|
if( window.localStorage ) {
|
|
|
|
|
window.localStorage.setItem( 'reveal-speaker-layout', value );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-21 12:10:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* Returns the ID of the most recently set speaker layout
|
|
|
|
|
* or our default layout if none has been set.
|
|
|
|
|
*/
|
2016-09-21 11:54:42 +00:00
|
|
|
|
function getLayout() {
|
|
|
|
|
|
|
|
|
|
if( window.localStorage ) {
|
|
|
|
|
var layout = window.localStorage.getItem( 'reveal-speaker-layout' );
|
|
|
|
|
if( layout ) {
|
|
|
|
|
return layout;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Default to the first record in the layouts hash
|
|
|
|
|
for( var id in SPEAKER_LAYOUTS ) {
|
|
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-19 08:54:14 +00:00
|
|
|
|
function zeroPadInteger( num ) {
|
2012-10-21 00:40:52 +00:00
|
|
|
|
|
2014-04-19 08:54:14 +00:00
|
|
|
|
var str = '00' + parseInt( num );
|
|
|
|
|
return str.substring( str.length - 2 );
|
2013-01-26 16:49:19 +00:00
|
|
|
|
|
2014-04-19 08:54:14 +00:00
|
|
|
|
}
|
2012-10-21 00:40:52 +00:00
|
|
|
|
|
2014-04-22 12:50:50 +00: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 08:54:14 +00:00
|
|
|
|
})();
|
2013-01-26 18:32:07 +00:00
|
|
|
|
|
2012-10-21 00:40:52 +00:00
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|