sonarr-repo-only/packages/TelerikMvcExtensions.2011.3.../content/Scripts/2011.3.1115/telerik.datepicker.min.js

1 line
12 KiB
JavaScript
Raw Normal View History

2011-11-23 01:51:44 +00:00
(function(a){var b=a.telerik;b.scripts.push("telerik.datepicker.js");var f=null,d=(navigator.userAgent.search(/like\sMac\sOS\sX;.*Mobile\/\S+/)!=-1),e=(navigator.userAgent.search(/4_1\slike\sMac\sOS\sX;.*Mobile\/\S+/)!=-1);b.datetime.parseByToken=function(p,n){if(p===null||p===""){return null}n=n||new b.datetime();var i=null;var m=null;var o=null;var k=0;var j=function(q){var r=null;if(q&&p.substring(k,k+q.length).toLowerCase()==q.toLowerCase()){r=q}return r};var l=function(){var q=null;a.each(["days","abbrDays","months","abbrMonths"],function(r,s){if(q!==null){return}a.each(b.cultureInfo[s],function(t,u){if(q!==null){return}q=j(u)});o=s});return q};var g=function(){var r;var s=function(u,t){n[t?"date":"month"](n[t?"date":"month"]()+(r!=0?((r+((r>0?1:-1)*u))%u):0)+(m?(i==b.cultureInfo.next?1:-1)*u:0))};var q=a.inArray(m||i,b.cultureInfo[o]);if(o.toLowerCase().indexOf("day")>-1){r=(q==0?7:q)-n.day();s(7,true)}else{r=q-n.month();s(12,false)}};var h=function(){var r=function(t){var s;switch(m){case"year":s=t==1?1:0;break;case"month":s=t==2?1:0;break;case"week":s=t==3?7:0;break;case"day":s=t==3?1:0;break}return s};var q=(i==b.cultureInfo.next?1:-1);n.year(n.year()+r(1)*q,n.month()+r(2)*q,n.date()+r(3)*q)};a.each(["today","tomorrow","yesterday","next","last"],function(q,r){if(i!==null){return}i=j(b.cultureInfo[r])});if(i!==null){k+=i.length;if(/[^\s\d]\s+[^\s\d]/i.test(p)){k++;a.each(["year","month","week","day"],function(q,r){if(m!==null){return}m=j(b.cultureInfo[r])});o=null;if(m===null){m=l()}if(m===null){return null}}else{switch(i){case b.cultureInfo.today:break;case b.cultureInfo.tomorrow:n.date(n.date()+1);break;case b.cultureInfo.yesterday:n.date(n.date()-1);break;default:n=null;break}return n}}else{i=l();if(i!=null){g();return n}else{return null}}if(o!==null){g()}else{h()}return n};function c(g,j,i,h){if(j){g=new Date(j)}if(i>g){g=new Date(i)}else{if(h<g){g=new Date(h)}}return g}b.dateView=function(g){a.extend(this,g);this.isValueChanged=false;this.focusedValue=c(new Date(),this.selectedValue,this.minValue,this.maxValue);this.$calendar=this._createSharedCalendar()};b.dateView.prototype={_createSharedCalendar:function(){if(!f){f=a(b.calendar.html(new b.datetime(this.focusedValue),this.selectedValue?new b.datetime(this.selectedValue):null,new b.datetime(this.minValue),new b.datetime(this.maxValue))).hide().addClass("t-popup t-datepicker-calendar").appendTo(document.body).tCalendar({selectedValue:this.selectedValue,minDate:this.minValue,maxDate:this.maxValue});if(a.browser.msie&&parseInt(a.browser.version)<7){f.prepend('<iframe src="javascript:\'\';" style="position:absolute; width: 100%; height: 190px; border: 0; top: 0; left: 0; opacity: 0; filter:alpha(opacity=0);"></iframe>')}b.fx._wrap(f).css("display","none");if(a.browser.msie&&a.browser.version<=6){a('<iframe class="t-iframe-overlay" src="javascript:false;"></iframe>').prependTo(f).height(f.height())}}return f},_getCalendar:function(){return f.data("tCalendar")},_reassignSharedCalendar:function(){var g=this._getCalendar();if(f.data("associatedDateView")!=this){f.stop(true,true);this.focusedValue=c(this.focusedValue,this.selectedValue,this.minValue,this.maxValue);g.minDate=this.minValue;g.maxDate=this.maxValue;g.selectedValue=this.selectedValue;g.goToView(0,this.focusedValue);f.unbind("change").bind("change",a.proxy(function(h){var j=this.selectedValue;var i=new b.datetime(h.date);if(j!==null){i.hours(j.getHours()).minutes(j.getMinutes()).seconds(j.getSeconds()).milliseconds(j.getMilliseconds())}this.onChange(i.toDate())},this)).unbind("navigate").bind("navigate",a.proxy(function(h){var i=this.focusedValue;var j=g.viewedMonth;var k=g.currentView.index;i.setFullYear(j.year(),j.month(),i.getDate());b.calendar.focusDate(i,k,f,h.direction)},this)).data("associatedDateView",this);if(this.selectedValue){g.value(this.selectedValue)}b.calendar.focusDate(this.focusedValue,g.currentView.index,f)}},open:function(j){if(this.isOpened()){return}this._reassignSharedCalendar();var i=this.isRtl;var g=this.$calendar;elementPosition=j.offset;elementPosition.top+=j.outerHeight;if(d){