diaspora/public/javascripts/widgets/comment.js
2011-08-26 15:24:07 -05:00

31 lines
807 B
JavaScript

(function() {
var Comment = function() {
var self = this;
this.subscribe("widget/ready", function(evt, comment) {
$.extend(self, {
comment: comment,
deleteCommentLink: comment.find("a.comment_delete")
});
self.deleteCommentLink.click(self.removeComment);
self.deleteCommentLink.tipsy({ trigger: "hover" });
});
this.removeComment = function(evt) {
evt.preventDefault();
if(confirm(Diaspora.I18n.t("confirm_dialog"))) {
$.post(self.deleteCommentLink.attr("href"), {
_method: "delete"
}, function() {
self.comment.hide("blind", { direction: "vertical" }, 300, function() {
self.comment.remove();
});
});
}
};
};
Diaspora.Widgets.Comment = Comment;
})();