%PDF- %PDF-
Direktori : /home/t/r/a/tradesc/www/relax/wp-content/plugins/wpforms-lite/assets/lib/ |
Current File : /home/t/r/a/tradesc/www/relax/wp-content/plugins/wpforms-lite/assets/lib/jquery.conditionals.min.js |
/** * jQuery Conditions 1.0.1 * * Copyright 2016 Bejamin Rojas * @license Released under the MIT license. * http://jquery.org/license */ !function(e){"use strict";e.fn.conditions=function(i){return this.each(function(t,o){new n(o,i,e.fn.conditions.defaults).init()})},e.fn.conditions.defaults={condition:null,actions:{},effect:"fade"};var n=function(n,i,t){var o=this;o.element=e(n),o.defaults=t,o.conditions=i,o._init=!1,e.isArray(o.conditions)||(o.conditions=[o.conditions]),e.each(o.conditions,function(n,i){o.conditions[n]=e.extend({},o.defaults,i)})};n.prototype.init=function(){var n=this;n._init=!0,e(n.element).on("change",function(){n.matchConditions()}),e(n.element).on("keyup",function(){n.matchConditions()}),n.matchConditions(!0)},n.prototype.matchConditions=function(n){var i=this;n||(i._init=!1),e.each(i.conditions,function(n,t){var o=!1,a=!0;e.isArray(t.conditions)||(t.conditions=[t.conditions]),e.each(t.conditions,function(n,i){switch(i=e.extend({element:null,type:"val",operator:"==",condition:null,multiple:"single"},i),i.element=e(i.element),i.type){case"value":case"val":switch(i.operator){case"===":case"==":case"=":if(e.isArray(i.element.val())){var t=!1,c=!0;e.each(i.element.val(),function(e,n){n===i.condition?t=!0:c=!1}),o="single"==i.multiple?t:c}else o=i.element.val()===i.condition;break;case"!==":case"!=":if(e.isArray(i.element.val())){var t=!1,c=!0;e.each(i.element.val(),function(e,n){n!==i.condition?t=!0:c=!1}),o="single"==i.multiple?t:c}else o=i.element.val()!==i.condition;break;case"array":if(e.isArray(i.element.val())){var t=!1,c=i.element.val().length===i.condition.length;e.each(i.element.val(),function(n,o){-1!==e.inArray(o,i.condition)?t=!0:c=!1}),o="single"==i.multiple?t:c}else o=-1!==e.inArray(i.element.val(),i.condition);break;case"!array":if(e.isArray(i.element.val())){var t=!1,c=!0,s=[];e.each(i.element.val(),function(n,o){-1===e.inArray(o,i.condition)?t=!0:s.push(o)}),s.length==i.condition.length&&(c=!1),o="single"==i.multiple?t:c}else o=-1===e.inArray(i.element.val(),i.condition)}break;case"checked":switch(i.operator){case"is":o=i.element.is(":checked");break;case"!is":o=!i.element.is(":checked")}}!o&&a&&(a=!1)}),a?e.isEmptyObject(t.actions.if)||(e.isArray(t.actions.if)||(t.actions.if=[t.actions.if]),e.each(t.actions.if,function(e,n){i.showAndHide(n,t.effect)})):e.isEmptyObject(t.actions.else)||(e.isArray(t.actions.else)||(t.actions.else=[t.actions.else]),e.each(t.actions.else,function(e,n){i.showAndHide(n,t.effect)}))})},n.prototype.showAndHide=function(n,i){var t=this;switch(n.action){case"show":t._show(e(n.element),i);break;case"hide":t._hide(e(n.element),i)}},n.prototype._show=function(e,n){if(this._init)e.show();else switch(n){case"appear":e.show();break;case"slide":e.slideDown();break;case"fade":e.fadeIn(300)}},n.prototype._hide=function(e,n){if(this._init)e.hide();else switch(n){case"appear":e.hide();break;case"slide":e.slideUp();break;case"fade":e.fadeOut(300)}}}(jQuery);