Free javascript Hosting


dependson-min.js

Uploaded on Oct 11 2021 15:42 by shagspiel

!function(e){function t(s){if(i[s])return i[s].exports;var n=i[s]={exports:{},id:s,loaded:!1};return e[s].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t,i){/*!
* dependsOn v1.5.1
* a jQuery plugin to facilitate the handling of form field dependencies.
*
* Copyright 2016 David Street
* Licensed under the MIT license.
*/
var s=i(1);$.fn.dependsOn=function(e,t){var i=$.extend({},{disable:!0,hide:!0,duration:200,trigger:"change"},t);i.trigger+=i.trigger.search(".dependsOn")>-1?"":".dependsOn";var n=new s(this,e,i);return n}},function(e,t,i){var s=i(2),n=i(4),r=function(e,t,i){this.$subject=e,this.collection=new s,this.options=$.extend({},{onEnable:function(){},onDisable:function(){},trigger:"change",readonly:!1},i),this.collection.addSet(new n(t,this.options.trigger)),this.$valueTarget=this._getValueTarget(),this.isInitialState=!0,this.collection.qualified?this._enable():this._disable(),this.isInitialState=!1,this.collection.on("change",this._changeHandler.bind(this))};r.prototype._changeHandler=function(e){e.qualified?this._enable(e.triggerBy.$ele,e.e):this._disable(e.triggerBy.$ele,e.e)},r.prototype._getValueTarget=function(){var e=this.$subject;return this.options.hasOwnProperty("valueTarget")&&void 0!==typeof this.options.valueTarget?e=$(this.options.valueTarget):"input"!==this.$subject[0].nodeName.toLowerCase()&&"textarea"!==this.$subject[0].nodeName.toLowerCase()&&"select"!==this.$subject[0].nodeName.toLowerCase()&&(e=this.$subject.find("input, textarea, select")),e},r.prototype.or=function(e){return this.collection.addSet(new n(e,this.options.trigger)),this.collection.qualified?this._enable():this._disable(),this},r.prototype.check=function(){this.collection.runCheck()},r.prototype._enable=function(e,t){this.options.disable&&this.$subject.attr("disabled",!1),this.options.readonly&&this.$subject.attr("readonly",!1),this.options.hide&&this._toggleDisplay(!0,this.isInitialState),this.options.hasOwnProperty("valueOnEnable")&&void 0!==typeof this.options.valueOnEnable&&this.$valueTarget.val(this.options.valueOnEnable).change(),this.options.hasOwnProperty("checkOnEnable")&&this.$valueTarget.prop("checked",this.options.checkOnEnable).change(),this.options.hasOwnProperty("toggleClass")&&void 0!==typeof this.options.toggleClass&&this.$subject.addClass(this.options.toggleClass),this.options.onEnable.call(e,t,this.$subject)},r.prototype._disable=function(e,t){this.options.disable&&this.$subject.attr("disabled",!0),this.options.readonly&&this.$subject.attr("readonly",!0),this.options.hide&&this._toggleDisplay(!1,this.isInitialState),this.options.hasOwnProperty("valueOnDisable")&&void 0!==typeof this.options.valueOnDisable&&this.$valueTarget.val(this.options.valueOnDisable).change(),this.options.hasOwnProperty("checkOnDisable")&&this.$valueTarget.prop("checked",this.options.checkOnDisable).change(),this.options.hasOwnProperty("toggleClass")&&void 0!==typeof this.options.toggleClass&&this.$subject.removeClass(this.options.toggleClass),this.options.onDisable.call(e,t,this.$subject)},r.prototype._toggleDisplay=function(e,t){var i,s=this.$subject.attr("id");i="label"===this.$subject.parent()[0].nodeName.toLowerCase()?this.$subject.parent():this.$subject.add('label[for="'+s+'"]'),e?t?i.show():i.fadeIn(this.options.duration):e||(t?i.hide():i.fadeOut(this.options.duration))},e.exports=r},function(e,t,i){var s=i(3).EventEmitter,n=function(){this.sets=[],this._qualSum=0,this.qualified=null};e.exports=n,n.prototype=$.extend({},s.prototype),n.prototype.addSet=function(e){this.sets.push(e),this._qualSum+=e.qualified?1:0,this.qualified=this._qualSum>0,e.on("change",this._setChangeHandler.bind(this))},n.prototype.runCheck=function(){for(var e=0,t=this.sets.length;t>e;e++)this.sets[e].runCheck()},n.prototype._setChangeHandler=function(e){var t=this.qualified;this._qualSum+=e.qualified?1:0===this._qualSum?0:-1,this.qualified=this._qualSum>0,this.qualified!==t&&this.emit("change",{triggerBy:e.triggerBy,e:e.e,qualified:this.qualified})}},function(e,t){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function s(e){return"function"==typeof e}function n(e){return"number"==typeof e}function r(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}e.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(e){if(!n(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},i.prototype.emit=function(e){var t,i,n,a,h,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||r(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(i=this._events[e],o(i))return!1;if(s(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),i.apply(this,a)}else if(r(i))for(a=Array.prototype.slice.call(arguments,1),l=i.slice(),n=l.length,h=0;n>h;h++)l[h].apply(this,a);return!0},i.prototype.addListener=function(e,t){var n;if(!s(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,s(t.listener)?t.listener:t),this._events[e]?r(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,r(this._events[e])&&!this._events[e].warned&&(n=o(this._maxListeners)?i.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}if(!s(t))throw TypeError("listener must be a function");var n=!1;return i.listener=t,this.on(e,i),this},i.prototype.removeListener=function(e,t){var i,n,o,a;if(!s(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(i=this._events[e],o=i.length,n=-1,i===t||s(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(r(i)){for(a=o;a-- >0;)if(i[a]===t||i[a].listener&&i[a].listener===t){n=a;break}if(0>n)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[e],s(i))this.removeListener(e,i);else if(i)for(;i.length;)this.removeListener(e,i[i.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?s(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(s(t))return 1;if(t)return t.length}return 0},i.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,i){var s=i(3).EventEmitter,n=i(5),r=function(e,t){function i(e){return function(t){var i=this.qualified;s+=t.qualified?1:0===s?0:-1,this.qualified=this.doesQualify(),this.qualified!==i&&this.emit("change",{triggerBy:e,e:t.e,qualified:this.doesQualify()})}}this.dependencies=[];var s=0;for(var r in e)if(e.hasOwnProperty(r)){var o=new n(r,e[r],t);this.dependencies.push(o),s+=o.qualified?1:0,o.on("change",i(o).bind(this))}this.doesQualify=function(){return s===this.dependencies.length},this.qualified=this.doesQualify()};e.exports=r,r.prototype=$.extend({},s.prototype),r.prototype.runCheck=function(){for(var e=0,t=this.dependencies.length;t>e;e++)this.dependencies[e].runCheck()}},function(e,t,i){function s(e){var t=e.val();return"radio"===e.attr("type")&&(t=e.filter(":checked").val()),{value:t,checked:e.is(":checked"),disabled:e.is(":disabled"),selected:e.is(":selected")}}var n=i(3).EventEmitter,r=function(e,t,i){function n(t){var i=this.qualified;this.fieldState=s(this.$ele),this.qualified=this.doesQualify(),this.qualified!==i&&this.emit("change",{selector:e,e:t,qualified:this.qualified})}this.$ele=$(e),this.qualifiers=t,this.fieldState=s(this.$ele),this.methods=["enabled","checked","values","not","match","contains","email","url"],this.qualified=this.doesQualify(),this.$ele.on(i,n.bind(this)),this.runCheck=n.bind(this)};r.prototype=$.extend({},n.prototype),r.prototype.enabled=function(e){return!!(!this.fieldState.disabled&&e||this.fieldState.disabled&&!e)},r.prototype.checked=function(e){return"checkbox"!==this.$ele.attr("type")||!(!this.fieldState.checked&&e||this.fieldState.checked&&!e)},r.prototype.values=function(e){for(var t=0,i=e.length;i>t;t++)if(null!==this.fieldState.value&&Array.isArray(this.fieldState.value)){if(0===$(this.fieldState.value).not(e[t]).length&&0===$(e[t]).not(this.fieldState.value).length)return!0}else if(e[t]===this.fieldState.value)return!0;return!1},r.prototype.not=function(e){return!this.values(e)},r.prototype.match=function(e){var t=this.fieldState.value;Array.isArray(this.fieldState.value)||(t=[t]);for(var i=0,s=t.length;s>i;i++)if(!e.test(t[i]))return!1;return!0},r.prototype.notMatch=function(e){var t=this.fieldState.value;Array.isArray(this.fieldState.value)||(t=[t]);for(var i=0,s=t.length;s>i;i++)if(e.test(t[i]))return!1;return!0},r.prototype.contains=function(e){if(!Array.isArray(this.fieldState.value))return this.values(e);for(var t=0,i=e.length;i>t;t++)if(-1!==$.inArray(e[t],this.fieldState.value))return!0;return!1},r.prototype.email=function(e){var t=/^[_a-zA-Z0-9\-\+]+(\.[_a-zA-Z0-9\-\+]+)*@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$/;return this.match(t)===e},r.prototype.url=function(e){var t=/(((http|ftp|https):\/\/)|www\.)[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?\^=%&:\/~\+#!]*[\w\-\@?\^=%&\/~\+#])?/;return this.match(t)===e},r.prototype.range=function(e,t,i){var s="string"==typeof e?"char":"number",n="char"===s?e.charCodeAt():e,r="char"===s?t.charCodeAt():t,o="char"===s?this.fieldState.value.charCodeAt():parseFloat(this.fieldState.value);if(i){for(var a=[],h=n;r>=h;h+=i)a.push(h);return a.indexOf(o)>=0}return o>=n&&r>=o},r.prototype.doesQualify=function(){for(var e in this.qualifiers)if(this.qualifiers.hasOwnProperty(e))if(this.methods.indexOf(e)&&"function"==typeof this[e]){if("range"===e){if(!this[e].apply(this,this.qualifiers[e]))return!1}else if(!this[e].call(this,this.qualifiers[e]))return!1}else if("function"==typeof this.qualifiers[e]&&!this.qualifiers[e].call(this.qualifiers,this.$ele.val()))return!1;return!0},e.exports=r,Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Number.isNaN=Number.isNaN||function(e){return e!==e}}]);

Back to list