1 line
15 KiB
JavaScript
1 line
15 KiB
JavaScript
(function(f){try{if(document.execCommand){document.execCommand("BackgroundImageCache",false,true)}}catch(i){}var d=/\d/;var b=/\s+/;var c=parseInt(f.browser.version.substring(0,5).replace(".",""));var g=f.browser.mozilla&&c>=180&&c<=191;var a=/d{1,4}|M{1,4}|yy(?:yy)?|([Hhmstf])\1*|"[^"]*"|'[^']*'/g;var j=f.telerik={create:function(e,k){var m=k.name;var l=f.extend({},f.fn[m].defaults,k.options);return e.each(function(){var n=f(this);l=f.meta?f.extend({},l,n.data()):l;if(!n.data(m)){var o=k.init(this,l);n.data(m,o);j.trigger(this,"load");if(k.success){k.success(o)}}})},toJson:function(e){var k=[];for(var m in e){var l=e[m];if(typeof l!="object"){k.push('"'+m+'":"'+l+'"')}else{k.push('"'+m+'":'+this.toJson(l))}}return"{"+k.join(",")+"}"},delegate:function(k,e){return function(l){e.apply(k,[l,this])}},stop:function(e,k){return function(l){l.stopPropagation();e.apply(k||this,arguments)}},stopAll:function(e,k){return function(l){l.preventDefault();l.stopPropagation();e.apply(k||this,arguments)}},bind:function(e,k){var l=f(e.element);f.each(k,function(m){if(f.isFunction(this)){l.bind(m,this)}})},preventDefault:function(k){k.preventDefault()},hover:function(){f(this).addClass("t-state-hover")},leave:function(){f(this).removeClass("t-state-hover")},buttonHover:function(){f(this).addClass("t-button-hover")},buttonLeave:function(){f(this).removeClass("t-button-hover")},stringBuilder:function(){this.buffer=[]},ajaxError:function(m,l,e,n){var k=this.trigger(m,l,{XMLHttpRequest:e,textStatus:n});if(!k){if(n=="error"&&e.status!="0"){alert("Error! The requested URL returned "+e.status+" - "+e.statusText)}if(n=="timeout"){alert("Error! Server timeout.")}}return k},trigger:function(l,k,m){m=f.extend(m||{},new f.Event(k));m.stopPropagation();f(l).trigger(m);return m.isDefaultPrevented()},getType:function(e){if(e instanceof Date){return"date"}if(!isNaN(e)){return"number"}return"object"},formatString:function(){var o=arguments[0];for(var e=0,k=arguments.length-1;e<k;e++){var n=new RegExp("\\{"+e+"(:([^\\}]+))?\\}","gm");var m=arguments[e+1];var p=this.formatters[this.getType(m)];if(p){var q=n.exec(o);if(q){m=p(m,q[2])}}o=o.replace(n,function(){return m})}return o},getElementZIndex:function(e){var k="auto";f(e).parents().andSelf().each(function(){k=f(this).css("zIndex");if(Number(k)){k=Number(k)+1;return false}});return k},lastIndexOf:function(e,k){var l=k.length;for(var m=e.length-1;m>-1;m--){if(e.substr(m,l)==k){return m}}return -1},caretPos:function(e){var k=-1;if(document.selection){k=Math.abs(e.document.selection.createRange().moveStart("character",-e.value.length))}else{if(e.selectionStart!==undefined){k=e.selectionStart}}return k},encode:function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\u00a0/g," ")},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}};j.dropDown=function(e){f.extend(this,e);this.$element=f(new j.stringBuilder().cat("<div ").catIf(e.attr,e.attr).cat('><ul class="t-reset"></ul></div>').string()).addClass("t-popup t-group").hide()};j.dropDown.prototype={_html:function(n){var l=new j.stringBuilder();if(n){for(var k=0,o=n.length;k<o;k++){var m=n[k];var p=m.Text;var q={html:p==undefined?m:p&&p.replace(b,"")?p:" ",dataItem:m};if(this.onItemCreate){this.onItemCreate(q)}l.cat('<li class="t-item">').cat(q.html).cat("</li>")}}return l.string()},open:function(e){if(this.onOpen){this.onOpen()}if(this.isOpened()||!this.$items){return}var n=this.$element,l=".t-reset > .t-item";n.appendTo(document.body);var k;if(n[0].style.width==""){k=e.outerWidth?e.outerWidth-2:0}else{k=parseInt(this.attr?f("<div"+this.attr+"></div>")[0].style.width:n[0].style.width)}n.css("overflowY","auto").css("width",k);n.delegate(l,"mouseenter",j.hover).delegate(l,"mouseleave",j.leave).delegate(l,"click",f.proxy(function(o){if(this.onClick){this.onClick(f.extend(o,{item:f(o.target).closest(".t-item")[0]}))}},this));var m=e.offset;m.top+=e.outerHeight;j.fx._wrap(n).css(f.extend({position:"absolute",zIndex:e.zIndex},m));if(g){n.css("overflow","hidden")}j.fx.play(this.effects,n,{direction:"bottom"},f.proxy(function(){if(g){n.css("overflow","auto")}var o=this.$items.filter(".t-state-selected");if(o.length){this.scrollTo(o[0])}},this))},close:function(){if(!this.isOpened()){return}var e=this.$element;if(g){e.css("overflow","hidden")}j.fx.rewind(this.effects,e,{direction:"bottom"},function(){if(g){e.css("overflow","auto")}e.parent().remove()})},dataBind:function(k){k=k||[];var n=this.$element;var m=n[0].style.height;var l=m&&m!="auto"?n[0].style.height:"200px";var e=this.$items=f(this._html(k));n.find("> ul").html(e);n.css("height",e.length>10?l:"auto")},highlight:function(e){return f(e).addClass("t-state-selected").siblings().removeClass("t-state-selected").end().index()},isOpened:function(){return this.$element.is(":visible")},scrollTo:function(p){if(!p){return}var e=p.offsetTop;var n=p.offsetHeight;var k=this.$element[0];var l=k.scrollTop;var o=k.clientHeight;var m=e+n;k.scrollTop=l>e?e:m>(l+o)?m-o:l}};j.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};f.extend(j.datetime,{msPerMinute:60000,msPerDay:86400000,add:function(n,k){var l=n.timeOffset();var m=new j.datetime(n.time()+k);var e=m.timeOffset()-l;return new j.datetime(m.time()+e*j.datetime.msPerMinute)},subtract:function(m,l){l=new j.datetime(l).toDate();var e=m.time()-l;var k=m.timeOffset()-l.timeOffset();return e-(k*j.datetime.msPerMinute)},firstDayOfMonth:function(e){return new j.datetime(0).hours(e.hours()).minutes(e.minutes()).seconds(e.seconds()).milliseconds(e.milliseconds()).year(e.year(),e.month(),1)},firstVisibleDay:function(l){var e=j.cultureInfo.firstDayOfWeek;var k=new j.datetime(l.year(),l.month(),0,l.hours(),l.minutes(),l.seconds(),l.milliseconds());while(k.day()!=e){j.datetime.modify(k,-1*j.datetime.msPerDay)}return k},modify:function(n,e){var l=n.timeOffset();var k=new j.datetime(n.time()+e);var m=k.timeOffset()-l;n.time(k.time()+m*j.datetime.msPerMinute)},pad:function(e){if(e<10){return"0"+e}return e},standardFormat:function(e){var k=j.cultureInfo;var m={d:k.shortDate,D:k.longDate,F:k.fullDateTime,g:k.generalDateShortTime,G:k.generalDateTime,m:k.monthDay,M:k.monthDay,s:k.sortableDateTime,t:k.shortTime,T:k.longTime,u:k.universalSortableDateTime,y:k.monthYear,Y:k.monthYear};return m[e]},format:function(x,e){var r=j.cultureInfo;var v=x.getDate();var k=x.getDay();var u=x.getMonth();var n=x.getFullYear();var q=x.getHours();var p=x.getMinutes();var o=x.getSeconds();var w=x.getMilliseconds();var t=j.datetime.pad;var z={d:v,dd:t(v),ddd:r.abbrDays[k],dddd:r.days[k],M:u+1,MM:t(u+1),MMM:r.abbrMonths[u],MMMM:r.months[u],yy:t(n%100),yyyy:n,h:q%12||12,hh:t(q%12||12),H:q,HH:t(q),m:p,mm:t(p),s:o,ss:t(o),f:Math.floor(w/100),ff:Math.floor(w/10),fff:w,tt:q<12?r.am:r.pm};e=e||"G";e=j.datetime.standardFormat(e)?j.datetime.standardFormat(e):e;return e.replace(a,function(l){return l in z?z[l]:l.slice(1,l.length-1)})},parse:function(l){var e=l.value;var k=l.format;k=j.datetime.standardFormat(k)?j.datetime.standardFormat(k):k;if(d.test(e)){return j.datetime.parseMachineDate({value:e,format:k,shortYearCutOff:l.shortYearCutOff,baseDate:l.baseDate,AM:j.cultureInfo.am,PM:j.cultureInfo.pm})}return j.datetime.parseByToken?j.datetime.parseByToken(e,l.today):null},parseMachineDate:function(A){var N=A.AM;var G=A.PM;var n=A.value;var q=A.format;var e=A.baseDate;var J=A.shortYearCutOff||30;var v=-1;var D=-1;var w=-1;var m=0;var t=0;var y=0;var x=0;var L;var H;var r=false;var M=function(P){var O=0;while(u(P)){O++;z++}return O};var l=function(){var O=u("'");if(O){z++}return O};var u=function(O){return(z+1<q.length&&q.charAt(z+1)==O)};var B=function(P){var Q=new RegExp("^\\d{1,"+P+"}");var O=n.substr(E).match(Q);if(O){E+=O[0].length;return parseInt(O[0],10)}else{return -1}};var o=function(O){for(var P=0;P<O.length;P++){if(n.substr(E,O[P].length)==O[P]){E+=O[P].length;return P+1}}return -1};var I=function(){if(n.charAt(E)==q.charAt(z)){E++}};var K=function(O){return O===-1?0:O};var F=0;var E=0;var k=n.length;for(var z=0,s=q.length;z<s;z++){if(E==k){break}if(r){I();if(q.charAt(z)=="'"){r=false}}else{switch(q.charAt(z)){case"d":F=M("d");w=F<=1?B(2):o(j.cultureInfo[F==3?"days":"abbrDays"]);break;case"M":F=M("M");D=F<=1?B(2):o(j.cultureInfo[F==3?"months":"abbrMonths"]);break;case"y":F=M("y");v=B(F<=1?2:4);break;case"H":F=M("H");m=K(B(2));break;case"h":M("h");m=K(B(2));break;case"m":M("m");t=K(B(2));break;case"s":M("s");y=K(B(2));break;case"f":F=M("f");x=K(B(F<=0?1:F+1));break;case"t":F=M("t");N=F>0?N:"a";G=F>0?G:"p";var p=n.substr(E).toLowerCase();L=p.indexOf(N.toLowerCase())!=-1;H=p.indexOf(G.toLowerCase())!=-1;E+=H?G.length:L?N.length:0;break;case"'":I();r=true;break;default:I()}}}var C=new j.datetime();if(v!=-1&&v<100){v+=C.year()-C.year()%100+(v<=J?0:-100)}m=(H&&m<12)?m+12:m==12&&L?0:m;if(e==undefined){if(v==-1){v=C.year()}C=new j.datetime(v,D-1,w,m,t,y,x);if(C.year()!=v||C.month()!=(D-1)||C.date()!=w){return null}}else{C=e.year(v!=-1?v:e.year()).month(D!=-1?D-1:e.month()).date(w!=-1?w:e.date()).hours(m).minutes(t).seconds(y).milliseconds(x);if((v!=-1&&C.year()!=v)||(D!=-1&&C.month()!=(D-1))||(w!=-1&&C.date()!=w)||(m!=-1&&C.hours()!=m)||(t!=-1&&C.minutes()!=t)||(y!=-1&&C.seconds()!=y)||(x!=-1&&C.milliseconds()!=x)){return null}}return C}});j.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)}};f.each(["Month","Date","Hours","Minutes","Seconds","Milliseconds","Time"],function(e,k){j.datetime.prototype[k.toLowerCase()]=function(){if(arguments.length==1){this.value["set"+k](arguments[0])}else{return this.value["get"+k]()}return this}});j.stringBuilder.prototype={cat:function(e){this.buffer.push(e);return this},rep:function(k,e){for(var l=0;l<e;l++){this.cat(k)}return this},catIf:function(k,e){if(e){this.cat(k)}return this},string:function(){return this.buffer.join("")}};var h=function(l,e,k){if(e.length==0&&k){k();return null}var m=l.list.length;return function(){if(--m==0&&k){k()}}};f.extend(j.fx,{_wrap:function(e){if(!e.parent().hasClass("t-animation-container")){e.wrap(f("<div/>").addClass("t-animation-container").css({width:e.outerWidth(),height:e.outerHeight()}))}return e.parent()},play:function(n,o,l,e){var q=h(n,o,e);if(q===null){return}o.stop(false,true);for(var k=0,p=n.list.length;k<p;k++){var m=new j.fx[n.list[k].name](o);if(!o.data("effect-"+k)){m.play(f.extend(n.list[k],{openDuration:n.openDuration,closeDuration:n.closeDuration},l),q);o.data("effect-"+k,m)}}},rewind:function(n,o,l,e){var p=h(n,o,e);if(p===null){return}for(var k=n.list.length-1;k>=0;k--){var m=o.data("effect-"+k)||new j.fx[n.list[k].name](o);m.rewind(f.extend(n.list[k],{openDuration:n.openDuration,closeDuration:n.closeDuration},l),p);o.data("effect-"+k,null)}}});j.fx.toggle=function(e){this.element=e.stop(false,true)};j.fx.toggle.prototype={play:function(e,k){this.element.show();if(k){k()}},rewind:function(e,k){this.element.hide();if(k){k()}}};j.fx.toggle.defaults=function(){return{list:[{name:"toggle"}]}};j.fx.slide=function(e){this.element=e;this.animationContainer=j.fx._wrap(e)};j.fx.slide.prototype={play:function(k,o){var e=this.animationContainer;this.element.css("display","block").stop();e.css({display:"block",overflow:"hidden"});var l=this.element.outerWidth();var q=this.element.outerHeight();var p=k.direction=="bottom"?"marginTop":"marginLeft";var m=k.direction=="bottom"?-q:-l;e.css({width:l,height:q});var n={};n[p]=0;this.element.css("width",this.element.width()).each(function(){this.style.cssText=this.style.cssText}).css(p,m).animate(n,{queue:false,duration:k.openDuration,easing:"linear",complete:function(){e.css("overflow","");if(o){o()}}})},rewind:function(l,k){var m=this.animationContainer;this.element.stop();m.css({overflow:"hidden"});var e;switch(l.direction){case"bottom":e={marginTop:-this.element.outerHeight()};break;case"right":e={marginLeft:-this.element.outerWidth()};break}this.element.animate(e,{queue:false,duration:l.closeDuration,easing:"linear",complete:function(){m.css({display:"none",overflow:""});if(k){k()}}})}};j.fx.slide.defaults=function(){return{list:[{name:"slide"}],openDuration:"fast",closeDuration:"fast"}};j.fx.property=function(e){this.element=e};j.fx.property.prototype={_animate:function(n,m,k,e){var o={overflow:"hidden"},p={},l=this.element;f.each(n,function(r,s){var q;switch(s){case"height":case"width":q=l[s]();break;case"opacity":q=1;break;default:q=l.css(s);break}o[s]=k?q:0;p[s]=k?0:q});l.css(o).show().animate(p,{queue:false,duration:m,easing:"linear",complete:function(){if(k){l.hide()}f.each(p,function(q){p[q]=""});l.css(f.extend({overflow:""},p));if(e){e()}}})},play:function(k,e){this._animate(k.properties,k.openDuration,false,e)},rewind:function(k,e){this._animate(k.properties,k.closeDuration,true,e)}};j.fx.property.defaults=function(){return{list:[{name:"property",properties:arguments}],openDuration:"fast",closeDuration:"fast"}};f(document).ready(function(){if(f.browser.msie&&typeof(Sys)!="undefined"&&typeof(Sys.Mvc)!="undefined"&&typeof(Sys.Mvc.FormContext)!="undefined"){var e=function(l,k){return f.grep(l.getElementsByTagName("*"),function(m){return m.name==k})};if(Sys.Mvc.FormContext){Sys.Mvc.FormContext.$F=Sys.Mvc.FormContext._getFormElementsWithName=e}}})})(jQuery); |