(function(a,b,c,d){function g(b,c){this.element=b,this.options=a.extend({},f,c),this._defaults=f,this._name=e,this.init()}var e="autosave",f={url:"",method:"POST",event:"change",data:{},type:"html",debug:!1,before:function(){},done:function(){},fail:function(){},always:function(){}};g.prototype.init=function(){function e(b){var c=/^data\-(\w+)$/,d={};return d.value=b.val()||"",d.name=b.attr("name")||"",a(b[0].attributes).each(function(){c.test(this.nodeName)&&(attribute_name=c.exec(this.nodeName)[1],d[attribute_name]=this.nodeValue)}),d}var b=a(this.element),c=e(b),d=this.options,c=e(b);d.event=c.event||d.event,b.on(d.event,function(c){d.before&&d.before.call(b);var f=e(b);options=a.extend({},d,f);var g=a.extend({},options.data,f);options.debug=="false"&&(options.debug=!1),delete g.url,delete g.method,delete g.type,delete g.debug,g.event=options.event,options.debug?console.log(g):a.ajax({url:options.url,type:options.method,cache:!1,data:g,dataType:options.type}).done(function(a,c,d){b.data("autosave-data",a),b.data("autosave-textStatus",c),b.data("autosave-jqXHR",d),b.trigger("autosave-done")}).fail(function(a,c,d){b.data("autosave-jqXHR",a),b.data("autosave-textStatus",c),b.data("autosave-errorThrown",d),b.trigger("autosave-fail")}).always(function(){b.trigger("autosave-always")})}),d.done&&b.on("autosave-done",function(){var a=b.data("autosave-data"),c=b.data("autosave-textStatus"),d=b.data("autosave-jqXHR");options.done.call(b,a,c,d)}),d.fail&&b.on("autosave-fail",function(){var a=b.data("autosave-jqXHR"),c=b.data("autosave-textStatus"),d=b.data("autosave-errorThrown");options.fail.call(b,a,c,d)}),d.always&&b.on("autosave-always",function(){options.always.call(b)})},a.fn.autosave=function(a){return this.each(function(){new g(this,a)})}})(jQuery,window,document)
!function(t,a,e,o){function n(a,e){this.element=a,this.options=t.extend({},s,e),this._defaults=s,this._name=i,this.init()}var i="autosave",s={url:"",method:"POST",event:"change",data:{},type:"html",debug:!1,before:function(){},done:function(){},fail:function(){},always:function(){}};n.prototype.init=function(){function a(a){var e=/^data\-(\w+)$/,o={};return a.is(":checkbox")?o.value=a.prop("checked"):o.value=a.val()||"",o.name=a.attr("name")||"",t(a[0].attributes).each(function(){e.test(this.name)&&(attribute_name=e.exec(this.name)[1],o[attribute_name]=this.value)}),o}var e=t(this.element),o=a(e),n=this.options,o=a(e);n.event=o.event||n.event,e.on(n.event,function(o){n.before&&n.before.call(e);var i=a(e);options=t.extend({},n,i);var s=t.extend({},options.data,i);"false"==options.debug&&(options.debug=!1),delete s.url,delete s.method,delete s.type,delete s.debug,s.event=options.event,options.debug?console.log(s):t.ajax({url:options.url,type:options.method,cache:!1,data:s,dataType:options.type}).done(function(t,a,o){e.data("autosave-data",t),e.data("autosave-textStatus",a),e.data("autosave-jqXHR",o),e.trigger("autosave-done")}).fail(function(t,a,o){e.data("autosave-jqXHR",t),e.data("autosave-textStatus",a),e.data("autosave-errorThrown",o),e.trigger("autosave-fail")}).always(function(){e.trigger("autosave-always")})}),n.done&&e.on("autosave-done",function(){var t=e.data("autosave-data"),a=e.data("autosave-textStatus"),o=e.data("autosave-jqXHR");options.done.call(e,t,a,o)}),n.fail&&e.on("autosave-fail",function(){var t=e.data("autosave-jqXHR"),a=e.data("autosave-textStatus"),o=e.data("autosave-errorThrown");options.fail.call(e,t,a,o)}),n.always&&e.on("autosave-always",function(){options.always.call(e)})},t.fn.autosave=function(t){return this.each(function(){new n(this,t)})}}(jQuery,window,document);
refresh min file