File manager - Edit - /home/asiatechinc/public_html/asiatech-websites/vedaaweddingpartys.com/js/validator.js
Back
!function(t){"use strict";function e(e){return e.is('[type="checkbox"]')?e.prop("checked"):e.is('[type="radio"]')?!!t('[name="'+e.attr("name")+'"]:checked').length:e.val()}var r=function(a,i){this.options=i,this.validators=t.extend({},r.VALIDATORS,i.custom),this.$element=t(a),this.$btn=t('button[type="submit"], input[type="submit"]').filter('[form="'+this.$element.attr("id")+'"]').add(this.$element.find('input[type="submit"], button[type="submit"]')),this.update(),this.$element.on("input.bs.validator change.bs.validator focusout.bs.validator",t.proxy(this.onInput,this)),this.$element.on("submit.bs.validator",t.proxy(this.onSubmit,this)),this.$element.on("reset.bs.validator",t.proxy(this.reset,this)),this.$element.find("[data-match]").each(function(){var r=t(this),a=r.data("match");t(a).on("input.bs.validator",function(t){e(r)&&r.trigger("input.bs.validator")})}),this.$inputs.filter(function(){return e(t(this))}).trigger("focusout"),this.$element.attr("novalidate",!0),this.toggleSubmit()};function a(e){return this.each(function(){var a=t(this),i=t.extend({},r.DEFAULTS,a.data(),"object"==typeof e&&e),o=a.data("bs.validator");(o||"destroy"!=e)&&(o||a.data("bs.validator",o=new r(this,i)),"string"==typeof e&&o[e]())})}r.VERSION="0.11.5",r.INPUT_SELECTOR=':input:not([type="hidden"], [type="submit"], [type="reset"], button)',r.FOCUS_OFFSET=20,r.DEFAULTS={delay:500,html:!1,disable:!0,focus:!0,custom:{},errors:{match:"Does not match",minlength:"Not long enough"},feedback:{success:"glyphicon-ok",error:"glyphicon-remove"}},r.VALIDATORS={native:function(t){var e=t[0];if(e.checkValidity)return!e.checkValidity()&&!e.validity.valid&&(e.validationMessage||"error!")},match:function(e){var a=e.data("match");return e.val()!==t(a).val()&&r.DEFAULTS.errors.match},minlength:function(t){var e=t.data("minlength");return t.val().length<e&&r.DEFAULTS.errors.minlength}},r.prototype.update=function(){return this.$inputs=this.$element.find(r.INPUT_SELECTOR).add(this.$element.find('[data-validate="true"]')).not(this.$element.find('[data-validate="false"]')),this},r.prototype.onInput=function(e){var r=this,a=t(e.target),i="focusout"!==e.type;this.$inputs.is(a)&&this.validateInput(a,i).done(function(){r.toggleSubmit()})},r.prototype.validateInput=function(r,a){e(r);var i=r.data("bs.validator.errors");r.is('[type="radio"]')&&(r=this.$element.find('input[name="'+r.attr("name")+'"]'));var o=t.Event("validate.bs.validator",{relatedTarget:r[0]});if(this.$element.trigger(o),!o.isDefaultPrevented()){var s=this;return this.runValidators(r).done(function(e){r.data("bs.validator.errors",e),e.length?a?s.defer(r,s.showErrors):s.showErrors(r):s.clearErrors(r),i&&e.toString()===i.toString()||(o=e.length?t.Event("invalid.bs.validator",{relatedTarget:r[0],detail:e}):t.Event("valid.bs.validator",{relatedTarget:r[0],detail:i}),s.$element.trigger(o)),s.toggleSubmit(),s.$element.trigger(t.Event("validated.bs.validator",{relatedTarget:r[0]}))})}},r.prototype.runValidators=function(r){var a=[],i=t.Deferred();function o(t){return function(t){return r.data(t+"-error")}(t)||((e=r[0].validity).typeMismatch?r.data("type-error"):e.patternMismatch?r.data("pattern-error"):e.stepMismatch?r.data("step-error"):e.rangeOverflow?r.data("max-error"):e.rangeUnderflow?r.data("min-error"):e.valueMissing?r.data("required-error"):null)||r.data("error");var e}return r.data("bs.validator.deferred")&&r.data("bs.validator.deferred").reject(),r.data("bs.validator.deferred",i),t.each(this.validators,t.proxy(function(t,i){var s=null;(e(r)||r.attr("required"))&&(r.data(t)||"native"==t)&&(s=i.call(this,r))&&(s=o(t)||s,!~a.indexOf(s)&&a.push(s))},this)),!a.length&&e(r)&&r.data("remote")?this.defer(r,function(){var s={};s[r.attr("name")]=e(r),t.get(r.data("remote"),s).fail(function(t,e,r){a.push(o("remote")||r)}).always(function(){i.resolve(a)})}):i.resolve(a),i.promise()},r.prototype.validate=function(){var e=this;return t.when(this.$inputs.map(function(r){return e.validateInput(t(this),!1)})).then(function(){e.toggleSubmit(),e.focusError()}),this},r.prototype.focusError=function(){if(this.options.focus){var e=this.$element.find(".has-error:first :input");0!==e.length&&(t("html, body").animate({scrollTop:e.offset().top-r.FOCUS_OFFSET},250),e.focus())}},r.prototype.showErrors=function(e){var r=this.options.html?"html":"text",a=e.data("bs.validator.errors"),i=e.closest(".form-group"),o=i.find(".help-block.with-errors"),s=i.find(".form-control-feedback");a.length&&(a=t("<ul/>").addClass("list-unstyled").append(t.map(a,function(e){return t("<li/>")[r](e)})),void 0===o.data("bs.validator.originalContent")&&o.data("bs.validator.originalContent",o.html()),o.empty().append(a),i.addClass("has-error has-danger"),i.hasClass("has-feedback")&&s.removeClass(this.options.feedback.success)&&s.addClass(this.options.feedback.error)&&i.removeClass("has-success"))},r.prototype.clearErrors=function(t){var r=t.closest(".form-group"),a=r.find(".help-block.with-errors"),i=r.find(".form-control-feedback");a.html(a.data("bs.validator.originalContent")),r.removeClass("has-error has-danger has-success"),r.hasClass("has-feedback")&&i.removeClass(this.options.feedback.error)&&i.removeClass(this.options.feedback.success)&&e(t)&&i.addClass(this.options.feedback.success)&&r.addClass("has-success")},r.prototype.hasErrors=function(){return!!this.$inputs.filter(function(){return!!(t(this).data("bs.validator.errors")||[]).length}).length},r.prototype.isIncomplete=function(){return!!this.$inputs.filter("[required]").filter(function(){var r=e(t(this));return!("string"==typeof r?t.trim(r):r)}).length},r.prototype.onSubmit=function(t){this.validate(),(this.isIncomplete()||this.hasErrors())&&t.preventDefault()},r.prototype.toggleSubmit=function(){this.options.disable&&this.$btn.toggleClass("disabled",this.isIncomplete()||this.hasErrors())},r.prototype.defer=function(e,r){if(r=t.proxy(r,this,e),!this.options.delay)return r();window.clearTimeout(e.data("bs.validator.timeout")),e.data("bs.validator.timeout",window.setTimeout(r,this.options.delay))},r.prototype.reset=function(){return this.$element.find(".form-control-feedback").removeClass(this.options.feedback.error).removeClass(this.options.feedback.success),this.$inputs.removeData(["bs.validator.errors","bs.validator.deferred"]).each(function(){var e=t(this),r=e.data("bs.validator.timeout");window.clearTimeout(r)&&e.removeData("bs.validator.timeout")}),this.$element.find(".help-block.with-errors").each(function(){var e=t(this),r=e.data("bs.validator.originalContent");e.removeData("bs.validator.originalContent").html(r)}),this.$btn.removeClass("disabled"),this.$element.find(".has-error, .has-danger, .has-success").removeClass("has-error has-danger has-success"),this},r.prototype.destroy=function(){return this.reset(),this.$element.removeAttr("novalidate").removeData("bs.validator").off(".bs.validator"),this.$inputs.off(".bs.validator"),this.options=null,this.validators=null,this.$element=null,this.$btn=null,this};var i=t.fn.validator;t.fn.validator=a,t.fn.validator.Constructor=r,t.fn.validator.noConflict=function(){return t.fn.validator=i,this},t(window).on("load",function(){t('form[data-toggle="validator"]').each(function(){var e=t(this);a.call(e,e.data())})})}(jQuery);
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.03 |
proxy
|
phpinfo
|
Settings