pre-gh pages creation

This commit is contained in:
John Bintz 2012-03-23 17:25:31 -04:00
parent 01cb7cde64
commit a64763cab1
2 changed files with 5211 additions and 1594 deletions

View File

@ -21,7 +21,6 @@ Attentive.Presentation = (function() {
this.getCurrentSlide = __bind(this.getCurrentSlide, this); this.getCurrentSlide = __bind(this.getCurrentSlide, this);
this.calculate = __bind(this.calculate, this); this.calculate = __bind(this.calculate, this);
this.advanceTo = __bind(this.advanceTo, this); this.advanceTo = __bind(this.advanceTo, this);
this.isFile = __bind(this.isFile, this);
this.advance = __bind(this.advance, this); this.advance = __bind(this.advance, this);
this.handleKeyDown = __bind(this.handleKeyDown, this); this.handleKeyDown = __bind(this.handleKeyDown, this);
this.handleClick = __bind(this.handleClick, this); this.handleClick = __bind(this.handleClick, this);
@ -50,9 +49,6 @@ Attentive.Presentation = (function() {
Presentation.prototype.start = function() { Presentation.prototype.start = function() {
var imageWait, var imageWait,
_this = this; _this = this;
if (!this.isFile()) {
window.addEventListener('popstate', this.handlePopState, false);
}
this.timer.render(); this.timer.render();
document.addEventListener('click', this.handleClick, false); document.addEventListener('click', this.handleClick, false);
document.addEventListener('keydown', this.handleKeyDown, false); document.addEventListener('keydown', this.handleKeyDown, false);
@ -80,13 +76,11 @@ Attentive.Presentation = (function() {
}; };
Presentation.prototype.slideFromLocation = function() { Presentation.prototype.slideFromLocation = function() {
var value; return Number(location.hash.substr(1));
value = this.isFile() ? location.hash : location.pathname;
return Number(value.substr(1));
}; };
Presentation.prototype.handlePopState = function(e) { Presentation.prototype.handlePopState = function(e) {
return this.advanceTo(e.state ? e.state.index : this.slideFromLocation()); return this.advanceTo(this.slideFromLocation());
}; };
Presentation.prototype.handleClick = function(e) { Presentation.prototype.handleClick = function(e) {
@ -98,9 +92,11 @@ Attentive.Presentation = (function() {
case 72: case 72:
return this.advanceTo(0); return this.advanceTo(0);
case 37: case 37:
case 33:
return this.advance(-1); return this.advance(-1);
case 39: case 39:
case 32: case 32:
case 34:
return this.advance(); return this.advance();
case 220: case 220:
return this.timer.reset(); return this.timer.reset();
@ -118,21 +114,11 @@ Attentive.Presentation = (function() {
return this.advanceTo(Math.max(Math.min(this.currentSlide + offset, this.length - 1), 0)); return this.advanceTo(Math.max(Math.min(this.currentSlide + offset, this.length - 1), 0));
}; };
Presentation.prototype.isFile = function() {
return location.href.slice(0, 4) === 'file';
};
Presentation.prototype.advanceTo = function(index) { Presentation.prototype.advanceTo = function(index) {
this.priorSlide = this.currentSlide; this.priorSlide = this.currentSlide;
this.currentSlide = index || 0; this.currentSlide = index || 0;
this.calculate(); this.calculate();
if (this.isFile()) { return location.hash = this.currentSlide;
return location.hash = this.currentSlide;
} else {
return history.pushState({
index: this.currentSlide
}, '', this.currentSlide);
}
}; };
Presentation.prototype.calculate = function() { Presentation.prototype.calculate = function() {

File diff suppressed because it is too large Load Diff