├── demo ├── images │ ├── ok.png │ └── ok-128.png ├── bootstrap-3.3.7-dist │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ └── js │ │ └── npm.js ├── success.html ├── index.html ├── zh_CN │ ├── bootstrap3_2.html │ ├── bootstrap3.html │ ├── tooltip.html │ └── div.html └── en │ ├── bootstrap3_2.html │ ├── bootstrap3.html │ ├── tooltip.html │ └── div.html ├── doc └── images │ ├── div.png │ ├── tooltip.png │ ├── bootstrap3.png │ ├── easycheck.png │ ├── bootstrap3_2.png │ └── easycheck-engine.png ├── easycheck ├── plugins │ ├── div │ │ ├── easycheck-div.css │ │ ├── easycheck-div2.css │ │ ├── easy.easycheck-div.min.js │ │ ├── easy.easycheck-div-all.min.js │ │ └── easy.easycheck-div.js │ ├── tooltip │ │ ├── easy.easycheck-tooltip.min.js │ │ ├── easycheck-tooltip.css │ │ ├── easy.easycheck-tooltip-all.min.js │ │ └── easy.easycheck-tooltip.js │ └── bootstrap3 │ │ └── easy.easycheck-bootstrap3.min.js ├── lang │ ├── easy.easycheck-lang-zh_CN.js │ └── easy.easycheck-lang-en.js └── easy.easycheck.min.js ├── .github └── FUNDING.yml └── readme.md /demo/images/ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ushelp/EasyCheck/HEAD/demo/images/ok.png -------------------------------------------------------------------------------- /doc/images/div.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ushelp/EasyCheck/HEAD/doc/images/div.png -------------------------------------------------------------------------------- /demo/images/ok-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ushelp/EasyCheck/HEAD/demo/images/ok-128.png -------------------------------------------------------------------------------- /doc/images/tooltip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ushelp/EasyCheck/HEAD/doc/images/tooltip.png -------------------------------------------------------------------------------- /doc/images/bootstrap3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ushelp/EasyCheck/HEAD/doc/images/bootstrap3.png -------------------------------------------------------------------------------- /doc/images/easycheck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ushelp/EasyCheck/HEAD/doc/images/easycheck.png -------------------------------------------------------------------------------- /doc/images/bootstrap3_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ushelp/EasyCheck/HEAD/doc/images/bootstrap3_2.png -------------------------------------------------------------------------------- /doc/images/easycheck-engine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ushelp/EasyCheck/HEAD/doc/images/easycheck-engine.png -------------------------------------------------------------------------------- /demo/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ushelp/EasyCheck/HEAD/demo/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /demo/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ushelp/EasyCheck/HEAD/demo/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /demo/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ushelp/EasyCheck/HEAD/demo/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /demo/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ushelp/EasyCheck/HEAD/demo/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /demo/success.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Success 6 | 7 | 8 |

Success!

