/** * * /$$ * | $$ * | $$ /$$ /$$ /$$$$$$$ /$$$$$$ /$$$$$$ * | $$ | $$ | $$| $$__ $$ /$$__ $$ /$$__ $$ * | $$ | $$ | $$| $$ \ $$| $$ \ $$| $$ \ $$ * | $$ | $$ | $$| $$ | $$| $$ | $$| $$ | $$ * | $$$$$$$$| $$$$$$/| $$ | $$| $$$$$$$| $$$$$$/ * |________/ \______/ |__/ |__/ \____ $$ \______/ * /$$ \ $$ * | $$$$$$/ * \______/ * * @copyright 2011 TapQuo Inc (c) * @license http://www.github.com/tapquo/lungo/blob/master/LICENSE.txt * @version 1.0.4 * @link https://github.com/TapQuo/Lungo.js * * @author Javier Jimenez Villar || @soyjavi * @author Guillermo Pascual || @pasku1 */ (function(a){if(String.prototype.trim===a)String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")};if(Array.prototype.reduce===a)Array.prototype.reduce=function(e){if(this===void 0||this===null)throw new TypeError;var c=Object(this),f=c.length>>>0,g=0,k;if(typeof e!="function")throw new TypeError;if(f==0&&arguments.length==1)throw new TypeError;if(arguments.length>=2)k=arguments[1];else{do{if(g in c){k=c[g++];break}if(++g>=f)throw new TypeError;}while(1)}for(;g= 0||b===window){p=[b];b=null}else if(G.test(b)){p=v(b.trim(),RegExp.$1);b=null}else p=b.nodeType&&b.nodeType==3?[b]:d(u,b);return x(p,b)}}function z(b,m){return m===h?q(b):q(b).filter(m)}function B(b,m,p,y){return a(m)?m.call(b,p,y):m}function s(b,m,p){var y=b%2?m:m.parentNode;y&&y.insertBefore(p,!b?m.nextSibling:b==1?y.firstChild:b==2?m:null)}function j(b,m){m(b);for(var p in b.childNodes)j(b.childNodes[p],m)}var h,t,d,i,n=[],w=n.slice,u=window.document,A={},C={},E=u.defaultView.getComputedStyle, F={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},G=/^\s*<(\w+)[^>]*>/,O=[1,9,11],L=u.createElement("table"),N=u.createElement("tr"),M={tr:u.createElement("tbody"),tbody:L,thead:L,tfoot:L,td:N,th:N,"*":u.createElement("div")},P=/complete|loaded|interactive/,Q=/^\.([\w-]+)$/,R=/^#([\w-]+)$/,S=/^[\w-]+$/;q.extend=function(b){w.call(arguments,1).forEach(function(m){for(t in m)b[t]=m[t]});return b};q.qsa=d=function(b,m){var p;return b===u&&R.test(m)?(p=b.getElementById(RegExp.$1))? [p]:n:w.call(Q.test(m)?b.getElementsByClassName(RegExp.$1):S.test(m)?b.getElementsByTagName(m):b.querySelectorAll(m))};q.isFunction=a;q.isObject=e;q.isArray=c;q.map=function(b,m){var p,y=[],D;if(f(b))for(D=0;D0?[].concat.apply([],y):y};q.each=function(b,m){var p;if(f(b))for(p=0;p=0}))},end:function(){return this.prevObject||q()},andSelf:function(){return this.add(this.prevObject||q())},add:function(b,m){return q(l(this.concat(q(b,m))))},is:function(b){return this.length>0&&q(this[0]).filter(b).length>0},not:function(b){var m=[];if(a(b)&&b.call!==h)this.each(function(y){b.call(this,y)||m.push(this)});else{var p=typeof b=="string"?this.filter(b): f(b)&&a(b.item)?w.call(b):q(b);this.forEach(function(y){p.indexOf(y)<0&&m.push(y)})}return q(m)},eq:function(b){return b===-1?this.slice(b):this.slice(b,+b+1)},first:function(){var b=this[0];return b&&!e(b)?b:q(b)},last:function(){var b=this[this.length-1];return b&&!e(b)?b:q(b)},find:function(b){var m;m=this.length==1?d(this[0],b):this.map(function(){return d(this,b)});return q(m)},closest:function(b,m){var p=this[0],y=d(m||u,b);for(y.length||(p=null);p&&y.indexOf(p)<0;)p=p!==m&&p!==u&&p.parentNode; return q(p)},parents:function(b){for(var m=[],p=this;p.length>0;)p=q.map(p,function(y){if((y=y.parentNode)&&y!==u&&m.indexOf(y)<0){m.push(y);return y}});return z(m,b)},parent:function(b){return z(l(this.pluck("parentNode")),b)},children:function(b){return z(this.map(function(){return w.call(this.children)}),b)},siblings:function(b){return z(this.map(function(m,p){return w.call(p.parentNode.children).filter(function(y){return y!==p})}),b)},empty:function(){return this.each(function(){this.innerHTML= ""})},pluck:function(b){return this.map(function(){return this[b]})},show:function(){return this.each(function(){this.style.display=="none"&&(this.style.display=null);if(E(this,"").getPropertyValue("display")=="none"){var b=this.style,m=this.nodeName,p,y;if(!A[m]){p=u.createElement(m);u.body.appendChild(p);y=E(p,"").getPropertyValue("display");p.parentNode.removeChild(p);y=="none"&&(y="block");A[m]=y}b.display=A[m]}})},replaceWith:function(b){return this.each(function(){q(this).before(b).remove()})}, wrap:function(b){return this.each(function(){q(this).wrapAll(q(b)[0].cloneNode(false))})},wrapAll:function(b){if(this[0]){q(this[0]).before(b=q(b));b.append(this)}return this},unwrap:function(){this.parent().each(function(){q(this).replaceWith(q(this).children())});return this},hide:function(){return this.css("display","none")},toggle:function(b){return(b===h?this.css("display")=="none":b)?this.show():this.hide()},prev:function(){return q(this.pluck("previousElementSibling"))},next:function(){return q(this.pluck("nextElementSibling"))}, html:function(b){return b===h?this.length>0?this[0].innerHTML:null:this.each(function(m){var p=this.innerHTML;q(this).empty().append(B(this,b,m,p))})},text:function(b){return b===h?this.length>0?this[0].textContent:null:this.each(function(){this.textContent=b})},attr:function(b,m){var p;return typeof b=="string"&&m===h?this.length==0?h:b=="value"&&this[0].nodeName=="INPUT"?this.val():!(p=this[0].getAttribute(b))&&b in this[0]?this[0][b]:p:this.each(function(y){if(e(b))for(t in b)this.setAttribute(t, b[t]);else this.setAttribute(b,B(this,m,y,this.getAttribute(b)))})},removeAttr:function(b){return this.each(function(){this.removeAttribute(b)})},data:function(b,m){return this.attr("data-"+b,m)},val:function(b){return b===h?this.length>0?this[0].value:null:this.each(function(m){this.value=B(this,b,m,this.value)})},offset:function(){if(this.length==0)return null;var b=this[0].getBoundingClientRect();return{left:b.left+window.pageXOffset,top:b.top+window.pageYOffset,width:b.width,height:b.height}}, css:function(b,m){if(m===h&&typeof b=="string")return this.length==0?h:this[0].style[k(b)]||E(this[0],"").getPropertyValue(b);var p="";for(t in b)p+=o(t)+":"+(typeof b[t]=="number"&&!F[o(t)]?b[t]+"px":b[t])+";";if(typeof b=="string")p=o(b)+":"+(typeof m=="number"&&!F[o(b)]?m+"px":m);return this.each(function(){this.style.cssText+=";"+p})},index:function(b){return b?this.indexOf(q(b)[0]):this.parent().children().indexOf(this[0])},hasClass:function(b){return this.length<1?false:r(b).test(this[0].className)}, addClass:function(b){return this.each(function(m){i=[];var p=this.className;B(this,b,m,p).split(/\s+/g).forEach(function(y){q(this).hasClass(y)||i.push(y)},this);i.length&&(this.className+=(p?" ":"")+i.join(" "))})},removeClass:function(b){return this.each(function(m){if(b===h)return this.className="";i=this.className;B(this,b,m,i).split(/\s+/g).forEach(function(p){i=i.replace(r(p)," ")});this.className=i.trim()})},toggleClass:function(b,m){return this.each(function(p){p=B(this,b,p,this.className); (m===h?!q(this).hasClass(p):m)?q(this).addClass(p):q(this).removeClass(p)})}};"filter,add,not,eq,first,last,find,closest,parents,parent,children,siblings".split(",").forEach(function(b){var m=q.fn[b];q.fn[b]=function(){var p=m.apply(this,arguments);p.prevObject=this;return p}});["width","height"].forEach(function(b){q.fn[b]=function(m){var p,y=b.replace(/./,function(D){return D[0].toUpperCase()});return m===h?this[0]==window?window["inner"+y]:this[0]==u?u.documentElement["offset"+y]:(p=this.offset())&& p[b]:this.each(function(D){var I=q(this);I.css(b,B(this,m,D,I[b]()))})}});["after","prepend","before","append"].forEach(function(b,m){q.fn[b]=function(p){var y=e(p)?p:v(p);if(!("length"in y)||y.nodeType)y=[y];if(y.length<1)return this;var D=this.length,I=D>1,T=m<2;return this.each(function(U,V){for(var J=0;J0&&this.one(j,s);setTimeout(function(){B.css(q);l<=0&&setTimeout(function(){B.each(function(){s.call(this)})},0)},0);return this};g=null})(Zepto); (function(a){function e(j,h,t,d){if(j.global){j=h||q;t=a.Event(t);a(j).trigger(t,d);return!t.defaultPrevented}}function c(j){j.global&&a.active++===0&&e(j,null,"ajaxStart")}function f(j,h){var t=h.context;if(h.beforeSend.call(t,j,h)===false||e(h,t,"ajaxBeforeSend",[j,h])===false)return false;e(h,t,"ajaxSend",[j,h])}function g(j,h,t){var d=t.context;t.success.call(d,j,"success",h);e(t,d,"ajaxSuccess",[h,t,j]);o("success",h,t)}function k(j,h,t,d){var i=d.context;d.error.call(i,t,h,j);e(d,i,"ajaxError", [t,d,j]);o(h,t,d)}function o(j,h,t){var d=t.context;t.complete.call(d,h,j);e(t,d,"ajaxComplete",[h,t]);t.global&&!--a.active&&e(t,null,"ajaxStop")}function l(){}function r(j,h,t,d){var i=a.isArray(h);a.each(h,function(n,w){if(d)n=t?d:d+"["+(i?"":n)+"]";if(!d&&i)j.add(w.name,w.value);else(t?a.isArray(w):x(w))?r(j,w,t,n):j.add(n,w)})}var v=0,x=a.isObject,q=window.document,z,B;a.active=0;a.ajaxJSONP=function(j){var h="jsonp"+ ++v,t=q.createElement("script"),d={abort:function(){a(t).remove();if(h in window)window[h]= l;o(d,j,"abort")}},i;window[h]=function(n){clearTimeout(i);a(t).remove();delete window[h];g(n,d,j)};t.src=j.url.replace(/=\?/,"="+h);a("head").append(t);if(j.timeout>0)i=setTimeout(function(){d.abort();o(d,j,"timeout")},j.timeout);return d};a.ajaxSettings={type:"GET",beforeSend:l,success:l,error:l,complete:l,context:null,global:true,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript",json:"application/json",xml:"application/xml, text/xml",html:"text/html", text:"text/plain"},crossDomain:false,timeout:0};a.ajax=function(j){var h=a.extend({},j||{});for(z in a.ajaxSettings)if(h[z]===undefined)h[z]=a.ajaxSettings[z];c(h);if(!h.crossDomain)h.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(h.url)&&RegExp.$2!=window.location.host;if(/=\?/.test(h.url))return a.ajaxJSONP(h);if(!h.url)h.url=window.location.toString();if(h.data&&!h.contentType)h.contentType="application/x-www-form-urlencoded";if(x(h.data))h.data=a.param(h.data);if(h.type.match(/get/i)&&h.data){j=h.data; if(h.url.match(/\?.*=/))j="&"+j;else if(j[0]!="?")j="?"+j;h.url+=j}var t=h.accepts[h.dataType];j={};var d=/^([\w-]+:)\/\//.test(h.url)?RegExp.$1:window.location.protocol,i=a.ajaxSettings.xhr(),n;h.crossDomain||(j["X-Requested-With"]="XMLHttpRequest");if(t)j.Accept=t;h.headers=a.extend(j,h.headers||{});i.onreadystatechange=function(){if(i.readyState==4){clearTimeout(n);var w,u=false;if(i.status>=200&&i.status<300||i.status==0&&d=="file:"){if(t=="application/json"&&!/^\s*$/.test(i.responseText))try{w= JSON.parse(i.responseText)}catch(A){u=A}else w=i.responseText;u?k(u,"parsererror",i,h):g(w,i,h)}else k(null,"error",i,h)}};i.open(h.type,h.url,true);if(h.contentType)h.headers["Content-Type"]=h.contentType;for(B in h.headers)i.setRequestHeader(B,h.headers[B]);if(f(i,h)===false){i.abort();return false}if(h.timeout>0)n=setTimeout(function(){i.onreadystatechange=l;i.abort();k(null,"timeout",i,h)},h.timeout);i.send(h.data);return i};a.get=function(j,h){return a.ajax({url:j,success:h})};a.post=function(j, h,t,d){if(a.isFunction(h)){d=d||t;t=h;h=null}return a.ajax({type:"POST",url:j,data:h,success:t,dataType:d})};a.getJSON=function(j,h){return a.ajax({url:j,success:h,dataType:"json"})};a.fn.load=function(j,h){if(!this.length)return this;var t=this,d=j.split(/\s/),i;if(d.length>1){j=d[0];i=d[1]}a.get(j,function(n){t.html(i?a(q.createElement("div")).html(n).find(i).html():n);h&&h.call(t)});return this};var s=encodeURIComponent;a.param=function(j,h){var t=[];t.add=function(d,i){this.push(s(d)+"="+s(i))}; r(t,j,h);return t.join("&").replace("%20","+")}})(Zepto); (function(a){a.fn.serializeArray=function(){var e=[],c;a(Array.prototype.slice.call(this.get(0).elements)).each(function(){c=a(this);var f=c.attr("type");if(!this.disabled&&f!="submit"&&f!="reset"&&f!="button"&&(f!="radio"&&f!="checkbox"||this.checked))e.push({name:c.attr("name"),value:c.val()})});return e};a.fn.serialize=function(){var e=[];this.serializeArray().forEach(function(c){e.push(encodeURIComponent(c.name)+"="+encodeURIComponent(c.value))});return e.join("&")};a.fn.submit=function(e){if(e)this.bind("submit", e);else if(this.length){e=a.Event("submit");this.eq(0).trigger(e);e.defaultPrevented||this.get(0).submit()}return this}})(Zepto); (function(a){function e(){if(c.last&&Date.now()-c.last>=g){a(c.target).trigger("longTap");c={}}}var c={},f,g=750;a(document).ready(function(){a(document.body).bind("touchstart",function(k){var o=Date.now(),l=o-(c.last||o);c.target="tagName"in k.touches[0].target?k.touches[0].target:k.touches[0].target.parentNode;f&&clearTimeout(f);c.x1=k.touches[0].pageX;c.y1=k.touches[0].pageY;if(l>0&&l<=250)c.isDoubleTap=true;c.last=o;setTimeout(e,g)}).bind("touchmove",function(k){c.x2=k.touches[0].pageX;c.y2=k.touches[0].pageY}).bind("touchend", function(){if(c.isDoubleTap){a(c.target).trigger("doubleTap");c={}}else if(c.x2>0||c.y2>0){(Math.abs(c.x1-c.x2)>30||Math.abs(c.y1-c.y2)>30)&&a(c.target).trigger("swipe")&&a(c.target).trigger("swipe"+(Math.abs(c.x1-c.x2)>=Math.abs(c.y1-c.y2)?c.x1-c.x2>0?"Left":"Right":c.y1-c.y2>0?"Up":"Down"));c.x1=c.x2=c.y1=c.y2=c.last=0}else if("last"in c)f=setTimeout(function(){f=null;a(c.target).trigger("tap");c={}},250)}).bind("touchcancel",function(){c={}})});["swipe","swipeLeft","swipeRight","swipeUp","swipeDown", "doubleTap","tap","longTap"].forEach(function(k){a.fn[k]=function(o){return this.bind(k,o)}})})(Zepto);(function(){var a=Math,e=/webkit/i.test(navigator.appVersion)?"webkit":/firefox/i.test(navigator.userAgent)?"Moz":"opera"in window?"O":"";/android/gi.test(navigator.appVersion);var c=/iphone|ipad/gi.test(navigator.appVersion),f=/playbook/gi.test(navigator.appVersion),g=/hp-tablet/gi.test(navigator.appVersion),k="WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix,o="ontouchstart"in window&&!g,l=e+"Transform"in document.documentElement.style,r=c||f,v=function(){return window.requestAnimationFrame|| window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(d){return setTimeout(d,17)}}(),x=window.cancelRequestAnimationFrame||window.webkitCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||clearTimeout,q="onorientationchange"in window?"orientationchange":"resize",z=o?"touchstart":"mousedown", B=o?"touchmove":"mousemove",s=o?"touchend":"mouseup",j=o?"touchcancel":"mouseup",h="translate"+(k?"3d(":"("),t=k?",0)":")";c=function(d,i){var n=document,w;this.wrapper=typeof d=="object"?d:n.getElementById(d);this.wrapper.style.overflow="hidden";this.scroller=this.wrapper.children[0];this.options={hScroll:true,vScroll:true,x:0,y:0,bounce:true,bounceLock:false,momentum:true,lockDirection:true,useTransform:true,useTransition:false,onRefresh:null,onBeforeScrollStart:function(u){u.preventDefault()}, onScrollStart:null,onBeforeScrollMove:null,onScrollMove:null,onBeforeScrollEnd:null,onScrollEnd:null,onTouchEnd:null,onDestroy:null};for(w in i)this.options[w]=i[w];this.x=this.options.x;this.y=this.options.y;this.options.useTransform=l?this.options.useTransform:false;this.options.hScrollbar=this.options.hScroll&&this.options.hScrollbar;this.options.vScrollbar=this.options.vScroll&&this.options.vScrollbar;this.options.useTransition=r&&this.options.useTransition;this.scroller.style[e+"TransitionProperty"]= this.options.useTransform?"-"+e.toLowerCase()+"-transform":"top left";this.scroller.style[e+"TransitionDuration"]="0";this.scroller.style[e+"TransformOrigin"]="0 0";if(this.options.useTransition)this.scroller.style[e+"TransitionTimingFunction"]="cubic-bezier(0.33,0.66,0.66,1)";if(this.options.useTransform)this.scroller.style[e+"Transform"]=h+this.x+"px,"+this.y+"px"+t;else this.scroller.style.cssText+=";position:absolute;top:"+this.y+"px;left:"+this.x+"px";this.refresh();this._bind(q,window);this._bind(z); o||this._bind("mouseout",this.wrapper)};c.prototype={enabled:true,x:0,y:0,steps:[],scale:1,handleEvent:function(d){switch(d.type){case z:if(!o&&d.button!==0)break;this._start(d);break;case B:this._move(d);break;case s:case j:this._end(d);break;case q:this._resize();break;case "mouseout":this._mouseout(d);break;case "webkitTransitionEnd":this._transitionEnd(d)}},_resize:function(){this.refresh()},_pos:function(d,i){d=this.hScroll?d:0;i=this.vScroll?i:0;if(this.options.useTransform)this.scroller.style[e+ "Transform"]=h+d+"px,"+i+"px"+t+" scale("+this.scale+")";else{d>>=0;i>>=0;this.scroller.style.left=d+"px";this.scroller.style.top=i+"px"}this.x=d;this.y=i},_start:function(d){var i=o?d.touches[0]:d,n,w;if(this.enabled){this.options.onBeforeScrollStart&&this.options.onBeforeScrollStart.call(this,d);this.options.useTransition&&this._transitionTime(0);this.zoomed=this.animating=this.moved=false;this.dirY=this.dirX=this.absDistY=this.absDistX=this.distY=this.distX=0;if(this.options.momentum){if(this.options.useTransform){n= getComputedStyle(this.scroller,null)[e+"Transform"].replace(/[^0-9-.,]/g,"").split(",");w=n[4]*1;n=n[5]*1}else{w=getComputedStyle(this.scroller,null).left.replace(/[^0-9-]/g,"")*1;n=getComputedStyle(this.scroller,null).top.replace(/[^0-9-]/g,"")*1}if(w!=this.x||n!=this.y){this.options.useTransition?this._unbind("webkitTransitionEnd"):x(this.aniTime);this.steps=[];this._pos(w,n)}}this.startX=this.x;this.startY=this.y;this.pointX=i.pageX;this.pointY=i.pageY;this.startTime=d.timeStamp||Date.now();this.options.onScrollStart&& this.options.onScrollStart.call(this,d);this._bind(B);this._bind(s);this._bind(j)}},_move:function(d){var i=o?d.touches[0]:d,n=i.pageX-this.pointX,w=i.pageY-this.pointY,u=this.x+n,A=this.y+w,C=d.timeStamp||Date.now();this.options.onBeforeScrollMove&&this.options.onBeforeScrollMove.call(this,d);this.pointX=i.pageX;this.pointY=i.pageY;if(u>0||u=0||this.maxScrollX>=0?0:this.maxScrollX;if(A>0||A=0|| this.maxScrollY>=0?0:this.maxScrollY;if(this.absDistX<6&&this.absDistY<6){this.distX+=n;this.distY+=w;this.absDistX=a.abs(this.distX);this.absDistY=a.abs(this.distY)}else{if(this.options.lockDirection)if(this.absDistX>this.absDistY+5){A=this.y;w=0}else if(this.absDistY>this.absDistX+5){u=this.x;n=0}this.moved=true;this._pos(u,A);this.dirX=n>0?-1:n<0?1:0;this.dirY=w>0?-1:w<0?1:0;if(C-this.startTime>300){this.startTime=C;this.startX=this.x;this.startY=this.y}this.options.onScrollMove&&this.options.onScrollMove.call(this, d)}},_end:function(d){if(!(o&&d.touches.length!=0)){var i=o?d.changedTouches[0]:d,n,w,u={dist:0,time:0},A={dist:0,time:0},C=(d.timeStamp||Date.now())-this.startTime;n=this.x;w=this.y;this._unbind(B);this._unbind(s);this._unbind(j);this.options.onBeforeScrollEnd&&this.options.onBeforeScrollEnd.call(this,d);if(this.moved){if(C<300&&this.options.momentum){u=n?this._momentum(n-this.startX,C,-this.x,this.scrollerW-this.wrapperW+this.x,this.options.bounce?this.wrapperW:0):u;A=w?this._momentum(w-this.startY, C,-this.y,this.maxScrollY<0?this.scrollerH-this.wrapperH+this.y:0,this.options.bounce?this.wrapperH:0):A;n=this.x+u.dist;w=this.y+A.dist;if(this.x>0&&n>0||this.x0&&w>0||this.y>0,w>>0,i)}else this._resetPos(200)}else{if(o){for(n=i.target;n.nodeType!=1;)n=n.parentNode;if(n.tagName!="SELECT"&&n.tagName!="INPUT"&&n.tagName!= "TEXTAREA"){w=document.createEvent("MouseEvents");w.initMouseEvent("click",true,true,d.view,1,i.screenX,i.screenY,i.clientX,i.clientY,d.ctrlKey,d.altKey,d.shiftKey,d.metaKey,0,null);w._fake=true;n.dispatchEvent(w)}}this._resetPos(200)}this.options.onTouchEnd&&this.options.onTouchEnd.call(this,d)}},_resetPos:function(d){var i=this.x>=0?0:this.x=0||this.maxScrollY>0?0:this.y=w+u.time){d._pos(u.x,u.y);d.animating=false;d.options.onAnimationEnd&&d.options.onAnimationEnd.call(d);d._startAni()}else{E=(E-w)/u.time-1;A=a.sqrt(1-E*E);E=(u.x-i)*A+i;d._pos(E,(u.y-n)*A+n);if(d.animating)d.aniTime=v(C)}};C()}}else d._resetPos(400)},_transitionTime:function(d){this.scroller.style[e+"TransitionDuration"]=d+"ms"},_momentum:function(d,i,n,w,u){i=a.abs(d)/i; var A=i*i/0.0012,C=0;C=0;if(d>0&&A>n){C=u/(6/(A/i*6.0E-4));n+=C;i=i*n/A;A=n}else if(d<0&&A>w){C=u/(6/(A/i*6.0E-4));w+=C;i=i*w/A;A=w}A*=d<0?-1:1;C=i/6.0E-4;return{dist:A,time:C>>0}},_offset:function(d){for(var i=-d.offsetLeft,n=-d.offsetTop;d=d.offsetParent;){i-=d.offsetLeft;n-=d.offsetTop}return{left:i,top:n}},_bind:function(d,i,n){(i||this.scroller).addEventListener(d,this,!!n)},_unbind:function(d,i,n){(i||this.scroller).removeEventListener(d,this,!!n)},destroy:function(){this.scroller.style[e+"Transform"]= "";this._unbind(q,window);this._unbind(z);this._unbind(B);this._unbind(s);this._unbind(j);this._unbind("mouseout",this.wrapper);this.options.useTransition&&this._unbind("webkitTransitionEnd");this.options.onDestroy&&this.options.onDestroy.call(this)},refresh:function(){var d;this.wrapperW=this.wrapper.clientWidth;this.wrapperH=this.wrapper.clientHeight;this.scrollerW=this.scroller.offsetWidth;this.scrollerH=this.scroller.offsetHeight;this.maxScrollX=this.wrapperW-this.scrollerW;this.maxScrollY=this.wrapperH- this.scrollerH;this.dirY=this.dirX=0;this.hScroll=this.options.hScroll&&this.maxScrollX<0;this.vScroll=this.options.vScroll&&(!this.options.bounceLock&&!this.hScroll||this.scrollerH>this.wrapperH);d=this._offset(this.wrapper);this.wrapperOffsetLeft=-d.left;this.wrapperOffsetTop=-d.top;this.scroller.style[e+"TransitionDuration"]="0";this._resetPos(200)},scrollTo:function(d,i,n,w){var u=d;this.stop();u.length||(u=[{x:d,y:i,time:n,relative:w}]);d=0;for(i=u.length;d0?0:n.left0?0:n.top0)g=true;else a.Core.log(3,"Lungo.Router ERROR: The target "+f+" does not exists.");return g};return{section:function(f){f=f.indexOf("#")?"#"+f:f;if(c("section"+f)){a.Dom.query(a.Router.History.current()).removeClass(e.SHOW).addClass(e.HIDE);a.Dom.query(f).addClass(e.SHOW);a.Router.History.add(f)}},article:function(f,g){c(f+" article"+g)&&a.View.Article.show(f,g)},back:function(){a.Dom.query(a.Router.History.current()).removeClass(e.SHOW); a.Router.History.removeLast();a.Dom.query(a.Router.History.current()).removeClass(e.HIDE).addClass(e.SHOW)}}}(LUNGO);LUNGO.Router.History=function(){var a=[],e=function(){return a[a.length-1]};return{add:function(c){c!==e()&&a.push(c)},current:e,removeLast:function(){a.length-=1}}}();LUNGO.View.Article=function(a){var e={ARTICLE:"article",NAVIGATION_ITEM:"a"},c={ACTIVE:"current"};return{show:function(f,g){var k=f+" "+e.NAVIGATION_ITEM;a.Dom.query(k).removeClass(c.ACTIVE);k=a.Dom.query(k+'[href="'+g+'"]');k.addClass(c.ACTIVE);(k=k.data("title"))&&a.Dom.query(f+" header .title, "+f+" footer .title").text(k);a.Dom.query(f+" "+e.ARTICLE).removeClass(c.ACTIVE);a.Dom.query(g).addClass(c.ACTIVE)}}}(LUNGO);LUNGO.View.Resize=function(a){return{scroll:function(e){var c=e.children().first(),f=c.children().first();if(a.View.Scroll.isHorizontal(e)){f=c.children().length*f.width();c.css("width",f+"px")}else{var g=c.children().length;e=Math.floor(e.width()/f.width());f=Math.ceil(g/e)*f.height();c.css("height",f+"px")}},article:function(e,c,f,g){c=e.children(c);if(c.length>0){g=c[g]();e.children("article").css(f,g+"px")}},toolbars:function(){for(var e=".toolbar nav",c=a.Dom.query(e),f=0,g=c.length;f> No type defined.");k=void 0}k=k;a.Dom.query("#"+f).html(k); a.Core.execute(o)}else a.Core.log(3,"lng.View.Template.binding: id "+g+" not exists")},dataAttribute:function(f,g){var k=f.data(g.tag);if(k){k=g.html.replace("{{value}}",k);f.prepend(k)}}}}(LUNGO);LUNGO.View.Template.List=function(a){var e=null,c=function(){var f=e.order_field,g=e.order_type==="desc"?-1:1;f&&g&&e.data.sort(function(k,o){return k[f]o[f]?g:0})};return{create:function(f){e=f;e.container_id+="_list";f=false;var g=!!a.Dom.query(e.container_id),k=a.View.Template.exists(e.template_id);if(g&&k){a.Dom.query("#"+e.container_id).html("");g=a.Core.toType(e.data);if(g==="array"||g==="object")f=true}if(f){c();a.View.Template.Binding.create(e.container_id,e.template_id,e.data); f=a.Dom.query("#"+e.container_id).parent().attr("id");a.View.Scroll.create(f,{snap:"li"})}}}}(LUNGO);LUNGO.View.Scroll=function(a){var e={hScroll:false,vScroll:false,useTransition:true,momentum:true,lockDirection:true,fixedScrollbar:true,fadeScrollbar:true,hideScrollbar:true},c=function(g){return g.hasClass("horizontal")?true:false},f=function(g,k){a.Data.Cache.exists("scrolls")||a.Data.Cache.set("scrolls",{});var o=a.Data.Cache.get("scrolls");o[g]=new iScroll(g,k);a.Data.Cache.set("scrolls",o)};return{create:function(g,k){if(g){var o=a.Dom.query("#"+g);setTimeout(function(){var l=false,r=o[0];if(r.clientHeight< r.scrollHeight){l=true;var v=r.scrollHeight+90;a.Dom.query(r).children().first().css("height",v+"px")}if(l){l=k;r=c(o)?"hScroll":"vScroll";l||(l={});l[r]=true;k=l=a.Core.mix(e,l);f(g,k)}},100)}else a.Core.log(3,"ERROR: Impossible to create a without ID")},update:function(g,k){var o=a.Dom.query("#"+g),l=o.children().first();if(l.length===0){o.html('
');l=o.children().first()}l.html(k);a.View.Resize.scroll(o);!a.Data.Cache.get("scrolls",g)&&f(g);a.Data.Cache.get("scrolls", g).refresh()},remove:function(g){if(a.Data.Cache.exists("scrolls")){a.Data.Cache.get("scrolls",g).destroy();a.Data.Cache.remove("scrolls",g)}},isHorizontal:c}}(LUNGO);LUNGO.View.Aside=function(a){return{toggle:function(e){a.Dom.query(e+" article").toggleClass("aside")}}}(LUNGO);LUNGO.View.Element=function(a){var e={BUBBLE:".bubble.count"};return{count:function(c,f){var g=a.Dom.query(c);if(g)if(f>0){var k=g.children(e.BUBBLE);if(k.length>0)k.html(f);else{k=LUNGO.Attributes.Data.Count.html.replace("{{value}}",f);g.append(k)}}else g.children(e.BUBBLE).remove()}}}(LUNGO);LUNGO.Dom=function(a,e){return{query:function(c){return e(c)}}}(LUNGO,Zepto);LUNGO.Dom.Event=function(a){var e=function(c,f,g){var k=false;switch(f){case "SWIPE":a.Dom.query(c).swipe(g);break;case "SWIPE_LEFT":a.Dom.query(c).swipeLeft(g);break;case "SWIPE_RIGHT":a.Dom.query(c).swipeRight(g);break;case "SWIPE_UP":a.Dom.query(c).swipeUp(g);break;case "SWIPE_DOWN":a.Dom.query(c).swipeDown(g);break;case "DOUBLE_TAP":a.Environment.isDesktop()?a.Dom.query(c).live(a.Events.get(f),g):a.Dom.query(c).doubleTap(g);break;default:k=true}return k};return{bind:function(c,f,g){e(c,f,g)&& a.Dom.query(c).bind(a.Events.get(f),g)},unbind:function(c,f){a.Dom.query(c).unbind(a.Events.get(f))},live:function(c,f,g){e(c,f,g)&&a.Dom.query(c).live(a.Events.get(f),g)},die:function(c,f){a.Dom.query(c).die(a.Events.get(f))},delegate:function(c,f,g,k){e(c,g,k)&&a.Dom.query(c).delegate(f,a.Events.get(g),k)},undelegate:function(c){a.Dom.query(c).undelegate(c)},listener:function(c,f,g){c.addEventListener(a.Events.get(f),function(k){setTimeout(g,0,k)},false)}}}(LUNGO);LUNGO.Attributes.Data={Search:{tag:"search",selector:".list",html:''},Count:{tag:"count",selector:"*",html:'{{value}}'},Search:{tag:"search",selector:"*",html:''},Icon:{tag:"icon",selector:"*",html:''},Image:{tag:"image", selector:"*",html:''},Title:{tag:"title",selector:"header, footer, article",html:'

{{value}}

'},Back:{tag:"back",selector:"header, footer",html:''}};LUNGO.Data.Cache=function(a){var e={},c=function(g){return arguments.length===1?e[g]:e[arguments[0]][arguments[1]]},f=function(g){return e[g]?true:false};return{set:function(g,k){e[g]=f(g)?a.Core.mix(c(g),k):k},get:c,remove:function(g){if(arguments.length===1)delete e[g];else delete e[arguments[0]][arguments[1]]},exists:f}}(LUNGO);LUNGO.Data.Sql=function(a){var e={name:"lungo_db",version:"1.0",size:65536,schema:[]},c=null,f=function(l,r){a.Core.log(1,"lng.Data.Sql >> "+l);c.transaction(function(v){v.executeSql(l,[],function(x,q){k(r,q)},o)})},g=function(l,r){var v="",x;for(x in l)if(a.Core.isOwnProperty(l,x)){var q=l[x];if(v)v+=" "+r+" ";v+=x+"=";v+=isNaN(q)?'"'+q+'"':q}return v},k=function(l,r){a.Core.toType(l)==="function"&&setTimeout(l,100,r)},o=function(l,r){a.Core.log(3,"lng.Data.Sql >> "+r.code+": "+r.message)};return{init:function(l){e= a.Core.mix(e,l);if(c=openDatabase(e.name,e.version,e.name,e.size)){l=e.schema;var r=l.length;if(r)for(var v=0;v> Failed to connect to database.")},select:function(l,r,v){r=r?" WHERE "+g(r,"AND"):"";f("SELECT * FROM "+l+r,function(x){for(var q= [],z=0,B=x.rows.length;z')}},g=function(o){o=o.attr("id");a.View.Scroll.create(o)},k=function(o){o.append(" ")};return{start:function(){c(e.LIST_IN_ARTICLE,f); c(e.SCROLL_IN_ARTICLE,g);c(e.CHECKBOX_IN_ARTICLE,k)}}}(LUNGO);LUNGO.Boot.Data=function(a){return{start:function(){var e=a.Attributes.Data,c;for(c in e)if(a.Core.isOwnProperty(e,c))for(var f=e[c],g=a.Dom.query(f.selector),k=0,o=g.length;k