Browse Source

Handle previously opened notes window, by giving focus.

oyron 6 years ago
parent
commit
f32cd8586d
1 changed files with 8 additions and 1 deletions
  1. 8 1
      plugin/notes/notes.js

+ 8 - 1
plugin/notes/notes.js

@@ -11,15 +11,22 @@
  */
  */
 var RevealNotes = (function() {
 var RevealNotes = (function() {
 
 
+    var notesPopup = null;
+
 	function openNotes( notesFilePath ) {
 	function openNotes( notesFilePath ) {
 
 
+        if (notesPopup && !notesPopup.closed) {
+            notesPopup.focus();
+            return;
+        }
+
 		if( !notesFilePath ) {
 		if( !notesFilePath ) {
 			var jsFileLocation = document.querySelector('script[src$="notes.js"]').src;  // this js file path
 			var jsFileLocation = document.querySelector('script[src$="notes.js"]').src;  // this js file path
 			jsFileLocation = jsFileLocation.replace(/notes\.js(\?.*)?$/, '');   // the js folder path
 			jsFileLocation = jsFileLocation.replace(/notes\.js(\?.*)?$/, '');   // the js folder path
 			notesFilePath = jsFileLocation + 'notes.html';
 			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 ) {
 		if( !notesPopup ) {
 			alert( 'Speaker view popup failed to open. Please make sure popups are allowed and reopen the speaker view.' );
 			alert( 'Speaker view popup failed to open. Please make sure popups are allowed and reopen the speaker view.' );