diff --git a/plugin/notes-server/notes.html b/plugin/notes-server/notes.html
index ad8c719..ab8c5b1 100644
--- a/plugin/notes-server/notes.html
+++ b/plugin/notes-server/notes.html
@@ -8,6 +8,7 @@
@@ -152,7 +247,7 @@
- UPCOMING:
+ Upcoming
Time Click to Reset
@@ -170,6 +265,10 @@
+
+
+
+
@@ -182,11 +281,20 @@
currentState,
currentSlide,
upcomingSlide,
+ layoutLabel,
+ layoutDropdown,
connected = false;
var socket = io.connect( window.location.origin ),
socketId = '{{socketId}}';
+ var SPEAKER_LAYOUTS = {
+ 'default': 'Default',
+ 'wide': 'Wide',
+ 'tall': 'Tall',
+ 'notes-only': 'Notes only'
+ };
+
socket.on( 'statechanged', function( data ) {
// ignore data from sockets that aren't ours
@@ -205,6 +313,8 @@
} );
+ setupLayout();
+
// Load our presentation iframes
setupIframes();
@@ -362,6 +472,74 @@
}
+ /**
+ * 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 );
+ }
+
+ }
+
+ /**
+ * Returns the ID of the most recently set speaker layout
+ * or our default layout if none has been set.
+ */
+ 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;
+ }
+
+ }
+
function zeroPadInteger( num ) {
var str = '00' + parseInt( num );
diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html
index 145490a..4fda869 100644
--- a/plugin/notes/notes.html
+++ b/plugin/notes/notes.html
@@ -544,6 +544,10 @@
}
+ /**
+ * Returns the ID of the most recently set speaker layout
+ * or our default layout if none has been set.
+ */
function getLayout() {
if( window.localStorage ) {