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.
Sonarr/NzbDrone.Web/Scripts/2011.3.1115/telerik.grid.editing.min.js

1 line
28 KiB

(function(a){var b=a.telerik,e=/^\/Date\((.*?)\)\/$/,d=/[0#?]/,i=/[npc?]/;b.scripts.push("telerik.grid.editing.js");var l=function(o){this.formId=o;this._isBuild=false;var n="tUnobtrusiveValidation";var m="tUnobtrusiveContainer";var p=this.unobtrusive={adapters:[],parseElement:function(r,v){var q=a(r),s=q.parents("form")[0],w,u,t;if(!s){return}w=p.validationInfo(s);w.options.rules[r.name]=u={};w.options.messages[r.name]=t={};a.each(this.adapters,function(){var z="data-val-"+this.name,x=q.attr(z),y={};if(x!==undefined){z+="-";a.each(this.params,function(){y[this]=q.attr(z+this)});this.adapt({element:r,form:s,message:x,params:y,rules:u,messages:t})}});if(!v){w.attachValidation()}},parse:function(q){a(q).find(":input[data-val=true]").each(function(){p.parseElement(this,true)});a(q).each(function(){var r=p.validationInfo(this);if(r){r.attachValidation()}})},onError:function(r,s){var q=a(this).find("[data-valmsg-for='"+s[0].name+"']"),t=a.parseJSON(q.attr("data-valmsg-replace"))!==false;q.removeClass("field-validation-valid").addClass("field-validation-error");r.data(m,q);if(t){q.empty();r.removeClass("input-validation-error").appendTo(q)}else{r.hide()}},onErrors:function(r,t){var q=a(this).find("[data-valmsg-summary=true]"),s=q.find("ul");if(s&&s.length&&t.errorList.length){s.empty();q.addClass("validation-summary-errors").removeClass("validation-summary-valid");a.each(t.errorList,function(){a("<li />").html(this.message).appendTo(s)})}},onSuccess:function(r){var q=r.data(m),s=a.parseJSON(q.attr("data-valmsg-replace"));if(q){q.addClass("field-valiion-valid").removeClass("field-validation-error");r.removeData(m);if(s){q.empty()}}},validationInfo:function(r){var q=a(r),s=q.data(n);if(!s){s={options:{errorClass:"input-validation-error",errorElement:"span",errorPlacement:a.proxy(p.onError,r),invalidHandler:a.proxy(p.onErrors,r),messages:{},rules:{},success:a.proxy(p.onSuccess,r)},attachValidation:function(){q.validate(this.options)},validate:function(){q.validate();return q.valid()}};q.data(n,s)}return s}}};l.prototype={build:function(){if(this._isBuild){return}this._isBuild=true;var m=[];function p(r,s,t){r.rules[s]=t;if(r.message){r.messages[s]=r.message}}function q(r){return r.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function o(r){return r.substr(0,r.lastIndexOf(".")+1)}function n(s,r){if(s.indexOf("*.")===0){s=s.replace("*.",r)}return s}m=this.unobtrusive.adapters;m.add=function(r,t,s){if(!s){s=t;t=[]}this.push({name:r,params:t,adapt:s});return this};m.addBool=function(r,s){return this.add(r,function(t){p(t,s||r,true)})};m.addMinMax=function(r,w,t,v,u,s){return this.add(r,[u||"min",s||"max"],function(z){var y=z.params.min,x=z.params.max;if(y&&x){p(z,v,[y,x])}else{if(y){p(z,w,y)}else{if(x){p(z,t,x)}}}})};m.addSingleVal=function(r,s,t){return this.add(r,[s||"val"],function(u){p(u,t||r,u.params[s])})};m.addSingleVal("accept","exts").addSingleVal("regex","pattern");m.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");m.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range");m.add("equalto",["other"],function(s){var r=a(s.form).find(":input[name="+s.params.other+"]")[0];p(s,"equalTo",r)});m.add("required",function(r){if(r.element.tagName.toUpperCase()!=="INPUT"||r.element.type.toUpperCase()!=="CHECKBOX"){p(r,"required",true)}});m.add("remote",["url","type","additionalfields"],function(r){var t={url:r.params.url,type:r.params.type||"GET",data:{}},s=o(r.element.name);a.each(q(r.params.additionalfields||r.element.name),function(v,u){var w=n(u,s);t.data[w]=function(){return a(r.form).find(":input[name='"+w+"']").val()}});p(r,"remote",t)});if(a.validator.unobtrusive&&a.validator.unobtrusive.adapters){a.extend(m,a.validator.unobtrusive.adapters)}a.validator.addMethod("regex",function(u,r,t){if(this.optional(r)){return true}var s=new RegExp(t).exec(u);return s&&s.index==0&&s[0].length==u.length});a.validator.addMethod("number",function(u,s){var t=b.cultureInfo.numericgroupsize;if(t){var r=new b.stringBuilder();r.cat("^-?(?:\\d+|\\d{1,").ca