1/*! jQuery Validation Plugin - v1.13.0 - 7/1/2014 2 * http://jqueryvalidation.org/ 3 * Copyright (c) 2014 Jörn Zaefferer; Licensed MIT */ 4! 5function (a) { 6 "function" == typeof define && define.amd ? define(["jquery"], a) : a(jQuery) 7}(function (a) { 8 a.extend(a.fn, { 9 validate: function (b) { 10 if (!this.length) return void (b && b.debug && window.console && console.warn("Nothing selected, can't validate, returning nothing.")); 11 var c = a.data(this[0], "validator"); 12 return c ? c : (this.attr("novalidate", "novalidate"), c = new a.validator(b, this[0]), a.data(this[0], "validator", c), c.settings.onsubmit && (this.validateDelegate(":submit", "click", function (b) { 13 c.settings.submitHandler && (c.submitButton = b.target), a(b.target).hasClass("cancel") && (c.cancelSubmit = !0), void 0 !== a(b.target).attr("formnovalidate") && (c.cancelSubmit = !0) 14 }), this.submit(function (b) { 15 function d() { 16 var d; 17 return c.settings.submitHandler ? (c.submitButton && (d = a("<input type='hidden'/>").attr("name", c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)), c.settings.submitHandler.call(c, c.currentForm, b), c.submitButton && d.remove(), !1) : !0 18 } 19 return c.settings.debug && b.preventDefault(), c.cancelSubmit ? (c.cancelSubmit = !1, d()) : c.form() ? c.pendingRequest ? (c.formSubmitted = !0, !1) : d() : (c.focusInvalid(), !1) 20 })), c) 21 }, 22 valid: function () { 23 var b, c; 24 return a(this[0]).is("form") ? b = this.validate().form() : (b = !0, c = a(this[0].form).validate(), this.each(function () { 25 b = c.element(this) && b 26 })), b 27 }, 28 removeAttrs: function (b) { 29 var c = {}, 30 d = this; 31 return a.each(b.split(/\s/), function (a, b) { 32 c[b] = d.attr(b), d.removeAttr(b) 33 }), c 34 }, 35 rules: function (b, c) { 36 var d, e, f, g, h, i, j = this[0]; 37 if (b) switch (d = a.data(j.form, "validator").settings, e = d.rules, f = a.validator.staticRules(j), b) { 38 case "add": 39 a.extend(f, a.validator.normalizeRule(c)), delete f.messages, e[j.name] = f, c.messages && (d.messages[j.name] = a.extend(d.messages[j.name], c.messages)); 40 break; 41 case "remove": 42 return c ? (i = {}, a.each(c.split(/\s/), function (b, c) { 43 i[c] = f[c], delete f[c], "required" === c && a(j).removeAttr("aria-required") 44 }), i) : (delete e[j.name], f) 45 } 46 return g = a.validator.normalizeRules(a.extend({}, a.validator.classRules(j), a.validator.attributeRules(j), a.validator.dataRules(j), a.validator.staticRules(j)), j), g.required && (h = g.required, delete g.required, g = a.extend({ 47 required: h 48 }, g), a(j).attr("aria-required", "true")), g.remote && (h = g.remote, delete g.remote, g = a.extend(g, { 49 remote: h 50 })), g 51 } 52 }), a.extend(a.expr[":"], { 53 blank: function (b) { 54 return !a.trim("" + a(b).val()) 55 }, 56 filled: function (b) { 57 return !!a.trim("" + a(b).val()) 58 }, 59 unchecked: function (b) { 60 return !a(b).prop("checked") 61 } 62 }), a.validator = function (b, c) { 63 this.settings = a.extend(!0, {}, a.validator.defaults, b), this.currentForm = c, this.init() 64 }, a.validator.format = function (b, c) { 65 return 1 === arguments.length ? 66 function () { 67 var c = a.makeArray(arguments); 68 return c.unshift(b), a.validator.format.apply(this, c) 69 } : (arguments.length > 2 && c.constructor !== Array && (c = a.makeArray(arguments).slice(1)), c.constructor !== Array && (c = [c]), a.each(c, function (a, c) { 70 b = b.replace(new RegExp("\\{" + a + "\\}", "g"), function () { 71 return c 72 }) 73 }), b) 74 }
74, a.extend(a.validator, { 75 defaults: { 76 messages: {}, 77 groups: {}, 78 rules: {}, 79 errorClass: "error", 80 validClass: "valid", 81 errorElement: "label", 82 focusInvalid: !0, 83 errorContainer: a([]), 84 errorLabelContainer: a([]), 85 onsubmit: !0, 86 ignore: ":hidden", 87 ignoreTitle: !1, 88 onfocusin: function (a) { 89 this.lastActive = a, this.settings.focusCleanup && !this.blockFocusCleanup && (this.settings.unhighlight && this.settings.unhighlight.call(this, a, this.settings.errorClass, this.settings.validClass), this.hideThese(this.errorsFor(a))) 90 }, 91 onfocusout: function (a) { 92 this.checkable(a) || !(a.name in this.submitted) && this.optional(a) || this.element(a) 93 }, 94 onkeyup: function (a, b) { 95 (9 !== b.which || "" !== this.elementValue(a)) && (a.name in this.submitted || a === this.lastElement) && this.element(a) 96 }, 97 onclick: function (a) { 98 a.name in this.submitted ? this.element(a) : a.parentNode.name in this.submitted && this.element(a.parentNode) 99 }, 100 highlight: function (b, c, d) { 101 "radio" === b.type ? this.findByName(b.name).addClass(c).removeClass(d) : a(b).addClass(c).removeClass(d) 102 }, 103 unhighlight: function (b, c, d) { 104 "radio" === b.type ? this.findByName(b.name).removeClass(c).addClass(d) : a(b).removeClass(c).addClass(d) 105 } 106 }, 107 setDefaults: function (b) { 108 a.extend(a.validator.defaults, b) 109 }, 110 messages: { 111 required: "å¿ å¡«æ¬ä½.", 112 remote: "Please fix this field.", 113 email: "ä¿¡ç®±æ ¼å¼ä¸ç¬¦.", 114 url: "Please enter a valid URL.", 115 date: "Please enter a valid date.", 116 dateISO: "Please enter a valid date (ISO).", 117 number: "è«è¼¸å ¥æ¸å.", 118 digits: "Please enter only digits.", 119 creditcard: "Please enter a valid credit card number.", 120 equalTo: "Please enter the same value again.", 121 maxlength: $.validator.format("æå¤è¼¸å ¥{0}å."), 122 minlength: $.validator.format("è³å°è¼¸å ¥{0}å."), 123 rangelength: a.validator.format("Please enter a value between {0} and {1} characters long."), 124 range: a.validator.format("Please enter a value between {0} and {1}."), 125 max: a.validator.format("Please enter a value less than or equal to {0}."), 126 min: a.validator.format("Please enter a value greater than or equal to {0}."), 127 128 //2011/10/04 Alan Wu åæ³æ¥æ,ææ©,é»è©± 129 validDate: "Please enter a valid date.", 130 phone: "Please enter phone as 02-12345678#90", 131 mobile: "ææ©æ ¼å¼çº 0933123456", 132 password: "å¯ç¢¼é·åº¦éç", 133 byteLimit: $.validator.format("Please enter no more than {0} bytes."), 134 alphaDigit: "Please enter english or number", 135 twIDCheck: "Format Error" 136 }, 137 autoCreateRanges: !1, 138 prototype: { 139 init: function () { 140 function b(b) { 141 var c = a.data(this[0].form, "validator"), 142 d = "on" + b.type.replace(/^validate/, ""), 143 e = c.settings; 144 e[d] && !this.is(e.ignore) && e[d].call(c, this[0], b) 145 } 146 this.labelContainer = a(this.settings.errorLabelContainer), this.errorContext = this.labelContainer.length && this.labelContainer || a(this.currentForm), this.containers = a(this.settings.errorContainer).add(this.settings.errorLabelContainer), this.submitted = {}, this.valueCache = {}, this.pendingRequest = 0, this.pending = {}, this.invalid = {}, this.reset(); 147 var c, d = this.groups = {}; 148 a.each(this.settings.groups, function (b, c) { 149 "string" == typeof c && (c = c.split(/\s/)), a.each(c, function (a, c) { 150 d[c] = b 151 }) 152 }), c = this.settings.rules, a.each(c, function (b, d) { 153 c[b] = a.validator.normalizeRule(d) 154 }), a(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox']", "focusin focusout keyup", b).validateDelegate("select, option, [type='radio'], [type='checkbox']", "click", b), this.settings.invalidHandler && a(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler), a(this.currentForm).find("[required], [data-rule-required], .required").attr("aria-required", "true") 155 }, 156 form: function () { 157 return this.checkForm(), a.extend(this.submitted, this.errorMap), this.invalid = a.extend({}, this.errorMap), this.valid() || a(this.currentForm).triggerHandler("invalid-form", [this]), this.showErrors(), this.valid() 158 }, 159 checkForm: function () { 160 this.prepareForm(); 161 for (var a = 0, b = this.currentElements = this.elements() ; b[a]; a++) this.check(b[a]); 162 return this.valid() 163 }, 164 element: function (b) { 165 var c = this.clean(b), 166 d = this.validationTargetFor(c), 167 e = !0; 168 return this.lastElement = d, void 0 === d ? delete this.invalid[c.name] : (this.prepareElement(d), this.currentElements = a(d), e = this.check(d) !== !1, e ? delete this.invalid[d.name] : this.invalid[d.name] = !0), a(b).attr("aria-invalid", !e), this.numberOfInvalids() || (this.toHide = this.toHide.add(this.containers
168)), this.showErrors(), e 169 }, 170 showErrors: function (b) { 171 if (b) { 172 a.extend(this.errorMap, b), this.errorList = []; 173 for (var c in b) this.errorList.push({ 174 message: b[c], 175 element: this.findByName(c)[0] 176 }); 177 this.successList = a.grep(this.successList, function (a) { 178 return !(a.name in b) 179 }) 180 } 181 this.settings.showErrors ? this.settings.showErrors.call(this, this.errorMap, this.errorList) : this.defaultShowErrors() 182 }, 183 resetForm: function () { 184 a.fn.resetForm && a(this.currentForm).resetForm(), this.submitted = {}, this.lastElement = null, this.prepareForm(), this.hideErrors(), this.elements().removeClass(this.settings.errorClass).removeData("previousValue").removeAttr("aria-invalid") 185 }, 186 numberOfInvalids: function () { 187 return this.objectLength(this.invalid) 188 }, 189 objectLength: function (a) { 190 var b, c = 0; 191 for (b in a) c++; 192 return c 193 }, 194 hideErrors: function () { 195 this.hideThese(this.toHide) 196 }, 197 hideThese: function (a) { 198 a.not(this.containers).text(""), this.addWrapper(a).hide() 199 }, 200 valid: function () { 201 return 0 === this.size() 202 }, 203 size: function () { 204 return this.errorList.length 205 }, 206 focusInvalid: function () { 207 if (this.settings.focusInvalid) try { 208 a(this.findLastActive() || this.errorList.length && this.errorList[0].element || []).filter(":visible").focus().trigger("focusin") 209 } catch (b) { } 210 }, 211 findLastActive: function () { 212 var b = this.lastActive; 213 return b && 1 === a.grep(this.errorList, function (a) { 214 return a.element.name === b.name 215 }).length && b
216 }, 217 elements: function () { 218 var b = this, 219 c = {}; 220 return a(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function () { 221 return !this.name && b.settings.debug && window.console && console.error("%o has no name assigned", this), this.name in c || !b.objectLength(a(this).rules()) ? !1 : (c[this.name] = !0, !0) 222 }) 223 }, 224 clean: function (b) { 225 return a(b)[0] 226 }, 227 errors: function () { 228 var b = this.settings.errorClass.split(" ").join("."); 229 return a(this.settings.errorElement + "." + b, this.errorContext) 230 }, 231 reset: function () { 232 this.successList = [], this.errorList = [], this.errorMap = {}, this.toShow = a([]), this.toHide = a([]), this.currentElements = a([]) 233 }, 234 prepareForm: function () { 235 this.reset(), this.toHide = this.errors().add(this.containers) 236 }, 237 prepareElement: function (a) { 238 this.reset(), this.toHide = this.errorsFor(a) 239 }, 240 elementValue: function (b) { 241 var c, d = a(b), 242 e = b.type; 243 return "radio" === e || "checkbox" === e ? a("input[name='" + b.name + "']:checked").val() : "number" === e && "undefined" != typeof b.validity ? b.validity.badInput ? !1 : d.val() : (c = d.val(), "string" == typeof c ? c.replace(/\r/g, "") : c) 244 }, 245 check: function (b) { 246 b = this.validationTargetFor(this.clean(b)); 247 var c, d, e, f = a(b).rules(), 248 g = a.map(f, function (a, b) { 249 return b 250 }).length, 251 h = !1, 252 i = this.elementValue(b); 253 for (d in f) { 254 e = { 255 method: d, 256 parameters: f[d] 257 }; 258 try { 259 if (c = a.validator.methods[d].call(this, i, b, e.parameters), "dependency-mismatch" === c && 1 === g) { 260 h = !0; 261 continue 262 } 263 if (h = !1, "pending" === c) return void (this.toHide = this.toHide.not(this.errorsFor(b))); 264 if (!c) return this.formatAndAdd(b, e), !1 265 } catch (j) { 266 throw this.settings.debug && window.console && console.log("Exception occurred when checking element " + b.id + ", check the '" + e.method + "' method.", j), j 267 } 268 } 269 if (!h) return this.objectLength(f) && this.successList.push(b), !0 270 }, 271 customDataMessage: function (b, c) { 272 return a(b).data("msg" + c.charAt(0).toUpperCase() + c.substring(1).toLowerCase()) || a(b).data("msg") 273 }, 274 customMessage: function (a, b) { 275 var c = this.settings.messages[a]; 276 return c && (c.constructor === String ? c : c[b]) 277 }, 278 findDefined: function () { 279 for (var a = 0; a < arguments.length; a++) if (void 0 !== arguments[a]) return arguments[a]; 280 return void 0 281 }, 282 defaultMessage: function (b, c) { 283 return this.findDefined(this.customMessage(b.name, c), this.customDataMessage(b, c), !this.settings.ignoreTitle && b.title || void 0, a.validator.messages[c], "<strong>Warning: No message defined for " + b.name + "</strong>") 284 }, 285 formatAndAdd: function (b, c) { 286 var d = this.defaultMessage(b, c.method), 287 e = /\$?\{(\d+)\}/g; 288 "function" == typeof d ? d = d.call(this, c.parameters, b) : e.test(d) && (d = a.validator.format(d.replace(e, "{$1}"), c.parameters)), this.errorList.push({ 289 message: d, 290 element: b, 291 method: c.method 292 }), this.errorMap[b.name] = d, this.submitted[b.name] = d 293 }, 294 addWrapper: function (a) { 295 return this.settings.wrapper && (a = a.add(a.parent(this.settings.wrapper))), a 296 }, 297 defaultShowErrors: function () { 298 var a, b, c; 299 for (a = 0; this.errorList[a]; a++) c = this.errorList[a], this.settings.highlight && this.settings.highlight.call(this, c.element, this.settings.errorClass, this.settings.val
299idClass), this.showLabel(c.element, c.message); 300 if (this.errorList.length && (this.toShow = this.toShow.add(this.containers)), this.settings.success) for (a = 0; this.successList[a]; a++) this.showLabel(this.successList[a]); 301 if (this.settings.unhighlight) for (a = 0, b = this.validElements() ; b[a]; a++) this.settings.unhighlight.call(this, b[a], this.settings.errorClass, this.settings.validClass); 302 this.toHide = this.toHide.not(this.toShow), this.hideErrors(), this.addWrapper(this.toShow).show() 303 }, 304 validElements: function () { 305 return this.currentElements.not(this.invalidElements()) 306 }, 307 invalidElements: function () { 308 return a(this.errorList).map(function () { 309 return this.element 310 }) 311 }, 312 showLabel: function (b, c) { 313 var d, e, f, g = this.errorsFor(b), 314 h = this.idOrName(b), 315 i = a(b).attr("aria-describedby"); 316 g.length ? (g.removeClass(this.settings.validClass).addClass(this.settings.errorClass), g.html(c)) : (g = a("<" + this.settings.errorElement + ">").attr("id", h + "-error").addClass(this.settings.errorClass).html(c || ""), d = g, this.settings.wrapper && (d = g.hide().show().wrap("<" + this.settings.wrapper + "/>").parent()), this.labelContainer.length ? this.labelContainer.append(d) : this.settings.errorPlacement ? this.settings.errorPlacement(d, a(b)) : d.insertAfter(b), g.is("label") ? g.attr("for", h) : 0 === g.parents("label[for='" + h + "']").length && (f = g.attr("id"), i ? i.match(new RegExp("\b" + f + "\b")) || (i += " " + f) : i = f, a(b).attr("aria-describedby", i), e = this.groups[b.n
316ame], e && a.each(this.groups, function (b, c) { 317 c === e && a("[name='" + b + "']", this.currentForm).attr("aria-describedby", g.attr("id")) 318 }))), !c && this.settings.success && (g.text(""), "string" == typeof this.settings.success ? g.addClass(this.settings.success) : this.settings.success(g, b)), this.toShow = this.toShow.add(g) 319 }, 320 errorsFor: function (b) { 321 var c = this.idOrName(b), 322 d = a(b).attr("aria-describedby"), 323 e = "label[for='" + c + "'], label[for='" + c + "'] *"; 324 return d && (e = e + ", #" + d.replace(/\s+/g, ", #")), this.errors().filter(e) 325 }, 326 idOrName: function (a) { 327 return this.groups[a.name] || (this.checkable(a) ? a.name : a.id || a.name) 328 }, 329 validationTargetFor: function (a) { 330 return this.checkable(a) && (a = this.findByName(a.name).not(this.settings.ignore)[0]), a 331 }, 332 checkable: function (a) { 333 return /radio|checkbox/i.test(a.type) 334 }, 335 findByName: function (b) { 336 return a(this.currentForm).find("[name='" + b + "']") 337 }, 338 getLength: function (b, c) { 339 switch (c.nodeName.toLowerCase()) { 340 case "select": 341 return a("option:selected", c).length; 342 case "input": 343 if (this.checkable(c)) return this.findByName(c.name).filter(":checked").length 344 } 345 return b.length 346 }, 347 depend: function (a, b) { 348 return this.dependTypes[typeof a] ? this.dependTypes[typeof a](a, b) : !0 349 }, 350 dependTypes: { 351 "boolean": function (a) { 352 return a 353 }, 354 string: function (b, c) { 355 return !!a(b, c.form).length 356 }, 357 "function": function (a, b) { 358 return a(b) 359 } 360 }, 361 optional: function (b) { 362 var c = this.elementValue(b); 363 return !a.validator.methods.required.call(this, c, b) && "dependency-mismatch" 364 }, 365 startRequest: function (a) { 366 this.pending[a.name] || (this.pendingRequest++, this.pending[a.name] = !0) 367 }, 368 stopRequest: function (b, c) { 369 this.pendingRequest--, this.pendingRequest < 0 && (this.pendingRequest = 0), delete this.pending[b.name], c && 0 === this.pendingRequest && this.formSubmitted && this.form() ? (a(this.currentForm).submit(), this.formSubmitted = !1) : !c && 0 === this.pendingRequest && this.formSubmitted && (a(this.currentForm).triggerHandler("invalid-form", [this]), this.formSubmitted = !1) 370 }, 371 previousValue: function (b) { 372 return a.data(b, "previousValue") || a.data(b, "previousValue", { 373 old: null, 374 valid: !0, 375 message: this.defaultMessage(b, "remote") 376 }) 377 } 378 }, 379 classRuleSettings: { 380 required: { 381 required: !0 382 }, 383 email: { 384 email: !0 385 }, 386 url: { 387 url: !0 388 }, 389 date: { 390 date: !0 391 }, 392 dateISO: { 393 dateISO: !0 394 }, 395 number: { 396 number: !0 397 }, 398 digits: { 399 digits: !0 400 }, 401 creditcard: { 402 creditcard: !0 403 } 404 }, 405 addClassRules: function (b, c) { 406 b.constructor === String ? this.classRuleSettings[b] = c : a.extend(this.classRuleSettings, b) 407 }, 408 classRules: function (b) { 409 var c = {}, 410 d = a(b).attr("class"); 411 return d && a.each(d.split(" "), function () { 412 this in a.validator.classRuleSettings && a.extend(c, a.validator.classRuleSettings[this]) 413 }), c 414 }, 415 attributeRules: function (b) { 416 var c, d, e = {}, 417 f = a(b), 418 g = b.getAttribute("type"); 419 for (c in a.validator.methods) "required" === c ? (d = b.getAttribute(c), "" === d && (d = !0), d = !!d) : d = f.attr(c), /min|max/.test(c) && (null === g || /number|range|text/.test(g)) && (d = Number(d)), d || 0 === d ? e[c] = d : g === c && "range" !== g && (e[c] = !0);
420 return e.maxlength && /-1|2147483647|524288/.test(e.maxlength) && delete e.maxlength, e 421 }, 422 dataRules: function (b) { 423 var c, d, e = {}, 424 f = a(b); 425 for (c in a.validator.methods) d = f.data("rule" + c.charAt(0).toUpperCase() + c.substring(1).toLowerCase()), void 0 !== d && (e[c] = d); 426 return e 427 }, 428 staticRules: function (b) { 429 var c = {}, 430 d = a.data(b.form, "validator"); 431 return d.settings.rules && (c = a.validator.normalizeRule(d.settings.rules[b.name]) || {}), c 432 }, 433 normalizeRules: function (b, c) { 434 return a.each(b, function (d, e) { 435 if (e === !1) return void delete b[d]; 436 if (e.param || e.depends) { 437 var f = !0; 438 switch (typeof e.depends) { 439 case "string": 440 f = !!a(e.depends, c.form).length; 441 break; 442 case "function": 443 f = e.depends.call(c, c) 444 } 445 f ? b[d] = void 0 !== e.param ? e.param : !0 : delete b[d] 446 } 447 }), a.each(b, function (d, e) { 448 b[d] = a.isFunction(e) ? e(c) : e 449 }), a.each(["minlength", "maxlength"], function () { 450 b[this] && (b[this] = Number(b[this])) 451 }), a.each(["rangelength", "range"], function () { 452 var c; 453 b[this] && (a.isArray(b[this]) ? b[this] = [Number(b[this][0]), Number(b[this][1])] : "string" == typeof b[this] && (c = b[this].replace(/[\[\]]/g, "").split(/[\s,]+/), b[this] = [Number(c[0]), Number(c[1])])) 454 }), a.validator.autoCreateRanges && (b.min && b.max && (b.range = [b.min, b.max], delete b.min, delete b.max), b.minlength && b.maxlength && (b.rangelength = [b.minlength, b.maxlength], delete b.minlength, delete b.maxlength)), b 455 }, 456 normalizeRule: function (b) { 457 if ("string" == typeof b) { 458 var c = {}; 459 a.each(b.split(/\s/), function () { 460 c[this] = !0 461 }), b = c 462 } 463 return b 464 }, 465 addMethod: function (b, c, d) { 466 a.validator.methods[b] = c, a.validator.messages[b] = void 0 !== d ? d : a.validator.messages[b], c.length < 3 && a.validator.addClassRules(b, a.validator.normalizeRule(b)) 467 }, 468 methods: { 469 required: function (b, c, d) { 470 if (!this.depend(d, c)) return "dependency-mismatch"; 471 if ("select" === c.nodeName.toLowerCase()) { 472 var e = a(c).val(); 473 return e && e.length > 0 474 } 475 return this.checkable(c) ? this.getLength(b, c) > 0 : a.trim(b).length > 0 476 }, 477 email: function (a, b) { 478 return this.optional(b) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a) 479 }, 480 url: function (a, b) { 481 return this.optional(b) || /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a) 482 }, 483 date: function (a, b) { 484 return this.optional(b) || !/Invalid|NaN/.test(new Date(a).toString()) 485 }, 486 dateISO: function (a, b) { 487 return this.optional(b) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a) 488 }, 489 number: function (a, b) { 490 return this.optional(b) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a) 491 }, 492 digits: function (a, b) { 493 return this.optional(b) || /^\d+$/.test(a) 494 }, 495 creditcard: function (a, b) { 496 if (this.optional(b)) return "dependency-mismatch"; 497 if (/[^0-9 \-]+/.test(a)) return !1; 498 var c, d, e = 0, 499 f = 0, 500 g = !1; 501 if (a = a.replace(/\D/g, ""), a.length < 13 || a.length > 19) return !1; 502 for (c = a.length - 1; c >= 0; c--) d = a.charAt(c), f = parseInt(d, 10), g && (f *= 2) > 9 && (f -= 9), e += f, g = !g; 503 return e % 10 === 0 504 }, 505 minlength: function (b, c, d) { 506 var e = a.isArray(b) ? b.length : this.getLength(a.trim(b), c); 507 return this.optional(c) || e >= d 508 }, 509 maxlength: function (b, c, d) { 510 var e = a.isArray(b) ? b.length : this.getLength(a.trim(b), c); 511 return this.optional(c) || d >= e 512 }, 513 rangelength: function (b, c, d) { 514 var e = a.isArray(b) ? b.length : this.getLength(a.trim(b), c); 515 return this.optional(c) || e >= d[0] && e <= d[1] 516 }, 517 min: function (a, b, c) { 518 return this.optional(b) || a >= c 519 }, 520 max: function (a, b, c) { 521 return this.optional(b) || c >= a 522 }, 523 range: function (a, b, c) { 524 return this.optional(b) || a >= c[0] && a <= c[1] 525 }, 526 equalTo: function (b, c, d) { 527 var e = a(d); 528 return this.settings.onfocusout && e.unbind(".validate-equalTo").bind("blur.validate-equalTo", function () { 529 a(c).valid() 530 }), b === e.val() 531 }, 532 533 //檢é©åæ³æ¥æ,æ¥ææ ¼å¼éå®çºyyyy/MM/dd yyy-MM-dd (Alan Wu 2011/10/04) 534 validDate: function (value, element, param) { 535 var date = element.value.replace(/\D/g, '/').split("/"); 536 var JDate = new Date(parseInt(date[0], 10), parseInt(date[1], 10) - 1, parseInt(date[2], 10)); 537 valid = (parseInt(date[1], 10) - 1 == JDate.getMonth() && parseInt(date[2], 10) == JDate.getDate() && parseInt(date[0], 10) == JDate.getFullYear()) 538 539 return this.optional(element) || valid; 540 }, 541 //é»è©± 02-22223333#44 (Alan Wu 2011/10/04) 542 phone: function (value, element) { 543 return this.optional(element) || /^[0][1-9]{1,2}-([0-9]{7,8})+((#([0-9]){1,5}){0,1})$/.test(value); 544 }, 545 //ææ© 0933123456 (Alan Wu 2011/10/04) 546 mobile: function (value, element) { 547 return this.optional(element) || /^09[0-9]{8}$/.test(value); 548 }, 549 //å¯ç¢¼ è³å°5-12碼 (Alan Wu 2011/10/04) 550 password: function (value, element) { 551 return this.optional(element) || /((\W|\w){5,12})$/.test(value); 552 }, 553 //åå é·åº¦é©è (Alan Wu 2012/01/19) 554 byteLimit: function (value, element, param) { 555 var arr = value.match(/[^\x00-\xff]/ig); 556 if ((arr == null ? value.length : value.length + arr.length) > param) 557 return false; 558 else 559 return true; 560 }, 561 // å°ç£èº«ä»½èåèæ ¼å¼æª¢æ¥ç¨å¼ (Alan Wu 2012/08/30) 562 twIDCheck: function (value, element, param) { 563 var a = new Array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'X', 'Y', 'W', 'Z', 'I', 'O'); 564 var b = new Array(1, 9, 8, 7, 6, 5, 4, 3, 2, 1); 565 var c = new Array(2); 566 var d; 567 var e; 568 var f; 569 var g = 0; 570 var h = /^[a-z](1|2)\d{8}$/i; 571 if (value.search(h) == -1) { 572 return false; 573 } 574 else { 575 d = value.charAt(0).toUpperCase(); 576 f = value.charAt(9); 577 } 578 for (var i = 0; i < 26; i++) { 579 if (d == a[i])//a==a 580 { 581 e = i + 10; //10 582 c[0] = Math.floor(e / 10); //1 583 c[1] = e - (c[0] * 10); //10-(1*10) 584 break; 585 } 586 } 587 for (var i = 0; i < b.length; i++) { 588 if (i < 2) { 589 g += c[i] * b[i]; 590 } 591 else { 592 g += parseInt(value.charAt(i - 1)) * b[i]; 593 } 594 } 595 if ((g % 10) == f) { 596 return true; 597 } 598 if ((10 - (g % 10)) != f) { 599 return false; 600 } 601 return true; 602 }, 603 604 remote: function (b, c, d) { 605 if (this.optional(c)) return "dependency-mismatch"; 606 var e, f, g = this.previousValue(c); 607 return this.settings.messages[c.name] || (this.settings.messages[c.name] = {}), g.originalMessage = this.settings.messages[c.name].remote, this.settings.messages[c.name].remote = g.message, d = "string" == typeof d && { 608 url: d 609 } || d, g.old === b ? g.valid : (g.old = b, e = this, this.startRequest
609(c), f = {}, f[c.name] = b, a.ajax(a.extend(!0, { 610 url: d, 611 mode: "abort", 612 port: "validate" + c.name, 613 dataType: "json", 614 data: f, 615 context: e.currentForm, 616 success: function (d) { 617 var f, h, i, j = d === !0 || "true" === d; 618 e.settings.messages[c.name].remote = g.originalMessage, j ? (i = e.formSubmitted, e.prepareElement(c), e.formSubmitted = i, e.successList.push(c), delete e.invalid[c.name], e.showErrors()) : (f = {}, h = d || e.defaultMessage(c, "remote"), f[c.name] = g.message = a.isFunction(h) ? h(b) : h, e.invalid[c.name] = !0, e.showErrors(f)), g.valid = j, e.stopRequest(c, j) 619 } 620 }, d)), "pending") 621 }, 622 623 regex: function (value, element, regexp) { 624 var re = new RegExp(regexp); 625 return this.optional(element) || re.test(value); 626 }, 627 } 628 }), a.format = function () { 629 throw "$.format has been deprecated. Please use $.validator.format instead." 630 }; 631 var b, c = {}; 632 a.ajaxPrefilter ? a.ajaxPrefilter(function (a, b, d) { 633 var e = a.port; 634 "abort" === a.mode && (c[e] && c[e].abort(), c[e] = d) 635 }) : (b = a.ajax, a.ajax = function (d) { 636 var e = ("mode" in d ? d : a.ajaxSettings).mode, 637 f = ("port" in d ? d : a.ajaxSettings).port; 638 return "abort" === e ? (c[f] && c[f].abort(), c[f] = b.apply(this, arguments), c[f]) : b.apply(this, arguments) 639 }), a.extend(a.fn, { 640 validateDelegate: function (b, c, d) { 641 return this.bind(c, function (c) { 642 var e = a(c.target); 643 return e.is(b) ? d.apply(e, arguments) : void 0 644 }) 645 } 646 }) 647});
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.