1
0
Fork 0

notes code format tweaks

This commit is contained in:
Hakim El Hattab 2014-04-22 14:14:21 +02:00
parent ce05138f9a
commit c02d185cfd
1 changed files with 29 additions and 18 deletions

View File

@ -11,7 +11,7 @@
} }
#current-slide, #current-slide,
#next-slide, #upcoming-slide,
#speaker-controls { #speaker-controls {
padding: 6px; padding: 6px;
box-sizing: border-box; box-sizing: border-box;
@ -19,14 +19,14 @@
} }
#current-slide iframe, #current-slide iframe,
#next-slide iframe { #upcoming-slide iframe {
width: 100%; width: 100%;
height: 100%; height: 100%;
border: 1px solid #ddd; border: 1px solid #ddd;
} }
#current-slide .label, #current-slide .label,
#next-slide .label { #upcoming-slide .label {
position: absolute; position: absolute;
top: 10px; top: 10px;
left: 10px; left: 10px;
@ -45,7 +45,7 @@
padding-right: 0; padding-right: 0;
} }
#next-slide { #upcoming-slide {
position: absolute; position: absolute;
width: 35%; width: 35%;
height: 40%; height: 40%;
@ -141,7 +141,7 @@
<body> <body>
<div id="current-slide"></div> <div id="current-slide"></div>
<div id="next-slide"><span class="label">UPCOMING:</span></div> <div id="upcoming-slide"><span class="label">UPCOMING:</span></div>
<div id="speaker-controls"> <div id="speaker-controls">
<div class="speaker-controls-time"> <div class="speaker-controls-time">
<h4 class="label">Time</h4> <h4 class="label">Time</h4>
@ -169,7 +169,7 @@
notesValue, notesValue,
currentState, currentState,
currentSlide, currentSlide,
nextSlide, upcomingSlide,
connected = false; connected = false;
window.addEventListener( 'message', function( event ) { window.addEventListener( 'message', function( event ) {
@ -239,8 +239,8 @@
// Update the note slides // Update the note slides
currentSlide.contentWindow.postMessage( JSON.stringify({ method: 'setState', args: [ data.state ] }), '*' ); currentSlide.contentWindow.postMessage( JSON.stringify({ method: 'setState', args: [ data.state ] }), '*' );
nextSlide.contentWindow.postMessage( JSON.stringify({ method: 'setState', args: [ data.state ] }), '*' ); upcomingSlide.contentWindow.postMessage( JSON.stringify({ method: 'setState', args: [ data.state ] }), '*' );
nextSlide.contentWindow.postMessage( JSON.stringify({ method: 'next' }), '*' ); upcomingSlide.contentWindow.postMessage( JSON.stringify({ method: 'next' }), '*' );
} }
@ -249,26 +249,37 @@
*/ */
function setupIframes( data ) { function setupIframes( data ) {
var params = [ var currentParams = [
'receiver', 'receiver',
'progress=false', 'progress=false',
'history=false' 'history=false',
]; 'postMessageEvents=true'
].join( '&' );
var upcomingParams = [
'receiver',
'progress=false',
'history=false',
'controls=false',
'transition=none',
'backgroundTransition=none'
].join( '&' );
var url = data.url + '?' + params.join( '&' );
var hash = '#/' + data.state.indexh + '/' + data.state.indexv; var hash = '#/' + data.state.indexh + '/' + data.state.indexv;
var currentURL = data.url + '?' + currentParams + hash;
var upcomingURL = data.url + '?' + upcomingParams + hash;
currentSlide = document.createElement( 'iframe' ); currentSlide = document.createElement( 'iframe' );
currentSlide.setAttribute( 'width', 1280 ); currentSlide.setAttribute( 'width', 1280 );
currentSlide.setAttribute( 'height', 1024 ); currentSlide.setAttribute( 'height', 1024 );
currentSlide.setAttribute( 'src', url + '&postMessageEvents=true' + hash ); currentSlide.setAttribute( 'src', currentURL );
document.querySelector( '#current-slide' ).appendChild( currentSlide ); document.querySelector( '#current-slide' ).appendChild( currentSlide );
nextSlide = document.createElement( 'iframe' ); upcomingSlide = document.createElement( 'iframe' );
nextSlide.setAttribute( 'width', 640 ); upcomingSlide.setAttribute( 'width', 640 );
nextSlide.setAttribute( 'height', 512 ); upcomingSlide.setAttribute( 'height', 512 );
nextSlide.setAttribute( 'src', url + '&controls=false&transition=none&backgroundTransition=none' + hash ); upcomingSlide.setAttribute( 'src', upcomingURL );
document.querySelector( '#next-slide' ).appendChild( nextSlide ); document.querySelector( '#upcoming-slide' ).appendChild( upcomingSlide );
} }