aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Bidelman2012-04-16 12:04:03 -0700
committerEric Bidelman2012-04-16 12:04:03 -0700
commit32f207b326a2138c14e0502fcd58c5c3457cde35 (patch)
tree5231a40fb221a0fd3118eb18efb768e386da7c83
parent04153b7c8a3332c8008408227f6d71b8ef392c35 (diff)
downloadio-slides-remote-32f207b326a2138c14e0502fcd58c5c3457cde35.tar.gz
mobile tweaks. Modernizr touch detection
-rw-r--r--js/modernizr.custom.76029.js4
-rw-r--r--js/slides.js3
-rw-r--r--js/touch.js61
-rw-r--r--template.html2
-rw-r--r--theme/css/default.css101
-rw-r--r--theme/css/phone.css8
-rw-r--r--theme/sass/default.scss10
-rw-r--r--theme/sass/phone.scss8
8 files changed, 76 insertions, 121 deletions
diff --git a/js/modernizr.custom.76029.js b/js/modernizr.custom.76029.js
new file mode 100644
index 0000000..6604275
--- /dev/null
+++ b/js/modernizr.custom.76029.js
@@ -0,0 +1,4 @@
1/* Modernizr 2.5.3 (Custom Build) | MIT & BSD
2 * Build: http://www.modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-flexbox_legacy-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes
3 */
4;window.Modernizr=function(a,b,c){function B(a){i.cssText=a}function C(a,b){return B(m.join(a+";")+(b||""))}function D(a,b){return typeof a===b}function E(a,b){return!!~(""+a).indexOf(b)}function F(a,b){for(var d in a)if(i[a[d]]!==c)return b=="pfx"?a[d]:!0;return!1}function G(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:D(f,"function")?f.bind(d||b):f}return!1}function H(a,b,c){var d=a.charAt(0).toUpperCase()+a.substr(1),e=(a+" "+o.join(d+" ")+d).split(" ");return D(b,"string")||D(b,"undefined")?F(e,b):(e=(a+" "+p.join(d+" ")+d).split(" "),G(e,b,c))}function J(){e.input=function(c){for(var d=0,e=c.length;d<e;d++)t[c[d]]=c[d]in j;return t.list&&(t.list=!!b.createElement("datalist")&&!!a.HTMLDataListElement),t}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")),e.inputtypes=function(a){for(var d=0,e,g,h,i=a.length;d<i;d++)j.setAttribute("type",g=a[d]),e=j.type!=="text",e&&(j.value=k,j.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(g)&&j.style.WebkitAppearance!==c?(f.appendChild(j),h=b.defaultView,e=h.getComputedStyle&&h.getComputedStyle(j,null).WebkitAppearance!=="textfield"&&j.offsetHeight!==0,f.removeChild(j)):/^(search|tel)$/.test(g)||(/^(url|email)$/.test(g)?e=j.checkValidity&&j.checkValidity()===!1:/^color$/.test(g)?(f.appendChild(j),f.offsetWidth,e=j.value!=k,f.removeChild(j)):e=j.value!=k)),s[a[d]]=!!e;return s}("search tel url email datetime date month week time datetime-local number range color".split(" "))}var d="2.5.3",e={},f=b.documentElement,g="modernizr",h=b.createElement(g),i=h.style,j=b.createElement("input"),k=":)",l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n="Webkit Moz O ms",o=n.split(" "),p=n.toLowerCase().split(" "),q={svg:"http://www.w3.org/2000/svg"},r={},s={},t={},u=[],v=u.slice,w,x=function(a,c,d,e){var h,i,j,k=b.createElement("div"),l=b.body,m=l?l:b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:g+(d+1),k.appendChild(j);return h=["&#173;","<style>",a,"</style>"].join(""),k.id=g,(l?k:m).innerHTML+=h,m.appendChild(k),l||(m.style.background="",f.appendChild(m)),i=c(k,a),l?k.parentNode.removeChild(k):m.parentNode.removeChild(m),!!i},y=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=D(e[d],"function"),D(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),z={}.hasOwnProperty,A;!D(z,"undefined")&&!D(z.call,"undefined")?A=function(a,b){return z.call(a,b)}:A=function(a,b){return b in a&&D(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=v.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(v.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(v.call(arguments)))};return e});var I=function(c,d){var f=c.join(""),g=d.length;x(f,function(c,d){var f=b.styleSheets[b.styleSheets.length-1],h=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"",i=c.childNodes,j={};while(g--)j[i[g].id]=i[g];e.touch="ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch||(j.touch&&j.touch.offsetTop)===9,e.csstransforms3d=(j.csstransforms3d&&j.csstransforms3d.offsetLeft)===9&&j.csstransforms3d.offsetHeight===3,e.generatedcontent=(j.generatedcontent&&j.generatedcontent.offsetHeight)>=1,e.fontface=/src/i.test(h)&&h.indexOf(d.split(" ")[0])===0},g,d)}(['@font-face {font-family:"font";src:url("https://")}',["@media (",m.join("touch-enabled),("),g,")","{#touch{top:9px;position:absolute}}"].join(""),["@media (",m.join("transform-3d),("),g,")","{#csstransforms3d{left:9px;position:absolute;height:3px;}}"].join(""),['#generatedcontent:after{content:"',k,'";visibility:hidden}'].join("")],["fontface","touch","csstransforms3d","generatedcontent"]);r.flexbox=function(){return H("flexOrder")},r["flexbox-legacy"]=function(){return H("boxDirection")},r.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},r.canvastext=function(){return!!e.canvas&&!!D(b.createElement("canvas").getContext("2d").fillText,"function")},r.webgl=function(){try{var d=b.createElement("canvas"),e;e=!(!a.WebGLRenderingContext||!d.getContext("experimental-webgl")&&!d.getContext("webgl")),d=c}catch(f){e=!1}return e},r.touch=function(){return e.touch},r.geolocation=function(){return!!navigator.geolocation},r.postmessage=function(){return!!a.postMessage},r.websqldatabase=function(){return!!a.openDatabase},r.indexedDB=function(){return!!H("indexedDB",a)},r.hashchange=function(){return y("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},r.history=function(){return!!a.history&&!!history.pushState},r.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},r.websockets=function(){for(var b=-1,c=o.length;++b<c;)if(a[o[b]+"WebSocket"])return!0;return"WebSocket"in a},r.rgba=function(){return B("background-color:rgba(150,255,150,.5)"),E(i.backgroundColor,"rgba")},r.hsla=function(){return B("background-color:hsla(120,40%,100%,.5)"),E(i.backgroundColor,"rgba")||E(i.backgroundColor,"hsla")},r.multiplebgs=function(){return B("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(i.background)},r.backgroundsize=function(){return H("backgroundSize")},r.borderimage=function(){return H("borderImage")},r.borderradius=function(){return H("borderRadius")},r.boxshadow=function(){return H("boxShadow")},r.textshadow=function(){return b.createElement("div").style.textShadow===""},r.opacity=function(){return C("opacity:.55"),/^0.55$/.test(i.opacity)},r.cssanimations=function(){return H("animationName")},r.csscolumns=function(){return H("columnCount")},r.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return B((a+"-webkit- ".split(" ").join(b+a)+m.join(c+a)).slice(0,-a.length)),E(i.backgroundImage,"gradient")},r.cssreflections=function(){return H("boxReflect")},r.csstransforms=function(){return!!H("transform")},r.csstransforms3d=function(){var a=!!H("perspective");return a&&"webkitPerspective"in f.style&&(a=e.csstransforms3d),a},r.csstransitions=function(){return H("transition")},r.fontface=function(){return e.fontface},r.generatedcontent=function(){return e.generatedcontent},r.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},r.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c},r.localstorage=function(){try{return localStorage.setItem(g,g),localStorage.removeItem(g),!0}catch(a){return!1}},r.sessionstorage=function(){try{return sessionStorage.setItem(g,g),sessionStorage.removeItem(g),!0}catch(a){return!1}},r.webworkers=function(){return!!a.Worker},r.applicationcache=function(){return!!a.applicationCache},r.svg=function(){return!!b.createElementNS&&!!b.createElementNS(q.svg,"svg").createSVGRect},r.inlinesvg=function(){var a=b.createElement("div");return a.innerHTML="<svg/>",(a.firstChild&&a.firstChild.namespaceURI)==q.svg},r.smil=function(){return!!b.createElementNS&&/SVGAnimate/.test(l.call(b.createElementNS(q.svg,"animate")))},r.svgclippaths=function(){return!!b.createElementNS&&/SVGClipPath/.test(l.call(b.createElementNS(q.svg,"clipPath")))};for(var K in r)A(r,K)&&(w=K.toLowerCase(),e[w]=r[K](),u.push((e[w]?"":"no-")+w));return e.input||J(),B(""),h=j=null,e._version=d,e._prefixes=m,e._domPrefixes=p,e._cssomPrefixes=o,e.hasEvent=y,e.testProp=function(a){return F([a])},e.testAllProps=H,e.testStyles=x,e}(this,this.document); \ No newline at end of file
diff --git a/js/slides.js b/js/slides.js
index a28fd55..c970ddb 100644
--- a/js/slides.js
+++ b/js/slides.js
@@ -265,7 +265,8 @@ SlideDeck.prototype.loadConfig_ = function(config) {
265 slides.appendChild(el); 265 slides.appendChild(el);
266 } 266 }
267 267
268 if (!!!('enableTouch' in settings) || settings.enableTouch) { 268 if (Modernizr.touch && (!!!('enableTouch' in settings) ||
269 settings.enableTouch)) {
269 var self = this; 270 var self = this;
270 271
271 var hammer = new Hammer(slides); 272 var hammer = new Hammer(slides);
diff --git a/js/touch.js b/js/touch.js
deleted file mode 100644
index e0519e6..0000000
--- a/js/touch.js
+++ /dev/null
@@ -1,61 +0,0 @@
1/* Touch events */
2(function(exports) {
3var PM_TOUCH_SENSITIVITY = 15;
4var touchDX;
5var touchDY;
6var touchStartX;
7var touchStartY;
8
9function TouchManager(deck) {
10 this.deck_ = deck;
11
12 /* Add swiping */
13 document.body.addEventListener('touchstart', this.handleTouchStart.bind(this), false);
14 document.body.addEventListener('touchmove', this.handleTouchMove.bind(this), false);
15 document.body.addEventListener('touchend', this.handleTouchEnd.bind(this), false);
16}
17
18TouchManager.prototype.handleTouchStart = function(e) {
19 if (e.touches.length == 1) {
20 touchDX = 0;
21 touchDY = 0;
22
23 touchStartX = e.touches[0].pageX;
24 touchStartY = e.touches[0].pageY;
25
26 }
27};
28
29TouchManager.prototype.handleTouchMove = function(e) {
30 if (e.touches.length > 1) {
31 //this.cancelTouch();
32 } else {
33 touchDX = e.touches[0].pageX - touchStartX;
34 touchDY = e.touches[0].pageY - touchStartY;
35 }
36};
37
38TouchManager.prototype.handleTouchEnd = function(e) {
39 var dx = Math.abs(touchDX);
40 var dy = Math.abs(touchDY);
41
42 if ((dx > PM_TOUCH_SENSITIVITY) && (dy < (dx * 2 / 3))) {
43 if (touchDX > 0) {
44 this.deck_.prevSlide();
45 } else {
46 this.deck_.nextSlide();
47 }
48 }
49
50 //this.cancelTouch();
51};
52
53// TouchManager.prototype.cancelTouch = function() {
54// console.log(touchDX)
55// document.body.removeEventListener('touchmove', this.handleTouchMove.bind(this), false);
56// document.body.removeEventListener('touchend', this.handleTouchMove.bind(this), false);
57// };
58
59exports.TouchManager = TouchManager;
60
61})(window);
diff --git a/template.html b/template.html
index c0a6bcd..6bfb029 100644
--- a/template.html
+++ b/template.html
@@ -366,7 +366,9 @@ function helloWorld(world) {
366 366
367</slides> 367</slides>
368 368
369
369<script src="slide_config.js" defer></script> 370<script src="slide_config.js" defer></script>
371<script src="js/modernizr.custom.76029.js" defer></script>
370<script src="js/prettify/prettify.js" defer></script> 372<script src="js/prettify/prettify.js" defer></script>
371<script src="js/yepnope.1.5.3-min.js" defer></script> 373<script src="js/yepnope.1.5.3-min.js" defer></script>
372<script src="js/hammer.js" defer></script> 374<script src="js/hammer.js" defer></script>
diff --git a/theme/css/default.css b/theme/css/default.css
index 7507b19..7c96455 100644
--- a/theme/css/default.css
+++ b/theme/css/default.css
@@ -884,25 +884,17 @@ article.smaller q:before, article.smaller q:after {
884} 884}
885 885
886/* line 638, ../sass/default.scss */ 886/* line 638, ../sass/default.scss */
887.with-notes slide.current {
888 -webkit-transform: rotateY(180deg) !important;
889 -moz-transform: rotateY(180deg) !important;
890 -ms-transform: rotateY(180deg) !important;
891 -o-transform: rotateY(180deg) !important;
892 transform: rotateY(180deg) !important;
893}
894/* line 641, ../sass/default.scss */
895.with-notes .note { 887.with-notes .note {
896 opacity: 1; 888 opacity: 1;
897 -webkit-transform: rotateY(180deg); 889 -webkit-transform: translateY(0);
898 -moz-transform: rotateY(180deg); 890 -moz-transform: translateY(0);
899 -ms-transform: rotateY(180deg); 891 -ms-transform: translateY(0);
900 -o-transform: rotateY(180deg); 892 -o-transform: translateY(0);
901 transform: rotateY(180deg); 893 transform: translateY(0);
902 pointer-events: auto; 894 pointer-events: auto;
903} 895}
904 896
905/* line 648, ../sass/default.scss */ 897/* line 645, ../sass/default.scss */
906.note { 898.note {
907 position: absolute; 899 position: absolute;
908 z-index: 100; 900 z-index: 100;
@@ -930,18 +922,23 @@ article.smaller q:before, article.smaller q:after {
930 -moz-box-pack: center; 922 -moz-box-pack: center;
931 -ms-box-pack: center; 923 -ms-box-pack: center;
932 box-pack: center; 924 box-pack: center;
933 -webkit-transition: -webkit-transform 0.2s cubic-bezier(0.1, 0.1, 0.25, 0.9), opacity 0.4s ease-in-out 0.4s;
934 -moz-transition: -moz-transform 0.2s cubic-bezier(0.1, 0.1, 0.25, 0.9), opacity 0.4s ease-in-out 0.4s;
935 -ms-transition: -ms-transform 0.2s cubic-bezier(0.1, 0.1, 0.25, 0.9), opacity 0.4s ease-in-out 0.4s;
936 -o-transition: -o-transform 0.2s cubic-bezier(0.1, 0.1, 0.25, 0.9), opacity 0.4s ease-in-out 0.4s;
937 transition: transform 0.2s cubic-bezier(0.1, 0.1, 0.25, 0.9), opacity 0.4s ease-in-out 0.4s;
938 -webkit-border-radius: 5px; 925 -webkit-border-radius: 5px;
939 -moz-border-radius: 5px; 926 -moz-border-radius: 5px;
940 -ms-border-radius: 5px; 927 -ms-border-radius: 5px;
941 -o-border-radius: 5px; 928 -o-border-radius: 5px;
942 border-radius: 5px; 929 border-radius: 5px;
943} 930 -webkit-transform: translateY(350px);
944/* line 664, ../sass/default.scss */ 931 -moz-transform: translateY(350px);
932 -ms-transform: translateY(350px);
933 -o-transform: translateY(350px);
934 transform: translateY(350px);
935 -webkit-transition: all 0.4s ease-in-out;
936 -moz-transition: all 0.4s ease-in-out;
937 -ms-transition: all 0.4s ease-in-out;
938 -o-transition: all 0.4s ease-in-out;
939 transition: all 0.4s ease-in-out;
940}
941/* line 662, ../sass/default.scss */
945.note > section { 942.note > section {
946 background: #fff; 943 background: #fff;
947 -webkit-border-radius: 5px; 944 -webkit-border-radius: 5px;
@@ -956,7 +953,7 @@ article.smaller q:before, article.smaller q:after {
956 padding: 2em; 953 padding: 2em;
957} 954}
958 955
959/* line 673, ../sass/default.scss */ 956/* line 671, ../sass/default.scss */
960.source { 957.source {
961 font-size: 14px; 958 font-size: 14px;
962 color: #a9a9a9; 959 color: #a9a9a9;
@@ -965,7 +962,7 @@ article.smaller q:before, article.smaller q:after {
965 left: 60px; 962 left: 60px;
966} 963}
967 964
968/* line 681, ../sass/default.scss */ 965/* line 679, ../sass/default.scss */
969input, button { 966input, button {
970 vertical-align: middle; 967 vertical-align: middle;
971} 968}
@@ -981,7 +978,7 @@ input, button {
981 -ms-bo