Viewing more comments rebinds javascript

This commit is contained in:
Maxwell Salzberg & Sarah Mei 2011-08-23 23:39:56 -07:00
parent a7d05756db
commit c1c622ff52
2 changed files with 9 additions and 6 deletions

View file

@ -5,7 +5,8 @@
this.subscribe("widget/ready", function(evt, commentStream) {
$.extend(self, {
commentStream: commentStream,
commentToggle: commentStream.siblings(".show_comments").find(".toggle_post_comments")
commentToggle: commentStream.siblings(".show_comments").find(".toggle_post_comments"),
postGuid: commentStream.parents(".stream_element").first().attr("id")
});
self.commentToggle.toggle(self.showComments, self.hideComments);
@ -25,8 +26,7 @@
self.commentToggle.html(Diaspora.I18n.t("comments.hide"));
self.commentStream.html(data)
.addClass("loaded");
self.globalPublish("commentStream/" + self.commentStream.attr("id") + "/loaded");
self.globalPublish("commentStream/" + self.postGuid + "/loaded");
});
}
};

View file

@ -1,7 +1,7 @@
(function() {
var StreamElement = function() {
var self = this;
this.subscribe("widget/ready", function(evt, element) {
self.postGuid = element.attr("id");
@ -15,8 +15,11 @@
});
self.globalSubscribe("post/" + self.postGuid + "/comment/added", function(evt, comment) {
self.commentStream.publish("comment/added", comment);
});
self.commentStream.publish("comment/added", comment);
});
self.globalSubscribe("commentStream/" + self.postGuid + "/loaded", function(evt) {
self.commentStream.instantiateCommentWidgets();
});
});
};