📄 util.js
字号:
;g.prototype.Nb=function(a){return this.ka.remove(a)};g.prototype.u=function(a){a=arguments.length===0||a;var b=this.f.U();for(var c=0;c<b.length;++c){var d=this.J[b[c].toString()];this.C(d,false)}this.f.clear();if(!this.M){this.Ha(null);this.la(null)}if(a)this.z()};g.prototype.Jb=function(a){return this.f.contains(a)};g.prototype.Sa=function(a){if(this.xa){this.xa.call(null,a);return}var b=z(a);var c=this.f;switch(this.O){case 1:var d=this.Wa();if(d==0)break;if(d!=1&&(d!=-1||!c.contains(this.b[a]))){var e=this.b[b.id];var f;switch(d){case -1:if(c.s()>7&&this.R()){var h=b.id.substr(b.id.length-3,1);e=this.b[this.g+"day_"+h+"_0"]}f=c.s()-1;break;case 7:var h=b.id.substr(b.id.length-3,1);e=this.b[this.g+"day_"+h+"_0"];f=6;break;case 30:e=this.b[b.id];e=j.create(e.year,e.month,1);var l=Q(e);f=H(e.year,e.month)-1;break;default:}var l=Q(e);l.date+=f;var n=l.i();this.ma(e,n);return}na(d==1||d==-1&&c.contains(this.b[a]),"not a case for single date selection");this.u(false);case 0:if(c.s()>0){var k=c.U()[0];c.remove(k);var q=this.J[k.toString()];if(q)this.C(q,false)}c.add(this.b[b.id]);this.C(b);this.z(this.b[b.id]);break;case 2:break;case 3:default:break}};g.prototype.Ha=function(a){this.d=a;this.I=a?this.b[a.id]:null};g.prototype.la=function(a){this.m=a;this.H=a?this.b[a.id]:null};g.prototype.fb=function(){return this.M};g.prototype.Vb=function(a,b){this.u(false);this.M=true;this.Ha(this.Y(a));var c=this.b[this.d.id];this.f.add(c);this.C(this.d);this.ma(c);this.la(this.d)};g.prototype.xb=function(a,b,c){this.M=false;this.m=this.Y(a);if(this.R()){this.z(this.I,this.H,false);return}var d,e;if(this.b[this.m.id].a()<this.b[this.d.id].a()){d=this.b[this.m.id];e=this.b[this.d.id]}else{d=this.b[this.d.id];e=this.b[this.m.id]}this.z(d,e,false)};g.prototype.Ib=function(a,b,c,d){this.Ca=Ea(a);if(this.O!=1||this.ba)return;this.ba=true;var e=this;setTimeout(function(){try{if(e.M){e.Va.call(e,b,c,d)}}finally{e.ba=false}},50)};g.prototype.Sb=function(a){if(this.qa==a)return;this.qa=!(!a);this.u()};g.prototype.R=function(){return this.qa};g.prototype.Va=function(a,b,c){var d=this.Ca;var e=this.Y(d);if(e===this.m)return;var f=this.m;this.la(e);var h=this.b;var l=h[f.id].a()<h[e.id].a();var n=h[f.id].a()<h[this.d.id].a();var k=h[e.id].a()<h[this.d.id].a();var q=h[this.d.id].a()<h[e.id].a();var s=h[this.d.id].a()<h[f.id].a();var u,i;var v,r;var m=k?this.m:this.d;var A=k?this.d:this.m;if(this.R()){var D=sa(h[A.id],h[m.id]);if(D>=7){var O,T;O=parseInt(m.id.charAt(m.id.length-3),10);T=parseInt(A.id.charAt(A.id.length-3),10);m=z(this.g+"day_"+O+"_0");A=z(this.g+"day_"+T+"_6")}this.B(this.n,m,false);this.B(A,this.N,false);this.B(m,A,true);this.I=h[m.id];this.H=h[A.id]}else{if(l){if(n){i=k?this.F[e.id]:this.F[this.d.id];this.B(f,i,false)}if(q){u=s?this.t[f.id]:this.t[this.d.id];this.B(u,e,true)}}else{if(s){u=q?this.t[e.id]:this.t[this.d.id];this.B(u,f,false)}if(k){i=k?this.F[this.d.id]:this.F[f.id];this.B(e,i,true)}}}v=h[m.id];r=h[A.id];this.z(v,r,true)};g.prototype.B=function(a,b,c){var d=false;while(a){if(c){d=this.f.add(this.b[a.id])}else{d=this.f.remove(this.b[a.id])}if(d){this.C(a,c)}if(a.id===b.id)break;a=this.t[a.id]}};g.LAST_DAY_OF_WEEK={4:"day_3_6",5:"day_4_6",6:"day_5_6",7:"day_6_6"};g.prototype.Rb=function(a){if(a){this.o={};this.o.x=a.x;this.o.y=a.y}else{this.o=null}};g.prototype.Pa=function(a,b){if(!this.o)return;if(b){a.x-=this.o.x;a.y-=this.o.y}else{a.x+=this.o.x;a.y+=this.o.y}};g.prototype.Y=function(a){var b=Xa(this.n);var c=Va(this.n);var d=this.db();var e=Ja(a);this.Pa(e);var f=7;var h=this.za(d.x,b,f,e.x);var l=this.za(d.y,c,this.A,e.y);return z(this.g+"day_"+l+"_"+h)};g.prototype.za=function(a,b,c,d){if(d<a)return 0;var e=Math.floor((d-a)/b);return e>=c?c-1:e};g.prototype.db=function(){var a=this.g;var b=this.A;var c=Wa(this.n);var d=Ua(z(a+g.LAST_DAY_OF_WEEK[b]));return new L(c.x,c.y,d.x+d.w-c.x,d.y+d.h-c.y,c.coordinateFrame)};g.prototype.$=function(a,b){var c=b?aa:Z;return c[a.month]+" "+a.date};g.prototype.z=function(a,b,c){var d={};d.startDate=a;d.endDate=b||a;d.fb=!(!c);d.mode=this.aa();this.ka.Z(d)};g.prototype.Gb=function(){return this.j};g.prototype.Tb=function(a){if(a.equals(this.j))return;this.j=a;this.p()};g.prototype.va=function(a){if(a instanceof j)return a;if(a instanceof t){return j.create(a.year,a.month,a.date)}};g.prototype.Qb=function(a){this.ya=!(!a)};g.prototype.ma=function(a,b,c){var d=this.aa();c=c!==false;if(a)a=this.va(a);if(b)b=this.va(b);if(a)this.Ia(a);if(!a||d==3){this.u(c);return}if(d==0){this.u(false);var e=this.J[a.toString()];this.f.add(a);this.C(e);if(c)this.z(a)}else if(d==1){if(!b)b=a;var f=sa(b,a);var h=false;if(this.R()&&f>=7){var l=fa(a)+7;var n=fa(b)+7;l=(l-this.Aa())%7;n=(n-this.Aa())%7;var k;k=$(a.year,a.month,a.date-l);a=k.i();k=$(b.year,b.month,b.date+(6-n));b=k.i();h=this.Ia(a)}if(h){this.u(false)}var e=this.n;this.I=a;this.H=b;var q=this.N;var s=a.a();var u=b.a();var i=new G;for(;e;e=this.t[e.id]){var v=this.b[e.id];var r=this.f.contains(v);var m=v.a()>=s&&v.a()<=u;if(r!=m){this.C(e,m)}if(m){i.add(v)}}this.f=i;if(this.b[q.id].a()<u){q=this.N;var k=Q(this.b[this.N.id]);var A=null;do{k.date+=1;A=k.i();this.f.add(A)}while(!A.equals(b))}if(c)this.z(a,b)}};g.prototype.oa=function(a,b,c){if(this.r.month==a.month&&this.r.year==a.year&&!c)return false;b=arguments.length==1||b;this.r=j.create(a.year,a.month,1);this.p();if(b)this.ga.Z();return true};g.prototype.Za=function(){return this.r};g.prototype.Ia=function(a,b){if(a.a()>=this.ta.a()&&a.a()<=this.sa.a()){return false}return this.oa(a,b)};g.prototype.cb=function(){switch(this.aa()){case 0:if(this.f.s()){return this.f.U()[0]}else{return null}case 1:var a=this.I?this.I:null;var b=this.H?this.H:null;if(!a||!b)return null;return[a,b];case 2:return null;case 3:default:return null}};g.prototype.Db=function(){return this.f.s()};g.prototype.jb=function(a){if(this.pa){z(this.g+"sel").innerHTML=a}};g.prototype.C=function(a,b){if(this.ya||!a)return;if(!(typeof b!="undefined"))b=true;var c=[];var d=[];var e=" "+a.className+" ";var f=" "+this.c;if(b){if(-1!=e.indexOf(f+"today ")){c.push(f+"today ");d.push(f+"today_selected ")}if(-1!=e.indexOf(f+"weekday ")){c.push(f+"weekday ");d.push(f+"weekday_selected ")}else if(-1!=e.indexOf(f+"weekend ")){c.push(f+"weekend ");d.push(f+"weekend_selected ")}}else{if(-1!=e.indexOf(f+"today_selected ")){d.push(f+"today ");c.push(f+"today_selected ")}if(-1!=e.indexOf(f+"weekday_selected ")){d.push(f+"weekday ");c.push(f+"weekday_selected ")}else if(-1!=e.indexOf(f+"weekend_selected ")){d.push(f+"weekend ");c.push(f+"weekend_selected ")}}for(var h=0;h<c.length;++h){e=e.replace(c[h],d[h])}if(c.length!=0){a.className=e}};g.prototype.wb=function(a){this.ga.add(a)};g.prototype.Mb=function(a){this.ga.remove(a)};g.K=new Object;g.prototype.ub=function(){return this.g};g.staticGetPickerById=function(a){return g.K[a]};function Ha(a){var b=g.K[a];return b.oa(b.Fa)}function Ga(a){var b=g.K[a];return b.oa(b.Ea)}function Fa(a){var b=a.id;var c=b.match(/(.*)day_\d+_\d+/);var d=g.K[c[1]];return d.Sa(b)}g.prototype.Oa=function(){if(this.hb===true)return;this.hb=true};g.prototype.vb=function(a){return this.fa.add(a)};g.prototype.Lb=function(a){return this.fa.remove(a)};g.prototype.log=function(){this.fa.Z(arguments)};g.prototype.zb=function(){return this.Q};function G(){this.q={};this.S=0}G.prototype.s=function(){return this.S};G.prototype.add=function(a){var b=this.ra(a);if(b in this.q)return false;this.q[b]=a.i();++this.S;return true};G.prototype.remove=function(a){var b=this.ra(a);if(!(b in this.q))return false;delete this.q[b];--this.S;return true};G.prototype.clear=function(a){this.q={};this.S=0};G.prototype.contains=function(a){var b=this.ra(a);return b in this.q};G.prototype.U=function(){var a=new Array(this.s());var b=-1;for(var c in this.q)a[++b]=this.q[c];return a};G.prototype.ra=function(a){return a.toString().substr(0,9)};function J(a){this.kb=a;this.k=[]}J.prototype.add=function(a){if(!a)return false;for(var b=0;b<this.k.length;++b){if(a===this.k[b])return false}this.k.push(a);return true};J.prototype.remove=function(a){if(!a)return false;for(var b=0;b<this.k.length;++b){if(a===this.k[b]){this.k.splice(b,1);return true}}return false};J.prototype.Z=function(){for(var a=0;a<this.k.length;++a){this.k[a].apply(this.kb,arguments)}};J.prototype.s=function(){return this.k.length};J.prototype.iterator=function(){return new V(this)};function V(a){this.ea=a;this.ca=0;this.v=null}V.prototype.eb=function(){return this.ca<this.ea.s()};V.prototype.next=function(){if(this.eb()){this.v=this.ea.k[this.ca++]}else{this.v=null}return this.v};V.prototype.current=function(){return this.v};V.prototype.remove=function(){if(!this.v)throw new Error("no current element!");this.ea.remove(this.v);this.v=null;--this.ca};var x=null;function _InitializeDatePicker(a,b,c,d,e){var f=z(a);x=new g(f,false);x.qb(true);x.ob(function(){return"«"});x.nb(function(){return"»"});x.lb(b);x.Ga(1,c);x.mb(d["Sunday"]);x.ua(e);z("pickerContainer").style.display="";x.show()}function _DatePickerSetSelection(a){x.ma(a)}function _DatePickerGetSelection(){return x.cb()}function _DatePickerGetDateForCell(a){return x.Xa(a)}function _DatePickerGetMonths(){return x.bb()}function _DatePickerGetFirstDate(){return x.$a()}function _DatePickerGetLastDate(){return x.ab()}function _DatePickerPopulateHtml(){return x.p()}function _DatePickerIsVisible(){return x.gb()}function _DatePickerGetDisplayedMonth(){return x.Za()}function _ICAL_Date_create(a,b,c){return j.create(a,b,c)}function _ICAL_ToDate(a){return a.i()}function _ICAL_GetComparable(a){return a.a()}var _ICAL_DateTime=t;var _forid=z;var _ICAL_todaysDate=S;var _ical_builderCopy=Q;var _ToJSString=ma;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -