调整文件结构,为全面优化javascript代码做准备

This commit is contained in:
yubaolee
2016-04-06 23:28:27 +08:00
parent 38e2628b15
commit 4ced496da9
449 changed files with 70356 additions and 44446 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -0,0 +1,83 @@
/*! nice Validator 0.7.3
* (c) 2012-2014 Jony Zhang <zj86@live.cn>, MIT Licensed
* http://niceue.com/validator/
*/
.n-inline-block,.nice-validator input,.nice-validator select,.nice-validator textarea,.msg-wrap,.n-icon,.n-msg{display:inline-block;*display:inline;*zoom:1}
.msg-box{position:relative;*zoom:1}
.msg-wrap{position:relative;white-space:nowrap; min-height:24px;}
.msg-wrap.wrap{white-space:normal;}
.msg-wrap,.n-icon,.n-msg{vertical-align:middle;}
.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;line-height:15px;margin-left:2px;*margin-top:-1px;_margin-top:0;font-size:12px;}
.n-error{color:#c33}
.n-ok{color:#390}
.n-tip,.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;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:4px}
.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}
.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}
.n-yellow .n-tip .n-icon{display:none}
.n-red .msg-wrap{position:absolute;z-index:1;padding:4px 6px 3px;font-size:12px;border:1px solid transparent;background-color:#fff6f6;border-color:#ff6464;color:#ff2929;box-shadow:0 1px 3px #ccc;border-radius:2px;}
.n-red .msg-wrap .n-arrow b{color:#ff6464;text-shadow:0 0 2px #ccc}
.n-red .msg-wrap .n-arrow i{color:#ffecec;}
.n-red .msg-wrap .n-icon{background-image:url("images/validator_simple.png")}
.n-red .n-top .msg-wrap{bottom:100%}
.n-red .n-bottom .msg-wrap{top:100%}
.n-red .n-tip,.n-red .n-ok,.n-red .n-loading{background-color:#f8fdff;border-color:#ddd;color:#333;}
.n-red .n-ok{color:#008800; background-color:#f5fdf5; border-color:#008800;}
.n-red .msg-wrap.n-ok .n-arrow b{color:#008800;}
.n-red .msg-wrap.n-ok .n-arrow i{color:#f5fdf5;}
.n-red .n-tip{color:#db7c22; background-color:#fffcef; border-color:#ffbb76;}
.n-red .msg-wrap.n-tip .n-arrow b{color:#ffbb76;}
.n-red .msg-wrap.n-tip .n-arrow i{color:#fffcef;}
.n-red .n-tip .n-arrow b,.n-red .n-ok .n-arrow b,.n-red .n-loading .n-arrow b{color:#ddd;text-shadow:0 0 2px #ccc}
.n-red .n-tip .n-arrow i,.n-red .n-ok .n-arrow i,.n-red .n-loading .n-arrow i{color:#f8fdff}
.n-red .n-tip .n-icon{display:none}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,273 @@
/* ========================================================================
* for nice validate themes
* @since K'naan (xknaan@163.com)
* ======================================================================== */
+function ($) {
'use strict';
function fixedLeft($msgbox) {
var $input = $msgbox.prev(),
$btngroup = $msgbox.next(),
$icheck = $msgbox.closest('[data-icheck]'),
$ichecks = $icheck.siblings('[data-icheck="'+ $icheck.data('icheck') +'"]').andSelf(),
$upload = $msgbox.closest('.bjui-upload')
var offLeft = 0
if (($input && $input.isTag('select') && $input.is(':hidden')) && ($btngroup && $btngroup.hasClass('bootstrap-select'))) {
var $btngroup = $msgbox.next()
offLeft += $btngroup.outerWidth()
}
if ($icheck.length) {
$ichecks.each(function() {
offLeft += $(this).outerWidth()
})
$msgbox.children().css('top', -4)
}
if ($upload.length) {
offLeft += $upload.find('.bjui-upload-select').outerWidth()
}
return offLeft
}
var TPL_ARROW = '<span class="n-arrow"><b>◆</b><i>◆</i></span>'
$.validator.setTheme({
'simple_right': {
formClass: 'n-simple',
msgClass: 'n-right',
msgShow: function($msgbox, type) {
var $el = $msgbox.children()
var $el = $msgbox.children()
var $form = $msgbox.closest('form'),
fW = $form.width(),
fL = $form.offset().left,
eL = $msgbox.offset().left,
mw = $el.outerWidth()
var offLeft = fixedLeft($msgbox)
if ((fW - (eL - fL)) < (mw + offLeft + 8)) {
$msgbox.find('> .msg-wrap').addClass('wrap').width(fW - (eL - fL) - offLeft - 8)
.find('> .n-msg').width(fW - (eL - fL) - offLeft - 8 - 30)
}
$el.css({
left: offLeft,
opacity: 1
}).fadeIn(200)
},
msgHide: function($msgbox, type) {
$msgbox.hide()
}
},
'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,
msgShow: function($msgbox, type) {
var $el = $msgbox.children()
var $el = $msgbox.children()
var $form = $msgbox.closest('form'),
fW = $form.width(),
fL = $form.offset().left,
eL = $msgbox.offset().left,
mw = $el.outerWidth()
var offLeft = fixedLeft($msgbox)
if ((fW - (eL - fL)) < (mw + offLeft + 8)) {
$msgbox.find('> .msg-wrap').addClass('wrap').width(fW - (eL - fL) - offLeft - 8)
.find('> .n-msg').width(fW - (eL - fL) - offLeft - 8 - 30)
}
$el.css({
left: offLeft,
opacity: 1
}).fadeIn(200)
},
msgHide: function($msgbox, type) {
$msgbox.hide()
}
},
'yellow_right_effect': {
formClass: 'n-yellow',
msgClass: 'n-right',
msgArrow: TPL_ARROW,
msgShow: function($msgbox, type) {
var $el = $msgbox.children()
var $el = $msgbox.children()
var $form = $msgbox.closest('form'),
fW = $form.width(),
fL = $form.offset().left,
eL = $msgbox.offset().left,
mw = $el.outerWidth()
var offLeft = fixedLeft($msgbox)
if ((fW - (eL - fL)) < (mw + offLeft + 8)) {
$msgbox.find('> .msg-wrap').addClass('wrap').width(fW - (eL - fL) - offLeft - 8)
.find('> .n-msg').width(fW - (eL - fL) - offLeft - 8 - 30)
}
if ($el.is(':animated')) return
if (type === 'error') {
$el.css({
left: offLeft + 20,
opacity: 0
}).delay(100).show().stop().animate({
left: offLeft - 4,
opacity: 1
}, 150).animate({
left: offLeft + 3
}, 80).animate({
left: offLeft
}, 80)
} else {
$el.css({
left: offLeft,
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()
})
}
},
'red_right_effect': {
formClass: 'n-red',
msgClass: 'n-right',
msgArrow: TPL_ARROW,
msgShow: function($msgbox, type) {
var $el = $msgbox.children()
var $form = $msgbox.closest('form'),
fW = $form.width(),
fL = $form.offset().left,
eL = $msgbox.offset().left,
mw = $el.outerWidth()
var offLeft = fixedLeft($msgbox)
var $wrap = $msgbox.find('> .msg-wrap')
var $icon = $msgbox.find('.n-icon')
if ((fW - (eL - fL)) < (mw + offLeft + 8)) {
$wrap.addClass('wrap').width(fW - (eL - fL) - offLeft - 8)
.find('> .n-msg').width(fW - (eL - fL) - offLeft - 8 - 30)
}
if ($wrap.hasClass('n-error'))
$icon.removeClass('n-icon').addClass('glyphicon glyphicon-remove-circle').css({top:-1, 'font-size':'14px', 'vertical-align':'middle'})
else if ($wrap.hasClass('n-tip'))
$icon.removeClass('n-icon').addClass('glyphicon glyphicon-info-sign').css({top:-1, 'font-size':'14px', 'vertical-align':'middle'})
else if ($wrap.hasClass('n-ok'))
$icon.removeClass('n-icon').addClass('glyphicon glyphicon-ok-circle').css({top:-1, 'font-size':'14px', 'vertical-align':'middle'})
if ($el.is(':animated')) return
if (type === 'error') {
$el.css({
left: offLeft + 20,
opacity: 0
}).delay(100).show().stop().animate({
left: offLeft - 4,
opacity: 1
}, 150).animate({
left: offLeft + 3
}, 80).animate({
left: offLeft
}, 80)
} else {
$el.css({
left: offLeft,
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()
})
}
},
'red_bottom_effect_grid': {
formClass: 'n-red',
msgClass: 'n-right',
msgArrow: TPL_ARROW,
msgShow: function($msgbox, type) {
var $el = $msgbox.children()
/*
var $form = $msgbox.closest('form'),
fW = $form.width(),
fL = $form.offset().left,
eL = $msgbox.offset().left,
mw = $el.outerWidth()
*/
var offLeft = fixedLeft($msgbox)
var $wrap = $msgbox.find('> .msg-wrap')
var $icon = $msgbox.find('.n-icon')
/*if ((fW - (eL - fL)) < (mw + offLeft + 8)) {
$wrap.addClass('wrap').width(fW - (eL - fL) - offLeft - 8)
.find('> .n-msg').width(fW - (eL - fL) - offLeft - 8 - 30)
}*/
if ($wrap.hasClass('n-error'))
$icon.removeClass('n-icon').addClass('glyphicon glyphicon-remove-circle').css({top:-1, 'font-size':'14px', 'vertical-align':'middle'})
else if ($wrap.hasClass('n-tip'))
$icon.removeClass('n-icon').addClass('glyphicon glyphicon-info-sign').css({top:-1, 'font-size':'14px', 'vertical-align':'middle'})
else if ($wrap.hasClass('n-ok'))
$icon.removeClass('n-icon').addClass('glyphicon glyphicon-ok-circle').css({top:-1, 'font-size':'14px', 'vertical-align':'middle'})
if ($el.is(':animated')) return
if (type === 'error') {
$el.css({
left: offLeft + 20,
opacity: 0
}).delay(100).show().stop().animate({
left: offLeft - 4,
opacity: 1
}, 150).animate({
left: offLeft + 3
}, 80).animate({
left: offLeft
}, 80)
} else {
$el.css({
left: offLeft,
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()
})
}
}
})
$.validator.config({
theme : 'red_right_effect',
formClass : 'n-red'
})
}(jQuery);

View File

@@ -0,0 +1,57 @@
/* nice validate - Global configuration */
$.validator.config({
//stopOnError: false,
//theme: 'yellow_right',
defaultMsg: "This field is not valid.",
loadingMsg: "Validating...",
// Custom rules
rules: {
digits: [/^\d+$/, "Please enter only digits."]
}
})
/* nice validate - Default error messages */
$.validator.config({
messages: {
required: "This field 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}."
},
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: ""
}
}
})