29 lines
730 B
JavaScript
29 lines
730 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();
|
|
|
|
$.post(self.deleteCommentLink.attr("href"), {
|
|
_method: "delete"
|
|
}, function() {
|
|
self.comment.hide("blind", { direction: "vertical" }, 300, function() {
|
|
self.comment.remove();
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
Diaspora.Widgets.Comment = Comment;
|
|
})();
|