diff options
author | Raphael Sofaer <raphael@joindiaspora.com> | 2011-07-12 03:18:19 +0400 |
---|---|---|
committer | Raphael Sofaer <raphael@joindiaspora.com> | 2011-07-12 03:18:19 +0400 |
commit | be5f3bf95e61eadce2ee180222996a7e003cffb9 (patch) | |
tree | 19a32df4908a4f3381e6b77bd6b47d7d9b543fd5 /public | |
parent | ee0ecc790c8003442364b263573c8a41b63544a0 (diff) | |
parent | 8f50c622fada4cf864f432c5c3866624c50a801e (diff) |
Merge branch 'like-comments'
Diffstat (limited to 'public')
-rw-r--r-- | public/javascripts/content-updater.js | 17 | ||||
-rw-r--r-- | public/javascripts/view.js | 2 | ||||
-rw-r--r-- | public/javascripts/web-socket-receiver.js | 21 | ||||
-rw-r--r-- | public/stylesheets/sass/application.sass | 43 |
4 files changed, 48 insertions, 35 deletions
diff --git a/public/javascripts/content-updater.js b/public/javascripts/content-updater.js index 0f1e115c7..a3c0c7dd0 100644 --- a/public/javascripts/content-updater.js +++ b/public/javascripts/content-updater.js @@ -4,14 +4,11 @@ */ var ContentUpdater = { - elementWithGuid: function(selector, guid) { - return $(selector + "[data-guid='" + guid + "']"); - }, addPostToStream: function(html) { var streamElement = $(html); - var postId = streamElement.attr("data-guid"); + var postGUID = $(streamElement).attr('id'); - if($(".stream_element[data-guid='" + postId + "']").length === 0) { + if($("#"+postGUID).length === 0) { if($("#no_posts").length) { $("#no_posts").detach(); } @@ -20,19 +17,19 @@ var ContentUpdater = { streamElement.find("label").inFieldLabels(); }); - Diaspora.widgets.publish("stream/postAdded", [postId]); + Diaspora.widgets.publish("stream/postAdded", [postGUID]); Diaspora.widgets.timeago.updateTimeAgo(); Diaspora.widgets.directionDetector.updateBinds(); } }, - addLikesToPost: function(postId, html) { - var post = ContentUpdater.elementWithGuid("div", postId); + addLikesToPost: function(postGUID, html) { + var post = $("#" + postGUID); $(".likes_container", post) .fadeOut("fast") .html(html) .fadeIn("fast"); } - -};
\ No newline at end of file + +}; diff --git a/public/javascripts/view.js b/public/javascripts/view.js index 4ae588bb6..90b7d500e 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -79,7 +79,7 @@ var View = { /* notification routing */ $("#notification").delegate('.hard_object_link', 'click', function(evt){ - var post = $("*[data-guid='"+ $(this).attr('data-ref') +"']"), + var post = $("#"+ $(this).attr('data-ref')), lastComment = post.find('.comment.posted').last(); if(post.length > 0){ diff --git a/public/javascripts/web-socket-receiver.js b/public/javascripts/web-socket-receiver.js index ddd36e354..1ae0db45a 100644 --- a/public/javascripts/web-socket-receiver.js +++ b/public/javascripts/web-socket-receiver.js @@ -33,7 +33,12 @@ var WebSocketReceiver = { WebSocketReceiver.processPerson(obj); } else { - WSR.debug("got a " + obj['class'] + " for aspects " + obj.aspect_ids); + debug_string = "got a " + obj['class']; + if(obj.aspect_ids !== undefined){ + debug_string += " for aspects " + obj.aspect_ids; + } + + WSR.debug(debug_string); if (obj['class']=="retractions") { WebSocketReceiver.processRetraction(obj.post_id); @@ -77,7 +82,7 @@ var WebSocketReceiver = { }, processRetraction: function(post_id){ - $("*[data-guid='" + post_id + "']").fadeOut(400, function() { + $("#" + post_id).fadeOut(400, function() { $(this).remove(); }); if($("#main_stream")[0].childElementCount === 0) { @@ -85,11 +90,10 @@ var WebSocketReceiver = { } }, - processComment: function(postId, commentId, html, opts) { - - if( $(".comment[data-guid='"+commentId+"']").length === 0 ) { + processComment: function(postGUID, commentGUID, html, opts) { - var post = $("*[data-guid='"+postId+"']'"), + if( $("#"+commentGUID).length === 0 ) { + var post = $("#"+postGUID), prevComments = $('.comment.posted', post); if(prevComments.length > 0) { @@ -123,9 +127,8 @@ var WebSocketReceiver = { Diaspora.widgets.directionDetector.updateBinds(); }, - processLike: function(postId, html) { - var post = $("*[data-guid='"+postId+"']"); - $('.likes', post).html(html); + processLike: function(targetGUID, html) { + $('.likes', "#" + targetGUID).first().html(html); }, processPost: function(className, postId, html, aspectIds) { diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 22cf2154b..a5ed7b3c6 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -302,10 +302,10 @@ ul.as-selections :height 370px :width 500px - time - :font - :weight normal - :size smaller + .comment + .comment_info + :font + :size smaller .from a @@ -667,9 +667,23 @@ form.new_comment :display inline-block -.comments - .timeago - :color #999 +.comment + .likes, + .likes_container + :display inline + :padding 0 + :margin 0 + :font + :size 10px + a + :font + :weight normal + + img + :margin 0 + :height 9px + :width 9px + :top 1px .stream.show ul.comments @@ -816,6 +830,7 @@ label :cursor pointer #publisher + :z-index 0 :color #999 :position relative @@ -2210,6 +2225,11 @@ ul.show_comments :border :top 1px dotted #aaa +ul.show_comments, +.likes_container + a + :color #999 + .likes_container :margin :bottom -4px @@ -2217,18 +2237,11 @@ ul.show_comments ul.show_comments, .likes_container - * - :font - :weight bold - :color #999 - img :position relative - :top 3px + :top 2px :height 12px :width 12px - :margin - :left 0.5em .mark_all_read :position relative |