aboutsummaryrefslogtreecommitdiff
path: root/js/slide-deck.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/slide-deck.js')
-rw-r--r--js/slide-deck.js32
1 files changed, 21 insertions, 11 deletions
diff --git a/js/slide-deck.js b/js/slide-deck.js
index 67aa4f2..61fe1c0 100644
--- a/js/slide-deck.js
+++ b/js/slide-deck.js
@@ -65,7 +65,7 @@ SlideDeck.prototype.loadSlide = function(slideNo) {
65 */ 65 */
66SlideDeck.prototype.onDomLoaded_ = function(e) { 66SlideDeck.prototype.onDomLoaded_ = function(e) {
67 document.body.classList.add('loaded'); // Add loaded class for templates to 67 document.body.classList.add('loaded'); // Add loaded class for templates to
68 // use. 68 // use.
69 69
70 this.slides = this.container 70 this.slides = this.container
71 .querySelectorAll('slide:not([hidden]):not(.hidden):not(.backdrop)'); 71 .querySelectorAll('slide:not([hidden]):not(.hidden):not(.backdrop)');
@@ -111,7 +111,7 @@ SlideDeck.prototype.onDomLoaded_ = function(e) {
111 // // Also, no need to set this up if we're on mobile. 111 // // Also, no need to set this up if we're on mobile.
112 // if (!Modernizr.touch) { 112 // if (!Modernizr.touch) {
113 this.controller = new SlideController(this); 113 this.controller = new SlideController(this);
114 if (this.controller.isPopup) { 114 if (this.controller.isPresenter) {
115 document.body.classList.add('popup'); 115 document.body.classList.add('popup');
116 } 116 }
117 // } 117 // }
@@ -177,7 +177,7 @@ SlideDeck.prototype.onBodyKeyDown_ = function(e) {
177 } 177 }
178 178
179 // Forward keydowns to the main slides if we're the popup. 179 // Forward keydowns to the main slides if we're the popup.
180 if (this.controller && this.controller.isPopup) { 180 if (this.controller && this.controller.isPresenter) {
181 this.controller.sendMsg({ 181 this.controller.sendMsg({
182 keyCode : e.keyCode 182 keyCode : e.keyCode
183 }); 183 });
@@ -223,7 +223,7 @@ SlideDeck.prototype.onBodyKeyDown_ = function(e) {
223 break; 223 break;
224 224
225 case 80: // P 225 case 80: // P
226 if (this.controller && this.controller.isPopup) { 226 if (this.controller && this.controller.isPresenter) {
227 document.body.classList.toggle('with-notes'); 227 document.body.classList.toggle('with-notes');
228 } else if (this.controller && !this.controller.popup) { 228 } else if (this.controller && !this.controller.popup) {
229 document.body.classList.toggle('with-notes'); 229 document.body.classList.toggle('with-notes');
@@ -275,7 +275,7 @@ SlideDeck.prototype.onBodyKeyDown_ = function(e) {
275}; 275};
276 276
277/** 277/**
278 * 278 *
279 */ 279 */
280SlideDeck.prototype.focusOverview_ = function() { 280SlideDeck.prototype.focusOverview_ = function() {
281 var overview = document.body.classList.contains('overview'); 281 var overview = document.body.classList.contains('overview');
@@ -425,11 +425,21 @@ SlideDeck.prototype.loadConfig_ = function(config) {
425 425
426 var hammer = new Hammer(this.container); 426 var hammer = new Hammer(this.container);
427 hammer.ondragend = function(e) { 427 hammer.ondragend = function(e) {
428 if (e.direction == 'right' || e.direction == 'down') { 428 var evt = document.createEvent('Event');
429 self.prevSlide(); 429 evt.initEvent('keydown', true, true);
430 } else if (e.direction == 'left' || e.direction == 'up') { 430
431 self.nextSlide(); 431 switch (e.direction) {
432 case 'right':
433 // previous slide
434 evt.keyCode = 37;
435 break;
436 case 'left':
437 // next slide
438 evt.keyCode = 39;
439 break;
432 } 440 }
441
442 document.dispatchEvent(evt);
433 }; 443 };
434 } 444 }
435}; 445};
@@ -488,7 +498,7 @@ SlideDeck.prototype.prevSlide = function(opt_dontPush) {
488 // Toggle off speaker notes if they're showing when we move backwards on 498 // Toggle off speaker notes if they're showing when we move backwards on
489 // the 499 // the
490 // main slides. If we're the speaker notes popup, leave them up. 500 // main slides. If we're the speaker notes popup, leave them up.
491 if (this.controller && !this.controller.isPopup) { 501 if (this.controller && !this.controller.isPresenter) {
492 bodyClassList.remove('with-notes'); 502 bodyClassList.remove('with-notes');
493 } else if (!this.controller) { 503 } else if (!this.controller) {
494 bodyClassList.remove('with-notes'); 504 bodyClassList.remove('with-notes');
@@ -516,7 +526,7 @@ SlideDeck.prototype.nextSlide = function(opt_dontPush) {
516 // Toggle off speaker notes if they're showing when we advanced on the 526 // Toggle off speaker notes if they're showing when we advanced on the
517 // main 527 // main
518 // slides. If we're the speaker notes popup, leave them up. 528 // slides. If we're the speaker notes popup, leave them up.
519 if (this.controller && !this.controller.isPopup) { 529 if (this.controller && !this.controller.isPresenter) {
520 bodyClassList.remove('with-notes'); 530 bodyClassList.remove('with-notes');
521 } else if (!this.controller) { 531 } else if (!this.controller) {
522 bodyClassList.remove('with-notes'); 532 bodyClassList.remove('with-notes');