9 | 10 | 11 | -------------------------------------------------------------------------------- /demo/bootstrap-3.3.7-dist/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /easycheck/plugins/div/easycheck-div.css: -------------------------------------------------------------------------------- 1 | .easycheck_errorInfo { 2 | margin-left: 10px; 3 | color:#FF2A2B; 4 | display: inline; 5 | font-size: 13px; 6 | } 7 | .easycheck_okInfo { 8 | margin-left: 10px; 9 | display: inline; 10 | font-size: 13px; 11 | color:#007C00; 12 | } 13 | [id^='default_'] { 14 | margin-left: 10px; 15 | display: inline; 16 | font-size: 13px; 17 | } 18 | /* 19 | * Notice: 20 | * Make style to take effect 21 | * Use the !important to specify the style for each of the highest priority 22 | */ 23 | .easycheck_focusInput{ 24 | border: 1px solid #0066FF !important; 25 | } 26 | .easycheck_errorInput { 27 | border: 1px solid #DD080A !important; 28 | } 29 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: ['http://www.easyproject.cn/donation'] 13 | -------------------------------------------------------------------------------- /easycheck/lang/easy.easycheck-lang-zh_CN.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery EasyCheck Plugin - language file 3 | * 4 | * Version 5.3.0 5 | * 6 | * http://easyproject.cn 7 | * https://github.com/ushelp/EasyCheck 8 | * 9 | * Copyright 2014 Ray [ inthinkcolor@gmail.com ] 10 | * 11 | * Dependencies: EasyCheck 12 | * 13 | */ 14 | if(window.EasyCheck){ 15 | /* 16 | * I18N Resources 17 | * */ 18 | EasyCheck.msg = { 19 | required:"不能为空", 20 | email:"邮箱格式不正确", 21 | url:"网址有误", 22 | number:"必须为数字", 23 | integer:"必须为整数", 24 | equalto:"输入不一致", 25 | equallength:"长度必须为{0}位", 26 | lengthrange:"长度必须在{0}到{1}之间", 27 | minlength:"长度不能小于{0}", 28 | maxlength:"长度不能大于{0}", 29 | numberrange:"值必须在{0}和{1}之间", 30 | min:"不能小于{0}", 31 | max:"不能大于{0}", 32 | regexp:"格式有误", 33 | extension:"文件后缀只能为{0}", 34 | vc:"输入有误" 35 | } 36 | if(EasyCheck.bootstrap3){ 37 | EasyCheck.bootstrap3.alertMsg="验证未通过!"; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /easycheck/lang/easy.easycheck-lang-en.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery EasyCheck Plugin - language file 3 | * 4 | * Version 5.3.0 5 | * 6 | * http://easyproject.cn 7 | * https://github.com/ushelp/EasyCheck 8 | * 9 | * Copyright 2014 Ray [ inthinkcolor@gmail.com ] 10 | * 11 | * Dependencies: EasyCheck 12 | * 13 | */ 14 | if(window.EasyCheck){ 15 | /* 16 | * I18N Resources 17 | * */ 18 | EasyCheck.msg = { 19 | required:"Is required", 20 | email:"Invalid email", 21 | url:"Invalid url", 22 | number:"Invalid number", 23 | integer:"Invalid integer", 24 | equalto:"Didn't match input", 25 | equallength:"length has to be {0}", 26 | lengthrange:"Please use between {0} and {1} characters", 27 | minlength:"Use at least {0} characters", 28 | maxlength:"Must have at most {0} characters", 29 | numberrange:"Value is between{0}and{1}", 30 | min:"The minimum value of {0}", 31 | max:"The maximum value of {0}", 32 | regexp:"Invalid value", 33 | extension:"Invalid extension,only {0}", 34 | vc:"Didn't match the word verification" 35 | }; 36 | 37 | if(EasyCheck.bootstrap3){ 38 | EasyCheck.bootstrap3.alertMsg="Validation failed!"; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /easycheck/plugins/div/easycheck-div2.css: -------------------------------------------------------------------------------- 1 | .easycheck_errorInfo { 2 | padding: 2px 8px; 3 | padding-left: 0px; 4 | height: 30px; 5 | font-family: 微软雅黑, Arial, Helvetica, sans-serif; 6 | margin-left: 10px; 7 | font-size: 18px; 8 | line-height: 30px; 9 | color : #BF6200; 10 | display: inline; 11 | font-weight: bold; 12 | border-radius: 0px; 13 | color: #BF6200; 14 | } 15 | 16 | .easycheck_okInfo { 17 | padding: 2px 8px; 18 | padding-left: 0px; 19 | height: 30px; 20 | font-family: 微软雅黑, Arial, Helvetica, sans-serif; 21 | margin-left: 10px; 22 | font-size: 18px; 23 | line-height: 30px; 24 | background-color: #7AC935; 25 | border-radius: 0px; 26 | color: #fff; 27 | display: inline; 28 | font-weight: bold; 29 | } 30 | [id^='default_'] { 31 | margin-left: 10px; 32 | display: inline; 33 | font-size: 13px; 34 | } 35 | 36 | /* 37 | * Notice: 38 | * Make style to take effect 39 | * Use the !important to specify the style for each of the highest priority 40 | */ 41 | .easycheck_focusInput { 42 | height: 38px !important; 43 | font-size: 14px !important; 44 | text-shadow: 0 0 0 rgba(0, 0, 0, 0.3) !important; 45 | text-indent: inherit !important; 46 | font-weight: normal !important; 47 | line-height: 38px !important; 48 | background: #fff !important; 49 | font-family: sans-serif, Verdana, Arial, Helvetica, Tahoma, "宋体" !important; 50 | margin-right: 10px !important; 51 | margin: 0px 0 0 10px !important; 52 | letter-spacing: 1px !important; 53 | background-color: #E3FFFF !important; 54 | outline: none !important; 55 | border: 1px solid #cfcfc9 !important; 56 | } 57 | 58 | .easycheck_errorInput { 59 | height: 38px !important; 60 | font-size: 14px !important; 61 | text-shadow: 0 0 0 rgba(0, 0, 0, 0.3) !important; 62 | text-indent: inherit !important; 63 | font-weight: normal !important; 64 | line-height: 38px !important; 65 | background: #fff !important; 66 | font-family: sans-serif, Verdana, Arial, Helvetica, Tahoma, "宋体" !important; 67 | margin-right: 10px !important; 68 | margin: 0px 0 0 10px !important; 69 | letter-spacing: 1px !important; 70 | outline: none !important; 71 | border: 1px solid #FF0084 !important; 72 | } 73 | 74 | -------------------------------------------------------------------------------- /demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | EasyCheck Demo 7 | 10 | 66 | 67 | 68 | 69 |
EasyCheck Demo
70 |
71 | http://easyproject.cn/EasyCheck 72 |
73 | https://github.com/ushelp/EasyCheck 74 | 75 |
76 |
77 |
78 |

中文

79 | Div demo
80 | Tooltip demo
81 | Bootstrap3 demo
82 | Bootstrap3 demo2 83 |
84 | 85 |
86 |

English

87 | Div demo
88 | Tooltip demo
89 | Bootstrap3 demo
90 | Bootstrap3 demo2 91 |
92 |
93 | 94 | 95 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # EasyCheck valication framework 2 | 3 | --------------- 4 | 5 | EasyCheck,是一个基于 jQuery 的前端 JavaScript 表单验证框架,无需编程通过 HTML 增强即可完成表单验证工作,简化前端开发工作,并保持统一验证风格,提高效率。并提供灵活的自定义接口,支持基于验证引擎的插件扩展。 6 | 7 | EasyCheck (Echeck), is a jQuery based front-end JavaScript forms authentication framework, without programming through HTML enhanced form validation work, simplifying the front-end development work, and maintain a unified style, improve efficiency. Custom interface, and provides a flexible support plug-in extension based on validation engine. 8 | 9 | ## Feature/功能 10 | 11 | ### 中文 12 | **主要特点:** 13 | 14 | 1. 轻量级,无需 JS 编程 15 | 16 | 2. 支持基于类、基于属性和组合验证器,内置能满足日常开发的十多种常用验证器 17 | 18 | 3. 文本框验证样式自动切换 19 | 20 | 4. 默认、错误和正确三种提示消息内容,提示消息位置的自定义 21 | 22 | 5. 客户端防止重复提交功能 23 | 24 | 6. 异步验证支持,支持 `ES6 Promise` 编程(验证码在不支持 `Promise` 的环境时,自动回退到同步验证) 25 | 26 | 7. 服务器验证消息处理,手动添加和清除验证消息(如页面提交到服务器校验转发回的消息,`Ajax` 的消息...) 27 | 28 | 8. 扩展性,支持用户开发注册新验证器 29 | 30 | 9. 插件支持,已支持验证提示插件:**DIV**, **ToolTip**, **Bootstrap3** 31 | 32 | 33 | **兼容性**: 34 | - 浏览器:完全兼容IE6及以上版本、Firefox、Chrome、Safari、Opera等各内核(Trident、Gecko、Webkit、Presto)浏览器,并兼容多平台及系统(PC,TabletPC,Mobile)。 35 | - jQuery: `1.9+`, `2.X`, `3.X` 36 | > Bootstrap 验证插件的兼容性与 Bootstrap 最低兼容要求一致 37 | 38 | **已支持插件:** 39 | - DIV 40 | - ToolTip 41 | - Bootstrap3 42 | 43 | 44 | ### English 45 | 46 | **Main features:** 47 | 1. Lightweight, No JavaScript programming 48 | 49 | 2. Support class-based, based on a combination of property and validators, Built to meet the daily development of a dozen popular validator 50 | 51 | 3. Verify that the text box to automatically switch styles 52 | 53 | 4. By default, errors and correct three kinds of message content, custom message location 54 | 55 | 5. Anti-client resubmit function 56 | 57 | 6. Asynchronous validation support, support for `ES6 Promise` programming (validation code automatically fallback to sync verification when the environment is not supported for `Promise`) 58 | 59 | 7. Server-side validation message, according to manually add and remove validation messages (such as the page to submit to the server check forwarding back to news, the news of the Ajax...) 60 | 61 | 8. scalability, support for registered users to develop new validator 62 | 63 | 9. Engine framework extension plugins, now support plug-ins: **DIV**, **ToolTip**, **Bootstrap3** 64 | 65 | **Compatibility:** 66 | - Browser: fully compatible with IE6 or later, Firefox, Chrome, Safari, Opera, and other kernel (Trident, Gecko, Webkit, Presto) browser, and is compatible with multiple platforms and systems (PC, TabletPC, Mobile). 67 | - jQuery: `1.9+`, `2.X`, `3.X` 68 | > That the bootstrap validation plugin is compatible with Bootstrap minimum compatibility requirements 69 | 70 | **Already support plugins:** 71 | - DIV 72 | - ToolTip 73 | - Bootstrap3 74 | 75 | 76 | ## Architecture/架构 77 | 78 | ![EasyCheck Functions](doc/images/easycheck.png) 79 | 80 | ![EasyCheck Engine](doc/images/easycheck-engine.png) 81 | 82 | 83 | ## Demo&Support plugins/示例和插件 84 | 85 | [Demo - 中文](http://www.easyproject.cn/easycheck/zh-cn/index.jsp#demo 'Demo - 中文]') 86 | 87 | [Demo - English](http://www.easyproject.cn/easycheck/zh-cn/index.jsp#demo 'Demo - English]') 88 | 89 | - **DIV** 90 | ![DIV demo](doc/images/div.png) 91 | 92 | - **ToolTip** 93 | ![DIV demo](doc/images/tooltip.png) 94 | 95 | - **Bootstrap3** 96 | ![DIV demo](doc/images/bootstrap3.png) 97 | ![DIV demo](doc/images/bootstrap3_2.png) 98 | 99 | 100 | ## Document/文档 101 | 102 | ### 中文 103 | 104 | [中文说明文档](doc/readme_zh_CN.md) 105 | 106 | [官方主页](http://www.easyproject.cn/easycheck/zh-cn/index.jsp '官方主页') 107 | 108 | [留言评论](http://www.easyproject.cn/easycheck/zh-cn/index.jsp#donation '留言评论') 109 | 110 | 如果您有更好意见,建议或想法,请联系我。 111 | 112 | ### English 113 | 114 | [English Readme](doc/readme_en.md) 115 | 116 | [The official home page](http://www.easyproject.cn/easycheck/en/index.jsp 'The official home page') 117 | 118 | [Comments](http://www.easyproject.cn/easycheck/en/index.jsp#donation 'Comments') 119 | 120 | If you have more comments, suggestions or ideas, please contact me. 121 | 122 | ## End 123 | 124 | Email: 125 | 126 | [http://www.easyproject.cn](http://www.easyproject.cn "EasyProject Home") 127 | 128 | 129 | **支付宝钱包扫一扫捐助:** 130 | 131 | 我们相信,每个人的点滴贡献,都将是推动产生更多、更好免费开源产品的一大步。 132 | 133 | **感谢慷慨捐助,以支持服务器运行和鼓励更多社区成员。** 134 | 135 | 支付宝钱包扫一扫捐助 136 | 137 | 138 | 139 | We believe that the contribution of each bit by bit, will be driven to produce more and better free and open source products a big step. 140 | 141 | **Thank you donation to support the server running and encourage more community members.** 142 | 143 | [![PayPal](http://www.easyproject.cn/images/paypaldonation5.jpg)](https://www.paypal.me/easyproject/10 "Make payments with PayPal - it's fast, free and secure!") 144 | 145 | -------------------------------------------------------------------------------- /easycheck/plugins/div/easy.easycheck-div.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery EasyCheck Plugin - Div plugin file 3 | * 4 | * Version 5.3.0 5 | * 6 | * http://easyproject.cn 7 | * https://github.com/ushelp/EasyCheck 8 | * 9 | * Author: Ray [ inthinkcolor@gmail.com ] 10 | * Since: 2011 11 | * 12 | * Dependencies: EasyCheck 13 | * 14 | */ 15 | EasyCheck.chkDef={errorManger:function(a){var b="";a.formId&&(b="[id='"+a.formId+"'] "),$(b+"[id^='error_']").each(function(){var d,e,f,a=$(this).attr("id").replace("error_",""),c=null;c=$(b+"[id='"+a+"']").length>0?$(b+"[id='"+a+"']"):$(b+"[name='"+a+"']"),d=$("form").has(c).attr("id"),"no"!=EasyCheck.ecss&&"no"!=EasyCheck.formEcss[d]&&(c.attr("ecss")&&"yes"!=c.attr("ecss")||(c.removeClass(EasyCheck.errorCss),d&&EasyCheck.formErrorCss[d]&&c.removeClass(EasyCheck.formErrorCss[d]),e=c.attr("id")||c.attr("name"),f=d+"_"+e,c.addClass(EasyCheck.txtClass[f+"_class"]))),$(b+"[id^='error_']").hide()}),a.restore&&($(b+"[id^='correct_']").each(function(){$(this).hide()}),$(b+"[id^='default_']").each(function(){var c,d,a=$("form").has(this),b=$(this);a?(c=a.attr("id"),d=b.attr("id").substr("default_".length),EasyCheck.chkDef.showDef(b,c,d)):EasyCheck.chkDef.showDef(b)}))},showDef:function(a,b,c){if(b){var d=a.html();void 0!=EasyCheck.cacheDefMsg[b+"_"+c]?d=EasyCheck.cacheDefMsg[b+"_"+c]:(a.attr("info")&&(d=a.attr("info")),EasyCheck.cacheDefMsg[b+"_"+c]=d),EasyCheck.defMsgs[c]?a.html(EasyCheck.defMsgs[c].replace(EasyCheck.msgMark,d)):EasyCheck.defMsgs[b]?a.html(EasyCheck.defMsgs[b].replace(EasyCheck.msgMark,d)):a.html(EasyCheck.defMsg.replace(EasyCheck.msgMark,d))}a.show()},addChkMethod:function(a,b,c,d,e){function i(d){var h,i,j,k,l,f=$(b).attr("id")||$(b).attr("name"),g=$("[id='default_"+f+"']");return d?(EasyCheck.clearError(b),h=$("[id='default_"+f+"']"),h&&h.hide(),i=$("[id='correct_"+f+"']"),a+" == "+"[id='correct_"+f+"']"+"====="+i.length,j=$("form").has(b).attr("id"),i.length>0&&(i.addClass("easycheck_okInfo"),k=i.html(),void 0!=EasyCheck.cacheCorrectMsg[j+"_"+f]?k=EasyCheck.cacheCorrectMsg[j+"_"+f]:(i.attr("info")&&(k=i.attr("info")),EasyCheck.cacheCorrectMsg[j+"_"+f]=k),EasyCheck.correctMsgs[f]?i.html(EasyCheck.correctMsgs[f].replace(EasyCheck.msgMark,k)):EasyCheck.correctMsgs[j]?i.html(EasyCheck.correctMsgs[j].replace(EasyCheck.msgMark,k)):i.html(EasyCheck.correctMsg.replace(EasyCheck.msgMark,k)),i.show()),c&&"keyup"==c.type&&($(b).removeClass(EasyCheck.errorCss),l=$("form").has(b),l.length>0&&EasyCheck.formErrorCss[l.attr("id")]&&$(b).removeClass(EasyCheck.formErrorCss[l.attr("id")]),l.length>0&&EasyCheck.formFocusCss[l.attr("id")]?$(b).addClass(EasyCheck.formFocusCss[l.attr("id")]):$(b).addClass(EasyCheck.focusCss)),!0):(g=$("[id='default_"+f+"']"),g&&g.hide(),EasyCheck.msgs[f]&&EasyCheck.msgs[f][a]&&(e="string"==typeof EasyCheck.msgs[f][a]?EasyCheck.msgs[f][a]:EasyCheck.msgs[f][a]($(b))),EasyCheck.showError(b,e),c&&c.stopImmediatePropagation(),!1)}var h,f=$(b).attr("id")||$(b).attr("name"),g=$("[id='default_"+f+"']");return g&&g.hide(),h=d(b),window.Promise&&h instanceof Promise?h.then(function(a){return i(a)},function(){return i(!1)}):i(h)},showError:function(a,b){var c,d,e,f,g,h;"string"==typeof a&&(a=$("#"+a)[0]||$("[name='"+a+"']")[0]),a=$(a),c=a.attr("id")||a.attr("name"),$("[id='correct_"+c+"']").hide(),$("[id='default_"+c+"']").hide(),d=$("[id='error_"+c+"']"),0==d.length&&(a.after("
"),d=$("[id='error_"+c+"']")),d.removeClass(),d.addClass("easycheck_errorInfo"),e=$("form").has(a).attr("id"),a.removeClass(EasyCheck.focusCss),e&&EasyCheck.formFocusCss[e]&&a.removeClass(EasyCheck.formFocusCss[e]),"no"!=EasyCheck.ecss&&"no"!=EasyCheck.formEcss[e]&&(a.attr("ecss")&&"yes"!=a.attr("ecss")||(e&&EasyCheck.formErrorCss[e]?a.addClass(EasyCheck.formErrorCss[e]):a.addClass(EasyCheck.errorCss))),f="",g=d.attr("prefix"),g?f=g+b:(g="",f=b),h=d.html(),void 0!=EasyCheck.cacheErrorMsg[e+"_"+c]?h=EasyCheck.cacheErrorMsg[e+"_"+c]:(d.attr("info")&&(h=d.attr("info")),EasyCheck.cacheErrorMsg[e+"_"+c]=h),h&&(f=g+h),EasyCheck.errorMsgs[c]?d.html(EasyCheck.errorMsgs[c].replace(EasyCheck.msgMark,f)):EasyCheck.errorMsgs[e]?d.html(EasyCheck.errorMsgs[e].replace(EasyCheck.msgMark,f)):d.html(EasyCheck.errorMsg.replace(EasyCheck.msgMark,f)),d.show()},clearError:function(a,b){var c,d,e,f,g,h;"string"==typeof a&&(a=$("#"+a)[0]||$("[name='"+a+"']")[0]),a=$(a),c=a.attr("id")||a.attr("name"),d=$("[id='error_"+c+"']"),e=$("form").has(a).attr("id"),d.length>0&&("no"!=EasyCheck.ecss&&"no"!=EasyCheck.formEcss[e]&&(a.attr("ecss")&&"yes"!=a.attr("ecss")||(a.removeClass(EasyCheck.errorCss),e&&EasyCheck.formErrorCss[e]&&a.removeClass(EasyCheck.formErrorCss[e]),f=a.attr("id")||a.attr("name"),g=e+"_"+f,a.addClass(EasyCheck.txtClass[g+"_class"]))),d.addClass("easycheck_okInfo"),b?d.html(b):d.html(""),d.hide(),h=$("[id='default_"+c+"']"),$("[id='correct_"+c+"']").hide(),EasyCheck.chkDef.showDef(h,e,c)),a.removeClass(EasyCheck.focusCss),e&&EasyCheck.formFocusCss[e]&&a.removeClass(EasyCheck.formFocusCss[e]),f=a.attr("id")||a.attr("name"),g=e+"_"+f,a.addClass(EasyCheck.txtClass[g+"_class"])},initChk:function(a,b){var d,c="";b&&(c="#"+b+" "),d=EasyCheck.getMatches(a.chkName),$(c+d).each(function(){var a=$(this),b=$("form").has(a).attr("id"),c=a.attr("id")||a.attr("name"),d=b+"_"+c;EasyCheck.txtClass[d+"_class"]=$(this).attr("class"),EasyCheck.txtClass[d+"_style"]=$(this).attr("style")}),$(c+d).on("blur change",function(b){EasyCheck.easyCheckBlurIgnore[a.chkName]||EasyCheck.easyCheckEleIgnore[b.target.id||b.target.name]||EasyCheck.easyCheckEleBlurIgnore[b.target.id||b.target.name]||(EasyCheck.blurChk?EasyCheck.chk(this,b,a.chkFunction):"")}).on("focus",function(){var b,c,d,e,f,g;EasyCheck.resetOnFocus&&(EasyCheck.clearError(this),b=$(this),c=b.attr("id")||b.attr("name"),d=$("[id='correct_"+c+"']"),d.length>0?d.filter(":hidden").length>0&&(e=$("[id='default_"+c+"']"),e&&($("[id='correct_"+c+"']").hide(),EasyCheck.chkDef.showDef(e,$("form").has($(c)).attr("id"),c))):(e=$("[id='default_"+c+"']"),e&&($("[id='correct_"+c+"']").hide(),EasyCheck.chkDef.showDef(e,$("form").has($(c)).attr("id"),c))),f=$("form").has(b),g=f.attr("id"),g=f.attr("id"),g&&EasyCheck.formFocusCss[g]?b.addClass(EasyCheck.formFocusCss[g]):b.addClass(EasyCheck.focusCss))}).on("keyup",function(b){EasyCheck.easyCheckKeyupIgnore[a.chkName]||EasyCheck.easyCheckEleIgnore[b.target.id||b.target.name]||EasyCheck.easyCheckEleKeyupIgnore[b.target.id||b.target.name]||(EasyCheck.keyupChk?EasyCheck.chk(this,b,a.chkFunction):"")})}},$(function(){EasyCheck.initDefMsg()}); -------------------------------------------------------------------------------- /easycheck/plugins/tooltip/easy.easycheck-tooltip.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery EasyCheck Plugin - Tooltip plugin file 3 | * 4 | * Version 5.3.0 5 | * 6 | * http://easyproject.cn 7 | * https://github.com/ushelp/EasyCheck 8 | * 9 | * Author: Ray [ inthinkcolor@gmail.com ] 10 | * Since: 2011 11 | * 12 | * Dependencies: EasyCheck 13 | * 14 | */ 15 | EasyCheck.chkDef={errorManger:function(a){var b="";a.formId&&(b="[id='"+a.formId+"'] "),$(b+"[id^='error_']").each(function(){var d,e,f,a=$(this).attr("id").replace("error_",""),c=null;c=$(b+"[id='"+a+"']").length>0?$(b+"[id='"+a+"']"):$(b+"[name='"+a+"']"),d=$("form").has(c).attr("id"),"no"!=EasyCheck.ecss&&"no"!=EasyCheck.formEcss[d]&&(c.attr("ecss")&&"yes"!=c.attr("ecss")||(c.removeClass(EasyCheck.errorCss),d&&EasyCheck.formErrorCss[d]&&c.removeClass(EasyCheck.formErrorCss[d]),e=c.attr("id")||c.attr("name"),f=d+"_"+e,c.addClass(EasyCheck.txtClass[f+"_class"]))),$(b+"[id^='error_']").hide()}),a.restore&&($(b+"[id^='correct_']").each(function(){$(this).hide()}),$(b+"[id^='default_']").each(function(){var c,d,a=$("form").has(this),b=$(this);a?(c=a.attr("id"),d=b.attr("id").substr("default_".length),EasyCheck.chkDef.showDef(b,c,d)):EasyCheck.chkDef.showDef(b)}))},showDef:function(a,b,c){if(b){var d=a.html();void 0!=EasyCheck.cacheDefMsg[b+"_"+c]?d=EasyCheck.cacheDefMsg[b+"_"+c]:(a.attr("info")&&(d=a.attr("info")),EasyCheck.cacheDefMsg[b+"_"+c]=d),EasyCheck.defMsgs[c]?a.html(EasyCheck.defMsgs[c].replace(EasyCheck.msgMark,d)):EasyCheck.defMsgs[b]?a.html(EasyCheck.defMsgs[b].replace(EasyCheck.msgMark,d)):a.html(EasyCheck.defMsg.replace(EasyCheck.msgMark,d))}a.show()},addChkMethod:function(a,b,c,d,e){function j(d){var h,i,j,k,l,f=$(b).attr("id")||$(b).attr("name"),g=$("[id='default_"+f+"']");return d?(EasyCheck.clearError(b),h=$("[id='default_"+f+"']"),h&&h.hide(),i=$("[id='correct_"+f+"']"),j=$("form").has(b).attr("id"),i.length>0&&(i.addClass("easycheck_okInfo"),k=i.html(),void 0!=EasyCheck.cacheCorrectMsg[j+"_"+f]?k=EasyCheck.cacheCorrectMsg[j+"_"+f]:(i.attr("info")&&(k=i.attr("info")),EasyCheck.cacheCorrectMsg[j+"_"+f]=k),EasyCheck.correctMsgs[f]?i.html(EasyCheck.correctMsgs[f].replace(EasyCheck.msgMark,k)):EasyCheck.correctMsgs[j]?i.html(EasyCheck.correctMsgs[j].replace(EasyCheck.msgMark,k)):i.html(EasyCheck.correctMsg.replace(EasyCheck.msgMark,k)),i.show()),c&&"keyup"==c.type&&($(b).removeClass(EasyCheck.errorCss),l=$("form").has(b),l.length>0&&EasyCheck.formErrorCss[l.attr("id")]&&$(b).removeClass(EasyCheck.formErrorCss[l.attr("id")]),l.length>0&&EasyCheck.formFocusCss[l.attr("id")]?$(b).addClass(EasyCheck.formFocusCss[l.attr("id")]):$(b).addClass(EasyCheck.focusCss)),!0):(g=$("[id='default_"+f+"']"),g&&g.hide(),EasyCheck.msgs[f]&&EasyCheck.msgs[f][a]&&(e="string"==typeof EasyCheck.msgs[f][a]?EasyCheck.msgs[f][a]:EasyCheck.msgs[f][a]($(b))),EasyCheck.showError(b,e),c&&c.stopImmediatePropagation(),!1)}var h,i,f=$(b).attr("id")||$(b).attr("name"),g=$("[id='default_"+f+"']");return g&&g.hide(),h=d(b),window.Promise&&h instanceof Promise?i=h.then(function(a){return j(a)},function(){return j(!1)}):j(h)},showError:function(a,b){var c,d,e,f,g,h;"string"==typeof a&&(a=$("#"+a)[0]||$("[name='"+a+"']")[0]),a=$(a),c=a.attr("id")||a.attr("name"),$("[id='correct_"+c+"']").hide(),$("[id='default_"+c+"']").hide(),d=$("[id='error_"+c+"']"),0==d.length&&(a.after("
"),d=$("[id='error_"+c+"']")),d.removeClass(),d.addClass("easycheck_errorInfo"),e=$("form").has(a).attr("id"),a.removeClass(EasyCheck.focusCss),e&&EasyCheck.formFocusCss[e]&&a.removeClass(EasyCheck.formFocusCss[e]),"no"!=EasyCheck.ecss&&"no"!=EasyCheck.formEcss[e]&&(a.attr("ecss")&&"yes"!=a.attr("ecss")||(e&&EasyCheck.formErrorCss[e]?a.addClass(EasyCheck.formErrorCss[e]):a.addClass(EasyCheck.errorCss))),f="",g=d.attr("prefix"),g?f=g+b:(g="",f=b),h=d.html(),void 0!=EasyCheck.cacheErrorMsg[e+"_"+c]?h=EasyCheck.cacheErrorMsg[e+"_"+c]:(d.attr("info")&&(h=d.attr("info")),EasyCheck.cacheErrorMsg[e+"_"+c]=h),h&&(f=g+h),EasyCheck.errorMsgs[c]?d.html(EasyCheck.errorMsgs[c].replace(EasyCheck.msgMark,f)):EasyCheck.errorMsgs[e]?d.html(EasyCheck.errorMsgs[e].replace(EasyCheck.msgMark,f)):d.html(EasyCheck.errorMsg.replace(EasyCheck.msgMark,f)),d.show()},clearError:function(a,b){var c,d,e,f,g,h;"string"==typeof a&&(a=$("#"+a)[0]||$("[name='"+a+"']")[0]),a=$(a),c=a.attr("id")||a.attr("name"),d=$("[id='error_"+c+"']"),e=$("form").has(a).attr("id"),d.length>0&&("no"!=EasyCheck.ecss&&"no"!=EasyCheck.formEcss[e]&&(a.attr("ecss")&&"yes"!=a.attr("ecss")||(a.removeClass(EasyCheck.errorCss),e&&EasyCheck.formErrorCss[e]&&a.removeClass(EasyCheck.formErrorCss[e]),f=a.attr("id")||a.attr("name"),g=e+"_"+f,a.addClass(EasyCheck.txtClass[g+"_class"]))),d.addClass("easycheck_okInfo"),b?d.html(b):d.html(""),d.hide(),h=$("[id='default_"+c+"']"),$("[id='correct_"+c+"']").hide(),EasyCheck.chkDef.showDef(h,e,c)),a.removeClass(EasyCheck.focusCss),e&&EasyCheck.formFocusCss[e]&&a.removeClass(EasyCheck.formFocusCss[e]),f=a.attr("id")||a.attr("name"),g=e+"_"+f,a.addClass(EasyCheck.txtClass[g+"_class"])},initChk:function(a,b){var d,c="";b&&(c="#"+b+" "),d=EasyCheck.getMatches(a.chkName),$(c+d).each(function(){var a=$(this),b=$("form").has(a).attr("id"),c=a.attr("id")||a.attr("name"),d=b+"_"+c;EasyCheck.txtClass[d+"_class"]=$(this).attr("class"),EasyCheck.txtClass[d+"_style"]=$(this).attr("style")}),$(c+d).on("blur change",function(b){EasyCheck.easyCheckBlurIgnore[a.chkName]||EasyCheck.easyCheckEleIgnore[b.target.id||b.target.name]||EasyCheck.easyCheckEleBlurIgnore[b.target.id||b.target.name]||(EasyCheck.blurChk?EasyCheck.chk(this,b,a.chkFunction):"")}).on("focus",function(){var b,c,d,e,f,g;EasyCheck.resetOnFocus&&(EasyCheck.clearError(this),b=$(this),c=b.attr("id")||b.attr("name"),d=$("[id='correct_"+c+"']"),d.length>0?d.filter(":hidden").length>0&&(e=$("[id='default_"+c+"']"),e&&($("[id='correct_"+c+"']").hide(),EasyCheck.chkDef.showDef(e,$("form").has($(c)).attr("id"),c))):(e=$("[id='default_"+c+"']"),e&&($("[id='correct_"+c+"']").hide(),EasyCheck.chkDef.showDef(e,$("form").has($(c)).attr("id"),c))),f=$("form").has(b),g=f.attr("id"),g=f.attr("id"),g&&EasyCheck.formFocusCss[g]?b.addClass(EasyCheck.formFocusCss[g]):b.addClass(EasyCheck.focusCss))}).on("keyup",function(b){EasyCheck.easyCheckKeyupIgnore[a.chkName]||EasyCheck.easyCheckEleIgnore[b.target.id||b.target.name]||EasyCheck.easyCheckEleKeyupIgnore[b.target.id||b.target.name]||(EasyCheck.keyupChk?EasyCheck.chk(this,b,a.chkFunction):"")})}},$(function(){window.EasyCheck&&(EasyCheck.errorMsg='
{0}
',EasyCheck.correctMsg='
{0}
',EasyCheck.defMsg='
{0}
',EasyCheck.initDefMsg())}); -------------------------------------------------------------------------------- /easycheck/plugins/bootstrap3/easy.easycheck-bootstrap3.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery EasyCheck Plugin - Bootstrap plugin file 3 | * 4 | * Version 5.3.0 5 | * 6 | * http://easyproject.cn 7 | * https://github.com/ushelp/EasyCheck 8 | * 9 | * Author: Ray [ inthinkcolor@gmail.com ] 10 | * Since: 2011 11 | * 12 | * Dependencies: EasyCheck 13 | * 14 | */ 15 | EasyCheck.focusCss="",EasyCheck.errorCss="",EasyCheck.resetOnFocus=!1,EasyCheck.bootstrap3={icon:!0,required:!0,requiredPosition:"after",alert:!0,alertMsg:"Validation failed!"},EasyCheck.chkDef={errorManger:function(a){var c,b="";a.formId&&(b="[id='"+a.formId+"'] "),$(b+"[id^='error_']").each(function(){var d,e,f,g,a=$(this).attr("id").replace("error_",""),c=$(this).parents(".form-group");c.find(".form-control-feedback").remove(),c.removeClass("has-feedback"),c.removeClass("has-error"),c.removeClass("has-success"),d=null,d=$(b+"[id='"+a+"']").length>0?$(b+"[id='"+a+"']"):$(b+"[name='"+a+"']"),e=$("form").has(d).attr("id"),"no"!=EasyCheck.ecss&&"no"!=EasyCheck.formEcss[e]&&(d.attr("ecss")&&"yes"!=d.attr("ecss")||(d.removeClass(EasyCheck.errorCss),e&&EasyCheck.formErrorCss[e]&&d.removeClass(EasyCheck.formErrorCss[e]),f=d.attr("id")||d.attr("name"),g=e+"_"+f,d.addClass(EasyCheck.txtClass[g+"_class"]))),$(b+"[id^='error_']").hide()}),a.restore&&(c=$("#"+a.formId),c.find(".form-control-feedback").remove(),c.find("div").removeClass("has-feedback"),c.find("div").removeClass("has-error"),c.find("div").removeClass("has-success"),$(b+"[id^='correct_']").each(function(){var a=$(this).parents(".form-group");a.find(".form-control-feedback").remove(),a.removeClass("has-feedback"),a.removeClass("has-error"),a.removeClass("has-success"),$(this).hide()}),$(b+"[id^='default_']").each(function(){var c,d,a=$("form").has(this),b=$(this);a?(c=a.attr("id"),d=b.attr("id").substr("default_".length),EasyCheck.chkDef.showDef(b,c,d)):EasyCheck.chkDef.showDef(b)}))},showDef:function(a,b,c){var d,e;b&&(d=a.html(),e=$("#"+c).parents(".form-group"),EasyCheck.bootstrap3.icon&&(e.find(".form-control-feedback").remove(),e.removeClass("has-feedback"),e.removeClass("has-error"),e.removeClass("has-success")),void 0!=EasyCheck.cacheDefMsg[b+"_"+c]?d=EasyCheck.cacheDefMsg[b+"_"+c]:(a.attr("info")&&(d=a.attr("info")),EasyCheck.cacheDefMsg[b+"_"+c]=d),EasyCheck.defMsgs[c]?a.html(EasyCheck.defMsgs[c].replace(EasyCheck.msgMark,d)):EasyCheck.defMsgs[b]?a.html(EasyCheck.defMsgs[b].replace(EasyCheck.msgMark,d)):a.html(EasyCheck.defMsg.replace(EasyCheck.msgMark,d))),a.show()},addChkMethod:function(a,b,c,d,e){function j(d){var h,i,j,k,l,m,n,f=$(b).attr("id")||$(b).attr("name"),g=$("[id='default_"+f+"']");return d?(EasyCheck.clearError(b),h=$("[id='default_"+f+"']"),h&&h.hide(),i='',j=$("[id='correct_"+f+"']"),k=$("form").has(b).attr("id"),l=$(b).parents(".form-group"),l.removeClass("has-error has-success"),l.addClass("has-success"),EasyCheck.bootstrap3.icon&&(l.addClass("has-feedback"),l.find(".form-control-feedback").remove(),$(b).after(i)),j.length>0&&(j.addClass("help-block"),m=j.html(),void 0!=EasyCheck.cacheCorrectMsg[k+"_"+f]?m=EasyCheck.cacheCorrectMsg[k+"_"+f]:(j.attr("info")&&(m=j.attr("info")),EasyCheck.cacheCorrectMsg[k+"_"+f]=m),EasyCheck.correctMsgs[f]?j.html(EasyCheck.correctMsgs[f].replace(EasyCheck.msgMark,m)):EasyCheck.correctMsgs[k]?j.html(EasyCheck.correctMsgs[k].replace(EasyCheck.msgMark,m)):j.html(EasyCheck.correctMsg.replace(EasyCheck.msgMark,m)),j.show()),c&&"keyup"==c.type&&($(b).removeClass(EasyCheck.errorCss),n=$("form").has(b),n.length>0&&EasyCheck.formErrorCss[n.attr("id")]&&$(b).removeClass(EasyCheck.formErrorCss[n.attr("id")]),n.length>0&&EasyCheck.formFocusCss[n.attr("id")]?$(b).addClass(EasyCheck.formFocusCss[n.attr("id")]):$(b).addClass(EasyCheck.focusCss)),!0):(g=$("[id='default_"+f+"']"),g&&g.hide(),EasyCheck.msgs[f]&&EasyCheck.msgs[f][a]&&(e="string"==typeof EasyCheck.msgs[f][a]?EasyCheck.msgs[f][a]:EasyCheck.msgs[f][a]($(b))),EasyCheck.showError(b,e),c&&c.stopImmediatePropagation(),!1)}var h,i,f=$(b).attr("id")||$(b).attr("name"),g=$("[id='default_"+f+"']");return g&&g.hide(),h=d(b),window.Promise&&h instanceof Promise?i=h.then(function(a){return j(a)},function(){return j(!1)}):j(h)},showError:function(a,b){var c,d,e,f,g,h,i,j,k;"string"==typeof a&&(a=$("#"+a)[0]||$("[name='"+a+"']")[0]),a=$(a),c=a.parents(".form-group"),c.removeClass("has-error has-success"),c.addClass("has-error"),d=a.attr("id")||a.attr("name"),$("[id='correct_"+d+"']").hide(),$("[id='default_"+d+"']").hide(),e=$("[id='error_"+d+"']"),0==e.length&&(f=a.next('[name="required"]'),f.length>0?f.after(""):a.after(""),e=$("[id='error_"+d+"']")),e.addClass("help-block"),g=$("form").has(a).attr("id"),"no"!=EasyCheck.ecss&&"no"!=EasyCheck.formEcss[g]&&(a.attr("ecss")&&"yes"!=a.attr("ecss")||(c.removeClass("has-error has-success"),g&&EasyCheck.formErrorCss[g]?a.addClass(EasyCheck.formErrorCss[g]):c.addClass("has-error"))),h="",i=e.attr("prefix"),i?h=i+b:(i="",h=b),j=e.html(),void 0!=EasyCheck.cacheErrorMsg[g+"_"+d]?j=EasyCheck.cacheErrorMsg[g+"_"+d]:(e.attr("info")&&(j=e.attr("info")),EasyCheck.cacheErrorMsg[g+"_"+d]=j),j&&(h=i+j),k='',EasyCheck.bootstrap3.icon&&(c.addClass("has-feedback"),c.find(".form-control-feedback").remove(),a.after(k)),EasyCheck.errorMsgs[d]?e.html(EasyCheck.errorMsgs[d].replace(EasyCheck.msgMark,h)):EasyCheck.errorMsgs[g]?e.html(EasyCheck.errorMsgs[g].replace(EasyCheck.msgMark,h)):e.html(EasyCheck.errorMsg.replace(EasyCheck.msgMark,h)),e.show()},clearError:function(a,b){var c,d,e,f,g,h;"string"==typeof a&&(a=$("#"+a)[0]||$("[name='"+a+"']")[0]),a=$(a),c=a.attr("id")||a.attr("name"),d=$("[id='error_"+c+"']"),e=$("form").has(a).attr("id"),d.length>0&&("no"!=EasyCheck.ecss&&"no"!=EasyCheck.formEcss[e]&&(a.attr("ecss")&&"yes"!=a.attr("ecss")||(a.removeClass(EasyCheck.errorCss),e&&EasyCheck.formErrorCss[e]&&a.removeClass(EasyCheck.formErrorCss[e]),f=a.attr("id")||a.attr("name"),g=e+"_"+f,a.addClass(EasyCheck.txtClass[g+"_class"]))),b?d.html(b):d.html(""),d.hide(),h=$("[id='default_"+c+"']"),$("[id='correct_"+c+"']").hide(),EasyCheck.chkDef.showDef(h,e,c)),a.removeClass(EasyCheck.focusCss),e&&EasyCheck.formFocusCss[e]&&a.removeClass(EasyCheck.formFocusCss[e]),f=a.attr("id")||a.attr("name"),g=e+"_"+f,a.addClass(EasyCheck.txtClass[g+"_class"])},initChk:function(a,b){var d,c="";b&&(c="#"+b+" "),d=EasyCheck.getMatches(a.chkName),$(c+d).each(function(){var f,g,h,i,b=$(this),c=$("form").has(b);c.attr("id"),b.attr("id")||b.attr("name"),f=EasyCheck.bootstrap3.required,f&&".required"==a.chkName&&(g=EasyCheck.bootstrap3.requiredPosition,h='*',"after"==g&&(c.hasClass("form-horizontal")||c.hasClass("form-inline"))?b.parent().after(h):"left"==g?(i=$(this).parents(".form-group").find("label:first"),i.prepend(h)):"right"==g&&(i=$(this).parents(".form-group").find("label:first"),i.append(h)))}),$(c+d).on("blur change",function(b){EasyCheck.easyCheckBlurIgnore[a.chkName]||EasyCheck.easyCheckEleIgnore[b.target.id||b.target.name]||EasyCheck.easyCheckEleBlurIgnore[b.target.id||b.target.name]||(EasyCheck.blurChk?EasyCheck.chk(this,b,a.chkFunction):"")}).on("focus",function(){var b,c,d,e,f,g;EasyCheck.resetOnFocus&&(EasyCheck.clearError(this),b=$(this),c=b.attr("id")||b.attr("name"),d=$("[id='correct_"+c+"']"),d.length>0?d.filter(":hidden").length>0&&(e=$("[id='default_"+c+"']"),e&&($("[id='correct_"+c+"']").hide(),EasyCheck.chkDef.showDef(e,$("form").has($(c)).attr("id"),c))):(e=$("[id='default_"+c+"']"),e&&($("[id='correct_"+c+"']").hide(),EasyCheck.chkDef.showDef(e,$("form").has($(c)).attr("id"),c))),f=$("form").has(b),g=f.attr("id"),g=f.attr("id"),g&&EasyCheck.formFocusCss[g]?b.addClass(EasyCheck.formFocusCss[g]):b.addClass(EasyCheck.focusCss))}).on("keyup",function(b){EasyCheck.easyCheckKeyupIgnore[a.chkName]||EasyCheck.easyCheckEleIgnore[b.target.id||b.target.name]||EasyCheck.easyCheckEleKeyupIgnore[b.target.id||b.target.name]||(EasyCheck.keyupChk?EasyCheck.chk(this,b,a.chkFunction):"")})},complete:function(a,b){if(EasyCheck.bootstrap3.alert){if(0==$("#alert_"+a).length){var c=$("#"+a).find(":submit:last");c.length>0&&c.before('")}b?$("#alert_"+a).hide():$("#alert_"+a).show()}},restoreAllComplete:function(a){$("#alert_"+a).hide()},clearAllErrorComplete:function(a){$("#alert_"+a).hide()}},$(function(){EasyCheck.initDefMsg()}); -------------------------------------------------------------------------------- /easycheck/plugins/tooltip/easycheck-tooltip.css: -------------------------------------------------------------------------------- 1 | .easycheck_errorInfo { 2 | margin-left: 10px; 3 | color:#FF2A2B; 4 | display: inline; 5 | font-size: 13px; 6 | } 7 | .easycheck_okInfo { 8 | margin-left: 10px; 9 | display: inline; 10 | font-size: 13px; 11 | color:#007C00; 12 | } 13 | [id^='default_'] { 14 | margin-left: 10px; 15 | display: inline; 16 | font-size: 13px; 17 | } 18 | 19 | /* 20 | * Notice: 21 | * Make style to take effect 22 | * Use the !important to specify the style for each of the highest priority 23 | */ 24 | .easycheck_focusInput{ 25 | border: 1px solid #0066FF !important; 26 | } 27 | .easycheck_errorInput { 28 | border: 1px solid #DD080A !important; 29 | } 30 | 31 | /* 32 | * Tooltip Style 33 | * Error tooltip 34 | * OK tooltip-ok 35 | * Default tooltip-def 36 | * 37 | */ 38 | 39 | .tooltip { 40 | position: absolute; 41 | display: none; 42 | z-index: 9900000; 43 | outline: none; 44 | opacity: 1; 45 | filter: alpha(opacity=100); 46 | padding: 5px; 47 | border-width: 1px; 48 | border-style: solid; 49 | border-radius: 5px; 50 | -moz-border-radius: 5px 5px 5px 5px; 51 | -webkit-border-radius: 5px 5px 5px 5px; 52 | border-radius: 5px 5px 5px 5px; 53 | display: inline; 54 | margin-left: 10px; 55 | background-color: #FCD5C4 !important; 56 | 57 | } 58 | .tooltip-content { 59 | font-size: 15px; 60 | } 61 | .tooltip-arrow-outer, 62 | .tooltip-arrow { 63 | position: absolute; 64 | width: 0; 65 | height: 0; 66 | line-height: 0; 67 | font-size: 0; 68 | border-style: solid; 69 | border-width: 6px; 70 | border-color: transparent; 71 | _border-color: tomato; 72 | _filter: chroma(color=tomato); 73 | 74 | } 75 | .tooltip-right .tooltip-arrow-outer { 76 | left: 0; 77 | top: 50%; 78 | margin: -6px 0 0 -13px; 79 | } 80 | .tooltip-right .tooltip-arrow { 81 | left: 0; 82 | top: 50%; 83 | margin: -6px 0 0 -12px; 84 | } 85 | .tooltip-left .tooltip-arrow-outer { 86 | right: 0; 87 | top: 50%; 88 | margin: -6px -13px 0 0; 89 | } 90 | .tooltip-left .tooltip-arrow { 91 | right: 0; 92 | top: 50%; 93 | margin: -6px -12px 0 0; 94 | } 95 | .tooltip-top .tooltip-arrow-outer { 96 | bottom: 0; 97 | left: 50%; 98 | margin: 0 0 -13px -6px; 99 | } 100 | .tooltip-top .tooltip-arrow { 101 | bottom: 0; 102 | left: 50%; 103 | margin: 0 0 -12px -6px; 104 | } 105 | .tooltip-bottom .tooltip-arrow-outer { 106 | top: 0; 107 | left: 50%; 108 | margin: -13px 0 0 -6px; 109 | } 110 | .tooltip-bottom .tooltip-arrow { 111 | top: 0; 112 | left: 50%; 113 | margin: -12px 0 0 -6px; 114 | } 115 | .tooltip { 116 | background-color: #ffffff; 117 | border-color: #FF243B; 118 | color: #FF0000; 119 | } 120 | .tooltip-right .tooltip-arrow-outer { 121 | border-right-color: #FF243B; 122 | } 123 | .tooltip-right .tooltip-arrow { 124 | border-right-color: #FCD5C4; 125 | } 126 | .tooltip-left .tooltip-arrow-outer { 127 | border-left-color: #FF243B; 128 | } 129 | .tooltip-left .tooltip-arrow { 130 | border-left-color: #FCD5C4; 131 | } 132 | .tooltip-top .tooltip-arrow-outer { 133 | border-top-color: #FF243B; 134 | } 135 | .tooltip-top .tooltip-arrow { 136 | border-top-color: #FCD5C4; 137 | } 138 | .tooltip-bottom .tooltip-arrow-outer { 139 | border-bottom-color: #FF243B; 140 | } 141 | .tooltip-bottom .tooltip-arrow { 142 | border-bottom-color: #FCD5C4; 143 | } 144 | 145 | .tooltip-ok { 146 | position: absolute; 147 | display: none; 148 | z-index: 9900000; 149 | outline: none; 150 | opacity: 1; 151 | filter: alpha(opacity=100); 152 | padding: 5px; 153 | border-width: 1px; 154 | border-style: solid; 155 | border-radius: 5px; 156 | -moz-border-radius: 5px 5px 5px 5px; 157 | -webkit-border-radius: 5px 5px 5px 5px; 158 | border-radius: 5px 5px 5px 5px; 159 | display: inline; 160 | margin-left: 10px; 161 | background-color: #fff !important; 162 | 163 | } 164 | .tooltip-content-ok { 165 | font-size: 15px; 166 | } 167 | .tooltip-arrow-outer-ok, 168 | .tooltip-arrow-ok { 169 | position: absolute; 170 | width: 0; 171 | height: 0; 172 | line-height: 0; 173 | font-size: 0; 174 | border-style: solid; 175 | border-width: 6px; 176 | border-color: transparent; 177 | _border-color: tomato; 178 | _filter: chroma(color=tomato); 179 | 180 | } 181 | .tooltip-right-ok .tooltip-arrow-outer-ok { 182 | left: 0; 183 | top: 50%; 184 | margin: -6px 0 0 -13px; 185 | } 186 | .tooltip-right-ok .tooltip-arrow-ok { 187 | left: 0; 188 | top: 50%; 189 | margin: -6px 0 0 -12px; 190 | } 191 | .tooltip-left-ok .tooltip-arrow-outer-ok { 192 | right: 0; 193 | top: 50%; 194 | margin: -6px -13px 0 0; 195 | } 196 | .tooltip-left-ok .tooltip-arrow-ok { 197 | right: 0; 198 | top: 50%; 199 | margin: -6px -12px 0 0; 200 | } 201 | .tooltip-top-ok .tooltip-arrow-outer-ok { 202 | bottom: 0; 203 | left: 50%; 204 | margin: 0 0 -13px -6px; 205 | } 206 | .tooltip-top-ok .tooltip-arrow-ok { 207 | bottom: 0; 208 | left: 50%; 209 | margin: 0 0 -12px -6px; 210 | } 211 | .tooltip-bottom-ok .tooltip-arrow-outer-ok { 212 | top: 0; 213 | left: 50%; 214 | margin: -13px 0 0 -6px; 215 | } 216 | .tooltip-bottom-ok .tooltip-arrow-ok { 217 | top: 0; 218 | left: 50%; 219 | margin: -12px 0 0 -6px; 220 | } 221 | .tooltip-ok { 222 | background-color: #ffffff; 223 | border-color: #11C400; 224 | color: #11C400; 225 | } 226 | .tooltip-right-ok .tooltip-arrow-outer-ok { 227 | border-right-color: #11C400; 228 | } 229 | .tooltip-right-ok .tooltip-arrow-ok { 230 | border-right-color: #fff; 231 | } 232 | .tooltip-left-ok .tooltip-arrow-outer-ok { 233 | border-left-color: #11C400; 234 | } 235 | .tooltip-left-ok .tooltip-arrow-ok { 236 | border-left-color: #fff; 237 | } 238 | .tooltip-top-ok .tooltip-arrow-outer-ok { 239 | border-top-color: #11C400; 240 | } 241 | .tooltip-top-ok .tooltip-arrow-ok { 242 | border-top-color: #fff; 243 | } 244 | .tooltip-bottom-ok .tooltip-arrow-outer-ok { 245 | border-bottom-color: #11C400; 246 | } 247 | .tooltip-bottom-ok .tooltip-arrow-ok { 248 | border-bottom-color: #fff; 249 | } 250 | 251 | 252 | .tooltip-def { 253 | position: absolute; 254 | display: none; 255 | z-index: 9900000; 256 | outline: none; 257 | opacity: 1; 258 | filter: alpha(opacity=100); 259 | padding: 5px; 260 | border-width: 1px; 261 | border-style: solid; 262 | border-radius: 5px; 263 | -moz-border-radius: 5px 5px 5px 5px; 264 | -webkit-border-radius: 5px 5px 5px 5px; 265 | border-radius: 5px 5px 5px 5px; 266 | display: inline; 267 | margin-left: 10px; 268 | background-color: #fff !important; 269 | 270 | } 271 | .tooltip-content-def { 272 | font-size: 15px; 273 | } 274 | .tooltip-arrow-outer-def, 275 | .tooltip-arrow-def { 276 | position: absolute; 277 | width: 0; 278 | height: 0; 279 | line-height: 0; 280 | font-size: 0; 281 | border-style: solid; 282 | border-width: 6px; 283 | border-color: transparent; 284 | _border-color: tomato; 285 | _filter: chroma(color=tomato); 286 | 287 | } 288 | .tooltip-right-def .tooltip-arrow-outer-def { 289 | left: 0; 290 | top: 50%; 291 | margin: -6px 0 0 -13px; 292 | } 293 | .tooltip-right-def .tooltip-arrow-def { 294 | left: 0; 295 | top: 50%; 296 | margin: -6px 0 0 -12px; 297 | } 298 | .tooltip-left-def .tooltip-arrow-outer-def { 299 | right: 0; 300 | top: 50%; 301 | margin: -6px -13px 0 0; 302 | } 303 | .tooltip-left-def .tooltip-arrow-def { 304 | right: 0; 305 | top: 50%; 306 | margin: -6px -12px 0 0; 307 | } 308 | .tooltip-top-def .tooltip-arrow-outer-def { 309 | bottom: 0; 310 | left: 50%; 311 | margin: 0 0 -13px -6px; 312 | } 313 | .tooltip-top-def .tooltip-arrow-def { 314 | bottom: 0; 315 | left: 50%; 316 | margin: 0 0 -12px -6px; 317 | } 318 | .tooltip-bottom-def .tooltip-arrow-outer-def { 319 | top: 0; 320 | left: 50%; 321 | margin: -13px 0 0 -6px; 322 | } 323 | .tooltip-bottom-def .tooltip-arrow-def { 324 | top: 0; 325 | left: 50%; 326 | margin: -12px 0 0 -6px; 327 | } 328 | .tooltip-def { 329 | background-color: #ffffff; 330 | border-color: #868A8D; 331 | color: #878787; 332 | } 333 | .tooltip-right-def .tooltip-arrow-outer-def { 334 | border-right-color: #868A8D; 335 | } 336 | .tooltip-right-def .tooltip-arrow-def { 337 | border-right-color: #fff; 338 | } 339 | .tooltip-left-def .tooltip-arrow-outer-def { 340 | border-left-color: #868A8D; 341 | } 342 | .tooltip-left-def .tooltip-arrow-def { 343 | border-left-color: #fff; 344 | } 345 | .tooltip-top-def .tooltip-arrow-outer-def { 346 | border-top-color: #868A8D; 347 | } 348 | .tooltip-top-def .tooltip-arrow-def { 349 | border-top-color: #fff; 350 | } 351 | .tooltip-bottom-def .tooltip-arrow-outer-def { 352 | border-bottom-color: #868A8D; 353 | } 354 | .tooltip-bottom-def .tooltip-arrow-def { 355 | border-bottom-color: #fff; 356 | } 357 | 358 | -------------------------------------------------------------------------------- /demo/zh_CN/bootstrap3_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | EasyCheck Div Validation 9 | 10 | 11 | 12 | 13 | 16 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 |
122 |
EasyCheck Bootstrap3 demo2 - 中文
123 |
124 | Demo home 125 |
126 | 127 |
128 | 129 |
130 | 131 | 132 |
133 | 134 |
135 |
136 | 137 |
138 |
139 | 140 | 验证码 141 | 看不清,换一张 142 | 143 |
144 | 145 |
146 | 记住我 147 |
148 | 149 |
150 | 151 | 152 |
153 |
154 | 155 |
156 | 157 | 158 |
159 | 160 |
161 | 162 |
163 |
164 | 165 |
166 | 167 |
168 | 169 |
170 |
171 | 172 |
173 | 174 |
175 | 176 |
177 | 验证码 178 | 看不清,换一张 179 | 180 |
181 | 182 |
183 | 184 | 185 |
186 | 187 |
188 |
189 | 190 |
191 | 192 |
193 | 194 | 195 |
196 | 197 | 198 |
199 |
200 | 201 | 202 |
203 |
204 | 205 | 206 |
207 |
208 | 211 |
212 |
213 | 214 | 215 |
216 |
217 | 218 |
219 |
220 | 237 | 238 | 241 | 242 | 243 | -------------------------------------------------------------------------------- /demo/en/bootstrap3_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | EasyCheck Div Validation 9 | 10 | 11 | 12 | 13 | 16 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 |
121 |
EasyCheck Bootstrap3 demo2 - English
122 |
Demo home
123 | 124 |
125 |
126 | 127 | 128 |
129 | 130 |
131 |
132 | 133 |
134 |
135 | 136 | captcha 137 | refresh 138 | 139 |
140 | 141 | 142 |
143 | Remember me 144 |
145 | 146 |
147 | 148 | 149 |
150 |
151 | 152 | 153 | 154 | 155 |
156 | 157 | 158 |
159 | 160 |
161 | 162 |
163 |
164 | 165 |
166 | 167 |
168 | 169 |
170 |
171 | 172 | 180 | 181 |
182 | 183 | 184 |
185 | 186 |
187 |
188 | 189 | 190 |
191 | 192 |
193 | 194 | 195 |
196 | 197 | 198 |
199 |
200 | 201 | 202 |
203 | 212 |
213 | 214 | 215 |
216 |
217 |
218 |
219 | 236 | 237 | 240 | 241 | 242 | -------------------------------------------------------------------------------- /easycheck/easy.easycheck.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery EasyCheck Plugin 3 | * 4 | * Version 5.3.0 5 | * 6 | * http://easyproject.cn 7 | * https://github.com/ushelp/EasyCheck 8 | * 9 | * Author: Ray [ inthinkcolor@gmail.com ] 10 | * Since: 2011 11 | * 12 | * Dependencies: jQuery 13 | * 14 | */ 15 | !function(a){var b=function(b,c){var d=s.getMatches(b.chkName),e=new Array;return $(c.eleArea+d).each(function(d,f){var h,i,g=$(f).attr("id")||$(f).attr("name");c.errorEleArray[g]?c.chkFlag=!1:(h=b.chkFunction(f),a.Promise&&h instanceof Promise?(i=h.then(function(a){a||(c.errorEleArray[g]="E",c.chkFlag=!1)},function(){c.errorEleArray[g]="E",c.chkFlag=!1}),e.push(i)):h||(c.errorEleArray[g]="E",c.chkFlag=!1))}),e},c=function(b,c){return s.chkDef.addChkMethod("[vc]",b,c,function(b){var d,e,c=$(b).val();return a.Promise?d=new Promise(function(a,d){$.ajax({url:$(b).attr("vc"),data:$(b).attr("name")+"="+c+"&n="+new Date,type:"POST",success:function(b){var d,c=b;c?c+="":c="false",d=c.replace(/\r\n/g,""),"true"!=d&&"false"!=d&&console.error("Captcha validation result must is 'true' or 'false', but your is: ",b),a("true"==d)},error:function(){d(!1)},xhrFields:{withCredentials:s.withCredentials}})}):(e=!1,$.ajaxSetup({async:!1}),$.post($(b).attr("vc"),$(b).attr("name")+"="+c+"&n="+new Date,function(a){e=a.replace(/\r\n/g,"")},"text"),"true"==e)},s.msg["vc"])},d=function(a,b){return s.chkDef.addChkMethod("[reg]",a,b,function(a){var b=$(a).val(),c=new RegExp("^(?:"+$(a).attr("reg")+")$");return!(""!=$.trim(b)&&!c.test(b))},s.msg["regexp"])},e=function(a,b){return s.chkDef.addChkMethod("[extension]",a,b,function(a){var b=$(a).attr("extension"),c=$(a).val(),d=""!=b?b.replace(/,/g,"|"):"png|jpe?g|gif";return!(""!=$.trim(c)&&!c.match(new RegExp(".("+d+")$","i")))},s.formatMsg(s.msg["extension"],$(a).attr("extension")))},f=function(a,b){return s.chkDef.addChkMethod(".required",a,b,function(a){var b=$(a).val();return""!=$.trim(b)},s.msg["required"])},g=function(a,b){return s.chkDef.addChkMethod(".email",a,b,function(a){var b=$(a).val();return!(""!=$.trim(b)&&!s.validator.email.test(b))},s.msg["email"])},h=function(a,b){return s.chkDef.addChkMethod(".url",a,b,function(a){var b=$(a).val();return!(""!=$.trim(b)&&!s.validator.url.test(b))},s.msg["url"])},i=function(a,b){return s.chkDef.addChkMethod(".number",a,b,function(a){var b=$(a).val();return!(""!=$.trim(b)&&!s.validator.number.test(b))},s.msg["number"])},j=function(a,b){return s.chkDef.addChkMethod(".integer",a,b,function(a){var b=$(a).val();return!(""!=$.trim(b)&&!s.validator.integer.test(b))},s.msg["integer"])},k=function(a,b){return s.chkDef.addChkMethod("[equalto]",a,b,function(a){var b=$(a).val();return b==$("[id='"+$(a).attr("equalto")+"']").val()},s.msg["equalto"])},l=function(a,b){return s.chkDef.addChkMethod("[equallength]",a,b,function(a){var b=$(a).val();return!(b.length!=$(a).attr("equallength"))},s.formatMsg(s.msg["equallength"],$(a).attr("equallength")))},m=function(a,b){return s.chkDef.addChkMethod("[minlength][maxlength]",a,b,function(a){var b=$(a).val();return!($.trim(b).length<$(a).attr("minlength")||$.trim(b).length>$(a).attr("maxlength"))},s.formatMsg(s.msg["lengthrange"],$(a).attr("minlength"),$(a).attr("maxlength")))},n=function(a,b){return s.chkDef.addChkMethod("[minlength]",a,b,function(a){var b=$(a).val();return!($.trim(b).length<$(a).attr("minlength"))},s.formatMsg(s.msg["minlength"],$(a).attr("minlength")))},o=function(a,b){return s.chkDef.addChkMethod("[maxlength]",a,b,function(a){var b=$(a).val();return!($.trim(b).length>$(a).attr("maxlength"))},s.formatMsg(s.msg["maxlength"],$(a).attr("maxlength")))},p=function(a,b){return s.chkDef.addChkMethod("[min][max]",a,b,function(a){var b=$(a).val();return!(parseFloat($.trim(b))parseFloat($(a).attr("max"))||isNaN(b))},s.formatMsg(s.msg["numberrange"],$(a).attr("min"),$(a).attr("max")))},q=function(a,b){return s.chkDef.addChkMethod("[min]",a,b,function(a){var b=$(a).val();return!(parseFloat($.trim(b))parseFloat($(a).attr("max"))||isNaN(b))},s.formatMsg(s.msg["max"],$(a).attr("max")))},s={chkList:"",msg:{},msgs:{},msgMark:"{0}",errorMsg:"{0}",correctMsg:"{0}",defMsg:"{0}",errorMsgs:{},correctMsgs:{},defMsgs:{},cacheCorrectMsg:{},cacheDefMsg:{},cacheErrorMsg:{},resetOnFocus:!0,withCredentials:!0,validator:{email:/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,url:/^(https?|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,number:/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/,integer:/^-?^\d+$/,English:/^[A-Za-z]+$/,Chinese:/^[\u0391-\uFFE5]+$/,Zip:/^[1-9]\d{5}$/,Currency:/^\d+(\.\d+)?$/,Require:/.+/,ipv4:/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i,ipv6:/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/},easyCheckIgnore:{},easyCheckBlurIgnore:{},easyCheckKeyupIgnore:{},easyCheckEleIgnore:{},easyCheckEleBlurIgnore:{},easyCheckEleKeyupIgnore:{},easyCheckSubmitDisable:!0,ecss:"yes",formEcss:{},focusCss:"easycheck_focusInput",errorCss:"easycheck_errorInput",formFocusCss:{},formErrorCss:{},txtClass:{},loadChk:!0,blurChk:!0,keyupChk:!0,formatMsg:function(){var b,a=[];for(b=1;b0&&s.chkDef.showDef(d,b,c)}))},initChk:function(a,b){s.chkDef.initChk(a,b)},addChk:function(a,b,c){var d=function(d,e){return s.chkDef.addChkMethod(a,d,e,b,"string"==typeof c?c:c(d))},e=new s.ChkRule(a,d);s.chkList.push(e),s.initChk(e)},ChkRule:function(a,b){this.chkName=a,this.chkFunction=b},checkForm:function(c){function k(a,b){return a.chkFlag?(s["easyCheckSubmitDisable"]&&$(":submit",$(a.eleArea)).prop("disabled",!0),s.chkDef.complete&&s.chkDef.complete(b,a.chkFlag)):(s.chkDef.complete&&s.chkDef.complete(b,a.chkFlag),$(":submit",$(a.eleArea)).prop("disabled",!1)),a.chkFlag}var d,e,f,g,h,i,j;for("string"==typeof c&&(c=$(c)),d=$(c).attr("id"),e={eleArea:"[id='"+d+"'] ",chkFlag:!0,errorEleArray:new Array},f=new Array,g=0;g0?j=Promise.all(f).then(function(){return k(e,d),e.chkFlag}):k(e,d)},initEasyCheck:function(b){function d(){var a,c;for(a=0;a 2 | 3 | 4 | 5 | 6 | 7 | 8 | EasyCheck Div Validation 9 | 10 | 11 | 12 | 13 | 16 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 |
119 |
EasyCheck Bootstrap3 demo - English
120 | 121 | 122 |
123 |
124 |
125 | 126 | Bootstrap3 Demo (Click here, clear all error messages) 127 | 128 | 129 |
130 | 131 |
132 | 133 |
134 |
135 | 136 |
137 | 138 |
139 | 140 |
141 |
142 | 143 |
144 | 145 |
146 | 147 |
148 |
149 | 150 |
151 | 152 |
153 | 154 |
155 |
156 | 157 |
158 | 159 |
160 | 161 |
162 |
163 | 164 |
165 | 166 |
167 | 168 |
169 |
170 | 171 |
172 | 173 |
174 | 175 |
176 |
177 | 178 |
179 | 180 |
181 | 182 |
183 |
184 | 185 |
186 | 187 |
188 | 189 |
190 | CAPTCHA 191 |
192 | 193 | 194 | 195 |
196 | 197 |
198 | 199 | 200 |
201 |
202 |
203 |
204 | 205 | 206 | 207 | 208 |
209 |
210 | 211 | Bootstrap3 Demo2 (Click here, clear all error messages) 212 | 213 | 214 |
215 | 216 |
217 | 218 | 219 | required&regexp 220 |
221 |
222 | 223 |
224 | 225 |
226 | 227 | 228 | required&email 229 | 230 | 231 |
232 |
233 | 234 |
235 | 236 |
237 | 238 | required&(minlength 6 - maxlength 12) 239 |
240 |
241 | 242 |
243 | 244 |
245 | 246 | required&(equal with pasword) 247 |
248 |
249 | 250 |
251 | 252 |
253 | 254 | must be a site 255 |
256 |
257 | 258 |
259 | 260 |
261 |
262 | 263 |
264 |
265 | integer&(min 18 - max 45) 266 |
267 |
268 |
269 | 270 |
271 | 272 |
273 |
274 | 275 |
276 |
277 | can include decimal 278 |
279 |
280 |
281 | 282 |
283 | 284 |
285 | 286 | suffix must be html, htm 287 |
288 |
289 | 290 | 301 | 302 | 303 | 304 |
305 | 306 |
307 | 308 | 309 |
310 |
311 | 312 |
313 |
314 | 315 |
316 |
317 | 334 | 335 | 338 | 339 | 340 | -------------------------------------------------------------------------------- /demo/zh_CN/bootstrap3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | EasyCheck Div Validation 9 | 10 | 11 | 12 | 13 | 16 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 |
118 |
EasyCheck Bootstrap3 demo - 中文
119 |
120 | Demo home 121 |
122 | 123 |
124 |
125 |
126 | 127 | Bootstrap3 Demo (单击此处,清除所有错误消息) 128 | 129 | 130 |
131 | 132 |
133 | 134 |
135 |
136 | 137 |
138 | 139 |
140 | 141 |
142 |
143 | 144 |
145 | 146 |
147 | 148 |
149 |
150 | 151 |
152 | 153 |
154 | 155 |
156 |
157 | 158 |
159 | 160 |
161 | 162 |
163 |
164 | 165 |
166 | 167 |
168 | 169 |
170 |
171 | 172 |
173 | 174 |
175 | 176 |
177 |
178 | 179 |
180 | 181 |
182 | 183 |
184 |
185 | 186 |
187 | 188 |
189 | 190 |
191 | 验证码 192 |
193 | 194 | 195 | 196 |
197 | 198 |
199 | 200 | 201 |
202 |
203 |
204 |
205 | 206 |
207 |
208 | 209 | Bootstrap3 Demo2 (单击此处,清除所有消息) 210 | 211 | 212 |
213 | 214 |
215 | 216 | 217 | required&regexp 218 |
219 |
220 | 221 |
222 | 223 |
224 | 225 | 226 | required&email 227 | 228 | 229 |
230 |
231 | 232 |
233 | 234 |
235 | 236 | required&(minlength 6 - maxlength 12) 237 |
238 |
239 | 240 |
241 | 242 |
243 | 244 | required&(equal with pasword) 245 |
246 |
247 | 248 |
249 | 250 |
251 | 252 | must be a site 253 |
254 |
255 | 256 |
257 | 258 |
259 |
260 | 261 |
262 |
263 | integer&(min 18 - max 45) 264 |
265 |
266 |
267 | 268 |
269 | 270 |
271 |
272 | 273 |
274 |
275 | can include decimal 276 |
277 |
278 |
279 | 280 |
281 | 282 |
283 | 284 | suffix must be html, htm 285 |
286 |
287 | 288 | 299 | 300 | 301 | 302 |
303 | 304 |
305 | 306 | 307 |
308 |
309 | 310 |
311 |
312 | 313 |
314 | 315 | 316 | 317 |
318 | 335 | 336 | 339 | 340 | 341 | -------------------------------------------------------------------------------- /demo/zh_CN/tooltip.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | EasyCheck Tooltip Validation 9 | 10 | 11 | 12 | 13 | 14 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 189 | 190 | 191 | 192 | 193 | 194 | 195 |
196 |
EasyCheck Div demo - 中文
197 | Demo home 198 | 199 |
200 | 基本功能(单击此处,清除所有错误消息) 201 |
202 |
203 | 204 | 205 | 208 | 209 | 213 | 214 | 215 | 216 | 220 | 221 | 222 | 223 | 226 | 227 | 228 | 229 | 232 | 233 | 234 | 235 | 238 | 239 | 240 | 241 | 244 | 245 | 246 | 247 | 250 | 251 | 252 | 253 | 256 | 257 | 264 | 265 | 269 | 270 |
206 | 用户名 207 | 210 | 211 | 212 |
邮箱 217 | 218 | 219 |
密码 224 | 225 |
确认密码 230 | 231 |
网站 236 | 237 |
年龄 242 | 243 |
薪资 248 | 249 |
文件 254 | 255 |
266 | 267 | 268 |
271 |
272 | 273 |
274 | 带默认提示和成功提示(单击此处,清除所有错误消息) 275 |
276 | 277 |
278 | 279 | 280 | 283 | 284 | 290 | 291 | 292 | 293 | 299 | 300 | 301 | 302 | 308 | 309 | 310 | 311 | 317 | 318 | 319 | 320 | 326 | 327 | 328 | 329 | 335 | 336 | 337 | 338 | 343 | 344 | 345 | 346 | 351 | 352 | 353 | 354 | 359 | 360 | 361 | 365 | 366 |
281 | 用户名 282 | 285 | 286 | 287 | 288 | 289 |
邮箱 294 | 295 | 296 | 297 | 298 |
密码 303 | 304 | 305 | 306 | 307 |
确认密码 312 | 313 | 314 | 315 | 316 |
网站 321 | 322 | 323 | 324 | 325 |
年龄 330 | 331 | 332 | 333 | 334 |
薪资 339 | 340 | 341 | 342 |
文件 347 | 348 | 349 | 350 |
验证码 355 | 356 | 验证码 357 | 358 |
362 | 363 | 364 |
367 |
368 | 369 |
370 | 371 | 388 | 389 | 392 | 393 | 394 | -------------------------------------------------------------------------------- /demo/zh_CN/div.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | EasyCheck Div Validation 9 | 10 | 11 | 12 | 13 | 16 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 192 | 193 | 194 | 195 | 196 | 197 | 198 |
199 |
EasyCheck Div demo - 中文
200 | Demo home 201 | 202 |
203 | 基本功能(单击此处,清除所有错误消息) 204 |
205 |
206 | 207 | 208 | 211 | 212 | 216 | 217 | 218 | 219 | 223 | 224 | 225 | 226 | 229 | 230 | 231 | 232 | 235 | 236 | 237 | 238 | 241 | 242 | 243 | 244 | 247 | 248 | 249 | 250 | 253 | 254 | 255 | 256 | 259 | 260 | 267 | 268 | 272 | 273 |
209 | 用户名 210 | 213 | 214 | 215 |
邮箱 220 | 221 | 222 |
密码 227 | 228 |
确认密码 233 | 234 |
网站 239 | 240 |
年龄 245 | 246 |
薪资 251 | 252 |
文件 257 | 258 |
269 | 270 | 271 |
274 |
275 | 276 |
277 | 带默认提示和成功提示(单击此处,清除所有错误消息) 278 |
279 | 280 |
281 | 282 | 283 | 286 | 287 | 293 | 294 | 295 | 296 | 302 | 303 | 304 | 305 | 311 | 312 | 313 | 314 | 320 | 321 | 322 | 323 | 329 | 330 | 331 | 332 | 338 | 339 | 340 | 341 | 346 | 347 | 348 | 349 | 354 | 355 | 356 | 357 | 362 | 363 | 364 | 368 | 369 |
284 | 用户名 285 | 288 | 289 | 290 | 291 | 292 |
邮箱 297 | 298 | 299 | 300 | 301 |
密码 306 | 307 | 308 | 309 | 310 |
确认密码 315 | 316 | 317 | 318 | 319 |
网站 324 | 325 | 326 | 327 | 328 |
年龄 333 | 334 | 335 | 336 | 337 |
薪资 342 | 343 | 344 | 345 |
文件 350 | 351 | 352 | 353 |
验证码 358 | 359 | 验证码 360 | 361 |
365 | 366 | 367 |
370 |
371 | 372 |
373 | 374 | 391 | 392 | 395 | 396 | 397 | -------------------------------------------------------------------------------- /demo/en/tooltip.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | EasyCheck Tooltip Validation 9 | 10 | 11 | 12 | 13 | 14 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 189 | 190 | 191 | 192 | 193 | 194 | 195 |
196 |
EasyCheck Tooltip demo - English
197 | Demo home 198 |
Basic (Click here, clear all error msg))
199 | 200 |
201 | 202 | 203 | 205 | 206 | 208 | 209 | 210 | 212 | 214 | 215 | 216 | 219 | 221 | 222 | 223 | 226 | 227 | 228 | 229 | 231 | 232 | 233 | 234 | 236 | 238 | 239 | 240 | 242 | 243 | 244 | 245 | 247 | 248 | 249 | 250 | 252 | 257 | 258 | 259 | 263 | 264 |
Username 207 |
email 211 | 213 |
Password 218 |
Confirm Password 225 |
Website 230 |
Age 235 |
Salary 241 |
File 246 |
verification code 251 | verification code 255 | 256 |
260 | 261 | 262 |
265 |
266 | 267 | 268 | 269 |
270 | EasyChek Tooltip With the default prompt and successful tips (Click here, clear all error msg) 271 |
272 | 273 |
274 | 275 | 276 | 277 | 278 | 284 | 285 | 286 | 287 | 293 | 294 | 295 | 296 | 303 | 304 | 305 | 306 | 312 | 313 | 314 | 315 | 321 | 322 | 323 | 324 | 331 | 332 | 333 | 334 | 339 | 340 | 341 | 342 | 347 | 348 | 355 | 356 | 360 | 361 |
Username 279 | 281 | 282 |
Email 288 | 289 | 292 |
Password 298 | 299 | 302 |
Confirm password 307 | 308 | 311 |
Website 316 | 317 | 320 |
Age 326 | 327 | 330 |
Salary 335 | 338 |
File 343 | 344 |
357 | 358 | 359 |
362 |
363 |
364 | 365 | 382 | 383 | 386 | 387 | 388 | -------------------------------------------------------------------------------- /demo/en/div.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | EasyCheck Div Validation 9 | 10 | 11 | 12 | 13 | 16 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 192 | 193 | 194 | 195 | 196 | 197 | 198 |
199 |
EasyCheck Div demo - English
200 | Demo home 201 |
202 | Basic (Click here, clear all error msg) 203 |
204 | 205 |
206 | 207 | 208 | 211 | 212 | 216 | 217 | 218 | 219 | 223 | 224 | 225 | 227 | 230 | 231 | 232 | 233 | 236 | 237 | 238 | 239 | 242 | 243 | 244 | 245 | 248 | 249 | 250 | 251 | 254 | 255 | 256 | 257 | 260 | 261 | 262 | 263 | 267 | 268 | 269 | 274 | 275 |
209 | Username 210 | 213 | 214 | 215 |
email 220 | 221 | 222 |
226 | Password 228 | 229 |
Confirm Password 234 | 235 |
Website 240 | 241 |
Age 246 | 247 |
Salary 252 | 253 |
File 258 | 259 |
verification code 264 | 265 | verification code 266 |
270 | 271 | 272 | 273 |
276 |
277 | 278 |
279 | with the default prompt and successful tips (Click here, clear all error msg) 280 |
281 | 282 |
283 | 284 | 285 | 288 | 289 | 296 | 297 | 298 | 299 | 305 | 306 | 307 | 308 | 314 | 315 | 316 | 317 | 323 | 324 | 325 | 326 | 332 | 333 | 334 | 335 | 341 | 342 | 343 | 344 | 349 | 350 | 351 | 352 | 357 | 358 | 366 | 367 | 372 | 373 |
286 | Username 287 | 290 | 291 | 292 | 293 | 294 | 295 |
Email 300 | 301 | 302 | 303 | 304 |
Password 309 | 310 | 311 | 312 | 313 |
Confirm password 318 | 319 | 320 | 321 | 322 |
Website 327 | 328 | 329 | 330 | 331 |
Age 336 | 337 | Must be an integer between 18-45 338 | 339 | 340 |
Salary 345 | 346 | 347 | 348 |
File 353 | 354 | Suffix gif,jpg,jpeg,png 355 | 356 |
368 | 369 | 370 | 371 |
374 |
375 |
376 | 377 | 394 | 395 | 398 | 399 | 400 | -------------------------------------------------------------------------------- /easycheck/plugins/div/easy.easycheck-div-all.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery EasyCheck DIV plugin all in one file 3 | * 4 | * Version 5.3.0 5 | * 6 | * http://easyproject.cn 7 | * https://github.com/ushelp/EasyCheck 8 | * 9 | * Author: Ray [ inthinkcolor@gmail.com ] 10 | * Since: 2011 11 | * 12 | * Dependencies: EasyCheck 13 | * 14 | */ 15 | !function(a){var b=function(b,c){var d=s.getMatches(b.chkName),e=new Array;return $(c.eleArea+d).each(function(d,f){var h,i,g=$(f).attr("id")||$(f).attr("name");c.errorEleArray[g]?c.chkFlag=!1:(h=b.chkFunction(f),a.Promise&&h instanceof Promise?(i=h.then(function(a){a||(c.errorEleArray[g]="E",c.chkFlag=!1)},function(){c.errorEleArray[g]="E",c.chkFlag=!1}),e.push(i)):h||(c.errorEleArray[g]="E",c.chkFlag=!1))}),e},c=function(b,c){return s.chkDef.addChkMethod("[vc]",b,c,function(b){var d,e,c=$(b).val();return a.Promise?d=new Promise(function(a,d){$.ajax({url:$(b).attr("vc"),data:$(b).attr("name")+"="+c+"&n="+new Date,type:"POST",success:function(b){var d,c=b;c?c+="":c="false",d=c.replace(/\r\n/g,""),"true"!=d&&"false"!=d&&console.error("Captcha validation result must is 'true' or 'false', but your is: ",b),a("true"==d)},error:function(){d(!1)},xhrFields:{withCredentials:s.withCredentials}})}):(e=!1,$.ajaxSetup({async:!1}),$.post($(b).attr("vc"),$(b).attr("name")+"="+c+"&n="+new Date,function(a){e=a.replace(/\r\n/g,"")},"text"),"true"==e)},s.msg["vc"])},d=function(a,b){return s.chkDef.addChkMethod("[reg]",a,b,function(a){var b=$(a).val(),c=new RegExp("^(?:"+$(a).attr("reg")+")$");return!(""!=$.trim(b)&&!c.test(b))},s.msg["regexp"])},e=function(a,b){return s.chkDef.addChkMethod("[extension]",a,b,function(a){var b=$(a).attr("extension"),c=$(a).val(),d=""!=b?b.replace(/,/g,"|"):"png|jpe?g|gif";return!(""!=$.trim(c)&&!c.match(new RegExp(".("+d+")$","i")))},s.formatMsg(s.msg["extension"],$(a).attr("extension")))},f=function(a,b){return s.chkDef.addChkMethod(".required",a,b,function(a){var b=$(a).val();return""!=$.trim(b)},s.msg["required"])},g=function(a,b){return s.chkDef.addChkMethod(".email",a,b,function(a){var b=$(a).val();return!(""!=$.trim(b)&&!s.validator.email.test(b))},s.msg["email"])},h=function(a,b){return s.chkDef.addChkMethod(".url",a,b,function(a){var b=$(a).val();return!(""!=$.trim(b)&&!s.validator.url.test(b))},s.msg["url"])},i=function(a,b){return s.chkDef.addChkMethod(".number",a,b,function(a){var b=$(a).val();return!(""!=$.trim(b)&&!s.validator.number.test(b))},s.msg["number"])},j=function(a,b){return s.chkDef.addChkMethod(".integer",a,b,function(a){var b=$(a).val();return!(""!=$.trim(b)&&!s.validator.integer.test(b))},s.msg["integer"])},k=function(a,b){return s.chkDef.addChkMethod("[equalto]",a,b,function(a){var b=$(a).val();return b==$("[id='"+$(a).attr("equalto")+"']").val()},s.msg["equalto"])},l=function(a,b){return s.chkDef.addChkMethod("[equallength]",a,b,function(a){var b=$(a).val();return!(b.length!=$(a).attr("equallength"))},s.formatMsg(s.msg["equallength"],$(a).attr("equallength")))},m=function(a,b){return s.chkDef.addChkMethod("[minlength][maxlength]",a,b,function(a){var b=$(a).val();return!($.trim(b).length<$(a).attr("minlength")||$.trim(b).length>$(a).attr("maxlength"))},s.formatMsg(s.msg["lengthrange"],$(a).attr("minlength"),$(a).attr("maxlength")))},n=function(a,b){return s.chkDef.addChkMethod("[minlength]",a,b,function(a){var b=$(a).val();return!($.trim(b).length<$(a).attr("minlength"))},s.formatMsg(s.msg["minlength"],$(a).attr("minlength")))},o=function(a,b){return s.chkDef.addChkMethod("[maxlength]",a,b,function(a){var b=$(a).val();return!($.trim(b).length>$(a).attr("maxlength"))},s.formatMsg(s.msg["maxlength"],$(a).attr("maxlength")))},p=function(a,b){return s.chkDef.addChkMethod("[min][max]",a,b,function(a){var b=$(a).val();return!(parseFloat($.trim(b))parseFloat($(a).attr("max"))||isNaN(b))},s.formatMsg(s.msg["numberrange"],$(a).attr("min"),$(a).attr("max")))},q=function(a,b){return s.chkDef.addChkMethod("[min]",a,b,function(a){var b=$(a).val();return!(parseFloat($.trim(b))parseFloat($(a).attr("max"))||isNaN(b))},s.formatMsg(s.msg["max"],$(a).attr("max")))},s={chkList:"",msg:{},msgs:{},msgMark:"{0}",errorMsg:"{0}",correctMsg:"{0}",defMsg:"{0}",errorMsgs:{},correctMsgs:{},defMsgs:{},cacheCorrectMsg:{},cacheDefMsg:{},cacheErrorMsg:{},resetOnFocus:!0,withCredentials:!0,validator:{email:/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,url:/^(https?|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,number:/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/,integer:/^-?^\d+$/,English:/^[A-Za-z]+$/,Chinese:/^[\u0391-\uFFE5]+$/,Zip:/^[1-9]\d{5}$/,Currency:/^\d+(\.\d+)?$/,Require:/.+/,ipv4:/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i,ipv6:/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/},easyCheckIgnore:{},easyCheckBlurIgnore:{},easyCheckKeyupIgnore:{},easyCheckEleIgnore:{},easyCheckEleBlurIgnore:{},easyCheckEleKeyupIgnore:{},easyCheckSubmitDisable:!0,ecss:"yes",formEcss:{},focusCss:"easycheck_focusInput",errorCss:"easycheck_errorInput",formFocusCss:{},formErrorCss:{},txtClass:{},loadChk:!0,blurChk:!0,keyupChk:!0,formatMsg:function(){var b,a=[];for(b=1;b0&&s.chkDef.showDef(d,b,c)}))},initChk:function(a,b){s.chkDef.initChk(a,b)},addChk:function(a,b,c){var d=function(d,e){return s.chkDef.addChkMethod(a,d,e,b,"string"==typeof c?c:c(d))},e=new s.ChkRule(a,d);s.chkList.push(e),s.initChk(e)},ChkRule:function(a,b){this.chkName=a,this.chkFunction=b},checkForm:function(c){function k(a,b){return a.chkFlag?(s["easyCheckSubmitDisable"]&&$(":submit",$(a.eleArea)).prop("disabled",!0),s.chkDef.complete&&s.chkDef.complete(b,a.chkFlag)):(s.chkDef.complete&&s.chkDef.complete(b,a.chkFlag),$(":submit",$(a.eleArea)).prop("disabled",!1)),a.chkFlag}var d,e,f,g,h,i,j;for("string"==typeof c&&(c=$(c)),d=$(c).attr("id"),e={eleArea:"[id='"+d+"'] ",chkFlag:!0,errorEleArray:new Array},f=new Array,g=0;g0?j=Promise.all(f).then(function(){return k(e,d),e.chkFlag}):k(e,d)},initEasyCheck:function(b){function d(){var a,c;for(a=0;a0?$(b+"[id='"+a+"']"):$(b+"[name='"+a+"']"),d=$("form").has(c).attr("id"),"no"!=s.ecss&&"no"!=s.formEcss[d]&&(c.attr("ecss")&&"yes"!=c.attr("ecss")||(c.removeClass(s.errorCss),d&&s.formErrorCss[d]&&c.removeClass(s.formErrorCss[d]),e=c.attr("id")||c.attr("name"),f=d+"_"+e,c.addClass(s.txtClass[f+"_class"]))),$(b+"[id^='error_']").hide()}),a.restore&&($(b+"[id^='correct_']").each(function(){$(this).hide()}),$(b+"[id^='default_']").each(function(){var c,d,a=$("form").has(this),b=$(this);a?(c=a.attr("id"),d=b.attr("id").substr("default_".length),s.chkDef.showDef(b,c,d)):s.chkDef.showDef(b)}))},showDef:function(a,b,c){if(b){var d=a.html();void 0!=s.cacheDefMsg[b+"_"+c]?d=s.cacheDefMsg[b+"_"+c]:(a.attr("info")&&(d=a.attr("info")),s.cacheDefMsg[b+"_"+c]=d),s.defMsgs[c]?a.html(s.defMsgs[c].replace(s.msgMark,d)):s.defMsgs[b]?a.html(s.defMsgs[b].replace(s.msgMark,d)):a.html(s.defMsg.replace(s.msgMark,d))}a.show()},addChkMethod:function(b,c,d,e,f){function j(a){var h,i,j,k,l,e=$(c).attr("id")||$(c).attr("name"),g=$("[id='default_"+e+"']");return a?(s.clearError(c),h=$("[id='default_"+e+"']"),h&&h.hide(),i=$("[id='correct_"+e+"']"),b+" == "+"[id='correct_"+e+"']"+"====="+i.length,j=$("form").has(c).attr("id"),i.length>0&&(i.addClass("easycheck_okInfo"),k=i.html(),void 0!=s.cacheCorrectMsg[j+"_"+e]?k=s.cacheCorrectMsg[j+"_"+e]:(i.attr("info")&&(k=i.attr("info")),s.cacheCorrectMsg[j+"_"+e]=k),s.correctMsgs[e]?i.html(s.correctMsgs[e].replace(s.msgMark,k)):s.correctMsgs[j]?i.html(s.correctMsgs[j].replace(s.msgMark,k)):i.html(s.correctMsg.replace(s.msgMark,k)),i.show()),d&&"keyup"==d.type&&($(c).removeClass(s.errorCss),l=$("form").has(c),l.length>0&&s.formErrorCss[l.attr("id")]&&$(c).removeClass(s.formErrorCss[l.attr("id")]),l.length>0&&s.formFocusCss[l.attr("id")]?$(c).addClass(s.formFocusCss[l.attr("id")]):$(c).addClass(s.focusCss)),!0):(g=$("[id='default_"+e+"']"),g&&g.hide(),s.msgs[e]&&s.msgs[e][b]&&(f="string"==typeof s.msgs[e][b]?s.msgs[e][b]:s.msgs[e][b]($(c))),s.showError(c,f),d&&d.stopImmediatePropagation(),!1)}var i,g=$(c).attr("id")||$(c).attr("name"),h=$("[id='default_"+g+"']");return h&&h.hide(),i=e(c),a.Promise&&i instanceof Promise?i.then(function(a){return j(a)},function(){return j(!1)}):j(i)},showError:function(a,b){var c,d,e,f,g,h;"string"==typeof a&&(a=$("#"+a)[0]||$("[name='"+a+"']")[0]),a=$(a),c=a.attr("id")||a.attr("name"),$("[id='correct_"+c+"']").hide(),$("[id='default_"+c+"']").hide(),d=$("[id='error_"+c+"']"),0==d.length&&(a.after("
"),d=$("[id='error_"+c+"']")),d.removeClass(),d.addClass("easycheck_errorInfo"),e=$("form").has(a).attr("id"),a.removeClass(s.focusCss),e&&s.formFocusCss[e]&&a.removeClass(s.formFocusCss[e]),"no"!=s.ecss&&"no"!=s.formEcss[e]&&(a.attr("ecss")&&"yes"!=a.attr("ecss")||(e&&s.formErrorCss[e]?a.addClass(s.formErrorCss[e]):a.addClass(s.errorCss))),f="",g=d.attr("prefix"),g?f=g+b:(g="",f=b),h=d.html(),void 0!=s.cacheErrorMsg[e+"_"+c]?h=s.cacheErrorMsg[e+"_"+c]:(d.attr("info")&&(h=d.attr("info")),s.cacheErrorMsg[e+"_"+c]=h),h&&(f=g+h),s.errorMsgs[c]?d.html(s.errorMsgs[c].replace(s.msgMark,f)):s.errorMsgs[e]?d.html(s.errorMsgs[e].replace(s.msgMark,f)):d.html(s.errorMsg.replace(s.msgMark,f)),d.show()},clearError:function(a,b){var c,d,e,f,g,h;"string"==typeof a&&(a=$("#"+a)[0]||$("[name='"+a+"']")[0]),a=$(a),c=a.attr("id")||a.attr("name"),d=$("[id='error_"+c+"']"),e=$("form").has(a).attr("id"),d.length>0&&("no"!=s.ecss&&"no"!=s.formEcss[e]&&(a.attr("ecss")&&"yes"!=a.attr("ecss")||(a.removeClass(s.errorCss),e&&s.formErrorCss[e]&&a.removeClass(s.formErrorCss[e]),f=a.attr("id")||a.attr("name"),g=e+"_"+f,a.addClass(s.txtClass[g+"_class"]))),d.addClass("easycheck_okInfo"),b?d.html(b):d.html(""),d.hide(),h=$("[id='default_"+c+"']"),$("[id='correct_"+c+"']").hide(),s.chkDef.showDef(h,e,c)),a.removeClass(s.focusCss),e&&s.formFocusCss[e]&&a.removeClass(s.formFocusCss[e]),f=a.attr("id")||a.attr("name"),g=e+"_"+f,a.addClass(s.txtClass[g+"_class"])},initChk:function(a,b){var d,c="";b&&(c="#"+b+" "),d=s.getMatches(a.chkName),$(c+d).each(function(){var a=$(this),b=$("form").has(a).attr("id"),c=a.attr("id")||a.attr("name"),d=b+"_"+c;s.txtClass[d+"_class"]=$(this).attr("class"),s.txtClass[d+"_style"]=$(this).attr("style")}),$(c+d).on("blur change",function(b){s.easyCheckBlurIgnore[a.chkName]||s.easyCheckEleIgnore[b.target.id||b.target.name]||s.easyCheckEleBlurIgnore[b.target.id||b.target.name]||(s.blurChk?s.chk(this,b,a.chkFunction):"")}).on("focus",function(){var b,c,d,e,f,g;s.resetOnFocus&&(s.clearError(this),b=$(this),c=b.attr("id")||b.attr("name"),d=$("[id='correct_"+c+"']"),d.length>0?d.filter(":hidden").length>0&&(e=$("[id='default_"+c+"']"),e&&($("[id='correct_"+c+"']").hide(),s.chkDef.showDef(e,$("form").has($(c)).attr("id"),c))):(e=$("[id='default_"+c+"']"),e&&($("[id='correct_"+c+"']").hide(),s.chkDef.showDef(e,$("form").has($(c)).attr("id"),c))),f=$("form").has(b),g=f.attr("id"),g=f.attr("id"),g&&s.formFocusCss[g]?b.addClass(s.formFocusCss[g]):b.addClass(s.focusCss))}).on("keyup",function(b){s.easyCheckKeyupIgnore[a.chkName]||s.easyCheckEleIgnore[b.target.id||b.target.name]||s.easyCheckEleKeyupIgnore[b.target.id||b.target.name]||(s.keyupChk?s.chk(this,b,a.chkFunction):"")})}}};s.chkList=[new s.ChkRule(".required",f),new s.ChkRule(".email",g),new s.ChkRule(".url",h),new s.ChkRule(".number",i),new s.ChkRule(".integer",j),new s.ChkRule("[equalto]",k),new s.ChkRule("[equallength]",l),new s.ChkRule("[minlength][maxlength]",m),new s.ChkRule("[minlength]",n),new s.ChkRule("[maxlength]",o),new s.ChkRule("[min][max]",p),new s.ChkRule("[min]",q),new s.ChkRule("[max]",r),new s.ChkRule("[reg]",d),new s.ChkRule("[extension]",e),new s.ChkRule("[vc]",c)],s.easyCheckIgnore["[vc]"]=!0,a.EasyCheck=s}(window),$(function(){EasyCheck.initEasyCheck()}); -------------------------------------------------------------------------------- /easycheck/plugins/div/easy.easycheck-div.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery EasyCheck Plugin - Div plugin file 3 | * 4 | * Version 5.3.0 5 | * 6 | * http://easyproject.cn 7 | * https://github.com/ushelp/EasyCheck 8 | * 9 | * Author: Ray [ inthinkcolor@gmail.com ] 10 | * Since: 2011 11 | * 12 | * Dependencies: EasyCheck 13 | * 14 | */ 15 | EasyCheck.chkDef={ 16 | // 错误消息清除管理 17 | errorManger : function(param) { 18 | var s = ""; 19 | if (param.formId) { 20 | s = "[id='" + param.formId + "'] "; 21 | } 22 | // clearAllError 23 | $(s + "[id^='error_']").each(function() { 24 | var oNameOrId = $(this).attr("id").replace("error_", ""); 25 | var n = null; 26 | if ($(s + "[id='" + oNameOrId + "']").length > 0) { 27 | n = $(s + "[id='" + oNameOrId + "']"); 28 | } else { 29 | n = $(s + "[name='" + oNameOrId + "']"); 30 | } 31 | var formId = $("form").has(n).attr("id"); 32 | if (EasyCheck.ecss != "no" && EasyCheck.formEcss[formId] != "no") { 33 | if (!(n.attr("ecss") && n.attr("ecss") != "yes")) { 34 | n.removeClass(EasyCheck.errorCss); 35 | if (formId && EasyCheck.formErrorCss[formId]) { 36 | n.removeClass(EasyCheck.formErrorCss[formId]); 37 | } 38 | var domId=n.attr("id")||n.attr("name"); 39 | var oid=formId+"_"+domId; 40 | n.addClass(EasyCheck.txtClass[oid+"_class"]); 41 | } 42 | } 43 | $(s + "[id^='error_']").hide(); 44 | }); 45 | 46 | //restoreAll 47 | if (param.restore) { 48 | $(s + "[id^='correct_']").each(function() { 49 | $(this).hide(); 50 | }); 51 | $(s + "[id^='default_']").each(function() { 52 | var nowForm=$("form").has(this); 53 | var defDiv=$(this); 54 | if(nowForm){ 55 | var formId=nowForm.attr("id"); 56 | var oid=defDiv.attr("id").substr("default_".length); 57 | EasyCheck.chkDef.showDef(defDiv,formId,oid ); 58 | }else{ 59 | EasyCheck.chkDef.showDef(defDiv); 60 | } 61 | 62 | }); 63 | } 64 | }, 65 | // 默认状态管理 66 | showDef:function(defDiv,formId,oid){ 67 | if(formId){ 68 | var defMsg=defDiv.html(); 69 | 70 | if(EasyCheck.cacheDefMsg[formId+"_"+oid]!=undefined){ 71 | defMsg=EasyCheck.cacheDefMsg[formId+"_"+oid]; 72 | }else{ 73 | if(defDiv.attr("info")){ 74 | defMsg=defDiv.attr("info"); 75 | } 76 | EasyCheck.cacheDefMsg[formId+"_"+oid]=defMsg; 77 | } 78 | 79 | if(EasyCheck.defMsgs[oid]){ 80 | defDiv.html(EasyCheck.defMsgs[oid].replace(EasyCheck.msgMark,defMsg)); 81 | }else if(EasyCheck.defMsgs[formId]){ 82 | defDiv.html(EasyCheck.defMsgs[formId].replace(EasyCheck.msgMark,defMsg)); 83 | }else{ 84 | defDiv.html(EasyCheck.defMsg.replace(EasyCheck.msgMark,defMsg)); 85 | } 86 | } 87 | defDiv.show(); 88 | }, 89 | // 添加检测方法管理 90 | addChkMethod : function(rule, o, e, chkCode, msg) { 91 | var divSuf = $(o).attr("id") || $(o).attr("name"); 92 | var de = $("[id='default_" + divSuf + "']"); 93 | if (de) { 94 | de.hide(); 95 | } 96 | 97 | var flag=chkCode(o); 98 | if(window.Promise && flag instanceof Promise){ 99 | // ES6 Promise Support 100 | return flag.then(function(data){ 101 | return execute(data); 102 | },function(){ 103 | return execute(false); 104 | }); 105 | }else{ 106 | return execute(flag); 107 | } 108 | 109 | function execute(res){ 110 | var divSuf = $(o).attr("id") || $(o).attr("name"); 111 | var de = $("[id='default_" + divSuf + "']"); 112 | if (!res) { 113 | var de = $("[id='default_" + divSuf + "']"); 114 | if (de) { 115 | de.hide(); 116 | } 117 | if (EasyCheck.msgs[divSuf] && EasyCheck.msgs[divSuf][rule]) { 118 | msg = typeof EasyCheck.msgs[divSuf][rule] == "string" ? EasyCheck.msgs[divSuf][rule] :EasyCheck.msgs[divSuf][rule]($(o)); 119 | } 120 | EasyCheck.showError(o, msg); 121 | if (e) { 122 | e.stopImmediatePropagation(); 123 | } 124 | return false; 125 | } else { 126 | 127 | EasyCheck.clearError(o); 128 | var defaultDiv = $("[id='default_" + divSuf + "']"); 129 | if (defaultDiv) { 130 | defaultDiv.hide(); 131 | } 132 | var okDiv = $("[id='correct_" + divSuf + "']"); 133 | 134 | (rule+" == "+"[id='correct_" + divSuf + "']"+"====="+okDiv.length) 135 | var formId = $("form").has(o).attr("id"); 136 | if (okDiv.length>0) { 137 | okDiv.addClass("easycheck_okInfo"); 138 | 139 | var correctMsg=okDiv.html(); 140 | if(EasyCheck.cacheCorrectMsg[formId+"_"+divSuf]!=undefined){ 141 | correctMsg=EasyCheck.cacheCorrectMsg[formId+"_"+divSuf]; 142 | }else{ 143 | if(okDiv.attr("info")){ 144 | correctMsg=okDiv.attr("info"); 145 | } 146 | EasyCheck.cacheCorrectMsg[formId+"_"+divSuf]=correctMsg; 147 | } 148 | 149 | if(EasyCheck.correctMsgs[divSuf]){ 150 | okDiv.html(EasyCheck.correctMsgs[divSuf].replace(EasyCheck.msgMark,correctMsg)); 151 | }else if(EasyCheck.correctMsgs[formId]){ 152 | okDiv.html(EasyCheck.correctMsgs[formId].replace(EasyCheck.msgMark,correctMsg)); 153 | }else{ 154 | okDiv.html(EasyCheck.correctMsg.replace(EasyCheck.msgMark,correctMsg)); 155 | } 156 | 157 | okDiv.show(); 158 | } 159 | if (e) { 160 | if (e.type == "keyup") { 161 | $(o).removeClass(EasyCheck.errorCss); 162 | var nowForm = $("form").has(o); 163 | if (nowForm.length > 0 && EasyCheck.formErrorCss[nowForm.attr("id")]) { 164 | $(o).removeClass(EasyCheck.formErrorCss[nowForm.attr("id")]); 165 | } 166 | if (nowForm.length > 0 && EasyCheck.formFocusCss[nowForm.attr("id")]) { 167 | $(o).addClass(EasyCheck.formFocusCss[nowForm.attr("id")]); 168 | } else { 169 | $(o).addClass(EasyCheck.focusCss); 170 | } 171 | } 172 | } 173 | return true; 174 | } 175 | } 176 | 177 | 178 | }, 179 | // 显示错误 180 | showError: function(o, msg){ 181 | if (typeof o == "string") { 182 | o = $("#" + o)[0] || $("[name='" + o + "']")[0]; 183 | } 184 | o=$(o); 185 | var divSuf = o.attr("id") || o.attr("name"); 186 | $("[id='correct_" + divSuf + "']").hide(); 187 | $("[id='default_" + divSuf + "']").hide(); 188 | var eo = $("[id='error_" + divSuf + "']"); 189 | if (eo.length == 0) { 190 | o.after("
"); 191 | eo = $("[id='error_" + divSuf + "']"); 192 | } 193 | eo.removeClass(); 194 | eo.addClass("easycheck_errorInfo"); 195 | var formId = $("form").has(o).attr("id"); 196 | 197 | o.removeClass(EasyCheck.focusCss); 198 | if (formId && EasyCheck.formFocusCss[formId]) { 199 | o.removeClass(EasyCheck.formFocusCss[formId]); 200 | } 201 | if (EasyCheck.ecss != "no" && EasyCheck.formEcss[formId] != "no") { 202 | if (!(o.attr("ecss") && o.attr("ecss") != "yes")) { 203 | if (formId && EasyCheck.formErrorCss[formId]) { 204 | o.addClass(EasyCheck.formErrorCss[formId]); 205 | } else { 206 | o.addClass(EasyCheck.errorCss); 207 | } 208 | } 209 | } 210 | 211 | 212 | var errorMsg=""; 213 | var prefix = eo.attr("prefix"); 214 | if (prefix) { 215 | errorMsg=prefix + msg; 216 | } else { 217 | prefix = ""; 218 | errorMsg=msg; 219 | } 220 | 221 | 222 | var info=eo.html(); 223 | if(EasyCheck.cacheErrorMsg[formId+"_"+divSuf]!=undefined){ 224 | info=EasyCheck.cacheErrorMsg[formId+"_"+divSuf]; 225 | }else{ 226 | if(eo.attr("info")){ 227 | info=eo.attr("info"); 228 | } 229 | EasyCheck.cacheErrorMsg[formId+"_"+divSuf]=info; 230 | } 231 | 232 | if (info) { 233 | errorMsg=prefix + info; 234 | } 235 | if(EasyCheck.errorMsgs[divSuf]){ 236 | eo.html(EasyCheck.errorMsgs[divSuf].replace(EasyCheck.msgMark,errorMsg)); 237 | }else if(EasyCheck.errorMsgs[formId]){ 238 | eo.html(EasyCheck.errorMsgs[formId].replace(EasyCheck.msgMark,errorMsg)); 239 | }else{ 240 | eo.html(EasyCheck.errorMsg.replace(EasyCheck.msgMark,errorMsg)); 241 | } 242 | eo.show(); 243 | }, 244 | // 清除错误 245 | clearError:function(o, msg){ 246 | if (typeof o == "string") { 247 | o = $("#" + o)[0] || $("[name='" + o + "']")[0]; 248 | } 249 | o=$(o); 250 | var divSuf = o.attr("id") || o.attr("name"); 251 | var eo = $("[id='error_" + divSuf + "']"); 252 | 253 | var formId = $("form").has(o).attr("id"); 254 | if (eo.length>0) { 255 | if (EasyCheck.ecss != "no" && EasyCheck.formEcss[formId] != "no") { 256 | if (!(o.attr("ecss") && o.attr("ecss") != "yes")) { 257 | o.removeClass(EasyCheck.errorCss); 258 | if (formId && EasyCheck.formErrorCss[formId]) { 259 | o.removeClass(EasyCheck.formErrorCss[formId]); 260 | } 261 | var domId=o.attr("id")||o.attr("name"); 262 | var oid=formId+"_"+domId; 263 | o.addClass(EasyCheck.txtClass[oid+"_class"]); 264 | 265 | } 266 | } 267 | eo.addClass("easycheck_okInfo"); 268 | if (msg) { 269 | eo.html(msg); 270 | } else { 271 | eo.html(""); 272 | } 273 | eo.hide(); 274 | 275 | 276 | var defDiv=$("[id='default_" + divSuf + "']"); 277 | $("[id='correct_" + divSuf + "']").hide(); 278 | EasyCheck.chkDef.showDef(defDiv,formId,divSuf ); 279 | 280 | } 281 | o.removeClass(EasyCheck.focusCss); 282 | if (formId && EasyCheck.formFocusCss[formId]) { 283 | o.removeClass(EasyCheck.formFocusCss[formId]); 284 | } 285 | 286 | var domId=o.attr("id")||o.attr("name"); 287 | var oid=formId+"_"+domId; 288 | o.addClass(EasyCheck.txtClass[oid+"_class"]); 289 | }, 290 | // 初始化Chk框 291 | initChk:function(chkrule, formId) { 292 | var area=''; 293 | if(formId){ 294 | area='#'+formId+' '; 295 | } 296 | var chkElements = EasyCheck.getMatches(chkrule.chkName); 297 | $(area+chkElements).each(function(){ 298 | var o=$(this); 299 | var formId = $("form").has(o).attr("id"); 300 | var domId=o.attr("id")||o.attr("name"); 301 | var oid=formId+"_"+domId; 302 | EasyCheck.txtClass[oid+"_class"]=$(this).attr("class"); 303 | EasyCheck.txtClass[oid+"_style"]=$(this).attr("style"); 304 | }); 305 | 306 | 307 | $(area+chkElements).on("blur change", function(e) { 308 | if (!EasyCheck.easyCheckBlurIgnore[chkrule.chkName] && !EasyCheck.easyCheckEleIgnore[e.target.id || e.target.name]) { 309 | if (!EasyCheck.easyCheckEleBlurIgnore[e.target.id || e.target.name]) { 310 | EasyCheck.blurChk ? EasyCheck.chk(this, e, chkrule.chkFunction) :""; 311 | } 312 | } 313 | }).on("focus", function(e) { 314 | if(!EasyCheck.resetOnFocus){ 315 | return; 316 | } 317 | EasyCheck.clearError(this); 318 | var o = $(this); 319 | var domId = o.attr("id") || o.attr("name"); 320 | var okDiv = $("[id='correct_" + domId + "']"); 321 | if (okDiv.length > 0) { 322 | if (okDiv.filter(":hidden").length > 0) { 323 | var defDiv = $("[id='default_" + domId + "']"); 324 | if (defDiv) { 325 | $("[id='correct_" + domId + "']").hide(); 326 | EasyCheck.chkDef.showDef(defDiv,$("form").has($(domId)).attr("id"),domId ); 327 | 328 | } 329 | } 330 | } else { 331 | var defDiv = $("[id='default_" + domId + "']"); 332 | if (defDiv) { 333 | $("[id='correct_" + domId + "']").hide(); 334 | EasyCheck.chkDef.showDef(defDiv,$("form").has($(domId)).attr("id"),domId ); 335 | } 336 | } 337 | var nowForm = $("form").has(o); 338 | var formId = nowForm.attr("id"); 339 | 340 | var formId = nowForm.attr("id"); 341 | if (formId && EasyCheck.formFocusCss[formId]) { 342 | o.addClass(EasyCheck.formFocusCss[formId]); 343 | } else { 344 | o.addClass(EasyCheck.focusCss); 345 | } 346 | }).on("keyup", function(e) { 347 | if (!EasyCheck.easyCheckKeyupIgnore[chkrule.chkName] && !EasyCheck.easyCheckEleIgnore[e.target.id || e.target.name]) { 348 | if (!EasyCheck.easyCheckEleKeyupIgnore[e.target.id || e.target.name]) { 349 | EasyCheck.keyupChk ? EasyCheck.chk(this, e, chkrule.chkFunction) :""; 350 | } 351 | } 352 | }); 353 | } 354 | } 355 | $(function(){ 356 | EasyCheck.initDefMsg(); 357 | }) 358 | 359 | 360 | 361 | -------------------------------------------------------------------------------- /easycheck/plugins/tooltip/easy.easycheck-tooltip-all.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery EasyCheck Tooltip plugin all in one file 3 | * 4 | * Version 5.3.0 5 | * 6 | * http://easyproject.cn 7 | * https://github.com/ushelp/EasyCheck 8 | * 9 | * Author: Ray [ inthinkcolor@gmail.com ] 10 | * Since: 2011 11 | * 12 | * Dependencies: EasyCheck 13 | * 14 | */ 15 | !function(a){var b=function(b,c){var d=s.getMatches(b.chkName),e=new Array;return $(c.eleArea+d).each(function(d,f){var h,i,g=$(f).attr("id")||$(f).attr("name");c.errorEleArray[g]?c.chkFlag=!1:(h=b.chkFunction(f),a.Promise&&h instanceof Promise?(i=h.then(function(a){a||(c.errorEleArray[g]="E",c.chkFlag=!1)},function(){c.errorEleArray[g]="E",c.chkFlag=!1}),e.push(i)):h||(c.errorEleArray[g]="E",c.chkFlag=!1))}),e},c=function(b,c){return s.chkDef.addChkMethod("[vc]",b,c,function(b){var d,e,c=$(b).val();return a.Promise?d=new Promise(function(a,d){$.ajax({url:$(b).attr("vc"),data:$(b).attr("name")+"="+c+"&n="+new Date,type:"POST",success:function(b){var d,c=b;c?c+="":c="false",d=c.replace(/\r\n/g,""),"true"!=d&&"false"!=d&&console.error("Captcha validation result must is 'true' or 'false', but your is: ",b),a("true"==d)},error:function(){d(!1)},xhrFields:{withCredentials:s.withCredentials}})}):(e=!1,$.ajaxSetup({async:!1}),$.post($(b).attr("vc"),$(b).attr("name")+"="+c+"&n="+new Date,function(a){e=a.replace(/\r\n/g,"")},"text"),"true"==e)},s.msg["vc"])},d=function(a,b){return s.chkDef.addChkMethod("[reg]",a,b,function(a){var b=$(a).val(),c=new RegExp("^(?:"+$(a).attr("reg")+")$");return!(""!=$.trim(b)&&!c.test(b))},s.msg["regexp"])},e=function(a,b){return s.chkDef.addChkMethod("[extension]",a,b,function(a){var b=$(a).attr("extension"),c=$(a).val(),d=""!=b?b.replace(/,/g,"|"):"png|jpe?g|gif";return!(""!=$.trim(c)&&!c.match(new RegExp(".("+d+")$","i")))},s.formatMsg(s.msg["extension"],$(a).attr("extension")))},f=function(a,b){return s.chkDef.addChkMethod(".required",a,b,function(a){var b=$(a).val();return""!=$.trim(b)},s.msg["required"])},g=function(a,b){return s.chkDef.addChkMethod(".email",a,b,function(a){var b=$(a).val();return!(""!=$.trim(b)&&!s.validator.email.test(b))},s.msg["email"])},h=function(a,b){return s.chkDef.addChkMethod(".url",a,b,function(a){var b=$(a).val();return!(""!=$.trim(b)&&!s.validator.url.test(b))},s.msg["url"])},i=function(a,b){return s.chkDef.addChkMethod(".number",a,b,function(a){var b=$(a).val();return!(""!=$.trim(b)&&!s.validator.number.test(b))},s.msg["number"])},j=function(a,b){return s.chkDef.addChkMethod(".integer",a,b,function(a){var b=$(a).val();return!(""!=$.trim(b)&&!s.validator.integer.test(b))},s.msg["integer"])},k=function(a,b){return s.chkDef.addChkMethod("[equalto]",a,b,function(a){var b=$(a).val();return b==$("[id='"+$(a).attr("equalto")+"']").val()},s.msg["equalto"])},l=function(a,b){return s.chkDef.addChkMethod("[equallength]",a,b,function(a){var b=$(a).val();return!(b.length!=$(a).attr("equallength"))},s.formatMsg(s.msg["equallength"],$(a).attr("equallength")))},m=function(a,b){return s.chkDef.addChkMethod("[minlength][maxlength]",a,b,function(a){var b=$(a).val();return!($.trim(b).length<$(a).attr("minlength")||$.trim(b).length>$(a).attr("maxlength"))},s.formatMsg(s.msg["lengthrange"],$(a).attr("minlength"),$(a).attr("maxlength")))},n=function(a,b){return s.chkDef.addChkMethod("[minlength]",a,b,function(a){var b=$(a).val();return!($.trim(b).length<$(a).attr("minlength"))},s.formatMsg(s.msg["minlength"],$(a).attr("minlength")))},o=function(a,b){return s.chkDef.addChkMethod("[maxlength]",a,b,function(a){var b=$(a).val();return!($.trim(b).length>$(a).attr("maxlength"))},s.formatMsg(s.msg["maxlength"],$(a).attr("maxlength")))},p=function(a,b){return s.chkDef.addChkMethod("[min][max]",a,b,function(a){var b=$(a).val();return!(parseFloat($.trim(b))parseFloat($(a).attr("max"))||isNaN(b))},s.formatMsg(s.msg["numberrange"],$(a).attr("min"),$(a).attr("max")))},q=function(a,b){return s.chkDef.addChkMethod("[min]",a,b,function(a){var b=$(a).val();return!(parseFloat($.trim(b))parseFloat($(a).attr("max"))||isNaN(b))},s.formatMsg(s.msg["max"],$(a).attr("max")))},s={chkList:"",msg:{},msgs:{},msgMark:"{0}",errorMsg:"{0}",correctMsg:"{0}",defMsg:"{0}",errorMsgs:{},correctMsgs:{},defMsgs:{},cacheCorrectMsg:{},cacheDefMsg:{},cacheErrorMsg:{},resetOnFocus:!0,withCredentials:!0,validator:{email:/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,url:/^(https?|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,number:/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/,integer:/^-?^\d+$/,English:/^[A-Za-z]+$/,Chinese:/^[\u0391-\uFFE5]+$/,Zip:/^[1-9]\d{5}$/,Currency:/^\d+(\.\d+)?$/,Require:/.+/,ipv4:/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i,ipv6:/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/},easyCheckIgnore:{},easyCheckBlurIgnore:{},easyCheckKeyupIgnore:{},easyCheckEleIgnore:{},easyCheckEleBlurIgnore:{},easyCheckEleKeyupIgnore:{},easyCheckSubmitDisable:!0,ecss:"yes",formEcss:{},focusCss:"easycheck_focusInput",errorCss:"easycheck_errorInput",formFocusCss:{},formErrorCss:{},txtClass:{},loadChk:!0,blurChk:!0,keyupChk:!0,formatMsg:function(){var b,a=[];for(b=1;b0&&s.chkDef.showDef(d,b,c)}))},initChk:function(a,b){s.chkDef.initChk(a,b)},addChk:function(a,b,c){var d=function(d,e){return s.chkDef.addChkMethod(a,d,e,b,"string"==typeof c?c:c(d))},e=new s.ChkRule(a,d);s.chkList.push(e),s.initChk(e)},ChkRule:function(a,b){this.chkName=a,this.chkFunction=b},checkForm:function(c){function k(a,b){return a.chkFlag?(s["easyCheckSubmitDisable"]&&$(":submit",$(a.eleArea)).prop("disabled",!0),s.chkDef.complete&&s.chkDef.complete(b,a.chkFlag)):(s.chkDef.complete&&s.chkDef.complete(b,a.chkFlag),$(":submit",$(a.eleArea)).prop("disabled",!1)),a.chkFlag}var d,e,f,g,h,i,j;for("string"==typeof c&&(c=$(c)),d=$(c).attr("id"),e={eleArea:"[id='"+d+"'] ",chkFlag:!0,errorEleArray:new Array},f=new Array,g=0;g0?j=Promise.all(f).then(function(){return k(e,d),e.chkFlag}):k(e,d)},initEasyCheck:function(b){function d(){var a,c;for(a=0;a0?$(b+"[id='"+a+"']"):$(b+"[name='"+a+"']"),d=$("form").has(c).attr("id"),"no"!=s.ecss&&"no"!=s.formEcss[d]&&(c.attr("ecss")&&"yes"!=c.attr("ecss")||(c.removeClass(s.errorCss),d&&s.formErrorCss[d]&&c.removeClass(s.formErrorCss[d]),e=c.attr("id")||c.attr("name"),f=d+"_"+e,c.addClass(s.txtClass[f+"_class"]))),$(b+"[id^='error_']").hide()}),a.restore&&($(b+"[id^='correct_']").each(function(){$(this).hide()}),$(b+"[id^='default_']").each(function(){var c,d,a=$("form").has(this),b=$(this);a?(c=a.attr("id"),d=b.attr("id").substr("default_".length),s.chkDef.showDef(b,c,d)):s.chkDef.showDef(b)}))},showDef:function(a,b,c){if(b){var d=a.html();void 0!=s.cacheDefMsg[b+"_"+c]?d=s.cacheDefMsg[b+"_"+c]:(a.attr("info")&&(d=a.attr("info")),s.cacheDefMsg[b+"_"+c]=d),s.defMsgs[c]?a.html(s.defMsgs[c].replace(s.msgMark,d)):s.defMsgs[b]?a.html(s.defMsgs[b].replace(s.msgMark,d)):a.html(s.defMsg.replace(s.msgMark,d))}a.show()},addChkMethod:function(b,c,d,e,f){function k(a){var h,i,j,k,l,e=$(c).attr("id")||$(c).attr("name"),g=$("[id='default_"+e+"']");return a?(s.clearError(c),h=$("[id='default_"+e+"']"),h&&h.hide(),i=$("[id='correct_"+e+"']"),j=$("form").has(c).attr("id"),i.length>0&&(i.addClass("easycheck_okInfo"),k=i.html(),void 0!=s.cacheCorrectMsg[j+"_"+e]?k=s.cacheCorrectMsg[j+"_"+e]:(i.attr("info")&&(k=i.attr("info")),s.cacheCorrectMsg[j+"_"+e]=k),s.correctMsgs[e]?i.html(s.correctMsgs[e].replace(s.msgMark,k)):s.correctMsgs[j]?i.html(s.correctMsgs[j].replace(s.msgMark,k)):i.html(s.correctMsg.replace(s.msgMark,k)),i.show()),d&&"keyup"==d.type&&($(c).removeClass(s.errorCss),l=$("form").has(c),l.length>0&&s.formErrorCss[l.attr("id")]&&$(c).removeClass(s.formErrorCss[l.attr("id")]),l.length>0&&s.formFocusCss[l.attr("id")]?$(c).addClass(s.formFocusCss[l.attr("id")]):$(c).addClass(s.focusCss)),!0):(g=$("[id='default_"+e+"']"),g&&g.hide(),s.msgs[e]&&s.msgs[e][b]&&(f="string"==typeof s.msgs[e][b]?s.msgs[e][b]:s.msgs[e][b]($(c))),s.showError(c,f),d&&d.stopImmediatePropagation(),!1)}var i,j,g=$(c).attr("id")||$(c).attr("name"),h=$("[id='default_"+g+"']");return h&&h.hide(),i=e(c),a.Promise&&i instanceof Promise?j=i.then(function(a){return k(a)},function(){return k(!1)}):k(i)},showError:function(a,b){var c,d,e,f,g,h;"string"==typeof a&&(a=$("#"+a)[0]||$("[name='"+a+"']")[0]),a=$(a),c=a.attr("id")||a.attr("name"),$("[id='correct_"+c+"']").hide(),$("[id='default_"+c+"']").hide(),d=$("[id='error_"+c+"']"),0==d.length&&(a.after("
"),d=$("[id='error_"+c+"']")),d.removeClass(),d.addClass("easycheck_errorInfo"),e=$("form").has(a).attr("id"),a.removeClass(s.focusCss),e&&s.formFocusCss[e]&&a.removeClass(s.formFocusCss[e]),"no"!=s.ecss&&"no"!=s.formEcss[e]&&(a.attr("ecss")&&"yes"!=a.attr("ecss")||(e&&s.formErrorCss[e]?a.addClass(s.formErrorCss[e]):a.addClass(s.errorCss))),f="",g=d.attr("prefix"),g?f=g+b:(g="",f=b),h=d.html(),void 0!=s.cacheErrorMsg[e+"_"+c]?h=s.cacheErrorMsg[e+"_"+c]:(d.attr("info")&&(h=d.attr("info")),s.cacheErrorMsg[e+"_"+c]=h),h&&(f=g+h),s.errorMsgs[c]?d.html(s.errorMsgs[c].replace(s.msgMark,f)):s.errorMsgs[e]?d.html(s.errorMsgs[e].replace(s.msgMark,f)):d.html(s.errorMsg.replace(s.msgMark,f)),d.show()},clearError:function(a,b){var c,d,e,f,g,h;"string"==typeof a&&(a=$("#"+a)[0]||$("[name='"+a+"']")[0]),a=$(a),c=a.attr("id")||a.attr("name"),d=$("[id='error_"+c+"']"),e=$("form").has(a).attr("id"),d.length>0&&("no"!=s.ecss&&"no"!=s.formEcss[e]&&(a.attr("ecss")&&"yes"!=a.attr("ecss")||(a.removeClass(s.errorCss),e&&s.formErrorCss[e]&&a.removeClass(s.formErrorCss[e]),f=a.attr("id")||a.attr("name"),g=e+"_"+f,a.addClass(s.txtClass[g+"_class"]))),d.addClass("easycheck_okInfo"),b?d.html(b):d.html(""),d.hide(),h=$("[id='default_"+c+"']"),$("[id='correct_"+c+"']").hide(),s.chkDef.showDef(h,e,c)),a.removeClass(s.focusCss),e&&s.formFocusCss[e]&&a.removeClass(s.formFocusCss[e]),f=a.attr("id")||a.attr("name"),g=e+"_"+f,a.addClass(s.txtClass[g+"_class"])},initChk:function(a,b){var d,c="";b&&(c="#"+b+" "),d=s.getMatches(a.chkName),$(c+d).each(function(){var a=$(this),b=$("form").has(a).attr("id"),c=a.attr("id")||a.attr("name"),d=b+"_"+c;s.txtClass[d+"_class"]=$(this).attr("class"),s.txtClass[d+"_style"]=$(this).attr("style")}),$(c+d).on("blur change",function(b){s.easyCheckBlurIgnore[a.chkName]||s.easyCheckEleIgnore[b.target.id||b.target.name]||s.easyCheckEleBlurIgnore[b.target.id||b.target.name]||(s.blurChk?s.chk(this,b,a.chkFunction):"")}).on("focus",function(){var b,c,d,e,f,g;s.resetOnFocus&&(s.clearError(this),b=$(this),c=b.attr("id")||b.attr("name"),d=$("[id='correct_"+c+"']"),d.length>0?d.filter(":hidden").length>0&&(e=$("[id='default_"+c+"']"),e&&($("[id='correct_"+c+"']").hide(),s.chkDef.showDef(e,$("form").has($(c)).attr("id"),c))):(e=$("[id='default_"+c+"']"),e&&($("[id='correct_"+c+"']").hide(),s.chkDef.showDef(e,$("form").has($(c)).attr("id"),c))),f=$("form").has(b),g=f.attr("id"),g=f.attr("id"),g&&s.formFocusCss[g]?b.addClass(s.formFocusCss[g]):b.addClass(s.focusCss))}).on("keyup",function(b){s.easyCheckKeyupIgnore[a.chkName]||s.easyCheckEleIgnore[b.target.id||b.target.name]||s.easyCheckEleKeyupIgnore[b.target.id||b.target.name]||(s.keyupChk?s.chk(this,b,a.chkFunction):"")})}}};s.chkList=[new s.ChkRule(".required",f),new s.ChkRule(".email",g),new s.ChkRule(".url",h),new s.ChkRule(".number",i),new s.ChkRule(".integer",j),new s.ChkRule("[equalto]",k),new s.ChkRule("[equallength]",l),new s.ChkRule("[minlength][maxlength]",m),new s.ChkRule("[minlength]",n),new s.ChkRule("[maxlength]",o),new s.ChkRule("[min][max]",p),new s.ChkRule("[min]",q),new s.ChkRule("[max]",r),new s.ChkRule("[reg]",d),new s.ChkRule("[extension]",e),new s.ChkRule("[vc]",c)],s.easyCheckIgnore["[vc]"]=!0,a.EasyCheck=s}(window),$(function(){window.EasyCheck&&(EasyCheck.errorMsg='
{0}
',EasyCheck.correctMsg='
{0}
',EasyCheck.defMsg='
{0}
',EasyCheck.initDefMsg()),EasyCheck.initEasyCheck()}); -------------------------------------------------------------------------------- /easycheck/plugins/tooltip/easy.easycheck-tooltip.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery EasyCheck Plugin - Tooltip plugin file 3 | * 4 | * Version 5.3.0 5 | * 6 | * http://easyproject.cn 7 | * https://github.com/ushelp/EasyCheck 8 | * 9 | * Author: Ray [ inthinkcolor@gmail.com ] 10 | * Since: 2011 11 | * 12 | * Dependencies: EasyCheck 13 | * 14 | */ 15 | EasyCheck.chkDef={ 16 | 17 | // 错误消息清除管理 18 | errorManger : function(param) { 19 | var s = ""; 20 | if (param.formId) { 21 | s = "[id='" + param.formId + "'] "; 22 | } 23 | // clearAllError 24 | $(s + "[id^='error_']").each(function() { 25 | var oNameOrId = $(this).attr("id").replace("error_", ""); 26 | var n = null; 27 | if ($(s + "[id='" + oNameOrId + "']").length > 0) { 28 | n = $(s + "[id='" + oNameOrId + "']"); 29 | } else { 30 | n = $(s + "[name='" + oNameOrId + "']"); 31 | } 32 | var formId = $("form").has(n).attr("id"); 33 | if (EasyCheck.ecss != "no" && EasyCheck.formEcss[formId] != "no") { 34 | if (!(n.attr("ecss") && n.attr("ecss") != "yes")) { 35 | n.removeClass(EasyCheck.errorCss); 36 | if (formId && EasyCheck.formErrorCss[formId]) { 37 | n.removeClass(EasyCheck.formErrorCss[formId]); 38 | } 39 | var domId=n.attr("id")||n.attr("name"); 40 | var oid=formId+"_"+domId; 41 | n.addClass(EasyCheck.txtClass[oid+"_class"]); 42 | } 43 | } 44 | $(s + "[id^='error_']").hide(); 45 | }); 46 | 47 | //restoreAll 48 | if (param.restore) { 49 | $(s + "[id^='correct_']").each(function() { 50 | $(this).hide(); 51 | }); 52 | $(s + "[id^='default_']").each(function() { 53 | var nowForm=$("form").has(this); 54 | var defDiv=$(this); 55 | if(nowForm){ 56 | var formId=nowForm.attr("id"); 57 | var oid=defDiv.attr("id").substr("default_".length); 58 | EasyCheck.chkDef.showDef(defDiv,formId,oid ); 59 | }else{ 60 | EasyCheck.chkDef.showDef(defDiv); 61 | } 62 | 63 | }); 64 | } 65 | }, 66 | // 默认状态管理 67 | showDef:function(defDiv,formId,oid){ 68 | if(formId){ 69 | var defMsg=defDiv.html(); 70 | 71 | if(EasyCheck.cacheDefMsg[formId+"_"+oid]!=undefined){ 72 | defMsg=EasyCheck.cacheDefMsg[formId+"_"+oid]; 73 | }else{ 74 | if(defDiv.attr("info")){ 75 | defMsg=defDiv.attr("info"); 76 | } 77 | EasyCheck.cacheDefMsg[formId+"_"+oid]=defMsg; 78 | } 79 | 80 | if(EasyCheck.defMsgs[oid]){ 81 | defDiv.html(EasyCheck.defMsgs[oid].replace(EasyCheck.msgMark,defMsg)); 82 | }else if(EasyCheck.defMsgs[formId]){ 83 | defDiv.html(EasyCheck.defMsgs[formId].replace(EasyCheck.msgMark,defMsg)); 84 | }else{ 85 | defDiv.html(EasyCheck.defMsg.replace(EasyCheck.msgMark,defMsg)); 86 | } 87 | } 88 | defDiv.show(); 89 | }, 90 | // 添加检测方法管理 91 | addChkMethod : function(rule, o, e, chkCode, msg) { 92 | var divSuf = $(o).attr("id") || $(o).attr("name"); 93 | var de = $("[id='default_" + divSuf + "']"); 94 | if (de) { 95 | de.hide(); 96 | } 97 | 98 | var flag=chkCode(o); 99 | if(window.Promise && flag instanceof Promise){ 100 | // ES6 Promise Support 101 | var p=flag.then(function(data){ 102 | return execute(data); 103 | },function(){ 104 | return execute(false); 105 | }); 106 | return p; 107 | }else{ 108 | return execute(flag); 109 | } 110 | 111 | function execute(res){ 112 | var divSuf = $(o).attr("id") || $(o).attr("name"); 113 | var de = $("[id='default_" + divSuf + "']"); 114 | if (!res) { 115 | var de = $("[id='default_" + divSuf + "']"); 116 | if (de) { 117 | de.hide(); 118 | } 119 | if (EasyCheck.msgs[divSuf] && EasyCheck.msgs[divSuf][rule]) { 120 | msg = typeof EasyCheck.msgs[divSuf][rule] == "string" ? EasyCheck.msgs[divSuf][rule] :EasyCheck.msgs[divSuf][rule]($(o)); 121 | } 122 | EasyCheck.showError(o, msg); 123 | if (e) { 124 | e.stopImmediatePropagation(); 125 | } 126 | return false; 127 | } else { 128 | EasyCheck.clearError(o); 129 | var defaultDiv = $("[id='default_" + divSuf + "']"); 130 | if (defaultDiv) { 131 | defaultDiv.hide(); 132 | } 133 | var okDiv = $("[id='correct_" + divSuf + "']"); 134 | var formId = $("form").has(o).attr("id"); 135 | if (okDiv.length>0) { 136 | okDiv.addClass("easycheck_okInfo"); 137 | 138 | var correctMsg=okDiv.html(); 139 | if(EasyCheck.cacheCorrectMsg[formId+"_"+divSuf]!=undefined){ 140 | correctMsg=EasyCheck.cacheCorrectMsg[formId+"_"+divSuf]; 141 | }else{ 142 | if(okDiv.attr("info")){ 143 | correctMsg=okDiv.attr("info"); 144 | } 145 | EasyCheck.cacheCorrectMsg[formId+"_"+divSuf]=correctMsg; 146 | } 147 | 148 | if(EasyCheck.correctMsgs[divSuf]){ 149 | okDiv.html(EasyCheck.correctMsgs[divSuf].replace(EasyCheck.msgMark,correctMsg)); 150 | }else if(EasyCheck.correctMsgs[formId]){ 151 | okDiv.html(EasyCheck.correctMsgs[formId].replace(EasyCheck.msgMark,correctMsg)); 152 | }else{ 153 | okDiv.html(EasyCheck.correctMsg.replace(EasyCheck.msgMark,correctMsg)); 154 | } 155 | 156 | okDiv.show(); 157 | } 158 | if (e) { 159 | if (e.type == "keyup") { 160 | $(o).removeClass(EasyCheck.errorCss); 161 | var nowForm = $("form").has(o); 162 | if (nowForm.length > 0 && EasyCheck.formErrorCss[nowForm.attr("id")]) { 163 | $(o).removeClass(EasyCheck.formErrorCss[nowForm.attr("id")]); 164 | } 165 | if (nowForm.length > 0 && EasyCheck.formFocusCss[nowForm.attr("id")]) { 166 | $(o).addClass(EasyCheck.formFocusCss[nowForm.attr("id")]); 167 | } else { 168 | $(o).addClass(EasyCheck.focusCss); 169 | } 170 | } 171 | } 172 | return true; 173 | } 174 | } 175 | 176 | 177 | 178 | 179 | }, 180 | // 显示错误 181 | showError: function(o, msg){ 182 | if (typeof o == "string") { 183 | o = $("#" + o)[0] || $("[name='" + o + "']")[0]; 184 | } 185 | o=$(o); 186 | var divSuf = o.attr("id") || o.attr("name"); 187 | $("[id='correct_" + divSuf + "']").hide(); 188 | $("[id='default_" + divSuf + "']").hide(); 189 | var eo = $("[id='error_" + divSuf + "']"); 190 | if (eo.length == 0) { 191 | o.after("
"); 192 | eo = $("[id='error_" + divSuf + "']"); 193 | } 194 | eo.removeClass(); 195 | eo.addClass("easycheck_errorInfo"); 196 | var formId = $("form").has(o).attr("id"); 197 | 198 | o.removeClass(EasyCheck.focusCss); 199 | if (formId && EasyCheck.formFocusCss[formId]) { 200 | o.removeClass(EasyCheck.formFocusCss[formId]); 201 | } 202 | if (EasyCheck.ecss != "no" && EasyCheck.formEcss[formId] != "no") { 203 | if (!(o.attr("ecss") && o.attr("ecss") != "yes")) { 204 | if (formId && EasyCheck.formErrorCss[formId]) { 205 | o.addClass(EasyCheck.formErrorCss[formId]); 206 | } else { 207 | o.addClass(EasyCheck.errorCss); 208 | } 209 | } 210 | } 211 | 212 | 213 | var errorMsg=""; 214 | var prefix = eo.attr("prefix"); 215 | if (prefix) { 216 | errorMsg=prefix + msg; 217 | } else { 218 | prefix = ""; 219 | errorMsg=msg; 220 | } 221 | 222 | 223 | var info=eo.html(); 224 | if(EasyCheck.cacheErrorMsg[formId+"_"+divSuf]!=undefined){ 225 | info=EasyCheck.cacheErrorMsg[formId+"_"+divSuf]; 226 | }else{ 227 | if(eo.attr("info")){ 228 | info=eo.attr("info"); 229 | } 230 | EasyCheck.cacheErrorMsg[formId+"_"+divSuf]=info; 231 | } 232 | 233 | if (info) { 234 | errorMsg=prefix + info; 235 | } 236 | if(EasyCheck.errorMsgs[divSuf]){ 237 | eo.html(EasyCheck.errorMsgs[divSuf].replace(EasyCheck.msgMark,errorMsg)); 238 | }else if(EasyCheck.errorMsgs[formId]){ 239 | eo.html(EasyCheck.errorMsgs[formId].replace(EasyCheck.msgMark,errorMsg)); 240 | }else{ 241 | eo.html(EasyCheck.errorMsg.replace(EasyCheck.msgMark,errorMsg)); 242 | } 243 | eo.show(); 244 | }, 245 | // 清除错误 246 | clearError:function(o, msg){ 247 | if (typeof o == "string") { 248 | o = $("#" + o)[0] || $("[name='" + o + "']")[0]; 249 | } 250 | o=$(o); 251 | var divSuf = o.attr("id") || o.attr("name"); 252 | var eo = $("[id='error_" + divSuf + "']"); 253 | 254 | var formId = $("form").has(o).attr("id"); 255 | if (eo.length>0) { 256 | if (EasyCheck.ecss != "no" && EasyCheck.formEcss[formId] != "no") { 257 | if (!(o.attr("ecss") && o.attr("ecss") != "yes")) { 258 | o.removeClass(EasyCheck.errorCss); 259 | if (formId && EasyCheck.formErrorCss[formId]) { 260 | o.removeClass(EasyCheck.formErrorCss[formId]); 261 | } 262 | var domId=o.attr("id")||o.attr("name"); 263 | var oid=formId+"_"+domId; 264 | o.addClass(EasyCheck.txtClass[oid+"_class"]); 265 | 266 | } 267 | } 268 | eo.addClass("easycheck_okInfo"); 269 | if (msg) { 270 | eo.html(msg); 271 | } else { 272 | eo.html(""); 273 | } 274 | eo.hide(); 275 | 276 | 277 | var defDiv=$("[id='default_" + divSuf + "']"); 278 | $("[id='correct_" + divSuf + "']").hide(); 279 | EasyCheck.chkDef.showDef(defDiv,formId,divSuf ); 280 | 281 | } 282 | o.removeClass(EasyCheck.focusCss); 283 | if (formId && EasyCheck.formFocusCss[formId]) { 284 | o.removeClass(EasyCheck.formFocusCss[formId]); 285 | } 286 | 287 | var domId=o.attr("id")||o.attr("name"); 288 | var oid=formId+"_"+domId; 289 | o.addClass(EasyCheck.txtClass[oid+"_class"]); 290 | }, 291 | // 初始化Chk框 292 | initChk:function(chkrule, formId) { 293 | var area=''; 294 | if(formId){ 295 | area='#'+formId+' '; 296 | } 297 | var chkElements = EasyCheck.getMatches(chkrule.chkName); 298 | $(area+chkElements).each(function(){ 299 | var o=$(this); 300 | var formId = $("form").has(o).attr("id"); 301 | var domId=o.attr("id")||o.attr("name"); 302 | var oid=formId+"_"+domId; 303 | EasyCheck.txtClass[oid+"_class"]=$(this).attr("class"); 304 | EasyCheck.txtClass[oid+"_style"]=$(this).attr("style"); 305 | }); 306 | 307 | 308 | $(area+chkElements).on("blur change", function(e) { 309 | if (!EasyCheck.easyCheckBlurIgnore[chkrule.chkName] && !EasyCheck.easyCheckEleIgnore[e.target.id || e.target.name]) { 310 | if (!EasyCheck.easyCheckEleBlurIgnore[e.target.id || e.target.name]) { 311 | EasyCheck.blurChk ? EasyCheck.chk(this, e, chkrule.chkFunction) :""; 312 | } 313 | } 314 | }).on("focus", function(e) { 315 | if(!EasyCheck.resetOnFocus){ 316 | return; 317 | } 318 | EasyCheck.clearError(this); 319 | var o = $(this); 320 | var domId = o.attr("id") || o.attr("name"); 321 | var okDiv = $("[id='correct_" + domId + "']"); 322 | if (okDiv.length > 0) { 323 | if (okDiv.filter(":hidden").length > 0) { 324 | var defDiv = $("[id='default_" + domId + "']"); 325 | if (defDiv) { 326 | $("[id='correct_" + domId + "']").hide(); 327 | EasyCheck.chkDef.showDef(defDiv,$("form").has($(domId)).attr("id"),domId ); 328 | 329 | } 330 | } 331 | } else { 332 | var defDiv = $("[id='default_" + domId + "']"); 333 | if (defDiv) { 334 | $("[id='correct_" + domId + "']").hide(); 335 | EasyCheck.chkDef.showDef(defDiv,$("form").has($(domId)).attr("id"),domId ); 336 | } 337 | } 338 | var nowForm = $("form").has(o); 339 | var formId = nowForm.attr("id"); 340 | 341 | var formId = nowForm.attr("id"); 342 | if (formId && EasyCheck.formFocusCss[formId]) { 343 | o.addClass(EasyCheck.formFocusCss[formId]); 344 | } else { 345 | o.addClass(EasyCheck.focusCss); 346 | } 347 | }).on("keyup", function(e) { 348 | if (!EasyCheck.easyCheckKeyupIgnore[chkrule.chkName] && !EasyCheck.easyCheckEleIgnore[e.target.id || e.target.name]) { 349 | if (!EasyCheck.easyCheckEleKeyupIgnore[e.target.id || e.target.name]) { 350 | EasyCheck.keyupChk ? EasyCheck.chk(this, e, chkrule.chkFunction) :""; 351 | } 352 | } 353 | }); 354 | } 355 | } 356 | 357 | $(function(){ 358 | if(window.EasyCheck){ 359 | EasyCheck.errorMsg='
'+ 360 | '
{0}
'+ 361 | '
'+ 362 | '
'+ 363 | '
'; 364 | EasyCheck.correctMsg='
'+ 365 | '
{0}
'+ 366 | '
'+ 367 | '
'+ 368 | '
'; 369 | EasyCheck.defMsg='
'+ 370 | '
{0}
'+ 371 | '
'+ 372 | '
'+ 373 | '
'; 374 | 375 | //Manually initialize the default message to take effect 376 | EasyCheck.initDefMsg(); 377 | } 378 | }) 379 | 380 | 381 | --------------------------------------------------------------------------------