You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
BIN
static/plugins/validator/images/loading.gif
Executable file
BIN
static/plugins/validator/images/loading.gif
Executable file
Binary file not shown.
After Width: | Height: | Size: 457 B |
BIN
static/plugins/validator/images/validator_default.png
Executable file
BIN
static/plugins/validator/images/validator_default.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 423 B |
BIN
static/plugins/validator/images/validator_simple.png
Executable file
BIN
static/plugins/validator/images/validator_simple.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
269
static/plugins/validator/jquery.validator.css
Executable file
269
static/plugins/validator/jquery.validator.css
Executable file
@ -0,0 +1,269 @@
|
||||
.n-inline-block,
|
||||
.nice-validator input,
|
||||
.nice-validator select,
|
||||
.nice-validator textarea,
|
||||
.nice-validator [contenteditable],
|
||||
.msg-wrap,
|
||||
.n-icon,
|
||||
.n-msg {
|
||||
display: inline-block;
|
||||
*display: inline;
|
||||
*zoom: 1;
|
||||
}
|
||||
.nice-validator .msg-container .msg-box {
|
||||
display: block;
|
||||
}
|
||||
.nice-validator .msg-container .msg-wrap {
|
||||
position: static;
|
||||
}
|
||||
.msg-box {
|
||||
position: relative;
|
||||
*zoom: 1;
|
||||
}
|
||||
.msg-wrap {
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
line-height: 16px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.msg-wrap,
|
||||
.n-icon,
|
||||
.n-msg {
|
||||
vertical-align: top;
|
||||
}
|
||||
.msg-box .msg-wrap .n-error,
|
||||
.msg-box .msg-wrap .n-ok,
|
||||
.msg-box .msg-wrap .n-tip {
|
||||
display: block;
|
||||
background: none;
|
||||
box-shadow: none;
|
||||
padding: 3px 2px;
|
||||
}
|
||||
.n-arrow {
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
}
|
||||
.n-arrow b,
|
||||
.n-arrow i {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
border: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
font-size: 12px;
|
||||
font-family: serif;
|
||||
line-height: 14px;
|
||||
_line-height: 15px;
|
||||
}
|
||||
.n-arrow i {
|
||||
text-shadow: none;
|
||||
}
|
||||
.n-icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
overflow: hidden;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
.n-msg {
|
||||
display: inline-block;
|
||||
*display: inline;
|
||||
*zoom: 1;
|
||||
margin-left: 1px;
|
||||
}
|
||||
.n-error {
|
||||
color: #c33;
|
||||
}
|
||||
.n-ok {
|
||||
color: #390;
|
||||
}
|
||||
.n-tip .n-msg,
|
||||
.n-loading {
|
||||
color: #808080;
|
||||
}
|
||||
.n-error .n-icon {
|
||||
background-position: 0 0;
|
||||
}
|
||||
.n-ok .n-icon {
|
||||
background-position: -16px 0;
|
||||
}
|
||||
.n-tip .n-icon {
|
||||
background-position: -32px 0;
|
||||
}
|
||||
.n-loading .n-icon {
|
||||
background: url("images/loading.gif") 0 center no-repeat !important;
|
||||
}
|
||||
.n-top,
|
||||
.n-right,
|
||||
.n-bottom,
|
||||
.n-left {
|
||||
display: inline-block;
|
||||
*display: inline;
|
||||
*zoom: 1;
|
||||
line-height: 0;
|
||||
vertical-align: top;
|
||||
outline: 0;
|
||||
}
|
||||
.n-top .n-arrow,
|
||||
.n-bottom .n-arrow {
|
||||
height: 6px;
|
||||
width: 12px;
|
||||
left: 8px;
|
||||
}
|
||||
.n-left .n-arrow,
|
||||
.n-right .n-arrow {
|
||||
width: 6px;
|
||||
height: 12px;
|
||||
top: 6px;
|
||||
}
|
||||
.n-top {
|
||||
vertical-align: top;
|
||||
}
|
||||
.n-top .msg-wrap {
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.n-top .n-arrow {
|
||||
bottom: -6px;
|
||||
}
|
||||
.n-top .n-arrow b {
|
||||
top: -6px;
|
||||
}
|
||||
.n-top .n-arrow i {
|
||||
top: -7px;
|
||||
}
|
||||
.n-bottom {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
.n-bottom .msg-wrap {
|
||||
margin-top: 6px;
|
||||
}
|
||||
.n-bottom .n-arrow {
|
||||
top: -6px;
|
||||
}
|
||||
.n-bottom .n-arrow b {
|
||||
top: -1px;
|
||||
}
|
||||
.n-bottom .n-arrow i {
|
||||
top: 0;
|
||||
}
|
||||
.n-left .msg-wrap {
|
||||
right: 100%;
|
||||
margin-right: 6px;
|
||||
}
|
||||
.n-left .n-arrow {
|
||||
right: -6px;
|
||||
}
|
||||
.n-left .n-arrow b {
|
||||
left: -6px;
|
||||
}
|
||||
.n-left .n-arrow i {
|
||||
left: -7px;
|
||||
}
|
||||
.n-right .msg-wrap {
|
||||
margin-left: 6px;
|
||||
}
|
||||
.n-right .n-arrow {
|
||||
left: -6px;
|
||||
}
|
||||
.n-right .n-arrow b {
|
||||
left: 1px;
|
||||
}
|
||||
.n-right .n-arrow i {
|
||||
left: 2px;
|
||||
}
|
||||
/*********************
|
||||
* Themes
|
||||
*********************/
|
||||
.n-default .n-left,
|
||||
.n-default .n-right {
|
||||
margin-top: 5px;
|
||||
}
|
||||
.n-default .n-top .msg-wrap {
|
||||
bottom: 100%;
|
||||
}
|
||||
.n-default .n-bottom .msg-wrap {
|
||||
top: 100%;
|
||||
}
|
||||
.n-default .msg-wrap {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
}
|
||||
.n-default .msg-wrap .n-icon {
|
||||
background-image: url("images/validator_default.png");
|
||||
}
|
||||
.n-default .n-tip .n-icon {
|
||||
display: none;
|
||||
}
|
||||
.n-simple .msg-wrap {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
}
|
||||
.n-simple .msg-wrap .n-icon {
|
||||
background-image: url("images/validator_simple.png");
|
||||
}
|
||||
.n-simple .n-top .msg-wrap {
|
||||
bottom: 100%;
|
||||
}
|
||||
.n-simple .n-bottom .msg-wrap {
|
||||
top: 100%;
|
||||
}
|
||||
.n-simple .n-left,
|
||||
.n-simple .n-right {
|
||||
margin-top: 5px;
|
||||
}
|
||||
.n-simple .n-bottom .msg-wrap {
|
||||
margin-top: 3px;
|
||||
}
|
||||
.n-simple .n-tip .n-icon {
|
||||
display: none;
|
||||
}
|
||||
.n-yellow .msg-wrap {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
padding: 4px 6px;
|
||||
font-size: 12px;
|
||||
border: 1px solid transparent;
|
||||
background-color: #fffcef;
|
||||
border-color: #ffbb76;
|
||||
color: #db7c22;
|
||||
box-shadow: 0 1px 3px #ccc;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.n-yellow .msg-wrap .n-arrow b {
|
||||
color: #ffbb76;
|
||||
text-shadow: 0 0 2px #ccc;
|
||||
}
|
||||
.n-yellow .msg-wrap .n-arrow i {
|
||||
color: #fffcef;
|
||||
}
|
||||
.n-yellow .msg-wrap .n-icon {
|
||||
background-image: url("images/validator_simple.png");
|
||||
}
|
||||
.n-yellow .n-top .msg-wrap {
|
||||
bottom: 100%;
|
||||
}
|
||||
.n-yellow .n-bottom .msg-wrap {
|
||||
top: 100%;
|
||||
}
|
||||
.n-yellow .n-tip,
|
||||
.n-yellow .n-ok,
|
||||
.n-yellow .n-loading {
|
||||
background-color: #f8fdff;
|
||||
border-color: #ddd;
|
||||
color: #333;
|
||||
box-shadow: 0 1px 3px #ccc;
|
||||
}
|
||||
.n-yellow .n-tip .n-arrow b,
|
||||
.n-yellow .n-ok .n-arrow b,
|
||||
.n-yellow .n-loading .n-arrow b {
|
||||
color: #ddd;
|
||||
text-shadow: 0 0 2px #ccc;
|
||||
}
|
||||
.n-yellow .n-tip .n-arrow i,
|
||||
.n-yellow .n-ok .n-arrow i,
|
||||
.n-yellow .n-loading .n-arrow i {
|
||||
color: #f8fdff;
|
||||
}
|
2141
static/plugins/validator/jquery.validator.js
Executable file
2141
static/plugins/validator/jquery.validator.js
Executable file
File diff suppressed because it is too large
Load Diff
7
static/plugins/validator/jquery.validator.min.js
vendored
Executable file
7
static/plugins/validator/jquery.validator.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
137
static/plugins/validator/local/en.js
Executable file
137
static/plugins/validator/local/en.js
Executable file
@ -0,0 +1,137 @@
|
||||
/*********************************
|
||||
* Themes, rules, and i18n support
|
||||
* Locale: English
|
||||
*********************************/
|
||||
(function(factory) {
|
||||
typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
|
||||
typeof define === 'function' && define.amd ? require(['jquery'], factory) :
|
||||
factory(jQuery);
|
||||
}(function($) {
|
||||
|
||||
/* Global configuration
|
||||
*/
|
||||
$.validator.config({
|
||||
//stopOnError: true,
|
||||
//focusCleanup: true,
|
||||
//theme: 'yellow_right',
|
||||
//timely: 2,
|
||||
|
||||
// Custom rules
|
||||
rules: {
|
||||
digits: [/^\d+$/, "Please enter only digits."]
|
||||
,letters: [/^[a-z]+$/i, "Please enter only letters."]
|
||||
,date: [/^\d{4}-\d{2}-\d{2}$/, "Please enter a valid date, format: yyyy-mm-dd"]
|
||||
,time: [/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "Please enter a valid time, between 00:00 and 23:59"]
|
||||
,email: [/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/i, "Please enter a valid email address."]
|
||||
,url: [/^(https?|s?ftp):\/\/\S+$/i, "Please enter a valid URL."]
|
||||
,accept: function (element, params){
|
||||
if (!params) return true;
|
||||
var ext = params[0],
|
||||
value = $(element).val();
|
||||
return (ext === '*') ||
|
||||
(new RegExp(".(?:" + ext + ")$", "i")).test(value) ||
|
||||
this.renderMsg("Only accept {1} file extension.", ext.replace(/\|/g, ', '));
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// Default error messages
|
||||
messages: {
|
||||
0: "This field",
|
||||
fallback: "{0} is not valid.",
|
||||
loading: "Validating...",
|
||||
error: "Network Error.",
|
||||
timeout: "Request timed out.",
|
||||
required: "{0} is required.",
|
||||
remote: "Please try another name.",
|
||||
integer: {
|
||||
'*': "Please enter an integer.",
|
||||
'+': "Please enter a positive integer.",
|
||||
'+0': "Please enter a positive integer or 0.",
|
||||
'-': "Please enter a negative integer.",
|
||||
'-0': "Please enter a negative integer or 0."
|
||||
},
|
||||
match: {
|
||||
eq: "{0} must be equal to {1}.",
|
||||
neq: "{0} must be not equal to {1}.",
|
||||
lt: "{0} must be less than {1}.",
|
||||
gt: "{0} must be greater than {1}.",
|
||||
lte: "{0} must be less than or equal to {1}.",
|
||||
gte: "{0} must be greater than or equal to {1}."
|
||||
},
|
||||
range: {
|
||||
rg: "Please enter a number between {1} and {2}.",
|
||||
gte: "Please enter a number greater than or equal to {1}.",
|
||||
lte: "Please enter a number less than or equal to {1}.",
|
||||
gtlt: "Please fill in the number of {1} to {2}.",
|
||||
gt: "Please enter a number greater than {1}.",
|
||||
lt: "Please enter a number less than {1}."
|
||||
},
|
||||
checked: {
|
||||
eq: "Please check {1} items.",
|
||||
rg: "Please check between {1} and {2} items.",
|
||||
gte: "Please check at least {1} items.",
|
||||
lte: "Please check no more than {1} items."
|
||||
},
|
||||
length: {
|
||||
eq: "Please enter {1} characters.",
|
||||
rg: "Please enter a value between {1} and {2} characters long.",
|
||||
gte: "Please enter at least {1} characters.",
|
||||
lte: "Please enter no more than {1} characters.",
|
||||
eq_2: "",
|
||||
rg_2: "",
|
||||
gte_2: "",
|
||||
lte_2: ""
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/* Themes
|
||||
*/
|
||||
var TPL_ARROW = '<span class="n-arrow"><b>◆</b><i>◆</i></span>';
|
||||
$.validator.setTheme({
|
||||
'simple_right': {
|
||||
formClass: 'n-simple',
|
||||
msgClass: 'n-right'
|
||||
},
|
||||
'simple_bottom': {
|
||||
formClass: 'n-simple',
|
||||
msgClass: 'n-bottom'
|
||||
},
|
||||
'yellow_top': {
|
||||
formClass: 'n-yellow',
|
||||
msgClass: 'n-top',
|
||||
msgArrow: TPL_ARROW
|
||||
},
|
||||
'yellow_right': {
|
||||
formClass: 'n-yellow',
|
||||
msgClass: 'n-right',
|
||||
msgArrow: TPL_ARROW
|
||||
},
|
||||
'yellow_right_effect': {
|
||||
formClass: 'n-yellow',
|
||||
msgClass: 'n-right',
|
||||
msgArrow: TPL_ARROW,
|
||||
msgShow: function($msgbox, type){
|
||||
var $el = $msgbox.children();
|
||||
if ($el.is(':animated')) return;
|
||||
if (type === 'error') {
|
||||
$el.css({left: '20px', opacity: 0})
|
||||
.delay(100).show().stop()
|
||||
.animate({left: '-4px', opacity: 1}, 150)
|
||||
.animate({left: '3px'}, 80)
|
||||
.animate({left: 0}, 80);
|
||||
} else {
|
||||
$el.css({left: 0, opacity: 1}).fadeIn(200);
|
||||
}
|
||||
},
|
||||
msgHide: function($msgbox, type){
|
||||
var $el = $msgbox.children();
|
||||
$el.stop().delay(100).show()
|
||||
.animate({left: '20px', opacity: 0}, 300, function(){
|
||||
$msgbox.hide();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
145
static/plugins/validator/local/zh-CN.js
Executable file
145
static/plugins/validator/local/zh-CN.js
Executable file
@ -0,0 +1,145 @@
|
||||
/*********************************
|
||||
* Themes, rules, and i18n support
|
||||
* Locale: Chinese; 中文
|
||||
*********************************/
|
||||
(function(factory) {
|
||||
typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
|
||||
typeof define === 'function' && define.amd ? require(['jquery'], factory) :
|
||||
factory(jQuery);
|
||||
}(function($) {
|
||||
|
||||
/* Global configuration
|
||||
*/
|
||||
$.validator.config({
|
||||
//stopOnError: true,
|
||||
//focusCleanup: true,
|
||||
//theme: 'yellow_right',
|
||||
//timely: 2,
|
||||
|
||||
// Custom rules
|
||||
rules: {
|
||||
digits: [/^\d+$/, "请填写数字"]
|
||||
,letters: [/^[a-z]+$/i, "请填写字母"]
|
||||
,date: [/^\d{4}-\d{2}-\d{2}$/, "请填写有效的日期,格式:yyyy-mm-dd"]
|
||||
,time: [/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "请填写有效的时间,00:00到23:59之间"]
|
||||
,email: [/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/i, "请填写有效的邮箱"]
|
||||
,url: [/^(https?|s?ftp):\/\/\S+$/i, "请填写有效的网址"]
|
||||
,qq: [/^[1-9]\d{4,}$/, "请填写有效的QQ号"]
|
||||
,IDcard: [/^\d{6}(19|2\d)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)?$/, "请填写正确的身份证号码"]
|
||||
,tel: [/^(?:(?:0\d{2,3}[\- ]?[1-9]\d{6,7})|(?:[48]00[\- ]?[1-9]\d{6}))$/, "请填写有效的电话号码"]
|
||||
,mobile: [/^1[3-9]\d{9}$/, "请填写有效的手机号"]
|
||||
,zipcode: [/^\d{6}$/, "请检查邮政编码格式"]
|
||||
,chinese: [/^[\u0391-\uFFE5]+$/, "请填写中文字符"]
|
||||
,username: [/^\w{3,12}$/, "请填写3-12位数字、字母、下划线"]
|
||||
,password: [/^[\S]{6,16}$/, "请填写6-16位字符,不能包含空格"]
|
||||
,accept: function (element, params){
|
||||
if (!params) return true;
|
||||
var ext = params[0],
|
||||
value = $(element).val();
|
||||
return (ext === '*') ||
|
||||
(new RegExp(".(?:" + ext + ")$", "i")).test(value) ||
|
||||
this.renderMsg("只接受{1}后缀的文件", ext.replace(/\|/g, ','));
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// Default error messages
|
||||
messages: {
|
||||
0: "此处",
|
||||
fallback: "{0}格式不正确",
|
||||
loading: "正在验证...",
|
||||
error: "网络异常",
|
||||
timeout: "请求超时",
|
||||
required: "{0}不能为空",
|
||||
remote: "{0}已被使用",
|
||||
integer: {
|
||||
'*': "请填写整数",
|
||||
'+': "请填写正整数",
|
||||
'+0': "请填写正整数或0",
|
||||
'-': "请填写负整数",
|
||||
'-0': "请填写负整数或0"
|
||||
},
|
||||
match: {
|
||||
eq: "{0}与{1}不一致",
|
||||
neq: "{0}与{1}不能相同",
|
||||
lt: "{0}必须小于{1}",
|
||||
gt: "{0}必须大于{1}",
|
||||
lte: "{0}不能大于{1}",
|
||||
gte: "{0}不能小于{1}"
|
||||
},
|
||||
range: {
|
||||
rg: "请填写{1}到{2}的数",
|
||||
gte: "请填写不小于{1}的数",
|
||||
lte: "请填写最大{1}的数",
|
||||
gtlt: "请填写{1}到{2}之间的数",
|
||||
gt: "请填写大于{1}的数",
|
||||
lt: "请填写小于{1}的数"
|
||||
},
|
||||
checked: {
|
||||
eq: "请选择{1}项",
|
||||
rg: "请选择{1}到{2}项",
|
||||
gte: "请至少选择{1}项",
|
||||
lte: "请最多选择{1}项"
|
||||
},
|
||||
length: {
|
||||
eq: "请填写{1}个字符",
|
||||
rg: "请填写{1}到{2}个字符",
|
||||
gte: "请至少填写{1}个字符",
|
||||
lte: "请最多填写{1}个字符",
|
||||
eq_2: "",
|
||||
rg_2: "",
|
||||
gte_2: "",
|
||||
lte_2: ""
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/* Themes
|
||||
*/
|
||||
var TPL_ARROW = '<span class="n-arrow"><b>◆</b><i>◆</i></span>';
|
||||
$.validator.setTheme({
|
||||
'simple_right': {
|
||||
formClass: 'n-simple',
|
||||
msgClass: 'n-right'
|
||||
},
|
||||
'simple_bottom': {
|
||||
formClass: 'n-simple',
|
||||
msgClass: 'n-bottom'
|
||||
},
|
||||
'yellow_top': {
|
||||
formClass: 'n-yellow',
|
||||
msgClass: 'n-top',
|
||||
msgArrow: TPL_ARROW
|
||||
},
|
||||
'yellow_right': {
|
||||
formClass: 'n-yellow',
|
||||
msgClass: 'n-right',
|
||||
msgArrow: TPL_ARROW
|
||||
},
|
||||
'yellow_right_effect': {
|
||||
formClass: 'n-yellow',
|
||||
msgClass: 'n-right',
|
||||
msgArrow: TPL_ARROW,
|
||||
msgShow: function($msgbox, type){
|
||||
var $el = $msgbox.children();
|
||||
if ($el.is(':animated')) return;
|
||||
if (type === 'error') {
|
||||
$el.css({left: '20px', opacity: 0})
|
||||
.delay(100).show().stop()
|
||||
.animate({left: '-4px', opacity: 1}, 150)
|
||||
.animate({left: '3px'}, 80)
|
||||
.animate({left: 0}, 80);
|
||||
} else {
|
||||
$el.css({left: 0, opacity: 1}).fadeIn(200);
|
||||
}
|
||||
},
|
||||
msgHide: function($msgbox, type){
|
||||
var $el = $msgbox.children();
|
||||
$el.stop().delay(100).show()
|
||||
.animate({left: '20px', opacity: 0}, 300, function(){
|
||||
$msgbox.hide();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
137
static/plugins/validator/local/zh-TW.js
Executable file
137
static/plugins/validator/local/zh-TW.js
Executable file
@ -0,0 +1,137 @@
|
||||
/*********************************
|
||||
* Themes, rules, and i18n support
|
||||
* Locale: Chinese; 中文; TW (Taiwan)
|
||||
*********************************/
|
||||
(function(factory) {
|
||||
typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
|
||||
typeof define === 'function' && define.amd ? require(['jquery'], factory) :
|
||||
factory(jQuery);
|
||||
}(function($) {
|
||||
|
||||
/* Global configuration
|
||||
*/
|
||||
$.validator.config({
|
||||
//stopOnError: true,
|
||||
//focusCleanup: true,
|
||||
//theme: 'yellow_right',
|
||||
//timely: 2,
|
||||
|
||||
// Custom rules
|
||||
rules: {
|
||||
digits: [/^\d+$/, "請填寫數字"]
|
||||
,letters: [/^[a-z]+$/i, "請填寫字母"]
|
||||
,date: [/^\d{4}-\d{2}-\d{2}$/, "請填寫有效的日期,格式:yyyy-mm-dd"]
|
||||
,time: [/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "請填寫有效的時間,00:00到23:59之間"]
|
||||
,email: [/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/i, "請填寫有效的電郵"]
|
||||
,url: [/^(https?|s?ftp):\/\/\S+$/i, "請填寫有效的網址"]
|
||||
,accept: function (element, params){
|
||||
if (!params) return true;
|
||||
var ext = params[0],
|
||||
value = $(element).val();
|
||||
return (ext === '*') ||
|
||||
(new RegExp(".(?:" + ext + ")$", "i")).test(value) ||
|
||||
this.renderMsg("只接受{1}後綴的文件", ext.replace(/\|/g, ','));
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// Default error messages
|
||||
messages: {
|
||||
0: "此處",
|
||||
fallback: "{0}格式不正確",
|
||||
loading: "正在驗證...",
|
||||
error: "網絡異常",
|
||||
timeout: "請求超時",
|
||||
required: "{0}不能為空",
|
||||
remote: "{0}已被使用",
|
||||
integer: {
|
||||
'*': "請填寫整數",
|
||||
'+': "請填寫正整數",
|
||||
'+0': "請填寫正整數或0",
|
||||
'-': "請填寫負整數",
|
||||
'-0': "請填寫負整數或0"
|
||||
},
|
||||
match: {
|
||||
eq: "{0}與{1}不一致",
|
||||
neq: "{0}與{1}不能相同",
|
||||
lt: "{0}必須小於{1}",
|
||||
gt: "{0}必須大於{1}",
|
||||
lte: "{0}不能大於{1}",
|
||||
gte: "{0}不能小於{1}"
|
||||
},
|
||||
range: {
|
||||
rg: "請填寫{1}到{2}的數",
|
||||
gte: "請填寫不小於{1}的數",
|
||||
lte: "請填寫最大{1}的數",
|
||||
gtlt: "請填寫{1}到{2}之間的數",
|
||||
gt: "請填寫大於{1}的數",
|
||||
lt: "請填寫小於{1}的數"
|
||||
},
|
||||
checked: {
|
||||
eq: "請選擇{1}項",
|
||||
rg: "請選擇{1}到{2}項",
|
||||
gte: "請至少選擇{1}項",
|
||||
lte: "請最多選擇{1}項"
|
||||
},
|
||||
length: {
|
||||
eq: "請填寫{1}個字符",
|
||||
rg: "請填寫{1}到{2}個字符",
|
||||
gte: "請至少填寫{1}個字符",
|
||||
lte: "請最多填寫{1}個字符",
|
||||
eq_2: "",
|
||||
rg_2: "",
|
||||
gte_2: "",
|
||||
lte_2: ""
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/* Themes
|
||||
*/
|
||||
var TPL_ARROW = '<span class="n-arrow"><b>◆</b><i>◆</i></span>';
|
||||
$.validator.setTheme({
|
||||
'simple_right': {
|
||||
formClass: 'n-simple',
|
||||
msgClass: 'n-right'
|
||||
},
|
||||
'simple_bottom': {
|
||||
formClass: 'n-simple',
|
||||
msgClass: 'n-bottom'
|
||||
},
|
||||
'yellow_top': {
|
||||
formClass: 'n-yellow',
|
||||
msgClass: 'n-top',
|
||||
msgArrow: TPL_ARROW
|
||||
},
|
||||
'yellow_right': {
|
||||
formClass: 'n-yellow',
|
||||
msgClass: 'n-right',
|
||||
msgArrow: TPL_ARROW
|
||||
},
|
||||
'yellow_right_effect': {
|
||||
formClass: 'n-yellow',
|
||||
msgClass: 'n-right',
|
||||
msgArrow: TPL_ARROW,
|
||||
msgShow: function($msgbox, type){
|
||||
var $el = $msgbox.children();
|
||||
if ($el.is(':animated')) return;
|
||||
if (type === 'error') {
|
||||
$el.css({left: '20px', opacity: 0})
|
||||
.delay(100).show().stop()
|
||||
.animate({left: '-4px', opacity: 1}, 150)
|
||||
.animate({left: '3px'}, 80)
|
||||
.animate({left: 0}, 80);
|
||||
} else {
|
||||
$el.css({left: 0, opacity: 1}).fadeIn(200);
|
||||
}
|
||||
},
|
||||
msgHide: function($msgbox, type){
|
||||
var $el = $msgbox.children();
|
||||
$el.stop().delay(100).show()
|
||||
.animate({left: '20px', opacity: 0}, 300, function(){
|
||||
$msgbox.hide();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
Reference in New Issue
Block a user