Skip to content

Commit

Permalink
Merge pull request hakimel#2251 from oyron/2229-speaker-notes-bug
Browse files Browse the repository at this point in the history
Give focus to previously opened speaker notes (fixes hakimel#2229)
  • Loading branch information
hakimel authored Oct 8, 2018
2 parents 30c76ea + 4e3f28d commit e9dd431
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion plugin/notes/notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,22 @@
*/
var RevealNotes = (function() {

var notesPopup = null;

function openNotes( notesFilePath ) {

if (notesPopup && !notesPopup.closed) {
notesPopup.focus();
return;
}

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' );
notesPopup = window.open( notesFilePath, 'reveal.js - Notes', 'width=1100,height=700' );

if( !notesPopup ) {
alert( 'Speaker view popup failed to open. Please make sure popups are allowed and reopen the speaker view.' );
Expand Down

0 comments on commit e9dd431

Please sign in to comment.