From 0efa73d161621475f4ac796859dedf7c1d055fb8 Mon Sep 17 00:00:00 2001 From: Vadim Makeev Date: Mon, 21 Jan 2013 00:48:34 +0400 Subject: [PATCH] New uglifyjs options for minified version --- shower.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shower.min.js b/shower.min.js index d37ea0e..acee7d1 100644 --- a/shower.min.js +++ b/shower.min.js @@ -3,4 +3,4 @@ * @copyright 2010–2013 Vadim Makeev, pepelsbey.net * @license MIT license: github.com/shower/shower/wiki/MIT-License */ - window.shower=function(e,t,n){var r={},i=e.location,s=t.body,o=t.querySelectorAll(".slide"),u=t.querySelector("div.progress div"),a=[],f,l=!!e.history&&!!history.pushState,c=o.length,h;r._getData=function(e,t){return e.dataset?e.dataset[t]:e.getAttribute("data-"+t)};for(h=0;h=a.length&&(e=a.length-1),e},r._getSlideIdByEl=function(e){while("BODY"!==e.nodeName&&"HTML"!==e.nodeName){if(e.classList.contains("slide"))return e.id;e=e.parentNode}return""},r._checkInteractiveElement=function(e){return"A"===e.target.nodeName},r.getSlideNumber=function(e){var t=a.length-1,n;e===""&&(n=0);for(;t>=0;--t)if(e===a[t].id){n=t;break}return n},r.go=function(e,t){if(!r._isNumber(e))throw new Error("Gimme slide number as Number, baby!");return i.hash=r.getSlideHash(e),r.isSlideMode()&&(r.showPresenterNotes(e),r.updateProgress(e),r.updateCurrentAndPassedSlides(e),r.runInnerNavigation(e)),typeof t=="function"&&t(),e},r.next=function(e){var t=r.getCurrentSlideNumber(),n=!1;return(-1===t||!a[t].hasInnerNavigation||!r.increaseInnerNavigation(t))&&t+2<=a.length&&(r.go(t+1),n=t+2),r.isSlideMode()&&r.runInnerNavigation(t+1),typeof e=="function"&&e(),n},r.previous=function(e){var t=r.getCurrentSlideNumber(),n=!1;return t>0&&(n=t,r.go(t-1),typeof e=="function"&&e()),n},r.first=function(e){return typeof e=="function"&&e(),r.go(0)},r.last=function(e){return typeof e=="function"&&e(),r.go(a.length-1)},r.enterSlideMode=function(e){var t=r.getCurrentSlideNumber();return s.classList.remove("list"),s.classList.add("full"),r.isListMode()&&l&&history.pushState(null,null,i.pathname+"?full"+r.getSlideHash(t)),r._applyTransform(r._getTransform()),typeof e=="function"&&e(),!0},r.enterListMode=function(e){s.classList.remove("full"),s.classList.add("list"),r.clearPresenterNotes();if(r.isListMode())return!1;var t=r.getCurrentSlideNumber();return clearTimeout(f),r.isSlideMode()&&l&&history.pushState(null,null,i.pathname+r.getSlideHash(t)),r.scrollToSlide(t),r._applyTransform("none"),typeof e=="function"&&e(),!0},r.toggleMode=function(e){return r.isListMode()?r.enterSlideMode():r.enterListMode(),typeof e=="function"&&e(),!0},r.getCurrentSlideNumber=function(){var e=a.length-1,t=i.hash.substr(1);for(;e>=0;--e)if(t===a[e].id)return e;return-1},r.scrollToSlide=function(n){var i,s=!1;if(!r._isNumber(n))throw new Error("Gimme slide number as Number, baby!");if(r.isSlideMode())throw new Error("You can't scroll to because you in slide mode. Please, switch to list mode.");if(-1===n)return s;if(!a[n])throw new Error("There is no slide with number "+n);return i=t.getElementById(a[n].id),e.scrollTo(0,i.offsetTop),s=!0,s},r.isListMode=function(){return l?!/^full.*/.test(i.search.substr(1)):s.classList.contains("list")},r.isSlideMode=function(){return l?/^full.*/.test(i.search.substr(1)):s.classList.contains("full")},r.updateProgress=function(e){if(null===u)return!1;if(!r._isNumber(e))throw new Error("Gimme slide number as Number, baby!");return u.style.width=(100/(a.length-1)*r._normalizeSlideNumber(e)).toFixed(2)+"%",!0},r.updateCurrentAndPassedSlides=function(e){var n,i,s=a.length;e=r._normalizeSlideNumber(e);if(!r._isNumber(e))throw new Error("Gimme slide number as Number, baby!");for(n=0;ne?(i.classList.remove("visited"),i.classList.remove("active")):(i.classList.remove("visited"),i.classList.add("active"));return!0},r.clearPresenterNotes=function(){e.console&&e.console.clear&&console.clear()},r.showPresenterNotes=function(n){r.clearPresenterNotes();if(e.console){n=r._normalizeSlideNumber(n);var i=a[n].id,s=a[n+1]?a[n+1].id:null,o=t.getElementById(i).querySelector("footer");o&&o.innerHTML&&console.info(o.innerHTML.replace(/\n\s+/g,"\n"));if(s){var u=t.getElementById(s).querySelector("h2");u&&(u=u.innerHTML.replace(/^\s+|<[^>]+>/g,""),console.info("NEXT: "+u))}}},r.getSlideHash=function(e){if(!r._isNumber(e))throw new Error("Gimme slide number as Number, baby!");return e=r._normalizeSlideNumber(e),"#"+a[e].id},r.runInnerNavigation=function(e){if(!r._isNumber(e))throw new Error("Gimme slide number as Number, baby!");e=r._normalizeSlideNumber(e),clearTimeout(f);if(a[e].hasTiming){var n=r._getData(t.getElementById(a[e].id),"timing").split(":");n=parseInt(n[0],10)*60*1e3+parseInt(n[1],10)*1e3,f=setTimeout(function(){r.next()},n)}return!0},r.increaseInnerNavigation=function(e){var n,i;if(!r._isNumber(e))throw new Error("Gimme slide number as Number, baby!");if(a[e].hasInnerNavigation){n=t.getElementById(a[e].id).querySelectorAll(".next:not(.active)");if(0!==n.length)return i=n[0],i.classList.add("active"),!0}return!1},e.addEventListener("DOMContentLoaded",function(){if(s.classList.contains("full")||r.isSlideMode())r.go(r.getCurrentSlideNumber()),r.enterSlideMode()},!1),e.addEventListener("popstate",function(){r.isListMode()?r.enterListMode():r.enterSlideMode()},!1),e.addEventListener("resize",function(){r.isSlideMode()&&r._applyTransform(r._getTransform())},!1),t.addEventListener("keydown",function(e){if(e.altKey||e.ctrlKey||e.metaKey)return;var t=r.getCurrentSlideNumber(),n=!0;switch(e.which){case 116:e.preventDefault();if(r.isListMode()){var i=e.shiftKey?t:0;r.go(i),r.enterSlideMode(),r.showPresenterNotes(i)}else r.enterListMode();break;case 13:r.isListMode()&&-1!==t&&(e.preventDefault(),r.enterSlideMode());break;case 27:r.isSlideMode()&&(e.preventDefault(),r.enterListMode());break;case 33:case 38:case 37:case 72:case 75:e.preventDefault(),r.previous();break;case 34:case 40:case 39:case 76:case 74:e.preventDefault(),r.next();break;case 36:e.preventDefault(),r.first();break;case 35:e.preventDefault(),r.last();break;case 9:case 32:e.preventDefault(),r[e.shiftKey?"previous":"next"]();break;default:}},!1),t.addEventListener("click",function(e){e.preventDefault();var t=r.getSlideNumber(r._getSlideIdByEl(e.target));r.isListMode()&&r._getSlideIdByEl(e.target)&&(r.go(t),r.enterSlideMode(),r.showPresenterNotes(t))},!1),t.addEventListener("touchstart",function(t){if(r._getSlideIdByEl(t.target)){if(r.isSlideMode()&&!r._checkInteractiveElement(t)){var n=t.touches[0].pageX;n>e.innerWidth/2?r.next():r.previous()}r.isListMode()&&(r.go(r.getSlideNumber(r._getSlideIdByEl(t.target))),r.enterSlideMode())}},!1),t.addEventListener("touchmove",function(e){r.isSlideMode()&&e.preventDefault()},!1),r}(this,this.document); \ No newline at end of file +window.shower=function(e,t,r){var i={},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){return e.dataset?e.dataset[t]:e.getAttribute("data-"+t)};for(c=0;c=l.length){e=l.length-1}return e};i._getSlideIdByEl=function(e){while("BODY"!==e.nodeName&&"HTML"!==e.nodeName){if(e.classList.contains("slide")){return e.id}else{e=e.parentNode}}return""};i._checkInteractiveElement=function(e){return"A"===e.target.nodeName};i.getSlideNumber=function(e){var t=l.length-1,r;if(e===""){r=0}for(;t>=0;--t){if(e===l[t].id){r=t;break}}return r};i.go=function(e,t){if(!i._isNumber(e)){throw new Error("Gimme slide number as Number, baby!")}n.hash=i.getSlideHash(e);if(i.isSlideMode()){i.showPresenterNotes(e);i.updateProgress(e);i.updateCurrentAndPassedSlides(e);i.runInnerNavigation(e)}if(typeof t==="function"){t()}return e};i.next=function(e){var t=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(typeof e==="function"){e()}return r};i.previous=function(e){var t=i.getCurrentSlideNumber(),r=false;if(t>0){r=t;i.go(t-1);if(typeof e==="function"){e()}}return r};i.first=function(e){if(typeof e==="function"){e()}return i.go(0)};i.last=function(e){if(typeof e==="function"){e()}return i.go(l.length-1)};i.enterSlideMode=function(e){var t=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(typeof e==="function"){e()}return true};i.enterListMode=function(e){s.classList.remove("full");s.classList.add("list");i.clearPresenterNotes();if(i.isListMode()){return false}var t=i.getCurrentSlideNumber();clearTimeout(u);if(i.isSlideMode()&&d){history.pushState(null,null,n.pathname+i.getSlideHash(t))}i.scrollToSlide(t);i._applyTransform("none");if(typeof e==="function"){e()}return true};i.toggleMode=function(e){if(i.isListMode()){i.enterSlideMode()}else{i.enterListMode()}if(typeof e==="function"){e()}return true};i.getCurrentSlideNumber=function(){var e=l.length-1,t=n.hash.substr(1);for(;e>=0;--e){if(t===l[e].id){return e}}return-1};i.scrollToSlide=function(r){var n,s=false;if(!i._isNumber(r)){throw new Error("Gimme slide number as Number, baby!")}if(i.isSlideMode()){throw new Error("You can't scroll to because you in slide mode. Please, switch to list mode.")}if(-1===r){return s}if(l[r]){n=t.getElementById(l[r].id);e.scrollTo(0,n.offsetTop);s=true}else{throw new Error("There is no slide with number "+r)}return s};i.isListMode=function(){return d?!/^full.*/.test(n.search.substr(1)):s.classList.contains("list")};i.isSlideMode=function(){return d?/^full.*/.test(n.search.substr(1)):s.classList.contains("full")};i.updateProgress=function(e){if(null===a){return false}if(!i._isNumber(e)){throw new Error("Gimme slide number as Number, baby!")}a.style.width=(100/(l.length-1)*i._normalizeSlideNumber(e)).toFixed(2)+"%";return true};i.updateCurrentAndPassedSlides=function(e){var r,n,s=l.length;e=i._normalizeSlideNumber(e);if(!i._isNumber(e)){throw new Error("Gimme slide number as Number, baby!")}for(r=0;re){n.classList.remove("visited");n.classList.remove("active")}else{n.classList.remove("visited");n.classList.add("active")}}return true};i.clearPresenterNotes=function(){if(e.console&&e.console.clear){console.clear()}};i.showPresenterNotes=function(r){i.clearPresenterNotes();if(e.console){r=i._normalizeSlideNumber(r);var n=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){var a=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)){throw new Error("Gimme slide number as Number, baby!")}e=i._normalizeSlideNumber(e);return"#"+l[e].id};i.runInnerNavigation=function(e){if(!i._isNumber(e)){throw new Error("Gimme slide number as Number, baby!")}e=i._normalizeSlideNumber(e);clearTimeout(u);if(l[e].hasTiming){var r=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)}return true};i.increaseInnerNavigation=function(e){var r,n;if(!i._isNumber(e)){throw new Error("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");return true}}return false};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}var t=i.getCurrentSlideNumber(),r=true;switch(e.which){case 116:e.preventDefault();if(i.isListMode()){var n=e.shiftKey?t:0;i.go(n);i.enterSlideMode();i.showPresenterNotes(n)}else{i.enterListMode()}break;case 13:if(i.isListMode()&&-1!==t){e.preventDefault();i.enterSlideMode()}break;case 27:if(i.isSlideMode()){e.preventDefault();i.enterListMode()}break;case 33:case 38:case 37:case 72:case 75:e.preventDefault();i.previous();break;case 34:case 40:case 39:case 76:case 74:e.preventDefault();i.next();break;case 36:e.preventDefault();i.first();break;case 35:e.preventDefault();i.last();break;case 9:case 32:e.preventDefault();i[e.shiftKey?"previous":"next"]();break;default:}},false);t.addEventListener("click",function(e){e.preventDefault();var t=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)){var r=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);return i}(this,this.document); \ No newline at end of file