From 495cb98005686748d3c923273b1061837c0756ee Mon Sep 17 00:00:00 2001 From: Sinetheta Date: Thu, 30 Aug 2012 14:30:29 -0700 Subject: [PATCH] changed theme file swap to be relative to theme file instead of slide-deck --- js/reveal.js | 13 +++++---- js/reveal.min.js | 70 +++--------------------------------------------- 2 files changed, 11 insertions(+), 72 deletions(-) diff --git a/js/reveal.js b/js/reveal.js index 593c32d..1943e15 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -1,5 +1,5 @@ /*! - * reveal.js 2.0 r21 + * reveal.js 2.0 r22 * http://lab.hakim.se/reveal-js * MIT licensed * @@ -228,12 +228,16 @@ var Reveal = (function(){ // Load the theme in the config, if it's not already loaded if( config.theme && dom.theme ) { - var themeURL = 'css/theme/' + config.theme + '.css'; - if( dom.theme.getAttribute( 'href' ) !== themeURL ) { + var themeURL = dom.theme.getAttribute( 'href' ); + var themeFinder = /[^/]*?(?=\.css)/; + var themeName = themeURL.match(themeFinder)[0]; + if( config.theme !== themeName ) { + themeURL = themeURL.replace(themeFinder, config.theme); dom.theme.setAttribute( 'href', themeURL ); } } + if( config.transition !== 'default' ) { dom.wrapper.classList.add( config.transition ); } @@ -1142,5 +1146,4 @@ var Reveal = (function(){ } }; -})(); - +})(); \ No newline at end of file diff --git a/js/reveal.min.js b/js/reveal.min.js index a8161bf..e660f78 100644 --- a/js/reveal.min.js +++ b/js/reveal.min.js @@ -1,72 +1,8 @@ /*! - * reveal.js 2.0 r21 + * reveal.js 2.0 r22 * http://lab.hakim.se/reveal-js * MIT licensed - * + * * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se */ -var Reveal=(function(){var k=".reveal .slides>section",b=".reveal .slides>section.present>section",e=!!("ontouchstart" in window),N={controls:true,progress:true,history:false,keyboard:true,loop:false,autoSlide:0,mouseWheel:true,rollingLinks:true,theme:"default",transition:"default",dependencies:[]},l=0,c=0,w,E,ac=[],d={},P="WebkitPerspective" in document.body.style||"MozPerspective" in document.body.style||"msPerspective" in document.body.style||"OPerspective" in document.body.style||"perspective" in document.body.style,m="WebkitTransform" in document.body.style||"MozTransform" in document.body.style||"msTransform" in document.body.style||"OTransform" in document.body.style||"transform" in document.body.style,x=0,j=0,B=0,W={startX:0,startY:0,startSpan:0,startCount:0,handled:false,threshold:40}; -function h(ad){if((!m&&!P)){document.body.setAttribute("class","no-transforms");return;}r(N,ad);d.theme=document.querySelector("#theme");d.wrapper=document.querySelector(".reveal"); -d.progress=document.querySelector(".reveal .progress");d.progressbar=document.querySelector(".reveal .progress span");if(N.controls){d.controls=document.querySelector(".reveal .controls"); -d.controlsLeft=document.querySelector(".reveal .controls .left");d.controlsRight=document.querySelector(".reveal .controls .right");d.controlsUp=document.querySelector(".reveal .controls .up"); -d.controlsDown=document.querySelector(".reveal .controls .down");}R();if(navigator.userAgent.match(/(iphone|ipod|android)/i)){document.documentElement.style.overflow="scroll"; -document.body.style.height="120%";window.addEventListener("load",X,false);window.addEventListener("orientationchange",X,false);}}function R(){var ae=[],ai=[]; -for(var af=0,ad=N.dependencies.length;afW.threshold){W.handled=true;if(ahW.threshold&&Math.abs(ae)>Math.abs(ad)){W.handled=true;z();}else{if(ae<-W.threshold&&Math.abs(ae)>Math.abs(ad)){W.handled=true;i();}else{if(ad>W.threshold){W.handled=true; -s();}else{if(ad<-W.threshold){W.handled=true;D();}}}}}}ai.preventDefault();}}function S(ad){W.handled=false;}function n(ad){clearTimeout(x);x=setTimeout(function(){var ae=ad.detail||-ad.wheelDelta; -if(ae>0){v();}else{U();}},100);}function u(ad){H();}function J(){if(P&&!("msPerspective" in document.body.style)){var ae=document.querySelectorAll(".reveal .slides section a:not(.image)"); -for(var af=0,ad=ae.length;af'+ag.innerHTML+"";}}}}function G(){d.wrapper.classList.add("overview");var ad=Array.prototype.slice.call(document.querySelectorAll(k)); -for(var ai=0,ag=ad.length;ai3?"none":"block";}ai[ah].classList.remove("past");ai[ah].classList.remove("present");ai[ah].classList.remove("future");if(ahag){ai[ah].classList.add("future");}}if(ad.querySelector("section")){ai[ah].classList.add("stack");}}ai[ag].classList.add("present");var af=ai[ag].getAttribute("data-state"); -if(af){ac=ac.concat(af.split(" "));}}else{ag=0;}return ag;}function a(aj,an){w=E;var ag=ac.concat();ac.length=0;var am=l,ae=c;l=ab(k,aj===undefined?l:aj); -c=ab(b,an===undefined?c:an);stateLoop:for(var ah=0,ak=ac.length;ah0,right:l0,down:c0||c>0){ad+=l;}if(c>0){ad+="/"+c;}window.location.hash=ad;}}function p(ae,ad){var af=document.createEvent("HTMLEvents",1,2);af.initEvent(ae,true,true); -r(af,ad);d.wrapper.dispatchEvent(af);}function t(){if(document.querySelector(b+".present")){var ae=document.querySelectorAll(b+".present .fragment:not(.visible)"); -if(ae.length){ae[0].classList.add("visible");p("fragmentshown",{fragment:ae[0]});return true;}}else{var ad=document.querySelectorAll(k+".present .fragment:not(.visible)"); -if(ad.length){ad[0].classList.add("visible");p("fragmentshown",{fragment:ad[0]});return true;}}return false;}function M(){if(document.querySelector(b+".present")){var ae=document.querySelectorAll(b+".present .fragment.visible"); -if(ae.length){ae[ae.length-1].classList.remove("visible");p("fragmenthidden",{fragment:ae[ae.length-1]});return true;}}else{var ad=document.querySelectorAll(k+".present .fragment.visible"); -if(ad.length){ad[ad.length-1].classList.remove("visible");p("fragmenthidden",{fragment:ad[ad.length-1]});return true;}}return false;}function K(){clearTimeout(j); -if(N.autoSlide){j=setTimeout(v,N.autoSlide);}}function L(ae,ad){a(ae,ad);}function z(){if(V()||M()===false){a(l-1,0);}}function i(){if(V()||t()===false){a(l+1,0); -}}function s(){if(V()||M()===false){a(l,c-1);}}function D(){if(V()||t()===false){a(l,c+1);}}function U(){if(M()===false){if(f().up){s();}else{var ad=document.querySelector(".reveal .slides>section.past:nth-child("+l+")"); -if(ad){c=(ad.querySelectorAll("section").length+1)||0;l--;a();}}}}function v(){if(t()===false){f().down?D():i();}K();}function T(){if(V()){Y();}else{G(); -}}return{initialize:h,navigateTo:L,navigateLeft:z,navigateRight:i,navigateUp:s,navigateDown:D,navigatePrev:U,navigateNext:v,toggleOverview:T,addEventListeners:C,removeEventListeners:Q,getIndices:function(ad){var ah=l,af=c; -if(ad){var ai=!!ad.parentNode.nodeName.match(/section/gi);var ag=ai?ad.parentNode:ad;var ae=Array.prototype.slice.call(document.querySelectorAll(k));ah=Math.max(ae.indexOf(ag),0); -if(ai){af=Math.max(Array.prototype.slice.call(ad.parentNode.children).indexOf(ad),0);}}return{h:ah,v:af};},getPreviousSlide:function(){return w;},getCurrentSlide:function(){return E; -},getQueryHash:function(){var ad={};location.search.replace(/[A-Z0-9]+?=(\w*)/gi,function(ae){ad[ae.split("=").shift()]=ae.split("=").pop();});return ad; -},addEventListener:function(ae,af,ad){if("addEventListener" in window){(d.wrapper||document.querySelector(".reveal")).addEventListener(ae,af,ad);}},removeEventListener:function(ae,af,ad){if("addEventListener" in window){(d.wrapper||document.querySelector(".reveal")).removeEventListener(ae,af,ad); -}}};})(); \ No newline at end of file +var Reveal=(function(){var k=".reveal .slides>section",b=".reveal .slides>section.present>section",e=!!("ontouchstart" in window),N={controls:true,progress:true,history:false,keyboard:true,loop:false,autoSlide:0,mouseWheel:true,rollingLinks:true,theme:"default",transition:"default",dependencies:[]},l=0,c=0,w,E,ac=[],d={},P="WebkitPerspective" in document.body.style||"MozPerspective" in document.body.style||"msPerspective" in document.body.style||"OPerspective" in document.body.style||"perspective" in document.body.style,m="WebkitTransform" in document.body.style||"MozTransform" in document.body.style||"msTransform" in document.body.style||"OTransform" in document.body.style||"transform" in document.body.style,x=0,j=0,B=0,W={startX:0,startY:0,startSpan:0,startCount:0,handled:false,threshold:40};function h(ad){if((!m&&!P)){document.body.setAttribute("class","no-transforms");return}r(N,ad);d.theme=document.querySelector("#theme");d.wrapper=document.querySelector(".reveal");d.progress=document.querySelector(".reveal .progress");d.progressbar=document.querySelector(".reveal .progress span");if(N.controls){d.controls=document.querySelector(".reveal .controls");d.controlsLeft=document.querySelector(".reveal .controls .left");d.controlsRight=document.querySelector(".reveal .controls .right");d.controlsUp=document.querySelector(".reveal .controls .up");d.controlsDown=document.querySelector(".reveal .controls .down")}R();if(navigator.userAgent.match(/(iphone|ipod|android)/i)){document.documentElement.style.overflow="scroll";document.body.style.height="120%";window.addEventListener("load",X,false);window.addEventListener("orientationchange",X,false)}}function R(){var ae=[],ai=[];for(var af=0,ad=N.dependencies.length;afW.threshold){W.handled=true;if(ahW.threshold&&Math.abs(ae)>Math.abs(ad)){W.handled=true;z()}else{if(ae<-W.threshold&&Math.abs(ae)>Math.abs(ad)){W.handled=true;i()}else{if(ad>W.threshold){W.handled=true;s()}else{if(ad<-W.threshold){W.handled=true;D()}}}}}}ai.preventDefault()}}function S(ad){W.handled=false}function n(ad){clearTimeout(x);x=setTimeout(function(){var ae=ad.detail||-ad.wheelDelta;if(ae>0){v()}else{U()}},100)}function u(ad){H()}function J(){if(P&&!("msPerspective" in document.body.style)){var ae=document.querySelectorAll(".reveal .slides section a:not(.image)");for(var af=0,ad=ae.length;af'+ag.innerHTML+""}}}}function G(){d.wrapper.classList.add("overview");var ad=Array.prototype.slice.call(document.querySelectorAll(k));for(var ai=0,ag=ad.length;ai3?"none":"block"}ai[ah].classList.remove("past");ai[ah].classList.remove("present");ai[ah].classList.remove("future");if(ahag){ai[ah].classList.add("future")}}if(ad.querySelector("section")){ai[ah].classList.add("stack")}}ai[ag].classList.add("present");var af=ai[ag].getAttribute("data-state");if(af){ac=ac.concat(af.split(" "))}}else{ag=0}return ag}function a(aj,an){w=E;var ag=ac.concat();ac.length=0;var am=l,ae=c;l=ab(k,aj===undefined?l:aj);c=ab(b,an===undefined?c:an);stateLoop:for(var ah=0,ak=ac.length;ah0,right:l0,down:c0||c>0){ad+=l}if(c>0){ad+="/"+c}window.location.hash=ad}}function p(ae,ad){var af=document.createEvent("HTMLEvents",1,2);af.initEvent(ae,true,true);r(af,ad);d.wrapper.dispatchEvent(af)}function t(){if(document.querySelector(b+".present")){var ae=document.querySelectorAll(b+".present .fragment:not(.visible)");if(ae.length){ae[0].classList.add("visible");p("fragmentshown",{fragment:ae[0]});return true}}else{var ad=document.querySelectorAll(k+".present .fragment:not(.visible)");if(ad.length){ad[0].classList.add("visible");p("fragmentshown",{fragment:ad[0]});return true}}return false}function M(){if(document.querySelector(b+".present")){var ae=document.querySelectorAll(b+".present .fragment.visible");if(ae.length){ae[ae.length-1].classList.remove("visible");p("fragmenthidden",{fragment:ae[ae.length-1]});return true}}else{var ad=document.querySelectorAll(k+".present .fragment.visible");if(ad.length){ad[ad.length-1].classList.remove("visible");p("fragmenthidden",{fragment:ad[ad.length-1]});return true}}return false}function K(){clearTimeout(j);if(N.autoSlide){j=setTimeout(v,N.autoSlide)}}function L(ae,ad){a(ae,ad)}function z(){if(V()||M()===false){a(l-1,0)}}function i(){if(V()||t()===false){a(l+1,0)}}function s(){if(V()||M()===false){a(l,c-1)}}function D(){if(V()||t()===false){a(l,c+1)}}function U(){if(M()===false){if(f().up){s()}else{var ad=document.querySelector(".reveal .slides>section.past:nth-child("+l+")");if(ad){c=(ad.querySelectorAll("section").length+1)||0;l--;a()}}}}function v(){if(t()===false){f().down?D():i()}K()}function T(){if(V()){Y()}else{G()}}return{initialize:h,navigateTo:L,navigateLeft:z,navigateRight:i,navigateUp:s,navigateDown:D,navigatePrev:U,navigateNext:v,toggleOverview:T,addEventListeners:C,removeEventListeners:Q,getIndices:function(ad){var ah=l,af=c;if(ad){var ai=!!ad.parentNode.nodeName.match(/section/gi);var ag=ai?ad.parentNode:ad;var ae=Array.prototype.slice.call(document.querySelectorAll(k));ah=Math.max(ae.indexOf(ag),0);if(ai){af=Math.max(Array.prototype.slice.call(ad.parentNode.children).indexOf(ad),0)}}return{h:ah,v:af}},getPreviousSlide:function(){return w},getCurrentSlide:function(){return E},getQueryHash:function(){var ad={};location.search.replace(/[A-Z0-9]+?=(\w*)/gi,function(ae){ad[ae.split("=").shift()]=ae.split("=").pop()});return ad},addEventListener:function(ae,af,ad){if("addEventListener" in window){(d.wrapper||document.querySelector(".reveal")).addEventListener(ae,af,ad)}},removeEventListener:function(ae,af,ad){if("addEventListener" in window){(d.wrapper||document.querySelector(".reveal")).removeEventListener(ae,af,ad)}}}})(); \ No newline at end of file