Skip to:
Content

BuddyPress.org

Ticket #2587: activity.diff

File activity.diff, 5.9 KB (added by johnjamesjacoby, 15 years ago)
  • bp-activity/bp-activity-templatetags.php

     
    650650                        if ( !$comment->children )
    651651                                return false;
    652652
    653                         $content .= '<ul>';
     653                        $content .= '<ul class="acomment-container">';
    654654                        foreach ( (array)$comment->children as $comment ) {
    655655                                if ( !$comment->user_fullname )
    656656                                        $comment->user_fullname = $comment->display_name;
  • bp-themes/bp-default/_inc/css/default.css

     
    10211021/* > Activity Stream Listing
    10221022-------------------------------------------------------------- */
    10231023
     1024div.show-hidden a {
     1025        position: absolute;
     1026        right: 0;
     1027        top: 7px;
     1028        background-color: #eee;
     1029        text-decoration: none;
     1030        padding: 3px 6px;
     1031        font-size: 11px;
     1032        color: #999;
     1033        text-decoration: none;
     1034        -moz-border-radius: 6px;
     1035        -webkit-border-radius: 6px;
     1036        border-radius: 6px;
     1037}
     1038div.show-hidden a:active,
     1039div.show-hidden a:hover {
     1040        color: #666;
     1041}
     1042div.show-hidden.loading a {
     1043        background-image: url( ../images/ajax-loader.gif );
     1044        background-position: 2% 50%;
     1045        background-repeat: no-repeat;
     1046        padding-left: 20px;
     1047}
     1048
    10241049ul.activity-list li {
    10251050        padding: 20px 0 0 0;
    10261051        overflow: hidden;
  • bp-themes/bp-default/_inc/global.js

     
    430430
    431431                        return false;
    432432                }
     433
     434                /* Showing hidden comments - pause for half a second */
     435                if ( target.parent().hasClass('show-hidden') ) {
     436                        target.parent().addClass('loading');
     437
     438                        setTimeout( function() {
     439                                target.parent().parent().parent().find('ul.acomment-container li').fadeIn(600, function() {
     440                                        target.parent().parent().find('.show-hidden').fadeOut( 200 );
     441                                });
     442                                jq.scrollTo( target.parent().parent().parent(), 1000, { offset: -40, easing: 'easeout' } );
     443                        }, 1000 );
     444
     445                        return false;
     446                }
    433447        });
    434448
    435449        /* Escape Key Press for cancelling comment forms */
     
    11801194        }, 'json' );
    11811195}
    11821196
    1183 /* Hide long lists of activity comments, only show the latest five root comments. */
    11841197function bp_dtheme_hide_comments() {
     1198
     1199        // Set thresholds for when 'More' clickables will appear'
     1200        var large_threshold = 5;
     1201        var small_threshold = 1;
     1202
     1203        // Check for activity comments
     1204        var comments_divs   = jq('div.activity-comments');
     1205
     1206        // Loop through each div.activity-comments
     1207        comments_divs.each( function(i) {
     1208
     1209                // The top-most parent activity div in a hierarchy
     1210                var comments_div          = jq(this);
     1211               
     1212                // Total number of replies to this activity item
     1213                var comment_replies_total = comments_div.find('ul.acomment-container li').size();
     1214
     1215                // Recursive replies within the current top-most activity item
     1216                var comment_replies       = comments_div.children('ul.acomment-container').children('li');
     1217
     1218                // If the total number of replies is greater than the large threshold, start the hiding process
     1219                if ( comment_replies_total > large_threshold ) {
     1220
     1221                        // Loop through each top level reply and possibly hide the children
     1222                        comment_replies.each( function() {
     1223                                var this_reply = jq(this);
     1224
     1225                                // Get the replies objects and the count of them
     1226                                var comment_nested_replies       = this_reply.children('ul.acomment-container').children('li');
     1227                                var comment_nested_replies_count = this_reply.find('ul.acomment-container li').size();
     1228
     1229                                // There are enough immediate replies to hide some
     1230                                if ( comment_nested_replies_count > small_threshold ) {
     1231
     1232                                        // Inject a 'Show X replies' link in the top level reply
     1233                                        comment_nested_replies.before( '<div class="show-hidden"><a href="/show-all/#' + comment_replies.attr( 'id' ) + '" title="' + BP_DTheme.show_all_comments + '">' + BP_DTheme.show_all + ' ' + comment_nested_replies_count + ' ' + BP_DTheme.comments + '</a></div>' );
     1234
     1235                                        // Loop through nested replies and hide them
     1236                                        comment_nested_replies.each( function() {
     1237                                                var nested_reply = jq(this);
     1238
     1239                                                nested_reply.addClass('hidden');
     1240                                                nested_reply.toggle();
     1241                                        });
     1242                                }
     1243                        });
     1244                }
     1245        });
     1246}
     1247
     1248/* Hide long lists of activity comments, only show the latest five root comments. */
     1249function bp_dtheme_hide_comments_old() {
    11851250        var comments_divs = jq('div.activity-comments');
    11861251
    11871252        if ( !comments_divs.length )
     
    12051270                                jq(this).toggle();
    12061271
    12071272                                if ( !i )
    1208                                         jq(this).before( '<li class="show-all"><a href="#' + parent_li.attr('id') + '/show-all/" title="' + BP_DTheme.show_all_comments + '">' + BP_DTheme.show_all + ' ' + comment_count + ' ' + BP_DTheme.comments + '</a></li>' );
     1273                                        jq(this).before( '<li class="show-hidden"><a href="#' + parent_li.attr('id') + '/show-all/" title="' + BP_DTheme.show_all_comments + '">' + BP_DTheme.show_all + ' ' + comment_count + ' ' + BP_DTheme.comments + '</a></li>' );
    12091274                        }
    12101275                });
    12111276
  • bp-themes/bp-default/functions.php

     
    2727        'accepted'          => __( 'Accepted', 'buddypress' ),
    2828        'rejected'          => __( 'Rejected', 'buddypress' ),
    2929        'show_all_comments' => __( 'Show all comments for this thread', 'buddypress' ),
    30         'show_all'          => __( 'Show all', 'buddypress' ),
    31         'comments'          => __( 'comments', 'buddypress' ),
     30        'show_all'          => __( 'Show', 'buddypress' ),
     31        'comments'          => __( 'replies', 'buddypress' ),
    3232        'close'             => __( 'Close', 'buddypress' ),
    3333        'mention_explain'   => sprintf( __( "%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.", 'buddypress' ), '@' . bp_get_displayed_user_username(), bp_get_user_firstname( bp_get_displayed_user_fullname() ), bp_get_user_firstname( bp_get_displayed_user_fullname() ) )
    3434);