Commit c9daa441 authored by Vadim Makeev's avatar Vadim Makeev

Merge pull request #102 from fhemberger/master

Add presenter notes support
parents 88dc6c49 0fe9b484
...@@ -18,7 +18,7 @@ window.shower = (function(window, document, undefined) { ...@@ -18,7 +18,7 @@ window.shower = (function(window, document, undefined) {
*/ */
shower._getData = function(element, name) { shower._getData = function(element, name) {
return element.dataset ? element.dataset[name] : element.getAttribute('data-' + name); return element.dataset ? element.dataset[name] : element.getAttribute('data-' + name);
} };
for (i = 0; i < l; i++) { for (i = 0; i < l; i++) {
// Slide ID's are optional. In case of missing ID we set it to the // Slide ID's are optional. In case of missing ID we set it to the
...@@ -132,10 +132,14 @@ window.shower = (function(window, document, undefined) { ...@@ -132,10 +132,14 @@ window.shower = (function(window, document, undefined) {
*/ */
shower.enterSlideMode = function() { shower.enterSlideMode = function() {
// check if it's already in slide mode... // check if it's already in slide mode...
if ( body.classList.contains('full') ) { return; } if (body.classList.contains('full')) { return; }
body.classList.remove('list'); body.classList.remove('list');
body.classList.add('full'); body.classList.add('full');
if (window.console && window.console.clear) { console.clear(); }
shower.showPresenterNotes(shower.getCurrentSlideNumber());
return shower._applyTransform(shower._getTransform()); return shower._applyTransform(shower._getTransform());
}; };
...@@ -145,8 +149,8 @@ window.shower = (function(window, document, undefined) { ...@@ -145,8 +149,8 @@ window.shower = (function(window, document, undefined) {
*/ */
shower.enterListMode = function() { shower.enterListMode = function() {
// check if it's already in list mode... // check if it's already in list mode...
if ( body.classList.contains('list') ) { return; } if (body.classList.contains('list')) { return; }
body.classList.remove('full'); body.classList.remove('full');
body.classList.add('list'); body.classList.add('list');
return shower._applyTransform('none'); return shower._applyTransform('none');
...@@ -306,6 +310,31 @@ window.shower = (function(window, document, undefined) { ...@@ -306,6 +310,31 @@ window.shower = (function(window, document, undefined) {
return true; return true;
}; };
/**
* Show presenter notes in console.
* @param {number} slideNumber slide number (sic!). Attention: starts from zero.
*/
shower.showPresenterNotes = function(slideNumber) {
if (window.console) {
slideNumber = shower._normalizeSlideNumber(slideNumber);
var slideId = slideList[slideNumber].id;
var nextSlideId = slideList[slideNumber + 1] ? slideList[slideNumber + 1].id : null;
var notes = document.getElementById(slideId).querySelector('.presenter-notes');
if (notes) {
console.info(notes.innerHTML.replace(/\n\s+/g,'\n'));
}
if (nextSlideId) {
var next = document.getElementById(nextSlideId).querySelector('h2');
if (next) {
next = next.innerHTML.replace(/^\s+|<[^>]+>/g,'');
console.info('NEXT: ' + next);
}
}
}
};
/** /**
* Get slide hash. * Get slide hash.
* @param {number} slideNumber slide number (sic!). Attention: starts from zero. * @param {number} slideNumber slide number (sic!). Attention: starts from zero.
...@@ -336,6 +365,7 @@ window.shower = (function(window, document, undefined) { ...@@ -336,6 +365,7 @@ window.shower = (function(window, document, undefined) {
if ( ! shower.isListMode()) { if ( ! shower.isListMode()) {
shower.updateProgress(slideNumber); shower.updateProgress(slideNumber);
shower.updateCurrentAndPassedSlides(slideNumber); shower.updateCurrentAndPassedSlides(slideNumber);
shower.showPresenterNotes(slideNumber);
} }
return slideNumber; return slideNumber;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment