* @license MIT license: github.com/shower/shower/wiki/MIT-License
*/
window.shower=function(e,t,r){vari={},n=e.location,s=t.body,o=t.querySelectorAll(".slide"),a=t.querySelector("div.progress div"),l=[],u,d=!!(e.history&&history.pushState),f=o.length,c;i._getData=function(e,t){returne.dataset?e.dataset[t]:e.getAttribute("data-"+t)};for(c=0;c<f;c++){if(!o[c].id){o[c].id=c+1}l.push({id:o[c].id,hasInnerNavigation:null!==o[c].querySelector(".next"),hasTiming:i._getData(o[c],"timing")&&i._getData(o[c],"timing").indexOf(":")!==-1})}i._getTransform=function(){vart=Math.max(s.clientWidth/e.innerWidth,s.clientHeight/e.innerHeight);return"scale("+1/t+")"};i._applyTransform=function(e){s.style.WebkitTransform=e;s.style.MozTransform=e;s.style.msTransform=e;s.style.OTransform=e;s.style.transform=e;returntrue};i._isNumber=function(e){return!isNaN(parseFloat(e))&&isFinite(e)};i._normalizeSlideNumber=function(e){if(!i._isNumber(e)){thrownewError("Gimme slide number as Number, baby!")}if(e<0){e=0}if(e>=l.length){e=l.length-1}returne};i._getSlideIdByEl=function(e){while("BODY"!==e.nodeName&&"HTML"!==e.nodeName){if(e.classList.contains("slide")){returne.id}else{e=e.parentNode}}return""};i._checkInteractiveElement=function(e){return"A"===e.target.nodeName};i.getSlideNumber=function(e){vart=l.length-1,r;if(e===""){r=0}for(;t>=0;--t){if(e===l[t].id){r=t;break}}returnr};i.go=function(e,t){if(!i._isNumber(e)){thrownewError("Gimme slide number as Number, baby!")}n.hash=i.getSlideHash(e);i.updateProgress(e);i.updateActiveAndVisitedSlides(e);if(i.isSlideMode()){i.showPresenterNotes(e);i.runInnerNavigation(e)}if(typeoft==="function"){t()}returne};i.next=function(e){vart=i.getCurrentSlideNumber(),r=false;if((-1===t||!l[t].hasInnerNavigation||!i.increaseInnerNavigation(t))&&t+2<=l.length){i.go(t+1);r=t+2}if(i.isSlideMode()){i.runInnerNavigation(t+1)}if(typeofe==="function"){e()}returnr};i.previous=function(e){vart=i.getCurrentSlideNumber(),r=false;if(t>0){r=t;i.go(t-1);if(typeofe==="function"){e()}}returnr};i.first=function(e){if(typeofe==="function"){e()}returni.go(0)};i.last=function(e){if(typeofe==="function"){e()}returni.go(l.length-1)};i.enterSlideMode=function(e){vart=i.getCurrentSlideNumber();s.classList.remove("list");s.classList.add("full");if(i.isListMode()&&d){history.pushState(null,null,n.pathname+"?full"+i.getSlideHash(t))}i._applyTransform(i._getTransform());if(typeofe==="function"){e()}returntrue};i.enterListMode=function(e){s.classList.remove("full");s.classList.add("list");i.clearPresenterNotes();if(i.isListMode()){returnfalse}vart=i.getCurrentSlideNumber();clearTimeout(u);if(i.isSlideMode()&&d){history.pushState(null,null,n.pathname+i.getSlideHash(t))}i.scrollToSlide(t);i._applyTransform("none");if(typeofe==="function"){e()}returntrue};i.toggleMode=function(e){if(i.isListMode()){i.enterSlideMode()}else{i.enterListMode()}if(typeofe==="function"){e()}returntrue};i.getCurrentSlideNumber=function(){vare=l.length-1,t=n.hash.substr(1);for(;e>=0;--e){if(t===l[e].id){returne}}return-1};i.scrollToSlide=function(r){varn,s=false;if(!i._isNumber(r)){thrownewError("Gimme slide number as Number, baby!")}if(i.isSlideMode()){thrownewError("You can't scroll to because you in slide mode. Please, switch to list mode.")}if(-1===r){returns}if(l[r]){n=t.getElementById(l[r].id);e.scrollTo(0,n.offsetTop);s=true}else{thrownewError("There is no slide with number "+r)}returns};i.isListMode=function(){returnd?!/^full.*/.test(n.search.substr(1)):s.classList.contains("list")};i.isSlideMode=function(){returnd?/^full.*/.test(n.search.substr(1)):s.classList.contains("full")};i.updateProgress=function(e){if(null===a){returnfalse}if(!i._isNumber(e)){thrownewError("Gimme slide number as Number, baby!")}a.style.width=(100/(l.length-1)*i._normalizeSlideNumber(e)).toFixed(2)+"%";returntrue};i.updateActiveAndVisitedSlides=function(e){varr,n,s=l.length;e=i._normalizeSlideNumber(e);if(!i._isNumber(e)){thrownewError("Gimme slide number as Number, baby!")}for(r=0;r<s;++r){n=t.getElementById(l[r].id);if(r<e){n.classList.remove("active");n.classList.add("visited")}elseif(r>e){n.classList.remove("visited");n.classList.remove("active")}else{n.classList.remove("visited");n.classList.add("active")}}returntrue};i.clearPresenterNotes=function(){if(e.console&&e.console.clear){console.clear()}};i.showPresenterNotes=function(r){i.clearPresenterNotes();if(e.console){r=i._normalizeSlideNumber(r);varn=l[r].id,s=l[r+1]?l[r+1].id:null,o=t.getElementById(n).querySelector("footer");if(o&&o.innerHTML){console.info(o.innerHTML.replace(/\n\s+/g,"\n"))}if(s){vara=t.getElementById(s).querySelector("h2");if(a){a=a.innerHTML.replace(/^\s+|<[^>]+>/g,"");console.info("NEXT: "+a)}}}};i.getSlideHash=function(e){if(!i._isNumber(e)){thrownewError("Gimme slide number as Number, baby!")}e=i._normalizeSlideNumber(e);return"#"+l[e].id};i.runInnerNavigation=function(e){if(!i._isNumber(e)){thrownewError("Gimme slide number as Number, baby!")}e=i._normalizeSlideNumber(e);clearTimeout(u);if(l[e].hasTiming){varr=i._getData(t.getElementById(l[e].id),"timing").split(":");r=parseInt(r[0],10)*60*1e3+parseInt(r[1],10)*1e3;u=setTimeout(function(){i.next()},r)}returntrue};i.increaseInnerNavigation=function(e){varr,n;if(!i._isNumber(e)){thrownewError("Gimme slide number as Number, baby!")}if(l[e].hasInnerNavigation){r=t.getElementById(l[e].id).querySelectorAll(".next:not(.active)");if(0!==r.length){n=r[0];n.classList.add("active");returntrue}}returnfalse};e.addEventListener("DOMContentLoaded",function(){if(s.classList.contains("full")||i.isSlideMode()){i.go(i.getCurrentSlideNumber());i.enterSlideMode()}},false);e.addEventListener("popstate",function(){if(i.isListMode()){i.enterListMode()}else{i.enterSlideMode()}},false);e.addEventListener("resize",function(){if(i.isSlideMode()){i._applyTransform(i._getTransform())}},false);t.addEventListener("keydown",function(e){if(e.altKey||e.ctrlKey||e.metaKey){return}vart=i.getCurrentSlideNumber(),r=true;switch(e.which){case116:e.preventDefault();if(i.isListMode()){varn=e.shiftKey?t:0;i.go(n);i.enterSlideMode();i.showPresenterNotes(n)}else{i.enterListMode()}break;case13:if(i.isListMode()&&-1!==t){e.preventDefault();i.enterSlideMode();i.showPresenterNotes(t);i.runInnerNavigation(t)}break;case27:if(i.isSlideMode()){e.preventDefault();i.enterListMode()}break;case33:case38:case37:case72:case75:e.preventDefault();i.previous();break;case34:case40:case39:case76:case74:e.preventDefault();i.next();break;case36:e.preventDefault();i.first();break;case35:e.preventDefault();i.last();break;case9:case32:e.preventDefault();i[e.shiftKey?"previous":"next"]();break;default:}},false);t.addEventListener("click",function(e){vart=i.getSlideNumber(i._getSlideIdByEl(e.target));if(i.isListMode()&&i._getSlideIdByEl(e.target)){i.go(t);i.enterSlideMode();i.showPresenterNotes(t)}},false);t.addEventListener("touchstart",function(t){if(i._getSlideIdByEl(t.target)){if(i.isSlideMode()&&!i._checkInteractiveElement(t)){varr=t.touches[0].pageX;if(r>e.innerWidth/2){i.next()}else{i.previous()}}if(i.isListMode()){i.go(i.getSlideNumber(i._getSlideIdByEl(t.target)));i.enterSlideMode()}}},false);t.addEventListener("touchmove",function(e){if(i.isSlideMode()){e.preventDefault()}},false);returni}(this,this.document);
\ No newline at end of file
window.shower=window.shower||function(e,t,r){vari={},n=e.location,s=t.body,o=t.querySelectorAll(".slide"),a=t.querySelector("div.progress div"),l=[],u,d=!!(e.history&&history.pushState),f=o.length,c;i._getData=function(e,t){returne.dataset?e.dataset[t]:e.getAttribute("data-"+t)};for(c=0;c<f;c++){if(!o[c].id){o[c].id=c+1}l.push({id:o[c].id,hasInnerNavigation:null!==o[c].querySelector(".next"),hasTiming:i._getData(o[c],"timing")&&i._getData(o[c],"timing").indexOf(":")!==-1})}i._getTransform=function(){vart=Math.max(s.clientWidth/e.innerWidth,s.clientHeight/e.innerHeight);return"scale("+1/t+")"};i._applyTransform=function(e){s.style.WebkitTransform=e;s.style.MozTransform=e;s.style.msTransform=e;s.style.OTransform=e;s.style.transform=e;returntrue};i._isNumber=function(e){return!isNaN(parseFloat(e))&&isFinite(e)};i._normalizeSlideNumber=function(e){if(!i._isNumber(e)){thrownewError("Gimme slide number as Number, baby!")}if(e<0){e=0}if(e>=l.length){e=l.length-1}returne};i._getSlideIdByEl=function(e){while("BODY"!==e.nodeName&&"HTML"!==e.nodeName){if(e.classList.contains("slide")){returne.id}else{e=e.parentNode}}return""};i._checkInteractiveElement=function(e){return"A"===e.target.nodeName};i.getSlideNumber=function(e){vart=l.length-1,r;if(e===""){r=0}for(;t>=0;--t){if(e===l[t].id){r=t;break}}returnr};i.go=function(e,t){if(!i._isNumber(e)){thrownewError("Gimme slide number as Number, baby!")}n.hash=i.getSlideHash(e);i.updateProgress(e);i.updateActiveAndVisitedSlides(e);if(i.isSlideMode()){i.showPresenterNotes(e);i.runInnerNavigation(e)}if(typeoft==="function"){t()}returne};i.next=function(e){vart=i.getCurrentSlideNumber(),r=false;if((-1===t||!l[t].hasInnerNavigation||!i.increaseInnerNavigation(t))&&t+2<=l.length){i.go(t+1);r=t+2}if(i.isSlideMode()){i.runInnerNavigation(t+1)}if(typeofe==="function"){e()}returnr};i.previous=function(e){vart=i.getCurrentSlideNumber(),r=false;if(t>0){r=t;i.go(t-1);if(typeofe==="function"){e()}}returnr};i.first=function(e){if(typeofe==="function"){e()}returni.go(0)};i.last=function(e){if(typeofe==="function"){e()}returni.go(l.length-1)};i.enterSlideMode=function(e){vart=i.getCurrentSlideNumber();s.classList.remove("list");s.classList.add("full");if(i.isListMode()&&d){history.pushState(null,null,n.pathname+"?full"+i.getSlideHash(t))}i._applyTransform(i._getTransform());if(typeofe==="function"){e()}returntrue};i.enterListMode=function(e){s.classList.remove("full");s.classList.add("list");i.clearPresenterNotes();if(i.isListMode()){returnfalse}vart=i.getCurrentSlideNumber();clearTimeout(u);if(i.isSlideMode()&&d){history.pushState(null,null,n.pathname+i.getSlideHash(t))}i.scrollToSlide(t);i._applyTransform("none");if(typeofe==="function"){e()}returntrue};i.toggleMode=function(e){if(i.isListMode()){i.enterSlideMode()}else{i.enterListMode()}if(typeofe==="function"){e()}returntrue};i.getCurrentSlideNumber=function(){vare=l.length-1,t=n.hash.substr(1);for(;e>=0;--e){if(t===l[e].id){returne}}return-1};i.scrollToSlide=function(r){varn,s=false;if(!i._isNumber(r)){thrownewError("Gimme slide number as Number, baby!")}if(i.isSlideMode()){thrownewError("You can't scroll to because you in slide mode. Please, switch to list mode.")}if(-1===r){returns}if(l[r]){n=t.getElementById(l[r].id);e.scrollTo(0,n.offsetTop);s=true}else{thrownewError("There is no slide with number "+r)}returns};i.isListMode=function(){returnd?!/^full.*/.test(n.search.substr(1)):s.classList.contains("list")};i.isSlideMode=function(){returnd?/^full.*/.test(n.search.substr(1)):s.classList.contains("full")};i.updateProgress=function(e){if(null===a){returnfalse}if(!i._isNumber(e)){thrownewError("Gimme slide number as Number, baby!")}a.style.width=(100/(l.length-1)*i._normalizeSlideNumber(e)).toFixed(2)+"%";returntrue};i.updateActiveAndVisitedSlides=function(e){varr,n,s=l.length;e=i._normalizeSlideNumber(e);if(!i._isNumber(e)){thrownewError("Gimme slide number as Number, baby!")}for(r=0;r<s;++r){n=t.getElementById(l[r].id);if(r<e){n.classList.remove("active");n.classList.add("visited")}elseif(r>e){n.classList.remove("visited");n.classList.remove("active")}else{n.classList.remove("visited");n.classList.add("active")}}returntrue};i.clearPresenterNotes=function(){if(e.console&&e.console.clear){console.clear()}};i.showPresenterNotes=function(r){i.clearPresenterNotes();if(e.console){r=i._normalizeSlideNumber(r);varn=l[r].id,s=l[r+1]?l[r+1].id:null,o=t.getElementById(n).querySelector("footer");if(o&&o.innerHTML){console.info(o.innerHTML.replace(/\n\s+/g,"\n"))}if(s){vara=t.getElementById(s).querySelector("h2");if(a){a=a.innerHTML.replace(/^\s+|<[^>]+>/g,"");console.info("NEXT: "+a)}}}};i.getSlideHash=function(e){if(!i._isNumber(e)){thrownewError("Gimme slide number as Number, baby!")}e=i._normalizeSlideNumber(e);return"#"+l[e].id};i.runInnerNavigation=function(e){if(!i._isNumber(e)){thrownewError("Gimme slide number as Number, baby!")}e=i._normalizeSlideNumber(e);clearTimeout(u);if(l[e].hasTiming){varr=i._getData(t.getElementById(l[e].id),"timing").split(":");r=parseInt(r[0],10)*60*1e3+parseInt(r[1],10)*1e3;u=setTimeout(function(){i.next()},r)}returntrue};i.increaseInnerNavigation=function(e){varr,n;if(!i._isNumber(e)){thrownewError("Gimme slide number as Number, baby!")}if(l[e].hasInnerNavigation){r=t.getElementById(l[e].id).querySelectorAll(".next:not(.active)");if(0!==r.length){n=r[0];n.classList.add("active");returntrue}}returnfalse};e.addEventListener("DOMContentLoaded",function(){if(s.classList.contains("full")||i.isSlideMode()){i.go(i.getCurrentSlideNumber());i.enterSlideMode()}},false);e.addEventListener("popstate",function(){if(i.isListMode()){i.enterListMode()}else{i.enterSlideMode()}},false);e.addEventListener("resize",function(){if(i.isSlideMode()){i._applyTransform(i._getTransform())}},false);t.addEventListener("keydown",function(e){if(e.altKey||e.ctrlKey||e.metaKey){return}vart=i.getCurrentSlideNumber(),r=true;switch(e.which){case116:e.preventDefault();if(i.isListMode()){varn=e.shiftKey?t:0;i.go(n);i.enterSlideMode();i.showPresenterNotes(n)}else{i.enterListMode()}break;case13:if(i.isListMode()&&-1!==t){e.preventDefault();i.enterSlideMode();i.showPresenterNotes(t);i.runInnerNavigation(t)}break;case27:if(i.isSlideMode()){e.preventDefault();i.enterListMode()}break;case33:case38:case37:case72:case75:e.preventDefault();i.previous();break;case34:case40:case39:case76:case74:e.preventDefault();i.next();break;case36:e.preventDefault();i.first();break;case35:e.preventDefault();i.last();break;case9:case32:e.preventDefault();i[e.shiftKey?"previous":"next"]();break;default:}},false);t.addEventListener("click",function(e){vart=i.getSlideNumber(i._getSlideIdByEl(e.target));if(i.isListMode()&&i._getSlideIdByEl(e.target)){i.go(t);i.enterSlideMode();i.showPresenterNotes(t)}},false);t.addEventListener("touchstart",function(t){if(i._getSlideIdByEl(t.target)){if(i.isSlideMode()&&!i._checkInteractiveElement(t)){varr=t.touches[0].pageX;if(r>e.innerWidth/2){i.next()}else{i.previous()}}if(i.isListMode()){i.go(i.getSlideNumber(i._getSlideIdByEl(t.target)));i.enterSlideMode()}}},false);t.addEventListener("touchmove",function(e){if(i.isSlideMode()){e.preventDefault()}},false);returni}(this,this.document);