From ba011027cea557a78a400959f9f04a8de456947e Mon Sep 17 00:00:00 2001 From: Eric Bidelman Date: Tue, 10 Apr 2012 16:41:02 -0700 Subject: Clean up up .sass file. Speaker notes and code highlighting toggles off when slide move --- js/slides.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/slides.js b/js/slides.js index 3f2366b..66aaa51 100644 --- a/js/slides.js +++ b/js/slides.js @@ -128,7 +128,10 @@ SlideDeck.prototype.onBodyKeyDown_ = function(e) { break; case 78: // N - document.body.classList.toggle('with-notes'); + // If this slide contains notes, toggle them. + if (this.slides_[this.curSlide_].querySelector('.note')) { + document.body.classList.toggle('with-notes'); + } break; case 27: // ESC @@ -276,6 +279,11 @@ SlideDeck.prototype.buildNextItem_ = function() { */ SlideDeck.prototype.prevSlide = function(opt_dontPush) { if (this.curSlide_ > 0) { + // Toggle off speaker notes and/or highlighted code if they're showing. + var bodyClassList = document.body.classList; + bodyClassList.remove('with-notes'); + bodyClassList.remove('highlight-code'); + this.prevSlide_ = this.curSlide_; this.curSlide_--; @@ -293,6 +301,11 @@ SlideDeck.prototype.nextSlide = function(opt_dontPush) { } if (this.curSlide_ < this.slides_.length - 1) { + // Toggle off speaker notes and/or highlighted code if they're showing. + var bodyClassList = document.body.classList; + bodyClassList.remove('with-notes'); + bodyClassList.remove('highlight-code'); + this.prevSlide_ = this.curSlide_; this.curSlide_++; -- cgit v1.2.3