vendor/reveal.js/plugin/notes/notes.js in slide_hero-0.0.10 vs vendor/reveal.js/plugin/notes/notes.js in slide_hero-0.0.11
- old
+ new
@@ -9,15 +9,20 @@
* 3. This window proceeds to send the current presentation state
* to the notes window
*/
var RevealNotes = (function() {
- function openNotes() {
- var jsFileLocation = document.querySelector('script[src$="notes.js"]').src; // this js file path
- jsFileLocation = jsFileLocation.replace(/notes\.js(\?.*)?$/, ''); // the js folder path
- var notesPopup = window.open( jsFileLocation + 'notes.html', 'reveal.js - Notes', 'width=1100,height=700' );
+ function openNotes( notesFilePath ) {
+ if( !notesFilePath ) {
+ var jsFileLocation = document.querySelector('script[src$="notes.js"]').src; // this js file path
+ jsFileLocation = jsFileLocation.replace(/notes\.js(\?.*)?$/, ''); // the js folder path
+ notesFilePath = jsFileLocation + 'notes.html';
+ }
+
+ var notesPopup = window.open( notesFilePath, 'reveal.js - Notes', 'width=1100,height=700' );
+
/**
* Connect to the notes window through a postmessage handshake.
* Using postmessage enables us to work in situations where the
* origins differ, such as a presentation being opened from the
* file system.
@@ -26,11 +31,11 @@
// Keep trying to connect until we get a 'connected' message back
var connectInterval = setInterval( function() {
notesPopup.postMessage( JSON.stringify( {
namespace: 'reveal-notes',
type: 'connect',
- url: window.location.protocol + '//' + window.location.host + window.location.pathname,
+ url: window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search,
state: Reveal.getState()
} ), '*' );
}, 500 );
window.addEventListener( 'message', function( event ) {
@@ -53,16 +58,18 @@
var messageData = {
namespace: 'reveal-notes',
type: 'state',
notes: '',
markdown: false,
+ whitespace: 'normal',
state: Reveal.getState()
};
// Look for notes defined in a slide attribute
if( slideElement.hasAttribute( 'data-notes' ) ) {
messageData.notes = slideElement.getAttribute( 'data-notes' );
+ messageData.whitespace = 'pre-wrap';
}
// Look for notes defined in an aside element
if( notesElement ) {
messageData.notes = notesElement.innerHTML;
@@ -92,10 +99,11 @@
post();
}
connect();
+
}
if( !/receiver/i.test( window.location.search ) ) {
// If the there's a 'notes' query set, open directly
@@ -107,14 +115,20 @@
document.addEventListener( 'keydown', function( event ) {
// Disregard the event if the target is editable or a
// modifier is present
if ( document.querySelector( ':focus' ) !== null || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return;
+ // Disregard the event if keyboard is disabled
+ if ( Reveal.getConfig().keyboard === false ) return;
+
if( event.keyCode === 83 ) {
event.preventDefault();
openNotes();
}
}, false );
+
+ // Show our keyboard shortcut in the reveal.js help overlay
+ if( window.Reveal ) Reveal.registerKeyboardShortcut( 'S', 'Speaker notes view' );
}
return { open: openNotes };