window.shower=function(window,document,undefined){varshower={},url=window.location,body=document.body,slides=document.querySelectorAll(".slide"),progress=document.querySelector("div.progress div"),slideList=[],timer,isHistoryApiSupported=!!(window.history&&history.pushState),l=slides.length,i;shower._getData=function(element,name){returnelement.dataset?element.dataset[name]:element.getAttribute("data-"+name)};for(i=0;i<l;i++){if(!slides[i].id){slides[i].id=i+1}slideList.push({id:slides[i].id,hasInnerNavigation:null!==slides[i].querySelector(".next"),hasTiming:shower._getData(slides[i],"timing")&&shower._getData(slides[i],"timing").indexOf(":")!==-1})}shower._getTransform=function(){vardenominator=Math.max(body.clientWidth/window.innerWidth,body.clientHeight/window.innerHeight);return"scale("+1/denominator+")"};shower._applyTransform=function(transform){body.style.WebkitTransform=transform;body.style.MozTransform=transform;body.style.msTransform=transform;body.style.OTransform=transform;body.style.transform=transform;returntrue};shower._isNumber=function(arg){if(!(!isNaN(parseFloat(arg))&&isFinite(arg))){returnfalse}returntrue};shower._normalizeSlideNumber=function(slideNumber){if(!shower._isNumber(slideNumber)){thrownewError("Gimme slide number as Number, baby!")}if(slideNumber<0){slideNumber=0}if(slideNumber>=slideList.length){slideNumber=slideList.length-1}returnslideNumber};shower._getContainingSlideId=function(el){while("BODY"!==el.nodeName&&"HTML"!==el.nodeName){if(el.classList.contains("slide")){returnel.id}else{el=el.parentNode}}return""};shower._dispatchSingleSlideMode=function(e){if("A"===e.target.nodeName){e.preventDefault();window.open(e.target.getAttribute("href"));return}varslideId=shower._getContainingSlideId(e.target);if(""!==slideId&&shower.isListMode()){e.preventDefault();url.hash="#"+slideId;if(isHistoryApiSupported){history.replaceState(null,null,url.pathname+"?full#"+slideId)}shower.enterSlideMode();shower.updateProgress(shower.getCurrentSlideNumber());shower.updateCurrentAndPassedSlides(shower.getCurrentSlideNumber());shower.runSlideshowIfPresented(shower.getCurrentSlideNumber())}return};shower.next=function(callback){varcurrentSlideNumber=shower.getCurrentSlideNumber(),ret;if(-1===currentSlideNumber||!slideList[currentSlideNumber].hasInnerNavigation||-1===shower.increaseInnerNavigation(currentSlideNumber)){shower.go(currentSlideNumber+1);ret=currentSlideNumber+2;if(typeofcallback==="function"){callback()}}else{ret=false}returnret};shower.previous=function(callback){varcurrentSlideNumber=shower.getCurrentSlideNumber(),ret;if(currentSlideNumber>0){ret=currentSlideNumber;shower.go(currentSlideNumber-1);if(typeofcallback==="function"){callback()}}else{ret=false}returnret};shower.first=function(callback){if(typeofcallback==="function"){callback()}returnshower.go(0)};shower.last=function(callback){if(typeofcallback==="function"){callback()}returnshower.go(slideList.length-1)};shower.enterSlideMode=function(callback){if(body.classList.contains("full")){returnfalse}body.classList.remove("list");body.classList.add("full");if(window.console&&window.console.clear){console.clear()}shower.showPresenterNotes(shower.getCurrentSlideNumber());if(typeofcallback==="function"){callback()}returnshower._applyTransform(shower._getTransform())};shower.enterListMode=function(callback){if(body.classList.contains("list")){returnfalse}body.classList.remove("full");body.classList.add("list");if(typeofcallback==="function"){callback()}returnshower._applyTransform("none")};shower.getCurrentSlideNumber=function(){vari=slideList.length-1,currentSlideId=url.hash.substr(1);for(;i>=0;--i){if(currentSlideId===slideList[i].id){returni}}return-1};shower.scrollToSlide=function(slideNumber){varcurrentSlide,ret;if(!shower._isNumber(slideNumber)){thrownewError("Gimme slide number as Number, baby!")}if(!shower.isListMode()){thrownewError("You can't scroll to because you in slide mode. Please, switch to list mode.")}if(-1===slideNumber){return}if(slideList[slideNumber]){currentSlide=document.getElementById(slideList[slideNumber].id);window.scrollTo(0,currentSlide.offsetTop);ret=true}else{thrownewError("There is no slide with number "+slideNumber)}returnret};shower.isListMode=function(){returnisHistoryApiSupported?!/^full.*/.test(url.search.substr(1)):body.classList.contains("list")};shower.updateProgress=function(slideNumber){if(null===progress){returnfalse}if(!shower._isNumber(slideNumber)){thrownewError("Gimme slide number as Number, baby!")}progress.style.width=(100/(slideList.length-1)*shower._normalizeSlideNumber(slideNumber)).toFixed(2)+"%";returntrue};shower.updateCurrentAndPassedSlides=function(slideNumber){vari,slide,l=slideList.length;slideNumber=shower._normalizeSlideNumber(slideNumber);if(!shower._isNumber(slideNumber)){thrownewError("Gimme slide number as Number, baby!")}for(i=0;i<l;++i){slide=document.getElementById(slideList[i].id);if(i<slideNumber){slide.classList.remove("current");slide.classList.add("passed")}elseif(i>slideNumber){slide.classList.remove("passed");slide.classList.remove("current")}else{slide.classList.remove("passed");slide.classList.add("current")}}returntrue};shower.showPresenterNotes=function(slideNumber){if(window.console){slideNumber=shower._normalizeSlideNumber(slideNumber);varslideId=slideList[slideNumber].id;varnextSlideId=slideList[slideNumber+1]?slideList[slideNumber+1].id:null;varnotes=document.getElementById(slideId).querySelector("footer");if(notes){console.info(notes.innerHTML.replace(/\n\s+/g,"\n"))}if(nextSlideId){varnext=document.getElementById(nextSlideId).querySelector("h2");if(next){next=next.innerHTML.replace(/^\s+|<[^>]+>/g,"");console.info("NEXT: "+next)}}}};shower.getSlideHash=function(slideNumber){if(!shower._isNumber(slideNumber)){thrownewError("Gimme slide number as Number, baby!")}slideNumber=shower._normalizeSlideNumber(slideNumber);return"#"+slideList[slideNumber].id};shower.go=function(slideNumber,callback){if(!shower._isNumber(slideNumber)){thrownewError("Gimme slide number as Number, baby!")}url.hash=shower.getSlideHash(slideNumber);if(!shower.isListMode()){shower.updateProgress(slideNumber);shower.updateCurrentAndPassedSlides(slideNumber);shower.showPresenterNotes(slideNumber);if(typeofcallback==="function"){callback()}}returnslideNumber};shower.runSlideshowIfPresented=function(slideNumber){if(!shower._isNumber(slideNumber)){thrownewError("Gimme slide number as Number, baby!")}slideNumber=shower._normalizeSlideNumber(slideNumber);clearTimeout(timer);if(slideList[slideNumber].hasTiming){vartiming=shower._getData(document.getElementById(slideList[slideNumber].id),"timing").split(":");timing=parseInt(timing[0],10)*60*1e3+parseInt(timing[1],10)*1e3;timer=setTimeout(function(){shower.go(slideNumber+1);shower.runSlideshowIfPresented(slideNumber+1)},timing)}};shower.increaseInnerNavigation=function(slideNumber){varnextNodes,node,ret=-1;if(!shower._isNumber(slideNumber)){thrownewError("Gimme slide number as Number, baby!")}if(slideList[slideNumber].hasInnerNavigation){nextNodes=document.getElementById(slideList[slideNumber].id).querySelectorAll(".next:not(.active)");if(0!==nextNodes.length){node=nextNodes[0];node.classList.add("active");ret=nextNodes.length-1}}returnret};window.addEventListener("DOMContentLoaded",function(){if(!shower.isListMode()){if(-1===shower.getCurrentSlideNumber()){if(isHistoryApiSupported){history.replaceState(null,null,url.pathname+"?full"+shower.getSlideHash(0))}}shower.enterSlideMode();shower.updateProgress(shower.getCurrentSlideNumber());shower.updateCurrentAndPassedSlides(shower.getCurrentSlideNumber());shower.runSlideshowIfPresented(shower.getCurrentSlideNumber())}},false);window.addEventListener("popstate",function(e){if(shower.isListMode()){shower.enterListMode();shower.scrollToSlide(shower.getCurrentSlideNumber())}else{shower.enterSlideMode()}},false);window.addEventListener("resize",function(e){if(!shower.isListMode()){shower._applyTransform(shower._getTransform())}},false);document.addEventListener("keydown",function(e){if(e.altKey||e.ctrlKey||e.metaKey){return}varcurrentSlideNumber=shower.getCurrentSlideNumber(),innerNavigationCompleted=true;switch(e.which){case116:e.preventDefault();if(shower.isListMode()){varslideNumber=e.shiftKey?currentSlideNumber:0;shower.go(slideNumber);if(isHistoryApiSupported){history.pushState(null,null,url.pathname+"?full"+shower.getSlideHash(slideNumber))}shower.enterSlideMode();shower.updateProgress(slideNumber);shower.updateCurrentAndPassedSlides(slideNumber);shower.runSlideshowIfPresented(slideNumber)}else{if(isHistoryApiSupported){history.pushState(null,null,url.pathname+shower.getSlideHash(currentSlideNumber))}shower.enterListMode();shower.scrollToSlide(currentSlideNumber)}break;case13:if(shower.isListMode()&&-1!==currentSlideNumber){e.preventDefault();if(isHistoryApiSupported){history.pushState(null,null,url.pathname+"?full"+shower.getSlideHash(currentSlideNumber))}shower.enterSlideMode();shower.updateProgress(currentSlideNumber);shower.updateCurrentAndPassedSlides(currentSlideNumber);shower.runSlideshowIfPresented(currentSlideNumber)}break;case27:if(!shower.isListMode()){e.preventDefault();if(isHistoryApiSupported){history.pushState(null,null,url.pathname+shower.getSlideHash(currentSlideNumber))}shower.enterListMode();shower.scrollToSlide(currentSlideNumber)}break;case33:case38:case37:case72:case75:e.preventDefault();shower.previous();break;case34:case40:case39:case76:case74:e.preventDefault();if(!shower.isListMode()){innerNavigationCompleted=!slideList[currentSlideNumber].hasInnerNavigation||-1===shower.increaseInnerNavigation(currentSlideNumber)}else{innerNavigationCompleted=true}if(-1===currentSlideNumber||innerNavigationCompleted){currentSlideNumber++;shower.go(currentSlideNumber);if(!shower.isListMode()){shower.runSlideshowIfPresented(currentSlideNumber)}}break;case36:e.preventDefault();shower.first();break;case35:e.preventDefault();shower.last();break;case9:case32:e.preventDefault();shower[e.shiftKey?"previous":"next"]();break;default:}},false);document.addEventListener("click",shower._dispatchSingleSlideMode,false);document.addEventListener("touchend",shower._dispatchSingleSlideMode,false);document.addEventListener("touchstart",function(e){if(!shower.isListMode()){varcurrentSlideNumber=shower.getCurrentSlideNumber(),x=e.touches[0].pageX;if(x>window.innerWidth/2){currentSlideNumber++}else{currentSlideNumber--}shower.go(currentSlideNumber)}},false);document.addEventListener("touchmove",function(e){if(!shower.isListMode()){e.preventDefault()}},false);returnshower}(this,this.document);
\ No newline at end of file
/**
* Shower HTML presentation engine: github.com/shower/shower
* @license MIT license: github.com/shower/shower/wiki/MIT-License
*/
window.shower=function(window,document,undefined){varshower={},url=window.location,body=document.body,slides=document.querySelectorAll(".slide"),progress=document.querySelector("div.progress div"),slideList=[],timer,isHistoryApiSupported=!!(window.history&&history.pushState),l=slides.length,i;shower._getData=function(element,name){returnelement.dataset?element.dataset[name]:element.getAttribute("data-"+name)};for(i=0;i<l;i++){if(!slides[i].id){slides[i].id=i+1}slideList.push({id:slides[i].id,hasInnerNavigation:null!==slides[i].querySelector(".next"),hasTiming:shower._getData(slides[i],"timing")&&shower._getData(slides[i],"timing").indexOf(":")!==-1})}shower._getTransform=function(){vardenominator=Math.max(body.clientWidth/window.innerWidth,body.clientHeight/window.innerHeight);return"scale("+1/denominator+")"};shower._applyTransform=function(transform){body.style.WebkitTransform=transform;body.style.MozTransform=transform;body.style.msTransform=transform;body.style.OTransform=transform;body.style.transform=transform;returntrue};shower._isNumber=function(arg){if(!(!isNaN(parseFloat(arg))&&isFinite(arg))){returnfalse}returntrue};shower._normalizeSlideNumber=function(slideNumber){if(!shower._isNumber(slideNumber)){thrownewError("Gimme slide number as Number, baby!")}if(slideNumber<0){slideNumber=0}if(slideNumber>=slideList.length){slideNumber=slideList.length-1}returnslideNumber};shower._getSlideIdByEl=function(el){while("BODY"!==el.nodeName&&"HTML"!==el.nodeName){if(el.classList.contains("slide")){returnel.id}else{el=el.parentNode}}return""};shower._checkInteractiveElement=function(e){if("A"===e.target.nodeName){returntrue}else{returnfalse}};shower.getSlideNumber=function(slideId){vari=slideList.length-1,slideNumber;if(slideId===""){slideNumber=0}for(;i>=0;--i){if(slideId===slideList[i].id){slideNumber=i;break}}returnslideNumber};shower.next=function(callback){varcurrentSlideNumber=shower.getCurrentSlideNumber(),ret;if(-1===currentSlideNumber||!slideList[currentSlideNumber].hasInnerNavigation||-1===shower.increaseInnerNavigation(currentSlideNumber)){shower.go(currentSlideNumber+1);ret=currentSlideNumber+2;if(typeofcallback==="function"){callback()}}else{ret=false}returnret};shower.previous=function(callback){varcurrentSlideNumber=shower.getCurrentSlideNumber(),ret;if(currentSlideNumber>0){ret=currentSlideNumber;shower.go(currentSlideNumber-1);if(typeofcallback==="function"){callback()}}else{ret=false}returnret};shower.first=function(callback){if(typeofcallback==="function"){callback()}returnshower.go(0)};shower.last=function(callback){if(typeofcallback==="function"){callback()}returnshower.go(slideList.length-1)};shower.enterSlideMode=function(callback){varcurrentSlideNumber=shower.getCurrentSlideNumber();if(currentSlideNumber===-1){currentSlideNumber=0}shower.go(currentSlideNumber);shower.showPresenterNotes(currentSlideNumber);if(shower.isListMode()&&isHistoryApiSupported){history.pushState(null,null,url.pathname+"?full"+shower.getSlideHash(currentSlideNumber))}body.classList.remove("list");body.classList.add("full");if(window.console&&window.console.clear){console.clear()}shower.updateProgress(currentSlideNumber);shower.updateCurrentAndPassedSlides(currentSlideNumber);shower.runSlideshowIfPresented(currentSlideNumber);if(typeofcallback==="function"){callback()}returnshower._applyTransform(shower._getTransform())};shower.enterListMode=function(callback){varcurrentSlideNumber=shower.getCurrentSlideNumber();body.classList.remove("full");body.classList.add("list");if(shower.isSlideMode()&&isHistoryApiSupported){history.pushState(null,null,url.pathname+shower.getSlideHash(currentSlideNumber))}shower.scrollToSlide(currentSlideNumber);if(typeofcallback==="function"){callback()}returnshower._applyTransform("none")};shower.toggleMode=function(callback){if(shower.isListMode()){shower.enterSlideMode()}else{shower.enterListMode()}if(typeofcallback==="function"){callback()}returntrue};shower.getCurrentSlideNumber=function(){vari=slideList.length-1,currentSlideId=url.hash.substr(1);for(;i>=0;--i){if(currentSlideId===slideList[i].id){returni}}return-1};shower.scrollToSlide=function(slideNumber){varcurrentSlide,ret;if(!shower._isNumber(slideNumber)){thrownewError("Gimme slide number as Number, baby!")}if(shower.isSlideMode()){thrownewError("You can't scroll to because you in slide mode. Please, switch to list mode.")}if(-1===slideNumber){return}if(slideList[slideNumber]){currentSlide=document.getElementById(slideList[slideNumber].id);window.scrollTo(0,currentSlide.offsetTop);ret=true}else{thrownewError("There is no slide with number "+slideNumber)}returnret};shower.isListMode=function(){returnisHistoryApiSupported?!/^full.*/.test(url.search.substr(1)):body.classList.contains("list")};shower.isSlideMode=function(){returnisHistoryApiSupported?/^full.*/.test(url.search.substr(1)):body.classList.contains("full")};shower.updateProgress=function(slideNumber){if(null===progress){returnfalse}if(!shower._isNumber(slideNumber)){thrownewError("Gimme slide number as Number, baby!")}progress.style.width=(100/(slideList.length-1)*shower._normalizeSlideNumber(slideNumber)).toFixed(2)+"%";returntrue};shower.updateCurrentAndPassedSlides=function(slideNumber){vari,slide,l=slideList.length;slideNumber=shower._normalizeSlideNumber(slideNumber);if(!shower._isNumber(slideNumber)){thrownewError("Gimme slide number as Number, baby!")}for(i=0;i<l;++i){slide=document.getElementById(slideList[i].id);if(i<slideNumber){slide.classList.remove("current");slide.classList.add("passed")}elseif(i>slideNumber){slide.classList.remove("passed");slide.classList.remove("current")}else{slide.classList.remove("passed");slide.classList.add("current")}}returntrue};shower.showPresenterNotes=function(slideNumber){if(window.console){slideNumber=shower._normalizeSlideNumber(slideNumber);varslideId=slideList[slideNumber].id,nextSlideId=slideList[slideNumber+1]?slideList[slideNumber+1].id:null,notes=document.getElementById(slideId).querySelector("footer");if(notes){console.info(notes.innerHTML.replace(/\n\s+/g,"\n"))}if(nextSlideId){varnext=document.getElementById(nextSlideId).querySelector("h2");if(next){next=next.innerHTML.replace(/^\s+|<[^>]+>/g,"");console.info("NEXT: "+next)}}}};shower.getSlideHash=function(slideNumber){if(!shower._isNumber(slideNumber)){thrownewError("Gimme slide number as Number, baby!")}slideNumber=shower._normalizeSlideNumber(slideNumber);return"#"+slideList[slideNumber].id};shower.go=function(slideNumber,callback){if(!shower._isNumber(slideNumber)){thrownewError("Gimme slide number as Number, baby!")}url.hash=shower.getSlideHash(slideNumber);if(shower.isSlideMode()){shower.updateProgress(slideNumber);shower.updateCurrentAndPassedSlides(slideNumber);shower.showPresenterNotes(slideNumber);if(typeofcallback==="function"){callback()}}returnslideNumber};shower.runSlideshowIfPresented=function(slideNumber){if(!shower._isNumber(slideNumber)){thrownewError("Gimme slide number as Number, baby!")}slideNumber=shower._normalizeSlideNumber(slideNumber);clearTimeout(timer);if(slideList[slideNumber].hasTiming){vartiming=shower._getData(document.getElementById(slideList[slideNumber].id),"timing").split(":");timing=parseInt(timing[0],10)*60*1e3+parseInt(timing[1],10)*1e3;timer=setTimeout(function(){shower.go(slideNumber+1);shower.runSlideshowIfPresented(slideNumber+1)},timing)}};shower.increaseInnerNavigation=function(slideNumber){varnextNodes,node,ret=-1;if(!shower._isNumber(slideNumber)){thrownewError("Gimme slide number as Number, baby!")}if(slideList[slideNumber].hasInnerNavigation){nextNodes=document.getElementById(slideList[slideNumber].id).querySelectorAll(".next:not(.active)");if(0!==nextNodes.length){node=nextNodes[0];node.classList.add("active");ret=nextNodes.length-1}}returnret};window.addEventListener("DOMContentLoaded",function(){if(shower.isSlideMode()){shower.enterSlideMode()}},false);window.addEventListener("popstate",function(e){if(shower.isListMode()){shower.enterListMode()}else{shower.enterSlideMode()}},false);window.addEventListener("resize",function(e){if(shower.isSlideMode()){shower._applyTransform(shower._getTransform())}},false);document.addEventListener("keydown",function(e){if(e.altKey||e.ctrlKey||e.metaKey){return}varcurrentSlideNumber=shower.getCurrentSlideNumber(),innerNavigationCompleted=true;switch(e.which){case116:e.preventDefault();if(shower.isListMode()){varslideNumber=e.shiftKey?currentSlideNumber:0;shower.go(slideNumber);shower.enterSlideMode()}else{shower.enterListMode()}break;case13:if(shower.isListMode()&&-1!==currentSlideNumber){e.preventDefault();shower.enterSlideMode()}break;case27:if(shower.isSlideMode()){e.preventDefault();shower.enterListMode()}break;case33:case38:case37:case72:case75:e.preventDefault();shower.previous();break;case34:case40:case39:case76:case74:e.preventDefault();if(shower.isSlideMode()){innerNavigationCompleted=!slideList[currentSlideNumber].hasInnerNavigation||-1===shower.increaseInnerNavigation(currentSlideNumber)}else{innerNavigationCompleted=true}if(-1===currentSlideNumber||innerNavigationCompleted){currentSlideNumber++;shower.go(currentSlideNumber);if(shower.isSlideMode()){shower.runSlideshowIfPresented(currentSlideNumber)}}break;case36:e.preventDefault();shower.first();break;case35:e.preventDefault();shower.last();break;case9:case32:e.preventDefault();shower[e.shiftKey?"previous":"next"]();break;default:}},false);document.addEventListener("click",function(e){if(shower.isListMode()&&shower._getSlideIdByEl(e.target)){e.preventDefault();shower.go(shower.getSlideNumber(shower._getSlideIdByEl(e.target)));shower.enterSlideMode()}},false);document.addEventListener("touchstart",function(e){if(shower._getSlideIdByEl(e.target)){if(shower.isSlideMode()&&!shower._checkInteractiveElement(e)){varx=e.touches[0].pageX;if(x>window.innerWidth/2){shower.next()}else{shower.previous()}}if(shower.isListMode()){shower.go(shower.getSlideNumber(shower._getSlideIdByEl(e.target)));shower.enterSlideMode()}}},false);document.addEventListener("touchmove",function(e){if(shower.isSlideMode()){e.preventDefault()}},false);returnshower}(this,this.document);