wmdeit_kaform/addons/magicquery/kube.magicquery.min.js

1 line
692 B
JavaScript

!function(e){e.add("module","magicquery",{init:function(e,t){this.app=e,this.response=e.response;var s={url:!1};this.context=t,this.params=t.getParams(s),this.$element=t.getElement()},start:function(){this.$element.on("click.kube.magicquery",this._send.bind(this))},stop:function(){this._enable(),this.$element.off(".kube.magicquery")},_disable:function(){this.$element.attr("disabled",!0)},_enable:function(){this.$element.removeAttr("disabled")},_send:function(t){t.preventDefault(),this._disable(),e.ajax.post({url:this.params.url,success:this._parse.bind(this)})},_parse:function(e){this._enable();var t=this.response.parse(e);t&&this.app.broadcast("magicquery.success",this,t)}})}(Kube);