Light12306/Mobile12306New/js/js.min.js

177 lines
84 KiB
JavaScript
Raw Normal View History

2014-08-19 16:11:37 +08:00
function FastClick(a){var b,c=this;this.trackingClick=!1;this.trackingClickStart=0;this.targetElement=null;this.lastTouchIdentifier=this.touchStartY=this.touchStartX=0;this.touchBoundary=10;this.layer=a;if(!a||!a.nodeType)throw new TypeError("Layer must be a document node");this.onClick=function(){return FastClick.prototype.onClick.apply(c,arguments)};this.onMouse=function(){return FastClick.prototype.onMouse.apply(c,arguments)};this.onTouchStart=function(){return FastClick.prototype.onTouchStart.apply(c,
arguments)};this.onTouchEnd=function(){return FastClick.prototype.onTouchEnd.apply(c,arguments)};this.onTouchCancel=function(){return FastClick.prototype.onTouchCancel.apply(c,arguments)};FastClick.notNeeded(a)||(this.deviceIsAndroid&&(a.addEventListener("mouseover",this.onMouse,!0),a.addEventListener("mousedown",this.onMouse,!0),a.addEventListener("mouseup",this.onMouse,!0)),a.addEventListener("click",this.onClick,!0),a.addEventListener("touchstart",this.onTouchStart,!1),a.addEventListener("touchend",
2014-08-21 13:42:42 +08:00
this.onTouchEnd,!1),a.addEventListener("touchcancel",this.onTouchCancel,!1),Event.prototype.stopImmediatePropagation||(a.removeEventListener=function(b,c,f){var g=Node.prototype.removeEventListener;"click"===b?g.call(a,b,c.hijacked||c,f):g.call(a,b,c,f)},a.addEventListener=function(b,c,f){var g=Node.prototype.addEventListener;"click"===b?g.call(a,b,c.hijacked||(c.hijacked=function(a){a.propagationStopped||c(a)}),f):g.call(a,b,c,f)}),"function"===typeof a.onclick&&(b=a.onclick,a.addEventListener("click",
2014-08-19 16:11:37 +08:00
function(a){b(a)},!1),a.onclick=null))}FastClick.prototype.deviceIsAndroid=0<navigator.userAgent.indexOf("Android");FastClick.prototype.deviceIsIOS=/iP(ad|hone|od)/.test(navigator.userAgent);FastClick.prototype.deviceIsIOS4=FastClick.prototype.deviceIsIOS&&/OS 4_\d(_\d)?/.test(navigator.userAgent);FastClick.prototype.deviceIsIOSWithBadTarget=FastClick.prototype.deviceIsIOS&&/OS ([6-9]|\d{2})_\d/.test(navigator.userAgent);
FastClick.prototype.needsClick=function(a){switch(a.nodeName.toLowerCase()){case "button":case "select":case "textarea":if(a.disabled)return!0;break;case "input":if(this.deviceIsIOS&&"file"===a.type||a.disabled)return!0;break;case "label":case "video":return!0}return/\bneedsclick\b/.test(a.className)};
FastClick.prototype.needsFocus=function(a){switch(a.nodeName.toLowerCase()){case "textarea":case "select":return!0;case "input":switch(a.type){case "button":case "checkbox":case "file":case "image":case "radio":case "submit":return!1}return!a.disabled&&!a.readOnly;default:return/\bneedsfocus\b/.test(a.className)}};
2014-08-21 13:42:42 +08:00
FastClick.prototype.sendClick=function(a,b){var c,d;document.activeElement&&document.activeElement!==a&&document.activeElement.blur();d=b.changedTouches[0];c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!0,window,1,d.screenX,d.screenY,d.clientX,d.clientY,!1,!1,!1,!1,0,null);c.forwardedTouchEvent=!0;a.dispatchEvent(c)};FastClick.prototype.focus=function(a){var b;this.deviceIsIOS&&a.setSelectionRange?(b=a.value.length,a.setSelectionRange(b,b)):a.focus()};
2014-08-19 16:11:37 +08:00
FastClick.prototype.updateScrollParent=function(a){var b,c;b=a.fastClickScrollParent;if(!b||!b.contains(a)){c=a;do{if(c.scrollHeight>c.offsetHeight){b=c;a.fastClickScrollParent=c;break}c=c.parentElement}while(c)}b&&(b.fastClickLastScrollTop=b.scrollTop)};FastClick.prototype.getTargetElementFromEventTarget=function(a){return a.nodeType===Node.TEXT_NODE?a.parentNode:a};
2014-08-21 13:42:42 +08:00
FastClick.prototype.onTouchStart=function(a){var b,c,d;if(1<a.targetTouches.length)return!0;b=this.getTargetElementFromEventTarget(a.target);c=a.targetTouches[0];if(this.deviceIsIOS){d=window.getSelection();if(d.rangeCount&&!d.isCollapsed)return!0;if(!this.deviceIsIOS4){if(c.identifier===this.lastTouchIdentifier)return a.preventDefault(),!1;this.lastTouchIdentifier=c.identifier;this.updateScrollParent(b)}}this.trackingClick=!0;this.trackingClickStart=a.timeStamp;this.targetElement=b;this.touchStartX=
2014-08-19 16:11:37 +08:00
c.pageX;this.touchStartY=c.pageY;200>a.timeStamp-this.lastClickTime&&a.preventDefault();return!0};FastClick.prototype.touchHasMoved=function(a){a=a.changedTouches[0];var b=this.touchBoundary;return Math.abs(a.pageX-this.touchStartX)>b||Math.abs(a.pageY-this.touchStartY)>b?!0:!1};FastClick.prototype.findControl=function(a){return void 0!==a.control?a.control:a.htmlFor?document.getElementById(a.htmlFor):a.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")};
2014-08-21 13:42:42 +08:00
FastClick.prototype.onTouchEnd=function(a){var b,c,d;d=this.targetElement;if(this.touchHasMoved(a)||300<a.timeStamp-this.trackingClickStart)this.trackingClick=!1,this.targetElement=null;if(!this.trackingClick)return!0;if(200>a.timeStamp-this.lastClickTime)return this.cancelNextClick=!0;this.lastClickTime=a.timeStamp;b=this.trackingClickStart;this.trackingClick=!1;this.trackingClickStart=0;this.deviceIsIOSWithBadTarget&&(d=a.changedTouches[0],d=document.elementFromPoint(d.pageX-window.pageXOffset,
d.pageY-window.pageYOffset));c=d.tagName.toLowerCase();if("label"===c){if(b=this.findControl(d)){this.focus(d);if(this.deviceIsAndroid)return!1;d=b}}else if(this.needsFocus(d)){if(100<a.timeStamp-b||this.deviceIsIOS&&window.top!==window&&"input"===c)return this.targetElement=null,!1;this.focus(d);if(!this.deviceIsIOS4||"select"!==c)this.targetElement=null,a.preventDefault();return!1}if(this.deviceIsIOS&&!this.deviceIsIOS4&&(b=d.fastClickScrollParent)&&b.fastClickLastScrollTop!==b.scrollTop)return!0;
this.needsClick(d)||(a.preventDefault(),this.sendClick(d,a));return!1};FastClick.prototype.onTouchCancel=function(){this.trackingClick=!1;this.targetElement=null};FastClick.prototype.onMouse=function(a){return!this.targetElement||a.forwardedTouchEvent||!a.cancelable?!0:!this.needsClick(this.targetElement)||this.cancelNextClick?(a.stopImmediatePropagation?a.stopImmediatePropagation():a.propagationStopped=!0,a.stopPropagation(),a.preventDefault(),!1):!0};
2014-08-19 16:11:37 +08:00
FastClick.prototype.onClick=function(a){if(this.trackingClick)return this.targetElement=null,this.trackingClick=!1,!0;if("submit"===a.target.type&&0===a.detail)return!0;a=this.onMouse(a);a||(this.targetElement=null);return a};
FastClick.prototype.destroy=function(){var a=this.layer;this.deviceIsAndroid&&(a.removeEventListener("mouseover",this.onMouse,!0),a.removeEventListener("mousedown",this.onMouse,!0),a.removeEventListener("mouseup",this.onMouse,!0));a.removeEventListener("click",this.onClick,!0);a.removeEventListener("touchstart",this.onTouchStart,!1);a.removeEventListener("touchend",this.onTouchEnd,!1);a.removeEventListener("touchcancel",this.onTouchCancel,!1)};
FastClick.notNeeded=function(a){if("undefined"===typeof window.ontouchstart)return!0;if(/Chrome\/[0-9]+/.test(navigator.userAgent))if(FastClick.prototype.deviceIsAndroid){if((a=document.querySelector("meta[name=viewport]"))&&-1!==a.content.indexOf("user-scalable=no"))return!0}else return!0;return!1};FastClick.cache=[];FastClick.attach=function(a){if(-1!=FastClick.cache.indexOf(a))return!1;FastClick.cache.push(a);return new FastClick(a)};
2014-08-21 13:42:42 +08:00
"undefined"!==typeof define&&define.amd?define(function(){return FastClick}):"undefined"!==typeof module&&module.exports?(module.exports=FastClick.attach,module.exports.FastClick=FastClick):window.FastClick=FastClick;FastClick.attach(document);var Zepto=function(){function a(a){return null==a?String(a):L[R.call(a)]||"object"}function b(b){return"function"==a(b)}function c(a){return null!=a&&a==a.window}function d(a){return null!=a&&a.nodeType==a.DOCUMENT_NODE}function e(b){return"object"==a(b)}function f(a){return e(a)&&!c(a)&&Object.getPrototypeOf(a)==Object.prototype}function g(a){return"number"==typeof a.length}function m(a){return v.call(a,function(a){return null!=a})}function l(a){return a.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 k(a){return a in F?F[a]:F[a]=RegExp("(^|\\s)"+a+"(\\s|$)")}function z(a){return"children"in a?u.call(a.children):h.map(a.childNodes,function(a){if(1==a.nodeType)return a})}function p(a,b,c){for(r in b)c&&(f(b[r])||H(b[r]))?(f(b[r])&&!f(a[r])&&(a[r]={}),H(b[r])&&!H(a[r])&&(a[r]=[]),p(a[r],b[r],c)):b[r]!==x&&(a[r]=b[r])}function w(a,b){return null==b?h(a):h(a).filter(b)}function n(a,c,d,q){return b(c)?c.call(a,d,
q):c}function A(a,b){var c=a.className||"",d=c&&c.baseVal!==x;if(b===x)return d?c.baseVal:c;d?c.baseVal=b:a.className=b}function s(a){var b;try{return a?"true"==a||("false"==a?!1:"null"==a?null:!/^0/.test(a)&&!isNaN(b=Number(a))?b:/^[\[\{]/.test(a)?h.parseJSON(a):a):a}catch(c){return a}}function y(a,b){b(a);for(var c=0,d=a.childNodes.length;c<d;c++)y(a.childNodes[c],b)}var x,r,h,D,B=[],u=B.slice,v=B.filter,q=window.document,E={},F={},G={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,
"z-index":1,zoom:1},I=/^\s*<(\w+|!)[^>]*>/,S=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,T=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,N=/^(?:body|html)$/i,U=/([A-Z])/g,V="val css html text data width height offset".split(" "),M=q.createElement("table"),O=q.createElement("tr"),P={tr:q.createElement("tbody"),tbody:M,thead:M,tfoot:M,td:O,th:O,"*":q.createElement("div")},W=/complete|loaded|interactive/,X=/^[\w-]*$/,L={},R=L.toString,C={},J,K,Q=q.createElement("div"),Y={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(a){return a instanceof Array};C.matches=function(a,b){if(!b||!a||1!==a.nodeType)return!1;var c=a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.matchesSelector;if(c)return c.call(a,b);var d;d=a.parentNode;(c=!d)&&
(d=Q).appendChild(a);d=~C.qsa(d,b).indexOf(a);c&&Q.removeChild(a);return d};J=function(a){return a.replace(/-+(.)?/g,function(a,b){return b?b.toUpperCase():""})};K=function(a){return v.call(a,function(b,c){return a.indexOf(b)==c})};C.fragment=function(a,b,c){var d,e,E;S.test(a)&&(d=h(q.createElement(RegExp.$1)));d||(a.replace&&(a=a.replace(T,"<$1></$2>")),b===x&&(b=I.test(a)&&RegExp.$1),b in P||(b="*"),E=P[b],E.innerHTML=""+a,d=h.each(u.call(E.childNodes),function(){E.removeChild(this)}));f(c)&&(e=
h(d),h.each(c,function(a,b){if(-1<V.indexOf(a))e[a](b);else e.attr(a,b)}));return d};C.Z=function(a,b){a=a||[];a.__proto__=h.fn;a.selector=b||"";return a};C.isZ=function(a){return a instanceof C.Z};C.init=function(a,c){var d;if(a)if("string"==typeof a)if(a=a.trim(),"<"==a[0]&&I.test(a))d=C.fragment(a,RegExp.$1,c),a=null;else{if(c!==x)return h(c).find(a);d=C.qsa(q,a)}else{if(b(a))return h(q).ready(a);if(C.isZ(a))return a;if(H(a))d=m(a);else if(e(a))d=[a],a=null;else if(I.test(a))d=C.fragment(a.trim(),
RegExp.$1,c),a=null;else{if(c!==x)return h(c).find(a);d=C.qsa(q,a)}}else return C.Z();return C.Z(d,a)};h=function(a,b){return C.init(a,b)};h.extend=function(a){var b,c=u.call(arguments,1);"boolean"==typeof a&&(b=a,a=c.shift());c.forEach(function(c){p(a,c,b)});return a};C.qsa=function(a,b){var c,q="#"==b[0],e=!q&&"."==b[0],f=q||e?b.slice(1):b,E=X.test(f);return d(a)&&E&&q?(c=a.getElementById(f))?[c]:[]:1!==a.nodeType&&9!==a.nodeType?[]:u.call(E&&!q?e?a.getElementsByClassName(f):a.getElementsByTagName(b):
a.querySelectorAll(b))};h.contains=q.documentElement.contains?function(a,b){return a!==b&&a.contains(b)}:function(a,b){for(;b&&(b=b.parentNode);)if(b===a)return!0;return!1};h.type=a;h.isFunction=b;h.isWindow=c;h.isArray=H;h.isPlainObject=f;h.isEmptyObject=function(a){for(var b in a)return!1;return!0};h.inArray=function(a,b,c){return B.indexOf.call(b,a,c)};h.camelCase=J;h.trim=function(a){return null==a?"":String.prototype.trim.call(a)};h.uuid=0;h.support={};h.expr={};h.map=function(a,b){var c,d=[],
q;if(g(a))for(q=0;q<a.length;q++)c=b(a[q],q),null!=c&&d.push(c);else for(q in a)c=b(a[q],q),null!=c&&d.push(c);return 0<d.length?h.fn.concat.apply([],d):d};h.each=function(a,b){var c;if(g(a))for(c=0;c<a.length&&!1!==b.call(a[c],c,a[c]);c++);else for(c in a)if(!1===b.call(a[c],c,a[c]))break;return a};h.grep=function(a,b){return v.call(a,b)};window.JSON&&(h.parseJSON=JSON.parse);h.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){L["[object "+b+"]"]=b.toLowerCase()});
h.fn={forEach:B.forEach,reduce:B.reduce,push:B.push,sort:B.sort,indexOf:B.indexOf,concat:B.concat,map:function(a){return h(h.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return h(u.apply(this,arguments))},ready:function(a){W.test(q.readyState)&&q.body?a(h):q.addEventListener("DOMContentLoaded",function(){a(h)},!1);return this},get:function(a){return a===x?u.call(this):this[0<=a?a:a+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(a){B.every.call(this,function(b,c){return!1!==a.call(b,c,b)});return this},filter:function(a){return b(a)?this.not(this.not(a)):h(v.call(this,function(b){return C.matches(b,a)}))},add:function(a,b){return h(K(this.concat(h(a,b))))},is:function(a){return 0<this.length&&C.matches(this[0],a)},not:function(a){var c=[];if(b(a)&&a.call!==x)this.each(function(b){a.call(this,b)||c.push(this)});else{var d="string"==typeof a?this.filter(a):
g(a)&&b(a.item)?u.call(a):h(a);this.forEach(function(a){0>d.indexOf(a)&&c.push(a)})}return h(c)},has:function(a){return this.filter(function(){return e(a)?h.contains(this,a):h(this).find(a).size()})},eq:function(a){return-1===a?this.slice(a):this.slice(a,+a+1)},first:function(){var a=this[0];return a&&!e(a)?a:h(a)},last:function(){var a=this[this.length-1];return a&&!e(a)?a:h(a)},find:function(a){var b=this;return a?"object"==typeof a?h(a).filter(function(){var a=this;return B.some.call(b,function(b){return h.contains(b,
a)})}):1==this.length?h(C.qsa(this[0],a)):this.map(function(){return C.qsa(this,a)}):[]},closest:function(a,b){var c=this[0],q=!1;for("object"==typeof a&&(q=h(a));c&&!(q?0<=q.indexOf(c):C.matches(c,a));)c=c!==b&&!d(c)&&c.parentNode;return h(c)},parents:function(a){for(var b=[],c=this;0<c.length;)c=h.map(c,function(a){if((a=a.parentNode)&&!d(a)&&0>b.indexOf(a))return b.push(a),a});return w(b,a)},parent:function(a){return w(K(this.pluck("parentNode")),a)},children:function(a){return w(this.map(function(){return z(this)}),
a)},contents:function(){return this.map(function(){return u.call(this.childNodes)})},siblings:function(a){return w(this.map(function(a,b){return v.call(z(b.parentNode),function(a){return a!==b})}),a)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(a){return h.map(this,function(b){return b[a]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display="");if("none"==getComputedStyle(this,"").getPropertyValue("display")){var a=this.style,
b=this.nodeName,c,d;E[b]||(c=q.createElement(b),q.body.appendChild(c),d=getComputedStyle(c,"").getPropertyValue("display"),c.parentNode.removeChild(c),"none"==d&&(d="block"),E[b]=d);a.display=E[b]}})},replaceWith:function(a){return this.before(a).remove()},wrap:function(a){var c=b(a);if(this[0]&&!c)var d=h(a).get(0),q=d.parentNode||1<this.length;return this.each(function(b){h(this).wrapAll(c?a.call(this,b):q?d.cloneNode(!0):d)})},wrapAll:function(a){if(this[0]){h(this[0]).before(a=h(a));for(var b;(b=
a.children()).length;)a=b.first();h(a).append(this)}return this},wrapInner:function(a){var c=b(a);return this.each(function(b){var d=h(this),q=d.contents();b=c?a.call(this,b):a;q.length?q.wrapAll(b):d.append(b)})},unwrap:function(){this.parent().each(function(){h(this).replaceWith(h(this).children())});return this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(a){return this.each(function(){var b=h(this);
(a===x?"none"==b.css("display"):a)?b.show():b.hide()})},prev:function(a){return h(this.pluck("previousElementSibling")).filter(a||"*")},next:function(a){return h(this.pluck("nextElementSibling")).filter(a||"*")},html:function(a){return 0 in arguments?this.each(function(b){var c=this.innerHTML;h(this).empty().append(n(this,a,b,c))}):0 in this?this[0].innerHTML:null},text:function(a){return 0 in arguments?this.each(function(b){b=n(this,a,b,this.textContent);this.textContent=null==b?"":""+b}):0 in this?
this[0].textContent:null},attr:function(a,b){var c;return"string"==typeof a&&!(1 in arguments)?!this.length||1!==this[0].nodeType?x:!(c=this[0].getAttribute(a))&&a in this[0]?this[0][a]:c:this.each(function(c){if(1===this.nodeType)if(e(a))for(r in a){var d=r;c=a[r];null==c?this.removeAttribute(d):this.setAttribute(d,c)}else d=a,c=n(this,b,c,this.getAttribute(a)),null==c?this.removeAttribute(d):this.setAttribute(d,c)})},removeAttr:function(a){return this.each(function(){1===this.nodeType&&this.removeAttribute(a)})},
prop:function(a,b){a=Y[a]||a;return 1 in arguments?this.each(function(c){this[a]=n(this,b,c,this[a])}):this[0]&&this[0][a]},data:function(a,b){var c="data-"+a.replace(U,"-$1").toLowerCase(),c=1 in arguments?this.attr(c,b):this.attr(c);return null!==c?s(c):x},val:function(a){return 0 in arguments?this.each(function(b){this.value=n(this,a,b,this.value)}):this[0]&&(this[0].multiple?h(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(a){if(a)return this.each(function(b){var c=
h(this);b=n(this,a,b,c.offset());var d=c.offsetParent().offset();b={top:b.top-d.top,left:b.left-d.left};"static"==c.css("position")&&(b.position="relative");c.css(b)});if(!this.length)return null;var b=this[0].getBoundingClientRect();return{left:b.left+window.pageXOffset,top:b.top+window.pageYOffset,width:Math.round(b.width),height:Math.round(b.height)}},css:function(b,c){if(2>arguments.length){var d=this[0],q=getComputedStyle(d,"");if(!d)return;if("string"==typeof b)return d.style[J(b)]||q.getPropertyValue(b);
if(H(b)){var e={};h.each(b,function(a,b){e[b]=d.style[J(b)]||q.getPropertyValue(b)});return e}}var f="";if("string"==a(b))!c&&0!==c?this.each(function(){this.style.removeProperty(l(b))}):f=l(b)+":"+("number"==typeof c&&!G[l(b)]?c+"px":c);else for(r in b)!b[r]&&0!==b[r]?this.each(function(){this.style.removeProperty(l(r))}):f+=l(r)+":"+("number"==typeof b[r]&&!G[l(r)]?b[r]+"px":b[r])+";";return this.each(function(){this.style.cssText+=";"+f})},index:function(a){return a?this.indexOf(h(a)[0]):this.parent().children().indexOf(this[0])},
hasClass:function(a){return!a?!1:B.some.call(this,function(a){return this.test(A(a))},k(a))},addClass:function(a){return!a?this:this.each(function(b){if("className"in this){D=[];var c=A(this);n(this,a,b,c).split(/\s+/g).forEach(function(a){h(this).hasClass(a)||D.push(a)},this);D.length&&A(this,c+(c?" ":"")+D.join(" "))}})},removeClass:function(a){return this.each(function(b){if("className"in this){if(a===x)return A(this,"");D=A(this);n(this,a,b,D).split(/\s+/g).forEach(function(a){D=D.replace(k(a),
" ")});A(this,D.trim())}})},toggleClass:function(a,b){return!a?this:this.each(function(c){var d=h(this);n(this,a,c,A(this)).split(/\s+/g).forEach(function(a){(b===x?!d.hasClass(a):b)?d.addClass(a):d.removeClass(a)})})},scrollTop:function(a){if(this.length){var b="scrollTop"in this[0];return a===x?b?this[0].scrollTop:this[0].pageYOffset:this.each(b?function(){this.scrollTop=a}:function(){this.scrollTo(this.scrollX,a)})}},scrollLeft:function(a){if(this.length){var b="scrollLeft"in this[0];return a===
x?b?this[0].scrollLeft:this[0].pageXOffset:this.each(b?function(){this.scrollLeft=a}:function(){this.scrollTo(a,this.scrollY)})}},position:function(){if(this.length){var a=this[0],b=this.offsetParent(),c=this.offset(),d=N.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(h(a).css("margin-top"))||0;c.left-=parseFloat(h(a).css("margin-left"))||0;d.top+=parseFloat(h(b[0]).css("border-top-width"))||0;d.left+=parseFloat(h(b[0]).css("border-left-width"))||0;return{top:c.top-d.top,left:c.left-
d.left}}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||q.body;a&&!N.test(a.nodeName)&&"static"==h(a).css("position");)a=a.offsetParent;return a})}};h.fn.detach=h.fn.remove;["width","height"].forEach(function(a){var b=a.replace(/./,function(a){return a[0].toUpperCase()});h.fn[a]=function(q){var f,e=this[0];return q===x?c(e)?e["inner"+b]:d(e)?e.documentElement["scroll"+b]:(f=this.offset())&&f[a]:this.each(function(b){e=h(this);e.css(a,n(this,q,b,e[a]()))})}});["after",
"prepend","before","append"].forEach(function(b,c){var d=c%2;h.fn[b]=function(){var b,e=h.map(arguments,function(c){b=a(c);return"object"==b||"array"==b||null==c?c:C.fragment(c)}),f,E=1<this.length;return 1>e.length?this:this.each(function(a,b){f=d?b:b.parentNode;b=0==c?b.nextSibling:1==c?b.firstChild:2==c?b:null;var g=h.contains(q.documentElement,f);e.forEach(function(a){if(E)a=a.cloneNode(!0);else if(!f)return h(a).remove();f.insertBefore(a,b);g&&y(a,function(a){null!=a.nodeName&&("SCRIPT"===a.nodeName.toUpperCase()&&
(!a.type||"text/javascript"===a.type)&&!a.src)&&window.eval.call(window,a.innerHTML)})})})};h.fn[d?b+"To":"insert"+(c?"Before":"After")]=function(a){h(a)[b](this);return this}});C.Z.prototype=h.fn;C.uniq=K;C.deserializeValue=s;h.zepto=C;return h}();window.Zepto=Zepto;void 0===window.$&&(window.$=Zepto);
(function(a){function b(b,c,d,e){if(b.global)return b=c||A,d=a.Event(d),a(b).trigger(d,e),!d.isDefaultPrevented()}function c(c){c.global&&0===a.active++&&b(c,null,"ajaxStart")}function d(a,c){var d=c.context;if(!1===c.beforeSend.call(d,a,c)||!1===b(c,d,"ajaxBeforeSend",[a,c]))return!1;b(c,d,"ajaxSend",[a,c])}function e(a,c,d,e){var f=d.context;d.success.call(f,a,"success",c);e&&e.resolveWith(f,[a,"success",c]);b(d,f,"ajaxSuccess",[c,d,a]);g("success",c,d)}function f(a,c,d,e,f){var k=e.context;e.error.call(k,
d,c,a);f&&f.rejectWith(k,[d,c,a]);b(e,k,"ajaxError",[d,e,a||c]);g(c,d,e)}function g(c,d,e){var f=e.context;e.complete.call(f,d,c);b(e,f,"ajaxComplete",[d,e]);e.global&&!--a.active&&b(e,null,"ajaxStop")}function m(){}function l(a){a&&(a=a.split(";",2)[0]);return a&&(a==B?"html":a==D?"json":r.test(a)?"script":h.test(a)&&"xml")||"text"}function k(a,b){return""==b?a:(a+"&"+b).replace(/[&?]{1,2}/,"?")}function z(b){b.processData&&(b.data&&"string"!=a.type(b.data))&&(b.data=a.param(b.data,b.traditional));
if(b.data&&(!b.type||"GET"==b.type.toUpperCase()))b.url=k(b.url,b.data),b.data=void 0}function p(b,c,d,e){a.isFunction(c)&&(e=d,d=c,c=void 0);a.isFunction(d)||(e=d,d=void 0);return{url:b,data:c,success:d,dataType:e}}function w(b,c,d,e){var f,g=a.isArray(c),k=a.isPlainObject(c);a.each(c,function(c,u){f=a.type(u);e&&(c=d?e:e+"["+(k||"object"==f||"array"==f?c:"")+"]");!e&&g?b.add(u.name,u.value):"array"==f||!d&&"object"==f?w(b,u,d,c):b.add(c,u)})}var n=0,A=window.document,s,y,x=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
r=/^(?:text|application)\/javascript/i,h=/^(?:text|application)\/xml/i,D="application/json",B="text/html",u=/^\s*$/;a.active=0;a.ajaxJSONP=function(b,c){if(!("type"in b))return a.ajax(b);var g=b.jsonpCallback,k=(a.isFunction(g)?g():g)||"jsonp"+ ++n,u=A.createElement("script"),h=window[k],v,l=function(b){a(u).triggerHandler("error",b||"abort")},m={abort:l},p;c&&c.promise(m);a(u).on("load error",function(d,g){clearTimeout(p);a(u).off().remove();"error"==d.type||!v?f(null,g||"error",m,b,c):e(v[0],m,
b,c);window[k]=h;v&&a.isFunction(h)&&h(v[0]);h=v=void 0});if(!1===d(m,b))return l("abort"),m;window[k]=function(){v=arguments};u.src=b.url.replace(/\?(.+)=\?/,"?$1="+k);A.head.appendChild(u);0<b.timeout&&(p=setTimeout(function(){l("timeout")},b.timeout));return m};a.ajaxSettings={type:"GET",beforeSend:m,success:m,error:m,complete:m,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:D,xml:"application/xml, text/xml",
html:B,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0};a.ajax=function(b){var g=a.extend({},b||{}),h=a.Deferred&&a.Deferred();for(s in a.ajaxSettings)void 0===g[s]&&(g[s]=a.ajaxSettings[s]);c(g);g.crossDomain||(g.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(g.url)&&RegExp.$2!=window.location.host);g.url||(g.url=window.location.toString());z(g);var v=g.dataType,p=/\?.+=\?/.test(g.url);p&&(v="jsonp");if(!1===g.cache||(!b||!0!==b.cache)&&("script"==v||"jsonp"==v))g.url=k(g.url,"_="+
Date.now());if("jsonp"==v)return p||(g.url=k(g.url,g.jsonp?g.jsonp+"=?":!1===g.jsonp?"":"callback=?")),a.ajaxJSONP(g,h);b=g.accepts[v];var w={},p=function(a,b){w[a.toLowerCase()]=[a,b]},x=/^([\w-]+:)\/\//.test(g.url)?RegExp.$1:window.location.protocol,n=g.xhr(),A=n.setRequestHeader,r;h&&h.promise(n);g.crossDomain||p("X-Requested-With","XMLHttpRequest");p("Accept",b||"*/*");if(b=g.mimeType||b)-1<b.indexOf(",")&&(b=b.split(",",2)[0]),n.overrideMimeType&&n.overrideMimeType(b);if(g.contentType||!1!==
g.contentType&&g.data&&"GET"!=g.type.toUpperCase())p("Content-Type",g.contentType||"application/x-www-form-urlencoded");if(g.headers)for(y in g.headers)p(y,g.headers[y]);n.setRequestHeader=p;n.onreadystatechange=function(){if(4==n.readyState){n.onreadystatechange=m;clearTimeout(r);var b,c=!1;if(200<=n.status&&300>n.status||304==n.status||0==n.status&&"file:"==x){v=v||l(g.mimeType||n.getResponseHeader("content-type"));b=n.responseText;try{"script"==v?(0,eval)(b):"xml"==v?b=n.responseXML:"json"==v&&
(b=u.test(b)?null:a.parseJSON(b))}catch(d){c=d}c?f(c,"parsererror",n,g,h):e(b,n,g,h)}else f(n.statusText||null,n.status?"error":"abort",n,g,h)}};if(!1===d(n,g))return n.abort(),f(null,"abort",n,g,h),n;if(g.xhrFields)for(y in g.xhrFields)n[y]=g.xhrFields[y];n.open(g.type,g.url,"async"in g?g.async:!0,g.username,g.password);for(y in w)A.apply(n,w[y]);0<g.timeout&&(r=setTimeout(function(){n.onreadystatechange=m;n.abort();f(null,"timeout",n,g,h)},g.timeout));n.send(g.data?g.data:null);return n};a.get=
function(){return a.ajax(p.apply(null,arguments))};a.post=function(){var b=p.apply(null,arguments);b.type="POST";return a.ajax(b)};a.getJSON=function(){var b=p.apply(null,arguments);b.dataType="json";return a.ajax(b)};a.fn.load=function(b,c,d){if(!this.length)return this;var e=this,g=b.split(/\s/),f;b=p(b,c,d);var k=b.success;1<g.length&&(b.url=g[0],f=g[1]);b.success=function(b){e.html(f?a("<div>").html(b.replace(x,"")).find(f):b);k&&k.apply(e,arguments)};a.ajax(b);return this};var v=encodeURIComponent;
a.param=function(a,b){var c=[];c.add=function(a,b){this.push(v(a)+"="+v(b))};w(c,a,b);return c.join("&").replace(/%20/g,"+")}})(Zepto);(function(a){var b=[],c;a.fn.remove=function(){return this.each(function(){this.parentNode&&("IMG"===this.tagName&&(b.push(this),this.src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=",c&&clearTimeout(c),c=setTimeout(function(){b=[]},6E4)),this.parentNode.removeChild(this))})}})(Zepto);
(function(a){a.Callbacks=function(b){b=a.extend({},b);var c,d,e,f,g,m,l=[],k=!b.once&&[],z=function(a){c=b.memory&&a;d=!0;m=f||0;f=0;g=l.length;for(e=!0;l&&m<g;++m)if(!1===l[m].apply(a[0],a[1])&&b.stopOnFalse){c=!1;break}e=!1;l&&(k?k.length&&z(k.shift()):c?l.length=0:p.disable())},p={add:function(){if(l){var d=l.length,k=function(c){a.each(c,function(a,c){"function"===typeof c?(!b.unique||!p.has(c))&&l.push(c):c&&(c.length&&"string"!==typeof c)&&k(c)})};k(arguments);e?g=l.length:c&&(f=d,z(c))}return this},
remove:function(){l&&a.each(arguments,function(b,c){for(var d;-1<(d=a.inArray(c,l,d));)l.splice(d,1),e&&(d<=g&&--g,d<=m&&--m)});return this},has:function(b){return!(!l||!(b?-1<a.inArray(b,l):l.length))},empty:function(){g=l.length=0;return this},disable:function(){l=k=c=void 0;return this},disabled:function(){return!l},lock:function(){k=void 0;c||p.disable();return this},locked:function(){return!k},fireWith:function(a,b){if(l&&(!d||k))b=b||[],b=[a,b.slice?b.slice():b],e?k.push(b):z(b);return this},
fire:function(){return p.fireWith(this,arguments)},fired:function(){return!!d}};return p}})(Zepto);
(function(a){function b(b,d){var p=b[m],p=p&&e[p];if(void 0===d)return p||c(b);if(p){if(d in p)return p[d];var l=g(d);if(l in p)return p[l]}return f.call(a(b),d)}function c(b,c,f){var l=b[m]||(b[m]=++a.uuid);b=e[l]||(e[l]=d(b));void 0!==c&&(b[g(c)]=f);return b}function d(b){var c={};a.each(b.attributes||l,function(b,d){0==d.name.indexOf("data-")&&(c[g(d.name.replace("data-",""))]=a.zepto.deserializeValue(d.value))});return c}var e={},f=a.fn.data,g=a.camelCase,m=a.expando="Zepto"+ +new Date,l=[];a.fn.data=
function(d,e){return void 0===e?a.isPlainObject(d)?this.each(function(b,e){a.each(d,function(a,b){c(e,a,b)})}):0 in this?b(this[0],d):void 0:this.each(function(){c(this,d,e)})};a.fn.removeData=function(b){"string"==typeof b&&(b=b.split(/\s+/));return this.each(function(){var c=this[m],d=c&&e[c];d&&a.each(b||d,function(a){delete d[b?g(this):a]})})};["remove","empty"].forEach(function(b){var c=a.fn[b];a.fn[b]=function(){var a=this.find("*");"remove"===b&&(a=a.add(this));a.removeData();return c.call(this)}})})(Zepto);
(function(a){function b(c){var e=[["resolve","done",a.Callbacks({once:1,memory:1}),"resolved"],["reject","fail",a.Callbacks({once:1,memory:1}),"rejected"],["notify","progress",a.Callbacks({memory:1})]],f="pending",g={state:function(){return f},always:function(){m.done(arguments).fail(arguments);return this},then:function(){var c=arguments;return b(function(b){a.each(e,function(d,e){var f=a.isFunction(c[d])&&c[d];m[e[1]](function(){var c=f&&f.apply(this,arguments);if(c&&a.isFunction(c.promise))c.promise().done(b.resolve).fail(b.reject).progress(b.notify);
else{var d=this===g?b.promise():this;b[e[0]+"With"](d,f?[c]:arguments)}})});c=null}).promise()},promise:function(b){return null!=b?a.extend(b,g):g}},m={};a.each(e,function(a,b){var c=b[2],d=b[3];g[b[1]]=c.add;d&&c.add(function(){f=d},e[a^1][2].disable,e[2][2].lock);m[b[0]]=function(){m[b[0]+"With"](this===m?g:this,arguments);return this};m[b[0]+"With"]=c.fireWith});g.promise(m);c&&c.call(m,m);return m}var c=Array.prototype.slice;a.when=function(d){var e=c.call(arguments),f=e.length,g=0,m=1!==f||d&&
a.isFunction(d.promise)?f:0,l=1===m?d:b(),k,z,p,w=function(a,b,d){return function(e){b[a]=this;d[a]=1<arguments.length?c.call(arguments):e;d===k?l.notifyWith(b,d):--m||l.resolveWith(b,d)}};if(1<f){k=Array(f);z=Array(f);for(p=Array(f);g<f;++g)e[g]&&a.isFunction(e[g].promise)?e[g].promise().done(w(g,p,e)).fail(l.reject).progress(w(g,z,k)):--m}m||l.resolveWith(p,e);return l.promise()};a.Deferred=b})(Zepto);
(function(a){function b(a){var b=this.os={},e=this.browser={},f=a.match(/Web[kK]it[\/]{0,1}([\d.]+)/),g=a.match(/(Android);?[\s\/]+([\d.]+)?/),m=!!a.match(/\(Macintosh\; Intel /),l=a.match(/(iPad).*OS\s([\d_]+)/),k=a.match(/(iPod)(.*OS\s([\d_]+))?/),z=!l&&a.match(/(iPhone\sOS)\s([\d_]+)/),p=a.match(/(webOS|hpwOS)[\s\/]([\d.]+)/),w=a.match(/Windows Phone ([\d.]+)/),n=p&&a.match(/TouchPad/),A=a.match(/Kindle\/([\d.]+)/),s=a.match(/Silk\/([\d._]+)/),y=a.match(/(BlackBerry).*Version\/([\d.]+)/),x=a.match(/(BB10).*Version\/([\d.]+)/),
r=a.match(/(RIM\sTablet\sOS)\s([\d.]+)/),h=a.match(/PlayBook/),D=a.match(/Chrome\/([\d.]+)/)||a.match(/CriOS\/([\d.]+)/),B=a.match(/Firefox\/([\d.]+)/),u=a.match(/MSIE\s([\d.]+)/)||a.match(/Trident\/[\d](?=[^\?]+).*rv:([0-9.].)/),v=!D&&a.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/),q=v||a.match(/Version\/([\d.]+)([^S](Safari)|[^M]*(Mobile)[^S]*(Safari))/);if(e.webkit=!!f)e.version=f[1];g&&(b.android=!0,b.version=g[2]);z&&!k&&(b.ios=b.iphone=!0,b.version=z[2].replace(/_/g,"."));l&&(b.ios=b.ipad=
!0,b.version=l[2].replace(/_/g,"."));k&&(b.ios=b.ipod=!0,b.version=k[3]?k[3].replace(/_/g,"."):null);w&&(b.wp=!0,b.version=w[1]);p&&(b.webos=!0,b.version=p[2]);n&&(b.touchpad=!0);y&&(b.blackberry=!0,b.version=y[2]);x&&(b.bb10=!0,b.version=x[2]);r&&(b.rimtabletos=!0,b.version=r[2]);h&&(e.playbook=!0);A&&(b.kindle=!0,b.version=A[1]);s&&(e.silk=!0,e.version=s[1]);!s&&(b.android&&a.match(/Kindle Fire/))&&(e.silk=!0);D&&(e.chrome=!0,e.version=D[1]);B&&(e.firefox=!0,e.version=B[1]);u&&(e.ie=!0,e.version=
u[1]);if(q&&(m||b.ios))e.safari=!0,m&&(e.version=q[1]);v&&(e.webview=!0);b.tablet=!(!l&&!h&&!(g&&!a.match(/Mobile/)||B&&a.match(/Tablet/)||u&&!a.match(/Phone/)&&a.match(/Touch/)));b.phone=!(b.tablet||b.ipod||!g&&!z&&!p&&!y&&!x&&!(D&&a.match(/Android/)||D&&a.match(/CriOS\/([\d.]+)/)||B&&a.match(/Mobile/)||u&&a.match(/Touch/)))}b.call(a,navigator.userAgent);a.__detect=b})(Zepto);
(function(a){function b(a){return a._zid||(a._zid=l++)}function c(a,c,e,f){c=d(c);if(c.ns)var g=RegExp("(?:^| )"+c.ns.replace(" "," .* ?")+"(?: |$)");return(n[b(a)]||[]).filter(function(a){return a&&(!c.e||a.e==c.e)&&(!c.ns||g.test(a.ns))&&(!e||b(a.fn)===b(e))&&(!f||a.sel==f)})}function d(a){a=(""+a).split(".");return{e:a[0],ns:a.slice(1).sort().join(" ")}}function e(c,e,f,h,m,l,p){var z=b(c),w=n[z]||(n[z]=[]);e.split(/\s/).forEach(function(b){if("ready"==b)return a(document).ready(f);var e=d(b);
e.fn=f;e.sel=m;e.e in x&&(f=function(b){var c=b.relatedTarget;if(!c||c!==this&&!a.contains(this,c))return e.fn.apply(this,arguments)});var v=(e.del=l)||f;e.proxy=function(a){a=g(a);if(!a.isImmediatePropagationStopped()){a.data=h;var b=v.apply(c,a._args==k?[a]:[a].concat(a._args));!1===b&&(a.preventDefault(),a.stopPropagation());return b}};e.i=w.length;w.push(e);"addEventListener"in c&&c.addEventListener(x[e.e]||s&&y[e.e]||e.e,e.proxy,e.del&&!s&&e.e in y||!!p)})}function f(a,d,e,f,g){var h=b(a);(d||
"").split(/\s/).forEach(function(b){c(a,b,e,f).forEach(function(b){delete n[h][b.i];"removeEventListener"in a&&a.removeEventListener(x[b.e]||s&&y[b.e]||b.e,b.proxy,b.del&&!s&&b.e in y||!!g)})})}function g(b,c){if(c||!b.isDefaultPrevented)if(c||(c=b),a.each(B,function(a,d){var e=c[a];b[a]=function(){this[d]=r;return e&&e.apply(c,arguments)};b[d]=h}),c.defaultPrevented!==k?c.defaultPrevented:"returnValue"in c?!1===c.returnValue:c.getPreventDefault&&c.getPreventDefault())b.isDefaultPrevented=r;return b}
function m(a){var b,c={originalEvent:a};for(b in a)!D.test(b)&&a[b]!==k&&(c[b]=a[b]);return g(c,a)}var l=1,k,z=Array.prototype.slice,p=a.isFunction,w=function(a){return"string"==typeof a},n={},A={},s="onfocusin"in window,y={focus:"focusin",blur:"focusout"},x={mouseenter:"mouseover",mouseleave:"mouseout"};A.click=A.mousedown=A.mouseup=A.mousemove="MouseEvents";a.event={add:e,remove:f};a.proxy=function(c,d){var e=2 in arguments&&z.call(arguments,2);if(p(c)){var f=function(){return c.apply(d,e?e.concat(z.call(arguments)):
arguments)};f._zid=b(c);return f}if(w(d))return e?(e.unshift(c[d],c),a.proxy.apply(null,e)):a.proxy(c[d],c);throw new TypeError("expected function");};a.fn.bind=function(a,b,c){return this.on(a,b,c)};a.fn.unbind=function(a,b){return this.off(a,b)};a.fn.one=function(a,b,c,d){return this.on(a,b,c,d,1)};var r=function(){return!0},h=function(){return!1},D=/^([A-Z]|returnValue$|layer[XY]$)/,B={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};
a.fn.delegate=function(a,b,c){return this.on(b,a,c)};a.fn.undelegate=function(a,b,c){return this.off(b,a,c)};a.fn.live=function(b,c){a(document.body).delegate(this.selector,b,c);return this};a.fn.die=function(b,c){a(document.body).undelegate(this.selector,b,c);return this};a.fn.on=function(b,c,d,g,l){var x,n,r=this;if(b&&!w(b))return a.each(b,function(a,b){r.on(a,c,d,b,l)}),r;!w(c)&&(!p(g)&&!1!==g)&&(g=d,d=c,c=k);if(p(d)||!1===d)g=d,d=k;!1===g&&(g=h);return r.each(function(h,k){l&&(x=function(a){f(k,
a.type,g);return g.apply(this,arguments)});c&&(n=function(b){var d,e=a(b.target).closest(c,k).get(0);if(e&&e!==k)return d=a.extend(m(b),{currentTarget:e,liveFired:k}),(x||g).apply(e,[d].concat(z.call(arguments,1)))});e(k,b,g,d,c,n||x)})};a.fn.off=function(b,c,d){var e=this;if(b&&!w(b))return a.each(b,function(a,b){e.off(a,c,b)}),e;!w(c)&&(!p(d)&&!1!==d)&&(d=c,c=k);!1===d&&(d=h);return e.each(function(){f(this,b,d,c)})};a.fn.trigger=function(b,c){b=w(b)||a.isPlainObject(b)?a.Event(b):g(b);b._args=
c;return this.each(function(){"dispatchEvent"in this?this.dispatchEvent(b):a(this).triggerHandler(b,c)})};a.fn.triggerHandler=function(b,d){var e,f;this.each(function(g,h){e=m(w(b)?a.Event(b):b);e._args=d;e.target=h;a.each(c(h,b.type||b),function(a,b){f=b.proxy(e);if(e.isImmediatePropagationStopped())return!1})});return f};"focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(b){a.fn[b]=
function(a){return a?this.bind(b,a):this.trigger(b)}});["focus","blur"].forEach(function(b){a.fn[b]=function(a){a?this.bind(b,a):this.each(function(){try{this[b]()}catch(a){}});return this}});a.Event=function(a,b){w(a)||(b=a,a=b.type);var c=document.createEvent(A[a]||"Events"),d=!0;if(b)for(var e in b)"bubbles"==e?d=!!b[e]:c[e]=b[e];c.initEvent(a,d,!0);return g(c)}})(Zepto);
(function(a){a.fn.serializeArray=function(){var b,c,d=[];a([].slice.call(this.get(0).elements)).each(function(){b=a(this);c=b.attr("type");"fieldset"!=this.nodeName.toLowerCase()&&(!this.disabled&&"submit"!=c&&"reset"!=c&&"button"!=c&&("radio"!=c&&"checkbox"!=c||this.checked))&&d.push({name:b.attr("name"),value:b.val()})});return d};a.fn.serialize=function(){var a=[];this.serializeArray().forEach(function(c){a.push(encodeURIComponent(c.name)+"="+encodeURIComponent(c.value))});return a.join("&")};
a.fn.submit=function(b){b?this.bind("submit",b):this.length&&(b=a.Event("submit"),this.eq(0).trigger(b),b.isDefaultPrevented()||this.get(0).submit());return this}})(Zepto);
(function(a,b){var c="",d,e=window.document.createElement("div"),f=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,g,m,l,k,z,p,w,n,A,s={};a.each({Webkit:"webkit",Moz:"",O:"o"},function(a,f){if(e.style[a+"TransitionProperty"]!==b)return c="-"+a.toLowerCase()+"-",d=f,!1});g=c+"transform";s[m=c+"transition-property"]=s[l=c+"transition-duration"]=s[z=c+"transition-delay"]=s[k=c+"transition-timing-function"]=s[p=c+"animation-name"]=s[w=c+"animation-duration"]=s[A=c+"animation-delay"]=
s[n=c+"animation-timing-function"]="";a.fx={off:d===b&&e.style.transitionProperty===b,speeds:{_default:400,fast:200,slow:600},cssPrefix:c,transitionEnd:d?d+"TransitionEnd":"transitionend",animationEnd:d?d+"AnimationEnd":"animationend"};a.fn.animate=function(c,d,e,f,g){a.isFunction(d)&&(f=d,d=e=b);a.isFunction(e)&&(f=e,e=b);a.isPlainObject(d)&&(e=d.easing,f=d.complete,g=d.delay,d=d.duration);d&&(d=("number"==typeof d?d:a.fx.speeds[d]||a.fx.speeds._default)/1E3);g&&(g=parseFloat(g)/1E3);return this.anim(c,
d,e,f,g)};a.fn.anim=function(c,d,e,h,D){var B,u={},v,q="",E=this,F,G=a.fx.transitionEnd,I=!1;d===b&&(d=a.fx.speeds._default/1E3);D===b&&(D=0);a.fx.off&&(d=0);if("string"==typeof c)u[p]=c,u[w]=d+"s",u[A]=D+"s",u[n]=e||"linear",G=a.fx.animationEnd;else{v=[];for(B in c)f.test(B)?q+=B+"("+c[B]+") ":(u[B]=c[B],v.push(B.replace(/([a-z])([A-Z])/,"$1-$2").toLowerCase()));q&&(u[g]=q,v.push(g));0<d&&"object"===typeof c&&(u[m]=v.join(", "),u[l]=d+"s",u[z]=D+"s",u[k]=e||"linear")}F=function(b){if("undefined"!==
typeof b){if(b.target!==b.currentTarget)return;a(b.target).unbind(G,F)}else a(this).unbind(G,F);I=!0;a(this).css(s);h&&h.call(this)};0<d&&(this.bind(G,F),setTimeout(function(){I||F.call(E)},1E3*d+25));this.size()&&this.get(0).clientLeft;this.css(u);0>=d&&setTimeout(function(){E.each(function(){F.call(this)})},0);return this};e=null})(Zepto);
(function(a,b){function c(c,d,e,f,g){"function"==typeof d&&!g&&(g=d,d=b);e={opacity:e};f&&(e.scale=f,c.css(a.fx.cssPrefix+"transform-origin","0 0"));return c.animate(e,d,null,g)}function d(b,d,e,g){return c(b,d,0,e,function(){f.call(a(this));g&&g.call(this)})}var e=a.fn.show,f=a.fn.hide,g=a.fn.toggle;a.fn.show=function(a,d){e.call(this);a===b?a=0:this.css("opacity",0);return c(this,a,1,"1,1",d)};a.fn.hide=function(a,c){return a===b?f.call(this):d(this,a,"0,0",c)};a.fn.toggle=function(c,d){return c===
b||"boolean"==typeof c?g.call(this,c):this.each(function(){var b=a(this);b["none"==b.css("display")?"show":"hide"](c,d)})};a.fn.fadeTo=function(a,b,d){return c(this,a,b,null,d)};a.fn.fadeIn=function(a,b){var c=this.css("opacity");0<c?this.css("opacity",0):c=1;return e.call(this).fadeTo(a,c,b)};a.fn.fadeOut=function(a,b){return d(this,a,null,b)};a.fn.fadeToggle=function(b,c){return this.each(function(){var d=a(this);d[0==d.css("opacity")||"none"==d.css("display")?"fadeIn":"fadeOut"](b,c)})}})(Zepto);
(function(a){if(a.os.ios){var b={};a(document).bind("gesturestart",function(a){var d=Date.now();b.target="tagName"in a.target?a.target:a.target.parentNode;b.e1=a.scale;b.last=d}).bind("gesturechange",function(a){b.e2=a.scale}).bind("gestureend",function(c){0<b.e2?(0!=Math.abs(b.e1-b.e2)&&a(b.target).trigger("pinch")&&a(b.target).trigger("pinch"+(0<b.e1-b.e2?"In":"Out")),b.e1=b.e2=b.last=0):"last"in b&&(b={})});["pinch","pinchIn","pinchOut"].forEach(function(b){a.fn[b]=function(a){return this.bind(b,
a)}})}})(Zepto);(function(a){"__proto__"in{}||a.extend(a.zepto,{Z:function(b,c){b=b||[];a.extend(b,a.fn);b.selector=c||"";b.__Z=!0;return b},isZ:function(b){return"array"===a.type(b)&&"__Z"in b}});try{getComputedStyle(void 0)}catch(b){var c=getComputedStyle;window.getComputedStyle=function(a){try{return c(a)}catch(b){return null}}}})(Zepto);
(function(a){String.prototype.trim===a&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});Array.prototype.reduce===a&&(Array.prototype.reduce=function(b){if(void 0===this||null===this)throw new TypeError;var c=Object(this),d=c.length>>>0,e=0,f;if("function"!=typeof b)throw new TypeError;if(0==d&&1==arguments.length)throw new TypeError;if(2<=arguments.length)f=arguments[1];else{do{if(e in c){f=c[e++];break}if(++e>=d)throw new TypeError;}while(1)}for(;e<d;)e in c&&(f=b.call(a,
f,c[e],e,c)),e++;return f})})();
(function(a){function b(b){b=a(b);return!(!b.width()&&!b.height())&&"none"!==b.css("display")}function c(a,b){a=a.replace(/=#\]/g,'="#"]');var c,d,e=m.exec(a);e&&e[2]in g&&(c=g[e[2]],d=e[3],a=e[1],d&&(e=Number(d),d=isNaN(e)?d.replace(/^["']|["']$/g,""):e));return b(a,c,d)}var d=a.zepto,e=d.qsa,f=d.matches,g=a.expr[":"]={visible:function(){if(b(this))return this},hidden:function(){if(!b(this))return this},selected:function(){if(this.selected)return this},checked:function(){if(this.checked)return this},parent:function(){return this.parentNode},
first:function(a){if(0===a)return this},last:function(a,b){if(a===b.length-1)return this},eq:function(a,b,c){if(a===c)return this},contains:function(b,c,d){if(-1<a(this).text().indexOf(d))return this},has:function(a,b,c){if(d.qsa(this,c).length)return this}},m=/(.*):(\w+)(?:\(([^)]+)\))?$\s*/,l=/^\s*>/,k="Zepto"+ +new Date;d.qsa=function(b,g){return c(g,function(c,f,m){try{var s;!c&&f?c="*":l.test(c)&&(s=a(b).addClass(k),c="."+k+" "+c);var y=e(b,c)}catch(x){throw console.error("error performing selector: %o",
g),x;}finally{s&&s.removeClass(k)}return!f?y:d.uniq(a.map(y,function(a,b){return f.call(a,b,y,m)}))})};d.matches=function(a,b){return c(b,function(b,c,d){return(!b||f(a,b))&&(!c||c.call(a,null,d)===a)})}})(Zepto);
(function(a){a.fn.end=function(){return this.prevObject||a()};a.fn.andSelf=function(){return this.add(this.prevObject||a())};"filter add not eq first last find closest parents parent children siblings".split(" ").forEach(function(b){var c=a.fn[b];a.fn[b]=function(){var a=c.apply(this,arguments);a.prevObject=this;return a}})})(Zepto);
(function(a){function b(){k=null;f.last&&(f.el.trigger("longTap"),f={})}function c(){g&&clearTimeout(g);m&&clearTimeout(m);l&&clearTimeout(l);k&&clearTimeout(k);g=m=l=k=null;f={}}function d(a){return("touch"==a.pointerType||a.pointerType==a.MSPOINTER_TYPE_TOUCH)&&a.isPrimary}function e(a,b){return a.type=="pointer"+b||a.type.toLowerCase()=="mspointer"+b}var f={},g,m,l,k,z;a(document).ready(function(){var p,w,n=0,A=0,s,y;"MSGesture"in window&&(z=new MSGesture,z.target=document.body);a(document).bind("MSGestureEnd",
function(a){if(a=1<a.velocityX?"Right":-1>a.velocityX?"Left":1<a.velocityY?"Down":-1>a.velocityY?"Up":null)f.el.trigger("swipe"),f.el.trigger("swipe"+a)}).on("touchstart MSPointerDown pointerdown",function(c){if(!(y=e(c,"down"))||d(c))s=y?c:c.touches[0],c.touches&&(1===c.touches.length&&f.x2)&&(f.x2=void 0,f.y2=void 0),p=Date.now(),w=p-(f.last||p),f.el=a("tagName"in s.target?s.target:s.target.parentNode),g&&clearTimeout(g),f.x1=s.pageX,f.y1=s.pageY,0<w&&250>=w&&(f.isDoubleTap=!0),f.last=p,k=setTimeout(b,
750),z&&y&&z.addPointer(c.pointerId)}).on("touchmove MSPointerMove pointermove",function(a){if(!(y=e(a,"move"))||d(a))s=y?a:a.touches[0],k&&clearTimeout(k),k=null,f.x2=s.pageX,f.y2=s.pageY,n+=Math.abs(f.x1-f.x2),A+=Math.abs(f.y1-f.y2)}).on("touchend MSPointerUp pointerup",function(b){if(!(y=e(b,"up"))||d(b))k&&clearTimeout(k),k=null,f.x2&&30<Math.abs(f.x1-f.x2)||f.y2&&30<Math.abs(f.y1-f.y2)?l=setTimeout(function(){f.el.trigger("swipe");f.el.trigger("swipe"+(Math.abs(f.x1-f.x2)>=Math.abs(f.y1-f.y2)?
0<f.x1-f.x2?"Left":"Right":0<f.y1-f.y2?"Up":"Down"));f={}},0):"last"in f&&(30>n&&30>A?m=setTimeout(function(){var b=a.Event("tap");b.cancelTouch=c;f.el.trigger(b);f.isDoubleTap?(f.el&&f.el.trigger("doubleTap"),f={}):g=setTimeout(function(){g=null;f.el&&f.el.trigger("singleTap");f={}},250)},0):f={}),n=A=0}).on("touchcancel MSPointerCancel pointercancel",c);a(window).on("scroll",c)});"swipe swipeLeft swipeRight swipeUp swipeDown doubleTap tap singleTap longTap".split(" ").forEach(function(b){a.fn[b]=
function(a){return this.on(b,a)}})})(Zepto);var WIN=window,DOC=document,SKIPVC=!0,hostApi="12306.cn/otsweb",baseProxyUrl="/12306/proxy.php",isMobile=!0,isIos="undefined"!=typeof window.__gChrome||"undefined"!=typeof liebaoExtentions&&liebaoExtentions.isWebviewLiebao&&liebaoExtentions.isWebviewLiebao(),isAndLiebao="undefined"!=typeof liebaoExtentions,isWebApp=!1;DOC.addEventListener("mobileSupportInitialized",function(){isWebApp=!0});
var Public={init:function(){$(".query_box .query_bigcheck").live("click",function(){$(".query_bigcheck",$(this).parent(".query_box")).removeClass("query_bigcheck_checked");$("input[type=radio]",this).attr("checked","checked");$(this).addClass("query_bigcheck_checked")});$(".checks").each(function(a){$("[type=checkbox]",this)});$('[data-fn="back"]').on("click",function(){window.history.back()});Public.setHis()},his:{querys:[],queryObjs:{}},setHis:function(){Public.his.querys=Public.getHisQuery();for(var a=
0,b=Public.his.querys.length;a<b;a++)Public.his.queryObjs[Public.his.querys[a][0]]=Public.getQueryData(Public.his.querys[a][1])},toast:function(a,b){if(!a)return!1;var c=$('<div class="public_toast">'+a+"</div>");b=b||1500;$("body").append(c);setTimeout(function(){c.addClass("public_toast_show")},10);setTimeout(function(){c.removeClass("public_toast_show");c.on("webkitTransitionEnd",function(){c.remove()})},b)},popHtml:function(a,b){var c="",d=DOC.createElement("div"),e="";if("object"==typeof b)for(var f in b)e+=
'<a href="javascript:;" data-val="'+f+'">'+b[f]+"</a>";d.className="public_layer";c+='<div class="public_pop"><p>'+a+"</p>"+(""==e?'<div class="public_btns"><a href="javascript:;" data-type="sure">\u786e\u5b9a</a></div>':'<div class="public_btns">'+e+"</div>")+"</div>";d.innerHTML=c;document.getElementsByTagName("body")[0].appendChild(d);setTimeout(function(){$(".public_pop",d).addClass("public_pop_show")},0);$(d).on("touchmove",function(a){a.preventDefault();return!1});return $(d)},alert:function(a,
b){var c=Public.popHtml(a,{sure:"\u786e\u5b9a"});$(".public_btns a",c).on("click",function(){c.remove();"function"==typeof b&&b()})},confirm:function(a,b){var c=Public.popHtml(a,{cancel:"\u53d6\u6d88",sure:"\u786e\u5b9a"});$(".public_btns a",c).on("click",function(){var a=$(this).attr("data-val");c.remove();"function"==typeof b&&"sure"==a&&b()})},getQueryData:function(a){a=a.replace(/^\?+/,"").replace(/&amp;/,"&");a=a.split("&");for(var b=a.length,c={};b--;)if(item=a[b].split("="),item[0]){var d=
item[1]||"";try{d=decodeURIComponent(d)}catch(e){d=unescape(d)}c[decodeURIComponent(item[0])]=d}return c},objToQueryString:function(a){var b=[],c,d,e;for(c in a)if(d=a[c],d instanceof Array)for(e=d.length;e--;)b.push(c+"[]="+encodeURIComponent(d[e]));else b.push(c+(""===d?"":"="+encodeURIComponent(d)));return b.join("&")},hasArrObjKey:function(a,b,c){for(var d=-1,e=0,f=a.length;e<f;e++)if(a[e][b]==c){d=e;break}return d},getHisQuery:function(){var a=localStorage.getItem("hisQuery");return!a?[]:JSON.parse(a)},
setHisQuery:function(a,b){var c=Public.getHisQuery(),d=Public.hasArrObjKey(c,0,a);-1!=d&&c.splice(d,1);c.unshift([a,b]);6<c.length&&6==c.length;localStorage.setItem("hisQuery",JSON.stringify(c))},showInnerPage:function(a){$("#"+a).addClass("fixed_box_show");$("#wrap").hide()},hideInnerPage:function(){$(".fixed_box").removeClass("fixed_box_show");$("#wrap").show()},formatString:"yyyy\u5e74M\u6708d\u65e5",setDate:function(a){if(0==$("#calendar").length)return!1;a=a||(new Date).date;$("#start_date").html(a.format(Public.formatString)+
" "+a.day(3));$("#start_date_val").val(a.format("yyyy-MM-dd"));Public.calendar||(Public.calendar=new DateComponent({wrap:$("#calendar"),curDate:a,checkCallback:Public.dateChangeCallback}));$("#check_left,#check_right").on("click",function(){var a;if(a="check_left"==$(this).attr("id")?Public.calendar.dayPrev():Public.calendar.dayNext())$("#start_date").html(a.format(Public.formatString)+" "+a.day(3)),$("#start_date_val").val(a.format("yyyy-MM-dd"))});$("#start_date").on("click",function(){Public.showInnerPage("date_box")});
$("[name=type]").on("change",function(){var a=$("[name=type]:checked").val();1==a?(Public.calendar.maxDate=Public.calendar._TODAY.addDays(19),Public.calendar.curDate.date.getTime()>Public.calendar.maxDate.date.getTime()&&(Public.calendar.curDate=Public.calendar.maxDate,Public.dateChangeCallback(Public.calendar.curDate)),Public.calendar.setBasic()):2==a&&(Public.calendar.maxDate=Public.calendar._TODAY.addDays(29),Public.calendar.setBasic())})},dateChangeCallback:function(a){var b=a.date.getTime();
b>=Public.calendar.minDate.date.getTime()&&b<=Public.calendar.maxDate.date.getTime()?($("#date_tip").hide(),Public.hideInnerPage("date_box"),$("#start_date").html(Public.calendar.curDate.format(Public.formatString)+" "+Public.calendar.curDate.day(3)),$("#start_date_val").val(Public.calendar.curDate.format("yyyy-MM-dd"))):(b=$("a.cur",Public.calendar.wrap).offset(),$("#date_tip").css({left:b.left,top:b.top,display:"block"}).html("<p>"+a.format("M\u6708d\u65e5")+'\u4e0d\u5728\u9884\u552e\u671f</p><a href="#" class="btn btn_m btn_success">\u9884\u7ea6\u63d0\u9192</a>'),
0.75<b.left/window.innerWidth?$("#date_tip").attr("class","tip_small tip_right"):0.15>b.left/window.innerWidth?$("#date_tip").attr("class","tip_small tip_left"):$("#date_tip").attr("class","tip_small"))}};var Util={isImageFile:function(a){a=a.substring(a.lastIndexOf("."),a.length).toLowerCase();return".bmp"==a||".png"==a||".jpg"==a||".gif"==a},isEmpty:function(a,b,c){if(!a[b]){with($("#"+b).addError())0<length&&get(0).focus();c&&$.showTip(c);return!0}return!1},checkNumber:function(a,b,c){a=parseFloat(a);return!isNaN(a)&&(null==b||a>=b)&&(null==c||a<=c)},convertNumberToString:function(a,b){a=""+a;for(var c=[],d=0;d<b-a.length;d++)c.push("0");return c.join("")+a},convertDecimalToString:function(a,b){b=
b||2;a=""+Math.round(a*(10^b))/(10^b);var c=b,d=a.indexOf(".");-1!=d?c=b-a.length-d-1:a+=".";for(var d=[],e=0;e<c;e++)d.push("0");return a+d.join("")},isEmail:function(a){return/^\w+[\.\-_0-9a-z]+@[0-9a-z]+([\-_\.][0-9a-z]+)*\.(com|net|org|edu|cn)$/i.test(a)},loadJS:function(a,b,c){var d=document.createElement("script");d.onload=d.onreadystatechange=function(){if(!d||!d.readyState||!/^(?!(?:loaded|complete)$)/.test(d.readyState))d.onload=d.onreadystatechange=null,d.src="",d.parentNode.removeChild(d),
d=null,b&&b()};d.charset=c||document.charset||document.characterSet;d.src=a;try{document.getElementsByTagName("head")[0].appendChild(d)}catch(e){}},toSeatTypeName:function(a){switch(a){case 9:case "9":return"\u5546\u52a1\u5ea7";case "P":return"\u7279\u7b49\u5ea7";case "M":return"\u4e00\u7b49\u5ea7";case "O":return"\u4e8c\u7b49\u5ea7";case 6:case "6":return"\u9ad8\u7ea7\u8f6f\u5ea7";case 4:case "4":return"\u8f6f\u5367";case 3:case "3":return"\u786c\u5367";case 2:case "2":return"\u8f6f\u5ea7";case 1:case "1":return"\u786c\u5ea7";
case 0:case "0":return"\u65e0\u5ea7";default:return""}},inThatOrder:"OM934612P0".split(""),sortType:function(a){for(var b=[],c=0,d=Util.inThatOrder.length;c<d;c++)"undefined"!=typeof a[Util.inThatOrder[c]]&&b.push(a[Util.inThatOrder[c]]);return b},mapObject:function(a,b){for(var c={},d=0;d<a.length;d++)c[b(a[d])]=a[d];return c}},base64={base64map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("")},base64=$.extend({base64DeMap:!function(){var a={};return $.each(base64.base64map,
function(b,c){a[c]=b}),a}(),encode:function(a){for(var b=[],c=base64.base64map,d=a.length,e,f=0;f<d;)e=a[f]<<16|a[f+1]<<8|a[f+2],b.push(c[e>>18],c[e>>12&63],c[e>>6&63],c[e&63]),f+=3;return 1==d%3?(b.pop(),b.pop(),b.push("=","=")):(b.pop(),b.push("=")),b.join("")},decode:function(a){var b=[];a=a.split("");var c=base64.base64DeMap,d=a.length,e,f=0;if(d%4)return null;for(;f<d;)e=c[a[f]]<<18|c[a[f+1]]<<12|c[a[f+2]]<<6|c[a[f+3]],b.push(e>>16,e>>8&255,e&255),f+=4;for(;"="==a[--d];)b.pop();return b},encodeArrayBuffer:function(a){a=
new DataView(a);for(var b=a.byteLength,c=[],d=0;d<b;d++)c.push(a.getUint8(d));return base64.encode(c)},toObjectUrl:function(a,b){return"data:"+b+";base64,"+a}},base64);function DateDifference(a){this.TicksCount=a;this.getSeconds=function(){return this.TicksCount/1E3};this.getMinutes=function(){return this.getSeconds()/60};this.getHours=function(){return this.getMinutes()/60};this.getDays=function(){return this.getHours()/24};this.getYears=function(){return this.getDays()/365};return this}
Date.prototype.isValid=function(a){return!isNaN(this.getFullYear())};Date.prototype.addDays=function(a){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+a)};Date.prototype.addMonthes=function(a){return new Date(this.getFullYear(),this.getMonth()+a,this.getDate())};Date.prototype.addYears=function(a){return new Date(this.getFullYear()+a,this.getMonth(),this.getDate())};Date.prototype.subtract=function(a){return a instanceof Date?new DateDifference(this-a):null};
2014-08-19 16:11:37 +08:00
Date.prototype.__defineGetter__("date",function(){return new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0)});
Date.prototype.format=function(a){a=a||"yyyy-MM-dd";var b={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/i.test(a)&&(a=a.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(var c in b)RegExp("("+c+")").test(a)&&(a=a.replace(RegExp.$1,1==RegExp.$1.length?b[c]:("00"+b[c]).substr((""+b[c]).length)));return a};
Date.prototype.__defineGetter__("isToday",function(){return this.date.getTime()==(new Date).date.getTime()});Date.prototype.day=function(a){var b="\u65e5\u4e00\u4e8c\u4e09\u56db\u4e94\u516d".split("");switch(a){case 1:return b[this.getDay()];case 2:return"\u5468"+b[this.getDay()];default:return"\u661f\u671f"+b[this.getDay()]}};
function asDate(a){return/\/Date\((\d+)\)\//i.exec(a)?new Date(parseInt(RegExp.$1)):/(\d+)-0*(\d+)-0*(\d+)T0*(\d+):0*(\d+):0*(\d+)/i.exec(a)?new Date(parseInt(RegExp.$1),parseInt(RegExp.$2)-1,parseInt(RegExp.$3),parseInt(RegExp.$4),parseInt(RegExp.$5),parseInt(RegExp.$6)):/(\d{4})-0?(\d{1,2})-0?(\d{1,2})/.exec(a)?new Date(RegExp.$1,RegExp.$2-1,RegExp.$3):new Date(a)}String.prototype.toDate=function(){return asDate(this+"")};
String.prototype.padLeft=function(a,b){if(this.length>=a)return this;for(var c=[];c.length+this.length<a;)c.push(b);return c.join("")+this};String.prototype.padRight=function(a,b){if(this.length>=a)return this;for(var c=[];c.length+this.length<a;)c.push(b);return this+c.join("")};String.prototype.format=function(a,b){var c=parseInt(a);return 0<c?this.padLeft(c,b||" "):this.padRight(c,b||" ")};
String.prototype.temp=function(a){return this.replace(/\$\w+\$/gi,function(b){b=a[b.replace(/\$/g,"")];return"undefined"==b+""?"":b})};Number.prototype.toSize=function(){for(var a=["\u5b57\u8282","KB","MB","GB","TB"],b=0,c=1*this;1E3<c&&b<a.length;)b++,c/=1024;return Math.round(100*c)/100+a[b]};
2014-08-21 13:42:42 +08:00
Number.prototype.format=function(a){a=a.split(":");var b=this.toString(a[0]||10);if(!a[1])return b;var b=b.split("."),c="",d="",c=a[1]?b[0].padLeft(a[1],"0"):b[0],d=a[2]?(b[1]||"").padRight(a[2],"0"):b[1]||"";return c+(d?".":"")+d};Boolean.prototype.format=function(a){a=a.split(":");return!0==this?a[0]:a[1]};var cn12306={coreVersion:"1.0.0.0",baseUri:"https://kyfw.12306.cn/otn/",queryBaseUri:"http://dynamic.12306.cn/otsquery/",ajaxQueue:{},ajaxCount:0,getFullUri:function(a){return":"===a[4]||":"===a[5]?a:cn12306.baseUri+a},loadRandCode:function(a,b,c){var d=cn12306.getFullUri(":"===a[4]||":"===a[5]?a:function(b){if("sjrand"==a)return"/passcodeNew/getPassCodeNew?module=login&rand=sjrand";if("randp"==a)return"/passcodeNew/getPassCodeNew?module=passenger&rand=randp";Public.alert("\u4e0d\u652f\u6301\u7684\u9a8c\u8bc1\u7801\u7c7b\u578b\uff01")}(a));
c=cn12306.getFullUri(c||"loginAction.do?method=init");var e=new window.XMLHttpRequest;isAndLiebao||isIos?e.open("GET",d,!0):(e.open("GET",baseProxyUrl,!0),e.setRequestHeader("Fish-RawUrl",d));e.onreadystatechange=function(){4==e.readyState&&(200!=e.status?Public.alert("\u52a0\u8f7d\u9a8c\u8bc1\u7801\u5931\u8d25\uff0c\u8bf7\u70b9\u51fb\u9a8c\u8bc1\u7801\u5237\u65b0"):b(base64.toObjectUrl(base64.encodeArrayBuffer(e.response),"image/jpeg")))};var f=isAndLiebao?"":"Fish-";e.responseType="arraybuffer";
e.setRequestHeader(f+"Referer",c);e.setRequestHeader(f+"User-Agent","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)");e.setRequestHeader(f+"Origin",/(https?:\/\/[^\/]+\/)/.exec(d)[1]);e.send(null)},getAjaxUrl:function(a){console.log(a);return isAndLiebao||isIos?cn12306.getFullUri(a):baseProxyUrl},getHeaders:function(a,b){a=cn12306.getFullUri(a);b=cn12306.getFullUri(b);var c={},d=isAndLiebao?"":"Fish-";c[d+"User-Agent"]="Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)";
c[d+"Origin"]=/(https?:\/\/[^\/]+\/)/.exec(a)[1];c[d+"RawUrl"]=a;c[d+"Referer"]=b;!isAndLiebao&&!isIos&&(c["Fish-RawUrl"]=a);return c},checkRandCode:function(a,b,c,d,e){var f=cn12306.getFullUri("passcodeNew/checkRandCodeAnsyn");e=cn12306.getFullUri(e);var g=cn12306.getHeaders(f,e);$.ajax({type:"POST",url:cn12306.getAjaxUrl(f),data:{randCode:b,rand:a},dataType:"json",refer:e,headers:g,success:function(a){"function"==typeof c&&c(a)},error:function(a,b){"function"==typeof d&&d(a,b)}})},isUserLogined:function(a,
b,c){cn12306.ajax({url:"login/checkUser",data:{_json_att:""},refer:"leftTicket/init",success:function(c){c&&c.data&&c.data.flag?(c.attributes&&(sessionStorage.useratts=c.attributes),"function"==typeof a&&a()):"function"==typeof b&&b()},error:function(a,b){"function"==typeof c&&c()}})},ajax:function(a){var b={type:"POST",dataType:"json"};$.extend(b,a||{});b.headers=cn12306.getHeaders(b.url,b.refer);"undefined"!=typeof b.url&&(b.url=cn12306.getAjaxUrl(cn12306.getFullUri(b.url)));"undefined"!=typeof b.refer&&
(b.refer=cn12306.getAjaxUrl(b.refer));$.ajax(b)}};(function(a){function b(a){this.date=a||new Date;var b=0,d=0,e=(this.date-f)/864E5;this.daycyl=e+40;this.moncyl=14;for(a=1900;2050>a&&0<e;a++){b=void 0;d=348;for(b=32768;8<b;b>>=1)d+=c[a-1900]&b?1:0;d+=c[a-1900]&15?c[a-1900]&65536?30:29:0;e-=d;this.moncyl+=12}0>e&&(e+=d,a--,this.moncyl-=12);this.year=a;this.yearcyl=a-1864;b=c[a-1900]&15;this.isleap=!1;for(a=1;13>a&&0<e;a++)0<b&&a==b+1&&!1==this.isleap?(--a,this.isleap=!0,d=c[this.year-1900]&15?c[this.year-1900]&65536?30:29:0):d=c[this.year-1900]&
65536>>a?30:29,!0==this.isleap&&a==b+1&&(this.isleap=!1),e-=d,!1==this.isleap&&this.moncyl++;0==e&&(0<b&&a==b+1)&&(this.isleap?this.isleap=!1:(this.isleap=!0,--a,--this.moncyl));0>e&&(e+=d,--a,--this.moncyl);this.month=a;this.day=e+1}var c=[19416,19168,42352,21717,53856,55632,91476,22176,39632,21970,19168,42422,42192,53840,119381,46400,54944,44450,38320,84343,18800,42160,46261,27216,27968,109396,11104,38256,21234,18800,25958,54432,59984,28309,23248,11104,100067,37600,116951,51536,54432,120998,46416,
2014-08-19 16:11:37 +08:00
22176,107956,9680,37584,53938,43344,46423,27808,46416,86869,19872,42448,83315,21200,43432,59728,27296,44710,43856,19296,43748,42352,21088,62051,55632,23383,22176,38608,19925,19152,42192,54484,53840,54616,46400,46496,103846,38320,18864,43380,42160,45690,27216,27968,44870,43872,38256,19189,18800,25776,29859,59984,27480,21952,43872,38613,37600,51552,55636,54432,55888,30034,22176,43959,9680,37584,51893,43344,46240,47780,44368,21977,19360,42416,86390,21168,43312,31060,27296,44368,23378,19296,42726,42208,
2014-08-21 13:42:42 +08:00
53856,60005,54576,23200,30371,38608,19415,19152,42192,118966,53840,54560,56645,46496,22224,21938,18864,42359,42160,43600,111189,27936,44448],d="\u65e5\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d\u5341".split(""),e=["\u521d","\u5341","\u5eff","\u5345","\u3000"],f=new Date(1900,0,31);b.prototype.getLunarMonth=function(){var a="",a=10<this.month?a+("\u5341"+d[this.month-10]):a+d[this.month],a=a+"\u6708";"\u5341\u4e8c\u6708"==a?a="\u814a\u6708":"\u4e00\u6708"==a&&(a="\u6b63\u6708");return a};
b.prototype.getLunarDay=function(){var a="";switch(this.day){case 10:a+="\u521d\u5341";break;case 20:a+="\u4e8c\u5341";break;case 30:a+="\u4e09\u5341";break;default:a+=e[Math.floor(this.day/10)],a+=d[Math.floor(this.day%10)]}return a};b.prototype.getLunar=function(){return this.getLunarMonth()+this.getLunarDay()};b.prototype.getMOD=function(){var a=this.getLunarDay();"\u521d\u4e00"==a&&(a=this.getLunarMonth());return a};a.LunarCalendar=b})(window);function DateComponent(a){var b={_TODAY:(new Date).date,wrap:$("#date"),tdHtml:'<td><a href="javascript:;" class="$class$$isCheckClass$" data-time="$time$">$day$<span class="lunar">$lunar$</span></a></td>',curDate:(new Date).date,startDate:(new Date).date,minDate:(new Date).date,maxDate:(new Date).date.addDays(19),arr:[]};$.extend(this,b);"object"==typeof a&&$.extend(this,a);this.fd=this.curDate.format("yyyy\u5e74 MM\u6708");this.pageCurDate=new Date(this.curDate.getFullYear(),this.curDate.getMonth(),
2014-08-19 16:11:37 +08:00
1,0,0,0);this.pageCurMonth=this.curDate.getMonth();this.generateArray();this.setHtml()}
2014-08-21 13:42:42 +08:00
DateComponent.prototype.generateArray=function(){var a=this.pageCurMonth,b=this.pageCurDate,c=b.getDay(),d=b.date.getTime(),e=[],f=this.minDate.date.getTime(),g=this.maxDate.date.getTime();do e.push({year:b.getFullYear(),month:b.getMonth()+1,day:b.getDate(),format:b.format("yyyy/MM/dd"),time:b.date.getTime(),"class":b.isToday?" today"+(this.curDate.date.getTime()==b.date.getTime()?" cur":""):this.curDate.date.getTime()==b.date.getTime()?" cur":"",isCheckClass:d<f?" disable":d>g?" remind":"",lunar:(new LunarCalendar(b)).getMOD()}),
b=new Date(b.getTime()+864E5),d=b.date.getTime();while(a==b.getMonth());for(a=b.getDay();7>a&&0!=a;a++)e.push({year:b.getFullYear(),month:b.getMonth()+1,day:b.getDate(),format:b.format("yyyy/MM/dd"),time:b.date.getTime(),"class":b.isToday?" today"+(this.curDate.date.getTime()==b.date.getTime()?" cur":""):this.curDate.date.getTime()==b.date.getTime()?" cur":"",isCheckClass:d<f?" disable":d>g?" remind":"",lunar:(new LunarCalendar(b)).getMOD()}),b=new Date(b.getTime()+864E5),d=b.date.getTime();a=c;b=
new Date((new Date(this.pageCurDate.getFullYear(),this.pageCurDate.getMonth(),1,0,0,0)).getTime()-864E5);for(d=b.date.getTime();0<a;a--)e.unshift({year:b.getFullYear(),month:b.getMonth()+1,day:b.getDate(),format:b.format("yyyy/MM/dd"),time:b.date.getTime(),"class":b.isToday?" today"+(this.curDate.date.getTime()==b.date.getTime()?" cur":""):this.curDate.date.getTime()==b.date.getTime()?" cur":"",isCheckClass:d<f?" disable":d>g?" remind":"",lunar:(new LunarCalendar(b)).getMOD()}),b=new Date(b.getTime()-
864E5),d=b.date.getTime();this.arr=e};
2014-08-19 16:11:37 +08:00
DateComponent.prototype.setHtml=function(){for(var a='<div class="date_title"><span class="date_prev"><i class="icon icon_left"></i></span>'+this.fd+'<span class="date_next"><i class="icon icon_right"></i></span></div><table class="date_component"><tr><th>\u65e5</th><th>\u4e00</th><th>\u4e8c</th><th>\u4e09</th><th>\u56db</th><th>\u4e94</th><th>\u516d</th></tr><tr>',b=0,c=this.arr.length;b<c;b++)0!=b&&0==b%7&&(a+="</tr><tr>"),a+=this.tdHtml.temp(this.arr[b]);this.wrap.html(a+"</tr></table>");this.bindDomEvent()};
DateComponent.prototype.bindDomEvent=function(){var a=this;$("table a",a.wrap).on("click",function(b){b=new Date(parseInt($(this).attr("data-time")));a.minDate.date.getTime();a.maxDate.date.getTime();if(!$(this).hasClass("cur")){if(b.getTime()<a._TODAY.date.getTime())return!1;a.pageCurMonth==b.getMonth()?($("table a",a.wrap).removeClass("cur"),$(this).addClass("cur"),a.curDate=b):(a.curDate=b,a.startDate=b,a.pageCurDate=new Date(a.curDate.getFullYear(),a.curDate.getMonth(),1,0,0,0),a.pageCurMonth=
a.curDate.getMonth(),a.fd=a.curDate.format("yyyy\u5e74 MM\u6708"),a.generateArray(),a.setHtml())}a.checkCallback&&a.checkCallback(b)});$(".date_prev,.date_next",a.wrap).on("click",function(b){$(this).hasClass("date_prev")?a.monthPrev():a.monthNext()})};DateComponent.prototype.setBasic=function(){this.fd=this.pageCurDate.format("yyyy\u5e74 MM\u6708");this.generateArray();this.setHtml()};
2014-08-21 13:42:42 +08:00
DateComponent.prototype.setCurDate=function(a){if(a.date.getTime()<this._TODAY.date.getTime()||a.date.getTime()>this.maxDate.date.getTime())return this.curDate;this.curDate=a;this.pageCurMonth=a.getMonth();this.pageCurDate=new Date(a.getFullYear(),this.pageCurMonth,1,0,0,0);this.setBasic()};
2014-08-19 16:11:37 +08:00
DateComponent.prototype.monthPrev=function(){var a=this.pageCurMonth-1,b;0>a?(a=11,b=new Date(this.pageCurDate.getFullYear()-1,a,1,0,0,0)):b=new Date(this.pageCurDate.getFullYear(),a,1,0,0,0);if(b.getTime()<(new Date(this._TODAY.getFullYear(),this._TODAY.getMonth(),1,0,0,0)).getTime())return!1;this.pageCurMonth=a;this.pageCurDate=b;this.setBasic()};
DateComponent.prototype.monthNext=function(){this.pageCurMonth++;11<this.pageCurMonth?(this.pageCurMonth=0,this.pageCurDate=new Date(this.pageCurDate.getFullYear()+1,this.pageCurMonth,1,0,0,0)):this.pageCurDate=new Date(this.pageCurDate.getFullYear(),this.pageCurMonth,1,0,0,0);this.setBasic()};
DateComponent.prototype.dayPrev=function(){var a=new Date(this.curDate.getTime()-864E5);if(a.date.getTime()<this._TODAY.date.getTime())return this.curDate;this.curDate=a;this.pageCurDate=new Date(this.curDate.getFullYear(),this.curDate.getMonth(),1,0,0,0);this.pageCurMonth=this.pageCurDate.getMonth();this.setBasic();return this.curDate};
DateComponent.prototype.dayNext=function(){var a=new Date(this.curDate.getTime()+864E5);if(a.date.getTime()>this.maxDate.date.getTime())return this.curDate;this.curDate=a;this.pageCurDate=new Date(this.curDate.getFullYear(),this.curDate.getMonth(),1,0,0,0);this.pageCurMonth=this.pageCurDate.getMonth();this.setBasic();return this.curDate};DateComponent.prototype.setSection=function(a,b){this.minDate=a;this.maxDate=this.minDate.addDays(b)};
2014-08-21 13:42:42 +08:00
DateComponent.prototype.setMinDay=function(a){this.minDate=a};DateComponent.prototype.setMaxDay=function(a){this.maxDate=a};var CheckStaion={runing:!1,objs:{a:[],b:[],c:[],d:[],e:[],f:[],g:[],h:[],i:[],j:[],k:[],l:[],m:[],n:[],o:[],p:[],q:[],r:[],s:[],t:[],u:[],v:[],w:[],x:[],y:[],z:[]},objsZh:{},hotList:[],callback:null,init:function(){if(CheckStaion.runing)return!1;CheckStaion.runing=!0;CheckStaion.formatStation();CheckStaion.setHtml();CheckStaion.bindEvent()},formatStation:function(){CheckStaion.names=WIN.station_names.substr(1);CheckStaion.stationList=CheckStaion.names.split("@");for(var a="",b=[],c=0;c<CheckStaion.stationList.length;c++)a=
CheckStaion.stationList[c][0].toLowerCase(),CheckStaion.objs[a]||(CheckStaion.objs[a]=[]),b=CheckStaion.stationList[c].split("|"),CheckStaion.objs[a].push(b),a=b[1][0],CheckStaion.objsZh[a]||(CheckStaion.objsZh[a]=[]),CheckStaion.objsZh[a].push(b);CheckStaion.hotList=WIN.favorite_names.substr(1).split("@")},setHtml:function(){var a='<div class="fixed_box" id="search_station"><header class="header"><div class="search_box"><a href="javascript:;" class="search_cancel" id="station_cancel">\u53d6\u6d88</a><div class="search_ipt"><input type="search" name="" placeholder="\u641c\u7d22\u8f66\u7ad9" id="station_search" class="search_input" autocomplete="off"><i class="icon_remove_s"></i></div></div></header>';
if(0<CheckStaion.hotList.length){for(var b=[],a=a+'<div class="form_title">\u70ed\u95e8</div><div class="box"><ul class="station_list">',c=0,d=CheckStaion.hotList.length;c<d;c++)b=CheckStaion.hotList[c].split("|"),a+='<li><a href="javascript:;" title="'+b[1]+'" data-code="'+b[2]+'">'+b[1]+"</a></li>";a+='</ul></div><div class="suggest" id="station_suggest"><ul></ul></div></div>'}$("body").append(a)},show:function(){$("#search_station").addClass("fixed_box_show")},hide:function(){$("#search_station").removeClass("fixed_box_show")},
bindEvent:function(){$("#station_cancel").on("click",function(){CheckStaion.hide();CheckStaion.cancelCallback&&CheckStaion.cancelCallback()});$("#station_search").on("input",function(){var a=$(this).val();$.trim(a)?CheckStaion.showSuggest(CheckStaion.searchKey($.trim(a).toLowerCase())):($("#station_suggest ul").html(""),$("#station_suggest").hide())});$("#search_station [data-code]").live("click",function(a,b){var c=$(this).attr("title"),d=$(this).attr("data-code");CheckStaion.callback&&CheckStaion.callback(c,
d);$("#station_suggest ul").html("");$("#station_suggest").hide();$("#station_search").val("")})},showSuggest:function(a){if(!a||0==a.length)$("#station_suggest ul").html(""),$("#station_suggest").hide();else{for(var b="",c=0,d=a.length;c<d;c++)b+='<li><a href="javascript:;" title="'+a[c][1]+'" data-code="'+a[c][2]+'">'+a[c][1]+"</a></li>";$("#station_suggest ul").html(b);$("#station_suggest").show()}},getSuggestList:function(a){return!a?[]:/^[\u4E00-\u9FA5]+$/.test(a[0])?CheckStaion.searchKeyZh(a):
CheckStaion.searchKey(a)},searchKey:function(a){if(!CheckStaion.objs[a[0]])return[];var b=CheckStaion.objs[a[0]],c=[],c=[],d=[],e=[];if(0==a.length)return b;for(var f=0,g=b.length;f<g;f++)-1!=b[f][4].indexOf(a)?b[f][4]==a?c.unshift(b[f]):c.push(b[f]):-1!=b[f][3].indexOf(a)?b[f][3]==a?d.unshift(b[f]):d.push(b[f]):-1!=b[f][0].indexOf(a)&&(b[f][0]==a?e.unshift(b[f]):e.push(b[f]));return c=c.sort(CheckStaion.sort).concat(d.sort(CheckStaion.sort),e.sort(CheckStaion.sort))},searchKeyZh:function(a){if(!CheckStaion.objsZh[a[0]])return[];
var b=CheckStaion.objsZh[a[0]],c=[];if(1==a.length)return b;for(var d=0,e=b.length;d<e;d++)-1!=b[d][1].indexOf(a)&&c.push(b[d]);return c.sort(CheckStaion.sort)},sort:function(a,b){return parseInt(a[5])>parseInt(b[5])?1:-1}};var Login={init:function(){if(0!=$("#login_page").length){var a=new Date;$("#interval").html(a.format("M\u6708dd\u65e5")+"-"+a.addDays(19).format("M\u6708d\u65e5"));Login.recode();$("#randcodeimg").click(function(a){Login.recode();return!1});$("#randcode").keyup(function(){this.value=this.value.replace(/[^0-9a-zA-Z]/g,"")});$("#loginForm").submit(function(a){var c={username:$("[name=username]",this).val(),password:$("[name=password]",this).val(),randcode:$("[name=randcode]",this).val()};if(c.username)if(c.password){if(!c.randcode)return Public.toast("\u8bf7\u8f93\u5165\u9a8c\u8bc1\u7801"),
!1}else return Public.toast("\u8bf7\u8f93\u5165\u767b\u5f55\u5bc6\u7801"),!1;else return Public.toast("\u8bf7\u8f93\u5165\u7528\u6237\u540d"),!1;Login.formData=c;SKIPVC?Login.submitLogin():Login.getRandCode();a.preventDefault();return!1});localStorage.getItem("useraccount")&&(Login.formData=JSON.parse(localStorage.getItem("useraccount")),$("#loginForm [name=username]").val(Login.formData.username),$("#loginForm [name=password]").val(Login.formData.password),cn12306.isUserLogined(function(){sessionStorage.setItem("user",
Login.formData.username);Public.toast("\u767b\u5f55\u6210\u529f\uff0c\u6b63\u5728\u8fdb\u5165\u8ba2\u7968\u9875\u9762\uff0c\u8bf7\u7a0d\u7b49 \u2764");setTimeout(function(){location.href="query.html"},1E3)}))}},recode:function(){$("#randcodeimg").attr("src",$("#randcodeimg").attr("data-loading"));$("#randcode").html("").focus();cn12306.loadRandCode("sjrand",function(a){$("#randcodeimg").attr("src",a)})},getRandCode:function(){cn12306.checkRandCode("sjrand",Login.formData.randcode,function(a){"Y"!==
a.data?(Login.recode(),Public.toast("\u9a8c\u8bc1\u7801\u4e0d\u6b63\u786e\uff01")):Login.submitLogin(a)},function(a,b){Login.recode();Public.toast("\u6821\u9a8c\u9a8c\u8bc1\u7801\u5931\u8d25")},"login/init")},formData:null,submitLogin:function(){cn12306.ajax({url:"login/loginAysnSuggest",data:{"loginUserDTO.user_name":Login.formData.username,"userDTO.password":Login.formData.password,randCode:Login.formData.randcode},refer:"login/init",success:function(a){a&&a.data&&"Y"===a.data.loginCheck?Login.userPostLogin():
(a=(a.messages||["\u672a\u77e5\u9519\u8bef"]).join(";"),Login.recode(),-1!=a.indexOf("\u767b\u5f55\u540d")?($("#username").focus(),Public.toast("\u7528\u6237\u540d\u8f93\u5165\u9519\u8bef\u3002")):-1!=a.indexOf("\u9a8c\u8bc1\u7801")?($("#randcode").focus(),Public.toast("\u9a8c\u8bc1\u7801\u4e0d\u6b63\u786e\u3002")):-1!=a.indexOf("\u90ae\u7bb1")?($("#username").focus(),Public.toast("\u90ae\u7bb1\u8f93\u5165\u9519\u8bef\u3002")):-1<a.indexOf("\u5bc6\u7801")?($("#password").val("").focus(),Public.toast("\u5bc6\u7801\u4e0d\u6b63\u786e\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002",
2E3)):-1<a.indexOf("\u9501\u5b9a")?ui.postMessage(!1,"\u60a8\u7684\u8d26\u6237\u5df2\u7ecf\u88ab\u9501\u5b9a\uff0c\u8bf7\u7a0d\u540e\u518d\u8bd5\u3002","login"):-1!==a.indexOf("\u7cfb\u7edf\u7ef4\u62a4")?Public.toast("\u7cfb\u7edf\u7ef4\u62a4\u4e2d"):Public.toast("\u672a\u77e5\u9519\u8bef"))},error:function(a,b){403==a.status?Public.alert("\u8b66\u544a\uff01\u60a8\u7684IP\u5df2\u7ecf\u88ab\u5c01\u9501\uff0c\u8bf7\u91cd\u8bd5"):Public.alert("\u767b\u5f55\u65f6\u7f51\u7edc\u9519\u8bef")}})},userPostLogin:function(){cn12306.getHeaders("login/userLogin",
"login/init");cn12306.ajax({url:"login/userLogin",dataType:"text",refer:"login/init",success:function(){Login.checkJsonAttr()},error:function(a,b){Login.checkJsonAttr()}})},checkJsonAttr:function(a){a=Login.formData;cn12306.isUserLogined(function(){sessionStorage.setItem("user",a.username);localStorage.setItem("useraccount",JSON.stringify(a));Public.toast("\u767b\u5f55\u6210\u529f\uff0c\u6b63\u5728\u8fdb\u5165\u8ba2\u7968\u9875\u9762\uff0c\u8bf7\u7a0d\u7b49 \u2764");setTimeout(function(){location.href=
"query.html"},1E3)},function(){Public.toast("\u672a\u80fd\u6210\u529f\u767b\u5f55\uff0c\u8bf7\u91cd\u8bd5\u3002")},function(){Public.toast("\u767b\u5f55\u65f6\u7f51\u7edc\u9519\u8bef")})}};var Query={calendar:null,init:function(){if(0!=$("#query_page").length){Query.checkLogin();var a=(new Date).addDays(19);Public.setDate(a);$("#menu_btn").on("click",function(){$("#user_menu").toggle()});$("#user_menu").on("click",function(a){"user_menu"==$(a.target).attr("id")&&$("#user_menu").hide()});$("#open_filter").on("click",function(){Public.showInnerPage("filter")});$("#filter_cancel").on("click",function(){Public.hideInnerPage("filter");var a=$("#query_form [name=filters]").val().split("&");
Query.setFilter(a)});$("#filter_ok").on("click",function(){Public.hideInnerPage("filter");$("#query_form [name=filters]").val($("#filter_form").serialize())});CheckStaion.init();Query.stationInt();$("#query_form [name=filters]").val($("#filter_form").serialize());$("#query_form").on("submit",function(){var a=$("#startStationCode").val(),c=$("#endStationCode").val();if(""==a)return Public.alert("\u8bf7\u9009\u62e9\u51fa\u53d1\u7ad9"),!1;if(""==c)return Public.alert("\u8bf7\u9009\u62e9\u5230\u8fbe\u7ad9"),
!1;if(a==c)return Public.alert("\u51fa\u53d1\u5730\u548c\u76ee\u7684\u5730\u4e0d\u80fd\u76f8\u540c"),!1;var d=$("#query_form").serialize();Public.setHisQuery(a+"-"+c,d);window.location.href="run_query.html";return!1});Query.setHisQuery()}},setHisQuery:function(){var a=Public.his.querys,b,c;if(0==Public.his.querys.length)return!1;b='<div class="his_title">\u6700\u8fd1\u67e5\u627e</div><ul class="list his_list">';for(var d=0,e=a.length;d<e;d++)c=Public.his.queryObjs[a[d][0]],b+='<li><a href="javascript:;" data-key="'+
a[d][0]+'"><span>'+c.startname+"</span><span>"+c.endname+"</span></a></li>";$("#hisQuery").html(b+"</ul>");$("#hisQuery [data-key]").on("click",function(){var a=$(this).attr("data-key");a&&Public.his.queryObjs[a]&&Query.newQuery(Public.his.queryObjs[a])});Query.newQuery(Public.his.queryObjs[$("#hisQuery [data-key]:eq(0)").attr("data-key")])},newQuery:function(a){var b;$("#query_form [type=checkbox],#query_form [type=radio]").prop("checked",!1);for(var c in a)b=$("#query_form [name="+c+"]"),1<b.length?
$('#query_form [name="'+c+'"][value="'+a[c]+'"]').prop("checked",!0):(b.val(a[c]),"startname"==c?$("#startStation").html(a[c]):"endname"==c?$("#endStation").html(a[c]):"start_date"==c&&(b=new Date(a[c].replace(/\-/g,"/")),$("#start_date").html(b.format("yyyy\u5e74M\u6708d\u65e5")+" "+b.day(3)),Public.calendar.setCurDate(b)));a=$("#query_form [name=filters]").val().split("&");Query.setFilter(a)},setFilter:function(a){var b=[],c;$("#filter_form [type=checkbox],#filter_form [type=radio]").prop("checked",
!1);for(var d=0;d<a.length;d++)b=a[d].split("="),b[1]=decodeURIComponent(b[1]),c=$('#filter_form [name="'+b[0]+'"][value="'+b[1]+'"]'),"train_type"==b[0]||"train_seat"==b[0]?c.prop("checked",!0):"timeslot"==b[0]&&(c.prop("checked",!0),c.closest(".query_box").find("label").removeClass("query_bigcheck_checked"),c.closest("label").addClass("query_bigcheck_checked"))},checkNum:0,checkLogin:function(){Query.checkNum++;cn12306.isUserLogined(Query.hasLogin,Query.noLogin,function(){Query.noLogin();2>Query.checkNum&&
Query.checkLogin()})},hasLogin:function(){$("#login").attr("href","javascript:;").attr("data-fn","loginout").html("\u9000\u51fa");$("body").removeClass("nologin");$("#menu_btn .icon_user").addClass("icon_user2");$("#login_tip").hide()},noLogin:function(){$("#login").attr("href","/12306/login.html").attr("data-fn","login").html("\u767b\u5f55");$("body").addClass("nologin");$("#menu_btn .icon_user").removeClass("icon_user2");$("#login_tip").show()},stationInt:function(){$("#startStation").on("click",
function(){CheckStaion.callback=Query.startCallback;CheckStaion.cancelCallback=Query.cancelCallback;CheckStaion.show();$("#wrap").hide()});$("#endStation").on("click",function(){CheckStaion.callback=Query.endCallback;CheckStaion.cancelCallback=Query.cancelCallback;CheckStaion.show();$("#wrap").hide()});$("#exchange").on("click",function(){var a=$("#startStationName").val(),b=$("#startStationCode").val(),c=$("#endStationName").val(),d=$("#endStationCode").val();$("#startStationName").val(c);$("#startStationCode").val(d);
$("#endStationName").val(a);$("#endStationCode").val(b);a?$("#endStation").html(a):$("#endStation").html("\u5230\u8fbe\u7ad9");c?$("#startStation").html(c):$("#startStation").html("\u51fa\u53d1\u7ad9")})},startCallback:function(a,b){$("#startStation").html(a);$("#startStationName").val(a);$("#startStationCode").val(b);CheckStaion.hide();$("#wrap").show()},endCallback:function(a,b){$("#endStation").html(a);$("#endStationName").val(a);$("#endStationCode").val(b);CheckStaion.hide();$("#wrap").show()},
cancelCallback:function(){$("#wrap").show()}};var RunQuery={init:function(){if(0==$("#runquery_page").length)return!1;var a=(new Date).addDays(19);Public.formatString="M\u6708d\u65e5";Public.setDate(a);RunQuery.getQueryData();if(!RunQuery.curData)return window.location.href="query.html",!1;RunQuery.checkLogin();RunQuery.setFilter();$("#filter_btn").on("click",function(){Public.showInnerPage("filter")});$("#filter_cancel").on("click",function(){Public.hideInnerPage()});RunQuery.queryTicket()},curData:null,getQueryData:function(){Public.his.queryObjs[Public.his.querys[0][0]]&&
(RunQuery.curData=Public.his.queryObjs[Public.his.querys[0][0]])},setFilter:function(){Query.setFilter(RunQuery.curData.filters.split("&"));$(".station_title strong").html(RunQuery.curData.startname+"\u2192"+RunQuery.curData.endname)},isLogin:!1,checkNum:0,checkLogin:function(){RunQuery.checkNum++;cn12306.isUserLogined(RunQuery.hasLogin,RunQuery.noLogin,function(){RunQuery.noLogin();2>RunQuery.checkNum&&RunQuery.checkLogin()})},hasLogin:function(){RunQuery.isLogin=!0;$("body").removeClass("nologin");
$("#login_tip").hide()},noLogin:function(){RunQuery.isLogin=!1;$("body").addClass("nologin");$("#login_tip").show()},queryTicket:function(){cn12306.ajax({type:"GET",url:"leftTicket/query",data:{"leftTicketDTO.train_date":RunQuery.curData.start_date,"leftTicketDTO.from_station":RunQuery.curData.startcode,"leftTicketDTO.to_station":RunQuery.curData.endcode,purpose_codes:"2"==RunQuery.curData.type?"0X00":"ADULT"},refer:"leftTicket/init",success:function(a){!0==a.status&&200==a.httpstatus&&0<a.data.length&&
(RunQuery.formatJson(a),RunQuery.formatList())},error:function(a,b){console.log(a,b)}})},formatList:function(){var a=RunQuery.trainData.trainMap,b="",c={},d;for(d in a)if(a[d].available){c=a[d];b+="<li>";b+='<div class="line no_border">';b+='<strong class="pull_right text_underline text_lg" data-id="'+c.code+'">'+c.code+"</strong>";b+='<strong class="text_warning text_lg link_label">'+c.from.time+"</strong>";b+='<span class="text_lg">';c.from.code==c.start.code&&(b+='<i class="text_label">\u59cb</i>');
b+=c.from.name+"</span>";b+="</div>";b+='<div class="line">';ls=c.elapsedTime.total.split(":");b+='<span class="pull_right text_gray">'+(ls[0]?ls[0]+"\u5c0f\u65f6":"")+(ls[1]?ls[1]+"\u5206":"0\u5206")+"</span>";b+='<span class="text_lg link_label">';b+=c.to.time+"</span>";b+='<span class="text_lg">';c.to.code==c.end.code&&(b+='<i class="text_label">\u7ec8</i>');for(var b=b+(c.to.name+"</span>"),b=b+"</div>",e=0;e<c.ticketMapSort.length;e++)c.ticketMapSort[e],0!=c.ticketMapSort[e].count&&(b+='<div class="line"><span class="pull_right">',
"\u6709"==c.ticketMapSort[e].count?b+='<span class="text_warning">\u6709</span>':(b+='<span class="text_warning">'+c.ticketMapSort[e].count+"</span>",b+='<span class="text_gray">\u5f20</span>'),b+='<a href="javascript:;" class="btn btn_success">\u62a2\u7968</a>',b+="</span>",b+='<span class="link_label">'+c.ticketMapSort[e].name+"</span>",b+='<span class="text_gray">'+c.ticketMapSort[e].price/10+"\u5143</span>",b+="</div>");b+="</li>"}$("#train_list").html(b);$(".station_title span").html("\u5171&nbsp;"+
$("#train_list li").length+"&nbsp;\u8d9f\u5217\u8f66")},getTicketInfo:function(a){var b=[];a=(-1===a.indexOf("#")?a:/getSelected\(['"](.*?)['"]\)/i.exec(a)[1].split("#")[11]).match(/([A-Z\d])0*?([\*\d]{5})0*?(\d{4})/gi);for(var c in a){var d=/([A-Z\d])0*?([\*\d]{5})0*?(\d{4})/i.exec(a[c]),e=d[1],f="*"==d[2][0]?null:parseInt(d[2],10),d=parseInt(d[3],10),g={code:e,name:Util.toSeatTypeName(e),price:f};3E3>d?(g.count=d,"7"===e?b.push({code:"M",name:Util.toSeatTypeName("M"),price:f,count:d}):"8"===e?b.push({code:"O",
name:Util.toSeatTypeName("O"),price:f,count:d}):b.push(g)):(g.count=d-3E3,g.code="0",g.name="\u65e0\u5ea7",b.push(g))}return b},trainData:null,formatJson:function(a){if(!Array.isArray(a.data)&&!a.data.length)return null;for(var b=a.data,c,d={raw:a,rawTrainMap:{},trainMap:{},auto:null,nextTime:null},e=0;e<b.length;e++){t=b[e];a={id:t.queryLeftNewDTO.train_no,code:t.queryLeftNewDTO.station_train_code,available:"Y"===t.queryLeftNewDTO.canWebBuy?1:0,start:{code:t.queryLeftNewDTO.start_station_telecode,
name:t.queryLeftNewDTO.start_station_name},from:{code:t.queryLeftNewDTO.from_station_telecode,fromStationNo:t.queryLeftNewDTO.from_station_no,name:t.queryLeftNewDTO.from_station_name,endpoint:t.queryLeftNewDTO.from_station_telecode==t.queryLeftNewDTO.start_station_telecode,time:t.queryLeftNewDTO.start_time},to:{code:t.queryLeftNewDTO.to_station_telecode,toStationNo:t.queryLeftNewDTO.to_station_no,name:t.queryLeftNewDTO.to_station_name,endpoint:t.queryLeftNewDTO.end_station_telecode==t.queryLeftNewDTO.to_station_telecode,
time:t.queryLeftNewDTO.arrive_time},elapsedTime:{days:t.queryLeftNewDTO.day_difference,total:t.queryLeftNewDTO.lishi},end:{code:t.queryLeftNewDTO.end_station_telecode,name:t.queryLeftNewDTO.end_station_name},ypinfo:t.queryLeftNewDTO.yp_info,ypinfo_ex:t.queryLeftNewDTO.yp_ex,locationCode:t.queryLeftNewDTO.location_code,controlDay:t.queryLeftNewDTO.control_day,supportCard:t.queryLeftNewDTO.is_support_card,saleTime:t.queryLeftNewDTO.sale_time,secureStr:t.secretStr,selltime:null,date:t.queryLeftNewDTO.start_train_date.replace(/(\d{4})(\d{2})(\d{2})/,
"$1-$2-$3"),limitSellInfo:t.buttonTextInfo&&-1!=t.buttonTextInfo.indexOf("\u6682\u552e")?t.buttonTextInfo.replace(/<[^>]+>/i,""):null};c=RunQuery.getTicketInfo(t.queryLeftNewDTO.yp_info);a.tickets=c;a.ticketMap=Util.mapObject(c,function(a){return a.code});a.ticketMapSort=Util.sortType(a.ticketMap);if(c=/(0*(\d+)\u67080*(\d+)\u65e5)?(\d+)\s*\u70b9\s*((\d+)\u5206)?\s*\u8d77\u552e/i.exec(t.buttonTextInfo.replace(/<.*?>/g,"")))a.available=-1,a.selltime=new Date,a.selltime.setHours(parseInt(c[4])),a.selltime.setMinutes(parseInt(c[6]||
"0",10)),a.selltime.setSeconds(0),c[1]&&(a.selltime.setMonth(parseInt(c[2])-1),a.selltime.setDate(parseInt(c[3])),a.selltime.getMonth()<(new Date).getMonth()&&a.selltime.setFullYear(a.selltime.getFullYear()+1));d.rawTrainMap[a.id]=t;d.trainMap[a.id]=a}RunQuery.trainData=d}};$().ready(function(){Public.init();Login.init();Query.init();RunQuery.init()});