Skip to content
Snippets Groups Projects
Commit 121c0c97 authored by Dan Hansen's avatar Dan Hansen
Browse files

optimize infinite scroll widget instantiation. don't instantiate timeago...

optimize infinite scroll widget instantiation. don't instantiate timeago widgets for StreamElement and Comment widgets
parent ded85fb2
No related branches found
No related tags found
No related merge requests found
......@@ -5,8 +5,7 @@
this.subscribe("widget/ready", function(evt, comment) {
$.extend(self, {
comment: comment,
deleteCommentLink: comment.find(".comment_delete"),
timeAgo: self.instantiate("TimeAgo", comment.find("abbr.timeago"))
deleteCommentLink: comment.find(".comment_delete")
});
self.deleteCommentLink.click(self.removeComment);
......
......@@ -10,13 +10,13 @@
commentStream: self.instantiate("CommentStream", element.find("ul.comments")),
embedder: self.instantiate("Embedder", element.find("div.content")),
likes: self.instantiate("Likes", element.find("div.likes_container")),
lightBox: self.instantiate("Lightbox", element),
timeAgo: self.instantiate("TimeAgo", element.find("abbr.timeago"))
lightBox: self.instantiate("Lightbox", element)
});
self.globalSubscribe("post/" + self.postGuid + "/comment/added", function(evt, comment) {
self.commentStream.publish("comment/added", comment);
});
self.globalSubscribe("commentStream/" + self.postGuid + "/loaded", function(evt) {
self.commentStream.instantiateCommentWidgets();
});
......
(function() {
var Stream = function() {
var self = this;
this.streamElements = {};
this.subscribe("widget/ready", function(evt, stream) {
$.extend(self, {
stream: $(stream),
streamElements: {}
stream: $(stream)
});
$.each(self.stream.find(".stream_element"), function() {
self.addPost($(this));
var post = $(this);
if(typeof self.streamElements[post.attr("id")] === "undefined") {
self.addPost(post);
}
});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment