Edit D:\xinhaisoft\crisis_new\Scripts\jquery.jdate.js
??/* * ??????(jDate)??? * ??????????(QQ33080907) * ????????2015-4-2 * ?????????????????????????????????? */ ;(function($){ //?????? var today=new Date(); var todayyear=today.getFullYear(); var months="??,??,??,??,??,??,??,??,??,??,???,???".split(","); var monthlengths="31,28,31,30,31,30,31,31,30,31,30,31".split(","); var weekdays="??,??,??,??,??,??,??".split(","); var dateRegEx=/^(\d{4})(-|\/)(\d{1,2})(-|\/)(\d{1,2})$/; var yearRegEx=/^\d{4,4}$/; //?????????style??????????????ss??? var style="<style type='text/css'>"; style+=".jdate {border:1px solid #DDD;position:absolute;background:#F8F8F8;width:185px;}"; style+=".jdate thead .controls th {background:#F7B64C;text-align:left;padding:2px;border:1px solid #E78F08}"; style+=".jdate thead .controls select {font-size:12px;}"; style+=".jdate thead .days th {color:#333;font-size:12px;font-weight:bold;}"; style+=".jdate thead .about,.jdate .close {font-weight:bold;height:20px;width:20px;padding:0px;margin-left:1px;background:#fff;border:1px solid #ccc;}"; style+=".jdate tbody td {height:14px;text-align:right;font:9px Verdana;color:#4894CD;}"; style+=".jdate tbody td.date {cursor:pointer;border:1px solid #B7D8EC;background:#F0F7FB;}"; style+=".jdate tbody td.date.over {color:#D07434;background:#FDF5D0;border:1px solid #FBCB09;}"; style+=".jdate tbody td.date.chosen {font-weight:bold;color:#5D364B;border:1px solid #FED22F;background:#FFF0A5;}"; style+=".jdate tbody td.date.disabled {cursor:default;background:#F1F1F1;border:1px solid #E2E2E2;color:#A5CFDF;}"; style+=".jdate tfoot td {background:#FDF9E1;border:1px solid #FBCB09;font:12px Verdana;color:#333;padding:2px;cursor:pointer;}"; style+=".jdate tfoot td.over {background:#FFF0A5;}"; style+=".jdate tfoot td.disabled {cursor:auto;color:#999;}"; style+="</style>"; $("head").append(style); //?????????????????????????? today=new Date(todayyear,today.getMonth(),today.getDate()); //?????? $.fn.jDate=function(options){ var defaults={ chosendate:today, //?????????????????????? startdate:todayyear-100, //??????????????????????????4?????????????????????????????????????????????????????????????????????? enddate:todayyear+1, //??????????????? showtoday:true //????????????????????? }; var opts=$.extend({},defaults,options); //????????? getRange(); return this.each(function(){ var jdate; jQuery.data(jQuery(this).get(0),"jdate",{hasjdate:false}); jQuery(this).click(function(e){ var $this=jQuery(this); //DOM??????jQuery??? var element=$this.get(0); //???????????????????? if(jQuery.data(element,"jdate").hasjdate==false){ jQuery.data(element,"jdate",{hasjdate:true}); //?????????????????? var initialDate=$this.val(); //????????????? if(initialDate&&dateRegEx.test(initialDate)){var chosendate=getTheDate(initialDate);} //?????? else if(opts.chosendate.constructor==Date){var chosendate=opts.chosendate;} else{ var chosendate=getTheDate(opts.chosendate); //?????????????????????????? if(chosendate<opts.startdate||chosendate>opts.enddate){var chosendate=today;} } //?????????????????????????????? if(chosendate<opts.startdate||chosendate>opts.enddate){var chosendate=opts.startdate;} //jdate??TML??? jdate=newDateHTML(); //??????????? var xy=$this.offset(); var x=xy.left; var y=xy.top+$this.outerHeight()+1; jdate.css({"left":x,"top":y}); //?????ody?? jdate.hide().appendTo("body").fadeIn("normal"); //jQuery("body").append(jdate); //????????????????????? jQuery("select",jdate).on("change",function(){loadDate(element,jdate,chosendate);}); //????????? jQuery("input:button.about",jdate).on("click",function(){alert("jQuery????????? ??????????(QQ33080907)");}); //jQuery(":button.about",jdate).remove(); //????????? jQuery("input:button.close",jdate).on("click",function(){closeIt(element,jdate,initialDate);}); //????????????????? jQuery("select[name='year']",jdate).val(chosendate.getFullYear()); jQuery("select[name='month']",jdate).val(chosendate.getMonth()); loadDate(element,jdate,chosendate); } }); }); //?????????????????? function newDateHTML(){ var table=jQuery("<table class='jdate'></table>"); table.append('<thead></thead>'); table.append('<tfoot></tfoot>'); table.append('<tbody></tbody>'); //????????? var yearselect="<select name='year'>"; for(var i=opts.enddate.getFullYear();i>=opts.startdate.getFullYear();i--){yearselect+="<option>"+i+"</option>";} yearselect+="</select>"; //????????? var monthselect="<select name='month'>"; for(var i in months){monthselect+="<option value='"+i+"'>"+months[i]+"??</option>";} monthselect+="</select>"; //????????????????????head?? jQuery("thead",table).append("<tr class='controls'><th colspan='7'><div style='float:left'>"+yearselect+" "+monthselect+"</div><div style='float:right'><input type='button' class='about' value='!' title='???...'><input type='button' class='close' value='×' title='???'></div></th></tr>"); //???????????????thead?? jQuery("thead",table).append("<tr class='days'></tr>"); for(var i=0;i<7;i++){jQuery("thead>tr.days",table).append("<th>"+weekdays[i]+"</th>");} //??body?????6?????d for(var i=0;i<6;i++){jQuery("tbody",table).append("<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>");} //?????????????? if(opts.showtoday){jQuery("tfoot",table).append("<tr><td colspan='7'>??????"+today.getFullYear()+"??"+(today.getMonth()+1)+"??"+today.getDate()+"??</td></tr>");} //???table??? return table; } //????????????????????????????????????? function loadDate(element,jdate,chosendate){ //???????????????????????????????????itle???? var td=jQuery("tbody td",jdate).off().empty().removeClass().removeAttr("title"); //??????????????????????????0????????1?????????????? var y=jQuery("select[name='year']",jdate).val(); var m=jQuery("select[name='month']",jdate).val(); //???????? var d=new Date(y,m,1); //???????????????0?????????1???????????????? var startindex=d.getDay(); //?????????????? var numdays=monthlengths[m]; //????????? if(m==1&&((y%4==0&&y%100!=0)||y%400==0)){numdays=29;} //??????????????????????????????? jQuery("tr",jdate).show(); //????????????td???i?????1???????? for(var i=1;i<=numdays;i++){ var cell=td.eq(i+startindex-1).text(i).addClass("date"); //???td????? var date=new Date(y,m,cell.text()); //???td????????? var datestring=getTheString(date); //?????????? if(date>=opts.startdate&&date<=opts.enddate){ cell .attr("title",datestring) .hover(function(){jQuery(this).addClass("over");},function(){jQuery(this).removeClass("over");}) .on("click",function(){closeIt(element,jdate,jQuery(this).attr("title"));}); //??????????????????? if(datestring==getTheString(chosendate)){cell.addClass("chosen");} } else{cell.addClass("disabled");} } //??? if(opts.showtoday){ var cell=jQuery("tfoot>tr>td",jdate); if(today>=opts.startdate&&today<=opts.enddate){ cell .hover(function(){jQuery(this).addClass("over");},function(){jQuery(this).removeClass("over");}) .on("click",function(){closeIt(element,jdate,getTheString(today));}); } else{cell.addClass("disabled");} } //???????????????? if(jQuery("tbody>tr:last>td",jdate).text()==""){jQuery("tbody>tr:last",jdate).hide();} } //???????? function closeIt(element,jdate,datestring){ jQuery(element).val(datestring); jdate.remove(); jdate=null; jQuery.data(element,"jdate",{hasjdate:false}); } //??????????????????????? function getTheDate(str){ //?????????????????í var str=str.replace(/\//g,"-").split("-"); //????????0????? return (new Date(str[0],str[1]*1-1,str[2])); } //????????????????? function getTheString(date){ return (date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate()); } //????????? function getRange(){ //???? if(opts.startdate.constructor==Date){opts.startdate=new Date(opts.startdate.getFullYear(),opts.startdate.getMonth(),opts.startdate.getDate());} else if(yearRegEx.test(opts.startdate)){opts.startdate=new Date(opts.startdate,0,1);} else if(dateRegEx.test(opts.startdate)){opts.startdate=getTheDate(opts.startdate);} else{opts.startdate=today;} //??? if(opts.enddate.constructor==Date){opts.enddate=new Date(opts.enddate.getFullYear(),opts.enddate.getMonth(),opts.enddate.getDate());} else if(yearRegEx.test(opts.enddate)){opts.enddate=new Date(opts.enddate,11,31);} else if(dateRegEx.test(opts.enddate)){opts.enddate=getTheDate(opts.enddate);} else{opts.enddate=today;} //????????????? if(opts.startdate>opts.enddate){alert("?????????jDate??????????????????");return false;} } //??? function debug(str){ if(jQuery("#debug").size()==0){$("body").prepend("<div id='debug' style='position:absolute;background:#F00;color:#FFF;padding:5px;filter:alpha(Opacity=80);opacity:0.8;font-size:12px'></div>");} jQuery("#debug").append(str+"<br />"); } }; })(jQuery);
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de