From e14c8eaca6aa822bdac44de2147ad2b6285532bc Mon Sep 17 00:00:00 2001 From: Eric Bidelman Date: Mon, 9 Apr 2012 21:55:59 -0700 Subject: Iframe style updates. All links open in new tab --- js/slides.js | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'js') 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() { SlideDeck.prototype.onDomLoaded_ = function() { this.slides_ = document.querySelectorAll('slide:not([hidden])'); + // Load config. + this.loadConfig_(); + this.addEventListeners_(); + this.updateSlides_(); + + // Add slide numbers and total slide count metadata to each slide. for (var i = 0, slide; slide = this.slides_[i]; ++i) { slide.dataset.slideNum = i + 1; slide.dataset.totalSlides = this.slides_.length; } - // Load config. - this.loadConfig_(); - this.addEventListeners_(); - this.updateSlides_(); + // This is an app! Make all links open in a new tab. + [].forEach.call(document.querySelectorAll('a'), function(a) { + a.target = '_blank'; + }); }; /** @@ -175,7 +181,7 @@ SlideDeck.prototype.loadConfig_ = function() { } if (settings.title) { - document.title = settings.title + ' - Google IO 2012'; + document.title = settings.title.replace(//, ' ') + ' - Google IO 2012'; document.querySelector('[data-config-title]').innerHTML = settings.title; } @@ -193,14 +199,14 @@ SlideDeck.prototype.loadConfig_ = function() { html = [p.name, p.company].join('
'); var gplus = p.gplus ? 'g+' + p.gplus + '' : ''; + '">' + p.gplus + '' : ''; var twitter = p.twitter ? 'twitter' + - '' + + '' + p.twitter + '' : ''; var www = p.www ? 'www' + p.www + '' : ''; + '">' + p.www + '' : ''; var html2 = [gplus, twitter, www].join('
'); @@ -350,7 +356,6 @@ SlideDeck.prototype.updateSlides_ = function(opt_dontPush) { } }; - //this.triggerSlideEvent('slideleave', curSlide - 1); this.triggerSlideEvent('slideleave', this.prevSlide_); this.triggerSlideEvent('slideenter', curSlide); @@ -377,7 +382,7 @@ SlideDeck.prototype.enableSlideFrames_ = function(slideNo) { return; } - var frames = el.getElementsByTagName('iframe'); + var frames = el.querySelectorAll('iframe'); for (var i = 0, frame; frame = frames[i]; i++) { this.enableFrame_(frame); } @@ -388,7 +393,7 @@ SlideDeck.prototype.enableSlideFrames_ = function(slideNo) { * @param {number} slideNo */ SlideDeck.prototype.enableFrame_ = function(frame) { - var src = frame._src; + var src = frame.dataset.src; if (src && frame.src != src) { frame.src = src; } @@ -404,7 +409,7 @@ SlideDeck.prototype.disableSlideFrames_ = function(slideNo) { return; } - var frames = el.getElementsByTagName('iframe'); + var frames = el.querySelectorAll('iframe'); for (var i = 0, frame; frame = frames[i]; i++) { this.disableFrame_(frame); } -- cgit v1.2.3