1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00
Sonarr/NzbDrone.Web/Scripts/2011.1.315/telerik.common.min.js
2011-03-28 21:52:17 -07:00

1 line
19 KiB
JavaScript

(function(i){try{if(document.execCommand){document.execCommand("BackgroundImageCache",false,true)}}catch(l){}var q=/\d/;var h=/\s+/;var k=parseInt(i.browser.version.substring(0,5).replace(".",""));var d=i.browser.mozilla&&k>=180&&k<=191;var s=/d{1,4}|M{1,4}|yy(?:yy)?|([Hhmstf])\1*|"[^"]*"|'[^']*'/g;var n=i.telerik={create:function(e,t){var v=t.name;var u=i.extend({},i.fn[v].defaults,t.options);return e.each(function(){var w=i(this);u=i.meta?i.extend({},u,w.data()):u;if(!w.data(v)){var x=t.init(this,u);w.data(v,x);n.trigger(this,"load");if(t.success){t.success(x)}}})},toJson:function(e){function t(v){return"["+i.map(v,u).join(",")+"]"}function u(x){var w=[];for(var y in x){var v=x[y];if(i.isArray(v)){w.push('"'+y+'":'+t(v))}else{if(typeof v!="object"){w.push('"'+y+'":"'+(v==null?"":v)+'"')}else{w.push('"'+y+'":'+u(v))}}}return"{"+w.join(",")+"}"}if(i.isArray(e)){return t(e)}else{return u(e)}},delegate:function(t,e){return function(u){e.apply(t,[u,this])}},stop:function(e,t){return function(u){u.stopPropagation();e.apply(t||this,arguments)}},stopAll:function(e,t){return function(u){u.preventDefault();u.stopPropagation();e.apply(t||this,arguments)}},bind:function(e,t){var u=i(e.element?e.element:e);i.each(t,function(v){if(i.isFunction(this)){u.bind(v,this)}})},preventDefault:function(t){t.preventDefault()},hover:function(){i(this).addClass("t-state-hover")},leave:function(){i(this).removeClass("t-state-hover")},buttonHover:function(){i(this).addClass("t-button-hover")},buttonLeave:function(){i(this).removeClass("t-button-hover")},stringBuilder:function(){this.buffer=[]},ajaxError:function(v,u,e,w){var t=this.trigger(v,u,{XMLHttpRequest:e,textStatus:w});if(!t){if(w=="error"&&e.status!="0"){alert("Error! The requested URL returned "+e.status+" - "+e.statusText)}if(w=="timeout"){alert("Error! Server timeout.")}}return t},trigger:function(u,t,v){v=i.extend(v||{},new i.Event(t));v.stopPropagation();i(u).trigger(v);return v.isDefaultPrevented()},getType:function(e){if(e instanceof Date){return"date"}if(!isNaN(e)){return"number"}return"object"},formatString:function(){var w=arguments[0];for(var e=0,t=arguments.length-1;e<t;e++){var v=new RegExp("\\{"+e+"(:([^\\}]+))?\\}","gm");var u=arguments[e+1];var x=this.formatters[this.getType(u)];if(x){var y=v.exec(w);if(y){u=x(u,y[2])}}w=w.replace(v,function(){return u})}return w},getElementZIndex:function(e){var t="auto";i(e).parents().andSelf().each(function(){t=i(this).css("zIndex");if(Number(t)){t=Number(t)+1;return false}});return t},lastIndexOf:function(e,t){var u=t.length;for(var v=e.length-1;v>-1;v--){if(e.substr(v,u)==t){return v}}return -1},caretPos:function(e){var t=-1;if(document.selection){t=Math.abs(e.document.selection.createRange().moveStart("character",-e.value.length))}else{if(e.selectionStart!==undefined){t=e.selectionStart}}return t},encode:function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\u00a0/g,"&nbsp;")},formatters:{},fx:{},cultureInfo:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbrDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],abbrMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longTime:"h:mm:ss tt",longDate:"dddd, MMMM dd, yyyy",shortDate:"M/d/yyyy",shortTime:"h:mm tt",fullDateTime:"dddd, MMMM dd, yyyy h:mm:ss tt",generalDateShortTime:"M/d/yyyy h:mm tt",generalDateTime:"M/d/yyyy h:mm:ss tt",sortableDateTime:"yyyy'-'MM'-'ddTHH':'mm':'ss",universalSortableDateTime:"yyyy'-'MM'-'dd HH':'mm':'ss'Z'",monthYear:"MMMM, yyyy",monthDay:"MMMM dd",today:"today",tomorrow:"tomorrow",yesterday:"yesterday",next:"next",last:"last",year:"year",month:"month",week:"week",day:"day",am:"AM",pm:"PM",dateSeparator:"/",timeSeparator:":",firstDayOfWeek:0}};var a,o;if(Array.prototype.filter!==undefined){a=function(e,t){return e.filter(t)}}else{a=function(x,u){var w=[],v=x.length;for(var t=0;t<v;t++){var e=x[t];if(u(e,t,x)){w[w.length]=e}}return w}}if(Array.prototype.map!==undefined){o=function(t,e){return t.map(e)}}else{o=function(e,v){var u=e.length,t=new Array(u);for(var w=0;w<u;w++){t[w]=v(e[w],w,e)}return t}}var r=function(e){return new r.fn.init(e)};n.query=r;r.fn=r.prototype={init:function(e){this.data=e;return this},toArray:function(){return this.data},where:function(e){return r(a(this.data,e))},select:function(e){return r(o(this.data,e))},skip:function(e){return r(this.data.slice(e))},take:function(e){return r(this.data.slice(0,e))},orderBy:function(e){var t=this.data.slice(0);return r(t.sort(function(u,v){u=e(u);v=e(v);return u>v?1:(u<v?-1:0)}))},orderByDescending:function(e){var t=this.data.slice(0);return r(t.sort(function(u,v){u=e(u);v=e(v);return u<v?1:(u>v?-1:0)}))},concat:function(e){return r(this.data.concat(e.data))},count:function(){return this.data.length},any:function(e){if(i.isFunction(e)){for(var t=0,u=this.data.length;t<u;t++){if(e(this.data[t],t)){return true}}return false}return !!this.data.length}};r.fn.init.prototype=r.fn;n.dropDown=function(e){i.extend(this,e);this.$element=i(new n.stringBuilder().cat("<div ").catIf(e.attr,e.attr).cat('><ul class="t-reset"></ul></div>').string()).addClass("t-popup t-group").hide()};n.dropDown.prototype={_html:function(w){var u=new n.stringBuilder();if(w){for(var t=0,x=w.length;t<x;t++){var y="&nbsp;",v=w[t];if(v){if(v.Text!==undefined){y=v.Text}else{y=v}if(!y||!y.replace(h,"")){y="&nbsp;"}}var z={html:y,dataItem:v};if(this.onItemCreate){this.onItemCreate(z)}u.cat('<li class="t-item">').cat(z.html).cat("</li>")}}return u.string()},open:function(e){if(this.onOpen){this.onOpen()}if(this.isOpened()||!this.$items){return}var w=this.$element,u=".t-reset > .t-item";w.appendTo(document.body);var t;if(w[0].style.width==""){t=e.outerWidth?e.outerWidth-2:0}else{t=parseInt(this.attr?i("<div"+this.attr+"></div>")[0].style.width:w[0].style.width)}w.css("overflowY","auto").css("width",t);w.delegate(u,"mouseenter",n.hover).delegate(u,"mouseleave",n.leave).delegate(u,"click",i.proxy(function(x){if(this.onClick){this.onClick(i.extend(x,{item:i(x.target).closest(".t-item")[0]}))}},this));var v=e.offset;v.top+=e.outerHeight;n.fx._wrap(w).css(i.extend({position:"absolute",zIndex:e.zIndex},v));if(d){w.css("overflow","hidden")}n.fx.play(this.effects,w,{direction:"bottom"},i.proxy(function(){if(d){w.css("overflow","auto")}var x=this.$items.filter(".t-state-selected");if(x.length){this.scrollTo(x[0])}},this))},close:function(){if(!this.isOpened()){return}var e=this.$element;if(d){e.css("overflow","hidden")}n.fx.rewind(this.effects,e,{direction:"bottom"},function(){if(d){e.css("overflow","auto")}e.parent().remove()})},dataBind:function(t){t=t||[];var w=this.$element;var v=w[0].style.height;var u=v&&v!="auto"?w[0].style.height:"200px";var e=this.$items=i(this._html(t));w.find("> ul").html(e);w.css("height",e.length>10?u:"auto")},highlight:function(e){return i(e).addClass("t-state-selected").siblings().removeClass("t-state-selected").end().index()},isOpened:function(){return this.$element.is(":visible")},scrollTo:function(y){if(!y){return}var e=y.offsetTop;var w=y.offsetHeight;var t=this.$element[0];var u=t.scrollTop;var x=t.clientHeight;var v=e+w;t.scrollTop=u>e?e:v>(u+x)?v-x:u}};n.datetime=function(){if(arguments.length==0){this.value=new Date()}else{if(arguments.length==1){this.value=new Date(arguments[0])}else{if(arguments.length==3){this.value=new Date(arguments[0],arguments[1],arguments[2])}else{if(arguments.length==6){this.value=new Date(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])}else{this.value=new Date(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6])}}}}return this};i.extend(n.datetime,{msPerMinute:60000,msPerDay:86400000,add:function(w,t){var u=w.timeOffset();var v=new n.datetime(w.time()+t);var e=v.timeOffset()-u;return new n.datetime(v.time()+e*n.datetime.msPerMinute)},subtract:function(v,u){u=new n.datetime(u).toDate();var e=v.time()-u;var t=v.timeOffset()-u.timeOffset();return e-(t*n.datetime.msPerMinute)},firstDayOfMonth:function(e){return new n.datetime(0).hours(e.hours()).minutes(e.minutes()).seconds(e.seconds()).milliseconds(e.milliseconds()).year(e.year(),e.month(),1)},firstVisibleDay:function(u){var e=n.cultureInfo.firstDayOfWeek;var t=new n.datetime(u.year(),u.month(),0,u.hours(),u.minutes(),u.seconds(),u.milliseconds());while(t.day()!=e){n.datetime.modify(t,-1*n.datetime.msPerDay)}return t},modify:function(w,e){var u=w.timeOffset();var t=new n.datetime(w.time()+e);var v=t.timeOffset()-u;w.time(t.time()+v*n.datetime.msPerMinute)},pad:function(e){if(e<10){return"0"+e}return e},standardFormat:function(e){var t=n.cultureInfo;var u={d:t.shortDate,D:t.longDate,F:t.fullDateTime,g:t.generalDateShortTime,G:t.generalDateTime,m:t.monthDay,M:t.monthDay,s:t.sortableDateTime,t:t.shortTime,T:t.longTime,u:t.universalSortableDateTime,y:t.monthYear,Y:t.monthYear};return u[e]},format:function(E,e){var z=n.cultureInfo;var C=E.getDate();var t=E.getDay();var B=E.getMonth();var u=E.getFullYear();var x=E.getHours();var w=E.getMinutes();var v=E.getSeconds();var D=E.getMilliseconds();var A=n.datetime.pad;var F={d:C,dd:A(C),ddd:z.abbrDays[t],dddd:z.days[t],M:B+1,MM:A(B+1),MMM:z.abbrMonths[B],MMMM:z.months[B],yy:A(u%100),yyyy:u,h:x%12||12,hh:A(x%12||12),H:x,HH:A(x),m:w,mm:A(w),s:v,ss:A(v),f:Math.floor(D/100),ff:Math.floor(D/10),fff:D,tt:x<12?z.am:z.pm};e=e||"G";e=n.datetime.standardFormat(e)?n.datetime.standardFormat(e):e;return e.replace(s,function(y){return y in F?F[y]:y.slice(1,y.length-1)})},parse:function(u){var e=u.value;var t=u.format;if(e&&e.value){return e}t=n.datetime.standardFormat(t)?n.datetime.standardFormat(t):t;if(q.test(e)){return n.datetime.parseMachineDate({value:e,format:t,shortYearCutOff:u.shortYearCutOff,baseDate:u.baseDate,AM:n.cultureInfo.am,PM:n.cultureInfo.pm})}return n.datetime.parseByToken?n.datetime.parseByToken(e,u.today):null},parseMachineDate:function(H){var V=H.AM,O=H.PM,v=H.value,y=H.format,e=H.baseDate,R=H.shortYearCutOff||30,C=-1,L=-1,D=-1,u=0,B=0,F=0,E=0,T,P,z=false,I=function(W){return(G+1<y.length&&y.charAt(G+1)==W)},U=function(X){var W=0;while(I(X)){W++;G++}return W},J=function(X){var Y=new RegExp("^\\d{1,"+X+"}");var W=v.substr(M).match(Y);if(W){M+=W[0].length;return parseInt(W[0],10)}else{return -1}},w=function(W){for(var X=0;X<W.length;X++){if(v.substr(M,W[X].length)==W[X]){M+=W[X].length;return X+1}}return -1},Q=function(){if(v.charAt(M)==y.charAt(G)){M++}},S=function(W){return W===-1?0:W},N=0,M=0,t=v.length;for(var G=0,A=y.length;G<A;G++){if(M==t){break}if(z){Q();if(y.charAt(G)=="'"){z=false}}else{switch(y.charAt(G)){case"d":N=U("d");D=N<=1?J(2):w(n.cultureInfo[N==3?"days":"abbrDays"]);break;case"M":N=U("M");L=N<=1?J(2):w(n.cultureInfo[N==3?"months":"abbrMonths"]);break;case"y":N=U("y");C=J(N<=1?2:4);break;case"H":N=U("H");u=S(J(2));break;case"h":U("h");u=S(J(2));break;case"m":U("m");B=S(J(2));break;case"s":U("s");F=S(J(2));break;case"f":N=U("f");E=S(J(N<=0?1:N+1));break;case"t":N=U("t");V=N>0?V:"a";O=N>0?O:"p";var x=v.substr(M).toLowerCase();T=x.indexOf(V.toLowerCase())!=-1;P=x.indexOf(O.toLowerCase())!=-1;M+=P?O.length:T?V.length:0;break;case"'":Q();z=true;break;default:Q()}}}var K=new n.datetime();if(C!=-1&&C<100){C+=K.year()-K.year()%100+(C<=R?0:-100)}u=(P&&u<12)?u+12:u==12&&T?0:u;if(e==undefined){if(C==-1){C=K.year()}K=new n.datetime(C,L-1,D,u,B,F,E);if(K.year()!=C||K.month()!=(L-1)||K.date()!=D){return null}}else{K=e.year(C!=-1?C:e.year()).month(L!=-1?L-1:e.month()).date(D!=-1?D:e.date()).hours(u).minutes(B).seconds(F).milliseconds(E);if((C!=-1&&K.year()!=C)||(L!=-1&&K.month()!=(L-1))||(D!=-1&&K.date()!=D)||(u!=-1&&K.hours()!=u)||(B!=-1&&K.minutes()!=B)||(F!=-1&&K.seconds()!=F)||(E!=-1&&K.milliseconds()!=E)){return null}}return K}});n.datetime.prototype={year:function(){if(arguments.length==0){return this.value.getFullYear()}else{if(arguments.length==1){this.value.setFullYear(arguments[0])}else{this.value.setFullYear(arguments[0],arguments[1],arguments[2])}}return this},timeOffset:function(){return this.value.getTimezoneOffset()},day:function(){return this.value.getDay()},toDate:function(){return this.value},addMonth:function(e){this.month(this.month()+e)},addYear:function(e){this.year(this.year()+e)}};i.each(["Month","Date","Hours","Minutes","Seconds","Milliseconds","Time"],function(e,t){n.datetime.prototype[t.toLowerCase()]=function(){if(arguments.length==1){this.value["set"+t](arguments[0])}else{return this.value["get"+t]()}return this}});n.stringBuilder.prototype={cat:function(e){this.buffer.push(e);return this},rep:function(t,e){for(var u=0;u<e;u++){this.cat(t)}return this},catIf:function(){var t=arguments;if(t[t.length-1]){for(var e=0,u=t.length-1;e<u;e++){this.cat(t[e])}}return this},string:function(){return this.buffer.join("")}};var f=(/iphone|ipad|android/gi).test(navigator.appVersion);if(f){var m="touchmove",b="touchstart",p="touchend"}else{var m="mousemove",b="mousedown",p="mouseup"}i.extend(i.fn,{tScrollable:function(e){i(this).each(function(){if(f||(e&&e.force)){new g(this)}})}});function g(e){this.element=e;this.wrapper=i(e);this._horizontalScrollbar=i('<div class="t-touch-scrollbar" />');this._verticalScrollbar=this._horizontalScrollbar.clone();this._scrollbars=this._horizontalScrollbar.add(this._verticalScrollbar);this._startProxy=i.proxy(this._start,this);this._stopProxy=i.proxy(this._stop,this);this._dragProxy=i.proxy(this._drag,this);this._create()}function c(u){var t=u.originalEvent.changedTouches;if(t&&t.length<2){return{x:t[0].pageX,y:t[0].pageY}}return{x:u.pageX,y:u.pageY}}g.prototype={_create:function(){this.wrapper.css("overflow","hidden").bind(b,i.proxy(this._wait,this))},_wait:function(u){var t=c(u);this.start={x:t.x+this.wrapper.scrollLeft(),y:t.y+this.wrapper.scrollTop()};i(document).bind(m,this._startProxy).bind(p,this._stopProxy)},_start:function(w){w.preventDefault();var t=c(w);if(this.start.x-t.x>10||this.start.y-t.y>10){i(document).unbind(m,this._startProxy).bind(m,this._dragProxy);var u=this.wrapper.innerWidth(),v=this.wrapper.innerHeight();offset=this.wrapper.offset(),scrollWidth=this.wrapper.attr("scrollWidth"),scrollHeight=this.wrapper.attr("scrollHeight");if(scrollWidth>u){this._horizontalScrollbar.appendTo(document.body).css({width:Math.floor((u/scrollWidth)*u),left:this.wrapper.scrollLeft()+offset.left+parseInt(this.wrapper.css("borderLeftWidth")),top:offset.top+this.wrapper.innerHeight()+parseInt(this.wrapper.css("borderTopWidth"))-this._horizontalScrollbar.outerHeight()})}if(scrollHeight>v){this._verticalScrollbar.appendTo(document.body).css({height:Math.floor((v/scrollHeight)*v),top:this.wrapper.scrollTop()+offset.top+parseInt(this.wrapper.css("borderTopWidth")),left:offset.left+this.wrapper.innerWidth()+parseInt(this.wrapper.css("borderLeftWidth"))-this._verticalScrollbar.outerWidth()})}this._scrollbars.stop().fadeTo(200,0.5)}},_drag:function(A){A.preventDefault();var B=c(A),y=this.wrapper.offset(),v=y.left+parseInt(this.wrapper.css("borderLeftWidth")),w=y.top+parseInt(this.wrapper.css("borderTopWidth")),u=this.start.x-B.x,t=this.start.y-B.y,x=Math.max(v,v+u),z=Math.max(w,w+t);x=Math.min(v+this.wrapper.innerWidth()-this._horizontalScrollbar.outerWidth()-this._horizontalScrollbar.outerHeight(),x);z=Math.min(w+this.wrapper.innerHeight()-this._verticalScrollbar.outerHeight()-this._verticalScrollbar.outerWidth(),z);this._horizontalScrollbar.css("left",x);this._verticalScrollbar.css("top",z);this.wrapper.scrollLeft(u).scrollTop(t)},_stop:function(t){i(document).unbind(m,this._startProxy).unbind(m,this._dragProxy).unbind(p,this._stopProxy);this._scrollbars.stop().fadeTo(400,0)}};var j=function(u,e,t){if(e.length==0&&t){t();return null}var v=u.list.length;return function(){if(--v==0&&t){t()}}};i.extend(n.fx,{_wrap:function(e){if(!e.parent().hasClass("t-animation-container")){e.wrap(i("<div/>").addClass("t-animation-container").css({width:e.outerWidth(),height:e.outerHeight()}))}return e.parent()},play:function(w,x,u,e){var z=j(w,x,e);if(z===null){return}x.stop(false,true);for(var t=0,y=w.list.length;t<y;t++){var v=new n.fx[w.list[t].name](x);if(!x.data("effect-"+t)){v.play(i.extend(w.list[t],{openDuration:w.openDuration,closeDuration:w.closeDuration},u),z);x.data("effect-"+t,v)}}},rewind:function(w,x,u,e){var y=j(w,x,e);if(y===null){return}for(var t=w.list.length-1;t>=0;t--){var v=x.data("effect-"+t)||new n.fx[w.list[t].name](x);v.rewind(i.extend(w.list[t],{openDuration:w.openDuration,closeDuration:w.closeDuration},u),y);x.data("effect-"+t,null)}}});n.fx.toggle=function(e){this.element=e.stop(false,true)};n.fx.toggle.prototype={play:function(e,t){this.element.show();if(t){t()}},rewind:function(e,t){this.element.hide();if(t){t()}}};n.fx.toggle.defaults=function(){return{list:[{name:"toggle"}]}};n.fx.slide=function(e){this.element=e;this.animationContainer=n.fx._wrap(e)};n.fx.slide.prototype={play:function(t,x){var e=this.animationContainer;this.element.css("display","block").stop();e.css({display:"block",overflow:"hidden"});var u=this.element.outerWidth();var z=this.element.outerHeight();var y=t.direction=="bottom"?"marginTop":"marginLeft";var v=t.direction=="bottom"?-z:-u;e.css({width:u,height:z});var w={};w[y]=0;this.element.css("width",this.element.width()).each(function(){this.style.cssText=this.style.cssText}).css(y,v).animate(w,{queue:false,duration:t.openDuration,easing:"linear",complete:function(){e.css("overflow","");if(x){x()}}})},rewind:function(u,t){var v=this.animationContainer;this.element.stop();v.css({overflow:"hidden"});var e;switch(u.direction){case"bottom":e={marginTop:-this.element.outerHeight()};break;case"right":e={marginLeft:-this.element.outerWidth()};break}this.element.animate(e,{queue:false,duration:u.closeDuration,easing:"linear",complete:function(){v.css({display:"none",overflow:""});if(t){t()}}})}};n.fx.slide.defaults=function(){return{list:[{name:"slide"}],openDuration:"fast",closeDuration:"fast"}};n.fx.property=function(e){this.element=e};n.fx.property.prototype={_animate:function(w,v,t,e){var x={overflow:"hidden"},y={},u=this.element;i.each(w,function(A,B){var z;switch(B){case"height":case"width":z=u[B]();break;case"opacity":z=1;break;default:z=u.css(B);break}x[B]=t?z:0;y[B]=t?0:z});u.css(x).show().animate(y,{queue:false,duration:v,easing:"linear",complete:function(){if(t){u.hide()}i.each(y,function(z){y[z]=""});u.css(i.extend({overflow:""},y));if(e){e()}}})},play:function(t,e){this._animate(t.properties,t.openDuration,false,e)},rewind:function(t,e){this._animate(t.properties,t.closeDuration,true,e)}};n.fx.property.defaults=function(){return{list:[{name:"property",properties:arguments}],openDuration:"fast",closeDuration:"fast"}};i(document).ready(function(){if(i.browser.msie&&typeof(Sys)!="undefined"&&typeof(Sys.Mvc)!="undefined"&&typeof(Sys.Mvc.FormContext)!="undefined"){var e=function(u,t){return i.grep(u.getElementsByTagName("*"),function(v){return v.name==t})};if(Sys.Mvc.FormContext){Sys.Mvc.FormContext.$F=Sys.Mvc.FormContext._getFormElementsWithName=e}}})})(jQuery);