nette-forms
Advanced tools
Comparing version 3.0.6 to 3.1.0
{ | ||
"name": "nette-forms", | ||
"version": "3.0.6", | ||
"version": "3.1.0", | ||
"description": "Client side script for Nette Forms Component", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -34,6 +34,7 @@ /** | ||
var formToggles = {}; | ||
var toggleListeners = new WeakMap(); | ||
var toggleListeners = new window.WeakMap(); | ||
Nette.formErrors = []; | ||
Nette.version = '3.0'; | ||
Nette.invalidNumberMessage = 'Please enter a valid value.'; | ||
@@ -141,2 +142,3 @@ | ||
Nette.validateControl = function(elem, rules, onlyCheck, value, emptyOptional) { | ||
var top = !rules; | ||
elem = elem.tagName ? elem : elem[0]; // RadioNodeList | ||
@@ -191,4 +193,4 @@ rules = rules || JSON.parse(elem.getAttribute('data-nette-rules') || '[]'); | ||
if (elem.type === 'number' && !elem.validity.valid) { | ||
if (!onlyCheck) { | ||
Nette.addError(elem, 'Please enter a valid value.'); | ||
if (top && !onlyCheck) { | ||
Nette.addError(elem, Nette.invalidNumberMessage); | ||
} | ||
@@ -575,3 +577,3 @@ return false; | ||
*/ | ||
Nette.toggleForm = function(form, elem) { | ||
Nette.toggleForm = function(form, event) { | ||
var i; | ||
@@ -581,3 +583,3 @@ formToggles = {}; | ||
if (form.elements[i].tagName.toLowerCase() in {input: 1, select: 1, textarea: 1, button: 1}) { | ||
Nette.toggleControl(form.elements[i], null, null, !elem); | ||
Nette.toggleControl(form.elements[i], null, null, !event); | ||
} | ||
@@ -587,3 +589,3 @@ } | ||
for (i in formToggles) { | ||
Nette.toggle(i, formToggles[i], elem); | ||
Nette.toggle(i, formToggles[i].state, formToggles[i].elem, event); | ||
} | ||
@@ -602,4 +604,4 @@ }; | ||
var has = false, | ||
handler = function () { | ||
Nette.toggleForm(elem.form, elem); | ||
handler = function (e) { | ||
Nette.toggleForm(elem.form, e); | ||
}, | ||
@@ -650,6 +652,5 @@ curSuccess; | ||
} | ||
for (var id2 in rule.toggle || []) { | ||
if (Object.prototype.hasOwnProperty.call(rule.toggle, id2)) { | ||
formToggles[id2] = formToggles[id2] || (rule.toggle[id2] ? curSuccess : !curSuccess); | ||
} | ||
for (var toggleId in rule.toggle || []) { | ||
formToggles[toggleId] = formToggles[toggleId] || {elem: elem}; | ||
formToggles[toggleId].state = formToggles[toggleId].state || (rule.toggle[toggleId] ? curSuccess : !curSuccess); | ||
} | ||
@@ -665,3 +666,3 @@ } | ||
*/ | ||
Nette.toggle = function(selector, visible, srcElement) { // eslint-disable-line no-unused-vars | ||
Nette.toggle = function(selector, visible, srcElement, event) { // eslint-disable-line no-unused-vars | ||
if (/^\w[\w.:-]*$/.test(selector)) { // id | ||
@@ -668,0 +669,0 @@ selector = '#' + selector; |
/*! netteForms.js | (c) 2004 David Grudl (https://davidgrudl.com) */ | ||
(function(p,e){if(p.JSON)if("function"===typeof define&&define.amd)define(function(){return e(p)});else if("object"===typeof module&&"object"===typeof module.exports)module.exports=e(p);else{var t=!p.Nette||!p.Nette.noInit;p.Nette=e(p);t&&p.Nette.initOnLoad()}})("undefined"!==typeof window?window:this,function(p){var e={},t={},u={},x=new WeakMap;e.formErrors=[];e.version="3.0";e.onDocumentReady=function(a){"loading"!==document.readyState?a.call(this):document.addEventListener("DOMContentLoaded",a)}; | ||
e.getValue=function(a){var c;if(a){if(a.tagName){if("radio"===a.type){var b=a.form.elements;for(c=0;c<b.length;c++)if(b[c].name===a.name&&b[c].checked)return b[c].value;return null}if("file"===a.type)return a.files||a.value;if("select"===a.tagName.toLowerCase()){c=a.selectedIndex;b=a.options;var d=[];if("select-one"===a.type)return 0>c?null:b[c].value;for(c=0;c<b.length;c++)b[c].selected&&d.push(b[c].value);return d}if(a.name&&"[]"===a.name.substr(-2)){b=a.form.elements[a.name].tagName?[a]:a.form.elements[a.name]; | ||
d=[];for(c=0;c<b.length;c++)("checkbox"!==b[c].type||b[c].checked)&&d.push(b[c].value);return d}return"checkbox"===a.type?a.checked:"textarea"===a.tagName.toLowerCase()?a.value.replace("\r",""):a.value.replace("\r","").replace(/^\s+|\s+$/g,"")}return a[0]?e.getValue(a[0]):null}return null};e.getEffectiveValue=function(a,c){var b=e.getValue(a);a.getAttribute&&b===a.getAttribute("data-nette-empty-value")&&(b="");c&&void 0===t[a.name]&&(t[a.name]=!0,b={value:b},e.validateControl(a,null,!0,b),b=b.value, | ||
delete t[a.name]);return b};e.validateControl=function(a,c,b,d,f){a=a.tagName?a:a[0];c=c||JSON.parse(a.getAttribute("data-nette-rules")||"[]");d=void 0===d?{value:e.getEffectiveValue(a)}:d;f=void 0===f?!e.validateRule(a,":filled",null,d):f;for(var g=0,k=c.length;g<k;g++){var h=c[g],l=h.op.match(/(~)?([^?]+)/),q=h.control?a.form.elements.namedItem(h.control):a;h.neg=l[1];h.op=l[2];h.condition=!!h.rules;if(q&&(!f||h.condition||":filled"===h.op)&&(q=q.tagName?q:q[0],l=e.validateRule(q,h.op,h.arg,a=== | ||
q?d:void 0),null!==l))if(h.neg&&(l=!l),h.condition&&l){if(!e.validateControl(a,h.rules,b,d,":blank"===h.op?!1:f))return!1}else if(!h.condition&&!l&&!e.isDisabled(q)){if(!b){var w=Array.isArray(h.arg)?h.arg:[h.arg];c=h.msg.replace(/%(value|\d+)/g,function(m,n){return e.getValue("value"===n?q:a.form.elements.namedItem(w[n].control))});e.addError(q,c)}return!1}}return"number"!==a.type||a.validity.valid?!0:(b||e.addError(a,"Please enter a valid value."),!1)};e.validateForm=function(a,c){var b=a.form|| | ||
a,d=!1;e.formErrors=[];if(b["nette-submittedBy"]&&null!==b["nette-submittedBy"].getAttribute("formnovalidate"))if(d=JSON.parse(b["nette-submittedBy"].getAttribute("data-nette-validation-scope")||"[]"),d.length)d=new RegExp("^("+d.join("-|")+"-)");else return e.showFormErrors(b,[]),!0;var f={},g;for(g=0;g<b.elements.length;g++){var k=b.elements[g];if(!k.tagName||k.tagName.toLowerCase()in{input:1,select:1,textarea:1,button:1}){if("radio"===k.type){if(f[k.name])continue;f[k.name]=!0}if(!(d&&!k.name.replace(/]\[|\[|]|$/g, | ||
"-").match(d)||e.isDisabled(k)||e.validateControl(k,null,c)||e.formErrors.length))return!1}}d=!e.formErrors.length;e.showFormErrors(b,e.formErrors);return d};e.isDisabled=function(a){if("radio"===a.type){for(var c=0,b=a.form.elements;c<b.length;c++)if(b[c].name===a.name&&!b[c].disabled)return!1;return!0}return a.disabled};e.addError=function(a,c){e.formErrors.push({element:a,message:c})};e.showFormErrors=function(a,c){for(var b=[],d,f=0;f<c.length;f++){var g=c[f].element,k=c[f].message;0>b.indexOf(k)&& | ||
(b.push(k),!d&&g.focus&&(d=g))}b.length&&(alert(b.join("\n")),d&&d.focus())};e.validateRule=function(a,c,b,d){d=void 0===d?{value:e.getEffectiveValue(a,!0)}:d;":"===c.charAt(0)&&(c=c.substr(1));c=c.replace("::","_");c=c.replace(/\\/g,"");for(var f=Array.isArray(b)?b.slice(0):[b],g=0,k=f.length;g<k;g++)if(f[g]&&f[g].control){var h=a.form.elements.namedItem(f[g].control);f[g]=h===a?d.value:e.getEffectiveValue(h,!0)}return e.validators[c]?e.validators[c](a,Array.isArray(b)?f:f[0],d.value,d):null};e.validators= | ||
{filled:function(a,c,b){return"number"===a.type&&a.validity.badInput?!0:""!==b&&!1!==b&&null!==b&&(!Array.isArray(b)||!!b.length)&&(!p.FileList||!(b instanceof p.FileList)||b.length)},blank:function(a,c,b){return!e.validators.filled(a,c,b)},valid:function(a){return e.validateControl(a,null,!0)},equal:function(a,c,b){function d(h){return"number"===typeof h||"string"===typeof h?""+h:!0===h?"1":""}if(void 0===c)return null;b=Array.isArray(b)?b:[b];c=Array.isArray(c)?c:[c];a=0;var f=b.length;a:for(;a< | ||
f;a++){for(var g=0,k=c.length;g<k;g++)if(d(b[a])===d(c[g]))continue a;return!1}return!0},notEqual:function(a,c,b){return void 0===c?null:!e.validators.equal(a,c,b)},minLength:function(a,c,b){if("number"===a.type){if(a.validity.tooShort)return!1;if(a.validity.badInput)return null}return b.length>=c},maxLength:function(a,c,b){if("number"===a.type){if(a.validity.tooLong)return!1;if(a.validity.badInput)return null}return b.length<=c},length:function(a,c,b){if("number"===a.type){if(a.validity.tooShort|| | ||
a.validity.tooLong)return!1;if(a.validity.badInput)return null}c=Array.isArray(c)?c:[c,c];return(null===c[0]||b.length>=c[0])&&(null===c[1]||b.length<=c[1])},email:function(a,c,b){return/^("([ !#-[\]-~]|\\[ -~])+"|[-a-z0-9!#$%&'*+/=?^_`{|}~]+(\.[-a-z0-9!#$%&'*+/=?^_`{|}~]+)*)@([0-9a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,61}[0-9a-z\u00C0-\u02FF\u0370-\u1EFF])?\.)+[a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,17}[a-z\u00C0-\u02FF\u0370-\u1EFF])?$/i.test(b)}, | ||
(function(n,e){if(n.JSON)if("function"===typeof define&&define.amd)define(function(){return e(n)});else if("object"===typeof module&&"object"===typeof module.exports)module.exports=e(n);else{var v=!n.Nette||!n.Nette.noInit;n.Nette=e(n);v&&n.Nette.initOnLoad()}})("undefined"!==typeof window?window:this,function(n){var e={},v={},t={},y=new n.WeakMap;e.formErrors=[];e.version="3.0";e.invalidNumberMessage="Please enter a valid value.";e.onDocumentReady=function(a){"loading"!==document.readyState?a.call(this): | ||
document.addEventListener("DOMContentLoaded",a)};e.getValue=function(a){var c;if(a){if(a.tagName){if("radio"===a.type){var b=a.form.elements;for(c=0;c<b.length;c++)if(b[c].name===a.name&&b[c].checked)return b[c].value;return null}if("file"===a.type)return a.files||a.value;if("select"===a.tagName.toLowerCase()){c=a.selectedIndex;b=a.options;var d=[];if("select-one"===a.type)return 0>c?null:b[c].value;for(c=0;c<b.length;c++)b[c].selected&&d.push(b[c].value);return d}if(a.name&&"[]"===a.name.substr(-2)){b= | ||
a.form.elements[a.name].tagName?[a]:a.form.elements[a.name];d=[];for(c=0;c<b.length;c++)("checkbox"!==b[c].type||b[c].checked)&&d.push(b[c].value);return d}return"checkbox"===a.type?a.checked:"textarea"===a.tagName.toLowerCase()?a.value.replace("\r",""):a.value.replace("\r","").replace(/^\s+|\s+$/g,"")}return a[0]?e.getValue(a[0]):null}return null};e.getEffectiveValue=function(a,c){var b=e.getValue(a);a.getAttribute&&b===a.getAttribute("data-nette-empty-value")&&(b="");c&&void 0===v[a.name]&&(v[a.name]= | ||
!0,b={value:b},e.validateControl(a,null,!0,b),b=b.value,delete v[a.name]);return b};e.validateControl=function(a,c,b,d,f){var g=!c;a=a.tagName?a:a[0];c=c||JSON.parse(a.getAttribute("data-nette-rules")||"[]");d=void 0===d?{value:e.getEffectiveValue(a)}:d;f=void 0===f?!e.validateRule(a,":filled",null,d):f;for(var k=0,r=c.length;k<r;k++){var h=c[k],p=h.op.match(/(~)?([^?]+)/),q=h.control?a.form.elements.namedItem(h.control):a;h.neg=p[1];h.op=p[2];h.condition=!!h.rules;if(q&&(!f||h.condition||":filled"=== | ||
h.op)&&(q=q.tagName?q:q[0],p=e.validateRule(q,h.op,h.arg,a===q?d:void 0),null!==p))if(h.neg&&(p=!p),h.condition&&p){if(!e.validateControl(a,h.rules,b,d,":blank"===h.op?!1:f))return!1}else if(!h.condition&&!p&&!e.isDisabled(q)){if(!b){var l=Array.isArray(h.arg)?h.arg:[h.arg];c=h.msg.replace(/%(value|\d+)/g,function(m,x){return e.getValue("value"===x?q:a.form.elements.namedItem(l[x].control))});e.addError(q,c)}return!1}}return"number"!==a.type||a.validity.valid?!0:(g&&!b&&e.addError(a,e.invalidNumberMessage), | ||
!1)};e.validateForm=function(a,c){var b=a.form||a,d=!1;e.formErrors=[];if(b["nette-submittedBy"]&&null!==b["nette-submittedBy"].getAttribute("formnovalidate"))if(d=JSON.parse(b["nette-submittedBy"].getAttribute("data-nette-validation-scope")||"[]"),d.length)d=new RegExp("^("+d.join("-|")+"-)");else return e.showFormErrors(b,[]),!0;var f={},g;for(g=0;g<b.elements.length;g++){var k=b.elements[g];if(!k.tagName||k.tagName.toLowerCase()in{input:1,select:1,textarea:1,button:1}){if("radio"===k.type){if(f[k.name])continue; | ||
f[k.name]=!0}if(!(d&&!k.name.replace(/]\[|\[|]|$/g,"-").match(d)||e.isDisabled(k)||e.validateControl(k,null,c)||e.formErrors.length))return!1}}d=!e.formErrors.length;e.showFormErrors(b,e.formErrors);return d};e.isDisabled=function(a){if("radio"===a.type){for(var c=0,b=a.form.elements;c<b.length;c++)if(b[c].name===a.name&&!b[c].disabled)return!1;return!0}return a.disabled};e.addError=function(a,c){e.formErrors.push({element:a,message:c})};e.showFormErrors=function(a,c){for(var b=[],d,f=0;f<c.length;f++){var g= | ||
c[f].element,k=c[f].message;0>b.indexOf(k)&&(b.push(k),!d&&g.focus&&(d=g))}b.length&&(alert(b.join("\n")),d&&d.focus())};e.validateRule=function(a,c,b,d){d=void 0===d?{value:e.getEffectiveValue(a,!0)}:d;":"===c.charAt(0)&&(c=c.substr(1));c=c.replace("::","_");c=c.replace(/\\/g,"");for(var f=Array.isArray(b)?b.slice(0):[b],g=0,k=f.length;g<k;g++)if(f[g]&&f[g].control){var r=a.form.elements.namedItem(f[g].control);f[g]=r===a?d.value:e.getEffectiveValue(r,!0)}return e.validators[c]?e.validators[c](a, | ||
Array.isArray(b)?f:f[0],d.value,d):null};e.validators={filled:function(a,c,b){return"number"===a.type&&a.validity.badInput?!0:""!==b&&!1!==b&&null!==b&&(!Array.isArray(b)||!!b.length)&&(!n.FileList||!(b instanceof n.FileList)||b.length)},blank:function(a,c,b){return!e.validators.filled(a,c,b)},valid:function(a){return e.validateControl(a,null,!0)},equal:function(a,c,b){function d(r){return"number"===typeof r||"string"===typeof r?""+r:!0===r?"1":""}if(void 0===c)return null;b=Array.isArray(b)?b:[b]; | ||
c=Array.isArray(c)?c:[c];a=0;var f=b.length;a:for(;a<f;a++){for(var g=0,k=c.length;g<k;g++)if(d(b[a])===d(c[g]))continue a;return!1}return!0},notEqual:function(a,c,b){return void 0===c?null:!e.validators.equal(a,c,b)},minLength:function(a,c,b){if("number"===a.type){if(a.validity.tooShort)return!1;if(a.validity.badInput)return null}return b.length>=c},maxLength:function(a,c,b){if("number"===a.type){if(a.validity.tooLong)return!1;if(a.validity.badInput)return null}return b.length<=c},length:function(a, | ||
c,b){if("number"===a.type){if(a.validity.tooShort||a.validity.tooLong)return!1;if(a.validity.badInput)return null}c=Array.isArray(c)?c:[c,c];return(null===c[0]||b.length>=c[0])&&(null===c[1]||b.length<=c[1])},email:function(a,c,b){return/^("([ !#-[\]-~]|\\[ -~])+"|[-a-z0-9!#$%&'*+/=?^_`{|}~]+(\.[-a-z0-9!#$%&'*+/=?^_`{|}~]+)*)@([0-9a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,61}[0-9a-z\u00C0-\u02FF\u0370-\u1EFF])?\.)+[a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,17}[a-z\u00C0-\u02FF\u0370-\u1EFF])?$/i.test(b)}, | ||
url:function(a,c,b,d){/^[a-z\d+.-]+:/.test(b)||(b="http://"+b);return/^https?:\/\/((([-_0-9a-z\u00C0-\u02FF\u0370-\u1EFF]+\.)*[0-9a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,61}[0-9a-z\u00C0-\u02FF\u0370-\u1EFF])?\.)?[a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,17}[a-z\u00C0-\u02FF\u0370-\u1EFF])?|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\[[0-9a-f:]{3,39}\])(:\d{1,5})?(\/\S*)?$/i.test(b)?(d.value=b,!0):!1},regexp:function(a,c,b){a="string"===typeof c?c.match(/^\/(.*)\/([imu]*)$/): | ||
!1;try{return a&&(new RegExp(a[1],a[2].replace("u",""))).test(b)}catch(d){}},pattern:function(a,c,b,d,f){if("string"!==typeof c)return null;try{try{var g=new RegExp("^(?:"+c+")$",f?"ui":"u")}catch(k){g=new RegExp("^(?:"+c+")$",f?"i":"")}if(p.FileList&&b instanceof FileList){for(a=0;a<b.length;a++)if(!g.test(b[a].name))return!1;return!0}return g.test(b)}catch(k){}},patternCaseInsensitive:function(a,c,b){return e.validators.pattern(a,c,b,null,!0)},numeric:function(a,c,b){return"number"===a.type&&a.validity.badInput? | ||
!1;try{return a&&(new RegExp(a[1],a[2].replace("u",""))).test(b)}catch(d){}},pattern:function(a,c,b,d,f){if("string"!==typeof c)return null;try{try{var g=new RegExp("^(?:"+c+")$",f?"ui":"u")}catch(k){g=new RegExp("^(?:"+c+")$",f?"i":"")}if(n.FileList&&b instanceof FileList){for(a=0;a<b.length;a++)if(!g.test(b[a].name))return!1;return!0}return g.test(b)}catch(k){}},patternCaseInsensitive:function(a,c,b){return e.validators.pattern(a,c,b,null,!0)},numeric:function(a,c,b){return"number"===a.type&&a.validity.badInput? | ||
!1:/^[0-9]+$/.test(b)},integer:function(a,c,b){return"number"===a.type&&a.validity.badInput?!1:/^-?[0-9]+$/.test(b)},"float":function(a,c,b,d){if("number"===a.type&&a.validity.badInput)return!1;b=b.replace(/ +/g,"").replace(/,/g,".");return/^-?[0-9]*\.?[0-9]+$/.test(b)?(d.value=b,!0):!1},min:function(a,c,b){if("number"===a.type){if(a.validity.rangeUnderflow)return!1;if(a.validity.badInput)return null}return null===c||parseFloat(b)>=c},max:function(a,c,b){if("number"===a.type){if(a.validity.rangeOverflow)return!1; | ||
if(a.validity.badInput)return null}return null===c||parseFloat(b)<=c},range:function(a,c,b){if("number"===a.type){if(a.validity.rangeUnderflow||a.validity.rangeOverflow)return!1;if(a.validity.badInput)return null}return Array.isArray(c)?(null===c[0]||parseFloat(b)>=c[0])&&(null===c[1]||parseFloat(b)<=c[1]):null},submitted:function(a){return a.form["nette-submittedBy"]===a},fileSize:function(a,c,b){if(p.FileList)for(a=0;a<b.length;a++)if(b[a].size>c)return!1;return!0},mimeType:function(a,c,b){c=Array.isArray(c)? | ||
c:[c];for(var d=0,f=c.length,g=[];d<f;d++)g.push("^"+c[d].replace(/([^\w])/g,"\\$1").replace("\\*",".*")+"$");g=new RegExp(g.join("|"));if(p.FileList&&b instanceof FileList)for(d=0;d<b.length;d++){if(b[d].type&&!g.test(b[d].type))return!1;if(a.validity.badInput)return null}return!0},image:function(a,c,b){return e.validators.mimeType(a,["image/gif","image/png","image/jpeg","image/webp"],b)},"static":function(a,c){return c}};e.toggleForm=function(a,c){var b;u={};for(b=0;b<a.elements.length;b++)a.elements[b].tagName.toLowerCase()in | ||
{input:1,select:1,textarea:1,button:1}&&e.toggleControl(a.elements[b],null,null,!c);for(b in u)e.toggle(b,u[b],c)};e.toggleControl=function(a,c,b,d,f,g){c=c||JSON.parse(a.getAttribute("data-nette-rules")||"[]");f=void 0===f?{value:e.getEffectiveValue(a)}:f;g=void 0===g?!e.validateRule(a,":filled",null,f):g;for(var k=!1,h=function(){e.toggleForm(a.form,a)},l,q=0,w=c.length;q<w;q++){var m=c[q];l=m.op.match(/(~)?([^?]+)/);var n=m.control?a.form.elements.namedItem(m.control):a;m.neg=l[1];m.op=l[2];m.condition= | ||
!!m.rules;if(n&&(!g||m.condition||":filled"===m.op)){l=b;if(!1!==b){l=e.validateRule(n,m.op,m.arg,a===n?f:void 0);if(null===l)continue;else m.neg&&(l=!l);m.condition||(b=l)}if(m.condition&&e.toggleControl(a,m.rules,l,d,f,":blank"===m.op?!1:g)||m.toggle){k=!0;if(d){var y=n.tagName?n.name:n[0].name;n=n.tagName?n.form.elements:n;for(var r=0;r<n.length;r++)n[r].name!==y||x.has(n[r])||(n[r].addEventListener("change",h),x.set(n[r],null))}for(var v in m.toggle||[])Object.prototype.hasOwnProperty.call(m.toggle, | ||
v)&&(u[v]=u[v]||(m.toggle[v]?l:!l))}}}return k};e.toggle=function(a,c,b){/^\w[\w.:-]*$/.test(a)&&(a="#"+a);a=document.querySelectorAll(a);for(b=0;b<a.length;b++)a[b].hidden=!c};e.compactCheckboxes=function(a){var c,b={};for(c=0;c<a.elements.length;c++){var d=a.elements[c];if(d.tagName&&"input"===d.tagName.toLowerCase()&&"checkbox"===d.type){if(d.name&&"[]"===d.name.substr(-2)){var f=d.name.substr(0,d.name.length-2);d.removeAttribute("name");d.setAttribute("data-nette-name",f)}if(f=d.getAttribute("data-nette-name"))b[f]= | ||
if(a.validity.badInput)return null}return null===c||parseFloat(b)<=c},range:function(a,c,b){if("number"===a.type){if(a.validity.rangeUnderflow||a.validity.rangeOverflow)return!1;if(a.validity.badInput)return null}return Array.isArray(c)?(null===c[0]||parseFloat(b)>=c[0])&&(null===c[1]||parseFloat(b)<=c[1]):null},submitted:function(a){return a.form["nette-submittedBy"]===a},fileSize:function(a,c,b){if(n.FileList)for(a=0;a<b.length;a++)if(b[a].size>c)return!1;return!0},mimeType:function(a,c,b){c=Array.isArray(c)? | ||
c:[c];for(var d=0,f=c.length,g=[];d<f;d++)g.push("^"+c[d].replace(/([^\w])/g,"\\$1").replace("\\*",".*")+"$");g=new RegExp(g.join("|"));if(n.FileList&&b instanceof FileList)for(d=0;d<b.length;d++){if(b[d].type&&!g.test(b[d].type))return!1;if(a.validity.badInput)return null}return!0},image:function(a,c,b){return e.validators.mimeType(a,["image/gif","image/png","image/jpeg","image/webp"],b)},"static":function(a,c){return c}};e.toggleForm=function(a,c){var b;t={};for(b=0;b<a.elements.length;b++)a.elements[b].tagName.toLowerCase()in | ||
{input:1,select:1,textarea:1,button:1}&&e.toggleControl(a.elements[b],null,null,!c);for(b in t)e.toggle(b,t[b].state,t[b].elem,c)};e.toggleControl=function(a,c,b,d,f,g){c=c||JSON.parse(a.getAttribute("data-nette-rules")||"[]");f=void 0===f?{value:e.getEffectiveValue(a)}:f;g=void 0===g?!e.validateRule(a,":filled",null,f):g;for(var k=!1,r=function(z){e.toggleForm(a.form,z)},h,p=0,q=c.length;p<q;p++){var l=c[p];h=l.op.match(/(~)?([^?]+)/);var m=l.control?a.form.elements.namedItem(l.control):a;l.neg= | ||
h[1];l.op=h[2];l.condition=!!l.rules;if(m&&(!g||l.condition||":filled"===l.op)){h=b;if(!1!==b){h=e.validateRule(m,l.op,l.arg,a===m?f:void 0);if(null===h)continue;else l.neg&&(h=!h);l.condition||(b=h)}if(l.condition&&e.toggleControl(a,l.rules,h,d,f,":blank"===l.op?!1:g)||l.toggle){k=!0;if(d){var x=m.tagName?m.name:m[0].name;m=m.tagName?m.form.elements:m;for(var u=0;u<m.length;u++)m[u].name!==x||y.has(m[u])||(m[u].addEventListener("change",r),y.set(m[u],null))}for(var w in l.toggle||[])t[w]=t[w]||{elem:a}, | ||
t[w].state=t[w].state||(l.toggle[w]?h:!h)}}}return k};e.toggle=function(a,c,b,d){/^\w[\w.:-]*$/.test(a)&&(a="#"+a);a=document.querySelectorAll(a);for(b=0;b<a.length;b++)a[b].hidden=!c};e.compactCheckboxes=function(a){var c,b={};for(c=0;c<a.elements.length;c++){var d=a.elements[c];if(d.tagName&&"input"===d.tagName.toLowerCase()&&"checkbox"===d.type){if(d.name&&"[]"===d.name.substr(-2)){var f=d.name.substr(0,d.name.length-2);d.removeAttribute("name");d.setAttribute("data-nette-name",f)}if(f=d.getAttribute("data-nette-name"))b[f]= | ||
b[f]||[],d.checked&&!d.disabled&&b[f].push(d.value)}}for(f in b)void 0===a.elements[f]&&(d=document.createElement("input"),d.setAttribute("name",f),d.setAttribute("type","hidden"),a.appendChild(d)),a.elements[f].value=b[f].join(","),a.elements[f].disabled=0===b[f].length};e.initForm=function(a){"get"===a.method&&a.hasAttribute("data-nette-compact")&&a.addEventListener("submit",function(){e.compactCheckboxes(a)});a:{for(var c=0;c<a.elements.length;c++)if(a.elements[c].getAttribute("data-nette-rules"))break a; | ||
return}e.toggleForm(a);a.noValidate||(a.noValidate=!0,a.addEventListener("submit",function(b){e.validateForm(a)||(b.stopPropagation(),b.preventDefault())}))};e.initOnLoad=function(){e.onDocumentReady(function(){for(var a=0;a<document.forms.length;a++)e.initForm(document.forms[a]);document.body.addEventListener("click",function(c){for(c=c.target;c;){if(c.form&&c.type in{submit:1,image:1}){c.form["nette-submittedBy"]=c;break}c=c.parentNode}})})};e.webalize=function(a){a=a.toLowerCase();var c="",b;for(b= | ||
0;b<a.length;b++){var d=e.webalizeTable[a.charAt(b)];c+=d?d:a.charAt(b)}return c.replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")};e.webalizeTable={"\u00e1":"a","\u00e4":"a","\u010d":"c","\u010f":"d","\u00e9":"e","\u011b":"e","\u00ed":"i","\u013e":"l","\u0148":"n","\u00f3":"o","\u00f4":"o","\u0159":"r","\u0161":"s","\u0165":"t","\u00fa":"u","\u016f":"u","\u00fd":"y","\u017e":"z"};return e}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39288
714