!function(e){"use strict";e.fn.wpie_editable=function(t,i){if("function"!=typeof i&&(i=function(){}),"string"==typeof t)var r=this,a=t,n="input";else{if("object"!=typeof t)throw'Argument Error - jQuery.wpie_editable("click", function(){ ~~ })';"string"==typeof(r=t.trigger||this)&&(r=e(r));a=t.action||"click",n=t.type||"input"}var s=this,l={start:function(t){r.unbind("clickhold"===a?"mousedown":a),r!==s&&r.hide();var c=("textarea"===n?s.text().replace(/<br( \/)?>/gm,"\n").replace(/&gt;/gm,">").replace(/&lt;/gm,"<"):s.text()).replace(/^\s+/,"").replace(/\s+$/,""),o=e("textarea"===n?"<textarea>":"<input>");o.val(c).css("width","textarea"===n?"100%":s.width()+s.height()).css("font-size","100%").css("margin",0).attr("id","wpie_editable_"+1*new Date).addClass("wpie_editable"),s.addClass("wpie_editable_wrapper"),"textarea"===n&&o.css("height",s.height());var u=function(){s.removeClass("wpie_editable_wrapper");var e=o.val().replace(/^\s+/,"").replace(/\s+$/,""),t=e.replace(/</gm,"&lt;").replace(/>/gm,"&gt;");"textarea"===n&&(t=t.replace(/[\r\n]/gm,"<br />")),s.html(t),i({value:e,target:s,old_value:c}),l.register(),r!==s&&r.show()};o.blur(u),"input"===n&&o.keydown(function(e){13===e.keyCode&&u()}),s.html(o),o.focus()},register:function(){if("clickhold"===a){var e=null;r.bind("mousedown",function(t){e=setTimeout(function(){l.start(t)},500)}),r.bind("mouseup mouseout",function(t){clearTimeout(e)})}else r.bind(a,l.start)}};return l.register(),this}}(jQuery);