From 8bdeb360ce55fa13efcf2529ba42e38bb7d790d1 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Sat, 20 Oct 2012 21:05:14 -0400 Subject: clean up trailing whitespace (closes #197) --- plugin/notes/notes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugin/notes') diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index 58c26e0..729dad3 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -39,7 +39,7 @@ var RevealNotes = (function() { notesPopup.postMessage( JSON.stringify( slideData ), '*' ); } - // The main presentation is kept in sync when navigating the + // The main presentation is kept in sync when navigating the // note slides so that the popup may be used as a remote window.addEventListener( 'message', function( event ) { var data = JSON.parse( event.data ); @@ -60,7 +60,7 @@ var RevealNotes = (function() { // Open the notes when the 's' key is hit document.addEventListener( 'keydown', function( event ) { - // Disregard the event if the target is editable or a + // 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; -- cgit v1.2.3 From 296242f8d3d5f5513d5278e72941ef868c3cb4e5 Mon Sep 17 00:00:00 2001 From: Michael Kühnel Date: Wed, 24 Oct 2012 14:33:16 +0200 Subject: Make the fragments visible in speaker notes --- plugin/notes/notes.html | 23 ++++++++++++----- plugin/notes/notes.js | 67 ++++++++++++++++++++++++++++++++++++------------- 2 files changed, 67 insertions(+), 23 deletions(-) (limited to 'plugin/notes') diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html index 485edec..c69950b 100644 --- a/plugin/notes/notes.html +++ b/plugin/notes/notes.html @@ -109,12 +109,15 @@ window.addEventListener( 'message', function( event ) { var data = JSON.parse( event.data ); - - if( data.markdown ) { - notes.innerHTML = (new Showdown.converter()).makeHtml( data.notes ); - } - else { - notes.innerHTML = data.notes; + console.log(data); + // No need for updating the notes in case of fragement changes + if ( data.notes !== undefined) { + if( data.markdown ) { + notes.innerHTML = (new Showdown.converter()).makeHtml( data.notes ); + } + else { + notes.innerHTML = data.notes; + } } // Kill the slide listeners while responding to the event @@ -124,6 +127,14 @@ currentSlide.contentWindow.Reveal.slide( data.indexh, data.indexv ); nextSlide.contentWindow.Reveal.slide( data.nextindexh, data.nextindexv ); + // Showing and hiding fragments + if (data.fragment === 'next') { + currentSlide.contentWindow.Reveal.nextFragment(); + } + else if (data.fragment === 'prev') { + currentSlide.contentWindow.Reveal.prevFragment(); + } + // Resume listening on the next cycle setTimeout( addSlideListeners, 1 ); diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index 729dad3..45d13a4 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -7,15 +7,36 @@ var RevealNotes = (function() { function openNotes() { var notesPopup = window.open( 'plugin/notes/notes.html', 'reveal.js - Notes', 'width=1120,height=850' ); - Reveal.addEventListener( 'slidechanged', post ); + // Fires when slide is changed + Reveal.addEventListener( 'slidechanged', function( event ) { + post('slidechanged'); + } ); + + // Fires when a fragment is shown + Reveal.addEventListener( 'fragmentshown', function( event ) { + post('fragmentshown'); + } ); + + // Fires when a fragment is hidden + Reveal.addEventListener( 'fragmenthidden', function( event ) { + post('fragmenthidden'); + } ); - // Posts the current slide data to the notes window - function post() { + /** + * @description Posts the current slide data to the notes window + * + * @param {string} eventType Expecting 'slidechanged', 'fragmentshown' or 'fragmenthidden' + * set in the events above to define the needed slideDate. + */ + function post(eventType) { + console.log(eventType); var slideElement = Reveal.getCurrentSlide(), indexh = Reveal.getIndices().h, indexv = Reveal.getIndices().v, + notes = slideElement.querySelector( 'aside.notes' ), nextindexh, - nextindexv; + nextindexv, + slideData; if( slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION' ) { nextindexh = indexh; @@ -25,16 +46,26 @@ var RevealNotes = (function() { nextindexv = 0; } - var notes = slideElement.querySelector( 'aside.notes' ); - - var slideData = { - notes : notes ? notes.innerHTML : '', - indexh : indexh, - indexv : indexv, - nextindexh : nextindexh, - nextindexv : nextindexv, - markdown : notes ? typeof notes.getAttribute( 'data-markdown' ) === 'string' : false - }; + if (eventType === 'slidechanged') { + slideData = { + notes : notes ? notes.innerHTML : '', + indexh : indexh, + indexv : indexv, + nextindexh : nextindexh, + nextindexv : nextindexv, + markdown : notes ? typeof notes.getAttribute( 'data-markdown' ) === 'string' : false + }; + } + else if (eventType === 'fragmentshown') { + slideData = { + fragment : 'next' + }; + } + else if (eventType === 'fragmenthidden') { + slideData = { + fragment : 'prev' + }; + } notesPopup.postMessage( JSON.stringify( slideData ), '*' ); } @@ -50,7 +81,9 @@ var RevealNotes = (function() { } ); // Navigate to the current slide when the notes are loaded - notesPopup.addEventListener( 'load', post, false ); + notesPopup.addEventListener( 'load', function( event ) { + post('slidechanged'); + }, false ); } // If the there's a 'notes' query set, open directly @@ -70,5 +103,5 @@ var RevealNotes = (function() { } }, false ); - return { open: openNotes } -})(); \ No newline at end of file + return { open: openNotes }; +})(); -- cgit v1.2.3 From 13e7550afe26b216de6a9f97b3a55b60a2ee4cde Mon Sep 17 00:00:00 2001 From: Michael Kühnel Date: Wed, 24 Oct 2012 14:53:50 +0200 Subject: Delete console output. --- plugin/notes/notes.html | 3 +-- plugin/notes/notes.js | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'plugin/notes') diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html index c69950b..775ccb4 100644 --- a/plugin/notes/notes.html +++ b/plugin/notes/notes.html @@ -109,8 +109,7 @@ window.addEventListener( 'message', function( event ) { var data = JSON.parse( event.data ); - console.log(data); - // No need for updating the notes in case of fragement changes + // No need for updating the notes in case of fragment changes if ( data.notes !== undefined) { if( data.markdown ) { notes.innerHTML = (new Showdown.converter()).makeHtml( data.notes ); diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index 45d13a4..0573440 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -29,7 +29,6 @@ var RevealNotes = (function() { * set in the events above to define the needed slideDate. */ function post(eventType) { - console.log(eventType); var slideElement = Reveal.getCurrentSlide(), indexh = Reveal.getIndices().h, indexv = Reveal.getIndices().v, -- cgit v1.2.3 From 1801bf67eaf1fac8cb5776fe9ba83cc9e13272d6 Mon Sep 17 00:00:00 2001 From: Michael Kühnel Date: Wed, 24 Oct 2012 15:06:32 +0200 Subject: Delete functionality to control presentation from notes window Its was impossible (at least for me) to keep the windows in sync without bloating the code too much. --- plugin/notes/notes.html | 25 ------------------------- plugin/notes/notes.js | 10 ---------- 2 files changed, 35 deletions(-) (limited to 'plugin/notes') diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html index 775ccb4..90083cf 100644 --- a/plugin/notes/notes.html +++ b/plugin/notes/notes.html @@ -119,9 +119,6 @@ } } - // Kill the slide listeners while responding to the event - removeSlideListeners(); - // Update the note slides currentSlide.contentWindow.Reveal.slide( data.indexh, data.indexv ); nextSlide.contentWindow.Reveal.slide( data.nextindexh, data.nextindexv ); @@ -134,30 +131,8 @@ currentSlide.contentWindow.Reveal.prevFragment(); } - // Resume listening on the next cycle - setTimeout( addSlideListeners, 1 ); - }, false ); - function addSlideListeners() { - currentSlide.contentWindow.Reveal.addEventListener( 'slidechanged', onNotesSlideChange, false ); - nextSlide.contentWindow.Reveal.addEventListener( 'slidechanged', onNotesSlideChange, false ); - } - - function removeSlideListeners() { - currentSlide.contentWindow.Reveal.removeEventListener( 'slidechanged', onNotesSlideChange, false ); - nextSlide.contentWindow.Reveal.removeEventListener( 'slidechanged', onNotesSlideChange, false ); - } - - function onNotesSlideChange( event ) { - window.opener.postMessage( JSON.stringify({ - indexh : event.indexh, - indexv : event.indexv - }), '*' ); - } - - addSlideListeners(); - })( window ); }, false ); diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index 0573440..00d386d 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -69,16 +69,6 @@ var RevealNotes = (function() { notesPopup.postMessage( JSON.stringify( slideData ), '*' ); } - // The main presentation is kept in sync when navigating the - // note slides so that the popup may be used as a remote - window.addEventListener( 'message', function( event ) { - var data = JSON.parse( event.data ); - - if( data && typeof data.indexh === 'number' && typeof data.indexv === 'number' ) { - Reveal.slide( data.indexh, data.indexv ); - } - } ); - // Navigate to the current slide when the notes are loaded notesPopup.addEventListener( 'load', function( event ) { post('slidechanged'); -- cgit v1.2.3 From 605f7140e3406d4decd4182e13059e5666fdac8c Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Sun, 28 Oct 2012 18:48:52 -0400 Subject: updated markdown references in notes plugin --- README.md | 10 +++++----- plugin/notes-server/notes.html | 2 +- plugin/notes/notes.html | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) (limited to 'plugin/notes') diff --git a/README.md b/README.md index a7527a5..06edf1a 100644 --- a/README.md +++ b/README.md @@ -97,13 +97,13 @@ Reveal.js doesn't _rely_ on any third party scripts to work but a few optional l ```javascript Reveal.initialize({ dependencies: [ - // Syntax highlight for elements - { src: 'lib/js/highlight.js', async: true, callback: function() { window.hljs.initHighlightingOnLoad(); } }, // Cross-browser shim that fully implements classList - https://github.com/eligrey/classList.js/ - { src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } } + { src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } }, // Interpret Markdown in
elements - { src: 'lib/js/data-markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, - { src: 'lib/js/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + { src: 'plugin/markdown/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + { src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + // Syntax highlight for elements + { src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }, // Zoom in and out with Alt+click { src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } }, // Speaker notes diff --git a/plugin/notes-server/notes.html b/plugin/notes-server/notes.html index d71d7f8..053cb5e 100644 --- a/plugin/notes-server/notes.html +++ b/plugin/notes-server/notes.html @@ -99,7 +99,7 @@
- + +
- + UPCOMING:
@@ -102,45 +114,48 @@ UPCOMING: +
+
+

Time

+ 0:00:00 AM +
+
+

Elapsed

+ 00:00:00 +
+
-- cgit v1.2.3 From 784fa9d2e3570054728d21f8098199dc9d4164b9 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Sat, 26 Jan 2013 13:32:07 -0500 Subject: merge in timer in notes window, timer now stays hidden until initial time is set --- plugin/notes/notes.html | 146 ++++++++++++++++++++++++++++-------------------- 1 file changed, 84 insertions(+), 62 deletions(-) (limited to 'plugin/notes') diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html index f8e7f70..af2fbfc 100644 --- a/plugin/notes/notes.html +++ b/plugin/notes/notes.html @@ -95,10 +95,22 @@ .error code { font-family: monospace; } + .time { + width: 448px; + margin: 30px 0 0 10px; + float: left; text-align: center; + opacity: 0; + + -webkit-transition: opacity 0.4s; + -moz-transition: opacity 0.4s; + -o-transition: opacity 0.4s; + transition: opacity 0.4s; } - .elapsed, .clock { + + .elapsed, + .clock { color: #333; font-size: 2em; text-align: center; @@ -107,12 +119,15 @@ background-color: #eee; border-radius: 10px; } - .elapsed h2, .clock h2 { + + .elapsed h2, + .clock h2 { font-size: 0.8em; line-height: 100%; margin: 0; color: #aaa; } + .elapsed .mute { color: #ddd; } @@ -130,61 +145,85 @@ UPCOMING: -
-
+ +
+

Time

- 0:00:00 AM + 0:00:00 AM
-
+

Elapsed

- 00:00:00 + 00:00:00
+
-- cgit v1.2.3 From fd7d09f6972443279e7d06397b52ddd9d789f51e Mon Sep 17 00:00:00 2001 From: Damjan Georgievski Date: Wed, 6 Feb 2013 12:24:04 +0100 Subject: find correct path to open html file from the notes.js path --- plugin/notes/notes.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'plugin/notes') diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index 7c83366..72f6a10 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -5,7 +5,9 @@ var RevealNotes = (function() { function openNotes() { - var notesPopup = window.open( 'plugin/notes/notes.html', 'reveal.js - Notes', 'width=1120,height=850' ); + var jsFileLocation = document.querySelector('script[src*=notes]').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=1120,height=850' ); // Fires when slide is changed Reveal.addEventListener( 'slidechanged', function( event ) { -- cgit v1.2.3 From 380264afc8468544d82f3e50115cef249f08fff5 Mon Sep 17 00:00:00 2001 From: hakimel Date: Wed, 6 Feb 2013 19:15:30 -0500 Subject: merge in notes improvement --- plugin/notes/notes.html | 32 ++++++++++++++++---------------- plugin/notes/notes.js | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) (limited to 'plugin/notes') diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html index af2fbfc..50d172a 100644 --- a/plugin/notes/notes.html +++ b/plugin/notes/notes.html @@ -29,16 +29,16 @@ border: none; -webkit-transform-origin: 0 0; - -moz-transform-origin: 0 0; - -ms-transform-origin: 0 0; - -o-transform-origin: 0 0; - transform-origin: 0 0; + -moz-transform-origin: 0 0; + -ms-transform-origin: 0 0; + -o-transform-origin: 0 0; + transform-origin: 0 0; -webkit-transform: scale(0.5); - -moz-transform: scale(0.5); - -ms-transform: scale(0.5); - -o-transform: scale(0.5); - transform: scale(0.5); + -moz-transform: scale(0.5); + -ms-transform: scale(0.5); + -o-transform: scale(0.5); + transform: scale(0.5); } #wrap-next-slide { @@ -55,16 +55,16 @@ border: none; -webkit-transform-origin: 0 0; - -moz-transform-origin: 0 0; - -ms-transform-origin: 0 0; - -o-transform-origin: 0 0; - transform-origin: 0 0; + -moz-transform-origin: 0 0; + -ms-transform-origin: 0 0; + -o-transform-origin: 0 0; + transform-origin: 0 0; -webkit-transform: scale(0.35); - -moz-transform: scale(0.35); - -ms-transform: scale(0.35); - -o-transform: scale(0.35); - transform: scale(0.35); + -moz-transform: scale(0.35); + -ms-transform: scale(0.35); + -o-transform: scale(0.35); + transform: scale(0.35); } .slides { diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index 72f6a10..63de05a 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -5,7 +5,7 @@ var RevealNotes = (function() { function openNotes() { - var jsFileLocation = document.querySelector('script[src*=notes]').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 var notesPopup = window.open( jsFileLocation + 'notes.html', 'reveal.js - Notes', 'width=1120,height=850' ); -- cgit v1.2.3 From d7b92c9c6581dd33567a03bc2f0a3c7f4d5c305d Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Wed, 27 Feb 2013 16:55:42 -0500 Subject: update main window when current slide changes in notes (closes #343) --- plugin/notes/notes.html | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'plugin/notes') diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html index 50d172a..e14c6ac 100644 --- a/plugin/notes/notes.html +++ b/plugin/notes/notes.html @@ -225,6 +225,13 @@ }, 1000 ); + // Navigate the main window when the notes slide changes + currentSlide.contentWindow.Reveal.addEventListener( 'slidechanged', function( event ) { + + window.opener.Reveal.slide( event.indexh, event.indexv ); + + } ); + } else { -- cgit v1.2.3