1/*! 2** An extension to the jQuery Validation Plugin which makes it use Globalize.js for number and date parsing 3** Copyright (c) 2013 John Reilly 4*/ 5 6(function ($, Globalize) { 7 8 // Clone original methods we want to call into 9 var originalMethods = { 10 min: $.validator.methods.min, 11 max: $.validator.methods.max, 12 range: $.validator.methods.range 13 }; 14 15 // Globalize options - initially just the date format used for parsing 16 // Users can customise this to suit them 17 $.validator.methods.dateGlobalizeOptions = { dateParseFormat: { skeleton: "yMd" } }; 18 19 // Tell the validator that we want numbers parsed using Globalize 20 $.validator.methods.number = function (value, element) { 21 var val = Globalize.parseNumber(value); 22 return this.optional(element) || ($.isNumeric(val)); 23 }; 24 25 // Tell the validator that we want dates parsed using Globalize 26 $.validator.methods.date = function (value, element) { 27 var val = Globalize.parseDate(value, $.validator.methods.dateGlobalizeOptions.dateParseFormat); 28 return this.optional(element) || (val instanceof Date); 29 }; 30 31 // Tell the validator that we want numbers parsed using Globalize, 32 // then call into original implementation with parsed value 33 34 $.validator.methods.min = function (value, element, param) { 35 var val = Globalize.parseNumber(value); 36 return originalMethods.min.call(this, val, element, param); 37 }; 38 39 $.validator.methods.max = function (value, element, param) { 40 var val = Globalize.parseNumber(value); 41 return originalMethods.max.call(this, val, element, param); 42 }; 43 44 $.validator.methods.range = function (value, element, param) { 45 var val = Globalize.parseNumber(value); 46 return originalMethods.range.call(this, val, element, param); 47 }; 48 49}(jQuery, Globalize));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.