lungo-1.2.packed.js 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /**
  2. *
  3. * /$$
  4. * | $$
  5. * | $$ /$$ /$$ /$$$$$$$ /$$$$$$ /$$$$$$
  6. * | $$ | $$ | $$| $$__ $$ /$$__ $$ /$$__ $$
  7. * | $$ | $$ | $$| $$ \ $$| $$ \ $$| $$ \ $$
  8. * | $$ | $$ | $$| $$ | $$| $$ | $$| $$ | $$
  9. * | $$$$$$$$| $$$$$$/| $$ | $$| $$$$$$$| $$$$$$/
  10. * |________/ \______/ |__/ |__/ \____ $$ \______/
  11. * /$$ \ $$
  12. * | $$$$$$/
  13. * \______/
  14. *
  15. * @copyright 2011-2012 TapQuo Inc (c)
  16. * @license http://www.github.com/tapquo/lungo/blob/master/LICENSE.txt
  17. * @version 1.2
  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. var Quo=function(){function a(j,b){j=j||h;j.__proto__=a.prototype;j.selector=b||"";return j}function f(j){if(j){var b=f.getDomainSelector(j);return a(b,j)}else return a()}var h=[];f.extend=function(j){Array.prototype.slice.call(arguments,1).forEach(function(b){for(key in b)j[key]=b[key]});return j};a.prototype=f.fn={};return f}();window.Quo=Quo;"$$"in window||(window.$$=Quo);
  24. (function(a){function f(b){return b.filter(function(g){return g!==undefined&&g!==null})}var h=Object.prototype,j=[];a.toType=function(b){return h.toString.call(b).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()};a.isOwnProperty=function(b,g){return h.hasOwnProperty.call(b,g)};a.getDomainSelector=function(b){var g=null,c=[1,9,11],e=a.toType(b);if(e==="array")g=f(b);else if(e==="string")g=a.query(document,b);else if(c.indexOf(b.nodeType)>=0||b===window)g=[b];return g};a.map=function(b,g){var c=[],e;if(a.toType(b)===
  25. "array")for(e=0;e<b.length;e++){var i=g(b[e],e);i!=null&&c.push(i)}else for(e in b){i=g(b[e],e);i!=null&&c.push(i)}return c.length>0?[].concat.apply([],c):c};a.each=function(b,g){var c;if(a.toType(b)==="array")for(c=0;c<b.length;c++){if(g.call(b[c],c,b[c])===false)break}else for(c in b)if(g.call(b[c],c,b[c])===false)break;return b};a.mix=function(){for(var b={},g=0,c=arguments.length;g<c;g++){var e=arguments[g],i;for(i in e)if(a.isOwnProperty(e,i)&&e[i]!==undefined)b[i]=e[i]}return b};a.fn.forEach=
  26. j.forEach;a.fn.indexOf=j.indexOf;a.fn.map=function(b){return a.map(this,function(g,c){return b.call(g,c,g)})};a.fn.instance=function(b){return this.map(function(){return this[b]})};a.fn.filter=function(b){return a([].filter.call(this,function(g){return g.parentNode&&a.query(g.parentNode,b).indexOf(g)>=0}))}})(Quo);
  27. (function(a){a.fn.attr=function(f,h){return a.toType(f)==="string"&&h===undefined?this[0].getAttribute(f):this.each(function(){this.setAttribute(f,h)})};a.fn.data=function(f,h){return this.attr("data-"+f,h)};a.fn.val=function(f){return a.toType(f)==="string"?this.each(function(){this.value=f}):this.length>0?this[0].value:null};a.fn.show=function(){return this.style("display","block")};a.fn.hide=function(){return this.style("display","none")};a.fn.height=function(){return this.offset().height};a.fn.width=
  28. function(){return this.offset().width};a.fn.offset=function(){var f=this[0].getBoundingClientRect();return{left:f.left+window.pageXOffset,top:f.top+window.pageYOffset,width:f.width,height:f.height}};a.fn.remove=function(){return this.each(function(){this.parentNode!=null&&this.parentNode.removeChild(this)})}})(Quo);
  29. (function(a){var f=/WebKit\/([\d.]+)/,h={android:/(Android)\s+([\d.]+)/,ipad:/(iPad).*OS\s([\d_]+)/,iphone:/(iPhone\sOS)\s([\d_]+)/,blackberry:/(BlackBerry).*Version\/([\d.]+)/,webos:/(webOS|hpwOS)[\s\/]([\d.]+)/},j=null;a.isMobile=function(){j=j||b();return j.isMobile};a.environment=function(){return j=j||b()};a.isOnline=function(){return navigator.onLine};var b=function(){var g=navigator.userAgent,c={},e=g.match(f);c.browser=e?e[0]:g;var i;for(os in h)if(e=g.match(h[os])){i={name:os==="iphone"||
  30. os==="ipad"?"ios":os,version:e[2].replace("_",".")};break}c.os=i;c.isMobile=c.os?true:false;c.screen={width:window.innerWidth,height:window.innerHeight};return c}})(Quo);
  31. (function(a){a.fn.text=function(f){return!f?this[0].textContent:this.each(function(){this.textContent=f})};a.fn.html=function(f){return a.toType(f)==="string"?this.each(function(){this.innerHTML=f}):this[0].innerHTML};a.fn.append=function(f){return this.each(function(){if(a.toType(f)==="string"){if(f){var h=document.createElement();h.innerHTML=f;this.appendChild(h.firstChild)}}else this.insertBefore(f)})};a.fn.prepend=function(f){return this.each(function(){if(a.toType(f)==="string")this.innerHTML=
  32. f+this.innerHTML;else{var h=this.parentNode;h.insertBefore(f,h.firstChild)}})};a.fn.empty=function(){return this.each(function(){this.innerHTML=null})}})(Quo);
  33. (function(a){a.query=function(j,b){var g=document.querySelectorAll(b);return g=Array.prototype.slice.call(g)};a.fn.parent=function(j){var b=j?f(this):this.instance("parentNode");return h(b,j)};a.fn.siblings=function(j){var b=this.map(function(g,c){return Array.prototype.slice.call(c.parentNode.children).filter(function(e){return e!==c})});return h(b,j)};a.fn.children=function(j){var b=this.map(function(){return Array.prototype.slice.call(this.children)});return h(b,j)};a.fn.get=function(j){return j===
  34. undefined?this:this[j]};a.fn.first=function(){return a(this[0])};a.fn.last=function(){return a(this[this.length-1])};a.fn.closest=function(j,b){var g=this[0],c=a(j);for(c.length||(g=null);g&&c.indexOf(g)<0;)g=g!==b&&g!==document&&g.parentNode;return a(g)};a.fn.each=function(j){this.forEach(function(b,g){j.call(b,g,b)});return this};var f=function(j){for(var b=[];j.length>0;)j=a.map(j,function(g){if((g=g.parentNode)&&g!==document&&b.indexOf(g)<0){b.push(g);return g}});return b},h=function(j,b){return b===
  35. undefined?a(j):a(j).filter(b)}})(Quo);
  36. (function(a){function f(h,j){return j.split(/\s+/g).indexOf(h)>=0}a.fn.addClass=function(h){return this.each(function(){f(h,this.className)||(this.className+=" "+h)})};a.fn.removeClass=function(h){return this.each(function(){if(f(h,this.className))this.className=this.className.replace(h," ").replace(/\s+/gi," ")})};a.fn.toggleClass=function(h){return this.each(function(){if(f(h,this.className))this.className=this.className.replace(h," ");else this.className+=" "+h})};a.fn.hasClass=function(h){return f(h,
  37. this[0].className)};a.fn.style=function(h,j){return!j?this[0].style[h]||document.defaultView.getComputedStyle(this[0],"")[h]:this.each(function(){this.style[h]=j})}})(Quo);
  38. (function(a){function f(e,i){if(i.contentType)i.headers["Content-Type"]=i.contentType;if(i.dataType)i.headers.Accept=g[i.dataType];for(header in i.headers)e.setRequestHeader(header,i.headers[header])}function h(e,i){e.onreadystatechange={};e.abort();i.error.call(i.context,"QuoJS \u00bb $$.ajax : timeout exceeded",e,i)}function j(e,i){var d=e.responseText;if(d)if(i.dataType===b.MIME)try{d=JSON.parse(d)}catch(k){d=k;i.error.call(i.context,"Parse Error",e,i)}else if(i.dataType==="xml")d=e.responseXML;
  39. return d}var b={TYPE:"GET",MIME:"json"},g={script:"text/javascript, application/javascript",json:"application/json",xml:"application/xml, text/xml",html:"text/html",text:"text/plain"},c=0;a.ajaxSettings={type:b.TYPE,async:true,success:{},error:{},context:null,dataType:b.MIME,headers:{},xhr:function(){return new window.XMLHttpRequest},crossDomain:false,timeout:0};a.ajax=function(e){var i=a.mix(a.ajaxSettings,e);if(/=\?/.test(i.url))return a.jsonp(i);var d=i.xhr();d.onreadystatechange=function(){if(d.readyState===
  40. 4){clearTimeout(k);if(d.status===200||d.status===0){if(i.async){var m=j(d,i);i.success.call(i.context,m,d)}}else i.error.call(i.context,"QuoJS \u00bb $$.ajax",d,i)}};d.open(i.type,i.url,i.async);f(d,i);if(i.timeout>0)var k=setTimeout(function(){h(d,i)},i.timeout);d.send(i.data);return i.async?d:j(d,i)};a.jsonp=function(e){var i="jsonp"+ ++c,d=document.createElement("script"),k={abort:function(){a(d).remove();if(i in window)window[i]={}}},m;window[i]=function(n){clearTimeout(m);a(d).remove();delete window[i];
  41. e.success.call(e.context,n,k)};d.src=e.url.replace(/=\?/,"="+i);a("head").append(d);if(e.timeout>0)m=setTimeout(function(){h(k,e)},e.timeout);return k};a.get=function(e,i,d,k){e+=a.serializeParameters(i);return a.ajax({url:e,success:d,dataType:k})};a.post=function(e,i,d,k){return a.ajax({type:"POST",url:e,data:i,success:d,dataType:k,contentType:"application/x-www-form-urlencoded"})};a.json=function(e,i,d){e+=a.serializeParameters(i);return a.ajax({url:e,success:d,dataType:b.MIME})};a.serializeParameters=
  42. function(e){var i="?",d;for(d in e)if(e.hasOwnProperty(d)){if(i!=="?")i+="&";i+=d+"="+e[d]}return i==="?"?"":i}})(Quo);
  43. (function(a){var f={touch:"touchstart",tap:"tap"},h=/complete|loaded|interactive/;["touch","tap"].forEach(function(j){a.fn[j]=function(b){a(document.body).delegate(this.selector,f[j],b);return this}});a.fn.on=function(j,b,g){return b===undefined||a.toType(b)==="function"?this.bind(j,b):this.delegate(b,j,g)};a.fn.off=function(j,b,g){return b===undefined||a.toType(b)==="function"?this.unbind(j,b):this.undelegate(b,j,g)};a.fn.ready=function(j){h.test(document.readyState)?j(a):document.addEventListener("DOMContentLoaded",
  44. function(){j(a)},false);return this}})(Quo);
  45. (function(a){function f(k,m,n,r,s){m=(a.isMobile()?m:d[m])||m;var v=k._id||(k._id=c++);v=e[v]||(e[v]=[]);s=s&&s(n,m);m={event:m,callback:n,selector:r,proxy:j(s,n,k),delegate:s,index:v.length};v.push(m);k.addEventListener(m.event,m.proxy,false)}function h(k,m,n,r){m=(a.isMobile()?m:d[m])||m;var s=k._id||(k._id=c++);b(s,m,n,r).forEach(function(v){delete e[s][v.index];k.removeEventListener(v.event,v.proxy,false)})}function j(k,m,n){m=k||m;return function(r){var s=m.apply(n,[r].concat(r.data));s===false&&
  46. r.preventDefault();return s}}function b(k,m,n,r){return(e[k]||[]).filter(function(s){return s&&(!m||s.event==m)&&(!n||s.fn==n)&&(!r||s.selector==r)})}function g(k){var m=a.extend({originalEvent:k},k);a.each(i,function(n,r){m[n]=function(){this[r]=function(){return true};return k[n].apply(k,arguments)};m[r]=function(){return false}});return m}var c=1,e={},i={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"},d={touchstart:"mousedown",
  47. touchmove:"mousemove",touchend:"mouseup",tap:"click",doubletap:"dblclick",orientationchange:"resize"};a.Event=function(k){var m=document.createEvent("Events");m.initEvent(k,true,true,null,null,null,null,null,null,null,null,null,null,null,null);return m};a.fn.bind=function(k,m){return this.each(function(){f(this,k,m)})};a.fn.unbind=function(k,m){return this.each(function(){h(this,k,m)})};a.fn.delegate=function(k,m,n){return this.each(function(r,s){f(s,m,n,k,function(v){return function(z){var y=a(z.target).closest(k,
  48. s).get(0);if(y){var l=a.extend(g(z),{currentTarget:y,liveFired:s});return v.apply(y,[l].concat([].slice.call(arguments,1)))}}})})};a.fn.undelegate=function(k,m,n){return this.each(function(){h(this,m,n,k)})};a.fn.trigger=function(k){if(a.toType(k)==="string")k=a.Event(k);return this.each(function(){this.dispatchEvent(k)})}})(Quo);
  49. (function(a){function f(d){var k=Date.now(),m=k-(c.last||k);d=a.isMobile()?d.touches[0]:d;e&&clearTimeout(e);c={el:a("tagName"in d.target?d.target:d.target.parentNode),x1:d.pageX,y1:d.pageY,isDoubleTap:m>0&&m<=250?true:false,last:k};setTimeout(g,i)}function h(d){d=a.isMobile()?d.touches[0]:d;c.x2=d.pageX;c.y2=d.pageY}function j(){if(c.isDoubleTap){c.el.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)&&c.el.trigger("swipe")&&c.el.trigger("swipe"+(Math.abs(c.x1-
  50. 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;c={}}else{c.el!==undefined&&c.el.trigger("tap");e=setTimeout(function(){e=null;c={}},250)}}function b(){c={};clearTimeout(e)}function g(){if(c.last&&Date.now()-c.last>=i){c.el.trigger("longTap");c={}}}var c={},e,i=750;["swipe","swipeLeft","swipeRight","swipeUp","swipeDown","doubleTap","longTap"].forEach(function(d){a.fn[d]=function(k){return this.on(d,k)}});a(document).ready(function(){var d=
  51. a(document.body);d.bind("touchstart",f);d.bind("touchmove",h);d.bind("touchend",j);d.bind("touchcancel",b)})})(Quo);(function(){var a=Math,f=/webkit/i.test(navigator.appVersion)?"webkit":/firefox/i.test(navigator.userAgent)?"Moz":"opera"in window?"O":"";/android/gi.test(navigator.appVersion);var h=/iphone|ipad/gi.test(navigator.appVersion),j=/playbook/gi.test(navigator.appVersion),b=/hp-tablet/gi.test(navigator.appVersion),g="WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix,c="ontouchstart"in window&&!b,e=f+"Transform"in document.documentElement.style,i=h||j,d=function(){return window.requestAnimationFrame||
  52. window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(l){return setTimeout(l,17)}}(),k=window.cancelRequestAnimationFrame||window.webkitCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||clearTimeout,m="onorientationchange"in window?"orientationchange":"resize",n=c?"touchstart":"mousedown",
  53. r=c?"touchmove":"mousemove",s=c?"touchend":"mouseup",v=c?"touchcancel":"mouseup",z="translate"+(g?"3d(":"("),y=g?",0)":")";h=function(l,p){var o=document,t;this.wrapper=typeof l=="object"?l:o.getElementById(l);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(q){for(var u=q.target;u.nodeType!=
  54. 1;)u=u.parentNode;u.tagName!="SELECT"&&u.tagName!="INPUT"&&u.tagName!="TEXTAREA"&&q.preventDefault()},onScrollStart:null,onBeforeScrollMove:null,onScrollMove:null,onBeforeScrollEnd:null,onScrollEnd:null,onTouchEnd:null,onDestroy:null};for(t in p)this.options[t]=p[t];this.x=this.options.x;this.y=this.options.y;this.options.useTransform=e?this.options.useTransform:false;this.options.hScrollbar=this.options.hScroll&&this.options.hScrollbar;this.options.vScrollbar=this.options.vScroll&&this.options.vScrollbar;
  55. this.options.useTransition=i&&this.options.useTransition;this.scroller.style[f+"TransitionProperty"]=this.options.useTransform?"-"+f.toLowerCase()+"-transform":"top left";this.scroller.style[f+"TransitionDuration"]="0";this.scroller.style[f+"TransformOrigin"]="0 0";if(this.options.useTransition)this.scroller.style[f+"TransitionTimingFunction"]="cubic-bezier(0.33,0.66,0.66,1)";if(this.options.useTransform)this.scroller.style[f+"Transform"]=z+this.x+"px,"+this.y+"px"+y;else this.scroller.style.cssText+=
  56. ";position:absolute;top:"+this.y+"px;left:"+this.x+"px";this.refresh();this._bind(m,window);this._bind(n);c||this._bind("mouseout",this.wrapper)};h.prototype={enabled:true,x:0,y:0,steps:[],scale:1,handleEvent:function(l){switch(l.type){case n:if(!c&&l.button!==0)break;this._start(l);break;case r:this._move(l);break;case s:case v:this._end(l);break;case m:this._resize();break;case "mouseout":this._mouseout(l);break;case "webkitTransitionEnd":this._transitionEnd(l)}},_resize:function(){this.refresh()},
  57. _pos:function(l,p){l=this.hScroll?l:0;p=this.vScroll?p:0;if(this.options.useTransform)this.scroller.style[f+"Transform"]=z+l+"px,"+p+"px"+y+" scale("+this.scale+")";else{l>>=0;p>>=0;this.scroller.style.left=l+"px";this.scroller.style.top=p+"px"}this.x=l;this.y=p},_start:function(l){var p=c?l.touches[0]:l,o,t;if(this.enabled){this.options.onBeforeScrollStart&&this.options.onBeforeScrollStart.call(this,l);this.options.useTransition&&this._transitionTime(0);this.zoomed=this.animating=this.moved=false;
  58. this.dirY=this.dirX=this.absDistY=this.absDistX=this.distY=this.distX=0;if(this.options.momentum){if(this.options.useTransform){o=getComputedStyle(this.scroller,null)[f+"Transform"].replace(/[^0-9-.,]/g,"").split(",");t=o[4]*1;o=o[5]*1}else{t=getComputedStyle(this.scroller,null).left.replace(/[^0-9-]/g,"")*1;o=getComputedStyle(this.scroller,null).top.replace(/[^0-9-]/g,"")*1}if(t!=this.x||o!=this.y){this.options.useTransition?this._unbind("webkitTransitionEnd"):k(this.aniTime);this.steps=[];this._pos(t,
  59. o)}}this.startX=this.x;this.startY=this.y;this.pointX=p.pageX;this.pointY=p.pageY;this.startTime=l.timeStamp||Date.now();this.options.onScrollStart&&this.options.onScrollStart.call(this,l);this._bind(r);this._bind(s);this._bind(v)}},_move:function(l){var p=c?l.touches[0]:l,o=p.pageX-this.pointX,t=p.pageY-this.pointY,q=this.x+o,u=this.y+t,w=l.timeStamp||Date.now();this.options.onBeforeScrollMove&&this.options.onBeforeScrollMove.call(this,l);this.pointX=p.pageX;this.pointY=p.pageY;if(q>0||q<this.maxScrollX)q=
  60. this.options.bounce?this.x+o/2:q>=0||this.maxScrollX>=0?0:this.maxScrollX;if(u>0||u<this.maxScrollY)u=this.options.bounce?this.y+t/2:u>=0||this.maxScrollY>=0?0:this.maxScrollY;if(this.absDistX<6&&this.absDistY<6){this.distX+=o;this.distY+=t;this.absDistX=a.abs(this.distX);this.absDistY=a.abs(this.distY)}else{if(this.options.lockDirection)if(this.absDistX>this.absDistY+5){u=this.y;t=0}else if(this.absDistY>this.absDistX+5){q=this.x;o=0}this.moved=true;this._pos(q,u);this.dirX=o>0?-1:o<0?1:0;this.dirY=
  61. t>0?-1:t<0?1:0;if(w-this.startTime>300){this.startTime=w;this.startX=this.x;this.startY=this.y}this.options.onScrollMove&&this.options.onScrollMove.call(this,l)}},_end:function(l){if(!(c&&l.touches.length!=0)){var p=c?l.changedTouches[0]:l,o,t,q={dist:0,time:0},u={dist:0,time:0},w=(l.timeStamp||Date.now())-this.startTime;o=this.x;t=this.y;this._unbind(r);this._unbind(s);this._unbind(v);this.options.onBeforeScrollEnd&&this.options.onBeforeScrollEnd.call(this,l);if(this.moved){if(w<300&&this.options.momentum){q=
  62. o?this._momentum(o-this.startX,w,-this.x,this.scrollerW-this.wrapperW+this.x,this.options.bounce?this.wrapperW:0):q;u=t?this._momentum(t-this.startY,w,-this.y,this.maxScrollY<0?this.scrollerH-this.wrapperH+this.y:0,this.options.bounce?this.wrapperH:0):u;o=this.x+q.dist;t=this.y+u.dist;if(this.x>0&&o>0||this.x<this.maxScrollX&&o<this.maxScrollX)q={dist:0,time:0};if(this.y>0&&t>0||this.y<this.maxScrollY&&t<this.maxScrollY)u={dist:0,time:0}}if(q.dist||u.dist){p=a.max(a.max(q.time,u.time),10);this.scrollTo(o>>
  63. 0,t>>0,p)}else this._resetPos(200)}else{if(c){for(o=p.target;o.nodeType!=1;)o=o.parentNode;if(o.tagName!="SELECT"&&o.tagName!="INPUT"&&o.tagName!="TEXTAREA"){t=document.createEvent("MouseEvents");t.initMouseEvent("click",true,true,l.view,1,p.screenX,p.screenY,p.clientX,p.clientY,l.ctrlKey,l.altKey,l.shiftKey,l.metaKey,0,null);t._fake=true;o.dispatchEvent(t)}}this._resetPos(200)}this.options.onTouchEnd&&this.options.onTouchEnd.call(this,l)}},_resetPos:function(l){var p=this.x>=0?0:this.x<this.maxScrollX?
  64. this.maxScrollX:this.x,o=this.y>=0||this.maxScrollY>0?0:this.y<this.maxScrollY?this.maxScrollY:this.y;if(p==this.x&&o==this.y){if(this.moved){this.options.onScrollEnd&&this.options.onScrollEnd.call(this);this.moved=false}}else this.scrollTo(p,o,l||0)},_mouseout:function(l){var p=l.relatedTarget;if(p)for(;p=p.parentNode;)if(p==this.wrapper)return;this._end(l)},_transitionEnd:function(l){if(l.target==this.scroller){this._unbind("webkitTransitionEnd");this._startAni()}},_startAni:function(){var l=this,
  65. p=l.x,o=l.y,t=Date.now(),q,u,w;if(!l.animating)if(l.steps.length){q=l.steps.shift();if(q.x==p&&q.y==o)q.time=0;l.animating=true;l.moved=true;if(l.options.useTransition){l._transitionTime(q.time);l._pos(q.x,q.y);l.animating=false;q.time?l._bind("webkitTransitionEnd"):l._resetPos(0)}else{w=function(){var x=Date.now();if(x>=t+q.time){l._pos(q.x,q.y);l.animating=false;l.options.onAnimationEnd&&l.options.onAnimationEnd.call(l);l._startAni()}else{x=(x-t)/q.time-1;u=a.sqrt(1-x*x);x=(q.x-p)*u+p;l._pos(x,
  66. (q.y-o)*u+o);if(l.animating)l.aniTime=d(w)}};w()}}else l._resetPos(400)},_transitionTime:function(l){this.scroller.style[f+"TransitionDuration"]=l+"ms"},_momentum:function(l,p,o,t,q){p=a.abs(l)/p;var u=p*p/0.0012,w=0;w=0;if(l>0&&u>o){w=q/(6/(u/p*6.0E-4));o+=w;p=p*o/u;u=o}else if(l<0&&u>t){w=q/(6/(u/p*6.0E-4));t+=w;p=p*t/u;u=t}u*=l<0?-1:1;w=p/6.0E-4;return{dist:u,time:w>>0}},_offset:function(l){for(var p=-l.offsetLeft,o=-l.offsetTop;l=l.offsetParent;){p-=l.offsetLeft;o-=l.offsetTop}return{left:p,top:o}},
  67. _bind:function(l,p,o){(p||this.scroller).addEventListener(l,this,!!o)},_unbind:function(l,p,o){(p||this.scroller).removeEventListener(l,this,!!o)},destroy:function(){this.scroller.style[f+"Transform"]="";this._unbind(m,window);this._unbind(n);this._unbind(r);this._unbind(s);this._unbind(v);this._unbind("mouseout",this.wrapper);this.options.useTransition&&this._unbind("webkitTransitionEnd");this.options.onDestroy&&this.options.onDestroy.call(this)},refresh:function(){var l;this.wrapperW=this.wrapper.clientWidth;
  68. 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);l=this._offset(this.wrapper);this.wrapperOffsetLeft=-l.left;this.wrapperOffsetTop=-l.top;this.scroller.style[f+
  69. "TransitionDuration"]="0";this._resetPos(200)},scrollTo:function(l,p,o,t){var q=l;this.stop();q.length||(q=[{x:l,y:p,time:o,relative:t}]);l=0;for(p=q.length;l<p;l++){if(q[l].relative){q[l].x=this.x-q[l].x;q[l].y=this.y-q[l].y}this.steps.push({x:q[l].x,y:q[l].y,time:q[l].time||0})}this._startAni()},scrollToElement:function(l,p){var o;if(l=l.nodeType?l:this.scroller.querySelector(l)){o=this._offset(l);o.left+=this.wrapperOffsetLeft;o.top+=this.wrapperOffsetTop;o.left=o.left>0?0:o.left<this.maxScrollX?
  70. this.maxScrollX:o.left;o.top=o.top>0?0:o.top<this.maxScrollY?this.maxScrollY:o.top;p=p===undefined?a.max(a.abs(o.left)*2,a.abs(o.top)*2):p;this.scrollTo(o.left,o.top,p)}},disable:function(){this.stop();this._resetPos(0);this.enabled=false;this._unbind(r);this._unbind(s);this._unbind(v)},enable:function(){this.enabled=true},stop:function(){k(this.aniTime);this.steps=[];this.animating=this.moved=false}};if(typeof exports!=="undefined")exports.iScroll=h;else window.iScroll=h})();
  71. var LUNGO=LUNGO||{};LUNGO.VERSION="1.2";LUNGO.Attributes||(LUNGO.Attributes={});LUNGO.Data||(LUNGO.Data={});LUNGO.Sugar||(LUNGO.Sugar={});LUNGO.View||(LUNGO.View={});LUNGO.Device||(LUNGO.Device={});LUNGO.ready||(LUNGO.ready=Quo().ready);LUNGO.Constants={ELEMENT:{SECTION:"section",ARTICLE:"article",ASIDE:"aside",BODY:"body",DIV:"div",LIST:"<ul></ul>",SPAN:"<span>&nbsp;</span>"},CLASS:{ACTIVE:"active",ASIDE:"aside",SHOW:"show",SHOW_REVOKE:"show-revoke",HIDE:"hide",HIDE_REVOKE:"hide-revoke",CURRENT:"current",RIGHT:"onright",LEFT:"onleft",HORIZONTAL:"horizontal",FLOW:"flow"},TRIGGER:{LOAD:"load",UNLOAD:"unload"},ATTRIBUTE:{ID:"id",HREF:"href",TITLE:"title",ARTICLE:"article",CLASS:"class",WIDTH:"width",HEIGHT:"height",PIXEL:"px",PERCENT:"%",
  72. TARGET:"target",FIRST:"first",LAST:"last",EMPTY:""},BINDING:{START:"{{",END:"}}",KEY:"value",PARSER:/\{{.*?\}}/gi},ERROR:{CREATE_SCROLL:"ERROR: Impossible to create a <scroll> without ID.",BINDING_DATA_TYPE:"ERROR: Processing the type of binding data.",BINDING_TEMPLATE:"ERROR: Binding Template not exists >> ",BINDING_LIST:"ERROR: Processing parameters for list binding.",DATABASE:"ERROR: Connecting to Data.Sql.",ROUTER:"ERROR: The target does not exists >>",LOADING_RESOURCE:"ERROR: Loading resource."}};LUNGO.App=function(a){var f={id:1,name:"lungo_app",version:1,icon:""};return{init:function(h){f=a.Core.mix(f,h);a.Boot()},get:function(h){return f[h]}}}(LUNGO);LUNGO.Core=function(a,f){var h=Array.prototype,j=function(c,e){return f.isOwnProperty(c,e)},b=function(c){return f.toType(c)},g=function(c){return h.slice.call(c,0)};return{log:function(c,e){a.Core.isMobile()||console[c===1?"log":c===2?"warn":"error"](e)},execute:function(){var c=g(arguments),e=c.shift();b(e)==="function"&&e.apply(null,c)},bind:function(c,e){return function(){return e.apply(c,g(arguments))}},mix:function(){for(var c=c||{},e=0,i=arguments.length;e<i;e++){var d=arguments[e],k;for(k in d)if(j(d,
  73. k))c[k]=d[k]}return c},isOwnProperty:j,toType:b,toArray:g,isMobile:function(){return f.isMobile()},environment:function(){return f.environment()},orderByProperty:function(c,e,i){var d=i==="desc"?-1:1;return c.sort(function(k,m){return k[e]<m[e]?-d:k[e]>m[e]?d:0})},parseUrl:function(c){var e=c.lastIndexOf("#");if(e>0)c=c.substring(e);else if(e===-1)c="#"+c;return c},findByProperty:function(c,e,i){for(var d=null,k=0,m=c.length;k<m;k++){var n=c[k];if(n[e]==i){d=n;break}}return d}}}(LUNGO,Quo);LUNGO.dom=function(a){return $$(a)};LUNGO.Service=function(a,f){var h={MINUTE:"minute",HOUR:"hour",DAY:"day"},j=function(b,g){var c=false,e=a.Data.Storage.persistent("lungojs_service_cache");if(e){e=e[b];c=(new Date).getTime();e=(new Date(e)).getTime();var i=c-e;c=g.split(" ");e=c[1];i=i/1E3/60;if(e.indexOf(h.HOUR)>=0)i/=60;else if(e.indexOf(h.DAY)>=0)i=i/60/24;c=i<c[0]?true:false}return c};return{get:function(b,g,c,e){return f.get(b,g,c,e)},post:function(b,g,c,e){return f.post(b,g,c,e)},json:function(b,g,c){return f.json(b,g,c)},cache:function(b,
  74. g,c,e,i){var d=b+f.serializeParameters(g);if(j(d,c)){if(b=a.Data.Storage.persistent(d))return e.call(e,b)}else return f.get(b,g,function(k){var m=a.Data.Storage.persistent("lungojs_service_cache")||{};m[d]=new Date;a.Data.Storage.persistent("lungojs_service_cache",m);a.Data.Storage.persistent(d,k);e.call(e,k)},i)},Settings:f.ajaxSettings}}(LUNGO,Quo);LUNGO.Fallback=function(a){var f=a.Constants.CLASS,h=function(){a.dom(this).addClass(f.ACTIVE)},j=function(){a.dom(this).removeClass(f.ACTIVE)};return{androidButtons:function(){environment=a.Core.environment();if(environment.isMobile&&environment.os.name==="android"){a.dom(document.body).on("touchstart",".button",h);a.dom(document.body).on("touchend",".button",j)}},androidInputs:function(b,g){environment=a.Core.environment();if(environment.isMobile&&environment.os.name==="android"&&environment.os.version<
  75. "4")for(var c=a.dom(b+" input, "+b+" textarea, "+b+" select"),e=0,i=c.length;e<i;e++)g?c[e].removeAttribute("disabled"):c[e].setAttribute("disabled","disabled")},positionFixed:function(b){environment=a.Core.environment();environment.isMobile&&environment.os.name==="ios"&&environment.os.version>="4.2"&&b.style("position","fixed")}}}(LUNGO);LUNGO.Router=function(a){var f=a.Constants.CLASS,h=a.Constants.ELEMENT,j=a.Constants.ERROR,b=a.Constants.TRIGGER,g=function(c){var e=false;if(a.dom(c).length>0)e=true;else a.Core.log(3,j.ROUTER+c);return e};return{section:function(c){c=a.Core.parseUrl(c);var e=a.Router.History.current(),i=h.SECTION+c;if(g(i)){a.dom(e).removeClass(f.HIDE_REVOKE).removeClass(f.SHOW).addClass(f.HIDE);a.dom(i).removeClass(f.SHOW_REVOKE).addClass(f.SHOW).trigger(b.LOAD);a.Router.History.add(c)}},article:function(c,e){c=
  76. a.Core.parseUrl(c);e=a.Core.parseUrl(e);var i=h.SECTION+c+" "+h.ARTICLE+e;if(g(i)){a.dom(i).trigger(b.LOAD);a.View.Article.show(c,e)}},aside:function(c,e){c=a.Core.parseUrl(c);e=a.Core.parseUrl(e);var i=h.ASIDE+e;if(g(i))a.dom(i).hasClass(f.CURRENT)?a.View.Aside.hide(c,e):a.View.Aside.show(c,e)},back:function(){var c=h.SECTION+a.Router.History.current();a.dom(c).removeClass(f.SHOW).addClass(f.SHOW_REVOKE).trigger(b.UNLOAD);a.Router.History.removeLast();a.dom(a.Router.History.current()).removeClass(f.HIDE).addClass(f.HIDE_REVOKE).addClass(f.SHOW)}}}(LUNGO);LUNGO.Router.History=function(){var a=[],f=function(){return a[a.length-1]};return{add:function(h){h!==f()&&a.push(h)},current:f,removeLast:function(){a.length-=1}}}();LUNGO.View.Article=function(a){var f=a.Constants.ELEMENT,h=a.Constants.CLASS,j=a.Constants.ATTRIBUTE,b=a.Constants.TRIGGER,g={NAVIGATION_ITEM:'a[href][data-target="article"]',REFERENCE_LINK:" a[href][data-article]"},c=function(e,i){for(var d=a.dom(f.SECTION+e+g.REFERENCE_LINK),k=0,m=d.length;k<m;k++){var n=a.dom(d[k]);n.data(j.ARTICLE)===i?n.show():n.hide()}};return{show:function(e,i){var d=a.dom(e+" "+g.NAVIGATION_ITEM);d.removeClass(h.CURRENT);for(var k=0,m=d.length;k<m;k++){var n=a.dom(d[k]);if(a.Core.parseUrl(n.attr(j.HREF))===
  77. i){n.addClass(h.CURRENT);var r=e;(n=n.data(j.TITLE))&&a.dom(r+" header .title, "+r+" footer .title").text(n)}}c(e,i.replace("#",""));d=e+" "+f.ARTICLE+"."+h.CURRENT;k="#"+a.dom(d).attr(j.ID);a.dom(d).removeClass(h.CURRENT).trigger(b.UNLOAD);a.Fallback.androidInputs(k,false);a.dom(i).addClass(h.CURRENT);a.Fallback.androidInputs(i,true)},showReferenceLinks:c}}(LUNGO);LUNGO.View.Resize=function(a){var f=a.Constants.ATTRIBUTE;return{toolbars:function(){for(var h=".toolbar nav, .groupbar",j=a.dom(h),b=0,g=j.length;b<g;b++){h=a.dom(j[b]);var c=h.children();h=100/h.children().length;c.style(f.WIDTH,h+f.PERCENT)}}}}(LUNGO);LUNGO.View.Template=function(a){var f=a.Constants.ERROR,h={};return{create:function(j,b){h[j]=b},exists:function(j){return h[j]?true:false},get:function(j){return h[j]},render:function(j,b,g,c){if(a.View.Template.exists(b)){j=a.dom(j);b=this.markup(b,g);j.html(b);a.Core.execute(c)}else a.Core.log(3,f.BINDING_TEMPLATE+b)},markup:function(j,b){return a.View.Template.Binding.create(j,b)}}}(LUNGO);LUNGO.View.Template.Binding=function(a){var f=a.Constants.BINDING,h=a.Constants.ERROR,j=function(b,g){var c,e;for(e in b)if(a.Core.isOwnProperty(b,e)&&b[e]!==null){c=RegExp(f.START+e+f.END,"g");g=g.replace(c,b[e])}return g.replace(f.PARSER,"")};return{create:function(b,g){var c;var e=a.View.Template.get(b),i=a.Core.toType(g);if(i==="array"){c="";i=0;for(var d=g.length;i<d;i++)c+=j(g[i],e);c=c}else if(i==="object")c=j(g,e);else a.Core.log(3,h.BINDING_DATA_TYPE);return c},dataAttribute:function(b,g){var c=
  78. b.data(g.tag);if(c){c=g.html.replace(f.START+f.KEY+f.END,c);b.prepend(c)}}}}(LUNGO);LUNGO.View.Template.List=function(a){var f=a.Constants.ERROR,h=a.Constants.ATTRIBUTE,j=function(b,g){var c=a.dom(b).attr(h.ID);a.View.Scroll.init(c);if(g)a.View.Scroll[g===h.FIRST?h.FIRST:h.LAST](c)};return{create:function(b){b.container=a.dom(b.el).children().first();var g=false,c=!!b.container.length>0,e=a.View.Template.exists(b.template);if(c&&e){c=a.Core.toType(b.data);if(c==="array"||c==="object")g=true}else a.Core.log(3,f.BINDING_LIST);if(g){if(b.order&&b.order.field&&b.order.type)b.data=a.Core.orderByProperty(b.data,
  79. b.order.field,b.order.type);b.data=b.data;a.View.Template.render(b.container.selector,b.template,b.data);j(b.el)}},append:function(b){var g=a.View.Template.markup(b.template,b.data);a.dom(b.el).children().first().append(g);j(b.el,h.LAST)},prepend:function(b){var g=a.View.Template.markup(b.template,b.data);a.dom(b.el).children().first().prepend(g);j(b.el,h.FIRST)}}}(LUNGO);LUNGO.View.Scroll=function(a){var f=a.Constants.CLASS,h=a.Constants.ATTRIBUTE,j=a.Constants.ERROR,b={hScroll:false,vScroll:false,useTransition:true,momentum:true,lockDirection:true,fixedScrollbar:true,fadeScrollbar:true,hideScrollbar:true},g=function(d){if(a.Data.Cache.exists("scrolls")&&a.Data.Cache.get("scrolls",d)){a.Data.Cache.get("scrolls",d).destroy();a.Data.Cache.remove("scrolls",d)}},c=function(d){d=a.dom("#"+d);var k=d.children().first();if(k.length===0){d.html("<div></div>");k=d.children().first()}return k},
  80. e=function(d,k){var m=a.dom("#"+d),n=m[0];if(i(a.dom(n))?n.clientWidth<n.scrollWidth:n.clientHeight<n.scrollHeight){n=k;m=i(m)?"hScroll":"vScroll";n||(n={});n[m]=true;m=k=n=a.Core.mix(b,n);a.Data.Cache.exists("scrolls")||a.Data.Cache.set("scrolls",{});n=a.Data.Cache.get("scrolls");if(n[d])n[d].refresh();else n[d]=new iScroll(d,m);a.Data.Cache.set("scrolls",n)}else g(d)},i=function(d){return d.hasClass(f.HORIZONTAL)?true:false};return{init:function(d,k){d?e(d,k):a.Core.log(3,j.CREATE_SCROLL)},remove:g,
  81. refresh:function(d,k){e(d,k)},html:function(d,k){c(d).html(k);e(d)},append:function(d,k){c(d).append(k);e(d)},first:function(d){var k=a.Data.Cache.get("scrolls");k[d]&&k[d].scrollTo(0,0,250)},last:function(d){var k=a.Data.Cache.get("scrolls",d);if(k){d=a.dom("#"+d).first();var m=0,n=0;if(i(d))m=-(d.children().first()[h.WIDTH]()-d[h.WIDTH]());else n=-(d.children().first()[h.HEIGHT]()-d[h.HEIGHT]());k.scrollTo(m,n,250)}}}}(LUNGO);LUNGO.View.Aside=function(a){var f=a.Constants.ELEMENT,h=a.Constants.CLASS,j=a.Constants.ATTRIBUTE;return{show:function(b,g){var c=a.dom(f.ASIDE+g),e=c.attr(j.CLASS)||"";a.dom(f.SECTION+b).addClass(e).addClass(h.ASIDE);c.addClass(h.CURRENT)},hide:function(b,g){a.dom(f.ASIDE+g);a.dom(f.SECTION+b).removeClass(h.ASIDE).removeClass(h.RIGHT);setTimeout(function(){a.dom(f.ASIDE+g+"."+h.CURRENT).removeClass(h.CURRENT)},300)}}}(LUNGO);LUNGO.View.Element=function(a){var f=a.Constants.ATTRIBUTE,h=a.Constants.BINDING,j={BUBBLE:".bubble.count",PROGRESS_VALUE:" .value",PROGRESS_PERCENTAGE:" .labels span:last-child",PROGRESS_DESCRIPTION:" .labels span:first-child"};return{count:function(b,g){var c=a.dom(b);if(c)if(g>0){var e=c.children(j.BUBBLE);if(e.length>0)e.html(g);else{e=LUNGO.Attributes.Data.Count.html.replace(h.START+h.KEY+h.END,g);c.append(e)}}else c.children(j.BUBBLE).remove()},progress:function(b,g,c,e){if(a.dom(b)){g+=f.PERCENT;
  82. a.dom(b+j.PROGRESS_VALUE).style(f.WIDTH,g);g=g;a.dom(b+j.PROGRESS_PERCENTAGE).html(c?g:f.EMPTY);a.dom(b+j.PROGRESS_DESCRIPTION).html(c?e:f.EMPTY)}}}}(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>'},Progress:{tag:"progress",selector:"*",html:'<div class="progress" id="yeal"> <span class="labels"><span></span><span></span></span> <span class="bar"><span class="value" style="width:{{value}};"><span class="glow"></span></span></span> </div>'},
  83. Label:{tag:"label",selector:"a",html:"<abbr>{{value}}</abbr>"},Icon:{tag:"icon",selector:"*",html:'<span class="icon {{value}}"></span>'},Image:{tag:"image",selector:"*",html:'<img src="{{value}}" class="icon" />'},Title:{tag:"title",selector:"header, footer, article",html:'<span class="title">{{value}}</span>'},Back:{tag:"back",selector:"header, footer",html:'<a href="#back" data-target="section" class="onleft button default"><span class="icon {{value}}"></span></a>'}};LUNGO.Data.Cache=function(a,f){var h={},j=function(g){return arguments.length===1?h[g]:h[arguments[0]]?h[arguments[0]][arguments[1]]:f},b=function(g){return h[g]?true:false};return{set:function(g,c){h[g]=b(g)?a.Core.mix(j(g),c):c},get:j,remove:function(g){if(arguments.length===1)delete h[g];else delete h[arguments[0]][arguments[1]]},exists:b}}(LUNGO);LUNGO.Data.Sql=function(a){var f=a.Constants.ERROR,h={name:"lungo_db",version:"1.0",size:65536,schema:[]},j=null,b=function(d,k){a.Core.log(1,"lng.Data.Sql >> "+d);j.transaction(function(m){m.executeSql(d,[],function(n,r){c(k,r)},function(n){n.executedQuery=d;i.apply(null,arguments)})})},g=function(d,k){var m="",n;for(n in d)if(a.Core.isOwnProperty(d,n)){var r=d[n];if(m)m+=" "+k+" ";m+=n+"=";m+=isNaN(r)?'"'+r+'"':r}return m},c=function(d,k){a.Core.toType(d)==="function"&&setTimeout(d,100,k)},e=function(d,
  84. k){var m="",n="",r;for(r in k)if(a.Core.isOwnProperty(k,r)){var s=k[r];m+=m?", "+r:r;if(n)n+=", ";n+=isNaN(s)?'"'+s+'"':s}b("INSERT INTO "+d+" ("+m+") VALUES ("+n+")")},i=function(d,k){a.Core.log(3,"lng.Data.Sql >> "+k.code+": "+k.message+" \n Executed query: "+d.executedQuery)};return{init:function(d){h=a.Core.mix(h,d);if(j=openDatabase(h.name,h.version,h.name,h.size)){d=h.schema;var k=d.length;if(k)for(var m=0;m<k;m++){var n=d[m];n.drop===true&&b("DROP TABLE IF EXISTS "+n.name);var r=n.name;n=n.fields;
  85. var s="",v=void 0;for(v in n)if(a.Core.isOwnProperty(n,v)){if(s)s+=", ";s+=v+" "+n[v]}b("CREATE TABLE IF NOT EXISTS "+r+" ("+s+");")}}else a.Core.log(3,f.DATABASE)},select:function(d,k,m){k=k?" WHERE "+g(k,"AND"):"";b("SELECT * FROM "+d+k,function(n){for(var r=[],s=0,v=n.rows.length;s<v;s++)r.push(n.rows.item(s));c(m,r)})},insert:function(d,k){if(a.Core.toType(k)==="object")e(d,k);else for(row in k)e(d,k[row])},update:function(d,k,m){d="UPDATE "+d+" SET "+g(k,",");if(m)d+=" WHERE "+g(m,"AND");b(d)},
  86. drop:function(d,k){var m=k?" WHERE "+g(k,"AND"):"";b("DELETE FROM "+d+m+";")},execute:b}}(LUNGO);LUNGO.Data.Storage=function(){var a={PERSISTENT:"localStorage",SESSION:"sessionStorage"},f=function(h,j,b){h=window[h];if(b){h=h;b=b;b=JSON.stringify(b);h.setItem(j,b)}else{b=b;b=h.getItem(j);return JSON.parse(b)}};return{session:function(h,j){return f(a.SESSION,h,j)},persistent:function(h,j){return f(a.PERSISTENT,h,j)}}}(LUNGO);LUNGO.Boot=function(a){return function(){a.Boot.Resources.start();a.Boot.Layout.start();a.Boot.Events.start();a.Boot.Data.start();a.Boot.Section.start();a.Boot.Article.start();a.Boot.Stats.start()}}(LUNGO);LUNGO.Boot.Resources=function(a,f){var h=a.Constants.ELEMENT,j=a.Constants.ERROR,b={SECTION:"sections",TEMPLATE:"templates",SCRIPT:"scripts"},g=function(c){return f.ajax({url:c,async:false,dataType:"html",error:function(){console.error("[ERROR] Loading url",arguments)}})};return{start:function(){var c=a.App.get("resources");for(resource_key in c){var e=resource_key,i=c[resource_key];for(index in i){var d=/http/.test(i[index])?i[index]:"app/"+e+"/"+i[index];try{var k=g(d);switch(e){case b.SECTION:d=
  87. k;a.Core.toType(d)==="string"&&a.dom(h.BODY).append(d);break;case b.TEMPLATE:d=k;var m=document.createElement(h.DIV);m.innerHTML=d;var n=a.dom(m.firstChild).data("template");n&&a.View.Template.create(n,d)}}catch(r){a.Core.log(3,j.LOADING_RESOURCE+" "+r)}}}}}}(LUNGO,Quo);LUNGO.Boot.Stats=function(a){var f=function(){a.Service.post("http://www.lungojs.com/stats/",{name:a.App.get("name"),version:a.App.get("version"),icon:a.App.get("icon")},function(){})};return{start:function(){a.Core.isMobile()&&f()}}}(LUNGO);LUNGO.Boot.Layout=function(a){var f=null,h=null,j=a.Constants.ELEMENT,b=a.Constants.ATTRIBUTE,g=function(){if(!location.hash||!f.addEventListener){f.scrollTo(0,1);var c=1,e=setInterval(function(){if(h.body){clearInterval(e);c="scrollTop"in h.body?h.body.scrollTop:1;f.scrollTo(0,c===1?0:1)}},15);f.addEventListener("load",function(){setTimeout(function(){f.scrollTo(0,c===1?0:1)},0)},false)}};return{start:function(){if(a.Core.isMobile()){f=window;h=f.document;if(f.innerHeight==356){a.dom(j.BODY).style(b.HEIGHT,
  88. 416+b.PIXEL);g()}}}}}(LUNGO);LUNGO.Boot.Article=function(a){var f=a.Constants.ATTRIBUTE,h=a.Constants.ELEMENT,j={LIST_IN_ARTICLE:"article.list, aside.list",SCROLL_IN_ARTICLE:".scrollable",CHECKBOX_IN_ARTICLE:".checkbox, .radio"},b=function(i,d){for(var k=a.dom(i),m=0,n=k.length;m<n;m++){var r=a.dom(k[m]);a.Core.execute(d,r)}},g=function(i){if(i.children().length===0){i.attr(f.ID);i.append(h.LIST)}},c=function(i){i=i.attr(f.ID);a.View.Scroll.init(i)},e=function(i){i.append(h.SPAN)};return{start:function(){b(j.LIST_IN_ARTICLE,
  89. g);b(j.SCROLL_IN_ARTICLE,c);b(j.CHECKBOX_IN_ARTICLE,e)}}}(LUNGO);LUNGO.Boot.Data=function(a){return{start:function(){var f=a.Attributes.Data,h;for(h in f)if(a.Core.isOwnProperty(f,h))for(var j=f[h],b=a.dom(j.selector),g=0,c=b.length;g<c;g++){var e=a.dom(b[g]);a.View.Template.Binding.dataAttribute(e,j)}}}}(LUNGO);LUNGO.Boot.Events=function(a){var f=a.Constants.ATTRIBUTE,h=a.Constants.CLASS,j=a.Constants.ELEMENT,b={HREF_TARGET:"a[href][data-target]",HREF_TARGET_FROM_ASIDE:"aside a[href][data-target]"},g=function(){a.View.Resize.toolbars()},c=function(){var i=a.dom(this),d="#"+i.parent(j.ASIDE).attr(f.ID),k="#"+a.dom("section.aside, section.current").first().attr(f.ID);if(i.data(f.TARGET)===j.ARTICLE){a.dom(j.ASIDE+d+" "+b.HREF_TARGET).removeClass(h.CURRENT);i.addClass(h.CURRENT)}window.innerWidth<768&&a.View.Aside.hide(k,
  90. d)},e=function(i){var d=a.dom(this);switch(d.data(f.TARGET)){case j.SECTION:d=d.attr(f.HREF);d=a.Core.parseUrl(d);d==="#back"?a.Router.back():a.Router.section(d);break;case j.ARTICLE:var k=a.Router.History.current();d=d.attr(f.HREF);a.Router.article(k,d);break;case j.ASIDE:k=a.Router.History.current();d=d.attr(f.HREF);a.Router.aside(k,d)}i.preventDefault()};return{start:function(){a.dom(window).on("resize",g);a.dom(b.HREF_TARGET_FROM_ASIDE).tap(c);a.dom(b.HREF_TARGET).tap(e);a.Fallback.androidButtons()}}}(LUNGO);LUNGO.Boot.Section=function(a){var f=a.Constants.ELEMENT,h=a.Constants.CLASS,j=a.Constants.ATTRIBUTE;return{start:function(){var b=a.dom(f.SECTION),g=b.first(),c="#"+g.attr(j.ID);g.addClass(h.CURRENT);a.Router.History.add(c);a.Fallback.positionFixed(b);g=0;for(c=b.length;g<c;g++){var e=a.dom(b[g]),i=e.children(f.ARTICLE).first();i.addClass(h.CURRENT);i=i.attr(j.ID);e="#"+e.attr(j.ID);a.View.Article.showReferenceLinks(e,i)}a.View.Resize.toolbars()}}}(LUNGO);