"use strict";!function(e,a,t){e.fn.dataRemote=function(){function a(a,t,n){var l,o,d,r;a.find(".loader-image").hide(),t.debug&&e.fn.dataRemote.debug(a,n),t.handlebars!==!1||a.find('[type="text/x-handlebars-template"]').length?(r=t.template?e(t.template):a.find('[type="text/x-handlebars-template"]'),l=r.html(),o=Handlebars.compile(l),d=o(n)):d=n;var p=["html","append","prepend","after","before"],s=-1!==p.indexOf(t.placement);s&&a[t.placement](d)}function n(a,t,n,l){a.find(".loader-image").hide(),t.debug&&e.fn.dataRemote.debug(a,n,l)}function l(a,t){var n=t.element,l=t.target,o=t.options;o.loaderImg&&l.prepend(String()+'
'),e.ajax({url:a,data:o.data,type:o.type,dataType:o.dataType,cache:!0,success:function(e){o.success.call(n,l,o,e),o.complete.call(n,l)},error:function(e,a,t){o.error.call(n,l,o,e,t),o.complete.call(n,l)}})}var o=arguments[0]===t?{}:arguments[0],d={url:null,data:{},debug:!1,eventType:"load",dataType:"json",type:"GET",target:"",handlebars:!1,template:"",placement:"html",loaderImg:null,oneAndDone:!0,success:a,error:n,complete:function(e){},before:function(e){}},r=e.extend({},d,o);return this.each(function(a,t){var n=e(t),o=e.extend({},r);o.dataType=n.data("response-type")||r.dataType,o.eventType=n.data("event-type")||r.eventType,o.type=n.data("type")||r.type,o.url=n.data("url")||r.url,o.data=n.data("data")?n.data("data"):r.data,o.template=n.data("template")||r.template,o.placement=n.data("response-placement")||r.placement,o.target=n.data("target")||r.target,o.debug=t.hasAttribute("data-debug")?n.data("debug"):r.debug,o.oneAndDone=t.hasAttribute("data-one-and-done")?n.data("one-and-done"):r.oneAndDone,o.handlebars=t.hasAttribute("data-handlebars")?n.data("handlebars"):r.handlebars;var d=o.target?e(o.target):n;if("load"===o.eventType)o.before.call(n,d),l(o.url,{element:n,target:d,options:o});else{var p=o.oneAndDone?"one":"on";n[p](o.eventType,function(e){e.preventDefault(),-1!==["keyup","change"].indexOf(e.type)&&(o.data[this.name]=this.value),o.before.call(n,d),l(o.url,{element:n,target:d,options:o})})}})},e.fn.dataRemote.debug=function(e,t,n){a.console&&a.console.log&&(a.console.log("Element: "),a.console.log(e),a.console.log("Response: "),a.console.log(t),n&&(a.console.log(" -> Error: "),a.console.log(n)),a.console.log("------------"))}}(jQuery,window); //# sourceMappingURL=jquery.data-remote.min.js.map