diff options
author | Tobias Diekershoff <tobias.diekershoff@gmx.net> | 2012-03-22 06:27:13 +0100 |
---|---|---|
committer | Tobias Diekershoff <tobias.diekershoff@gmx.net> | 2012-03-22 06:27:13 +0100 |
commit | 5189a56ef832e1c5c6976f87d77d218bf4a6c221 (patch) | |
tree | 4c1aa63a36eeaadab00c61eb05f3f9f5ae0da095 /library/tinymce/jscripts/tiny_mce/utils/validate.js | |
parent | 751e4181e5e875b9f9850700a3687774e4c53ab3 (diff) | |
parent | d81256d7b051d9a76b087feeb64ac79fb4aeff4d (diff) | |
download | volse-hubzilla-5189a56ef832e1c5c6976f87d77d218bf4a6c221.tar.gz volse-hubzilla-5189a56ef832e1c5c6976f87d77d218bf4a6c221.tar.bz2 volse-hubzilla-5189a56ef832e1c5c6976f87d77d218bf4a6c221.zip |
Merge branch 'master' of https://github.com/friendica/friendica
Diffstat (limited to 'library/tinymce/jscripts/tiny_mce/utils/validate.js')
-rw-r--r--[-rwxr-xr-x] | library/tinymce/jscripts/tiny_mce/utils/validate.js | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/library/tinymce/jscripts/tiny_mce/utils/validate.js b/library/tinymce/jscripts/tiny_mce/utils/validate.js index a6fcf9701..27cbfab81 100755..100644 --- a/library/tinymce/jscripts/tiny_mce/utils/validate.js +++ b/library/tinymce/jscripts/tiny_mce/utils/validate.js @@ -32,7 +32,7 @@ var Validator = { },
isSize : function(s) {
- return this.test(s, '^[0-9]+(%|in|cm|mm|em|ex|pt|pc|px)?$');
+ return this.test(s, '^[0-9.]+(%|in|cm|mm|em|ex|pt|pc|px)?$');
},
isId : function(s) {
@@ -96,8 +96,10 @@ var AutoValidator = { var i, nl, s = this.settings, c = 0;
nl = this.tags(f, 'label');
- for (i=0; i<nl.length; i++)
+ for (i=0; i<nl.length; i++) {
this.removeClass(nl[i], s.invalid_cls);
+ nl[i].setAttribute('aria-invalid', false);
+ }
c += this.validateElms(f, 'input');
c += this.validateElms(f, 'select');
@@ -109,6 +111,33 @@ var AutoValidator = { invalidate : function(n) {
this.mark(n.form, n);
},
+
+ getErrorMessages : function(f) {
+ var nl, i, s = this.settings, field, msg, values, messages = [], ed = tinyMCEPopup.editor;
+ nl = this.tags(f, "label");
+ for (i=0; i<nl.length; i++) {
+ if (this.hasClass(nl[i], s.invalid_cls)) {
+ field = document.getElementById(nl[i].getAttribute("for"));
+ values = { field: nl[i].textContent };
+ if (this.hasClass(field, s.min_cls, true)) {
+ message = ed.getLang('invalid_data_min');
+ values.min = this.getNum(field, s.min_cls);
+ } else if (this.hasClass(field, s.number_cls)) {
+ message = ed.getLang('invalid_data_number');
+ } else if (this.hasClass(field, s.size_cls)) {
+ message = ed.getLang('invalid_data_size');
+ } else {
+ message = ed.getLang('invalid_data');
+ }
+
+ message = message.replace(/{\#([^}]+)\}/g, function(a, b) {
+ return values[b] || '{#' + b + '}';
+ });
+ messages.push(message);
+ }
+ }
+ return messages;
+ },
reset : function(e) {
var t = ['label', 'input', 'select', 'textarea'];
@@ -119,8 +148,10 @@ var AutoValidator = { for (i=0; i<t.length; i++) {
nl = this.tags(e.form ? e.form : e, t[i]);
- for (j=0; j<nl.length; j++)
+ for (j=0; j<nl.length; j++) {
this.removeClass(nl[j], s.invalid_cls);
+ nl[j].setAttribute('aria-invalid', false);
+ }
}
},
@@ -201,6 +232,7 @@ var AutoValidator = { var s = this.settings;
this.addClass(n, s.invalid_cls);
+ n.setAttribute('aria-invalid', 'true');
this.markLabels(f, n, s.invalid_cls);
return false;
|