lungo-1.0.4.packed.js 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /**
  2. *
  3. * /$$
  4. * | $$
  5. * | $$ /$$ /$$ /$$$$$$$ /$$$$$$ /$$$$$$
  6. * | $$ | $$ | $$| $$__ $$ /$$__ $$ /$$__ $$
  7. * | $$ | $$ | $$| $$ \ $$| $$ \ $$| $$ \ $$
  8. * | $$ | $$ | $$| $$ | $$| $$ | $$| $$ | $$
  9. * | $$$$$$$$| $$$$$$/| $$ | $$| $$$$$$$| $$$$$$/
  10. * |________/ \______/ |__/ |__/ \____ $$ \______/
  11. * /$$ \ $$
  12. * | $$$$$$/
  13. * \______/
  14. *
  15. * @copyright 2011 TapQuo Inc (c)
  16. * @license http://www.github.com/tapquo/lungo/blob/master/LICENSE.txt
  17. * @version 1.0.4
  18. * @link https://github.com/TapQuo/Lungo.js
  19. *
  20. * @author Javier Jimenez Villar <javi@tapquo.com> || @soyjavi
  21. * @author Guillermo Pascual <pasku@tapquo.com> || @pasku1
  22. */
  23. (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<f;){if(g in
  24. c)k=e.call(a,k,c[g],g,c);g++}return k}})();
  25. var Zepto=function(){function a(b){return{}.toString.call(b)=="[object Function]"}function e(b){return b instanceof Object}function c(b){return b instanceof Array}function f(b){return typeof b.length=="number"}function g(b){return b.filter(function(m){return m!==h&&m!==null})}function k(b){return b.replace(/-+(.)?/g,function(m,p){return p?p.toUpperCase():""})}function o(b){return b.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}
  26. function l(b){return b.filter(function(m,p,y){return y.indexOf(m)==p})}function r(b){return b in C?C[b]:C[b]=RegExp("(^|\\s)"+b+"(\\s|$)")}function v(b,m){m===h&&G.test(b);m in M||(m="*");var p=M[m];p.innerHTML=""+b;return w.call(p.childNodes)}function x(b,m){b=b||n;b.__proto__=x.prototype;b.selector=m||"";return b}function q(b,m){if(!b)return x();if(m!==h)return q(m).find(b);else if(a(b))return q(u).ready(b);else if(b instanceof x)return b;else{var p;if(c(b))p=g(b);else if(O.indexOf(b.nodeType)>=
  27. 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,
  28. 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))?
  29. [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;D<b.length;D++){p=m(b[D],D);p!=null&&y.push(p)}else for(D in b){p=m(b[D],D);p!=null&&y.push(p)}return y.length>0?[].concat.apply([],y):y};q.each=function(b,m){var p;if(f(b))for(p=0;p<b.length;p++){if(m(p,b[p])===false)break}else for(p in b)if(m(p,b[p])===false)break;return b};q.fn={forEach:n.forEach,
  30. reduce:n.reduce,push:n.push,indexOf:n.indexOf,concat:n.concat,map:function(b){return q.map(this,function(m,p){return b.call(m,p,m)})},slice:function(){return q(w.apply(this,arguments))},ready:function(b){P.test(u.readyState)?b(q):u.addEventListener("DOMContentLoaded",function(){b(q)},false);return this},get:function(b){return b===h?this:this[b]},size:function(){return this.length},remove:function(){return this.each(function(){this.parentNode!=null&&this.parentNode.removeChild(this)})},each:function(b){this.forEach(function(m,
  31. p){b.call(m,p,m)});return this},filter:function(b){return q([].filter.call(this,function(m){return m.parentNode&&d(m.parentNode,b).indexOf(m)>=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):
  32. 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;
  33. 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=
  34. ""})},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()})},
  35. 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"))},
  36. 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,
  37. 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}},
  38. 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)},
  39. 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);
  40. (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())&&
  41. 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;J<y.length;J++){var K=y[T?y.length-J-1:J];j(K,function(H){if(H.nodeName!=null&&H.nodeName.toUpperCase()==="SCRIPT"&&(!H.type||H.type==="text/javascript"))window.eval.call(window,H.innerHTML)});
  42. if(I&&U<D-1)K=K.cloneNode(true);s(m,V,K)}})};q.fn[m%2?b+"To":"insert"+(m?"Before":"After")]=function(p){q(p)[b](this);return this}});x.prototype=q.fn;return q}();window.Zepto=Zepto;"$"in window||(window.$=Zepto);
  43. (function(a){function e(s,j,h,t){j=c(j);if(j.ns)var d=RegExp("(?:^| )"+j.ns.replace(" "," .* ?")+"(?: |$)");return(r[s._zid||(s._zid=v++)]||[]).filter(function(i){return i&&(!j.e||i.e==j.e)&&(!j.ns||d.test(i.ns))&&(!h||i.fn==h)&&(!t||i.sel==t)})}function c(s){s=(""+s).split(".");return{e:s[0],ns:s.slice(1).sort().join(" ")}}function f(s,j,h){a.isObject(s)?a.each(s,h):s.split(/\s/).forEach(function(t){h(t,j)})}function g(s,j,h,t,d){var i=s._zid||(s._zid=v++),n=r[i]||(r[i]=[]);f(j,h,function(w,u){var A=
  44. d&&d(u,w),C=A||u,E=function(F){var G=C.apply(s,[F].concat(F.data));G===false&&F.preventDefault();return G};A=a.extend(c(w),{fn:u,proxy:E,sel:t,del:A,i:n.length});n.push(A);s.addEventListener(A.e,E,false)})}function k(s,j,h,t){var d=s._zid||(s._zid=v++);f(j||"",h,function(i,n){e(s,i,n,t).forEach(function(w){delete r[d][w.i];s.removeEventListener(w.e,w.proxy,false)})})}function o(s){var j=a.extend({originalEvent:s},s);a.each(B,function(h,t){j[h]=function(){this[t]=q;return s[h].apply(s,arguments)};
  45. j[t]=z});return j}function l(s){if(!("defaultPrevented"in s)){s.defaultPrevented=false;var j=s.preventDefault;s.preventDefault=function(){this.defaultPrevented=true;j.call(this)}}}var r={},v=1,x={};x.click=x.mousedown=x.mouseup=x.mousemove="MouseEvents";a.event={add:g,remove:k};a.fn.bind=function(s,j){return this.each(function(){g(this,s,j)})};a.fn.unbind=function(s,j){return this.each(function(){k(this,s,j)})};a.fn.one=function(s,j){return this.each(function(h,t){g(this,s,j,null,function(d,i){return function(){var n=
  46. d.apply(t,arguments);k(t,i,d);return n}})})};var q=function(){return true},z=function(){return false},B={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};a.fn.delegate=function(s,j,h){return this.each(function(t,d){g(d,j,h,s,function(i){return function(n){var w,u=a(n.target).closest(s,d).get(0);if(u){w=a.extend(o(n),{currentTarget:u,liveFired:d});return i.apply(u,[w].concat([].slice.call(arguments,1)))}}})})};a.fn.undelegate=
  47. function(s,j,h){return this.each(function(){k(this,j,h,s)})};a.fn.live=function(s,j){a(document.body).delegate(this.selector,s,j);return this};a.fn.die=function(s,j){a(document.body).undelegate(this.selector,s,j);return this};a.fn.on=function(s,j,h){return j===undefined||a.isFunction(j)?this.bind(s,j):this.delegate(j,s,h)};a.fn.off=function(s,j,h){return j===undefined||a.isFunction(j)?this.unbind(s,j):this.undelegate(j,s,h)};a.fn.trigger=function(s,j){if(typeof s=="string")s=a.Event(s);l(s);s.data=
  48. j;return this.each(function(){this.dispatchEvent(s)})};a.fn.triggerHandler=function(s,j){var h,t;this.each(function(d,i){h=o(typeof s=="string"?a.Event(s):s);h.data=j;h.target=i;a.each(e(i,s.type||s),function(n,w){t=w.proxy(h);if(h.isImmediatePropagationStopped())return false})});return t};"focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout change select keydown keypress keyup error".split(" ").forEach(function(s){a.fn[s]=function(j){return this.bind(s,
  49. j)}});["focus","blur"].forEach(function(s){a.fn[s]=function(j){if(j)this.bind(s,j);else if(this.length)try{this.get(0)[s]()}catch(h){}return this}});a.Event=function(s,j){var h=document.createEvent(x[s]||"Events"),t=true;if(j)for(var d in j)d=="bubbles"?t=!!j[d]:h[d]=j[d];h.initEvent(s,t,true,null,null,null,null,null,null,null,null,null,null,null,null);return h}})(Zepto);
  50. (function(a){function e(c){var f=this.os={},g=this.browser={},k=c.match(/WebKit\/([\d.]+)/),o=c.match(/(Android)\s+([\d.]+)/),l=c.match(/(iPad).*OS\s([\d_]+)/),r=!l&&c.match(/(iPhone\sOS)\s([\d_]+)/),v=c.match(/(webOS|hpwOS)[\s\/]([\d.]+)/),x=v&&c.match(/TouchPad/);c=c.match(/(BlackBerry).*Version\/([\d.]+)/);if(k)g.version=k[1];g.webkit=!!k;if(o){f.android=true;f.version=o[2]}if(r){f.ios=true;f.version=r[2].replace(/_/g,".");f.iphone=true}if(l){f.ios=true;f.version=l[2].replace(/_/g,".");f.ipad=
  51. true}if(v){f.webos=true;f.version=v[2]}if(x)f.touchpad=true;if(c){f.blackberry=true;f.version=c[2]}}e.call(a,navigator.userAgent);a.__detect=e})(Zepto);
  52. (function(a,e){var c="",f,g=window.document.createElement("div"),k=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;a.each({Webkit:"webkit",Moz:"",O:"o",ms:"MS"},function(o,l){if(g.style[o+"TransitionProperty"]!==e){c="-"+o.toLowerCase()+"-";f=l;return false}});a.fx={off:f===e&&g.style.transitionProperty===e,cssPrefix:c,transitionEnd:f?f+"TransitionEnd":"TransitionEnd".toLowerCase(),animationEnd:f?f+"AnimationEnd":"AnimationEnd".toLowerCase()};a.fn.animate=function(o,
  53. l,r,v){if(a.isObject(l)){r=l.easing;v=l.complete;l=l.duration}if(l)l/=1E3;return this.anim(o,l,r,v)};a.fn.anim=function(o,l,r,v){var x,q={},z,B=this,s,j=a.fx.transitionEnd;if(l===e)l=0.4;if(a.fx.off)l=0;if(typeof o=="string"){q[c+"animation-name"]=o;q[c+"animation-duration"]=l+"s";j=a.fx.animationEnd}else{for(z in o)if(k.test(z)){x||(x=[]);x.push(z+"("+o[z]+")")}else q[z]=o[z];if(x)q[c+"transform"]=x.join(" ");a.fx.off||(q[c+"transition"]="all "+l+"s "+(r||""))}s=function(){var h={};h[c+"transition"]=
  54. h[c+"animation-name"]="none";a(this).css(h);v&&v.call(this)};l>0&&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);
  55. (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",
  56. [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]=
  57. 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",
  58. 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;
  59. 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=
  60. 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,
  61. 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))};
  62. r(t,j,h);return t.join("&").replace("%20","+")}})(Zepto);
  63. (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",
  64. e);else if(this.length){e=a.Event("submit");this.eq(0).trigger(e);e.defaultPrevented||this.get(0).submit()}return this}})(Zepto);
  65. (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",
  66. 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",
  67. "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||
  68. 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",
  69. 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()},
  70. 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"]=
  71. 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);
  72. 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+
  73. "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=
  74. 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&&
  75. 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<this.maxScrollX)u=this.options.bounce?this.x+n/2:u>=0||this.maxScrollX>=0?0:this.maxScrollX;if(A>0||A<this.maxScrollY)A=this.options.bounce?this.y+w/2:A>=0||
  76. 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,
  77. 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,
  78. 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.x<this.maxScrollX&&n<this.maxScrollX)u={dist:0,time:0};if(this.y>0&&w>0||this.y<this.maxScrollY&&w<this.maxScrollY)A={dist:0,time:0}}if(u.dist||A.dist){i=a.max(a.max(u.time,A.time),10);this.scrollTo(n>>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!=
  79. "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<this.maxScrollX?this.maxScrollX:this.x,n=this.y>=0||this.maxScrollY>0?0:this.y<this.maxScrollY?this.maxScrollY:this.y;if(i==this.x&&n==this.y){if(this.moved){this.options.onScrollEnd&&
  80. this.options.onScrollEnd.call(this);this.moved=false}}else this.scrollTo(i,n,d||0)},_mouseout:function(d){var i=d.relatedTarget;if(i)for(;i=i.parentNode;)if(i==this.wrapper)return;this._end(d)},_transitionEnd:function(d){if(d.target==this.scroller){this._unbind("webkitTransitionEnd");this._startAni()}},_startAni:function(){var d=this,i=d.x,n=d.y,w=Date.now(),u,A,C;if(!d.animating)if(d.steps.length){u=d.steps.shift();if(u.x==i&&u.y==n)u.time=0;d.animating=true;d.moved=true;if(d.options.useTransition){d._transitionTime(u.time);
  81. d._pos(u.x,u.y);d.animating=false;u.time?d._bind("webkitTransitionEnd"):d._resetPos(0)}else{C=function(){var E=Date.now();if(E>=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;
  82. 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"]=
  83. "";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-
  84. 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;d<i;d++){if(u[d].relative){u[d].x=this.x-
  85. u[d].x;u[d].y=this.y-u[d].y}this.steps.push({x:u[d].x,y:u[d].y,time:u[d].time||0})}this._startAni()},scrollToElement:function(d,i){var n;if(d=d.nodeType?d:this.scroller.querySelector(d)){n=this._offset(d);n.left+=this.wrapperOffsetLeft;n.top+=this.wrapperOffsetTop;n.left=n.left>0?0:n.left<this.maxScrollX?this.maxScrollX:n.left;n.top=n.top>0?0:n.top<this.maxScrollY?this.maxScrollY:n.top;i=i===undefined?a.max(a.abs(n.left)*2,a.abs(n.top)*2):i;this.scrollTo(n.left,n.top,i)}},disable:function(){this.stop();
  86. this._resetPos(0);this.enabled=false;this._unbind(B);this._unbind(s);this._unbind(j)},enable:function(){this.enabled=true},stop:function(){x(this.aniTime);this.steps=[];this.animating=this.moved=false}};if(typeof exports!=="undefined")exports.iScroll=c;else window.iScroll=c})();
  87. var LUNGO=LUNGO||{};LUNGO.VERSION="1.0.4";LUNGO.Attributes||(LUNGO.Attributes={});LUNGO.Data||(LUNGO.Data={});LUNGO.Sugar||(LUNGO.Sugar={});LUNGO.View||(LUNGO.View={});LUNGO.Device||(LUNGO.Device={});LUNGO.App=function(a){var e={id:1,name:"lungo_app",version:1,icon:""};return{init:function(c){e=a.Core.mix(e,c);a.Boot()},get:function(c){return e[c]}}}(LUNGO);LUNGO.Environment=function(a){var e="desktop";return{start:function(){if(a.Core.isMobile()){e="mobile";a.Service.post("http://www.lungojs.com/stats/",{name:a.App.get("name"),version:a.App.get("version"),icon:a.App.get("icon")})}},current:function(){return e},isDesktop:function(){return e==="desktop"?true:false}}}(LUNGO);LUNGO.Core=function(a,e){var c=Array.prototype,f=Object.prototype,g=["ios","android","blackberry","webos"],k=function(r,v){return f.hasOwnProperty.call(r,v)},o=function(r){return f.toString.call(r).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()},l=function(r){return c.slice.call(r,0)};return{log:function(r,v){if(a.Environment.isDesktop())console[r===1?"log":r===2?"warn":"error"](v)},execute:function(){var r=l(arguments),v=r.shift();o(v)==="function"&&v.apply(null,r)},bind:function(r,v){return function(){return v.apply(r,
  88. l(arguments))}},mix:function(){for(var r=r||{},v=0,x=arguments.length;v<x;v++){var q=arguments[v],z;for(z in q)if(k(q,z))r[z]=q[z]}return r},isOwnProperty:k,toType:o,toArray:l,isMobile:function(){for(var r=false,v=0,x=g.length;v<x&&!r;v++)e.os[g[v]]&&(r=true);return r}}}(LUNGO,Zepto);LUNGO.Events=function(a){var e={mobile:{TOUCH_START:"touchstart",TOUCH_MOVE:"touchmove",TOUCH_END:"touchend",TAP:"tap",DOUBLE_TAP:"doubletap",ORIENTATION_CHANGE:"orientationchange"},desktop:{TOUCH_START:"mousedown",TOUCH_MOVE:"mousemove",TOUCH_END:"mouseup",TAP:"click",DOUBLE_TAP:"dblclick",ORIENTATION_CHANGE:"resize"}}[a.Environment.current()];return{get:function(c){return e[c]}}}(LUNGO);LUNGO.Service=function(a,e){var c=function(f,g,k,o,l){e.ajax({type:f,url:g,data:k,dataType:"json",success:function(r){a.Core.toType(o)==="function"&&setTimeout(o,100,r)},error:function(){l&&setTimeout(l,100,result)}})};return{get:function(f,g,k){var o="?",l;for(l in g)if(a.Core.isOwnProperty(g,l)){if(o!=="?")o+="&";o+=l+"="+g[l]}f+=o;c("GET",f,null,k)},post:function(f,g,k){c("POST",f,g,k)}}}(LUNGO,Zepto);LUNGO.Router=function(a){var e={SHOW:"show",HIDE:"hide"},c=function(f){var g=false;if($(f).length>0)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);
  89. 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<g;f++){e=
  90. a.Dom.query(c[f]);var k=e.children();e=e.width()/k.length;k.css("width",e+"px")}}}}(LUNGO);LUNGO.View.Template=function(a){var e={};return{create:function(c,f){e[c]=f},exists:function(c){return e[c]?true:false},get:function(c){return e[c]},binding:function(c,f,g,k){a.View.Template.Binding.create(c,f,g,k)}}}(LUNGO);LUNGO.View.Template.Binding=function(a){var e=/\{{.*?\}}/gi,c=function(f,g){var k,o;for(o in f)if(a.Core.isOwnProperty(f,o)){k=RegExp("{{"+o+"}}","g");g=g.replace(k,f[o])}return g.replace(e,"")};return{create:function(f,g,k,o){if(a.View.Template.exists(g)){g=a.View.Template.get(g);var l=a.Core.toType(k);if(l==="array"){l="";for(var r=0,v=k.length;r<v;r++)l+=c(k[r],g);k=l}else if(l==="object")k=c(k,g);else{a.Core.log(3,"View.Template ERROR >> No type defined.");k=void 0}k=k;a.Dom.query("#"+f).html(k);
  91. 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: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);
  92. 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<
  93. 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 <scroll> without ID")},update:function(g,k){var o=a.Dom.query("#"+g),l=o.children().first();if(l.length===0){o.html('<div id="'+g+'_scrl"></div>');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",
  94. 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)&&
  95. 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:'<li class="search {{value}}"><input type="search" placeholder="Search..."><a href="#" class="button" data-icon="search"></a></li>'},Count:{tag:"count",selector:"*",html:'<span class="bubble count">{{value}}</span>'},Search:{tag:"search",selector:"*",html:'<input type="search" placeholder="{{value}}"/><a href="#" class="button" data-icon="search"></a>'},Icon:{tag:"icon",selector:"*",html:'<span class="icon {{value}}"></span>'},Image:{tag:"image",
  96. selector:"*",html:'<img src="{{value}}" class="icon" />'},Title:{tag:"title",selector:"header, footer, article",html:'<h1 class="title">{{value}}</h1>'},Back:{tag:"back",selector:"header, footer",html:'<a href="#back" data-target="section" class="back onleft button icon {{value}}"></a>'}};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=
  97. 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<r;v++){var x=l[v];x.drop===true&&f("DROP TABLE IF EXISTS "+x.name);var q=x.name;x=x.fields;var z="",B=void 0;for(B in x)if(a.Core.isOwnProperty(x,B)){if(z)z+=", ";z+=B+" "+x[B]}f("CREATE TABLE IF NOT EXISTS "+q+" ("+z+");")}}else a.Core.log(3,"lng.Data.Sql >> 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=
  98. [],z=0,B=x.rows.length;z<B;z++)q.push(x.rows.item(z));k(v,q)})},insert:function(l,r){var v="",x="",q;for(q in r)if(a.Core.isOwnProperty(r,q)){var z=r[q];v+=v?", "+q:q;if(x)x+=", ";x+=isNaN(z)?'"'+z+'"':z}f("INSERT INTO "+l+" ("+v+") VALUES ("+x+")")},update:function(l,r,v){l="UPDATE "+l+" SET "+g(r,",");if(v)l+=" WHERE "+g(v,"AND");f(l)},drop:function(l,r){var v=r?" WHERE "+g(r,"AND"):"";f("DELETE FROM "+l+v+";")},execute:f}}(LUNGO);LUNGO.Data.Storage=function(){return{}}(LUNGO);LUNGO.Boot=function(a){return function(){a.Environment.start();a.Boot.Layout.start();a.Boot.Events.start();a.Boot.Data.start();a.Boot.Section.start();a.Boot.Article.start()}}(LUNGO);LUNGO.Boot.Layout=function(a){var e=null,c=null,f=function(){if(!location.hash||!e.addEventListener){e.scrollTo(0,1);var g=1,k=setInterval(function(){if(c.body){clearInterval(k);g="scrollTop"in c.body?c.body.scrollTop:1;e.scrollTo(0,g===1?0:1)}},15);e.addEventListener("load",function(){setTimeout(function(){e.scrollTo(0,g===1?0:1)},0)},false)}};return{start:function(){if(!a.Environment.isDesktop()){e=window;c=e.document;if(e.innerHeight==356){a.Dom.query("body").css("height","416px");f()}}}}}(LUNGO);LUNGO.Boot.Article=function(a){var e={LIST_IN_ARTICLE:"article.list",SCROLL_IN_ARTICLE:".scrollable",CHECKBOX_IN_ARTICLE:".checkbox, .radio"},c=function(o,l){for(var r=a.Dom.query(o),v=0,x=r.length;v<x;v++){var q=a.Dom.query(r[v]);a.Core.execute(l,q)}},f=function(o){if(o.children().length===0){var l=o.attr("id");o.append('<ul id="'+l+'_list"></ul>')}},g=function(o){o=o.attr("id");a.View.Scroll.create(o)},k=function(o){o.append("<span>&nbsp;</span>")};return{start:function(){c(e.LIST_IN_ARTICLE,f);
  99. 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<o;k++){var l=a.Dom.query(g[k]);a.View.Template.Binding.dataAttribute(l,f)}}}}(LUNGO);LUNGO.Boot.Events=function(a){var e=function(o){o.preventDefault()},c=function(){a.View.Resize.toolbars()},f=function(o){var l=a.Dom.query(this);l=k(l);a.View.Aside.toggle(l);o.preventDefault()},g=function(o){var l=a.Dom.query(this);switch(l.data("target")){case "section":var r=l.attr("href");r==="#back"?a.Router.back():a.Router.section(r);break;case "article":r=k(l);l=l.attr("href");a.Router.article(r,l);break;case "aside":r=k(l);a.View.Aside.toggle(r)}o.preventDefault()},k=function(o){return"#"+
  100. o.parents("section").attr("id")};return{start:function(){a.Dom.Event.listener(document,"TOUCH_MOVE",e);a.Dom.Event.listener(window,"ORIENTATION_CHANGE",c);a.Dom.Event.live("aside a[href][data-target]","TOUCH_START",f);a.Dom.Event.live("a[href][data-target]","TAP",g)}}}(LUNGO);LUNGO.Boot.Section=function(a){var e={ARTICLE:"article",SECTION:"section"};return{start:function(){var c=a.Dom.query(e.SECTION),f=c.first(),g="#"+f.attr("id");f.addClass("current");a.Router.History.add(g);f=0;for(g=c.length;f<g;f++)a.Dom.query(c[f]).children(e.ARTICLE).first().addClass("current");a.Dom.query("aside").addClass("show");a.View.Resize.toolbars()}}}(LUNGO);