// Generated by CoffeeScript 1.7.1
var Mode, Slide, SlideInitializer, Transform, UserInterface, startEventSourceHandler;
Highcharts.setOptions({
colors: ['#96000F', '#E10019', '#AAA5A0', '#46413C', '#327D91', '#4BBEE1', '#560F32', '#821350', '#006450', '#009682', '#697D19', '#9BC328', '#AA5500', '#FF8200'],
credits: {
enabled: true
},
legend: {
enabled: false
},
tooltip: {
enabled: false
},
title: {
text: ''
},
chart: {
backgroundColor: 'rgba(0,0,0,0)',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
margin: [0, 0, 0, 0],
style: {
fontFamily: 'Open Sans Light',
fontSize: '20px',
color: 'black'
}
}
});
Highcharts.getOptions().colors = Highcharts.map(Highcharts.getOptions().colors, function(color) {
return {
radialGradient: {
cx: 0.5,
cy: 0.3,
r: 0.7
},
stops: [[0, color], [1, Highcharts.Color(color).brighten(-0.3).get('rgb')]]
};
});
$.fn.extend({
typewriter: function() {
this.each(function() {
var $el, progress, str, timer;
$el = $(this);
str = $el.text();
progress = 0;
$el.text('');
return timer = setInterval(function() {
$el.text(str.substring(0, progress) + '_');
if (progress >= str.length) {
clearInterval(timer);
$el.text(str);
}
return progress++;
}, 100);
});
return this;
},
textfill: function(maxFontSize, maxWords) {
maxFontSize = parseInt(maxFontSize, 10) || 0;
maxWords = parseInt(maxWords, 10) || 3;
return this.each(function() {
var calcSize, fontSize, maxHeight, maxWidth, newText, orgText, self, splittedText, word, words, _i, _len;
calcSize = function(text) {
var multiplier, newSize, ourText, scrollHeight;
ourText = $("" + text + "").appendTo(self);
multiplier = maxWidth / ourText.width();
newSize = fontSize * (multiplier - 0.1);
ourText.css("fontSize", (maxFontSize > 0 && newSize > maxFontSize ? maxFontSize : newSize));
ourText.css("lineHeight", "1em");
scrollHeight = self[0].scrollHeight;
if (scrollHeight > maxHeight) {
multiplier = maxHeight / scrollHeight;
newSize = newSize * multiplier;
ourText.css("fontSize", (maxFontSize > 0 && newSize > maxFontSize ? maxFontSize : newSize));
ourText.css("lineHeight", "1em");
}
};
self = $(this);
orgText = self.text();
fontSize = parseInt(self.css("fontSize"), 10);
maxHeight = self.height();
maxWidth = self.width();
splittedText = self.html().split(/\s+|<.+?>/);
words = [];
for (_i = 0, _len = splittedText.length; _i < _len; _i++) {
word = splittedText[_i];
if (word && (word.empty == null)) {
words.push(word);
}
}
self.empty();
if (words.length > maxWords) {
while (words.length > 0) {
newText = words.splice(0, maxWords).join(" ");
console.log;
calcSize(newText);
self.append("
");
}
} else {
calcSize(orgText);
}
});
}
});
Transform = (function() {
function Transform() {}
Transform.body = document.body;
Transform.get = function() {
var denominator;
denominator = Math.max(this.body.clientWidth / window.innerWidth, this.body.clientHeight / window.innerHeight);
return "scale(" + (1 / denominator) + ")";
};
Transform.apply = function(transform) {
this.body.style.WebkitTransform = transform;
this.body.style.MozTransform = transform;
this.body.style.msTransform = transform;
this.body.style.OTransform = transform;
return this.body.style.transform = transform;
};
Transform.scale = function() {
return Transform.apply(Transform.get());
};
Transform.reset = function() {
return Transform.apply('none');
};
return Transform;
})();
Mode = (function() {
function Mode() {}
Mode.body = document.body;
Mode.dispatchSingleSlideMode = function(e) {
var presentSlideId, slide, slideId;
slideId = Mode.findSlideId(e.target);
presentSlideId = slideId != null;
if (presentSlideId && Mode.isListMode()) {
Mode.enterSlideMode();
slide = Slide.fromSlideId(slideId);
slide.goto();
return slide.replaceHistory();
}
};
Mode.enterSlideMode = function() {
this.body.className = "full";
return Transform.scale();
};
Mode.enterListMode = function() {
this.body.className = "list";
return Transform.reset();
};
Mode.isListMode = function() {
return !this.body.classList.contains("full");
};
Mode.isSlideMode = function() {
return !Mode.isListMode();
};
Mode.switchToListMode = function() {
var slide;
Mode.enterListMode();
slide = Slide.current();
slide.pushHistory();
return slide.scrollTo();
};
Mode.switchToSlideMode = function() {
var slide;
Mode.enterSlideMode();
slide = Slide.current();
slide.pushHistory();
return slide.updateProgress();
};
Mode.reload = function() {
var _ref;
Slide.current() || Slide.first().goto();
if (window.location.search.substr(1) === 'full') {
return Mode.enterSlideMode();
} else {
Mode.enterListMode();
return (_ref = Slide.current()) != null ? _ref.scrollTo() : void 0;
}
};
Mode.findSlideId = function(node) {
while ("BODY" !== node.nodeName && "HTML" !== node.nodeName) {
if (node.classList.contains("slide")) {
return node.id;
}
node = node.parentNode;
}
return null;
};
return Mode;
})();
SlideInitializer = (function() {
function SlideInitializer() {}
SlideInitializer.init = function() {
var $slides, slide, totalSize, _i, _len, _results;
$slides = $('.slide').not('.disabled');
totalSize = $slides.length;
_results = [];
for (_i = 0, _len = $slides.length; _i < _len; _i++) {
slide = $slides[_i];
SlideInitializer.initSlideNumber(slide, totalSize);
SlideInitializer.initIncremental(slide);
SlideInitializer.initPause(slide);
_results.push(SlideInitializer.initTypewriter(slide));
}
return _results;
};
SlideInitializer.initMouseClick = function() {
$('body').click(function(e) {
if (e.which === 1) {
e.preventDefault();
return UserInterface.nextStep();
}
});
return $('body').on('contextmenu', function(e) {
e.preventDefault();
return UserInterface.prevStep();
});
};
SlideInitializer.initSlideNumber = function(slide, total) {
var slideNum;
slideNum = $(slide).index() - $(slide).prevAll('.slide.disabled').length;
return $(slide).attr('data-slide', slideNum).attr('data-slides', total);
};
SlideInitializer.initIncremental = function(slide) {
var $slide;
$slide = $(slide);
if ($slide.hasClass('incr-list')) {
$slide.find('> div > ul > li:first-child').addClass('current');
$slide.find('> div > ol > li:first-child').addClass('current');
$slide.find('> div > ul > li:not(:first-child)').addClass('inactive');
$slide.find('> div > ol > li:not(:first-child)').addClass('inactive');
}
if ($slide.hasClass('incr-code')) {
$slide.find('pre > code:first-child').addClass('current');
$slide.find('pre > code:not(:first-child)').addClass('inactive');
}
if ($slide.hasClass('incr-table')) {
$slide.find('table > tbody > tr:first-child').addClass('current');
return $slide.find('table > tbody > tr:not(:first-child)').addClass('inactive');
}
};
SlideInitializer.initPause = function(slide) {
var i, last, pause, pauses, wrappable, _i, _len, _results;
pauses = $(slide).find(".pause");
_results = [];
for (i = _i = 0, _len = pauses.length; _i < _len; i = ++_i) {
pause = pauses[i];
last = i === pauses.length - 1;
if (last) {
wrappable = $(pause).nextAll();
} else {
wrappable = $(pause).nextUntil(".pause");
}
_results.push(wrappable != null ? wrappable.wrapAll('