You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Prowlarr/NzbDrone.Web/Scripts/2010.2.825/telerik.datepicker.min.js

1 line
11 KiB

14 years ago
(function(d){var b=d.telerik;var a=null;var c=/\d/;d.extend(b.datetime,{parse:function(e,g,f,h,i){g=b.calendar.standardFormat(g)?b.calendar.standardFormat(g):g;if(c.test(e)){return b.datetime.parseMachineDate(e,g,h,i)}return b.datetime.parseByToken(e,f,h,i)},parseMachineDate:function(i,l,E,u){var q=-1;var x=-1;var r=-1;var h=0;var o=0;var s=0;var k="+10";var A;var m=false;var D=function(G){var F=0;while(p(G)){F++;t++}return F};var f=function(){var F=p("'");if(F){t++}return F};var p=function(F){return(t+1<l.length&&l.charAt(t+1)==F)};var v=function(G){var H=new RegExp("^\\d{1,"+G+"}");var F=i.substr(y).match(H);if(F){y+=F[0].length;return parseInt(F[0],10)}else{return -1}};var j=function(F){for(var G=0;G<F.length;G++){if(i.substr(y,F[G].length)==F[G]){y+=F[G].length;return G+1}}return -1};var B=function(){if(i.charAt(y)==l.charAt(t)){y++}};var z=0;var y=0;var e=i.length;for(var t=0,n=l.length;t<n;t++){if(y==e){break}if(m){B();if(l.charAt(t)=="'"){m=false}}else{switch(l.charAt(t)){case"d":z=D("d");r=z<=1?v(2):j(b.cultureInfo[z==3?"days":"abbrDays"]);break;case"M":z=D("M");x=z<=1?v(2):j(b.cultureInfo[z==3?"months":"abbrMonths"]);break;case"y":z=D("y");q=v(z<=1?2:4);break;case"H":h=v(D("H")+1);break;case"h":h=v(D("h")+1);break;case"m":o=v(D("m")+1);break;case"s":s=v(D("s")+1);break;case"t":z=D("t");var C=i.substr(y,z+1).toLowerCase();A=C=="pm"||C=="p";case"'":B();m=true;break;default:B()}}}var g=new b.datetime();if(q==-1){q=g.year()}else{if(q<100){q+=g.year()-g.year()%100+(q<=k?0:-100)}}var w=new b.datetime(q,x-1,r,A?h+12:h,o,s);if(q==-1||x==-1||r==-1){return null}if(E&&u){w=b.calendar.isInRange(w,E,u)?w:null}return w},parseByToken:function(i,k,g,m){k=k||new b.datetime();var e=null;var o=null;var h=null;var p=0;var f=function(q){var r=null;if(q&&i.substring(p,p+q.length).toLowerCase()==q.toLowerCase()){r=q}return r};var l=function(){var q=null;d.each(["days","abbrDays","months","abbrMonths"],function(s,r){if(q!==null){return}d.each(b.cultureInfo[r],function(u,t){if(q!==null){return}q=f(t)});h=r});return q};var j=function(){var q;var r=function(t,u){k[u?"date":"month"](k[u?"date":"month"]()+(q!=0?((q+((q>0?1:-1)*t))%t):0)+(o?(e==b.cultureInfo.next?1:-1)*t:0))};var s=d.inArray(o||e,b.cultureInfo[h]);if(h.toLowerCase().indexOf("day")>-1){q=(s==0?7:s)-k.day();r(7,true)}else{q=s-k.month();r(12,false)}};var n=function(){var r=function(s){var t;switch(o){case"year":t=s==1?1:0;break;case"month":t=s==2?1:0;break;case"week":t=s==3?7:0;break;case"day":t=s==3?1:0;break}return t};var q=(e==b.cultureInfo.next?1:-1);k.year(k.year()+r(1)*q,k.month()+r(2)*q,k.date()+r(3)*q)};d.each(["today","tomorrow","yesterday","next","last"],function(r,q){if(e!==null){return}e=f(b.cultureInfo[q])});if(e!==null){p+=e.length;if(/[^\s\d]\s+[^\s\d]/i.test(i)){p++;d.each(["year","month","week","day"],function(r,q){if(o!==null){return}o=f(b.cultureInfo[q])});h=null;if(o===null){o=l()}if(o===null){return null}}else{switch(e){case b.cultureInfo.today:break;case b.cultureInfo.tomorrow:k.date(k.date()+1);break;case b.cultureInfo.yesterday:k.date(k.date()-1);break;default:k=null;break}if(g&&m){k=b.calendar.isInRange(k,g,m)?k:null}return k}}else{e=l();if(e!=null){j();if(g&&m){k=b.calendar.isInRange(k,g,m)?k:null}return k}else{return null}}if(h!==null){j()}else{n()}if(g&&m){k=b.calendar.isInRange(k,g,m)?k:null}return k}});b.datepicker=function(e,f){this.element=e;this.isValueChanged=false;d.extend(this,f);d("> .t-icon",e).bind("click",b.delegate(this,this.togglePopup));this.$input=d(".t-input",e).keydown(b.delegate(this,this.keyDown)).focus(b.delegate(this,this.show)).attr("autocomplete","off");this.focusedDate=this.selectedDate||(b.calendar.isInRange(this.focusedDate,this.minDate,this.maxDate)?this.focusedDate:new b.datetime(this.minDate.value));b.bind(this,{open:this.onOpen,close:this.onClose,change:this.onChange,load:this.onLoad})};d.extend(b.datepicker,{hideSharedCalendar:function(h){var f=a.data("associatedDatePicker");if(f){if(d.contains(f,h.target)||d.contains(a[0],h.target)){return}var g=d(f).data("tDatePicker");if(!g){g=d(f).tDatePicker().data("tDatePicker")