!function(a){var b=function(a,b){this.$element=a,this.options=b},c={init:function(){var b=this.options,d=this.$element;a(d).unbind("click").bind("dblclick",function(){c.click_action(b,this)})},click_action:function(b,c){var i,j,k,l,d=a(c).attr("edit_id_attr"),e=a(c).attr("edit_id"),f=a(c).attr("edit_val"),g=a(c).attr("edit_att"),h=a(c).attr("edit_validation");h&&""!=h&&(i=new RegExp(h,"g")),j=a(c).html(),k='<input type="text" class="form-control input-sm" name="'+g+'" value="'+f+'">',a(c).empty().append(k),l=a(c).children("input"),l.focus().select(),l.blur(function(){var k=a(this).val();k!==f&&(h&&k.match(i)||!h)?a.ajax({type:"post",url:b.url,data:g+"="+k+"&"+d+"="+e,global:!1,async:!1,dataType:"json",beforeSend:function(){parent.espcms_are_loading()},success:function(d){parent.$("#espcms_are_loading").dialog("close"),"true"===d.code?(parent.$.espcms_sticky(d.message,{autoclose:1500}),b.isrefresh?b.callback():(a(c).attr("edit_val",k),a(c).empty().append(k))):a(c).empty().append(j)}}):a(c).empty().append(j)})}};a.fn.espcms_celerity_edit=function(d,e){var h,g=a.extend({url:!1,isrefresh:!1,callback:loading},d);return g.url?(h=Array.prototype.slice.call(arguments,1),this.each(function(){var f=a(this),i=f.data("setOption");return i||f.data("setOption",i=new b(f,g)),"string"==typeof d&&a.isFunction(c[d])?e?c[d](e,g,f):c[d].apply(i,h):"object"!=typeof d&&d?!1:c.init.apply(i,h)})):!1}}(jQuery);