芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/media.8/system/js/fields/validate-es5.min.js
!function(){"use strict";function e(e,t){for(var r=0;r
e.length)&&(t=e.length);for(var r=0,a=new Array(t);r
=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a=2147483647,n=36,i=/[^\0-\x7E]/,s=/[\x2E\u3002\uFF0E\uFF61]/g,o={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},l=Math.floor,c=String.fromCharCode;function u(e){throw new RangeError(o[e])}function d(e,t){var r=e.split("@"),a="";r.length>1&&(a=r[0]+"@",e=r[1]);var n=function(e,t){for(var r=[],a=e.length;a--;)r[a]=t(e[a]);return r}((e=e.replace(s,".")).split("."),t).join(".");return a+n}function v(e){for(var t=[],r=0,a=e.length;r
=55296&&n<=56319&&r
>1,e+=l(e/t);e>455;a+=n)e=l(e/35);return l(a+36*e/(e+38))},m=function(e){for(var t,i=[],s=(e=v(e)).length,o=128,d=0,m=72,p=r(e);!(t=p()).done;){var b=t.value;b<128&&i.push(c(b))}var g=i.length,L=g;for(g&&i.push("-");L
=o&&x
l((a-d)/k)&&u("overflow"),d+=(y-o)*k,o=y;for(var _,I=r(e);!(_=I()).done;){var R=_.value;if(R
a&&u("overflow"),R==o){for(var S=d,q=n;;q+=n){var w=q<=m?1:q>=m+26?26:q-m;if(S
|\"|'|%|;|(|)|&]","i").test(e)})),this.setHandler("password",(function(e){return/^\S[\S ]{2,98}\S$/.test(e)})),this.setHandler("numeric",(function(e){return/^(\d|-)?(\d|,)*\.?\d*$/.test(e)})),this.setHandler("email",(function(e){var t=p(e);return/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(t)})),[].slice.call(document.querySelectorAll("form")).forEach((function(t){t.classList.contains("form-validate")&&e.attachToForm(t)}))}var r,a,n,i=t.prototype;return i.setHandler=function(e,t,r){var a=""===r||r;this.handlers[e]={enabled:a,exec:t}},i.markValid=function(e){var t,r=e.form.querySelector('label[for="'+e.id+'"]');(e.classList.contains("required")||e.getAttribute("required"))&&r&&(t=r.querySelector("span.form-control-feedback")),e.classList.remove("form-control-danger"),e.classList.remove("invalid"),e.classList.add("form-control-success"),e.parentNode.classList.remove("has-danger"),e.parentNode.classList.add("has-success"),e.setAttribute("aria-invalid","false"),t&&t.parentNode.removeChild(t),r&&r.classList.remove("invalid")},i.markInvalid=function(e,t){var r,a=e.form.querySelector('label[for="'+e.id+'"]');e.classList.remove("form-control-success"),e.classList.remove("valid"),e.classList.add("form-control-danger"),e.classList.add("invalid"),e.parentNode.classList.remove("has-success"),e.parentNode.classList.add("has-danger"),e.setAttribute("aria-invalid","true");var n=e.getAttribute("data-validation-text");if(a&&(r=a.querySelector("span.form-control-feedback")),!r){var i=document.createElement("span");i.classList.add("form-control-feedback"),i.innerHTML=t&&"checkbox"===t?null!==n?Joomla.sanitizeHtml(n):Joomla.sanitizeHtml(Joomla.Text._("JLIB_FORM_FIELD_REQUIRED_CHECK")):t&&"value"===t?null!==n?Joomla.sanitizeHtml(n):Joomla.sanitizeHtml(Joomla.Text._("JLIB_FORM_FIELD_REQUIRED_VALUE")):null!==n?Joomla.sanitizeHtml(n):Joomla.sanitizeHtml(Joomla.Text._("JLIB_FORM_FIELD_INVALID_VALUE")),a&&a.appendChild(i)}a&&a.classList.add("invalid")},i.removeMarking=function(e){var t,r=e.form.querySelector('label[for="'+e.id+'"]');r&&(t=r.querySelector("span.form-control-feedback")),e.classList.remove("form-control-danger"),e.classList.remove("form-control-success"),e.classList.remove("invalid"),e.classList.add("valid"),e.parentNode.classList.remove("has-danger"),e.parentNode.classList.remove("has-success"),t&&r&&r.removeChild(t),r&&r.classList.remove("invalid")},i.handleResponse=function(e,t,r){var a=t.tagName.toLowerCase();("button"!==a&&void 0!==t.value||"fieldset"===a)&&(!1===e?this.markInvalid(t,r):this.markValid(t))},i.validate=function(e){var t;if("disabled"===e.getAttribute("disabled")||"none"===e.getAttribute("display"))return this.handleResponse(!0,e),!0;if(e.getAttribute("required")||e.classList.contains("required"))if("fieldset"===(t=e.tagName.toLowerCase())&&(e.classList.contains("radio")||e.classList.contains("checkboxes"))){if(null===e.querySelector("input:checked"))return this.handleResponse(!1,e,"checkbox"),!1}else{if("checkbox"===e.getAttribute("type")&&!0!==e.checked||"select"===t&&!e.value.length)return this.handleResponse(!1,e,"checkbox"),!1;if(!e.value||e.classList.contains("placeholder"))return this.handleResponse(!1,e,"value"),!1}var r=e.getAttribute("class")&&e.getAttribute("class").match(/validate-([a-zA-Z0-9_-]+)/)?e.getAttribute("class").match(/validate-([a-zA-Z0-9_-]+)/)[1]:"";if(e.getAttribute("pattern")&&""!==e.getAttribute("pattern")){if(e.value.length){var a=new RegExp("^"+e.getAttribute("pattern")+"$").test(e.value);return this.handleResponse(a,e,"empty"),a}return e.hasAttribute("required")||e.classList.contains("required")?(this.handleResponse(!1,e,"empty"),!1):(this.handleResponse(!0,e),!0)}return""===r?(this.handleResponse(!0,e),!0):r&&"none"!==r&&this.handlers[r]&&e.value&&!0!==this.handlers[r].exec(e.value,e)?(this.handleResponse(!1,e,"invalid_value"),!1):(this.handleResponse(!0,e),!0)},i.isValid=function(e){var t,r=this,a=!0,n=[];return[].slice.call(e.querySelectorAll("input, textarea, select, button, fieldset")).forEach((function(e){!1===r.validate(e)&&(a=!1,n.push(e))})),Object.keys(this.customValidators).length&&Object.keys(this.customValidators).foreach((function(e){!0!==r.customValidators[e].exec()&&(a=!1)})),!a&&n.length>0&&(t={error:[e.getAttribute("data-validation-text")?e.getAttribute("data-validation-text"):Joomla.Text._("JLIB_FORM_CONTAINS_INVALID_FIELDS")]},Joomla.renderMessages(t)),a},i.attachToForm=function(e){var t=this;[].slice.call(e.querySelectorAll("input, textarea, select, button, fieldset")).forEach((function(r){var a=r.tagName.toLowerCase();["input","textarea","select","fieldset"].indexOf(a)>-1&&r.classList.contains("required")&&r.setAttribute("required",""),"input"!==a&&"button"!==a||"submit"!==r.getAttribute("type")&&"image"!==r.getAttribute("type")?"button"===a||"input"===a&&"button"===r.getAttribute("type")||"fieldset"!==a&&(r.addEventListener("blur",(function(e){var r=e.target;return t.validate(r)})),r.addEventListener("focus",(function(e){var r=e.target;return t.removeMarking(r)})),r.classList.contains("validate-email")&&t.inputEmail&&r.setAttribute("type","email")):r.classList.contains("validate")&&r.addEventListener("click",(function(){return t.isValid(e)}))}))},r=t,(a=[{key:"custom",get:function(){return this.customValidators},set:function(e){this.customValidators=e}}])&&e(r.prototype,a),n&&e(r,n),t}();document.addEventListener("DOMContentLoaded",(function e(){document.formvalidator=new b,document.removeEventListener("DOMContentLoaded",e)}))}();