var slides = []; function slide(x) { slides.push( (function(s) { return function() { window.location.hash = s; document.body.style.cssText = window.oc; x(); }; })(slides.length) ); } function main(text) { return function() { document.body.innerHTML = text; }; } function big(x) { return function() { x(); var i = 1e3, e = document.body; e.style.display = 'inline'; e.style.fontSize = i + 'px'; while ( e.offsetWidth > window.innerWidth || e.offsetHeight > window.innerHeight) { e.style.fontSize = (i -= 10) + 'px'; } } } window.onload = function() { var doc = document, win = window, cur = (win.location.hash && parse_hash()) || 0; win.oc = doc.body.style.cssText; function parse_hash() { return Math.max(Math.min( slides.length - 1, parseInt(win.location.hash.substring(1), 10)), 0); } doc.onkeydown = function(e) { (e.which === 39) && slides[cur = Math.min(slides.length - 1, ++cur)](); (e.which === 37) && slides[cur = Math.max(0, --cur)](); }; doc.onclick = doc.ontouchstart = function() { slides[cur = Math.min(slides.length - 1, ++cur)](); }; win.onhashchange = function() { var c = parse_hash(); if (c !== cur) slides[cur = c](); }; slides[cur](); };