You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
10 KiB
Plaintext
1 line
10 KiB
Plaintext
var $dp,WdatePicker;(function(){var aa={$langList:[{name:"en",charset:"UTF-8"},{name:"zh_CN",charset:"UTF-8"},{name:"zh_TW",charset:"UTF-8"}],$skinList:[{name:"default",charset:"gb2312"},{name:"whyGreen",charset:"gb2312"},{name:"blue",charset:"gb2312"},{name:"green",charset:"gb2312"},{name:"simple",charset:"gb2312"},{name:"ext",charset:"gb2312"},{name:"blueFresh",charset:"gb2312"},{name:"twoer",charset:"gb2312"},{name:"YcloudRed",charset:"gb2312"}],$wdate:true,$crossFrame:false,$preLoad:false,$dpPath:"",doubleCalendar:false,enableKeyboard:true,enableInputMask:true,autoUpdateOnChanged:null,weekMethod:"MSExcel",position:{},lang:(window.lang||"auto"),skin:"twoer",dateFmt:"yyyy-MM-dd",realDateFmt:"yyyy-MM-dd",realTimeFmt:"HH:mm:ss",realFullFmt:"%Date %Time",minDate:"0001-01-01 00:00:00",maxDate:"9999-12-31 23:59:59",minTime:"00:00:00",maxTime:"23:59:59",startDate:"",alwaysUseStartDate:false,yearOffset:1911,firstDayOfWeek:1,isShowWeek:false,highLineWeekDay:true,isShowClear:true,isShowToday:true,isShowOK:true,isShowOthers:true,readOnly:false,errDealMode:0,autoPickDate:null,qsEnabled:true,autoShowQS:false,hmsMenuCfg:{H:[1,6],m:[5,6],s:[15,4]},opposite:false,specialDates:null,specialDays:null,disabledDates:null,disabledDays:null,onpicking:null,onpicked:null,onclearing:null,oncleared:null,ychanging:null,ychanged:null,Mchanging:null,Mchanged:null,dchanging:null,dchanged:null,Hchanging:null,Hchanged:null,mchanging:null,mchanged:null,schanging:null,schanged:null,eCont:null,vel:null,elProp:"",errMsg:"",quickSel:[],has:{},getRealLang:function(){var b=aa.$langList;for(var a=0;a<b.length;a++){if(b[a].name==this.lang){return b[a]}}return b[0]}};WdatePicker=af;var Y=window,ad={innerHTML:""},d="document",U="documentElement",I="getElementsByTagName",N,M,ae,ag,Q;var K=navigator.appName;if(K=="Microsoft Internet Explorer"){ae=true}else{if(K=="Opera"){Q=true}else{ag=true}}M=aa.$dpPath||T();if(aa.$wdate){Z(M+"skin/WdatePicker.css")}N=Y;if(aa.$crossFrame){try{while(N.parent!=N&&N.parent[d][I]("frameset").length==0){N=N.parent}}catch(e){}}if(!N.$dp){N.$dp={ff:ag,ie:ae,opera:Q,status:0,defMinDate:aa.minDate,defMaxDate:aa.maxDate}}ai();if(aa.$preLoad&&$dp.status==0){ab(Y,"onload",function(){af(null,true)})}if(!Y[d].docMD){ab(Y[d],"onmousedown",P,true);Y[d].docMD=true}if(!N[d].docMD){ab(N[d],"onmousedown",P,true);N[d].docMD=true}ab(Y,"onunload",function(){if($dp.dd){R($dp.dd,"none")}});function ai(){try{N[d],N.$dp=N.$dp||{}}catch(b){N=Y;$dp=$dp||{}}var a={win:Y,$:function(f){return(typeof f=="string")?Y[d].getElementById(f):f},$D:function(f,g){return this.$DV(this.$(f).value,g)},$DV:function(h,i){if(h!=""){this.dt=$dp.cal.splitDate(h,$dp.cal.dateFmt);if(i){for(var f in i){if(this.dt[f]===undefined){this.errMsg="invalid property:"+f}else{this.dt[f]+=i[f];if(f=="M"){var j=i.M>0?1:0;var g=new Date(this.dt.y,this.dt.M,0).getDate();this.dt.d=Math.min(g+j,this.dt.d)}}}}if(this.dt.refresh()){return this.dt}}return""},show:function(){var g=N[d].getElementsByTagName("div"),h=100000;for(var i=0;i<g.length;i++){var f=parseInt(g[i].style.zIndex);if(f>h){h=f}}this.dd.style.zIndex=h+2;R(this.dd,"block");R(this.dd.firstChild,"")},unbind:function(f){f=this.$(f);if(f.initcfg){O(f,"onclick",function(){af(f.initcfg)});O(f,"onfocus",function(){af(f.initcfg)})}},hide:function(){R(this.dd,"none")},attachEvent:ab};for(var c in a){N.$dp[c]=a[c]}$dp=N.$dp}function ab(c,b,a,g){if(c.addEventListener){var f=b.replace(/on/,"");a._ieEmuEventHandler=function(h){return a(h)};c.addEventListener(f,a._ieEmuEventHandler,g)}else{c.attachEvent(b,a)}}function O(a,b,c){if(a.removeEventListener){var f=b.replace(/on/,"");c._ieEmuEventHandler=function(g){return c(g)};a.removeEventListener(f,c._ieEmuEventHandler,false)}else{a.detachEvent(b,c)}}function S(a,c,f){if(typeof a!=typeof c){return false}if(typeof a=="object"){if(!f){for(var b in a){if(typeof c[b]=="undefined"){return false}if(!S(a[b],c[b],true)){return false}}}return true}else{if(typeof a=="function"&&typeof c=="function"){return a.toString()==c.toString()}else{return a==c}}}function T(){var b,a,f=Y[d][I]("script");for(var c=0;c<f.length;c++){b=f[c].getAttribute("src")||"";b=b.substr(0,b.toLowerCase().indexOf("wdatepicker.js"));var a=b.lastIndexOf("/");if(a>0){b=b.substring(0,a+1)}if(b){break}}return b}function Z(a,c,b){var g=Y[d][I]("HEAD").item(0),f=Y[d].createElement("link");if(g){f.href=a;f.rel="stylesheet";f.type="text/css";if(c){f.title=c}if(b){f.charset=b}g.appendChild(f)}}function W(f){f=f||N;var a=0,h=0;while(f!=N){var g=f.parent[d][I]("iframe");for(var c=0;c<g.length;c++){try{if(g[c].contentWindow==f){var b=X(g[c]);a+=b.left;h+=b.top;break}}catch(i){}}f=f.parent}return{leftM:a,topM:h}}function X(l,m){if(l.getBoundingClientRect){return l.getBoundingClientRect()}else{var k={ROOT_TAG:/^body|html$/i,OP_SCROLL:/^(?:inline|table-row)$/i};var f=false,g=null,a=l.offsetTop,j=l.offsetLeft,h=l.offsetWidth,b=l.offsetHeight;var i=l.offsetParent;if(i!=l){while(i){j+=i.offsetLeft;a+=i.offsetTop;if(ah(i,"position").toLowerCase()=="fixed"){f=true}else{if(i.tagName.toLowerCase()=="body"){g=i.ownerDocument.defaultView}}i=i.offsetParent}}i=l.parentNode;while(i.tagName&&!k.ROOT_TAG.test(i.tagName)){if(i.scrollTop||i.scrollLeft){if(!k.OP_SCROLL.test(R(i))){if(!Q||i.style.overflow!=="visible"){j-=i.scrollLeft;a-=i.scrollTop}}}i=i.parentNode}if(!f){var c=L(g);j-=c.left;a-=c.top}h+=j;b+=a;return{left:j,top:a,right:h,bottom:b}}}function w(c){c=c||N;var a=c[d],b=(c.innerWidth)?c.innerWidth:(a[U]&&a[U].clientWidth)?a[U].clientWidth:a.body.offsetWidth,f=(c.innerHeight)?c.innerHeight:(a[U]&&a[U].clientHeight)?a[U].clientHeight:a.body.offsetHeight;return{width:b,height:f}}function L(c){c=c||N;var a=c[d],f=a[U],b=a.body;a=(f&&f.scrollTop!=null&&(f.scrollTop>b.scrollTop||f.scrollLeft>b.scrollLeft))?f:b;return{top:a.scrollTop,left:a.scrollLeft}}function P(b){try{var a=b?(b.srcElement||b.target):null;if($dp.cal&&!$dp.eCont&&$dp.dd&&a!=$dp.el&&$dp.dd.style.display=="block"){$dp.cal.close()}}catch(b){}}function V(){$dp.status=2}var J,ac;function af(j,i){if(!$dp){return}ai();var f={};for(var a in j){f[a]=j[a]}for(var a in aa){if(a.substring(0,1)!="$"&&f[a]===undefined){f[a]=aa[a]}}if(i){if(!b()){ac=ac||setInterval(function(){if(N[d].readyState=="complete"){clearInterval(ac)}af(null,true)},50);return}if($dp.status==0){$dp.status=1;f.el=ad;aj(f,true)}else{return}}else{if(f.eCont){f.eCont=$dp.$(f.eCont);f.el=ad;f.autoPickDate=true;f.qsEnabled=false;aj(f)}else{if(aa.$preLoad&&$dp.status!=2){return}var g=h();if(Y.event===g||g){f.srcEl=g.srcElement||g.target;g.cancelBubble=true}f.el=f.el=$dp.$(f.el||f.srcEl);if(f.el==null){alert('WdatePicker:el is null!\nexample:onclick="WdatePicker({el:this})"');return}try{if(!f.el||f.el.My97Mark===true||f.el.disabled||($dp.dd&&R($dp.dd)!="none"&&$dp.dd.style.left!="-970px")){if(f.el.My97Mark){f.el.My97Mark=false}return}}catch(c){}if(g&&f.el.nodeType==1&&!S(f.el.initcfg,j)){$dp.unbind(f.el);ab(f.el,g.type=="focus"?"onclick":"onfocus",function(){af(j)});f.el.initcfg=j}aj(f)}}function b(){if(ae&&N!=Y&&N[d].readyState!="complete"){return false}return true}function h(){if(ag){try{func=h.caller;while(func!=null){var l=func.arguments[0];if(l&&(l+"").indexOf("Event")>=0){return l}func=func.caller}}catch(k){}return null}return event}}function ah(a,b){return a.currentStyle?a.currentStyle[b]:document.defaultView.getComputedStyle(a,false)[b]}function R(a,b){if(a){if(b!=null){a.style.display=b}else{return ah(a,"display")}}}function aj(g,h){var b=g.el?g.el.nodeName:"INPUT";if(h||g.eCont||new RegExp(/input|textarea|div|span|p|a/ig).test(b)){g.elProp=b=="INPUT"?"value":"innerHTML"}else{return}if(g.lang=="auto"){g.lang=ae?navigator.browserLanguage.toLowerCase():navigator.language.toLowerCase()}if(!g.eCont){for(var c in g){$dp[c]=g[c]}}if(!$dp.dd||g.eCont||($dp.dd&&(g.getRealLang().name!=$dp.dd.lang||g.skin!=$dp.dd.skin))){if(g.eCont){a(g.eCont,g)}else{$dp.dd=N[d].createElement("DIV");$dp.dd.style.cssText="position:absolute";N[d].body.appendChild($dp.dd);a($dp.dd,g);if(h){$dp.dd.style.left=$dp.dd.style.top="-970px"}else{$dp.show();f($dp)}}}else{if($dp.cal){$dp.show();$dp.cal.init();if(!$dp.eCont){f($dp)}}}function a(i,o){var p=N[d].domain,l=false,r='<iframe hideFocus=true width=9 height=7 frameborder=0 border=0 scrolling=no src="about:blank"></iframe>';i.innerHTML=r;var s=aa.$langList,j=aa.$skinList,k;try{k=i.lastChild.contentWindow[d]}catch(n){l=true;i.removeChild(i.lastChild);var q=N[d].createElement("iframe");q.hideFocus=true;q.frameBorder=0;q.scrolling="no";q.src="javascript:(function(){var d=document;d.open();d.domain='"+p+"';})()";i.appendChild(q);setTimeout(function(){k=i.lastChild.contentWindow[d];m()},97);return}m();function m(){var u=o.getRealLang();i.lang=u.name;i.skin=o.skin;var v=["<head><script>","","var doc=document, $d, $dp, $cfg=doc.cfg, $pdp = parent.$dp, $dt, $tdt, $sdt, $lastInput, $IE=$pdp.ie, $FF = $pdp.ff,$OPERA=$pdp.opera, $ny, $cMark = false;","if($cfg.eCont){$dp = {};for(var p in $pdp)$dp[p]=$pdp[p];}else{$dp=$pdp;};for(var p in $cfg){$dp[p]=$cfg[p];}","doc.oncontextmenu=function(){try{$c._fillQS(!$dp.has.d,1);showB($d.qsDivSel);}catch(e){};return false;};","<\/script><script src=",M,"lang/",u.name,".js charset=",u.charset,"><\/script>"];if(l){v[1]='document.domain="'+p+'";'}for(var t=0;t<j.length;t++){if(j[t].name==o.skin){v.push('<link rel="stylesheet" type="text/css" href="'+M+"skin/"+j[t].name+'/datepicker.css" charset="'+j[t].charset+'"/>')}}v.push('<script src="'+M+'calendar.js"><\/script>');v.push('</head><body leftmargin="0" topmargin="0" tabindex=0></body></html>');v.push('<script>var t;t=t||setInterval(function(){if((typeof(doc.ready)=="boolean"&&doc.ready)||doc.readyState=="complete"){new My97DP();$cfg.onload();$c.autoSize();$cfg.setPos($dp);clearInterval(t);}},20);<\/script>');o.setPos=f;o.onload=V;k.write("<html>");k.cfg=o;k.write(v.join(""));k.close()}}function f(p){var r=p.position.left,i=p.position.top,s=p.el;if(s==ad){return}if(s!=p.srcEl&&(R(s)=="none"||s.type=="hidden")){s=p.srcEl}var k=X(s),o=W(Y),j=w(N),n=L(N),q=$dp.dd.offsetHeight,l=$dp.dd.offsetWidth;if(isNaN(i)){i=0}if((o.topM+k.bottom+q>j.height)&&(o.topM+k.top-q>0)){i+=n.top+o.topM+k.top-q-2}else{i+=n.top+o.topM+k.bottom;var m=i-n.top+q-j.height;if(m>0){i-=m}}if(isNaN(r)){r=0}r+=n.left+Math.min(o.leftM+k.left,j.width-l-5)-(ae?2:0);p.dd.style.top=i+"px";p.dd.style.left=r+"px"}}})(); |