Permalink
Browse files

Initial Upload

  • Loading branch information...
0 parents commit aee61c54f1139eed403112ab3aa2a278f8548188 erik klimczak committed Jul 26, 2011
229 css/style.css
@@ -0,0 +1,229 @@
+/* reset styles
+--------------------------------------------- */
+html,body,div,span,applet,object,iframe,button,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td {
+ margin:0;
+ padding:0;
+ font-size:100%;
+ vertical-align:baseline;
+ border:0;
+ outline:0
+}
+
+article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section {
+ display:block
+}
+
+ol,ul {
+ list-style:none
+}
+
+blockquote,q {
+ quotes:none
+}
+
+table {
+ border-collapse:collapse;
+ border-spacing:0
+}
+
+a:hover,a:active {
+ outline:none
+}
+
+/* end reset
+ ------------------------------------------------------------------------------*/
+body {
+ overflow:hidden;
+ background-color:#000;
+ font-family:"Lucida Grande","Lucida Sans Unicode",Arial,sans-serif;
+ font-weight:300;
+ font-size:14px;
+ color:#fff
+}
+
+#progressBar {
+ position:absolute;
+ top:50%;
+ left:0;
+ height:4px;
+ width:0;
+ background-color:#49a1cb;
+ z-index:10
+}
+
+#progressNumber {
+ position:absolute;
+ left:50%;
+ top:50%;
+ font-size:21px;
+ font-style:italic;
+ font-weight:700;
+ color:#fff;
+ z-index:10;
+ margin-top:15px
+}
+
+#container {
+ position:relative
+}
+
+#logo {
+ position:absolute;
+ top:25px;
+ left:25px;
+ background:url(../images/logo.png);
+ background-repeat:no-repeat;
+ width:170px;
+ height:49px;
+ z-index:2
+}
+
+#parallaxBg {
+ position:absolute;
+ top:0;
+ left:-50px;
+ background-color:#000
+}
+
+#dataList {
+ position:absolute
+}
+
+.vCenter {
+ top:50%
+}
+
+.hCenter {
+ left:50%
+}
+
+.listItem {
+ margin-right:5px;
+ padding:0;
+ position:relative
+}
+
+.closeBtn {
+ position:absolute;
+ top:15px;
+ right:15px;
+ width:32px;
+ height:32px;
+ background:url(../images/closeBtn.png);
+ background-repeat:no-repeat
+}
+
+.listDisplayItem {
+ -webkit-transition-property:-webkit-transform;
+ -webkit-transition-duration:450ms;
+ -webkit-transform-origin:5% 100%;
+ transform-origin:5% 100%;
+ -ms-transform-origin:5% 100%;
+ -moz-transform-origin:5% 100%;
+ -o-transform-origin:5% 100%
+}
+
+footer:before {
+ content:"";
+ position:absolute;
+ top:-10px;
+ left:0;
+ width:100%;
+ height:10px;
+ z-index:2;
+ background-image:url(../images/shadow.png);
+ background-repeat:repeat-x
+}
+
+footer {
+ position:absolute;
+ width:100%;
+ height:50px;
+ top:0;
+ background-color:#1e1e1e;
+ left:0;
+ z-index:3;
+ border-top:1px solid #000;
+ opacity:0;
+ -webkit-transition-property:-webkit-transform;
+ -webkit-transition-duration:350ms
+}
+
+footer ul {
+ font-family:"Myriad Pro","Gill Sans",Arial,sans-serif;
+ font-weight:700;
+ font-size:12px;
+ color:#ccc;
+ margin-left:30px;
+ float:left
+}
+
+footer li {
+ float:left;
+ margin:20px 25px 0 10px
+}
+
+button {
+ padding:0;
+ border:none;
+ width:48px;
+ height:48px;
+ cursor:pointer;
+ overflow:visible
+}
+
+button.expander {
+ float:right;
+ margin:0 15px 0 0;
+ background:url(../images/chevron.png) center no-repeat;
+ z-index:3;
+ -webkit-transition-property:-webkit-transform;
+ -webkit-transition-duration:350ms
+}
+
+button.expander:active {
+ margin-top:1px;
+ margin-left:1px;
+ opacity:.33
+}
+
+#info {
+ position:absolute;
+ background-color:#222;
+ border-top:1px solid #000;
+ width:100%;
+ height:150px;
+ margin-top:50px
+}
+
+.infoText {
+ float:left;
+ width:600px;
+ font-family:Verdana,Helvetica,Arial,sans-serif;
+ font-size:11px;
+ line-height:165%;
+ margin:20px 0 0 40px
+}
+
+
+#clarityLogo {
+ float:right;
+ background:url(../images/clarityLogo.png);
+ background-repeat:no-repeat;
+ width:196px;
+ height:68px;
+ margin:25px 30px 0 0
+}
+
+.black_overlay {
+ position:absolute;
+ top:0;
+ left:0;
+ width:100%;
+ height:100%;
+ background-color:rgba(0,0,0,.33);
+ display:none;
+ opacity:0;
+ -webkit-transition-property:opacity;
+ -webkit-transition-duration:350ms
+}
7 images/.BridgeSort
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
+<dirinfo>
+<files>
+<item key='1.jpg20110606150410' />
+<item key='loader.gif20110606145221' />
+</files>
+</dirinfo>
BIN images/1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/10.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/11.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/12.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/13.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/14.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/15.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/16.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/17.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/18.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/19.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/2.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/20.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/3.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/4.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/5.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/6.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/7.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/8.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/9.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/back.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/chevron.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/clarityLogo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/closeBtn.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/shadow.png
Diff not rendered.
59 index.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <title>Touch Friendly HTML5 Website</title>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"
+ <meta name="viewport" content="height=device-height,width=device-width, initial-scale=1,maximum-scale=1.0">
+ <link rel="stylesheet" href="css/style.css" type="text/css">
+ <script src='js/modernizr2.js' type="text/javascript"></script>
+</head>
+
+<body ontouchmove="BlockMove(event);">
+ <div id="container">
+ <div id="loader">
+ <div id="progressBar"></div><span id="progressNumber"></span>
+ </div>
+
+ <div id="logo"></div>
+
+ <div id="parallaxBg"><img src='images/back.jpg'></div>
+
+ <div id="dataList"></div>
+
+ <footer id="footer">
+ <ul>
+ <li>MENU 1</li>
+
+ <li>MENU 2</li>
+
+ <li>MENU 3</li>
+ </ul>
+
+ <button id="btnExpand" class="expander" type="button"></button>
+
+ <div id="info">
+ <p class="infoText">
+ This is a HTML5 experiment exploring how to create an 'app-like' website. The code showcases the following:
+ <span style="color:#999;">1)</span> Avoiding the use of jQuery for optimal perf on mobile devices.
+ <span style="color:#999;">2)</span> Implementing touch support.
+ <span style="color:#999;">3)</span> Providing a workaround for scrolling in fixed layouts on iOS.
+ <span style="color:#999;">4)</span> Using Hardware accelerated animations.
+ </p>
+ <div id="clarityLogo"></div>
+ </div>
+ </footer>
+
+ <div id="modal" class="black_overlay">
+ <div class="closeBtn"></div>
+ </div>
+ </div>
+
+<script src="js/util.js" type="text/javascript">
+</script><script src="js/loader.js" type="text/javascript">
+</script><script src="js/scroller.js" type="text/javascript">
+</script><script src="js/script.js" type="text/javascript">
+</script>
+</body>
+</html>
94 js/loader.js
@@ -0,0 +1,94 @@
+// A simpler image loader implementation inspired by http://thecodecentral.com/2008/02/21/a-useful-javascript-image-loader
+
+ var imgLoader = function(urls) {
+ this.urls = urls || {};
+ this.imgs = [];
+ this.number_total_assets_to_load = 0;
+ this.current_number_loaded = 0;
+ this.progress_number = 0;
+ };
+
+ imgLoader.prototype = {
+ load: function() {
+
+ var deets = [];
+ for(var u in this.urls) {
+ this.number_total_assets_to_load++;
+ if(!this.urls.hasOwnProperty(u)) { continue; }
+ deets.push(u);
+ }
+
+
+ for(var i = 0; i < deets.length; i++) {
+ var imgDeet = deets[i],
+ self = this;
+ // Wrapped in a closure to isolate each iterations load.
+ (function(name, url, s) {
+ setTimeout(function() {
+ s.loadImg(name, url);
+ }, 100);
+ })(imgDeet, this.urls[imgDeet], self);
+
+ }
+ },
+ loadImg: function(name, url) {
+ var img = new Image(),
+ self = this;
+
+ img.src = url;
+ img.alt = name;
+
+ img.onerror = function() {
+ console.log('Error Loading Image', name, url, img);
+ };
+
+ img.onload = function() {
+
+ var o = {
+ img: img,
+ name: name,
+ url: url
+ };
+
+ self.current_number_loaded ++;
+ self.progress_number = Math.round((self.current_number_loaded / self.number_total_assets_to_load)*100);
+ self.onImgLoaded(self.progress_number);
+
+ if(self.progress_number == 100)
+ self.onComplete();
+ };
+
+ this.imgs.push(img);
+ },
+ onImgLoaded: function(){
+ },
+ onComplete: function(){
+
+ }
+ };
+
+ // List of our images.
+ var imgs = {
+
+ img1: 'images/1.jpg',
+ img2: 'images/2.jpg',
+ img3: 'images/3.jpg',
+ img4: 'images/4.jpg',
+ img5: 'images/5.jpg',
+ img6: 'images/6.jpg',
+ img7: 'images/7.jpg',
+ img8: 'images/8.jpg',
+ img9: 'images/9.jpg',
+ img10: 'images/10.jpg',
+ img11: 'images/11.jpg',
+ img12: 'images/12.jpg',
+ img13: 'images/13.jpg',
+ img14: 'images/14.jpg',
+ img15: 'images/15.jpg',
+ img16: 'images/16.jpg',
+ img17: 'images/17.jpg',
+ img18: 'images/18.jpg',
+ img19: 'images/19.jpg',
+ img20: 'images/20.jpg'
+ }
+
4 js/modernizr2.js
@@ -0,0 +1,4 @@
+/* Modernizr 2.0.6 (Custom Build) | MIT & BSD
+ * Contains: fontface | borderradius | boxshadow | flexbox | opacity | rgba | cssanimations | csscolumns | generatedcontent | cssgradients | cssreflections | csstransforms | csstransforms3d | csstransitions | applicationcache | canvas | canvastext | draganddrop | audio | video | localstorage | sessionstorage | webworkers | geolocation | iepp | cssclasses | teststyles | testprop | testallprops | hasevent | prefixes | domprefixes | load
+ */
+;window.Modernizr=function(a,b,c){function E(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1),d=(a+" "+p.join(c+" ")+c).split(" ");return D(d,b)}function D(a,b){for(var d in a)if(k[a[d]]!==c)return b=="pfx"?a[d]:!0;return!1}function C(a,b){return!!~(""+a).indexOf(b)}function B(a,b){return typeof a===b}function A(a,b){return z(o.join(a+";")+(b||""))}function z(a){k.cssText=a}var d="2.0.6",e={},f=!0,g=b.documentElement,h=b.head||b.getElementsByTagName("head")[0],i="modernizr",j=b.createElement(i),k=j.style,l,m=":)",n=Object.prototype.toString,o=" -webkit- -moz- -o- -ms- -khtml- ".split(" "),p="Webkit Moz O ms Khtml".split(" "),q={},r={},s={},t=[],u=function(a,c,d,e){var f,h,j,k=b.createElement("div");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:i+(d+1),k.appendChild(j);f=["&shy;","<style>",a,"</style>"].join(""),k.id=i,k.innerHTML+=f,g.appendChild(k),h=c(k,a),k.parentNode.removeChild(k);return!!h},v=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=B(e[d],"function"),B(e[d],c)||(e[d]=c),e.removeAttribute(d))),e=null;return f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),w,x={}.hasOwnProperty,y;!B(x,c)&&!B(x.call,c)?y=function(a,b){return x.call(a,b)}:y=function(a,b){return b in a&&B(a.constructor.prototype[b],c)};var F=function(a,c){var d=a.join(""),f=c.length;u(d,function(a,c){var d=b.styleSheets[b.styleSheets.length-1],g=d.cssRules&&d.cssRules[0]?d.cssRules[0].cssText:d.cssText||"",h=a.childNodes,i={};while(f--)i[h[f].id]=h[f];e.csstransforms3d=i.csstransforms3d.offsetLeft===9,e.generatedcontent=i.generatedcontent.offsetHeight>=1,e.fontface=/src/i.test(g)&&g.indexOf(c.split(" ")[0])===0},f,c)}(['@font-face {font-family:"font";src:url("https://")}',["@media (",o.join("transform-3d),("),i,")","{#csstransforms3d{left:9px;position:absolute}}"].join(""),['#generatedcontent:after{content:"',m,'";visibility:hidden}'].join("")],["fontface","csstransforms3d","generatedcontent"]);q.flexbox=function(){function c(a,b,c,d){a.style.cssText=o.join(b+":"+c+";")+(d||"")}function a(a,b,c,d){b+=":",a.style.cssText=(b+o.join(c+";"+b)).slice(0,-b.length)+(d||"")}var d=b.createElement("div"),e=b.createElement("div");a(d,"display","box","width:42px;padding:0;"),c(e,"box-flex","1","width:10px;"),d.appendChild(e),g.appendChild(d);var f=e.offsetWidth===42;d.removeChild(e),g.removeChild(d);return f},q.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},q.canvastext=function(){return!!e.canvas&&!!B(b.createElement("canvas").getContext("2d").fillText,"function")},q.geolocation=function(){return!!navigator.geolocation},q.draganddrop=function(){return v("dragstart")&&v("drop")},q.rgba=function(){z("background-color:rgba(150,255,150,.5)");return C(k.backgroundColor,"rgba")},q.borderradius=function(){return E("borderRadius")},q.boxshadow=function(){return E("boxShadow")},q.opacity=function(){A("opacity:.55");return/^0.55$/.test(k.opacity)},q.cssanimations=function(){return E("animationName")},q.csscolumns=function(){return E("columnCount")},q.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";z((a+o.join(b+a)+o.join(c+a)).slice(0,-a.length));return C(k.backgroundImage,"gradient")},q.cssreflections=function(){return E("boxReflect")},q.csstransforms=function(){return!!D(["transformProperty","WebkitTransform","MozTransform","OTransform","msTransform"])},q.csstransforms3d=function(){var a=!!D(["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"]);a&&"webkitPerspective"in g.style&&(a=e.csstransforms3d);return a},q.csstransitions=function(){return E("transitionProperty")},q.fontface=function(){return e.fontface},q.generatedcontent=function(){return e.generatedcontent},q.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"');var d='video/mp4; codecs="avc1.42E01E';c.h264=a.canPlayType(d+'"')||a.canPlayType(d+', mp4a.40.2"'),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"')}}catch(e){}return c},q.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"'),c.mp3=a.canPlayType("audio/mpeg;"),c.wav=a.canPlayType('audio/wav; codecs="1"'),c.m4a=a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")}catch(d){}return c},q.localstorage=function(){try{return!!localStorage.getItem}catch(a){return!1}},q.sessionstorage=function(){try{return!!sessionStorage.getItem}catch(a){return!1}},q.webworkers=function(){return!!a.Worker},q.applicationcache=function(){return!!a.applicationCache};for(var G in q)y(q,G)&&(w=G.toLowerCase(),e[w]=q[G](),t.push((e[w]?"":"no-")+w));z(""),j=l=null,a.attachEvent&&function(){var a=b.createElement("div");a.innerHTML="<elem></elem>";return a.childNodes.length!==1}()&&function(a,b){function s(a){var b=-1;while(++b<g)a.createElement(f[b])}a.iepp=a.iepp||{};var d=a.iepp,e=d.html5elements||"abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",f=e.split("|"),g=f.length,h=new RegExp("(^|\\s)("+e+")","gi"),i=new RegExp("<(/*)("+e+")","gi"),j=/^\s*[\{\}]\s*$/,k=new RegExp("(^|[^\\n]*?\\s)("+e+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),l=b.createDocumentFragment(),m=b.documentElement,n=m.firstChild,o=b.createElement("body"),p=b.createElement("style"),q=/print|all/,r;d.getCSS=function(a,b){if(a+""===c)return"";var e=-1,f=a.length,g,h=[];while(++e<f){g=a[e];if(g.disabled)continue;b=g.media||b,q.test(b)&&h.push(d.getCSS(g.imports,b),g.cssText),b="all"}return h.join("")},d.parseCSS=function(a){var b=[],c;while((c=k.exec(a))!=null)b.push(((j.exec(c[1])?"\n":c[1])+c[2]+c[3]).replace(h,"$1.iepp_$2")+c[4]);return b.join("\n")},d.writeHTML=function(){var a=-1;r=r||b.body;while(++a<g){var c=b.getElementsByTagName(f[a]),d=c.length,e=-1;while(++e<d)c[e].className.indexOf("iepp_")<0&&(c[e].className+=" iepp_"+f[a])}l.appendChild(r),m.appendChild(o),o.className=r.className,o.id=r.id,o.innerHTML=r.innerHTML.replace(i,"<$1font")},d._beforePrint=function(){p.styleSheet.cssText=d.parseCSS(d.getCSS(b.styleSheets,"all")),d.writeHTML()},d.restoreHTML=function(){o.innerHTML="",m.removeChild(o),m.appendChild(r)},d._afterPrint=function(){d.restoreHTML(),p.styleSheet.cssText=""},s(b),s(l);d.disablePP||(n.insertBefore(p,n.firstChild),p.media="print",p.className="iepp-printshim",a.attachEvent("onbeforeprint",d._beforePrint),a.attachEvent("onafterprint",d._afterPrint))}(a,b),e._version=d,e._prefixes=o,e._domPrefixes=p,e.hasEvent=v,e.testProp=function(a){return D([a])},e.testAllProps=E,e.testStyles=u,g.className=g.className.replace(/\bno-js\b/,"")+(f?" js "+t.join(" "):"");return e}(this,this.document),function(a,b,c){function k(a){return!a||a=="loaded"||a=="complete"}function j(){var a=1,b=-1;while(p.length- ++b)if(p[b].s&&!(a=p[b].r))break;a&&g()}function i(a){var c=b.createElement("script"),d;c.src=a.s,c.onreadystatechange=c.onload=function(){!d&&k(c.readyState)&&(d=1,j(),c.onload=c.onreadystatechange=null)},m(function(){d||(d=1,j())},H.errorTimeout),a.e?c.onload():n.parentNode.insertBefore(c,n)}function h(a){var c=b.createElement("link"),d;c.href=a.s,c.rel="stylesheet",c.type="text/css";if(!a.e&&(w||r)){var e=function(a){m(function(){if(!d)try{a.sheet.cssRules.length?(d=1,j()):e(a)}catch(b){b.code==1e3||b.message=="security"||b.message=="denied"?(d=1,m(function(){j()},0)):e(a)}},0)};e(c)}else c.onload=function(){d||(d=1,m(function(){j()},0))},a.e&&c.onload();m(function(){d||(d=1,j())},H.errorTimeout),!a.e&&n.parentNode.insertBefore(c,n)}function g(){var a=p.shift();q=1,a?a.t?m(function(){a.t=="c"?h(a):i(a)},0):(a(),j()):q=0}function f(a,c,d,e,f,h){function i(){!o&&k(l.readyState)&&(r.r=o=1,!q&&j(),l.onload=l.onreadystatechange=null,m(function(){u.removeChild(l)},0))}var l=b.createElement(a),o=0,r={t:d,s:c,e:h};l.src=l.data=c,!s&&(l.style.display="none"),l.width=l.height="0",a!="object"&&(l.type=d),l.onload=l.onreadystatechange=i,a=="img"?l.onerror=i:a=="script"&&(l.onerror=function(){r.e=r.r=1,g()}),p.splice(e,0,r),u.insertBefore(l,s?null:n),m(function(){o||(u.removeChild(l),r.r=r.e=o=1,j())},H.errorTimeout)}function e(a,b,c){var d=b=="c"?z:y;q=0,b=b||"j",C(a)?f(d,a,b,this.i++,l,c):(p.splice(this.i++,0,a),p.length==1&&g());return this}function d(){var a=H;a.loader={load:e,i:0};return a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=r&&!s,u=s?l:n.parentNode,v=a.opera&&o.call(a.opera)=="[object Opera]",w="webkitAppearance"in l.style,x=w&&"async"in b.createElement("script"),y=r?"object":v||x?"img":"script",z=w?"img":y,A=Array.isArray||function(a){return o.call(a)=="[object Array]"},B=function(a){return Object(a)===a},C=function(a){return typeof a=="string"},D=function(a){return o.call(a)=="[object Function]"},E=[],F={},G,H;H=function(a){function f(a){var b=a.split("!"),c=E.length,d=b.pop(),e=b.length,f={url:d,origUrl:d,prefixes:b},g,h;for(h=0;h<e;h++)g=F[b[h]],g&&(f=g(f));for(h=0;h<c;h++)f=E[h](f);return f}function e(a,b,e,g,h){var i=f(a),j=i.autoCallback;if(!i.bypass){b&&(b=D(b)?b:b[a]||b[g]||b[a.split("/").pop().split("?")[0]]);if(i.instead)return i.instead(a,b,e,g,h);e.load(i.url,i.forceCSS||!i.forceJS&&/css$/.test(i.url)?"c":c,i.noexec),(D(b)||D(j))&&e.load(function(){d(),b&&b(i.origUrl,h,g),j&&j(i.origUrl,h,g)})}}function b(a,b){function c(a){if(C(a))e(a,h,b,0,d);else if(B(a))for(i in a)a.hasOwnProperty(i)&&e(a[i],h,b,i,d)}var d=!!a.test,f=d?a.yep:a.nope,g=a.load||a.both,h=a.callback,i;c(f),c(g),a.complete&&b.load(a.complete)}var g,h,i=this.yepnope.loader;if(C(a))e(a,0,i,0);else if(A(a))for(g=0;g<a.length;g++)h=a[g],C(h)?e(h,0,i,0):A(h)?H(h):B(h)&&b(h,i);else B(a)&&b(a,i)},H.addPrefix=function(a,b){F[a]=b},H.addFilter=function(a){E.push(a)},H.errorTimeout=1e4,b.readyState==null&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",G=function(){b.removeEventListener("DOMContentLoaded",G,0),b.readyState="complete"},0)),a.yepnope=d()}(this,this.document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};
245 js/script.js
@@ -0,0 +1,245 @@
+//Global Vars
+var min_width = 1024,
+ min_height = 768,
+ browser_width,
+ browser_height,
+ loader,
+ self = this;
+
+
+$.ready(function () {
+
+ var footerOpen = false;
+ var myTweenable;
+
+ //Shrink it down for iPhone
+ var viewport = document.querySelector("meta[name=viewport]");
+ if (navigator.userAgent.match(/iPhone/i)) viewport.setAttribute('content', 'width=device-width; initial-scale=.33; maximum-scale=1.0; user-scalable=0;');
+
+ //load animation framework if there is no css animation/transition support
+ Modernizr.load({
+ test: Modernizr.csstransforms3d,
+ nope: 'js/shifty.min.js',
+ complete: function () {
+ if (!Modernizr.csstransforms3d)
+ myTweenable = (new Tweenable()).init();
+ }
+ });
+
+ browser_width = window.innerWidth;
+ browser_height = window.innerHeight;
+
+ //Resize screen containers
+ var container = document.getElementById('container');
+ container.style.width = browser_width + 'px';
+ container.style.height = browser_height + 'px';
+
+ //Wire up common events
+ var btnExpander = document.getElementById('btnExpand');
+ $(btnExpander).bind('click', function () {
+ ToggleFooter()
+ });
+
+ Scroller.onItemClicked = function (data) {
+ CreateLightBox(data);
+ }
+
+ PositionFooter();
+ PreloadImages();
+
+
+ function PreloadImages() {
+
+ var indicator = document.getElementById('progressBar');
+ var progressNum = document.getElementById('progressNumber');
+ var ldr = document.getElementById('loader');
+ var container = document.getElementById('container');
+
+ loader = new imgLoader(imgs);
+ loader.load();
+ loader.onComplete = function () {
+ container.removeChild(ldr);
+ init();
+ };
+
+ loader.onImgLoaded = function(num){
+ //Draw Indicator on screen
+ var w = browser_width * (num / 100);
+ indicator.style.width = w+'px';
+ progressNum.innerHTML = num + '%';
+ };
+ }
+
+ function BuildDomItems() {
+
+ for (var i = 0; i < loader.imgs.length; i++) {
+
+ var listImg = document.createElement("img");
+ listImg.setAttribute("src", loader.imgs[i].src);
+ listImg.className = ('listItem');
+ document.getElementById('dataList').appendChild(listImg);
+ }
+ }
+
+ function init() {
+
+ BuildDomItems(); //Add images to list
+ var list = document.getElementById('dataList');
+ Scroller.init(list, 'x', $.hasTouch); //'x' or 'y'
+ }
+
+
+ function ToggleFooter() {
+
+ var footer = document.getElementById('footer');
+ var btn = document.getElementById('btnExpand');
+
+ if ($.has3d) { //if css3d transforms are supported
+
+ if (!footerOpen) {
+ footerOpen = true;
+ set3dTranslate(footer, 0 + 'px', -150 + 'px');
+ set3dRotate(btn, 180);
+ }
+ else {
+ footerOpen = false;
+ set3dTranslate(footer, 0 + 'px', 0 + 'px');
+ set3dRotate(btn, 0);
+ }
+ }
+
+ else {
+
+ //Using Lightweight animation tweener Shifty.js as alternative
+ if (!footerOpen) {
+ footerOpen = true;
+ myTweenable.tween({
+ from: { 'top': 0, 'rotate': 0 },
+ to: { 'top': -150, 'rotate': 180 },
+ 'duration': 350, 'step': function () {
+ set2dTranslate(footer, 0 + 'px', this.top + 'px');
+ set2dRotate(btn, this.rotate);
+ }, 'easing': 'easeInOutQuad'
+ });
+ }
+ else {
+ footerOpen = false;
+ myTweenable.tween({
+ from: { 'top': -150, 'rotate': 180 },
+ to: { 'top': 0, 'rotate': 0 },
+ 'duration': 350, 'step': function () {
+ set2dTranslate(footer, 0 + 'px', this.top + 'px');
+ set2dRotate(btn, this.rotate);
+ }, 'easing': 'easeInOutQuad'
+ });
+ }
+ }
+ }
+
+
+ function PositionFooter() {
+
+ var footer = document.getElementById('footer');
+ var footerHeight = footer.clientHeight;
+ footer.style.top = browser_height - footerHeight + 'px'; //needed for iOS
+ footer.style.opacity = 1;
+ }
+
+ function HandleResize() {
+
+ browser_width = window.innerWidth;
+ browser_height = window.innerHeight;
+
+ var container = document.getElementById('container');
+ container.style.width = browser_width + 'px';
+ container.style.height = browser_height + 'px';
+
+ PositionFooter();
+
+ }
+
+ function CreateLightBox(img) {
+
+ img.style.opacity = 0;
+ var offset = findPos(img);
+ var container = document.getElementById('container');
+ var overlay = document.getElementById('modal');
+ overlay.style.display = 'block';
+
+ var centerX = browser_width / 2;
+ var centerY = browser_height / 2;
+ var distFromCenter = ((offset.X + Scroller.offsetX) - centerX) + ((img.clientWidth * 1.5) / 2);
+
+ var displayImg = document.createElement('img');
+ displayImg.className = 'listDisplayItem';
+ displayImg.id = 'placeHolder';
+ displayImg.setAttribute("src", img.src);
+
+ var itemClickCB = function(e) { //Scale Down Image Close Lightbox
+
+ $(overlay).unbind('click', itemClickCB);
+
+ if ($.has3d) {
+ $(displayImg).bind('webkitTransitionEnd', function () {
+ overlay.style.display = 'none';
+ displayImg.parentNode.removeChild(displayImg);
+ });
+
+ displayImg.style.webkitTransform = 'scale3d(1,1,0) translate3d(' + (offset.X + Scroller.offsetX) + 'px,' + (offset.Y + Scroller.offsetY) + 'px, 0px)';
+ img.style.opacity = 1;
+ }else{
+
+ myTweenable.tween({
+ from: { 'scale': 1.5, 'x': (offset.X + Scroller.offsetX - distFromCenter), y: (offset.Y + Scroller.offsetY) },
+ to: { 'scale': 1, 'x': (offset.X + Scroller.offsetX), y: (offset.Y + Scroller.offsetY) },
+ 'duration': 350, 'step': function () {
+ set2dScaleTranslate(displayImg, this.x + 'px', this.y + 'px', this.scale, this.scale);
+ }, 'easing': 'easeInOutQuad','fps':60,
+ 'callback': function () {
+ overlay.style.display = 'none';
+ displayImg.parentNode.removeChild(displayImg);
+ }
+ });
+ img.style.opacity = 1;
+ }
+ }
+
+ $(overlay).bind('click', itemClickCB);
+ container.appendChild(displayImg);
+
+ //Scale up image
+ if ($.has3d) {
+ displayImg.style.webkitTransform = 'scale3d(1,1,0) translate3d(' + (offset.X + Scroller.offsetX) + 'px,' + (offset.Y + Scroller.offsetY) + 'px, 0px)';
+
+ setTimeout(function () {
+ displayImg.style.webkitTransform = 'scale3d(1.5,1.5,0) translate3d(' + (offset.X + Scroller.offsetX - distFromCenter) + 'px,' + (offset.Y + Scroller.offsetY) + 'px, 0px)';
+ overlay.style.opacity = 1;
+ }, 10);
+ }
+ else {
+
+ set2dScaleTranslate(displayImg, (offset.X + Scroller.offsetX) + 'px', (offset.Y + Scroller.offsetY) + 'px', 1, 1);
+ overlay.style.opacity = 1;
+
+ myTweenable.tween({
+ from: { 'scale': 1, 'x': (offset.X + Scroller.offsetX), 'y': (offset.Y + Scroller.offsetY)},
+ to: { 'scale': 1.5, 'x': (offset.X + Scroller.offsetX - distFromCenter), 'y' : (offset.Y + Scroller.offsetY) },
+ 'duration': 350, 'step': function () {
+ set2dScaleTranslate(displayImg, this.x + 'px', this.y + 'px', this.scale, this.scale);
+ }, 'easing': 'easeInOutQuad','fps':60
+ });
+ }
+ }
+
+
+ window.onorientationchange = function () {
+
+ HandleResize();
+ }
+
+ window.onresize = function () {
+
+ HandleResize();
+ }
+
+});
377 js/scroller.js
@@ -0,0 +1,377 @@
+var Scroller = new
+function() {
+
+ //Public Properties
+ this.scroller = null;
+ this.offsetX;
+ this.offsetY;
+
+ //Private Properties
+ var _mouseDown = false,
+ _prevMouseX = 0,
+ _prevMouseY = 0,
+ _lastX,
+ _lastY,
+ _prevViewportX,
+ _prevViewportY,
+ _roundedViewportX = 0,
+ _roundedViewportY = 0,
+ _moveThreshold = 10,
+ _targetX = 0,
+ _targetY = 0,
+ _viewPortX = 0,
+ _viewPortY = 0,
+ _curVelX = 0,
+ _curVelY = 0,
+ _curInertiaX = 0,
+ _curInertiaY = 0,
+ _prevMotion = 0,
+ _direction = 0,
+ _directionY, _processInertia = false,
+ _viewPortMax = 0,
+ _viewPortMin = 0,
+ _lastMotion, _didDrag = false,
+ self = this,
+ _scrollDirection,
+ _eventType,
+ _selectorType = 'img',
+ _clickElement,
+ _supportsTransforms = Modernizr.csstransforms3d;
+
+ this.init = function(ele, scrollDirection, useTouch) {
+
+ this.scroller = ele;
+ _scrollDirection = scrollDirection;
+ _eventType = useTouch ? "touch" : "mouse";
+
+ if (_scrollDirection == 'y') {
+
+ //TODO: Hard Coded Values should be dynamic
+ this.scroller.style.width = '640px';
+ this.scroller.className = 'hCenter';
+ this.scroller.style.marginLeft = '-320px';
+ _viewPortMax = this.scroller.clientHeight;
+ }
+
+ else if (_scrollDirection == 'x') {
+
+ //TODO: Hard Coded Values should be dynamic
+ this.scroller.style.width = '12900px';
+ this.scroller.style.height = '410px';
+ this.scroller.className = 'vCenter';
+ this.scroller.style.marginTop = '-205px';
+ _viewPortMax = this.scroller.clientWidth
+ }
+
+ this.addEventHandlers(_eventType);
+
+ $(this.scroller).bind(this._dragStartEvt, this._dragStartCB);
+ this.setElementTransform(this.scroller, 1 + "px", 0 + "px"); //reduces flicker for ios
+
+ this.animate();
+ }
+
+ this.changeOrientation = function(isPortrait){
+
+ if(isPortrait){
+ _scrollDirection = 'y';
+ this.scroller.style.width = '640px';
+ this.scroller.style.height = '8200px';
+ this.scroller.className = this.scroller.className.replace(new RegExp('(^|\\s+)' + 'vCenter' + '(\\s+|$)'), 'hCenter');
+ this.scroller.style.marginLeft = '-320px';
+ _viewPortMax = this.scroller.clientHeight;
+ }
+ else {
+ _scrollDirection = 'x';
+ this.scroller.style.width = '12900px';
+ this.scroller.style.height = '410px';
+ this.scroller.className = this.scroller.className.replace(new RegExp('(^|\\s+)' + 'hCenter' + '(\\s+|$)'), 'vCenter');
+ this.scroller.style.marginTop = '-205px';
+ _viewPortMax = this.scroller.clientWidth;
+ }
+ }
+
+
+ ///////////////////////////////////SCROLLER EVENTS///////////////////////////////////////////
+ this.PreventSelection = function(mouseEvent) {
+ mouseEvent.preventDefault();
+ }
+
+ this.OnMouseLost = function(mouseEvent) {
+ this.OnMouseUp(mouseEvent);
+ }
+
+ this.OnMouseDown = function(e, ex, ey) {
+ if(e.target.nodeName === _selectorType);
+ _clickElement = e.target;
+
+ _prevMouseX = ex;
+ _prevMouseY = ey;
+ _curInertiaX = 0;
+ _curInertiaY = 0;
+ _curVelX = 0;
+ _curVelY = 0;
+ _lastMotion = new Date().getTime();
+ _lastX = _targetX;
+ _lastY = _targetY;
+ _mouseDown = true;
+ _didDrag = false;
+
+ this.enableTracking();
+ e.preventDefault();
+
+ }
+
+ this.OnMouseMove = function(e, ex, ey) {
+
+ if (_mouseDown) {
+ var timeNow = new Date().getTime();
+ var newX = ex;
+ var newY = ey;
+ var deltaX = newX - _prevMouseX;
+ var deltaY = newY - _prevMouseY;
+
+ if (_scrollDirection == 'x' && Math.abs(deltaX) < _moveThreshold) return false;
+ if (_scrollDirection == 'y' && Math.abs(deltaY) < _moveThreshold) return false;
+
+ _prevMouseX = newX;
+ _prevMouseY = newY;
+ _lastMotion = timeNow;
+
+ if (_scrollDirection == 'y') {
+
+ if ((_targetY) > 0 && (_targetY < _viewPortMax - browser_height)) _targetY -= deltaY;
+ else _targetY -= deltaY / 3;
+
+ var dY = _targetY - _lastY;
+ _lastY = _targetY;
+
+ var velocityY = Math.abs(dY);
+ _curVelY += (velocityY - _curVelY) * .3;
+ _directionY = dY < 0 ? -1 : 1;
+
+ }
+ else {
+
+ if ((_targetX) > 0 && (_targetX < _viewPortMax - browser_width)) _targetX -= deltaX;
+ else _targetX -= deltaX / 3;
+
+ var dX = _targetX - _lastX;
+ _lastX = _targetX;
+
+ var velocity = Math.abs(dX);
+ _curVelX += (velocity - _curVelX) * .3;
+ _direction = dX < 0 ? -1 : 1;
+
+ }
+ _didDrag = true;
+ }
+ }
+
+ this.OnMouseUp = function(e) {
+
+ if (_mouseDown) {
+
+ _mouseDown = false;
+ _curInertiaX = Math.abs(_curVelX);
+ _curInertiaY = Math.abs(_curVelY);
+ _processInertia = true;
+ var timeNow = new Date().getTime();
+ var deltaTime = timeNow - _lastMotion;
+ deltaTime = Math.max(10, deltaTime);
+ _lastMotion = 0;
+ _curVelX *= 1 - Math.min(1, Math.max(0, deltaTime / 100));
+ _curVelY *= 1 - Math.min(1, Math.max(0, deltaTime / 100));
+ }
+
+ _prevMouseX = 0;
+ _prevMouseY = 0;
+
+ this.disableTracking();
+
+ if(!_didDrag && _clickElement != null)
+ self.onItemClicked(_clickElement);
+
+
+ return _didDrag ? false : undefined;
+ }
+
+ this.onItemClicked = function(){
+
+ }
+
+
+ this.draw = function() {
+
+ this.update();
+ }
+
+
+ this.update = function() {
+
+ if (_scrollDirection == 'x') {
+
+ if (_processInertia) {
+
+ _targetX += _curVelX * _direction;
+ _curVelX *= .9;
+
+ if (_targetX < _viewPortMin) {
+ _curVelX = 0;
+ _targetX = _viewPortMin;
+ _processInertia = false;
+ } else if (_targetX > _viewPortMax - browser_width) {
+ _curVelX = 0;
+ _targetX = _viewPortMax - browser_width;
+ _processInertia = false;
+ }
+
+ if (_curVelX < 0.01) {
+ _processInertia = false;
+ _curVelX = 0;
+ }
+ }
+
+ var ease = 0.12;
+ var speed = (_targetX - _viewPortX) * ease;
+ _viewPortX += speed;
+ _roundedViewportX = Math.round(-_viewPortX);
+
+ //Offset Viewport
+ if (_supportsTransforms) {
+ this.setElementTransform(this.scroller, _roundedViewportX + "px", 0 + "px");
+ this.setElementTransform(document.getElementById('parallaxBg'), _roundedViewportX / 8 + "px", 0 + "px");
+ }
+
+ else {
+ this.set2dTransform(this.scroller, _roundedViewportX + "px", 0 + "px");
+ this.set2dTransform(document.getElementById('parallaxBg'), _roundedViewportX / 8 + "px", 0 + "px");
+ }
+ }
+
+ else if (_scrollDirection == 'y') {
+ if (_processInertia) {
+ _targetY += _curVelY * _directionY;
+ _curVelY *= .9;
+
+ if (_targetY < _viewPortMin) {
+ _curVelY = 0;
+ _targetY = _viewPortMin;
+ _processInertia = false;
+ } else if (_targetY > _viewPortMax - browser_height) {
+ _curVelY = 0;
+ _targetY = _viewPortMax - browser_height;
+ _processInertia = false;
+ }
+ if (_curVelY < 0.01) {
+ _processInertia = false;
+ _curVelY = 0;
+ }
+ }
+ var ease = 0.12;
+ var speedY = (_targetY - _viewPortY) * ease;
+ _viewPortY += speedY;
+ _roundedViewportY = Math.round(-_viewPortY);
+
+ //Offset Viewport
+ if (_supportsTransforms) this.setElementTransform(this.scroller, 0 + "px", _roundedViewportY + "px");
+
+ else this.set2dTransform(this.scroller, 0 + "px", _roundedViewportY + "px");
+ }
+
+ this.offsetX = _roundedViewportX;
+ this.offsetY = _roundedViewportY;
+ }
+
+
+ this.set2dTransform = function(ele, x, y) {
+
+ var v = "translate(" + x + "," + y + ")";
+ ele.style.transform = v;
+ ele.style.WebkitTransform = v;
+ ele.style.msTransform = v;
+ ele.style.MozTransform = v;
+
+ }
+
+ this.setElementTransform = function(ele, x, y) {
+
+ var v = "translate3d(" + x + "," + y + ", 0px)";
+ ele.style.transform = v;
+ ele.style.WebkitTransform = v;
+ }
+
+ this.animate = function() {
+
+ Scroller.draw();
+ requestAnimFrame(Scroller.animate);
+ }
+
+ this.enableTracking = function() {
+
+ $(this.scroller).bind(this._dragMoveEvt, this._dragMoveCB);
+ $(this.scroller).bind(this._dragStopEvt, this._dragStopCB);
+ }
+
+ this.disableTracking = function() {
+
+ $(this.scroller).unbind(this._dragMoveEvt, this._dragMoveCB);
+ $(this.scroller).unbind(this._dragStopEvt, this._dragStopCB);
+ }
+
+ this.addEventHandlers = function(eventType) {
+
+ if (eventType === 'mouse') {
+
+ this._dragStartEvt = "mousedown";
+ this._dragStartCB = function(e) {
+ return self.OnMouseDown(e, e.clientX, e.clientY);
+ };
+
+ this._dragMoveEvt = "mousemove";
+ this._dragMoveCB = function(e) {
+ return self.OnMouseMove(e, e.clientX, e.clientY);
+ };
+
+ this._dragStopEvt = "mouseup";
+ this._dragStopCB = function(e) {
+ return self.OnMouseUp(e);
+ };
+
+ this._dragOutEvt = 'mouseout';
+ this._dragOutCB = function(e) {
+ return self.OnMouseUp(e);
+ }
+
+ $(window).bind(this._dragOutEvt, this._dragOutCB, true);
+ $('document').bind('mousedown', this.PreventSelection)
+
+
+ } else {
+
+ this._dragStartEvt = "touchstart";
+ this._dragStartCB = function(e) {
+ var t = e.touches[0];
+ return self.OnMouseDown(e, t.pageX, t.pageY);
+ };
+
+ this._dragMoveEvt = "touchmove";
+ this._dragMoveCB = function(e) {
+ var t = e.touches[0];
+ return self.OnMouseMove(e, t.pageX, t.pageY);
+ };
+
+ this._dragStopEvt = "touchend";
+ this._dragStopCB = function(e) {
+ return self.OnMouseUp(e);
+ };
+ }
+ }
+
+ this.resize = function(){
+
+
+ }
+
+
+};
33 js/shifty.min.js
@@ -0,0 +1,33 @@
+/**
+Shifty - A teeny tiny tweening engine in JavaScript.
+By Jeremy Kahn - jeremyckahn@gmail.com
+ v0.2.0
+
+For instructions on how to use Shifty, please consult the README: https://github.com/jeremyckahn/shifty/blob/master/README.md
+
+MIT Lincense. This code free to use, modify, distribute and enjoy.
+
+*/
+
+(function(b){function a(){return+new Date}function e(a,d){for(var f in a)a.hasOwnProperty(f)&&d(a,f)}function h(a,d){e(d,function(d,g){a[g]=d[g]});return a}function k(a,d){e(d,function(d,g){typeof a[g]==="undefined"&&(a[g]=d[g])});return a}function j(a,d,f){var g,a=(a-d.timestamp)/d.duration;for(g in f.current)f.current.hasOwnProperty(g)&&d.to.hasOwnProperty(g)&&(f.current[g]=d.originalState[g]+(d.to[g]-d.originalState[g])*d.easingFunc(a));return f.current}function i(a,d,f,g){var b;for(b=0;b<d[a].length;b++)d[a][b].apply(f,
+g)}function l(a,d,f){e(b.Tweenable.prototype.filter,function(g,b){g[b][a]&&g[b][a].apply(d,f)})}function n(c,d){var f;f=a();f<c.timestamp+c.duration&&d.isAnimating?(l("beforeTween",c.owner,[d.current,c.originalState,c.to]),j(f,c,d),l("afterTween",c.owner,[d.current,c.originalState,c.to]),c.hook.step&&i("step",c.hook,c.owner,[d.current]),c.step.call(d.current),d.loopId=setTimeout(function(){n(c,d)},1E3/c.fps)):c.owner.stop(!0)}function m(){this.init=function(a){a=a||{};this._hook={};this._tweenParams=
+{owner:this,hook:this._hook};this._state={};this._state.current=a.initialState||{};this.fps=a.fps||30;this.easing=a.easing||"linear";this.duration=a.duration||500;return this};this.tween=function(c,d,f,g,b){var e=this;if(!this._state.isAnimating)return this._state.loopId=0,this._state.pausedAtTime=null,d?(this._tweenParams.step=function(){},this._state.current=c||{},this._tweenParams.to=d||{},this._tweenParams.duration=f||this.duration,this._tweenParams.callback=g||function(){},this._tweenParams.easing=
+b||this.easing):(this._tweenParams.step=c.step||function(){},this._tweenParams.callback=c.callback||function(){},this._state.current=c.from||{},this._tweenParams.to=c.to||c.target||{},this._tweenParams.duration=c.duration||this.duration,this._tweenParams.easing=c.easing||this.easing),this._tweenParams.timestamp=a(),this._tweenParams.easingFunc=this.formula[this._tweenParams.easing]||this.formula.linear,k(this._state.current,this._tweenParams.to),k(this._tweenParams.to,this._state.current),l("tweenCreated",
+this._tweenParams.owner,[this._state.current,this._tweenParams.originalState,this._tweenParams.to]),this._tweenParams.originalState=h({},this._state.current),this._state.isAnimating=!0,setTimeout(function(){n(e._tweenParams,e._state)},1E3/this.fps),this};this.to=function(a,d,f,g){typeof d==="undefined"?(a.from=this.get(),this.tween(a)):this.tween(this.get(),a,d,f,g);return this};this.get=function(){return this._state.current};this.set=function(a){this._state.current=a||{};return this};this.stop=function(a){clearTimeout(this._state.loopId);
+this._state.isAnimating=!1;a&&(h(this._state.current,this._tweenParams.to),this._tweenParams.callback.call(this._state.current));return this};this.pause=function(){clearTimeout(this._state.loopId);this._state.pausedAtTime=a();this._state.isPaused=!0;return this};this.resume=function(){var a=this;this._state.isPaused&&(this._tweenParams.timestamp+=this._state.pausedAtTime-this._tweenParams.timestamp);setTimeout(function(){n(a._tweenParams,a._state)},1E3/this.fps);return this};this.hookAdd=function(a,
+d){this._hook.hasOwnProperty(a)||(this._hook[a]=[]);this._hook[a].push(d)};this.hookRemove=function(a,d){var f;if(this._hook.hasOwnProperty(a))if(d)for(f=this._hook[a].length;f>=0;f++)this._hook[a][f]===d&&this._hook[a].splice(f,1);else this._hook[a]=[]};return this}m.prototype.filter={};m.util={now:a,each:e,tweenProps:j,applyFilter:l,simpleCopy:h};m.prototype.formula={linear:function(a){return a}};b.Tweenable=m})(this);
+(function(b){b.Tweenable.util.simpleCopy(b.Tweenable.prototype.formula,{easeInQuad:function(a){return Math.pow(a,2)},easeOutQuad:function(a){return-(Math.pow(a-1,2)-1)},easeInOutQuad:function(a){if((a/=0.5)<1)return 0.5*Math.pow(a,2);return-0.5*((a-=2)*a-2)},easeInCubic:function(a){return Math.pow(a,3)},easeOutCubic:function(a){return Math.pow(a-1,3)+1},easeInOutCubic:function(a){if((a/=0.5)<1)return 0.5*Math.pow(a,3);return 0.5*(Math.pow(a-2,3)+2)},easeInQuart:function(a){return Math.pow(a,4)},easeOutQuart:function(a){return-(Math.pow(a-
+1,4)-1)},easeInOutQuart:function(a){if((a/=0.5)<1)return 0.5*Math.pow(a,4);return-0.5*((a-=2)*Math.pow(a,3)-2)},easeInQuint:function(a){return Math.pow(a,5)},easeOutQuint:function(a){return Math.pow(a-1,5)+1},easeInOutQuint:function(a){if((a/=0.5)<1)return 0.5*Math.pow(a,5);return 0.5*(Math.pow(a-2,5)+2)},easeInSine:function(a){return-Math.cos(a*(Math.PI/2))+1},easeOutSine:function(a){return Math.sin(a*(Math.PI/2))},easeInOutSine:function(a){return-0.5*(Math.cos(Math.PI*a)-1)},easeInExpo:function(a){return a==
+0?0:Math.pow(2,10*(a-1))},easeOutExpo:function(a){return a==1?1:-Math.pow(2,-10*a)+1},easeInOutExpo:function(a){if(a==0)return 0;if(a==1)return 1;if((a/=0.5)<1)return 0.5*Math.pow(2,10*(a-1));return 0.5*(-Math.pow(2,-10*--a)+2)},easeInCirc:function(a){return-(Math.sqrt(1-a*a)-1)},easeOutCirc:function(a){return Math.sqrt(1-Math.pow(a-1,2))},easeInOutCirc:function(a){if((a/=0.5)<1)return-0.5*(Math.sqrt(1-a*a)-1);return 0.5*(Math.sqrt(1-(a-=2)*a)+1)},easeOutBounce:function(a){return a<1/2.75?7.5625*
+a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375},easeInBack:function(a){return a*a*(2.70158*a-1.70158)},easeOutBack:function(a){return(a-=1)*a*(2.70158*a+1.70158)+1},easeInOutBack:function(a){var b=1.70158;if((a/=0.5)<1)return 0.5*a*a*(((b*=1.525)+1)*a-b);return 0.5*((a-=2)*a*(((b*=1.525)+1)*a+b)+2)},elastic:function(a){return-1*Math.pow(4,-8*a)*Math.sin((a*6-1)*2*Math.PI/2)+1},swingFromTo:function(a){var b=1.70158;return(a/=0.5)<
+1?0.5*a*a*(((b*=1.525)+1)*a-b):0.5*((a-=2)*a*(((b*=1.525)+1)*a+b)+2)},swingFrom:function(a){return a*a*(2.70158*a-1.70158)},swingTo:function(a){return(a-=1)*a*(2.70158*a+1.70158)+1},bounce:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375},bouncePast:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?2-(7.5625*(a-=1.5/2.75)*a+0.75):a<2.5/2.75?2-(7.5625*(a-=2.25/2.75)*a+0.9375):2-(7.5625*(a-=2.625/2.75)*
+a+0.984375)},easeFromTo:function(a){if((a/=0.5)<1)return 0.5*Math.pow(a,4);return-0.5*((a-=2)*Math.pow(a,3)-2)},easeFrom:function(a){return Math.pow(a,4)},easeTo:function(a){return Math.pow(a,0.25)}})})(this);
+(function(b){function a(a,b){return function(){a();b.shift();if(b.length)b[0]();else b.running=!1}}function e(a,b,e,i,l,n){return function(){e?a.tween(b,e,i,l,n):(b.callback=l,b.from?a.tween(b):a.to(b))}}b.Tweenable.prototype.queue=function(b,k,j,i,l){if(!this._tweenQueue)this._tweenQueue=[];i=i||b.callback||function(){};i=a(i,this._tweenQueue);this._tweenQueue.push(e(this,b,k,j,i,l));if(!this._tweenQueue.running)this._tweenQueue[0](),this._tweenQueue.running=!0;return this};b.Tweenable.prototype.queueShift=
+function(){this._tweenQueue.shift();return this};b.Tweenable.prototype.queuePop=function(){this._tweenQueue.pop();return this};b.Tweenable.prototype.queueEmpty=function(){this._tweenQueue.length=0;return this};b.Tweenable.prototype.queueLength=function(){return this._tweenQueue.length}})(this);
+(function(b){function a(a){return parseInt(a,16)}function e(c){b.Tweenable.util.each(c,function(d,b){if(typeof d[b]==="string"&&(i.test(d[b])||l.test(d[b]))){var c;c=d[b];c=c.replace(/#/g,"");c.length===3&&(c=c.split(""),c=c[0]+c[0]+c[1]+c[1]+c[2]+c[2]);c=[a(c.substr(0,2)),a(c.substr(2,2)),a(c.substr(4,2))];d[b]="rgb("+c[0]+","+c[1]+","+c[2]+")"}})}function h(a){var d;d=[];b.Tweenable.util.each(a,function(a,c){typeof a[c]==="string"&&(i.test(a[c])||l.test(a[c])||n.test(a[c]))&&d.push(c)});return d}
+function k(a,d){var b,g,e;g=d.length;for(b=0;b<g;b++)e=a[d[b]].match(/(\d+)/g),a["__r__"+d[b]]=+e[0],a["__g__"+d[b]]=+e[1],a["__b__"+d[b]]=+e[2],delete a[d[b]]}function j(a,b){var f,e;e=b.length;for(f=0;f<e;f++)a[b[f]]="rgb("+parseInt(a["__r__"+b[f]],10)+","+parseInt(a["__g__"+b[f]],10)+","+parseInt(a["__b__"+b[f]],10)+")",delete a["__r__"+b[f]],delete a["__g__"+b[f]],delete a["__b__"+b[f]]}var i=/^#([0-9]|[a-f]){3}$/i,l=/^#([0-9]|[a-f]){6}$/i,n=/^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)\s*$/i,m;if(b.Tweenable)b.Tweenable.prototype.filter.color=
+{tweenCreated:function(a,b,f){e(a);e(b);e(f)},beforeTween:function(a,b,f){m=h(b);k(a,m);k(b,m);k(f,m)},afterTween:function(a,b,f){j(a,m);j(b,m);j(f,m)}}})(this);
+(function(b){function a(a){var e;e={};b.Tweenable.util.each(a,function(a,b){typeof a[b]==="string"&&k.test(a[b])&&(e[b]={suffix:a[b].match(k)[0]})});return e}function e(a,e){b.Tweenable.util.each(e,function(b,c){a[c]=+a[c].replace(j,"")})}function h(a,e){b.Tweenable.util.each(e,function(b,c){a[c]+=b[c].suffix})}var k=/(px|em|%|pc|pt|mm|cm|in|ex)/i,j=/([a-z]|%)/gi,i;b.Tweenable.prototype.filter.token={beforeTween:function(b,h,j){i=a(h);e(b,i);e(h,i);e(j,i)},afterTween:function(a,b,e){h(a,i);h(b,i);
+h(e,i)}}})(this);
+(function(b){if(b.Tweenable)b.Tweenable.util.interpolate=function(a,e,h,k){var j;if(a&&a.from)e=a.to,h=a.position,k=a.easing,a=a.from;j=b.Tweenable.util.simpleCopy({},a);b.Tweenable.util.applyFilter("tweenCreated",j,[j,a,e]);b.Tweenable.util.applyFilter("beforeTween",j,[j,a,e]);h=b.Tweenable.util.tweenProps(h,{originalState:a,to:e,timestamp:0,duration:1,easingFunc:b.Tweenable.prototype.formula[k]||b.Tweenable.prototype.formula.linear},{current:j});b.Tweenable.util.applyFilter("afterTween",h,[h,a,
+e]);return h},b.Tweenable.prototype.interpolate=function(a,e,h){a=b.Tweenable.util.interpolate(this.get(),a,e,h);this.set(a);return a}})(this);
227 js/util.js
@@ -0,0 +1,227 @@
+/**
+ *
+ * Find more about the micro-framework at
+ * http://cubiq.org/
+ *
+ * Copyright (c) 2010 Matteo Spinelli, http://cubiq.org/
+ * Released under MIT license
+ * http://cubiq.org/dropbox/mit-license.txt
+ *
+ */
+
+(function() { // Define the core element
+ var $ = function(query) {
+ return new customNL(query);
+ },
+ // Custom Node List
+ customNL = function(query) {
+ if (query.nodeType) { // query is already a Node
+ query = [query];
+ } else if (typeof query == 'string') { // query is a string
+ query = document.querySelectorAll(query);
+ } else if (!(query instanceof Array)) { // if none of the above, query must be an array
+ return null;
+ }
+ this.length = query.length;
+ for (var i = 0; i < this.length; i++) {
+ this[i] = query[i];
+ }
+ return this;
+ },
+
+ // Holds all functions to be executed on DOM ready
+ readyFn = [],
+
+ // Executed on DOMContentLoaded
+ DOMReady = function() {
+ for (var i = 0, l = readyFn.length; i < l; i++) {
+ readyFn[i]();
+ }
+ readyFn = null;
+ document.removeEventListener('DOMContentLoaded', DOMReady, false);
+
+ }; // Merge to objects
+
+ $.extend = function(obj, target) {
+ target = target || customNL.prototype; // To help plugin development
+ for (var prop in obj) {
+ target[prop] = obj[prop];
+ }
+ }; // Add feature to the $ class
+
+ $.extend({
+ hasTouch: ('ontouchstart' in window),
+ isIpad: (/ipad/gi).test(navigator.appVersion),
+ isIphone: (/iphone/gi).test(navigator.appVersion),
+ isAndroid: (/android/gi).test(navigator.appVersion),
+ isOrientationAware: ('onorientationchange' in window),
+ isHashChangeAware: ('onhashchange' in window),
+ isStandalone: window.navigator.standalone,
+ has3d: ('WebKitCSSMatrix' in window && 'm11' in new WebKitCSSMatrix()),
+ // Execute functions on DOM ready
+ ready: function(fn) {
+ if (readyFn.length == 0) {
+ document.addEventListener('DOMContentLoaded', DOMReady, false);
+ }
+ readyFn.push(fn);
+ },
+ hasClass: function(el, className) {
+ return new RegExp('(^|\\s)' + className + '(\\s|$)').test(el.className);
+ },
+ }, $);
+
+ // Custom NodeList prototypes
+ customNL.prototype = {
+ each: function(callback) {
+ for (var i = 0; i < this.length; i++) {
+ callback.call(this[i]);
+ }
+ return this;
+ },
+ bind: function(type, fn, capture) {
+ return this.each(function() {
+ this.addEventListener(type, fn, capture ? true : false);
+ });
+ },
+ unbind: function(type, fn, capture) {
+ return this.each(function() {
+ this.removeEventListener(type, fn, capture ? true : false);
+ });
+ },
+ // Returns the first element className
+ hasClass: function(className) {
+ return $.hasClass(this[0], className);
+ },
+ // Add one or more classes to all elements
+ addClass: function() {
+ var className = arguments;
+ for (var i = 0, l = className.length; i < l; i++) {
+ this.each(function() {
+ if (!$.hasClass(this, className[i])) {
+ this.className = this.className ? this.className + ' ' + className[i] : className[i];
+ }
+ });
+ }
+ return this;
+ },
+
+ // Remove one or more classes from all elements
+ removeClass: function() {
+ var className = arguments;
+ for (var i = 0, l = className.length; i < l; i++) {
+ this.each(function() {
+ this.className = this.className.replace(new RegExp('(^|\\s+)' + className[i] + '(\\s+|$)'), ' ');
+ });
+ }
+ return this;
+ }
+ } // Expose $ to the world
+ window.$ = $;
+})();
+
+
+/*-------------Boiler Plate Stuff---------------------*/
+
+window.requestAnimFrame = (function() {
+ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame ||
+ function( /* function */ callback, /* DOMElement */ element) {
+ return window.setTimeout(callback, 1000 / 60);
+ };
+})();
+
+window.log = function() {
+ log.history = log.history || [];
+ log.history.push(arguments);
+ arguments.callee = arguments.callee.caller;
+ if (this.console) console.log(Array.prototype.slice.call(arguments));
+};
+
+(function(b) {
+ function c() {}
+ for (var d = "assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","), a; a = d.pop();) b[a] = b[a] || c
+})(window.console = window.console || {});
+
+
+
+
+
+
+/*-------------Helper Methods---------------------*/
+
+function findPos(obj) {
+ var curleft = curtop = 0;
+ var offset = new Object();
+ if (obj.offsetParent) {
+ do {
+ curleft += obj.offsetLeft;
+ curtop += obj.offsetTop;
+ } while (obj = obj.offsetParent);
+ offset.X = curleft;
+ offset.Y = curtop;
+ return offset;
+ }
+}
+
+function BlockMove(event) {
+ event.preventDefault();
+}
+
+function set2dTranslate(ele, x, y) {
+ var v = "translate(" + x + "," + y + ")";
+ ele.style.transform = v;
+ ele.style.WebkitTransform = v;
+ ele.style.msTransform = v;
+ ele.style.MozTransform = v;
+}
+
+function set3dTranslate(ele, x, y) {
+ var v = "translate3d(" + x + "," + y + ", 0px)";
+ ele.style.transform = v;
+ ele.style.WebkitTransform = v;
+}
+
+function set2dRotate(ele, degrees) {
+ var v = "rotate(" + degrees + "deg)";
+ ele.style.transform = v;
+ ele.style.WebkitTransform = v;
+ ele.style.msTransform = v;
+ ele.style.MozTransform = v;
+}
+
+function set3dRotate(ele, degrees) {
+ var v = "rotate3d(0,0,0," + degrees + "deg)";
+ ele.style.transform = v;
+ ele.style.WebkitTransform = v;
+}
+
+function set3dScale(ele, sx, sy) {
+ var v = "scale3d(" + sx + "," + sy + "0)";
+ ele.style.transform = v;
+ ele.style.WebkitTransform = v;
+ ele.style.msTransform = v;
+ ele.style.MozTransform = v;
+}
+
+function set2dScale(ele, sx, sy) {
+ var v = "scale(" + sx + "," + sy + ")";
+ ele.style.transform = v;
+ ele.style.WebkitTransform = v;
+ ele.style.msTransform = v;
+ ele.style.MozTransform = v;
+}
+
+function set2dScaleTranslate(ele, x, y, sx, sy) {
+ var v = "scale(" + sx + "," + sy + ") translate(" + x + "," + y + ")";
+ ele.style.transform = v;
+ ele.style.WebkitTransform = v;
+ ele.style.msTransform = v;
+ ele.style.MozTransform = v;
+}
+
+function set3dScaleTranslate(ele, x, y, sx, sy) {
+ var v = "scale3d(" + sx + "," + sy + "0) translate(" + x + "," + y + "0)";
+ ele.style.transform = v;
+ ele.style.WebkitTransform = v;
+ ele.style.msTransform = v;
+ ele.style.MozTransform = v;
+}

0 comments on commit aee61c5

Please sign in to comment.