portal.js
74.2 KB
!function(t,e){e=e(),"object"==typeof module&&module.exports?module.exports=e:(define("amdConfig",function(){}),require(e))}(0,function(){var n={portal_css:"24e7c1d8de",amdConfig:"81814c5bc7",portal:"d3dfa952c3","portal/classify":"6f00e9c950","portal/list":"7d486054a8","portal/detail":"473167b69d","portal/comment":"a823694524",utils:"c82055a9f6"};return{waitSeconds:0,baseUrl:"/mobilemode/mobile/dist/",urlArgs:function(t,e){return~e.indexOf("?v=")?"":"?v="+(n[t]||(new Date).getTime())},paths:{require:"js/lib/require/require.min_wev8",fastclick:"js/lib/fastclick/fastclick.min_wev8",mobilebone:"js/lib/mobilebone/mobilebone_wev8",zepto:"js/lib/zepto/zepto.min_wev8",sortable:"js/lib/sortable/Sortable.min",amdConfig:"js/portal/config",juicer:"js/lib/juicer/juicer.min_wev8",portal:"js/portal/portal",portal_css:"css/portal/portal","portal/classify":"js/portal/page/classify","portal/list":"js/portal/page/list","portal/detail":"js/portal/page/detail","portal/comment":"js/portal/page/comment",utils:"js/portal/utils"},shim:{juicer:{exports:"juicer"}}}}),function(){function c(r,t){var e;if(t=t||{},this.trackingClick=!1,this.trackingClickStart=0,this.targetElement=null,this.touchStartX=0,this.touchStartY=0,this.lastTouchIdentifier=0,this.touchBoundary=t.touchBoundary||10,this.layer=r,this.tapDelay=t.tapDelay||200,this.tapTimeout=t.tapTimeout||700,!c.notNeeded(r)){for(var n=["onMouse","onClick","onTouchStart","onTouchMove","onTouchEnd","onTouchCancel"],i=this,a=0,o=n.length;a<o;a++)i[n[a]]=s(i[n[a]],i);l&&(r.addEventListener("mouseover",this.onMouse,!0),r.addEventListener("mousedown",this.onMouse,!0),r.addEventListener("mouseup",this.onMouse,!0)),r.addEventListener("click",this.onClick,!0),r.addEventListener("touchstart",this.onTouchStart,!1),r.addEventListener("touchmove",this.onTouchMove,!1),r.addEventListener("touchend",this.onTouchEnd,!1),r.addEventListener("touchcancel",this.onTouchCancel,!1),Event.prototype.stopImmediatePropagation||(r.removeEventListener=function(t,e,n){var i=Node.prototype.removeEventListener;"click"===t?i.call(r,t,e.hijacked||e,n):i.call(r,t,e,n)},r.addEventListener=function(t,e,n){var i=Node.prototype.addEventListener;"click"===t?i.call(r,t,e.hijacked||(e.hijacked=function(t){t.propagationStopped||e(t)}),n):i.call(r,t,e,n)}),"function"==typeof r.onclick&&(e=r.onclick,r.addEventListener("click",function(t){e(t)},!1),r.onclick=null)}function s(t,e){return function(){return t.apply(e,arguments)}}}var t=0<=navigator.userAgent.indexOf("Windows Phone"),l=0<navigator.userAgent.indexOf("Android")&&!t,s=/iP(ad|hone|od)/.test(navigator.userAgent)&&!t,u=s&&/OS 4_\d(_\d)?/.test(navigator.userAgent),f=s&&/OS [6-7]_\d/.test(navigator.userAgent),r=0<navigator.userAgent.indexOf("BB10");c.prototype.needsClick=function(t){switch(t.nodeName.toLowerCase()){case"button":case"select":case"textarea":if(t.disabled)return!0;break;case"input":if(s&&"file"===t.type||t.disabled)return!0;break;case"label":case"iframe":case"video":return!0}return/\bneedsclick\b/.test(t.className)},c.prototype.needsFocus=function(t){switch(t.nodeName.toLowerCase()){case"textarea":return!0;case"select":return!l;case"input":switch(t.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return!1}return!t.disabled&&!t.readOnly;default:return/\bneedsfocus\b/.test(t.className)}},c.prototype.sendClick=function(t,e){var n,i;document.activeElement&&document.activeElement!==t&&document.activeElement.blur(),i=e.changedTouches[0],(n=document.createEvent("MouseEvents")).initMouseEvent(this.determineEventType(t),!0,!0,window,1,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),n.forwardedTouchEvent=!0,t.dispatchEvent(n)},c.prototype.determineEventType=function(t){return l&&"select"===t.tagName.toLowerCase()?"mousedown":"click"},c.prototype.focus=function(t){var e;s&&t.setSelectionRange&&0!==t.type.indexOf("date")&&"time"!==t.type&&"month"!==t.type?(e=t.value.length,t.setSelectionRange(e,e)):t.focus()},c.prototype.updateScrollParent=function(t){var e,n;if(!(e=t.fastClickScrollParent)||!e.contains(t)){n=t;do{if(n.scrollHeight>n.offsetHeight){e=n,t.fastClickScrollParent=n;break}n=n.parentElement}while(n)}e&&(e.fastClickLastScrollTop=e.scrollTop)},c.prototype.getTargetElementFromEventTarget=function(t){return t.nodeType===Node.TEXT_NODE?t.parentNode:t},c.prototype.onTouchStart=function(t){var e,n,i;if(1<t.targetTouches.length)return!0;if(e=this.getTargetElementFromEventTarget(t.target),n=t.targetTouches[0],s){if((i=window.getSelection()).rangeCount&&!i.isCollapsed)return!0;if(!u){if(n.identifier&&n.identifier===this.lastTouchIdentifier)return t.preventDefault(),!1;this.lastTouchIdentifier=n.identifier,this.updateScrollParent(e)}}return this.trackingClick=!0,this.trackingClickStart=t.timeStamp,this.targetElement=e,this.touchStartX=n.pageX,this.touchStartY=n.pageY,t.timeStamp-this.lastClickTime<this.tapDelay&&t.preventDefault(),!0},c.prototype.touchHasMoved=function(t){var e=t.changedTouches[0],n=this.touchBoundary;return Math.abs(e.pageX-this.touchStartX)>n||Math.abs(e.pageY-this.touchStartY)>n},c.prototype.onTouchMove=function(t){return this.trackingClick&&(this.targetElement!==this.getTargetElementFromEventTarget(t.target)||this.touchHasMoved(t))&&(this.trackingClick=!1,this.targetElement=null),!0},c.prototype.findControl=function(t){return void 0!==t.control?t.control:t.htmlFor?document.getElementById(t.htmlFor):t.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")},c.prototype.onTouchEnd=function(t){var e,n,i,r,a,o=this.targetElement;if(!this.trackingClick)return!0;if(t.timeStamp-this.lastClickTime<this.tapDelay)return this.cancelNextClick=!0;if(t.timeStamp-this.trackingClickStart>this.tapTimeout)return!0;if(this.cancelNextClick=!1,this.lastClickTime=t.timeStamp,n=this.trackingClickStart,this.trackingClick=!1,this.trackingClickStart=0,f&&(a=t.changedTouches[0],(o=document.elementFromPoint(a.pageX-window.pageXOffset,a.pageY-window.pageYOffset)||o).fastClickScrollParent=this.targetElement.fastClickScrollParent),"label"===(i=o.tagName.toLowerCase())){if(e=this.findControl(o)){if(this.focus(o),l)return!1;o=e}}else if(this.needsFocus(o))return 100<t.timeStamp-n||s&&window.top!==window&&"input"===i?this.targetElement=null:(this.focus(o),this.sendClick(o,t),s&&"select"===i||(this.targetElement=null,t.preventDefault())),!1;return!(!s||u||!(r=o.fastClickScrollParent)||r.fastClickLastScrollTop===r.scrollTop)||(this.needsClick(o)||(t.preventDefault(),this.sendClick(o,t)),!1)},c.prototype.onTouchCancel=function(){this.trackingClick=!1,this.targetElement=null},c.prototype.onMouse=function(t){return!(this.targetElement&&!t.forwardedTouchEvent&&t.cancelable&&(!this.needsClick(this.targetElement)||this.cancelNextClick)&&(t.stopImmediatePropagation?t.stopImmediatePropagation():t.propagationStopped=!0,t.stopPropagation(),t.preventDefault(),1))},c.prototype.onClick=function(t){var e;return this.trackingClick?(this.targetElement=null,!(this.trackingClick=!1)):"submit"===t.target.type&&0===t.detail||((e=this.onMouse(t))||(this.targetElement=null),e)},c.prototype.destroy=function(){var t=this.layer;l&&(t.removeEventListener("mouseover",this.onMouse,!0),t.removeEventListener("mousedown",this.onMouse,!0),t.removeEventListener("mouseup",this.onMouse,!0)),t.removeEventListener("click",this.onClick,!0),t.removeEventListener("touchstart",this.onTouchStart,!1),t.removeEventListener("touchmove",this.onTouchMove,!1),t.removeEventListener("touchend",this.onTouchEnd,!1),t.removeEventListener("touchcancel",this.onTouchCancel,!1)},c.notNeeded=function(t){var e,n,i;if(void 0===window.ontouchstart)return!0;if(n=+(/Chrome\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1]){if(!l)return!0;if(e=document.querySelector("meta[name=viewport]")){if(-1!==e.content.indexOf("user-scalable=no"))return!0;if(31<n&&document.documentElement.scrollWidth<=window.outerWidth)return!0}}if(r&&10<=(i=navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/))[1]&&3<=i[2]&&(e=document.querySelector("meta[name=viewport]"))){if(-1!==e.content.indexOf("user-scalable=no"))return!0;if(document.documentElement.scrollWidth<=window.outerWidth)return!0}return"none"===t.style.msTouchAction||"manipulation"===t.style.touchAction||!!(27<=+(/Firefox\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1]&&(e=document.querySelector("meta[name=viewport]"))&&(-1!==e.content.indexOf("user-scalable=no")||document.documentElement.scrollWidth<=window.outerWidth))||"none"===t.style.touchAction||"manipulation"===t.style.touchAction},c.attach=function(t,e){return new c(t,e)},"function"==typeof define&&"object"==typeof define.amd&&define.amd?define("fastclick",[],function(){return c}):"undefined"!=typeof module&&module.exports?(module.exports=c.attach,module.exports.FastClick=c):window.FastClick=c}(),function(e,n){document.MBLOADED||("function"==typeof define&&(define.amd||define.cmd)?define("mobilebone",function(t){return n(e,t)}):e.Mobilebone=n(e,{}))}(this,function(l,_){if(document.MBLOADED)return"Don't repeat load Mobilebone!";var O={},N=[].slice,u=/^#?\w+(?:[\-_]\w+)*$/i,P="WebkitAppearance"in document.documentElement.style||void 0!==document.webkitHidden,M="pushState"in history&&"replaceState"in history;_.support=M;var f=!1;if(_.VERSION="2.6.2",_.captureLink=!0,_.captureForm=!0,_.rootTransition=l,_.mergeCallback=!0,_.classAnimation="slide",_.classPage="page",_.classMask="mask",_.pushStateEnabled=!0,_.evalScript=!1,0<=window.navigator.userAgent.indexOf("Firefox")&&window.top!==window&&(_.pushStateEnabled=!1),0==M)return _;history.popstate=!1,_.transition=function(t,e,n,l){if(0!=arguments.length){3==arguments.length&&1==isNaN(1*n)&&(n=(l=n).back),e=e||null,n=n||!1,l=l||{};var i=_.isDulicatePage(t,e);if(i&&!n){var r=_.createDuplicatePage(t,e,l.formdata);t=r[0],e=r[1]}if(t!=e){var a={root:this.rootTransition,form:this.form||this.classAnimation,onpagefirstinto:this.onpagefirstinto,animationstart:this.animationstart,animationend:this.animationend,preventdefault:this.preventdefault,fallback:this.fallback,callback:this.callback},u=function(n){if(!n||!n.getAttribute)return{};var i={},r=q(n.getAttribute("data-params")||"");return["title","root","form"].forEach(function(t){i[t]=n.getAttribute("data-"+t)||r[t]||l[t]||a[t]}),"string"==typeof i.root&&(i.root=_.getFunction(i.root)),["onpagefirstinto","callback","fallback","animationstart","animationend","preventdefault"].forEach(function(t){if(1==_.mergeCallback&&"function"==typeof a[t]){var e=n.getAttribute("data-"+t)||r[t];"function"==typeof i.root[e]?i[t]=function(){a[t].apply(this,arguments),i.root[e].apply(this,arguments)}:"function"==typeof l[t]?i[t]=function(){a[t].apply(this,arguments),l[t].apply(this,arguments)}:i[t]=a[t]}else i[t]=n.getAttribute("data-"+t)||r[t]||l[t]||a[t]}),i},o=u(e),f=u(t);if(null!=e&&e.classList){var s=o.preventdefault,c=!1;"string"==typeof s&&(s=o.root[s])}if(null!=t&&t.classList){var d=f.preventdefault,h=!1;"string"==typeof d&&(d=f.root[d])}if("function"==typeof s&&(c=s.call(o.root,t,e,l)),1==c&&s===d)return!1;if("function"==typeof d&&(h=d.call(f.root,t,e,l)),1==h)return!1;var p=function(s,c){1!=s.flagAniBind&&["animationstart","animationend"].forEach(function(t,e){var n=f[t]||s[t],i="webkit"+t.replace(/^a|s|e/g,function(t){return t.toUpperCase()}),r=P?i:t;e&&!s._hide&&(s._hide=!0,s.addEventListener(r,function(){0==this.classList.contains("in")&&(this.style.display="none",1==this.removeSelf&&(this.parentElement.removeChild(this),this.removeSelf=null)),this.classList.remove(u(this).form)}));var a=null,o="_"+r;"string"==typeof n&&f.root[n]?a=function(){c.root[n].call(c.root,this,this.classList.contains("in")?"into":"out",l)}:"function"==typeof n&&(a=function(){n.call(c.root,this,this.classList.contains("in")?"into":"out",l)}),s[o]&&s.removeEventListener(r,s[o]),a&&(s.addEventListener(r,a),s[o]=a),s.flagAniBind=!0})},m=l.reverse,g=n||m?"add":"remove";if(null!=e&&e.classList&&1!=c){e.offsetWidth=e.offsetWidth,e.style.display="block",e.classList.add("out"),e.classList.remove("in"),e.classList[g]("reverse"),e.classList.add(o.form),e.removeSelf=e.removeSelf||i&&D(e.id)&&n,p(e,o);var v=o.fallback;"string"==typeof v&&(v=o.root[v]),"function"==typeof v&&v.call(o.root,t,e,l)}if(null!=t&&t.classList){var y=f.title,b=document.querySelector("h1"),w=document.querySelector("."+this.classPage);y&&!1!==l.title?(document.title=y,b&&(b.innerHTML=y,b.title=y)):w==t&&!e&&document.title&&t.setAttribute("data-title",document.title);var E=t.id||l.id,x=l.id||t.id,k=O["_"+E];!1!==l.remove&&O[E]&&O[E]!=t&&(k&&O[k]&&1==l.reload&&(delete O[k],delete O["_"+E]),O[E]!=e?O[E].parentElement&&O[E].parentElement.removeChild(O[E]):e.removeSelf=!0,delete O[E]),t.offsetWidth=t.offsetWidth,t.style.display="block",t.classList.remove("out"),t.classList.add("in"),t.classList[g]("reverse"),e&&t.classList.add(f.form);var C=f.onpagefirstinto;(!t.firstintoBind||l.reload&&!n)&&("string"==typeof C&&f.root[C]?f.root[C].call(f.root,t,e,l):"function"==typeof C&&C.call(f.root,t,e,l),N.call(t.querySelectorAll("form")).forEach(function(t){_.submit(t)}),t.firstintoBind=!0),p(t,f);var S,L=x;if(L&&0==/^#/.test(L)&&(L="#"+L),S=L.replace(/^#/,"#&"),M&&this.pushStateEnabled&&!1!==l.history&&L&&S!=location.hash){history.popstate=!1;var j=l.formdata?"?"+l.formdata:"",A=e&&"true"!=e.getAttribute("data-replaceState");history[e&&!l.replaceState&&A?"pushState":"replaceState"](null,document.title,L.replace(/^#/,"#&")+j)}O[E]||(O[E]=t,x!==E&&(O[x]=t,O["_"+E]=x));var T=f.callback;"string"==typeof T&&(T=f.root[T]),"function"==typeof T&&T.call(f.root,t,e,l,n),setTimeout(function(){history.popstate=!0},17)}}}},_.getCleanUrl=function(t,e,n){var i="",r="",a="";if(t)if(1==t.nodeType)if(t.action){if(i=t.getAttribute("action"),t.method&&"POST"==t.method.toUpperCase())return i;window.$&&$.fn&&$.fn.serialize?r=$(t).serialize():(r={},N.call(t.querySelectorAll("input,select,textarea")).forEach(function(t){if(t.name&&!t.disabled){var e=t.value.trim(),n=t.name;/^radio|checkbox/i.test(t.type)?t.checked&&(r[n]?r[n].push(e):r[n]=[e]):r[n]=[e]}}))}else{i=t.getAttribute("href"),r=t.getAttribute("data-formdata")||t.getAttribute("data-data")||"";var o="container",s=t.getAttribute("data-"+o);if(-1==r.indexOf(o)&&s){var c=o+"="+s;r=r?r+"&"+c:c}}else t.url&&(i=t.url,r=t.data);if(!(i=i||e))return"";if("object"==typeof(r=r||n||"")){var l=[];for(key in r)r[key].forEach||(r[key]=[r[key]]),r[key].forEach(function(t){l.push(key+"="+encodeURIComponent(t))});r=0<l.length?l.join("&"):""}return"?"==(a=i.split("#")[0].replace(/&+$/,"")).slice(-1)&&(a=a.split("?")[0]),""!=r&&(/\?/.test(a)?a=a+"&"+(r=r.replace(/^&|\?/,"")):""!=r&&(a=a+"?"+(r=r.replace("?","")))),a},_.createPage=function(t,e,n){var i=null,r=null,a=this.classPage,o=null;if(t){void 0===n&&"object"==typeof e&&(n=e),n=n||{};var s,c,l,u={};e&&(1==e.nodeType?((e.href||e.action)&&(s=e.getAttribute("data-title")||n.title),i=n.response,c=e.getAttribute("data-container"),r=document.getElementById(c),l=e.getAttribute("data-classpage"),o=(u.target=e).getAttribute("data-reload"),("form"==e.tagName.toLowerCase()||null!==o&&"false"!=o)&&(u.reload=!0),u.back="back"==e.getAttribute("data-rel"),"false"==e.getAttribute("data-history")&&(u.history=!1)):(i=e.response||n.response,s=e.title||n.title,r=e.container||n.container,l=e.classPage||n.classPage,u.target=e.target,"history"in e&&(u.history=e.history),u.back=e.back||n.back),r&&l&&(a=l));var f=(a==l?r:document).querySelector(".in."+a),d=null,h=document.createElement("div");"string"==typeof t?h.innerHTML=t:h.appendChild(t),1==_.evalScript&&1!=t.firstintoBind&&N.call(h.getElementsByTagName("script")).forEach(function(t){var e=t.innerHTML.trim(),n=t.getAttribute("type");if(""!=e.trim()&&!t.src){var i=document.getElementsByTagName("head")[0]||document.documentElement,r=document.createElement("script");n&&(r.type=n),r.appendChild(document.createTextNode(e)),setTimeout(function(){i.insertBefore(r,i.firstChild),i.removeChild(r),r=null},17),t=null}});var p=h.getElementsByTagName("title")[0];if((d=h.querySelector("."+a))||(h.className=a+" out",d=h),"string"==typeof s?d.setAttribute("data-title",s):p&&p.innerText&&d.setAttribute("data-title",p.innerText),u.response=i||t,u.id=this.getCleanUrl(e)||d.id||"unique"+Date.now(),~u.id.indexOf("?")){var m=u.id.split("?");u.id=m[0],u.formdata=m[1]}"object"==typeof n&&(void 0!==n.history&&(u.history=n.history),void 0!==n.remove&&(u.remove=n.remove),void 0!==n.target&&(u.target=n.target),void 0!==n.title&&(u.title=n.title)),a==l&&(u.history=!1,u.classPage=a),r=r||document.body;var g=d.id;g&&O[g]&&r.contains(O[g])?r.insertBefore(d,O[g]):r.appendChild(d),h=null,this.transition(d,f,u)}};var d=function(t){return(t||"").replace(/_sub.*$/g,"")},D=function(t){return!!t&&d(t)!==t};_.isDulicatePage=function(t,e){return!(!t||!e||t!=e&&d(t.id)!==d(e.id))},_.createDuplicatePage=function(n,i,r){if(!_.isDulicatePage(n,i)||!r)return[n,i];var a=d(n.id),t=[].slice.call(document.querySelectorAll("body > [id^="+a+"]")),o=t.length,s=t.map(function(t){return t.id}),c=function(t,e){return~s.indexOf(t+e)?c(t,e+1):t+e};if(1===o){var e=new RegExp("#&"+a+"(&|\\?)?","g");i.formdata=location.hash.replace(e,"")}return t.every(function(t,e){return t.formdata===r?(n=t,!1):(e===o-1&&((n=i.cloneNode(!0)).id=c(a+"_sub",e),n.classList.remove("in"),n.classList.add("out"),n.removeAttribute("style"),n.formdata=r,document.body.appendChild(n)),!0)}),[n,i]},_.getFunction=function(t){if("string"==typeof t){for(var e=l,n=t.split("."),i=0;i<n.length&&(e=e[n[i]]);i+=1);return e}},_.ajax=function(n){if(n){var t,e={url:"",type:"",dataType:"",data:{},timeout:1e4,async:!0,username:"",password:"",success:function(){},error:function(){},complete:function(){}},i={},r=null,a=null,o={};if(1==n.nodeType){for(key in o=q(n.getAttribute("data-params")||""),e)i[key]=n.getAttribute("data-"+key)||o[key]||e[key],"function"==typeof e[key]&&"string"==typeof i[key]&&(i[key]=this.getFunction(i[key]),"function"!=typeof i[key]&&(i[key]=e[key]));i.url=this.getCleanUrl(n,i.url),i.target=n,i.back="back"==n.getAttribute("data-rel");var s=n.tagName.toLowerCase();if("form"==s)i.type=n.method,a=new FormData(n);else if("a"==s){var c=n.getAttribute("data-container"),l=n.getAttribute("data-classpage"),u=c&&document.getElementById(c);u&&l&&l!=_.classPage&&(i.history=!1,i.title=!1)}"true"!=(t=n.getAttribute("data-mask"))&&""!=t||(r=n.querySelector("."+this.classMask))}else{if(!n.url)return;for(key2 in e)i[key2]=n[key2]||e[key2];i.url=this.getCleanUrl(null,i.url,i.data),i.title=n.title,i.back=n.back,i.container=n.container}var f=u||document.body;"string"!=typeof t&&(r=f.querySelector("."+this.classMask)),null==r&&((r=document.createElement("div")).className=this.classMask,r.innerHTML='<i class="loading"></i>',"string"==typeof t?n.appendChild(r):f.appendChild(r)),r.style.display="block";var d=new XMLHttpRequest;d.open(i.type||"GET",i.url+(/\?/.test(i.url)?"&":"?")+"r="+Date.now(),i.async,i.username,i.password),d.timeout=i.timeout,d.onload=function(){var e=null;if(200==d.status){if("json"==i.dataType||"JSON"==i.dataType)try{e=JSON.parse(d.response),i.response=e,setTimeout(function(){_.createPage(_.jsonHandle(e),n,i)},20)}catch(t){i.message="JSON parse error:"+t.message,i.error.call(i,d,d.status)}else if("unknown"==i.dataType){i.history=!1;try{e=JSON.parse(d.response),i.response=e,setTimeout(function(){_.createPage(_.jsonHandle(e),n,i)},20)}catch(t){e=d.response,setTimeout(function(){_.createPage(e,n,i)},20)}}else e=d.response,setTimeout(function(){_.createPage(e,n,i)},20);i.success.call(i,e,d.status)}else i.message="The status code exception!",i.error.call(i,d,d.status);i.complete.call(i,d,d.status),r.style.display="none"},d.onerror=function(t){i.message="Illegal request address or an unexpected network error!",i.error.call(i,d,d.status),r.style.display="none"},d.ontimeout=function(){i.message="The request timeout!",i.error.call(i,d,d.status),r.style.display="none"},d.setRequestHeader("Type","ajax"),d.setRequestHeader("From","mobilebone"),d.send(a)}},_.submit=function(t){if(t&&"string"==typeof t.action){var e=t.getAttribute("data-ajax");"false"==e||0==_.captureForm&&"true"!=e||t.addEventListener("submit",function(t){var e=this.getAttribute("data-preventdefault"),n=_.getFunction(e);if("function"==typeof n&&1==n(this))return t.preventDefault(),!1;_.ajax(this),t.preventDefault()})}},_.isBack=function(t,e){return 1==history.tempBack?!(history.tempBack=null):void 0===t||!!e},_.jsonHandle=function(t){return'<p style="text-align:center;">Dear master, if you see me, show that JSON parsing function is undefined!</p>'},_.init=function(t,e){if(1==f)return"Don't repeat initialization!";var n=location.hash.replace("#&","#"),i=null,r=null,a=null;if(e=e||{},~n.indexOf("?")&&(n=(a=n.split("?"))[0],e.formdata=a[1]),""==n||"#"==n){var o=t&&"#"+t||"."+this.classPage;this.transition(document.querySelector(o),null,e)}else 1==u.test(n)&&(i=document.querySelector(d(n)))&&i.classList.contains(this.classPage)?(D(n)&&((i=this.createDuplicatePage(i,i,e.formdata)[0]).formdata=e.formdata,i.id=n.replace("#","")),this.transition(i,null,e)):(2==n.split("container=").length&&(r=document.getElementById(n.split("container=")[1].split("&")[0])),this.ajax({url:location.hash.replace("#&","#").replace("#",""),dataType:"unknown",container:r,error:function(){i=document.querySelector("."+_.classPage),_.transition(i)}}));var s=l.$||l.jQuery||l.Zepto;s&&s.fn&&s.fn.tap&&"ontouchstart"in window==1?(s(document).tap(this.handleTapEvent),document.addEventListener("click",function(t){var e=t.target;if(e&&("a"==e.tagName.toLowerCase()||(e=e.getParentElementByTag("a")))){var n=e.getAttribute("data-ajax"),i=e.href;"external"==e.getAttribute("data-rel")||"false"==n||i.replace("://","").split("/")[0]!==location.href.replace("://","").split("/")[0]&&"true"!=n||0==_.captureLink&&"true"!=n?/^http/i.test(i)&&(location.href=i):t.preventDefault()}})):document.addEventListener("click",this.handleTapEvent);var c=!!navigator.userAgent.match(/safari/i)&&!navigator.userAgent.match(/chrome/i)&&void 0!==document.hidden&&!window.chrome;"ontouchstart"in window==1&&c&&(document.addEventListener("touchmove",function(){history.popstateswipe=!0}),document.addEventListener("touchend",function(){history.popstateswipe=!1})),f=!0},_.handleTapEvent=function(t){var e,n=null;t&&1==t.nodeType&&((n=t).preventDefault=function(){}),(e=(n=n||t.target||t.touches[0]).href)&&0!=/a/i.test(n.tagName)||!(n=n.getParentElementByTag("a"))||(e=n.href);var i=document.querySelector(".in."+_.classPage);if(null!=i&&n){var r={target:n},a=n.getAttribute("data-preventdefault")||q(n.getAttribute("data-params")||"").preventdefault,o=_.getFunction(a);if("function"==typeof o&&1==o(n))return t.preventDefault(),!1;var s=n.getAttribute("data-formdata");s&&(r.formdata=s);var c=n.getElementsByClassName(_.classMask)[0];if(c&&"none"!=c.style.display)return t.preventDefault(),!1;var l=n.getAttribute("data-container"),u=n.getAttribute("data-classpage"),f=l&&document.getElementById(l);f&&u&&u!=_.classPage&&(i=f.querySelector(".in."+u)||f.querySelector(u),r.history=!1,r.title=!1,r.classPage=u);var d=1==_.captureLink,h=n.getAttribute("data-rel"),p=!1;"back"==h&&(p=!0);var m="external"==h;if(e)if(e=e.replace("#&","#"),""!==n.getAttribute("href").replace(/#/g,"")){if(/^javascript/.test(e)){if(0==p)return}else if((1==(m=m||e.replace("://","").split("/")[0]!==location.href.replace("://","").split("/")[0])||0==d)&&"true"!=n.getAttribute("data-ajax"))return;if(1==/^#/.test(n.getAttribute("href"))){var g,v,y=e.split("#")[1];y&&~y.indexOf("?")&&(y=(v=y.split("?"))[0],r.formdata=v[1]),g=y&&document.getElementById(y),0==p&&"auto"==h&&(p=_.isBack(g,i)),g&&(r.reload="true"==n.getAttribute("data-reload"),_.transition(g,i,p,r)),t.preventDefault()}else if(/^javascript/.test(e))history.tempBack=!0,history.back();else if("false"!=n.getAttribute("data-ajax")){var b=_.getCleanUrl(n).split("?")[0],w=n.getAttribute("data-reload");if(n.getAttribute("href"),null!=w&&"false"!=w||!O[b])_.ajax(n);else{0==p&&"auto"==h&&(p=_.isBack(O[b],i)),r.id=b;var E=f||document.body;0==E.contains(O[b])&&E.appendChild(O[b]),_.transition(O[b],i,p,r)}t.preventDefault()}}else t.preventDefault()}},Element.prototype.getParentElementByTag=function(e){if(!e)return null;var n=null,i=this,r=function(){if(!(i=i.parentElement))return null;var t=i.tagName.toLowerCase();t===e?n=i:"body"==t?n=null:r()};return r(),n};var q=function(t){var n={};return"string"==typeof t&&t.split("&").forEach(function(t){var e=t.split("=");1<e.length&&(n[e[0]]=t.replace(e[0]+"=",""))}),n};return window.addEventListener("popstate",function(){if(1==history.popstateswipe)return location.reload(),void(history.popstateswipe=!1);if(0!=history.popstate){var t,e=location.hash.replace("#&","").replace(/^#/,""),n=null,i=null,r="";if(~e.indexOf("?")&&(e=(t=e.split("?"))[0],r=t[1]),""==e){if((n=document.querySelector("."+_.classPage)).id)return}else{if(n=O[e],D(e)&&(!n||!document.getElementById(n.id))){var a=document.getElementById(d(e));(n=_.createDuplicatePage(a,a,r)[0]).formdata=r,n.id=e.replace("#","")}if(2==e.split("container=").length&&(i=document.getElementById(e.split("container=")[1].split("&")[0])),n&&0==u.test(e))return void _.transition(n,(i||document).querySelector(".in."+_.classPage),!0,{id:e,history:!1,container:i,formdata:r})}if(!n){if(0==u.test(e))return void _.ajax({url:location.hash.replace("#&","").replace(/^#/,""),dataType:"unknown",back:_.isBack(),container:i});n=document.querySelector("#"+e)}var o=document.querySelector(".in."+_.classPage);n&&n==o||0==_.pushStateEnabled||n&&_.transition(n,o,_.isBack(n,o),{id:e,history:!1,remove:!1,formdata:r})}else history.popstate=!0}),document.MBLOADED=!0,_});var Zepto=function(){function c(t){return null==t?String(t):I[z.call(t)]||"object"}function o(t){return"function"==c(t)}function a(t){return null!=t&&t==t.window}function s(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function r(t){return"object"==c(t)}function l(t){return r(t)&&!a(t)&&Object.getPrototypeOf(t)==Object.prototype}function u(t){return"number"==typeof t.length}function f(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function n(t){return t in e?e[t]:e[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function d(t,e){return"number"!=typeof e||T[f(t)]?e:e+"px"}function i(t){return"children"in t?S.call(t.children):w.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function h(t,e){return null==e?w(t):w(t).filter(e)}function p(t,e,n,i){return o(e)?e.call(t,n,i):e}function m(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function g(t,e){var n=t.className||"",i=n&&n.baseVal!==y;return e===y?i?n.baseVal:n:void(i?n.baseVal=e:t.className=e)}function v(e){try{return e?"true"==e||"false"!=e&&("null"==e?null:+e+""==e?+e:/^[\[\{]/.test(e)?w.parseJSON(e):e):e}catch(t){return e}}var y,b,w,E,x,k,C=[],S=C.slice,L=C.filter,j=window.document,A={},e={},T={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},_=/^\s*<(\w+|!)[^>]*>/,$=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,O=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,N=/^(?:body|html)$/i,P=/([A-Z])/g,M=["val","css","html","text","data","width","height","offset"],t=j.createElement("table"),D=j.createElement("tr"),q={tr:j.createElement("tbody"),tbody:t,thead:t,tfoot:t,td:D,th:D,"*":j.createElement("div")},B=/complete|loaded|interactive/,U=/^[\w-]*$/,I={},z=I.toString,R={},F=j.createElement("div"),Z={tabindex:"tabIndex",readonly:"readOnly",for:"htmlFor",class:"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},H=Array.isArray||function(t){return t instanceof Array};return R.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var i,r=t.parentNode,a=!r;return a&&(r=F).appendChild(t),i=~R.qsa(r,e).indexOf(t),a&&F.removeChild(t),i},x=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},k=function(n){return L.call(n,function(t,e){return n.indexOf(t)==e})},R.fragment=function(t,e,n){var i,r,a;return $.test(t)&&(i=w(j.createElement(RegExp.$1))),i||(t.replace&&(t=t.replace(O,"<$1></$2>")),e===y&&(e=_.test(t)&&RegExp.$1),e in q||(e="*"),(a=q[e]).innerHTML=""+t,i=w.each(S.call(a.childNodes),function(){a.removeChild(this)})),l(n)&&(r=w(i),w.each(n,function(t,e){-1<M.indexOf(t)?r[t](e):r.attr(t,e)})),i},R.Z=function(t,e){return(t=t||[]).__proto__=w.fn,t.selector=e||"",t},R.isZ=function(t){return t instanceof R.Z},R.init=function(t,e){var n,i;if(!t)return R.Z();if("string"==typeof t)if("<"==(t=t.trim())[0]&&_.test(t))n=R.fragment(t,RegExp.$1,e),t=null;else{if(e!==y)return w(e).find(t);n=R.qsa(j,t)}else{if(o(t))return w(j).ready(t);if(R.isZ(t))return t;if(H(t))i=t,n=L.call(i,function(t){return null!=t});else if(r(t))n=[t],t=null;else if(_.test(t))n=R.fragment(t.trim(),RegExp.$1,e),t=null;else{if(e!==y)return w(e).find(t);n=R.qsa(j,t)}}return R.Z(n,t)},(w=function(t,e){return R.init(t,e)}).extend=function(e){var n,t=S.call(arguments,1);return"boolean"==typeof e&&(n=e,e=t.shift()),t.forEach(function(t){!function t(e,n,i){for(b in n)i&&(l(n[b])||H(n[b]))?(l(n[b])&&!l(e[b])&&(e[b]={}),H(n[b])&&!H(e[b])&&(e[b]=[]),t(e[b],n[b],i)):n[b]!==y&&(e[b]=n[b])}(e,t,n)}),e},R.qsa=function(t,e){var n,i="#"==e[0],r=!i&&"."==e[0],a=i||r?e.slice(1):e,o=U.test(a);return s(t)&&o&&i?(n=t.getElementById(a))?[n]:[]:1!==t.nodeType&&9!==t.nodeType?[]:S.call(o&&!i?r?t.getElementsByClassName(a):t.getElementsByTagName(e):t.querySelectorAll(e))},w.contains=j.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},w.type=c,w.isFunction=o,w.isWindow=a,w.isArray=H,w.isPlainObject=l,w.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},w.inArray=function(t,e,n){return C.indexOf.call(e,t,n)},w.camelCase=x,w.trim=function(t){return null==t?"":String.prototype.trim.call(t)},w.uuid=0,w.support={},w.expr={},w.map=function(t,e){var n,i,r,a,o=[];if(u(t))for(i=0;i<t.length;i++)null!=(n=e(t[i],i))&&o.push(n);else for(r in t)null!=(n=e(t[r],r))&&o.push(n);return 0<(a=o).length?w.fn.concat.apply([],a):a},w.each=function(t,e){var n,i;if(u(t)){for(n=0;n<t.length;n++)if(!1===e.call(t[n],n,t[n]))return t}else for(i in t)if(!1===e.call(t[i],i,t[i]))return t;return t},w.grep=function(t,e){return L.call(t,e)},window.JSON&&(w.parseJSON=JSON.parse),w.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(t,e){I["[object "+e+"]"]=e.toLowerCase()}),w.fn={forEach:C.forEach,reduce:C.reduce,push:C.push,sort:C.sort,indexOf:C.indexOf,concat:C.concat,map:function(n){return w(w.map(this,function(t,e){return n.call(t,e,t)}))},slice:function(){return w(S.apply(this,arguments))},ready:function(t){return B.test(j.readyState)&&j.body?t(w):j.addEventListener("DOMContentLoaded",function(){t(w)},!1),this},get:function(t){return t===y?S.call(this):this[0<=t?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(n){return C.every.call(this,function(t,e){return!1!==n.call(t,e,t)}),this},filter:function(e){return o(e)?this.not(this.not(e)):w(L.call(this,function(t){return R.matches(t,e)}))},add:function(t,e){return w(k(this.concat(w(t,e))))},is:function(t){return 0<this.length&&R.matches(this[0],t)},not:function(e){var n=[];if(o(e)&&e.call!==y)this.each(function(t){e.call(this,t)||n.push(this)});else{var i="string"==typeof e?this.filter(e):u(e)&&o(e.item)?S.call(e):w(e);this.forEach(function(t){i.indexOf(t)<0&&n.push(t)})}return w(n)},has:function(t){return this.filter(function(){return r(t)?w.contains(this,t):w(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!r(t)?t:w(t)},last:function(){var t=this[this.length-1];return t&&!r(t)?t:w(t)},find:function(t){var n=this;return t?"object"==typeof t?w(t).filter(function(){var e=this;return C.some.call(n,function(t){return w.contains(t,e)})}):1==this.length?w(R.qsa(this[0],t)):this.map(function(){return R.qsa(this,t)}):w()},closest:function(t,e){var n=this[0],i=!1;for("object"==typeof t&&(i=w(t));n&&!(i?0<=i.indexOf(n):R.matches(n,t));)n=n!==e&&!s(n)&&n.parentNode;return w(n)},parents:function(t){for(var e=[],n=this;0<n.length;)n=w.map(n,function(t){return(t=t.parentNode)&&!s(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return h(e,t)},parent:function(t){return h(k(this.pluck("parentNode")),t)},children:function(t){return h(this.map(function(){return i(this)}),t)},contents:function(){return this.map(function(){return S.call(this.childNodes)})},siblings:function(t){return h(this.map(function(t,e){return L.call(i(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(e){return w.map(this,function(t){return t[e]})},show:function(){return this.each(function(){var t,e,n;"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=(t=this.nodeName,A[t]||(e=j.createElement(t),j.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),A[t]=n),A[t]))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(e){var n=o(e);if(this[0]&&!n)var i=w(e).get(0),r=i.parentNode||1<this.length;return this.each(function(t){w(this).wrapAll(n?e.call(this,t):r?i.cloneNode(!0):i)})},wrapAll:function(t){if(this[0]){w(this[0]).before(t=w(t));for(var e;(e=t.children()).length;)t=e.first();w(t).append(this)}return this},wrapInner:function(r){var a=o(r);return this.each(function(t){var e=w(this),n=e.contents(),i=a?r.call(this,t):r;n.length?n.wrapAll(i):e.append(i)})},unwrap:function(){return this.parent().each(function(){w(this).replaceWith(w(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(e){return this.each(function(){var t=w(this);(e===y?"none"==t.css("display"):e)?t.show():t.hide()})},prev:function(t){return w(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return w(this.pluck("nextElementSibling")).filter(t||"*")},html:function(n){return 0 in arguments?this.each(function(t){var e=this.innerHTML;w(this).empty().append(p(this,n,t,e))}):0 in this?this[0].innerHTML:null},text:function(n){return 0 in arguments?this.each(function(t){var e=p(this,n,t,this.textContent);this.textContent=null==e?"":""+e}):0 in this?this[0].textContent:null},attr:function(e,n){var t;return"string"!=typeof e||1 in arguments?this.each(function(t){if(1===this.nodeType)if(r(e))for(b in e)m(this,b,e[b]);else m(this,e,p(this,n,t,this.getAttribute(e)))}):this.length&&1===this[0].nodeType?!(t=this[0].getAttribute(e))&&e in this[0]?this[0][e]:t:y},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){m(this,t)},this)})},prop:function(e,n){return e=Z[e]||e,1 in arguments?this.each(function(t){this[e]=p(this,n,t,this[e])}):this[0]&&this[0][e]},data:function(t,e){var n="data-"+t.replace(P,"-$1").toLowerCase(),i=1 in arguments?this.attr(n,e):this.attr(n);return null!==i?v(i):y},val:function(e){return 0 in arguments?this.each(function(t){this.value=p(this,e,t,this.value)}):this[0]&&(this[0].multiple?w(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(a){if(a)return this.each(function(t){var e=w(this),n=p(this,a,t,e.offset()),i=e.offsetParent().offset(),r={top:n.top-i.top,left:n.left-i.left};"static"==e.css("position")&&(r.position="relative"),e.css(r)});if(!this.length)return null;var t=this[0].getBoundingClientRect();return{left:t.left+window.pageXOffset,top:t.top+window.pageYOffset,width:Math.round(t.width),height:Math.round(t.height)}},css:function(t,e){if(arguments.length<2){var n,i=this[0];if(!i)return;if(n=getComputedStyle(i,""),"string"==typeof t)return i.style[x(t)]||n.getPropertyValue(t);if(H(t)){var r={};return w.each(t,function(t,e){r[e]=i.style[x(e)]||n.getPropertyValue(e)}),r}}var a="";if("string"==c(t))e||0===e?a=f(t)+":"+d(t,e):this.each(function(){this.style.removeProperty(f(t))});else for(b in t)t[b]||0===t[b]?a+=f(b)+":"+d(b,t[b])+";":this.each(function(){this.style.removeProperty(f(b))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(w(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return!!t&&C.some.call(this,function(t){return this.test(g(t))},n(t))},addClass:function(n){return n?this.each(function(t){if("className"in this){E=[];var e=g(this);p(this,n,t,e).split(/\s+/g).forEach(function(t){w(this).hasClass(t)||E.push(t)},this),E.length&&g(this,e+(e?" ":"")+E.join(" "))}}):this},removeClass:function(e){return this.each(function(t){if("className"in this){if(e===y)return g(this,"");E=g(this),p(this,e,t,E).split(/\s+/g).forEach(function(t){E=E.replace(n(t)," ")}),g(this,E.trim())}})},toggleClass:function(n,i){return n?this.each(function(t){var e=w(this);p(this,n,t,g(this)).split(/\s+/g).forEach(function(t){(i===y?!e.hasClass(t):i)?e.addClass(t):e.removeClass(t)})}):this},scrollTop:function(t){if(this.length){var e="scrollTop"in this[0];return t===y?e?this[0].scrollTop:this[0].pageYOffset:this.each(e?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})}},scrollLeft:function(t){if(this.length){var e="scrollLeft"in this[0];return t===y?e?this[0].scrollLeft:this[0].pageXOffset:this.each(e?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),n=this.offset(),i=N.test(e[0].nodeName)?{top:0,left:0}:e.offset();return n.top-=parseFloat(w(t).css("margin-top"))||0,n.left-=parseFloat(w(t).css("margin-left"))||0,i.top+=parseFloat(w(e[0]).css("border-top-width"))||0,i.left+=parseFloat(w(e[0]).css("border-left-width"))||0,{top:n.top-i.top,left:n.left-i.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||j.body;t&&!N.test(t.nodeName)&&"static"==w(t).css("position");)t=t.offsetParent;return t})}},w.fn.detach=w.fn.remove,["width","height"].forEach(function(i){var r=i.replace(/./,function(t){return t[0].toUpperCase()});w.fn[i]=function(e){var t,n=this[0];return e===y?a(n)?n["inner"+r]:s(n)?n.documentElement["scroll"+r]:(t=this.offset())&&t[i]:this.each(function(t){(n=w(this)).css(i,p(this,e,t,n[i]()))})}}),["after","prepend","before","append"].forEach(function(e,o){var s=o%2;w.fn[e]=function(){var e,i,r=w.map(arguments,function(t){return"object"==(e=c(t))||"array"==e||null==t?t:R.fragment(t)}),a=1<this.length;return r.length<1?this:this.each(function(t,e){i=s?e:e.parentNode,e=0==o?e.nextSibling:1==o?e.firstChild:2==o?e:null;var n=w.contains(j.documentElement,i);r.forEach(function(t){if(a)t=t.cloneNode(!0);else if(!i)return w(t).remove();i.insertBefore(t,e),n&&function t(e,n){n(e);for(var i=0,r=e.childNodes.length;i<r;i++)t(e.childNodes[i],n)}(t,function(t){null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||window.eval.call(window,t.innerHTML)})})})},w.fn[s?e+"To":"insert"+(o?"Before":"After")]=function(t){return w(t)[e](this),this}}),R.Z.prototype=w.fn,R.uniq=k,R.deserializeValue=v,w.zepto=R,w}();window.Zepto=Zepto,void 0===window.$&&(window.$=Zepto),function(u){function f(t){return t._zid||(t._zid=e++)}function o(t,e,n,i){if((e=d(e)).ns)var r=(a=e.ns,new RegExp("(?:^| )"+a.replace(" "," .* ?")+"(?: |$)"));var a;return(x[f(t)]||[]).filter(function(t){return!(!t||e.e&&t.e!=e.e||e.ns&&!r.test(t.ns)||n&&f(t.fn)!==f(n)||i&&t.sel!=i)})}function d(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function h(t,e){return t.del&&!n&&t.e in i||!!e}function p(t){return k[t]||n&&i[t]||t}function l(r,t,e,a,o,s,c){var n=f(r),l=x[n]||(x[n]=[]);t.split(/\s/).forEach(function(t){if("ready"==t)return u(document).ready(e);var n=d(t);n.fn=e,n.sel=o,n.e in k&&(e=function(t){var e=t.relatedTarget;return!e||e!==this&&!u.contains(this,e)?n.fn.apply(this,arguments):void 0});var i=(n.del=s)||e;n.proxy=function(t){if(!(t=g(t)).isImmediatePropagationStopped()){t.data=a;var e=i.apply(r,t._args==y?[t]:[t].concat(t._args));return!1===e&&(t.preventDefault(),t.stopPropagation()),e}},n.i=l.length,l.push(n),"addEventListener"in r&&r.addEventListener(p(n.e),n.proxy,h(n,c))})}function m(e,t,n,i,r){var a=f(e);(t||"").split(/\s/).forEach(function(t){o(e,t,n,i).forEach(function(t){delete x[a][t.i],"removeEventListener"in e&&e.removeEventListener(p(t.e),t.proxy,h(t,r))})})}function g(i,r){return(r||!i.isDefaultPrevented)&&(r||(r=i),u.each(t,function(t,e){var n=r[t];i[t]=function(){return this[e]=s,n&&n.apply(r,arguments)},i[e]=C}),(r.defaultPrevented!==y?r.defaultPrevented:"returnValue"in r?!1===r.returnValue:r.getPreventDefault&&r.getPreventDefault())&&(i.isDefaultPrevented=s)),i}function v(t){var e,n={originalEvent:t};for(e in t)r.test(e)||t[e]===y||(n[e]=t[e]);return g(n,t)}var y,e=1,b=Array.prototype.slice,w=u.isFunction,E=function(t){return"string"==typeof t},x={},a={},n="onfocusin"in window,i={focus:"focusin",blur:"focusout"},k={mouseenter:"mouseover",mouseleave:"mouseout"};a.click=a.mousedown=a.mouseup=a.mousemove="MouseEvents",u.event={add:l,remove:m},u.proxy=function(t,e){var n=2 in arguments&&b.call(arguments,2);if(w(t)){var i=function(){return t.apply(e,n?n.concat(b.call(arguments)):arguments)};return i._zid=f(t),i}if(E(e))return n?(n.unshift(t[e],t),u.proxy.apply(null,n)):u.proxy(t[e],t);throw new TypeError("expected function")},u.fn.bind=function(t,e,n){return this.on(t,e,n)},u.fn.unbind=function(t,e){return this.off(t,e)},u.fn.one=function(t,e,n,i){return this.on(t,e,n,i,1)};var s=function(){return!0},C=function(){return!1},r=/^([A-Z]|returnValue$|layer[XY]$)/,t={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};u.fn.delegate=function(t,e,n){return this.on(e,t,n)},u.fn.undelegate=function(t,e,n){return this.off(e,t,n)},u.fn.live=function(t,e){return u(document.body).delegate(this.selector,t,e),this},u.fn.die=function(t,e){return u(document.body).undelegate(this.selector,t,e),this},u.fn.on=function(e,r,n,a,o){var s,c,i=this;return e&&!E(e)?(u.each(e,function(t,e){i.on(t,r,n,e,o)}),i):(E(r)||w(a)||!1===a||(a=n,n=r,r=y),(w(n)||!1===n)&&(a=n,n=y),!1===a&&(a=C),i.each(function(t,i){o&&(s=function(t){return m(i,t.type,a),a.apply(this,arguments)}),r&&(c=function(t){var e,n=u(t.target).closest(r,i).get(0);return n&&n!==i?(e=u.extend(v(t),{currentTarget:n,liveFired:i}),(s||a).apply(n,[e].concat(b.call(arguments,1)))):void 0}),l(i,e,a,n,r,c||s)}))},u.fn.off=function(t,n,e){var i=this;return t&&!E(t)?(u.each(t,function(t,e){i.off(t,n,e)}),i):(E(n)||w(e)||!1===e||(e=n,n=y),!1===e&&(e=C),i.each(function(){m(this,t,e,n)}))},u.fn.trigger=function(t,e){return(t=E(t)||u.isPlainObject(t)?u.Event(t):g(t))._args=e,this.each(function(){t.type in i&&"function"==typeof this[t.type]?this[t.type]():"dispatchEvent"in this?this.dispatchEvent(t):u(this).triggerHandler(t,e)})},u.fn.triggerHandler=function(n,i){var r,a;return this.each(function(t,e){(r=v(E(n)?u.Event(n):n))._args=i,r.target=e,u.each(o(e,n.type||n),function(t,e){return a=e.proxy(r),!r.isImmediatePropagationStopped()&&void 0})}),a},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){u.fn[e]=function(t){return 0 in arguments?this.bind(e,t):this.trigger(e)}}),u.Event=function(t,e){E(t)||(t=(e=t).type);var n=document.createEvent(a[t]||"Events"),i=!0;if(e)for(var r in e)"bubbles"==r?i=!!e[r]:n[r]=e[r];return n.initEvent(t,i,!0),g(n)}}(Zepto),function(dh){function fh(t,e,n,i){return t.global?(r=e||vh,a=n,o=i,s=dh.Event(a),dh(r).trigger(s,o),!s.isDefaultPrevented()):void 0;var r,a,o,s}function ih(t,e){var n=e.context;return!1!==e.beforeSend.call(n,t,e)&&!1!==fh(e,n,"ajaxBeforeSend",[t,e])&&void fh(e,n,"ajaxSend",[t,e])}function jh(t,e,n,i){var r=n.context,a="success";n.success.call(r,t,a,e),i&&i.resolveWith(r,[t,a,e]),fh(n,r,"ajaxSuccess",[e,n,t]),lh(a,e,n)}function kh(t,e,n,i,r){var a=i.context;i.error.call(a,n,e,t),r&&r.rejectWith(a,[n,e,t]),fh(i,a,"ajaxError",[n,i,t||e]),lh(e,n,i)}function lh(t,e,n){var i,r=n.context;n.complete.call(r,e,t),fh(n,r,"ajaxComplete",[e,n]),(i=n).global&&!--dh.active&&fh(i,null,"ajaxStop")}function mh(){}function oh(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function qh(t,e,n,i){return dh.isFunction(e)&&(i=n,n=e,e=void 0),dh.isFunction(n)||(i=n,n=void 0),{url:t,data:e,success:n,dataType:i}}var sh,th,uh=0,vh=window.document,wh=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,xh=/^(?:text|application)\/javascript/i,yh=/^(?:text|application)\/xml/i,zh="application/json",Ah="text/html",Bh=/^\s*$/,Ch=vh.createElement("a");Ch.href=window.location.href,dh.active=0,dh.ajaxJSONP=function(n,i){if(!("type"in n))return dh.ajax(n);var r,a,t=n.jsonpCallback,o=(dh.isFunction(t)?t():t)||"jsonp"+ ++uh,s=vh.createElement("script"),c=window[o],e=function(t){dh(s).triggerHandler("error",t||"abort")},l={abort:e};return i&&i.promise(l),dh(s).on("load error",function(t,e){clearTimeout(a),dh(s).off().remove(),"error"!=t.type&&r?jh(r[0],l,n,i):kh(null,e||"error",l,n,i),window[o]=c,r&&dh.isFunction(c)&&c(r[0]),c=r=void 0}),!1===ih(l,n)?e("abort"):(window[o]=function(){r=arguments},s.src=n.url.replace(/\?(.+)=\?/,"?$1="+o),vh.head.appendChild(s),0<n.timeout&&(a=setTimeout(function(){e("timeout")},n.timeout))),l},dh.ajaxSettings={type:"GET",beforeSend:mh,success:mh,error:mh,complete:mh,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:zh,xml:"application/xml, text/xml",html:Ah,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},dh.ajax=function(Ji){var Ki,ii,Mh,Li=dh.extend({},Ji||{}),Mi=dh.Deferred&&dh.Deferred();for(sh in dh.ajaxSettings)void 0===Li[sh]&&(Li[sh]=dh.ajaxSettings[sh]);(Mh=Li).global&&0==dh.active++&&fh(Mh,null,"ajaxStart"),Li.crossDomain||((Ki=vh.createElement("a")).href=Li.url,Ki.href=Ki.href,Li.crossDomain=Ch.protocol+"//"+Ch.host!=Ki.protocol+"//"+Ki.host),Li.url||(Li.url=window.location.toString()),(ii=Li).processData&&ii.data&&"string"!=dh.type(ii.data)&&(ii.data=dh.param(ii.data,ii.traditional)),!ii.data||ii.type&&"GET"!=ii.type.toUpperCase()||(ii.url=oh(ii.url,ii.data),ii.data=void 0);var Ni=Li.dataType,Oi=/\?.+=\?/.test(Li.url);if(Oi&&(Ni="jsonp"),!1!==Li.cache&&(Ji&&!0===Ji.cache||"script"!=Ni&&"jsonp"!=Ni)||(Li.url=oh(Li.url,"_="+Date.now())),"jsonp"==Ni)return Oi||(Li.url=oh(Li.url,Li.jsonp?Li.jsonp+"=?":!1===Li.jsonp?"":"callback=?")),dh.ajaxJSONP(Li,Mi);var Pi,Qi=Li.accepts[Ni],Ri={},Si=function(t,e){Ri[t.toLowerCase()]=[t,e]},Ti=/^([\w-]+:)\/\//.test(Li.url)?RegExp.$1:window.location.protocol,Ui=Li.xhr(),Vi=Ui.setRequestHeader;if(Mi&&Mi.promise(Ui),Li.crossDomain||Si("X-Requested-With","XMLHttpRequest"),Si("Accept",Qi||"*/*"),(Qi=Li.mimeType||Qi)&&(-1<Qi.indexOf(",")&&(Qi=Qi.split(",",2)[0]),Ui.overrideMimeType&&Ui.overrideMimeType(Qi)),(Li.contentType||!1!==Li.contentType&&Li.data&&"GET"!=Li.type.toUpperCase())&&Si("Content-Type",Li.contentType||"application/x-www-form-urlencoded"),Li.headers)for(th in Li.headers)Si(th,Li.headers[th]);if(Ui.setRequestHeader=Si,Ui.onreadystatechange=function(){if(4==Ui.readyState){Ui.onreadystatechange=mh,clearTimeout(Pi);var Zi,$i=!1;if(200<=Ui.status&&Ui.status<300||304==Ui.status||0==Ui.status&&"file:"==Ti){Ni=Ni||((fi=Li.mimeType||Ui.getResponseHeader("content-type"))&&(fi=fi.split(";",2)[0]),fi&&(fi==Ah?"html":fi==zh?"json":xh.test(fi)?"script":yh.test(fi)&&"xml")||"text"),Zi=Ui.responseText;try{"script"==Ni?eval(Zi):"xml"==Ni?Zi=Ui.responseXML:"json"==Ni&&(Zi=Bh.test(Zi)?null:dh.parseJSON(Zi))}catch(t){$i=t}$i?kh($i,"parsererror",Ui,Li,Mi):jh(Zi,Ui,Li,Mi)}else kh(Ui.statusText||null,Ui.status?"error":"abort",Ui,Li,Mi)}var fi},!1===ih(Ui,Li))return Ui.abort(),kh(null,"abort",Ui,Li,Mi),Ui;if(Li.xhrFields)for(th in Li.xhrFields)Ui[th]=Li.xhrFields[th];var Wi=!("async"in Li)||Li.async;for(th in Ui.open(Li.type,Li.url,Wi,Li.username,Li.password),Ri)Vi.apply(Ui,Ri[th]);return 0<Li.timeout&&(Pi=setTimeout(function(){Ui.onreadystatechange=mh,Ui.abort(),kh(null,"timeout",Ui,Li,Mi)},Li.timeout)),Ui.send(Li.data?Li.data:null),Ui},dh.get=function(){return dh.ajax(qh.apply(null,arguments))},dh.post=function(){var t=qh.apply(null,arguments);return t.type="POST",dh.ajax(t)},dh.getJSON=function(){var t=qh.apply(null,arguments);return t.dataType="json",dh.ajax(t)},dh.fn.load=function(t,e,n){if(!this.length)return this;var i,r=this,a=t.split(/\s/),o=qh(t,e,n),s=o.success;return 1<a.length&&(o.url=a[0],i=a[1]),o.success=function(t){r.html(i?dh("<div>").html(t.replace(wh,"")).find(i):t),s&&s.apply(r,arguments)},dh.ajax(o),this};var Dh=encodeURIComponent;dh.param=function(t,e){var n=[];return n.add=function(t,e){dh.isFunction(e)&&(e=e()),null==e&&(e=""),this.push(Dh(t)+"="+Dh(e))},function n(i,t,r,a){var o,s=dh.isArray(t),c=dh.isPlainObject(t);dh.each(t,function(t,e){o=dh.type(e),a&&(t=r?a:a+"["+(c||"object"==o||"array"==o?t:"")+"]"),!a&&s?i.add(e.name,e.value):"array"==o||!r&&"object"==o?n(i,e,r,t):i.add(t,e)})}(n,t,e),n.join("&").replace(/%20/g,"+")}}(Zepto),function(a){a.fn.serializeArray=function(){var n,i,e=[],r=function(t){return t.forEach?t.forEach(r):void e.push({name:n,value:t})};return this[0]&&a.each(this[0].elements,function(t,e){i=e.type,(n=e.name)&&"fieldset"!=e.nodeName.toLowerCase()&&!e.disabled&&"submit"!=i&&"reset"!=i&&"button"!=i&&"file"!=i&&("radio"!=i&&"checkbox"!=i||e.checked)&&r(a(e).val())}),e},a.fn.serialize=function(){var e=[];return this.serializeArray().forEach(function(t){e.push(encodeURIComponent(t.name)+"="+encodeURIComponent(t.value))}),e.join("&")},a.fn.submit=function(t){if(0 in arguments)this.bind("submit",t);else if(this.length){var e=a.Event("submit");this.eq(0).trigger(e),e.isDefaultPrevented()||this.get(0).submit()}return this}}(Zepto),function(n){"__proto__"in{}||n.extend(n.zepto,{Z:function(t,e){return t=t||[],n.extend(t,n.fn),t.selector=e||"",t.__Z=!0,t},isZ:function(t){return"array"===n.type(t)&&"__Z"in t}});try{getComputedStyle(void 0)}catch(t){var e=getComputedStyle;window.getComputedStyle=function(t){try{return e(t)}catch(t){return null}}}}(Zepto),function(i){var t={nextAll:function(t){for(var e=i(),n=this.next();n.length;)(void 0===t||n.is(t))&&(e=e.add(n)),n=n.next();return e},prevAll:function(t){for(var e=i(),n=this.prev();n.length;)(void 0===t||n.is(t))&&(e=e.add(n)),n=n.prev();return e}};i.extend(i.fn,t)}(Zepto),function(d){d.Callbacks=function(i){i=d.extend({},i);var e,n,r,a,o,s,c=[],l=!i.once&&[],u=function(t){for(e=i.memory&&t,n=!0,s=a||0,a=0,o=c.length,r=!0;c&&s<o;++s)if(!1===c[s].apply(t[0],t[1])&&i.stopOnFalse){e=!1;break}r=!1,c&&(l?l.length&&u(l.shift()):e?c.length=0:f.disable())},f={add:function(){if(c){var t=c.length,n=function(t){d.each(t,function(t,e){"function"==typeof e?i.unique&&f.has(e)||c.push(e):e&&e.length&&"string"!=typeof e&&n(e)})};n(arguments),r?o=c.length:e&&(a=t,u(e))}return this},remove:function(){return c&&d.each(arguments,function(t,e){for(var n;-1<(n=d.inArray(e,c,n));)c.splice(n,1),r&&(n<=o&&--o,n<=s&&--s)}),this},has:function(t){return!(!c||!(t?-1<d.inArray(t,c):c.length))},empty:function(){return o=c.length=0,this},disable:function(){return c=l=e=void 0,this},disabled:function(){return!c},lock:function(){return l=void 0,e||f.disable(),this},locked:function(){return!l},fireWith:function(t,e){return!c||n&&!l||(e=[t,(e=e||[]).slice?e.slice():e],r?l.push(e):u(e)),this},fire:function(){return f.fireWith(this,arguments)},fired:function(){return!!n}};return f}}(Zepto),function(u){var f=Array.prototype.slice;function d(t){var r=[["resolve","done",u.Callbacks({once:1,memory:1}),"resolved"],["reject","fail",u.Callbacks({once:1,memory:1}),"rejected"],["notify","progress",u.Callbacks({memory:1})]],a="pending",o={state:function(){return a},always:function(){return s.done(arguments).fail(arguments),this},then:function(){var e=arguments;return d(function(a){u.each(r,function(t,i){var r=u.isFunction(e[t])&&e[t];s[i[1]](function(){var t=r&&r.apply(this,arguments);if(t&&u.isFunction(t.promise))t.promise().done(a.resolve).fail(a.reject).progress(a.notify);else{var e=this===o?a.promise():this,n=r?[t]:arguments;a[i[0]+"With"](e,n)}})}),e=null}).promise()},promise:function(t){return null!=t?u.extend(t,o):o}},s={};return u.each(r,function(t,e){var n=e[2],i=e[3];o[e[1]]=n.add,i&&n.add(function(){a=i},r[1^t][2].disable,r[2][2].lock),s[e[0]]=function(){return s[e[0]+"With"](this===s?o:this,arguments),this},s[e[0]+"With"]=n.fireWith}),o.promise(s),t&&t.call(s,s),s}u.when=function(t){var r,e,n,i=f.call(arguments),a=i.length,o=0,s=1!==a||t&&u.isFunction(t.promise)?a:0,c=1===s?t:d(),l=function(e,n,i){return function(t){n[e]=this,i[e]=1<arguments.length?f.call(arguments):t,i===r?c.notifyWith(n,i):--s||c.resolveWith(n,i)}};if(1<a)for(r=new Array(a),e=new Array(a),n=new Array(a);o<a;++o)i[o]&&u.isFunction(i[o].promise)?i[o].promise().done(l(o,n,i)).fail(c.reject).progress(l(o,e,r)):--s;return s||c.resolveWith(n,i),c.promise()},u.Deferred=d}(Zepto),function(u){var f=function(){var t,e,n,i,r,a,o=arguments[0]||{},s=1,c=arguments.length,l=!1;for("boolean"==typeof o&&(l=o,o=arguments[1]||{},s=2),"object"==typeof o||u.isFunction(o)||(o={}),c===s&&(o=this,--s);s<c;s++)if(null!=(t=arguments[s]))for(e in t)n=o[e],o!==(i=t[e])&&(l&&i&&(u.isPlainObject(i)||(r=u.isArray(i)))?(a=r?(r=!1,n&&u.isArray(n)?n:[]):n&&u.isPlainObject(n)?n:{},o[e]=f(l,a,i)):void 0!==i&&t.hasOwnProperty(e)&&(o[e]=i));return o};u.extend=f}(Zepto),define("zepto",[],function(){}),define("utils",["zepto"],function(){var a=function(){return!0},t=function(e){return function(t){return{}.toString.call(t)=="[object "+e+"]"}},o=(t("String"),t("Object")),e=0;return{ajax:function(t,e,n,i){o(t)&&(i=n,n=e,e=t,t="com.api.mobilemode.web.mobile.portal.PortalAction");var r=e.url;return r||(r="/mobilemode/mobile/server.jsp?invoker="+t+"&action="+e.action),e.url=r,e.cache=!1,e.dataType="json",n=n||a,i=i||a,$.ajax(e).done(function(t){if("1"==t.status)return n(t);"0"==t.status?alert("Server interface error:"+t.errMsg):alert("Server connection exception:"+JSON.stringify(t)),i()})},strToJson:function(t,e,n){var i,r,a=t.split(e),o={};return a.length&&a.forEach(function(t){var e=t.split(n);1!==e.length&&(i=e[0],r=e[1],o[i]=r)}),o},showBackBtn:function(t){navigator.userAgent.match(/e-mobile/i)&&navigator.userAgent.match(/iPhone|ipad/i)&&(1===(e+=t?-1:1)&&t?location="emobile:backBtnHide":2!==e||t||(location="emobile:backBtnShow"))},toggleTab:function(t){var e=$(t.target&&this||t),n=$(".tab-panel[data-rel="+e.data("tab")+"]"),i=function(t){t.addClass("active").siblings(".active").removeClass("active")};i(e),i(n)}}}),define("juicer",[],function(){return function(){var f=function(){var r=[].slice.call(arguments);return r.push(f.options),r[0].match(/^\s*#([\w:\-\.]+)\s*$/gim)&&r[0].replace(/^\s*#([\w:\-\.]+)\s*$/gim,function(t,e){var n=document,i=n&&n.getElementById(e);r[0]=i?i.value||i.innerHTML:t}),1==arguments.length?f.compile.apply(f,r):2<=arguments.length?f.to_html.apply(f,r):void 0},e={escapehash:{"<":"<",">":">","&":"&",'"':""","'":"'","/":"/"},escapereplace:function(t){return e.escapehash[t]},escaping:function(t){return"string"!=typeof t?t:t.replace(/[&<>"]/gim,this.escapereplace)},detection:function(t){return void 0===t?"":t}},i=function(t){if("undefined"!=typeof console){if(console.warn)return void console.warn(t);if(console.log)return void console.log(t)}throw t},r=function(t,e){if((t=t!==Object(t)?{}:t).__proto__)return t.__proto__=e,t;var n=function(){},i=Object.create?Object.create(e):(n.prototype=e,new n);for(var r in t)t.hasOwnProperty(r)&&(i[r]=t[r]);return i};f.__cache={},f.version="0.6.5-stable",f.settings={},f.tags={operationOpen:"{@",operationClose:"}",interpolateOpen:"\\${",interpolateClose:"}",noneencodeOpen:"\\$\\${",noneencodeClose:"}",commentOpen:"\\{#",commentClose:"\\}"},f.options={cache:!0,strip:!0,errorhandling:!0,detection:!0,_method:r({__escapehtml:e,__throw:i,__juicer:f},{})},f.tagInit=function(){var t=f.tags.operationOpen+"each\\s*([^}]*?)\\s*as\\s*(\\w*?)\\s*(,\\s*\\w*?)?"+f.tags.operationClose,e=f.tags.operationOpen+"\\/each"+f.tags.operationClose,n=f.tags.operationOpen+"if\\s*([^}]*?)"+f.tags.operationClose,i=f.tags.operationOpen+"\\/if"+f.tags.operationClose,r=f.tags.operationOpen+"else"+f.tags.operationClose,a=f.tags.operationOpen+"else if\\s*([^}]*?)"+f.tags.operationClose,o=f.tags.interpolateOpen+"([\\s\\S]+?)"+f.tags.interpolateClose,s=f.tags.noneencodeOpen+"([\\s\\S]+?)"+f.tags.noneencodeClose,c=f.tags.commentOpen+"[^}]*?"+f.tags.commentClose,l=f.tags.operationOpen+"each\\s*(\\w*?)\\s*in\\s*range\\(([^}]+?)\\s*,\\s*([^}]+?)\\)"+f.tags.operationClose,u=f.tags.operationOpen+"include\\s*([^}]*?)\\s*,\\s*([^}]*?)"+f.tags.operationClose;f.settings.forstart=new RegExp(t,"igm"),f.settings.forend=new RegExp(e,"igm"),f.settings.ifstart=new RegExp(n,"igm"),f.settings.ifend=new RegExp(i,"igm"),f.settings.elsestart=new RegExp(r,"igm"),f.settings.elseifstart=new RegExp(a,"igm"),f.settings.interpolate=new RegExp(o,"igm"),f.settings.noneencode=new RegExp(s,"igm"),f.settings.inlinecomment=new RegExp(c,"igm"),f.settings.rangestart=new RegExp(l,"igm"),f.settings.include=new RegExp(u,"igm")},f.tagInit(),f.set=function(t,e){var i=this,n=function(t,e){var n=t.match(/^tag::(.*)$/i);if(n)return i.tags[n[1]]=e.replace(/[\$\(\)\[\]\+\^\{\}\?\*\|\.]/gim,function(t){return"\\"+t}),void i.tagInit();i.options[t]=e};if(2!==arguments.length){if(t===Object(t))for(var r in t)t.hasOwnProperty(r)&&n(r,t[r])}else n(t,e)},f.register=function(t,e){var n=this.options._method;return!n.hasOwnProperty(t)&&(n[t]=e)},f.unregister=function(t){var e=this.options._method;if(e.hasOwnProperty(t))return delete e[t]},f.template=function(t){var i=this;this.options=t,this.__interpolate=function(t,e,n){var i,r=t.split("|"),a=r[0]||"";return 1<r.length&&(t=r.shift(),a="_method."+(i=r.shift().split(",")).shift()+".call({}, "+[t].concat(i)+")"),"<%= "+(e?"_method.__escapehtml.escaping":"")+"("+(n&&!1===n.detection?"":"_method.__escapehtml.detection")+"("+a+")) %>"},this.__removeShell=function(t,n){var a=0;return t=t.replace(f.settings.forstart,function(t,e,n,i){n=n||"value",i=i&&i.substr(1);var r="i"+a++;return"<% ~function() {for(var "+r+" in "+e+") {if("+e+".hasOwnProperty("+r+")) {var "+n+"="+e+"["+r+"];"+(i?"var "+i+"="+r+";":"")+" %>"}).replace(f.settings.forend,"<% }}}(); %>").replace(f.settings.ifstart,function(t,e){return"<% if("+e+") { %>"}).replace(f.settings.ifend,"<% } %>").replace(f.settings.elsestart,function(t){return"<% } else { %>"}).replace(f.settings.elseifstart,function(t,e){return"<% } else if("+e+") { %>"}).replace(f.settings.noneencode,function(t,e){return i.__interpolate(e,!1,n)}).replace(f.settings.interpolate,function(t,e){return i.__interpolate(e,!0,n)}).replace(f.settings.inlinecomment,"").replace(f.settings.rangestart,function(t,e,n,i){var r="j"+a++;return"<% ~function() {for(var "+r+"="+n+";"+r+"<"+i+";"+r+"++) {{var "+e+"="+r+"; %>"}).replace(f.settings.include,function(t,e,n){return"<%= _method.__juicer("+e+", "+n+"); %>"}),n&&!1===n.errorhandling||(t="<% try { %>"+t,t+='<% } catch(e) {_method.__throw("Juicer Render Exception: "+e.message);} %>'),t},this.__toNative=function(t,e){return this.__convert(t,!e||e.strip)},this.__lexicalAnalyze=function(t){var n=[],i=[],e="",r=["if","each","_","_method","console","break","case","catch","continue","debugger","default","delete","do","finally","for","function","in","instanceof","new","return","switch","this","throw","try","typeof","var","void","while","with","null","typeof","class","enum","export","extends","import","super","implements","interface","let","package","private","protected","public","static","yield","const","arguments","true","false","undefined","NaN"],a=function(t,e){if(Array.prototype.indexOf&&t.indexOf===Array.prototype.indexOf)return t.indexOf(e);for(var n=0;n<t.length;n++)if(t[n]===e)return n;return-1},o=function(t,e){if(e=e.match(/\w+/gim)[0],-1===a(n,e)&&-1===a(r,e)&&-1===a(i,e)){if("undefined"!=typeof window&&"function"==typeof window[e]&&window[e].toString().match(/^\s*?function \w+\(\) \{\s*?\[native code\]\s*?\}\s*?$/i))return t;if("undefined"!=typeof global&&"function"==typeof global[e]&&global[e].toString().match(/^\s*?function \w+\(\) \{\s*?\[native code\]\s*?\}\s*?$/i))return t;if("function"==typeof f.options._method[e]||f.options._method.hasOwnProperty(e))return i.push(e),t;n.push(e)}return t};t.replace(f.settings.forstart,o).replace(f.settings.interpolate,o).replace(f.settings.ifstart,o).replace(f.settings.elseifstart,o).replace(f.settings.include,o).replace(/[\+\-\*\/%!\?\|\^&~<>=,\(\)\[\]]\s*([A-Za-z_]+)/gim,o);for(var s=0;s<n.length;s++)e+="var "+n[s]+"=_."+n[s]+";";for(s=0;s<i.length;s++)e+="var "+i[s]+"=_method."+i[s]+";";return"<% "+e+" %>"},this.__convert=function(t,e){var n=[].join("");return n+="'use strict';",n+="var _=_||{};",(n+="var _out='';_out+='")+(!1!==e?t.replace(/\\/g,"\\\\").replace(/[\r\t\n]/g," ").replace(/'(?=[^%]*%>)/g,"\t").split("'").join("\\'").split("\t").join("'").replace(/<%=(.+?)%>/g,"';_out+=$1;_out+='").split("<%").join("';").split("%>").join("_out+='")+"';return _out;":t.replace(/\\/g,"\\\\").replace(/[\r]/g,"\\r").replace(/[\t]/g,"\\t").replace(/[\n]/g,"\\n").replace(/'(?=[^%]*%>)/g,"\t").split("'").join("\\'").split("\t").join("'").replace(/<%=(.+?)%>/g,"';_out+=$1;_out+='").split("<%").join("';").split("%>").join("_out+='")+"';return _out.replace(/[\\r\\n]\\s+[\\r\\n]/g, '\\r\\n');")},this.parse=function(t,e){var n=this;return e&&!1===e.loose||(t=this.__lexicalAnalyze(t)+t),t=this.__removeShell(t,e),t=this.__toNative(t,e),this._render=new Function("_, _method",t),this.render=function(t,e){return e&&e===i.options._method||(e=r(e,i.options._method)),n._render.call(this,t,e)},this}},f.compile=function(t,e){e&&e===this.options||(e=r(e,this.options));try{var n=this.__cache[t]?this.__cache[t]:new this.template(this.options).parse(t,e);return e&&!1===e.cache||(this.__cache[t]=n),n}catch(t){return i("Juicer Compile Exception: "+t.message),{render:function(){}}}},f.to_html=function(t,e,n){return n&&n===this.options||(n=r(n,this.options)),this.compile(t,n).render(e,n._method)},"undefined"!=typeof module&&module.exports?module.exports=f:this.juicer=f}(),juicer}),define("portal/classify",["utils","zepto","juicer"],function(i){var n={el:"#page-classify",tmpl:$("#classify-tmpl").html(),getApps:function(){return i.ajax({action:"getAppsByUser"})},render:function(t){var e=$(this.el),n=juicer(this.tmpl,t);e.find(".classifies").html(n),this.bindEvent()},bindEvent:function(){var n=$(this.el);require(["sortable"],function(t){var e=n.find(".apps");e.on("click",".app",function(){var t=$(this).data("href");window.open(t,"_self")}),e.each(function(){t.create(this,{delay:300,handle:".app",animation:150,forceFallback:!0,supportPointer:!1,scroll:!1,chosenClass:"app-chosen",ghostClass:"app-ghost",dragClass:"app-drag",onEnd:function(t){var e=$(t.target),n=[];t.newIndex!==t.oldIndex&&(e.find(".app").each(function(t,e){n.push($(e).data("appid"))}),i.ajax({action:"sort",data:{appids:n.join(",")},type:"post"}))}})})})}};return{init:function(){var t="",e=window.location.href.split("#")[0];-1<e.indexOf("?")&&(t="&"+e.split("?")[1]),n.tmpl=n.tmpl.replace("&platform_parameters",t),n.getApps().then(n.render.bind(n))}}}),define("portal/list",["utils","zepto","juicer"],function(s){var r=require("constants"),a={el:"#page-list",apps:[],data:null,status:"all",count:{all:0,unuse:0,inuse:0},vieweds:null,getApps:function(){var i=this;return s.ajax({action:"getApps"},function(t){var e=[],n=a.count;(i.data=t).datas.forEach(function(t){e.push.apply(e,t.apps)}),n.unuse=0,n.inuse=0,e.forEach(function(t){if(!t.inuse)return n.unuse++;n.inuse++}),n.all=e.length,i.apps=e})},getViewedAppids:function(){var e=this;return this.vieweds?$.Deferred().resolve(this.vieweds):s.ajax({action:"viewedAppids",force:!1},function(t){e.vieweds=t.datas})},reset:function(){var t=$(this.el);return this.vieweds=null,this.status="all",s.toggleTab(t.find("[data-tab='all']")),this},render:function(t){var e=$("#list-tmpl").html();e=juicer(e,t),$(this.el).find(".tab-panel").html(e),this.renderCount(),this.getViewedAppids().then(this.renderViews.bind(this))},renderCount:function(){var i=$(this.el),r=this.count;Object.keys(r).forEach(function(t,e){var n=r[t]?"("+r[t]+")":"";i.find(".count").eq(e).html(n)})},renderClassifyCount:function(){var t=$(this.el).find(".app-list"),e=this.status,n=".app-item";switch(e){case"inuse":n+="[data-inuse='1']";break;case"unuse":n+="[data-inuse='0']"}t.each(function(){var t=$(this).find(n).length,e=1<t?"("+t+")":"";$(this).find(".app-count").html(e)})},renderViews:function(){var i=$(this.el),r=this.vieweds,t=this.apps,a=!1;i.find(".app-item").data("version",!0),i.find(".tab").data("version",!1),t.forEach(function(t){var e=t.id,n=1==$('.app-item[data-id="'+e+'"]').data("inuse")?"inuse":"unuse";if(~r.indexOf(parseInt(e)))return $('.app-item[data-id="'+e+'"]').data("version",!1);a=!0,i.find("[data-tab='"+n+"']").data("version",!0)}),i.find(".tab:first-child").data("version",a)},bindEvent:function(){var i=this;$(this.el).on("click.tab",".tab",function(){var t=$(this).data("tab");t!==i.status&&(i.status=t,i.filter(t))}).on("click.expand",".expand",function(){var t=$(this).closest(".app-list"),e="true"==t.attr("data-expand"),n=e?r.VIEW_ALL:r.SHRIK;$(this).html(n),t.attr("data-expand",!e),i.filter(i.status)}).on("click.navigate",".app-item",function(t){var e=$(t.target),n=$(this).data("id");e.hasClass("switch")||~i.vieweds.indexOf(n)||s.ajax({action:"logView",data:{appid:$(this).data("id")}},function(){i.vieweds.push(n),i.renderViews()})})},filter:function(t){var i,e=$(this.el),n=0;e.find(".app-list").show(),e.find(".app-item").show(),"unuse"===t&&(n=1),i='.app-item[data-inuse="'+n+'"]',needShow='.app-item[data-inuse="'+Math.abs(n-1)+'"]',"all"===t&&(i=".none",needShow=".app-item"),e.find(i).hide(),e.find(".app-list").each(function(){var t=$(this),e=t.find(i).length==$(this).find(".app-item").length;t.toggle(!e);var n=t.find(needShow);t.data("expand")||(n.hide(),n.eq(0).show(),n.eq(1).show()),t.find(".expand").toggle(2<n.length)}),this.renderClassifyCount()},toggleSwitch:function(t,n,e){var i=this,r=$(t).closest(".app-item"),a=1==n?"unuse":"use",o=function(){var t="inuse",e="unuse";1==n&&(t=e,e="inuse"),r.data("inuse",Math.abs(n-1)),i.count[t]++,i.count[e]--,i.renderCount(),i.renderViews()};return e?$.Deferred().resolve((o(),void i.filter(i.status))):s.ajax({action:a,data:{appid:r.data("id")}},o)}};return a.bindEvent(),a.getViewedAppids(),{init:function(){a.reset().getApps().then(a.render.bind(a))},toggleSwitch:function(t,e){var n=$(a.el),i=$(t);return t.nodeName||(i=n.find(".app-item[data-id='"+t+"']").find(".switch")).toggleClass("switch-checked"),a.toggleSwitch(i,e,!t.nodeName)}}}),define("portal/detail",["utils","zepto","juicer"],function(a){var o=require("constants"),s={versionLog:'{@each datas as d}<div class= "ver-log" > <header> <span class="ver-title">${d.serial}</span> <span class="update-time">${d.createdate}</span> </header> <div class="log-content"> $${d.descriptions} </div></div >{@/each}',comment:'{@each datas as d}<div class="comment-wrapper"> <div> <div class="comment-header"> <h4>${d.title}</h4> <div class="comment-rate"> {@each i in range(1, 6)} <div class=\'star ${i<=d.score ? "active" : ""}\'></div> {@/each} </div> <div class="comment-sub"> <span class="date">${d.createdate}</span> <span class="username">${d.username}</span> </div> </div> <div class="comment-content"><div>$${decodeURIComponent(d.content)}</div><div class="more-btn"><a href="javascript:;">'+o.MORE+"</a></div></div> </div></div>{@/each}",baseInfo:'<img src="${icon}" /><div> <h4 class="ellipsis">${name}</h4> <p class= "desc ellipsis" >${desc ? desc : "'+o.NO_DESC+'"}</p> <span class=\'switch ${inuse == 1 ? " switch-checked" : ""}\'> <span class="switch-inner"></span> </span></div>',thumInfo:'{@each previmgs as i} <img src="${i}"/>{@/each}',scoreInfo:'<div class="score">${rate > 0 ? rate : ""} <div class= "stars" > {@each stars as s} <div class=\'star ${ s > 0.5 ? "active" : (s > 0 ? "half" : "")}\'></div> {@/each} </div></div ><span class="desc">${count ? count + "'+o.USER_SCORING+'" : "'+o.NO_USER_SCORING+'"}</span>'},c={el:"#page-detail",animationName:"slide_noop",formdata:null,getAppid:function(){return this.formdata.appid},reset:function(t){this.formdata=t||null,this.baseInfo.data=null,this.comment.currPageNo=1,this.comment.totalSize=0,this.comment.initialize=!1},render:function(t){var e=$(this.el);this.reset(t),e.find(".review").attr("data-formdata","appid="+c.getAppid()),a.toggleTab(e.find('[data-tab="log"]')),e.find(".ver-logs").html(""),e.find(".comments").html(""),this.comment.toggleMore(!1),e.find(".swtich").removeClass(".switch-selected"),e.find(".review").hide()},baseInfo:{data:null,get:function(){return this.data?$.Deferred().resolve(this.data):a.ajax({action:"detail",data:{appid:c.getAppid()}})},render:function(t){var e=t.data,n=$(c.el),i=juicer(s.baseInfo,e),r=juicer(s.thumInfo,e);n.find(".base-info").html(i),n.find(".thumbnail-info").html(r),this.renderVersionInfo(e)},renderVersionInfo:function(t){var e=$(c.el);t.versionCount=t.versionCount||0,t.versionSerial=t.versionSerial||"-/-",e.find(".version").find("p").html(t.versionSerial);var n=t.versionCount?"("+t.versionCount+")":"";e.find("[data-tab='log']").find(".count").html(n)}},versionLog:{el:".ver-logs",init:function(){var e=this;$(this.el),c.toggleLoadding(!0),this.get().then(function(t){e.render(t),c.toggleLoadding(!1)})},get:function(){return a.ajax({action:"listVersions",data:{appid:c.getAppid()}})},render:function(t){var e='<p class="no-logs">'+o.NO_LOG+"</p>";t.datas&&t.datas.length&&(e=juicer(s.versionLog,t)),$(c.el).find(".ver-logs").html(e)}},comment:{currPageNo:1,pageSize:10,totalSize:0,initialize:!1,init:function(){return this.get().then(this.render.bind(this))},initScore:function(){var e=this;this.getScore().then(function(t){e.renderScore(t),e.renderCommentCount()})},get:function(){var t=this;return a.ajax({action:"listComments",data:{appid:c.getAppid(),pageNo:this.currPageNo,pageSize:this.pageSize}},function(){t.initialize=!0})},getScore:function(){return a.ajax({action:"commentMeta",data:{appid:c.getAppid()}})},render:function(t){var e=$(c.el),n='<p class="no-comments">'+o.NO_COMMENT+"</p>",i=t.data.totalSize,r=this.currPageNo*this.pageSize<i;(this.totalSize=i)&&(n=juicer(s.comment,t.data),this.renderCommentCount()),e.find(".comments")[1===this.currPageNo?"html":"append"](n),this.renderMore(e.find(".comment-content")),this.toggleMore(r)},renderMore:function(t){t.each(function(){var t=$(this);if(!(t.children("div").height()<t.height())){var e=t.parents(".comment-wrapper");e.addClass("more"),t.children(".more-btn").on("click","a",function(){e.removeClass("more").addClass("all")})}})},renderScore:function(t){var e,n=$(c.el),i=t.data,r=i.avgScore;i.avgScore=r,i.rate=r&&1===String(r).length?r+".0":String(r),i.stars=[0,0,0,0,0];for(var a=1;a<=Math.ceil(r);a++)a==Math.ceil(r)&&1!=r?i.stars[a-1]=parseFloat(r-a+1).toFixed(1):i.stars[a-1]=1;e=juicer(s.scoreInfo,t.data),n.find(".rate").html(e),this.totalSize=i.count},renderCommentCount:function(){var t=$(c.el),e=this.totalSize?"("+this.totalSize+")":"";t.find(".comment").find("p").html(this.totalSize),t.find("[data-tab='comment']").find(".count").html(e)},toggleMore:function(t){$(c.el).find(".more-comments").toggle(t)}},bindEvent:function(){var n=this,e=$(this.el);e.on("click",".more-comments",function(){var e=n.comment;e.currPageNo++,n.toggleLoadding(!0),e.toggleMore(!1),e.get().then(function(t){n.toggleLoadding(!1),e.render(t)})}).on("click.init",".tab",function(){var t="comment"==$(this).data("tab");t&&!n.comment.initialize&&(n.toggleLoadding(!0),n.comment.init().then(function(){n.toggleLoadding(!1)})),e.find(".review").toggle(t)}).on("click.comment",".review",function(){e.attr("data-form",n.animationName)})},toggleLoadding:function(t){$(this.el).find(".portal-loading").toggle(t)},toggleSwitch:function(t){return a.ajax({action:1==t?"unuse":"use",data:{appid:c.getAppid()}})},clearPageAnimation:function(){var t=this;setTimeout(function(){$(t.el).removeAttr("data-form").removeClass(t.animationName)},250)}};return c.bindEvent(),{init:function(t,e){if(e)return c.clearPageAnimation();var n=c.baseInfo,i=c.versionLog,r=c.comment;t=a.strToJson(t,"&","="),c.render(t),n.get().then(n.render.bind(n)),i.init(),r.initScore()},getAppid:function(){return c.getAppid()},renderComment:function(){var t=c.comment;t.currPageNo=1,t.initScore(),t.init()},toggleSwitch:c.toggleSwitch}}),define("portal/comment",["utils","zepto","juicer"],function(a){var e={el:"#page-comment",formdata:{},isSend:!1,sending:!1,reset:function(){var t=$(this.el);this.isSend=!1,this.sending=!1,this.formdata={},t.find(".star").addClass("active"),t.find("input").val(""),t.find("textarea").val(""),t.find(".send").removeClass("active")},bindEvent:function(){var n=$(this.el),i=this,r=function(){history.go(-1)};n.on("click.cancel",".cancel",r).on("click.send",".send",function(){var t=$(this),e=i.formdata;t.hasClass("active")&&!i.sending&&(e.content=i.utf16toEntities(n.find("textarea").val()),i.sending=!0,a.ajax({action:"saveComment",data:e,type:"post"},function(){i.isSend=!0,r()}))}).on("click.star",".star",function(){var t=$(this),e=t.index();i.formdata.score=e+1,t.addClass("active"),t.prevAll().addClass("active"),t.nextAll().removeClass("active"),i.toggleSendBtn()}),n.find("input").on("input",function(){var t=$(this).val();i.formdata.title=t,i.toggleSendBtn()})},utf16toEntities:function(t){return t.replace(/[\ud800-\udbff][\udc00-\udfff]/g,function(t){return 2===t.length?"&#"+(1024*(t.charCodeAt(0)-55296)+65536+t.charCodeAt(1)-56320)+";":t})},toggleSendBtn:function(){var t=this.formdata,e=t.title&&t.score;$(this.el).find(".send").toggleClass("active",!!e)}};return{init:function(){e.bindEvent()},reset:function(t){e.reset(),e.formdata=a.strToJson(t,"&","="),e.formdata.score=5},isSend:function(){return e.isSend}}}),define("portal",["fastclick","mobilebone","utils","portal/classify","portal/list","portal/detail","portal/comment"],function(t,e,r){var a=require("portal/classify"),o=require("portal/list"),s=require("portal/detail"),c=require("portal/comment"),l="",n={initClassify:a.init,initList:function(t,e,n,i){i||o.init()},initDetail:function(t,e,n,i){if(i&&c.isSend())return s.renderComment();s.init(n.formdata,i)},initComment:c.init,resetComment:function(t,e,n){c.reset(n.formdata)}};t.attach(document.body),e.rootTransition=n,e.callback=function(t,e,n,i){l=t.id,r.showBackBtn(i)},e.init(),$("body").on("click.tab",".tab",r.toggleTab),$("body").on("click",".switch",function(){var t,e=$(this),n=$(this).hasClass("switch-checked")?1:0,i=[];return e.toggleClass("switch-checked"),"page-detail"==l&&(i.push(s.toggleSwitch(n)),t=s.getAppid()),i.push(o.toggleSwitch(t||this,n)),$.when.apply(null,i).then(function(){a.init()}),!1})});