aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/slides.js29
1 files changed, 17 insertions, 12 deletions
diff --git a/js/slides.js b/js/slides.js
index 1a6bb57..eee44ee 100644
--- a/js/slides.js
+++ b/js/slides.js
@@ -45,15 +45,21 @@ SlideDeck.prototype.getCurrentSlideFromHash_ = function() {
45SlideDeck.prototype.onDomLoaded_ = function() { 45SlideDeck.prototype.onDomLoaded_ = function() {
46 this.slides_ = document.querySelectorAll('slide:not([hidden])'); 46 this.slides_ = document.querySelectorAll('slide:not([hidden])');
47 47
48 // Load config.
49 this.loadConfig_();
50 this.addEventListeners_();
51 this.updateSlides_();
52
53 // Add slide numbers and total slide count metadata to each slide.
48 for (var i = 0, slide; slide = this.slides_[i]; ++i) { 54 for (var i = 0, slide; slide = this.slides_[i]; ++i) {
49 slide.dataset.slideNum = i + 1; 55 slide.dataset.slideNum = i + 1;
50 slide.dataset.totalSlides = this.slides_.length; 56 slide.dataset.totalSlides = this.slides_.length;
51 } 57 }
52 58
53 // Load config. 59 // This is an app! Make all links open in a new tab.
54 this.loadConfig_(); 60 [].forEach.call(document.querySelectorAll('a'), function(a) {
55 this.addEventListeners_(); 61 a.target = '_blank';
56 this.updateSlides_(); 62 });
57}; 63};
58 64
59/** 65/**
@@ -175,7 +181,7 @@ SlideDeck.prototype.loadConfig_ = function() {
175 } 181 }
176 182
177 if (settings.title) { 183 if (settings.title) {
178 document.title = settings.title + ' - Google IO 2012'; 184 document.title = settings.title.replace(/<br\/?>/, ' ') + ' - Google IO 2012';
179 document.querySelector('[data-config-title]').innerHTML = settings.title; 185 document.querySelector('[data-config-title]').innerHTML = settings.title;
180 } 186 }
181 187
@@ -193,14 +199,14 @@ SlideDeck.prototype.loadConfig_ = function() {
193 html = [p.name, p.company].join('<br>'); 199 html = [p.name, p.company].join('<br>');
194 200
195 var gplus = p.gplus ? '<span>g+</span><a href="' + p.gplus + 201 var gplus = p.gplus ? '<span>g+</span><a href="' + p.gplus +
196 '" target="_blank">' + p.gplus + '</a>' : ''; 202 '">' + p.gplus + '</a>' : '';
197 203
198 var twitter = p.twitter ? '<span>twitter</span>' + 204 var twitter = p.twitter ? '<span>twitter</span>' +
199 '<a href="http://twitter.com/' + p.twitter + '" target="_blank">' + 205 '<a href="http://twitter.com/' + p.twitter + '">' +
200 p.twitter + '</a>' : ''; 206 p.twitter + '</a>' : '';
201 207
202 var www = p.www ? '<span>www</span><a href="' + p.www + 208 var www = p.www ? '<span>www</span><a href="' + p.www +
203 '" target="_blank">' + p.www + '</a>' : ''; 209 '">' + p.www + '</a>' : '';
204 210
205 var html2 = [gplus, twitter, www].join('<br>'); 211 var html2 = [gplus, twitter, www].join('<br>');
206 212
@@ -350,7 +356,6 @@ SlideDeck.prototype.updateSlides_ = function(opt_dontPush) {
350 } 356 }
351 }; 357 };
352 358
353 //this.triggerSlideEvent('slideleave', curSlide - 1);
354 this.triggerSlideEvent('slideleave', this.prevSlide_); 359 this.triggerSlideEvent('slideleave', this.prevSlide_);
355 this.triggerSlideEvent('slideenter', curSlide); 360 this.triggerSlideEvent('slideenter', curSlide);
356 361
@@ -377,7 +382,7 @@ SlideDeck.prototype.enableSlideFrames_ = function(slideNo) {
377 return; 382 return;
378 } 383 }
379 384
380 var frames = el.getElementsByTagName('iframe'); 385 var frames = el.querySelectorAll('iframe');
381 for (var i = 0, frame; frame = frames[i]; i++) { 386 for (var i = 0, frame; frame = frames[i]; i++) {
382 this.enableFrame_(frame); 387 this.enableFrame_(frame);
383 } 388 }
@@ -388,7 +393,7 @@ SlideDeck.prototype.enableSlideFrames_ = function(slideNo) {
388 * @param {number} slideNo 393 * @param {number} slideNo
389 */ 394 */
390SlideDeck.prototype.enableFrame_ = function(frame) { 395SlideDeck.prototype.enableFrame_ = function(frame) {
391 var src = frame._src; 396 var src = frame.dataset.src;
392 if (src && frame.src != src) { 397 if (src && frame.src != src) {
393 frame.src = src; 398 frame.src = src;
394 } 399 }
@@ -404,7 +409,7 @@ SlideDeck.prototype.disableSlideFrames_ = function(slideNo) {
404 return; 409 return;
405 } 410 }
406 411
407 var frames = el.getElementsByTagName('iframe'); 412 var frames = el.querySelectorAll('iframe');
408 for (var i = 0, frame; frame = frames[i]; i++) { 413 for (var i = 0, frame; frame = frames[i]; i++) {
409 this.disableFrame_(frame); 414 this.disableFrame_(frame);
410 } 415 }