if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(e){e.widget("psc.blogcomment",{options:{apictrlr:null,omob:"#ffe08030",omof:"#501208",bgc:"#fff",fgc:"#000",lang:"fr-FR"},editable:!1,editting:!1,edctrl:null,_create:function(){var e=this;this.element.addClass("blogcomment");var t=new Date(this.element.data("date")),o=this.element.data("username");this.editable=this.element.data("allow-edit"),this.element.prepend('
'+o+'
'+t.toLocaleDateString(this.options.lang)+" "+t.toLocaleTimeString(this.options.lang)+"
"),this.element.on("mouseenter",this.onMouseEnter),this.element.on("mouseleave",this.onMouseLeave),this.editable&&this.element.on("click",function(t){e.toggleEdit(e,t)})},toggleEdit:function(t,o){t.edctrl?(t.edctrl.remove(),t.edctrl=null):(t.edctrl=e(''),t.edctrl.on("click",function(e){t.doDeleteComment(t,e)}).appendTo(t.element))},onMouseEnter:function(){e(this).animate({backgroundColor:e.psc.blogcomment.prototype.options.omob,color:e.psc.blogcomment.prototype.options.omof},400)},onMouseLeave:function(){e(this).animate({backgroundColor:e.psc.blogcomment.prototype.options.bgc,color:e.psc.blogcomment.prototype.options.fgc},400)},doDeleteComment:function(t,o){var n=e(t.element).data("id"),a=t.options.apictrlr;e.ajax({async:!0,cache:!1,type:"POST",method:"DELETE",error:function(t,o){e('span.field-validation-valid[data-valmsg-for="Content"]').html("Une erreur est survenue : "+t.status+"
").focus()},success:function(e){t.element.remove()},url:a+"/"+n})}}),e(document).ready(function(){e("[data-type='blogcomment']").blogcomment()})}(jQuery);