").append(b.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){b.fn[t]=function(e){return this.on(t,e)}}),b.each(["get","post"],function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Nn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Mn(Mn(e,b.ajaxSettings),t):Mn(b.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,u,l,c,p=b.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?b(f):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=p.statusCode||{},y={},v={},x=0,T="canceled",N={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else N.always(e[N.status]);return this},abort:function(e){var t=e||T;return l&&l.abort(t),k(0,t),this}};if(h.promise(N).complete=g.add,N.success=N.done,N.error=N.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=b.trim(p.dataType||"*").toLowerCase().match(w)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?80:443))==(mn[3]||("http:"===mn[1]?80:443)))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=b.param(p.data,p.traditional)),qn(An,p,n,N),2===x)return N;u=p.global,u&&0===b.active++&&b.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Cn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(b.lastModified[o]&&N.setRequestHeader("If-Modified-Since",b.lastModified[o]),b.etag[o]&&N.setRequestHeader("If-None-Match",b.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&N.setRequestHeader("Content-Type",p.contentType),N.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)N.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,N,p)===!1||2===x))return N.abort();T="abort";for(i in{success:1,error:1,complete:1})N[i](p[i]);if(l=qn(jn,p,n,N)){N.readyState=1,u&&d.trigger("ajaxSend",[N,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){N.abort("timeout")},p.timeout));try{x=1,l.send(y,k)}catch(C){if(!(2>x))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t,a=i||"",N.readyState=e>0?4:0,r&&(w=_n(p,N,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=N.getResponseHeader("Last-Modified"),T&&(b.lastModified[o]=T),T=N.getResponseHeader("etag"),T&&(b.etag[o]=T)),204===e?(c=!0,C="nocontent"):304===e?(c=!0,C="notmodified"):(c=Fn(p,w),C=c.state,y=c.data,v=c.error,c=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),N.status=e,N.statusText=(n||C)+"",c?h.resolveWith(f,[y,C,N]):h.rejectWith(f,[N,C,v]),N.statusCode(m),m=t,u&&d.trigger(c?"ajaxSuccess":"ajaxError",[N,p,c?y:v]),g.fireWith(f,[N,C]),u&&(d.trigger("ajaxComplete",[N,p]),--b.active||b.event.trigger("ajaxStop")))}return N},getScript:function(e,n){return b.get(e,t,n,"script")},getJSON:function(e,t,n){return b.get(e,t,n,"json")}});function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFields;for(s in c)s in r&&(n[c[s]]=r[s]);while("*"===l[0])l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in u)if(u[s]&&u[s].test(o)){l.unshift(s);break}if(l[0]in r)a=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u[1])for(i in e.converters)a[i.toLowerCase()]=e.converters[i];for(;r=u[++s];)if("*"!==r){if("*"!==l&&l!==r){if(i=a[l+" "+r]||a["* "+r],!i)for(n in a)if(o=n.split(" "),o[1]===r&&(i=a[l+" "+o[0]]||a["* "+o[0]])){i===!0?i=a[n]:a[n]!==!0&&(r=o[0],u.splice(s--,0,r));break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+l+" to "+r}}}l=r}return{state:"success",data:t}}b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),b.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||b("head")[0]||o.documentElement;return{send:function(t,i){n=o.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var On=[],Bn=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=On.pop()||b.expando+"_"+vn++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||b.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,On.push(o)),s&&b.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}b.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=b.ajaxSettings.xhr(),b.support.cors=!!Rn&&"withCredentials"in Rn,Rn=b.support.ajax=!!Rn,Rn&&b.ajaxTransport(function(n){if(!n.crossDomain||b.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=b.noop,$n&&delete Pn[a]),i)4!==u.readyState&&u.abort();else{p={},s=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(p.text=u.responseText);try{c=u.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,l)},n.async?4===u.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},b(e).unload($n)),Pn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+x+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=Yn.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(b.cssNumber[e]?"":"px"),"px"!==r&&s){s=b.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,b.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]),i=0,o=r.length;for(;o>i;i++)if(r[i].call(e,t,n))return})}function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;for(;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(tr(c,l.opts.specialEasing);a>o;o++)if(r=Gn[o].call(l,e,c,l.opts))return r;return Zn(l,c),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e[i],b.isArray(n)&&(o=n[1],n=e[i]=n[0]),i!==r&&(e[r]=n,delete e[i]),a=b.cssHooks[r],a&&"expand"in a){n=a.expand(n),delete e[r];for(i in n)i in e||(e[i]=n[i],t[i]=o)}else t[r]=o}b.Animation=b.extend(er,{tweener:function(e,t){b.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,u,l,c,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&nn(e);n.queue||(c=b._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,p=c.empty.fire,c.empty.fire=function(){c.unqueued||p()}),c.unqueued++,f.always(function(){f.always(function(){c.unqueued--,b.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(b.support.inlineBlockNeedsLayout&&"inline"!==un(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",b.support.shrinkWrapBlocks||f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(i in t)if(a=t[i],Vn.exec(a)){if(delete t[i],u=u||"toggle"===a,a===(m?"hide":"show"))continue;g.push(i)}if(o=g.length){s=b._data(e,"fxshow")||b._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),u&&(s.hidden=!m),m?b(e).show():f.done(function(){b(e).hide()}),f.done(function(){var t;b._removeData(e,"fxshow");for(t in h)b.style(e,t,h[t])});for(i=0;o>i;i++)r=g[i],l=f.createTween(r,m?s[r]:0),h[r]=s[r]||b.style(e,r),r in s||(s[r]=l.start,m&&(l.end=l.start,l.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}b.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?b.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=b.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.each(["toggle","show","hide"],function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),b.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=b.isEmptyObject(e),o=b.speed(t,n,r),a=function(){var t=er(this,b.extend({},e),o);a.finish=function(){t.stop(!0)},(i||b._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=b.timers,a=b._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&b.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=b._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,a=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}b.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=rr.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(Xn=b.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),Xn=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){Un||(Un=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(Un),Un=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,function(t){return e===t.elem}).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){b.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,b.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},b.offset={setOffset:function(e,t,n){var r=b.css(e,"position");"static"===r&&(e.style.position="relative");var i=b(e),o=i.offset(),a=b.css(e,"top"),s=b.css(e,"left"),u=("absolute"===r||"fixed"===r)&&b.inArray("auto",[a,s])>-1,l={},c={},p,f;u?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),b.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(l.top=t.top-o.top+p),null!=t.left&&(l.left=t.left-o.left+f),"using"in t?t.using.call(e,l):i.css(l)}},b.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===b.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(n=e.offset()),n.top+=b.css(e[0],"borderTopWidth",!0),n.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-b.css(r,"marginTop",!0),left:t.left-n.left-b.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||o.documentElement;while(e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position"))e=e.offsetParent;return e||o.documentElement})}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);b.fn[e]=function(i){return b.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?b(a).scrollLeft():o,r?o:b(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}b.each({Height:"height",Width:"width"},function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){b.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return b.access(this,function(n,r,i){var o;return b.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?b.css(n,r,s):b.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=b,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return b})})(window);
6 |
--------------------------------------------------------------------------------
/example/selector-data.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
数据选择组件
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/example/selector.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
数据选择组件
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
224 |
225 |
226 |
227 |
228 |
--------------------------------------------------------------------------------
/gulpfile.js:
--------------------------------------------------------------------------------
1 | var gulp = require('gulp'),
2 | watch = require('gulp-watch'),
3 | rename = require('gulp-rename'),
4 | uglify = require('gulp-uglify'),
5 | livereload = require('gulp-livereload');
6 |
7 | gulp.task('APPDateField', function(){
8 |
9 | var path = './src/',
10 | src = path + 'APPDateField.js';
11 |
12 | gulp.src(src)
13 | .pipe(watch(src))
14 | .pipe(rename("APPDateField.min.js"))
15 | .pipe(uglify({ preserveComments: '!' }))
16 | .pipe(gulp.dest(path))
17 | .pipe(livereload());
18 |
19 | });
20 |
21 | gulp.task('watch', function(){
22 | livereload.listen();
23 |
24 | });
25 |
26 | gulp.task('default', ['APPDateField', 'watch']);
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "APPDatefield",
3 | "version": "2.1.0",
4 | "description": "数据选择、日期选择组件",
5 | "main": "APPDateField.js",
6 | "directories": {
7 | "test": "test"
8 | },
9 | "scripts": {
10 | "test": "echo \"Error: no test specified\" && exit 1"
11 | },
12 | "repository": {
13 | "type": "git",
14 | "url": "git+https://github.com/RodeyManager/APPDatefield.git"
15 | },
16 | "author": "Rodey",
17 | "license": "GPL-3.0",
18 | "bugs": {
19 | "url": "https://github.com/RodeyManager/APPDatefield/issues"
20 | },
21 | "homepage": "https://github.com/RodeyManager/APPDatefield#readme",
22 | "devDependencies": {
23 | "gulp": "^3.9.0",
24 | "gulp-livereload": "^3.8.0",
25 | "gulp-rename": "^1.2.2",
26 | "gulp-uglify": "^1.4.1",
27 | "gulp-watch": "^4.3.5"
28 | },
29 | "keywords": [
30 | "app",
31 | "date",
32 | "select",
33 | "field"
34 | ]
35 | }
36 |
--------------------------------------------------------------------------------
/src/APPDateField.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created with JetBrains WebStorm.
3 | * User: LUOYONG (Rodey -- www.senuu.com)
4 | * Date: 16-6-21
5 | * Time: 下午5:40
6 | */
7 |
8 | ;(function(){
9 |
10 | 'use strict';
11 |
12 | var root = this;
13 | var gVars = {
14 | fontSize: 22,
15 | step: 40,
16 | //模板
17 | tpl: '
'+
18 | '
'+
19 | ' '+
20 | ' '+
21 | ' '+
22 | '
'+
23 | '
'+
24 | '
'+
25 | '
'+
26 | '
'+
27 | '
'+
28 | '
'+
29 | '
'+
30 | '
'
31 | };
32 | function isDefiend(val){ return undefined !== val; }
33 | var isFunction = function(fn){ return 'function' === typeof fn; };
34 | var empty = function(){};
35 | function isEmpty(){}
36 | var toString = Object.prototype.toString;
37 |
38 | /**
39 | * 构建日期选择对象
40 | * @param selectElm
41 | * @param options
42 | * @param complete
43 | * @param cancel
44 | * @constructor
45 | */
46 | var APPDateField = function(selectElm, options, complete, cancel){
47 | options = options || {};
48 | this.selectElm = $('#' + selectElm.replace(/^#/i, ''))[0];
49 | this.appWrap = $('#app-s-con');
50 |
51 | this.loaded = false;
52 | /**
53 | * 完成和取消事件判断
54 | */
55 | this.complete = isFunction(options.complete) ? options.complete : isFunction(complete) ? complete : empty;
56 | this.cancel = isFunction(options.cancel) ? options.cancel : isFunction(cancel) ? cancel : empty;
57 | this.moveEnd = isFunction(options.moveEnd) ? options.moveEnd : empty;
58 | if((options.complete && isDefiend(options.complete) && typeof options.complete === 'function')
59 | || (complete && typeof complete === 'function') ){
60 | this.complete = options.complete || complete || isEmpty;
61 | }
62 | if((options.cancel && isDefiend(options.cancel) && typeof options.cancel === 'function')
63 | || (cancel && typeof cancel === 'function') ){
64 | this.cancel = options.cancel || cancel || isEmpty;
65 | }
66 |
67 | this.step = gVars.step;
68 |
69 | //默认日期,从焦点对象中取值
70 | this.valList = [];
71 | //最后输出日期 (默认的, 你还可以使用对象的 getCurrentDate 方法获取,同时还可以在该方法的参数中设置 year, month, date)
72 | this.currDate = [];
73 |
74 | this.opts = {
75 | year: new Date().getFullYear(),
76 | month: new Date().getMonth() + 1,
77 | date: new Date().getDate(),
78 | hours: new Date().getHours(),
79 | minutes: new Date().getMinutes(),
80 | seconds: new Date().getSeconds(),
81 |
82 | upYear: 'number' === typeof options.upYear ? options.upYear : 60,
83 | downYear: 'number' === typeof options.downYear ? options.downYear : 60,
84 | data: options.data, //选择数据
85 | dataShowKey: options.dataShowKey || 'value',
86 | multiDataSelect: options.multiDataSelect,
87 | toValues: options.toValues,
88 |
89 | title: options.title || '',
90 | addClass: options.addClass || '',
91 | fontSize: options.fontSize || gVars.fontSize,
92 | cancelTxt: options.cancelTxt || '取消',
93 | completeTxt: options.completeTxt || '完成',
94 | isCN: isDefiend(options.isCN) ? options.isCN : true,
95 | isCircle: isDefiend(options.isCircle) ? options.isCircle : true, //是否设置凸镜效果
96 | showYear: isDefiend(options.showYear) ? options.showYear : true,
97 | showMonth: isDefiend(options.showMonth) ? options.showMonth : true,
98 | showDate: isDefiend(options.showDate) ? options.showDate : true,
99 | showTime: options.showTime || false,
100 | commer: options.commer || '-' //日期间隔默认 ‘-’,
101 |
102 | };
103 |
104 | //初始化
105 | this._init();
106 |
107 | };
108 | APPDateField.prototype.reset = function(){
109 | this._init();
110 | };
111 | APPDateField.prototype._init = function(){
112 | var value = this._getValue();
113 |
114 | if(this.opts.data){
115 | this.valList = value;
116 | }else{
117 | if(value && value !== ''){
118 | this.valList = this.subDefaultDate(value || '');
119 | }
120 | this.setCurrentTXT(this.valList);
121 | }
122 |
123 | //加载组件模板
124 | if(!this.appWrap[0]){
125 | this.appWrap = $('
').attr({'id': 'app-s-con', 'class': 'app-s-con'});
126 | //加入到页面中
127 | $('body').append(this.appWrap);
128 | }else{
129 | this.appWrap.fadeIn(10);
130 | }
131 | //加载模板
132 | this._load();
133 | };
134 |
135 | APPDateField.prototype._load = function(){
136 | this._render();
137 | };
138 |
139 | APPDateField.prototype._render = function(){
140 | var appWrap = this.appWrap.html(gVars.tpl);
141 |
142 | this.app_main = appWrap.find('.app-s-main');
143 | this.app_title = appWrap.find('.app-s-title');
144 | this.app_btnCancel = appWrap.find('.app-s-btnCancel');
145 | this.app_btnOk = appWrap.find('.app-s-btnOk');
146 | this.app_center_con = appWrap.find('.app-s-center');
147 | this.app_y_con = appWrap.find('.app-s-year-con');
148 | this.app_m_con = appWrap.find('.app-s-month-con');
149 | this.app_d_con = appWrap.find('.app-s-date-con');
150 |
151 | var appWrap_w = appWrap.width();
152 |
153 | //标题
154 | this.app_title.html(this.opts.title);
155 | //按钮文字
156 | this.app_btnCancel.html(this.opts.cancelTxt);
157 | this.app_btnOk.html(this.opts.completeTxt);
158 |
159 | if(this.opts.data){
160 | this.app_y_con.css({ width: appWrap_w, left: 0 });
161 | this.app_m_con.css('display', 'none');
162 | this.app_d_con.css('display', 'none');
163 | this.loaded = true;
164 | this.createDatas();
165 | this._events();
166 | return false;
167 | }
168 |
169 | //改变大小
170 | this._resize();
171 | this.loaded = true;
172 |
173 | if(this.opts.showTime){
174 | this.createHours();
175 | this.createMins();
176 | this.createSeconds();
177 | }else{
178 | this.createYear();
179 | this.createMonth();
180 | this.createDate();
181 | }
182 |
183 | this._events();
184 | };
185 |
186 | APPDateField.prototype._resize = function(){
187 | var appWrap_w = this.appWrap.width();
188 | this.app_center_con.find('ul').css('width', appWrap_w / 3);
189 |
190 | if(this.opts.showYear && this.opts.showMonth && this.opts.showDate){
191 | this.app_y_con.css('left', 0);
192 | this.app_m_con.css('left', appWrap_w / 3);
193 | this.app_d_con.css('left', appWrap_w / 3 * 2);
194 | }else if(this.opts.showYear && this.opts.showMonth && !this.opts.showDate){
195 | this.app_center_con.find('ul').css('width', appWrap_w / 2);
196 | this.app_y_con.css('left', 0);
197 | this.app_m_con.css('left', appWrap_w / 2);
198 | this.app_d_con.css({ left: appWrap_w / 2 * 2, display: 'none' });
199 | }else if(!this.opts.showYear && this.opts.showMonth && this.opts.showDate){
200 | this.app_center_con.find('ul').css('width', appWrap_w / 2);
201 | this.app_y_con.css({ left: 0, display: 'none' });
202 | this.app_m_con.css('left', 0);
203 | this.app_d_con.css('left', appWrap_w / 2);
204 | }
205 |
206 | };
207 |
208 | APPDateField.prototype.createDatas = function(){
209 | var datas = this.opts.data;
210 | var html = [], li = '', index = 1, i = 0;
211 | if(!this.loaded) return;
212 | if('[object Object]' === toString.call(datas)){
213 | for(var key in datas){
214 | li = '
'+ datas[key] +' ';
215 | html.push(li);
216 | if(this.valList === datas[key]){
217 | index = i + 1;
218 | }
219 | i++;
220 | }
221 | this.app_y_con.html(html.join('')).show();
222 | var currentTop = this.step * parseInt(index) - (this.step * 4);
223 | this._scrollTop(this.app_y_con, -currentTop, true);
224 | }
225 | else if('[object Array]' === toString.call(datas)){
226 |
227 | if(this.opts.multiDataSelect){
228 |
229 | var yData = datas[0], mData = datas[1], dData = datas[2];
230 |
231 | if(yData){
232 | this.opts.showYear = true;
233 | this._createHTML(yData, this.app_y_con, 0);
234 | }
235 | if(mData){
236 | this.showMonth = true;
237 | this._createHTML(mData, this.app_m_con, 1);
238 | }
239 | if(dData){
240 | this.showDate = true;
241 | this._createHTML(dData, this.app_d_con, 2);
242 | }
243 | this._resize();
244 |
245 | }else{
246 | this._createHTML(datas, this.app_y_con, 0);
247 | }
248 | }else{
249 | throw new ReferenceError('data parameter must be an array or object');
250 | }
251 | };
252 |
253 | APPDateField.prototype._createHTML = function(datas, el, vi){
254 |
255 | var html = [], li = '', index = 1, i = 0;
256 |
257 | for(var len = datas.length; i < len; i++){
258 | var data = datas[i];
259 | // 如果item为object
260 | if('[object Object]' === toString.call(data)){
261 | var attrs = '';
262 | for(var k in data){
263 | if(data.hasOwnProperty(k)){
264 | attrs += ' data-' + k + '="' + data[k] + '"';
265 | }
266 | }
267 | attrs += 'data-adf-index="' + i + '"';
268 | li = '
'+ data[this.opts.dataShowKey] +' ';
269 | }else{
270 | li = '
'+ datas[i] +' ';
271 | }
272 | html.push(li);
273 | if(this.valList[vi] === datas[i]){
274 | index = i + 1;
275 | }
276 | }
277 |
278 | el.html(html.join('')).show();
279 | var currentTop = this.step * parseInt(index) - (this.step * 4);
280 | this._scrollTop(el, -currentTop, true);
281 | };
282 |
283 | /**
284 | * 创建年份
285 | * @param up
286 | * @param down
287 | */
288 | APPDateField.prototype.createYear = function(up, down){
289 | if(!this.loaded) return;
290 | up = up || this.opts.upYear;
291 | down = down || this.opts.downYear;
292 | var now = new Date(),
293 | ny = now.getFullYear(),
294 | html = [], li = '', style = '';
295 |
296 | for(var j = 1; j < up + 1; j++){
297 | li = this.opts.isCN ? '
'+ (ny - j) +'年 ' : '
'+ (ny - j) +' ';
298 | html.unshift(li);
299 | }
300 | for(var i = 0; i <= down; i++){
301 | li = this.opts.isCN ? '
'+ (ny + i) +'年 ' : '
'+ this.dateFm((ny + i)) +' ';
302 | html.push(li);
303 | }
304 | this.app_y_con.html(html.join(''));
305 | var currentTop = this.step * ( this.opts.year - parseInt(this.app_y_con.find('li').eq(0).text()) - 3);
306 | this._scrollTop(this.app_y_con, -currentTop);
307 | };
308 |
309 | /**
310 | * 创建月份
311 | * @return {String}
312 | */
313 | APPDateField.prototype.createMonth = function(){
314 | this._createLists(this.app_m_con, 1, 13, this.opts.month);
315 | var currentTop = this.step * parseInt(this.opts.month) - (this.step * 4);
316 | this._scrollTop(this.app_m_con, -currentTop);
317 | };
318 |
319 | /**
320 | * 创建日
321 | <<<<<<< HEAD
322 | * @param flag
323 | =======
324 | * @param n
325 | >>>>>>> origin/master
326 | * @return {String}
327 | */
328 | APPDateField.prototype.createDate = function(flag){
329 |
330 | var d = 0, pr = 31, big = [1,3,5,7,8,10,12], small = [4,6,9,11],
331 | month = this.opts.month, html = [], li = '';
332 | if(!this.loaded) return;
333 | if(big.indexOf(month) !== -1){
334 | pr = 31;
335 | }else if(small.indexOf(month) !== -1){
336 | pr = 30;
337 | }else if(month === 2){
338 | //判断 平年(28) 和 闰年(29)
339 | pr = (((this.opts.year % 4 === 0 ) && (this.opts.year % 100 !== 0)) || (this.opts.year % 400 === 0 )) ? 29 : 28;
340 | }
341 | while(d < pr){
342 | li = this.opts.isCN ? '
'+ (d + 1) +'日 ' : '
'+ this.dateFm((d + 1)) +' ';
343 | html.push(li);
344 | d++;
345 | }
346 | this.app_d_con.html(html.join(''));
347 | this._scrollTop(this.app_d_con, -(this.step * parseInt(this.opts.date) - (this.step * 4)), flag);
348 | };
349 |
350 | /**
351 | * 创建小时
352 | * @return {[type]} [description]
353 | */
354 | APPDateField.prototype.createHours = function(){
355 | this._createLists(this.app_y_con, 0, 24, this.opts.hours);
356 | var currentTop = this.step * ( this.opts.hours - parseInt(this.app_y_con.find('li').eq(0).text()) - 3);
357 | this._scrollTop(this.app_y_con, -currentTop);
358 | };
359 |
360 | /**
361 | * 创建分钟
362 | * @return {[type]} [description]
363 | */
364 | APPDateField.prototype.createMins = function(){
365 | this._createLists(this.app_m_con, 0, 60, this.opts.minutes);
366 | var currentTop = this.step * parseInt(this.opts.minutes + 1) - (this.step * 4);
367 | this._scrollTop(this.app_m_con, -currentTop);
368 | };
369 |
370 | /**
371 | * 创建秒
372 | * @return {[type]} [description]
373 | */
374 | APPDateField.prototype.createSeconds = function(){
375 | this._createLists(this.app_d_con, 0, 60, this.opts.minutes);
376 | var currentTop = this.step * parseInt(this.opts.seconds + 1) - (this.step * 4);
377 | this._scrollTop(this.app_d_con, -currentTop);
378 | };
379 |
380 | /**
381 | * 创建数据列表
382 | * @param el 当前需要填充的元素
383 | * @param start 开始数
384 | * @param end 结束数
385 | * @param item 当前创建的类型
386 | * @private
387 | */
388 | APPDateField.prototype._createLists = function(el, start, end, item){
389 | if(!this.loaded) return;
390 | var html = [], li = '', isCN = this.opts.isCN, sufix = '';
391 |
392 | switch (item){
393 | case this.opts.month:
394 | sufix = '月'; break;
395 | case this.opts.date:
396 | sufix = '日'; break;
397 | case this.opts.hours:
398 | sufix = '时'; break;
399 | case this.opts.minutes:
400 | sufix = '分'; break;
401 | case this.opts.secondes:
402 | sufix = '秒'; break;
403 | }
404 |
405 | while(start < end){
406 | li = isCN ? '
'+ start + sufix +' ' : '
'+ this.dateFm(start) +' ';
407 | html.push(li);
408 | start++;
409 | }
410 | el.html(html.join(''));
411 | };
412 |
413 | //setter AND getter 设置和获取函数
414 | APPDateField.prototype.getYear = function(){
415 | return this._getText(this.app_y_con);
416 | };
417 | APPDateField.prototype.getMonth = function(){
418 | return this._getText(this.app_m_con);
419 | };
420 | APPDateField.prototype.getDate = function(){
421 | return this._getText(this.app_d_con);
422 | };
423 |
424 | APPDateField.prototype._getText = function(element){
425 | var text = parseInt(this.getCurrChangeElm(element).text());
426 | switch(element){
427 | case this.app_y_con:
428 | this[this.opts.showTime ? 'hours' : 'year'] = text; break;
429 | case this.app_m_con:
430 | this[this.opts.showTime ? 'minutes' : 'month'] = text; break;
431 | case this.app_d_con:
432 | this[this.opts.showTime ? 'seconds' : 'date'] = text; break;
433 | }
434 | return text;
435 | };
436 | /**
437 | * 获取当前值
438 | * @param moveEL (jQuery对象)
439 | * @returns {*|XMLList}
440 | */
441 | APPDateField.prototype.getCurrChangeElm = function(moveEL){
442 | var li, num = Math.round(moveEL.position().top) / this.step;
443 | if(num == 0){
444 | num = 3;
445 | }else if(num >=1 && num <= 3){
446 | if(num == 1) num = 2;
447 | else if(num == 2) num = 1;
448 | else if(num == 3) num = 0;
449 | }else if(num < 0){
450 | num = Math.abs(num) + 3;
451 | }
452 | li = moveEL.find('li').eq(num);
453 | return li;
454 | };
455 | /**
456 | * 设置值
457 | * @param valList
458 | */
459 | APPDateField.prototype.setCurrentTXT = function(valList){
460 | var self = this;
461 | var vlist = valList, opts = self.opts;
462 | if(self.opts.data){
463 | this._setValue('function' === typeof this.opts.toValues ? this.opts.toValues(valList) : valList.join(',').replace(/,*$/g, ''));
464 | return this;
465 | }
466 | if(!vlist || !valList.length || vlist.length === 0){
467 | this._setValue('');
468 | return this;
469 | }
470 |
471 | var one = parseInt(vlist[0]),
472 | two = parseInt(vlist[1]),
473 | three = parseInt(vlist[2]);
474 |
475 | if(opts.showTime){
476 | opts.hours = one || opts.hours;
477 | opts.minutes = two || opts.minutes;
478 | opts.seconds = three || opts.seconds;
479 | }else{
480 | //只显示月 日
481 | if(!opts.showYear){
482 | vlist[0] = '';
483 | }
484 | //只显示年 月
485 | if(!opts.showDate){
486 | vlist[2] = '';
487 | }
488 | opts.year = one || opts.year;
489 | opts.month = two || opts.month;
490 | opts.date = three || opts.date;
491 | }
492 |
493 | //console.log(vlist);
494 |
495 | var dateStr, dy, dm, dd;
496 | if(opts.showTime){
497 | dateStr = _getValue(opts.hours, '时', ':') + _getValue(opts.minutes, '分', ':') + _getValue(opts.seconds, '分', '');
498 | }else{
499 | dy = _getValue(opts.year, '年', opts.commer);
500 | dm = _getValue(opts.month, '月', opts.commer);
501 | dd = _getValue(opts.date, '日', '');
502 | if(opts.showYear && opts.showMonth && !opts.showDate){
503 | dateStr = dy + dm.replace(opts.commer, '');
504 | }else if(!opts.showYear && opts.showMonth && opts.showDate){
505 | dateStr = dm + dd;
506 | }else{
507 | dateStr = dy + dm + dd;
508 | }
509 | }
510 |
511 | function _getValue(val, suffix, commer){
512 | return opts.isCN ? (val + suffix) : (self.dateFm(val) + commer);
513 | }
514 |
515 | this._setValue(dateStr);
516 | };
517 |
518 | APPDateField.prototype._setValue = function(value){
519 | if(/INPUT/gi.test(this.selectElm.tagName)){
520 | this.selectElm.value = value;
521 | }else{
522 | this.selectElm.innerHTML = value;
523 | }
524 | };
525 | APPDateField.prototype._getValue = function(){
526 | if(this.opts.defaultValue){
527 | return this.opts.defaultValue;
528 | }
529 | if(/INPUT/gi.test(this.selectElm.tagName)){
530 | return this.selectElm.value;
531 | }else{
532 | return this.selectElm.innerHTML;
533 | }
534 | };
535 |
536 | /**
537 | * 截取默认日期
538 | * @param dateString
539 | * @returns {Array}
540 | */
541 | APPDateField.prototype.subDefaultDate = function(dateString){
542 |
543 | var self = this, list = [], opts = self.opts;
544 | if(!dateString){
545 | var date = new Date();
546 | if(opts.showTime){
547 | list.push(date.getHours());
548 | list.push(date.getMinutes());
549 | list.push(date.getSeconds());
550 | }else{
551 | list.push(date.getFullYear());
552 | list.push(date.getMonth() + 1);
553 | list.push(date.getDate());
554 | }
555 |
556 | }else{
557 | if(opts.isCN){
558 | list = dateString.match(/(\d)+/gi);
559 | }else{
560 | list = dateString.match(/(\d)+/gi) || dateString.split(opts.commer || '-');
561 | }
562 | }
563 | if(list.length === 3){
564 | if(!opts.showYear){
565 | list[0] = '';
566 | }
567 | if(!opts.showDate){
568 | list[2] = '';
569 | }
570 | }else{
571 | if(!opts.showYear){
572 | list.unshift('');
573 | }
574 | if(!opts.showDate){
575 | list.push('');
576 | }
577 | }
578 | self.valList = list;
579 | return list;
580 | };
581 |
582 | /**
583 | * 获取最后的日期 (可设置), 返回为数组
584 | * @param y
585 | * @param m
586 | * @param d
587 | * @param commer
588 | * @returns {string}
589 | */
590 | APPDateField.prototype.getCurrentDate = function(y, m, d){
591 | if(this.opts.data){
592 | return this.currDate;
593 | }
594 | var list = this.currDate;
595 | list[0] = y || list[0];
596 | list[1] = m || list[1];
597 | list[2] = d || list[2];
598 | this.currDate = list;
599 | return list;
600 | };
601 |
602 | /**
603 | * 初始化滚动动作,滚动到指定位置
604 | * @param elObj
605 | * @param y
606 | * @param flag
607 | * @private
608 | */
609 | APPDateField.prototype._scrollTop = function(elObj, y){
610 |
611 | _scrollTo(elObj[0], y, true, this, false);
612 | //设置凸镜效果
613 | (this.opts.isCircle === true) && zoomOBJ(elObj, y, this);
614 |
615 | };
616 |
617 | /**
618 | *
619 | * @private
620 | */
621 | APPDateField.prototype._events = function(){
622 | var opts = this.opts,
623 | app_y_con = this.app_y_con,
624 | app_m_con = this.app_m_con,
625 | app_d_con = this.app_d_con,
626 | app_main = this.app_main;
627 |
628 | (this.opts.showYear || this.opts.showTime) && new APPTouch(app_y_con[0], app_main[0], opts, this);
629 | (this.opts.showMonth || this.opts.showTime) && new APPTouch(app_m_con[0], app_main[0], opts, this);
630 | (this.opts.showDate || this.opts.showTime) && new APPTouch(app_d_con[0], app_main[0], opts, this);
631 |
632 | //完成和取消按钮
633 | this.app_btnOk.on('touchend', holdEvent(this, this._complete));
634 | this.app_btnCancel.on('touchend', holdEvent(this, this._cancel));
635 |
636 | this.app_btnOk.on('touchstart', this.endEvent);
637 | this.app_btnCancel.on('touchstart', this.endEvent);
638 |
639 | };
640 |
641 | APPDateField.prototype.endEvent = function(evt){
642 | evt.preventDefault();
643 | evt.stopPropagation();
644 | };
645 |
646 | /**
647 | * 日期选择 完成 事件
648 | * @param evt
649 | * @private
650 | */
651 | APPDateField.prototype._complete = function(evt){
652 | var vlist;
653 | if(this.opts.data){
654 | //自定义数据存在
655 | var liY = this.getCurrChangeElm(this.app_y_con);
656 | var liM = this.getCurrChangeElm(this.app_m_con);
657 | var liD = this.getCurrChangeElm(this.app_d_con);
658 | vlist = [ liY.text(), liM.text(), liD.text() ];
659 | this.changeElement = [ liY[0], liM[0], liD[0] ];
660 | }else{
661 | //日期时间选择
662 | vlist = [];
663 | vlist.push(this.getYear());
664 | vlist.push(this.getMonth());
665 | vlist.push(this.getDate());
666 | }
667 |
668 | this.currDate = vlist;
669 | //console.log(this.currDate)
670 | //填值给选择框
671 | this.setCurrentTXT(vlist);
672 |
673 | this._hide();
674 | this.complete.call(this, evt);
675 | };
676 | /**
677 | * 日期选择 取消 事件
678 | * @param evt
679 | * @private
680 | */
681 | APPDateField.prototype._cancel = function(evt){
682 | this._hide();
683 | };
684 | APPDateField.prototype._hide = function(){
685 | this.appWrap.css('display', 'none');
686 | };
687 | /**
688 | * 日期格式化
689 | * @//param n
690 | * @return {String}
691 | */
692 | APPDateField.prototype.dateFm = function(n){
693 | return (n < 10) ? '0' + n : n;
694 | };
695 |
696 | root.APPDateField = APPDateField;
697 |
698 | //////////////////////////以下是滚动对象//////////////////////////////////////////////////////////////////////////////
699 | /**
700 | * Touch对象
701 | * @param element 当前滚定对象
702 | * @param parentElement 当前滚定对象父节点
703 | * @param options 配置信息
704 | * @param target 当前实例
705 | * @constructor
706 | */
707 | var APPTouch = function(element, parentElement, options, target){
708 | //焦点对象
709 | this.elm = element;
710 | //焦点父节点
711 | this.elmParent = parentElement;
712 | //是否具有Touch事件
713 | this.hasTouch = 'ontouchstart' in window || window.TouchEvent;
714 | this.isTouchStart = false;
715 | this.options = options;
716 | this.callTarget = target;
717 |
718 | //存储列表
719 | this.vlist = {
720 | year: this.options.year,
721 | month: this.options.month,
722 | date: this.options.date,
723 | hours: this.options.hours,
724 | minutes: this.options.minutes,
725 | seconds: this.options.seconds
726 | };
727 |
728 | //滚动到
729 | this.dy = 0;
730 | //滚动层高度
731 | this.h = $(this.elm).height();
732 | //鼠标位置
733 | this.moveY = 0;
734 | //滚动层顶部坐标
735 | this.top = $(this.elm).position().top;
736 | //步长
737 | this.step = gVars.step;
738 | this.fontSize = this.callTarget.opts.fontSize;
739 |
740 | this.offset = {
741 | left: this.elmParent.offsetLeft,
742 | top: this.elmParent.offsetTop,
743 | width: $(this.elmParent).width(),
744 | height: $(this.elmParent).height()
745 | };
746 | this.startTime = 0;
747 |
748 | //触发时间侦听
749 | this._initEvent(element);
750 | };
751 |
752 | APPTouch.prototype = {
753 | _initEvent: function(element){
754 | if(this.hasTouch){
755 | element.addEventListener('touchstart', this, false);
756 | element.addEventListener('touchmove', this, false);
757 | element.addEventListener('touchend', this, false);
758 | }else{
759 | element.addEventListener('mousedown', this, false);
760 | element.addEventListener('mousemove', this, false);
761 | element.addEventListener('mouseup', this, false);
762 | }
763 | },
764 |
765 | handleEvent : function(evt) {
766 | /*evt.preventDefault();
767 | evt.stopPropagation();*/
768 | switch (evt.type) {
769 | case 'touchstart':
770 | this._start(evt.targetTouches[0], evt);
771 | break;
772 | case 'touchmove':
773 | this._move(evt.changedTouches[0], evt);
774 | break;
775 | case 'touchend':
776 | this._end(evt.changedTouches[0], evt);
777 | break;
778 | case 'mousedown':
779 | this._start(evt);
780 | break;
781 | case 'mousemove':
782 | this._move(evt);
783 | break;
784 | case 'mouseup':
785 | this._end(evt);
786 | break;
787 | }
788 |
789 | if(/SELECT|TEXTAREA|INPUT/.test(evt.target.tagName.toUpperCase())) {
790 | evt.preventDefault();
791 | }
792 | evt.preventDefault();
793 | evt.stopPropagation();
794 | },
795 | _start: function(evt){
796 | this.isTouchStart = true;
797 | this.y = this.top = $(this.elm).position().top;
798 | this.h = $(this.elm).height();
799 | this.moveY = evt.pageY; //开始位置
800 | this.startTime = Date.now();
801 | //console.log('this.h = ' + this.h)
802 | },
803 | _move: function(evt){
804 | if(this.isTouchStart){
805 | var target = $(evt.target).parent('ul');
806 | target.find('li').css('fontSize', this.fontSize + 'px');
807 | this.dy = this.y - (this.moveY - evt.pageY);
808 |
809 | var top = this._formateTop(this.dy);
810 | this._scrollTop(target[0], top, true);
811 |
812 | //设置凸镜效果
813 | (this.callTarget.opts.isCircle === true) && zoomOBJ(target, top, this.callTarget);
814 | }
815 | },
816 | _end: function(evt){
817 | this.isTouchStart = false;
818 | var target = $(evt.target).parent('ul');
819 |
820 | //判断是上拖还是下拖
821 | var offset = evt.pageY - this.moveY;
822 | var curTop = this.y + offset;
823 | var top = this._formateTop(curTop);
824 | this._scrollTop(target[0], top, false);
825 |
826 | //设置凸镜效果
827 | (this.callTarget.opts.isCircle === true) && zoomOBJ(target, top, this.callTarget);
828 | },
829 | /**
830 | * 判断高度越界
831 | * @param top
832 | * @return {*}
833 | * @private
834 | */
835 | _formateTop: function(top){
836 | if(top >= (gVars.step * 3)){
837 | top = (gVars.step * 3);
838 | }else if(Math.abs(top) >= this.h - (gVars.step * 4)){
839 | top = -(this.h - (gVars.step * 4));
840 | }else{
841 | return top;
842 | }
843 | this.y = top;
844 | return top;
845 | },
846 | /**
847 | * 滚动层到指定位置
848 | * @param el
849 | * @param y
850 | * @param flag
851 | * @private
852 | */
853 | _scrollTop: function(el, y, flag){
854 | _scrollTo(el, y, flag, this, !this.callTarget.opts.showTime);
855 | }
856 |
857 | };
858 |
859 | ///////////////////////////////////////////////////////////////////////////////////////////////////////
860 |
861 | /**
862 | * 改变对象作用域
863 | * @param obj
864 | * @param func
865 | * @return {Function}
866 | */
867 | function holdEvent(obj, func){
868 | var args = [];
869 | for(var i=2; i
= count){
945 | index = count - 1;
946 | }else if(index >=1 && index <= 3){
947 | if(index == 1){
948 | index = 3 - index;
949 | }else if(index == 2){
950 | index = 3 - index;
951 | }else if(index == 3){
952 | index = 0;
953 | }
954 | }else if(index <= 0){
955 | index = Math.abs(index) + 3;
956 | }
957 |
958 | //console.log(self.step)
959 |
960 | var uls = target.app_center_con.find('ul').filter(function(m){
961 | return $(this).css('display') != 'none';
962 | }),
963 | ulsLen = uls.length;
964 |
965 | //只显示当前的
966 | $.each(elObj.find('li'), function(i, item){
967 | if(index - 4 > i || i > index + 4){
968 | $(item).css('visibility', 'hidden');
969 | }else{
970 | $(item).attr('style', '');
971 | }
972 | });
973 |
974 | //循环缩放 上
975 | _repeat('up');
976 | //循环缩放 下
977 | _repeat('down');
978 |
979 | function _repeat(type){
980 | var i = 0, len = 4, li, eqIndex,
981 | fs = target.opts.fontSize,
982 | ti = 0, tiStep = 5,
983 | skew = 0, skewStep = 10;
984 |
985 | for(; i < len; i++){
986 | eqIndex = 'up' === type ? index - i : index + i;
987 | li = (elObj.find('li').eq(eqIndex))[0];
988 | if(!li) continue;
989 |
990 | //设置 text-indent
991 | if(ulsLen === 3){
992 | li.style.cssText = 'font-size:' + fs + 'px; text-indent:' + ti + 'px; -webkit-transform: skewX('+ skew +'deg)';
993 | elObj.hasClass('app-s-year-con') && _left();
994 | elObj.hasClass('app-s-date-con') && _right();
995 | }else{
996 | li.style.fontSize = fs + 'px';
997 | }
998 | fs -= 4.0;
999 | }
1000 |
1001 | function _left(){
1002 | ti += tiStep;
1003 | (type === 'down') ? (skew += skewStep) : (skew -= skewStep);
1004 | }
1005 |
1006 | function _right(){
1007 | ti -= tiStep;
1008 | (type === 'down') ? (skew -= skewStep) : (skew += skewStep);
1009 | }
1010 |
1011 |
1012 | }
1013 |
1014 |
1015 |
1016 | }
1017 |
1018 | }).call(this);
1019 |
1020 |
1021 |
1022 |
1023 |
1024 |
--------------------------------------------------------------------------------
/src/APPDateField.min.js:
--------------------------------------------------------------------------------
1 | /*! APPDateField v2.1.0 | (c) 2014, 2017 , Author: Rodeyluo@gmaile.com */
2 | (function(){var k=this;var b={fontSize:22,step:40,tpl:'"};function l(n){return undefined!==n}var d=function(n){return"function"===typeof n};var h=function(){};function g(){}var e=Object.prototype.toString;var m=function(o,p,n,q){p=p||{};this.selectElm=$("#"+o.replace(/^#/i,""))[0];this.appWrap=$("#app-s-con");this.loaded=false;this.complete=d(p.complete)?p.complete:d(n)?n:h;this.cancel=d(p.cancel)?p.cancel:d(q)?q:h;this.moveEnd=d(p.moveEnd)?p.moveEnd:h;if((p.complete&&l(p.complete)&&typeof p.complete==="function")||(n&&typeof n==="function")){this.complete=p.complete||n||g}if((p.cancel&&l(p.cancel)&&typeof p.cancel==="function")||(q&&typeof q==="function")){this.cancel=p.cancel||q||g}this.step=b.step;this.valList=[];this.currDate=[];this.opts={year:new Date().getFullYear(),month:new Date().getMonth()+1,date:new Date().getDate(),hours:new Date().getHours(),minutes:new Date().getMinutes(),seconds:new Date().getSeconds(),upYear:"number"===typeof p.upYear?p.upYear:60,downYear:"number"===typeof p.downYear?p.downYear:60,data:p.data,dataShowKey:p.dataShowKey||"value",multiDataSelect:p.multiDataSelect,toValues:p.toValues,title:p.title||"",addClass:p.addClass||"",fontSize:p.fontSize||b.fontSize,cancelTxt:p.cancelTxt||"取消",completeTxt:p.completeTxt||"完成",isCN:l(p.isCN)?p.isCN:true,isCircle:l(p.isCircle)?p.isCircle:true,showYear:l(p.showYear)?p.showYear:true,showMonth:l(p.showMonth)?p.showMonth:true,showDate:l(p.showDate)?p.showDate:true,showTime:p.showTime||false,commer:p.commer||"-"};this._init()};m.prototype.reset=function(){this._init()};m.prototype._init=function(){var n=this._getValue();if(this.opts.data){this.valList=n}else{if(n&&n!==""){this.valList=this.subDefaultDate(n||"")}this.setCurrentTXT(this.valList)}if(!this.appWrap[0]){this.appWrap=$("
").attr({"id":"app-s-con","class":"app-s-con"});$("body").append(this.appWrap)}else{this.appWrap.fadeIn(10)}this._load()};m.prototype._load=function(){this._render()};m.prototype._render=function(){var n=this.appWrap.html(b.tpl);this.app_main=n.find(".app-s-main");this.app_title=n.find(".app-s-title");this.app_btnCancel=n.find(".app-s-btnCancel");this.app_btnOk=n.find(".app-s-btnOk");this.app_center_con=n.find(".app-s-center");this.app_y_con=n.find(".app-s-year-con");this.app_m_con=n.find(".app-s-month-con");this.app_d_con=n.find(".app-s-date-con");var o=n.width();this.app_title.html(this.opts.title);this.app_btnCancel.html(this.opts.cancelTxt);this.app_btnOk.html(this.opts.completeTxt);if(this.opts.data){this.app_y_con.css({width:o,left:0});this.app_m_con.css("display","none");this.app_d_con.css("display","none");this.loaded=true;this.createDatas();this._events();return false}this._resize();this.loaded=true;if(this.opts.showTime){this.createHours();this.createMins();this.createSeconds()}else{this.createYear();this.createMonth();this.createDate()}this._events()};m.prototype._resize=function(){var n=this.appWrap.width();this.app_center_con.find("ul").css("width",n/3);if(this.opts.showYear&&this.opts.showMonth&&this.opts.showDate){this.app_y_con.css("left",0);this.app_m_con.css("left",n/3);this.app_d_con.css("left",n/3*2)}else{if(this.opts.showYear&&this.opts.showMonth&&!this.opts.showDate){this.app_center_con.find("ul").css("width",n/2);this.app_y_con.css("left",0);this.app_m_con.css("left",n/2);this.app_d_con.css({left:n/2*2,display:"none"})}else{if(!this.opts.showYear&&this.opts.showMonth&&this.opts.showDate){this.app_center_con.find("ul").css("width",n/2);this.app_y_con.css({left:0,display:"none"});this.app_m_con.css("left",0);this.app_d_con.css("left",n/2)}}}};m.prototype.createDatas=function(){var s=this.opts.data;var r=[],w="",t=1,q=0;if(!this.loaded){return}if("[object Object]"===e.call(s)){for(var v in s){w=''+s[v]+" ";r.push(w);if(this.valList===s[v]){t=q+1}q++}this.app_y_con.html(r.join("")).show();var u=this.step*parseInt(t)-(this.step*4);this._scrollTop(this.app_y_con,-u,true)}else{if("[object Array]"===e.call(s)){if(this.opts.multiDataSelect){var o=s[0],p=s[1],n=s[2];if(o){this.opts.showYear=true;this._createHTML(o,this.app_y_con,0)}if(p){this.showMonth=true;this._createHTML(p,this.app_m_con,1)}if(n){this.showDate=true;this._createHTML(n,this.app_d_con,2)}this._resize()}else{this._createHTML(s,this.app_y_con,0)}}else{throw new ReferenceError("data parameter must be an array or object")}}};m.prototype._createHTML=function(t,n,p){var s=[],y="",u=1,r=0;for(var v=t.length;r"+q[this.opts.dataShowKey]+""}else{y=''+t[r]+" "}s.push(y);if(this.valList[p]===t[r]){u=r+1}}n.html(s.join("")).show();var w=this.step*parseInt(u)-(this.step*4);this._scrollTop(n,-w,true)};m.prototype.createYear=function(r,v){if(!this.loaded){return}r=r||this.opts.upYear;v=v||this.opts.downYear;var o=new Date(),s=o.getFullYear(),t=[],w="",n="";for(var p=1;p"+(s-p)+"年":""+(s-p)+" ";t.unshift(w)}for(var q=0;q<=v;q++){w=this.opts.isCN?""+(s+q)+"年 ":""+this.dateFm((s+q))+" ";t.push(w)}this.app_y_con.html(t.join(""));var u=this.step*(this.opts.year-parseInt(this.app_y_con.find("li").eq(0).text())-3);this._scrollTop(this.app_y_con,-u)};m.prototype.createMonth=function(){this._createLists(this.app_m_con,1,13,this.opts.month);var n=this.step*parseInt(this.opts.month)-(this.step*4);this._scrollTop(this.app_m_con,-n)};m.prototype.createDate=function(p){var t=0,u=31,o=[1,3,5,7,8,10,12],r=[4,6,9,11],s=this.opts.month,q=[],n="";if(!this.loaded){return}if(o.indexOf(s)!==-1){u=31}else{if(r.indexOf(s)!==-1){u=30}else{if(s===2){u=(((this.opts.year%4===0)&&(this.opts.year%100!==0))||(this.opts.year%400===0))?29:28}}}while(t"+(t+1)+"日":""+this.dateFm((t+1))+" ";q.push(n);t++}this.app_d_con.html(q.join(""));this._scrollTop(this.app_d_con,-(this.step*parseInt(this.opts.date)-(this.step*4)),p)};m.prototype.createHours=function(){this._createLists(this.app_y_con,0,24,this.opts.hours);var n=this.step*(this.opts.hours-parseInt(this.app_y_con.find("li").eq(0).text())-3);this._scrollTop(this.app_y_con,-n)};m.prototype.createMins=function(){this._createLists(this.app_m_con,0,60,this.opts.minutes);var n=this.step*parseInt(this.opts.minutes+1)-(this.step*4);this._scrollTop(this.app_m_con,-n)};m.prototype.createSeconds=function(){this._createLists(this.app_d_con,0,60,this.opts.minutes);var n=this.step*parseInt(this.opts.seconds+1)-(this.step*4);this._scrollTop(this.app_d_con,-n)};m.prototype._createLists=function(q,u,o,s){if(!this.loaded){return}var p=[],n="",r=this.opts.isCN,t="";switch(s){case this.opts.month:t="月";break;case this.opts.date:t="日";break;case this.opts.hours:t="时";break;case this.opts.minutes:t="分";break;case this.opts.secondes:t="秒";break}while(u"+u+t+"":""+this.dateFm(u)+" ";p.push(n);u++}q.html(p.join(""))};m.prototype.getYear=function(){return this._getText(this.app_y_con)};m.prototype.getMonth=function(){return this._getText(this.app_m_con)};m.prototype.getDate=function(){return this._getText(this.app_d_con)};m.prototype._getText=function(n){var o=parseInt(this.getCurrChangeElm(n).text());switch(n){case this.app_y_con:this[this.opts.showTime?"hours":"year"]=o;break;case this.app_m_con:this[this.opts.showTime?"minutes":"month"]=o;break;case this.app_d_con:this[this.opts.showTime?"seconds":"date"]=o;break}return o};m.prototype.getCurrChangeElm=function(p){var n,o=Math.round(p.position().top)/this.step;if(o==0){o=3}else{if(o>=1&&o<=3){if(o==1){o=2}else{if(o==2){o=1}else{if(o==3){o=0}}}}else{if(o<0){o=Math.abs(o)+3}}}n=p.find("li").eq(o);return n};m.prototype.setCurrentTXT=function(r){var x=this;var q=r,n=x.opts;if(x.opts.data){this._setValue("function"===typeof this.opts.toValues?this.opts.toValues(r):r.join(",").replace(/,*$/g,""));return this}if(!q||!r.length||q.length===0){this._setValue("");return this}var u=parseInt(q[0]),y=parseInt(q[1]),o=parseInt(q[2]);if(n.showTime){n.hours=u||n.hours;n.minutes=y||n.minutes;n.seconds=o||n.seconds}else{if(!n.showYear){q[0]=""}if(!n.showDate){q[2]=""}n.year=u||n.year;n.month=y||n.month;n.date=o||n.date}var p,w,t,v;if(n.showTime){p=s(n.hours,"时",":")+s(n.minutes,"分",":")+s(n.seconds,"分","")}else{w=s(n.year,"年",n.commer);t=s(n.month,"月",n.commer);v=s(n.date,"日","");if(n.showYear&&n.showMonth&&!n.showDate){p=w+t.replace(n.commer,"")}else{if(!n.showYear&&n.showMonth&&n.showDate){p=t+v}else{p=w+t+v}}}function s(B,A,z){return n.isCN?(B+A):(x.dateFm(B)+z)}this._setValue(p)};m.prototype._setValue=function(n){if(/INPUT/gi.test(this.selectElm.tagName)){this.selectElm.value=n}else{this.selectElm.innerHTML=n}};m.prototype._getValue=function(){if(this.opts.defaultValue){return this.opts.defaultValue}if(/INPUT/gi.test(this.selectElm.tagName)){return this.selectElm.value}else{return this.selectElm.innerHTML}};m.prototype.subDefaultDate=function(q){var n=this,r=[],p=n.opts;if(!q){var o=new Date();if(p.showTime){r.push(o.getHours());r.push(o.getMinutes());r.push(o.getSeconds())}else{r.push(o.getFullYear());r.push(o.getMonth()+1);r.push(o.getDate())}}else{if(p.isCN){r=q.match(/(\d)+/gi)}else{r=q.match(/(\d)+/gi)||q.split(p.commer||"-")}}if(r.length===3){if(!p.showYear){r[0]=""}if(!p.showDate){r[2]=""}}else{if(!p.showYear){r.unshift("")}if(!p.showDate){r.push("")}}n.valList=r;return r};m.prototype.getCurrentDate=function(q,n,p){if(this.opts.data){return this.currDate
4 | }var o=this.currDate;o[0]=q||o[0];o[1]=n||o[1];o[2]=p||o[2];this.currDate=o;return o};m.prototype._scrollTop=function(n,o){i(n[0],o,true,this,false);(this.opts.isCircle===true)&&a(n,o,this)};m.prototype._events=function(){var r=this.opts,q=this.app_y_con,n=this.app_m_con,o=this.app_d_con,p=this.app_main;(this.opts.showYear||this.opts.showTime)&&new f(q[0],p[0],r,this);(this.opts.showMonth||this.opts.showTime)&&new f(n[0],p[0],r,this);(this.opts.showDate||this.opts.showTime)&&new f(o[0],p[0],r,this);this.app_btnOk.on("touchend",c(this,this._complete));this.app_btnCancel.on("touchend",c(this,this._cancel));this.app_btnOk.on("touchstart",this.endEvent);this.app_btnCancel.on("touchstart",this.endEvent)};m.prototype.endEvent=function(n){n.preventDefault();n.stopPropagation()};m.prototype._complete=function(o){var n;if(this.opts.data){var q=this.getCurrChangeElm(this.app_y_con);var r=this.getCurrChangeElm(this.app_m_con);var p=this.getCurrChangeElm(this.app_d_con);n=[q.text(),r.text(),p.text()];this.changeElement=[q[0],r[0],p[0]]}else{n=[];n.push(this.getYear());n.push(this.getMonth());n.push(this.getDate())}this.currDate=n;this.setCurrentTXT(n);this._hide();this.complete.call(this,o)};m.prototype._cancel=function(n){this._hide()};m.prototype._hide=function(){this.appWrap.css("display","none")};m.prototype.dateFm=function(o){return(o<10)?"0"+o:o};k.APPDateField=m;var f=function(p,n,o,q){this.elm=p;this.elmParent=n;this.hasTouch="ontouchstart" in window||window.TouchEvent;this.isTouchStart=false;this.options=o;this.callTarget=q;this.vlist={year:this.options.year,month:this.options.month,date:this.options.date,hours:this.options.hours,minutes:this.options.minutes,seconds:this.options.seconds};this.dy=0;this.h=$(this.elm).height();this.moveY=0;this.top=$(this.elm).position().top;this.step=b.step;this.fontSize=this.callTarget.opts.fontSize;this.offset={left:this.elmParent.offsetLeft,top:this.elmParent.offsetTop,width:$(this.elmParent).width(),height:$(this.elmParent).height()};this.startTime=0;this._initEvent(p)};f.prototype={_initEvent:function(n){if(this.hasTouch){n.addEventListener("touchstart",this,false);n.addEventListener("touchmove",this,false);n.addEventListener("touchend",this,false)}else{n.addEventListener("mousedown",this,false);n.addEventListener("mousemove",this,false);n.addEventListener("mouseup",this,false)}},handleEvent:function(n){switch(n.type){case"touchstart":this._start(n.targetTouches[0],n);break;case"touchmove":this._move(n.changedTouches[0],n);break;case"touchend":this._end(n.changedTouches[0],n);break;case"mousedown":this._start(n);break;case"mousemove":this._move(n);break;case"mouseup":this._end(n);break}if(/SELECT|TEXTAREA|INPUT/.test(n.target.tagName.toUpperCase())){n.preventDefault()}n.preventDefault();n.stopPropagation()},_start:function(n){this.isTouchStart=true;this.y=this.top=$(this.elm).position().top;this.h=$(this.elm).height();this.moveY=n.pageY;this.startTime=Date.now()},_move:function(n){if(this.isTouchStart){var p=$(n.target).parent("ul");p.find("li").css("fontSize",this.fontSize+"px");this.dy=this.y-(this.moveY-n.pageY);var o=this._formateTop(this.dy);this._scrollTop(p[0],o,true);(this.callTarget.opts.isCircle===true)&&a(p,o,this.callTarget)}},_end:function(n){this.isTouchStart=false;var q=$(n.target).parent("ul");var r=n.pageY-this.moveY;var o=this.y+r;var p=this._formateTop(o);this._scrollTop(q[0],p,false);(this.callTarget.opts.isCircle===true)&&a(q,p,this.callTarget)},_formateTop:function(n){if(n>=(b.step*3)){n=(b.step*3)}else{if(Math.abs(n)>=this.h-(b.step*4)){n=-(this.h-(b.step*4))}else{return n}}this.y=n;return n},_scrollTop:function(o,p,n){i(o,p,n,this,!this.callTarget.opts.showTime)}};function c(q,p){var n=[];for(var o=2;o=r){p=r-1}else{if(p>=1&&p<=3){if(p==1){p=3-p}else{if(p==2){p=3-p}else{if(p==3){p=0}}}}else{if(p<=0){p=Math.abs(p)+3}}}var q=t.app_center_con.find("ul").filter(function(v){return $(this).css("display")!="none"}),s=q.length;$.each(o.find("li"),function(v,w){if(p-4>v||v>p+4){$(w).css("visibility","hidden")}else{$(w).attr("style","")}});n("up");n("down");function n(B){var x=0,A=4,D,C,z=t.opts.fontSize,w=0,G=5,E=0,y=10;for(;x