From 7bdf52e173db6223f6a084059204d4367838ca19 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 6 Jul 2010 12:38:24 -0700 Subject: [PATCH 1/2] comment numbers update uncleanly --- app/views/js/_websocket_js.haml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/js/_websocket_js.haml b/app/views/js/_websocket_js.haml index 4cf690cf0..4a76ebbde 100644 --- a/app/views/js/_websocket_js.haml +++ b/app/views/js/_websocket_js.haml @@ -35,9 +35,12 @@ } function processComment(post_id, html){ - $('#'+ post_id + ' .comment_set li:last' ).before( + post = $('#' + post_id)[0] + $(' .comment_set li:last', post ).before( $(html).fadeIn("fast", function(){}) ); + $('.show_post_comments', post).html( + $('.show_post_comments', post).html().replace(/\d/,$('.comment_set', post)[0].childElementCount -1)); } function processPost(className, html){ From bb325cbf6b5e5ad362002327e783c7ff289d566f Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 6 Jul 2010 12:41:28 -0700 Subject: [PATCH 2/2] cleaned up a little --- app/views/js/_websocket_js.haml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/js/_websocket_js.haml b/app/views/js/_websocket_js.haml index 4a76ebbde..93286423c 100644 --- a/app/views/js/_websocket_js.haml +++ b/app/views/js/_websocket_js.haml @@ -39,8 +39,9 @@ $(' .comment_set li:last', post ).before( $(html).fadeIn("fast", function(){}) ); - $('.show_post_comments', post).html( - $('.show_post_comments', post).html().replace(/\d/,$('.comment_set', post)[0].childElementCount -1)); + toggler = $('.show_post_comments', post) + toggler.html( + toggler.html().replace(/\d/,$('.comment_set', post)[0].childElementCount -1)); } function processPost(className, html){