Skip to:
Content

BuddyPress.org

Changeset 2546


Ignore:
Timestamp:
02/02/2010 09:22:22 PM (16 years ago)
Author:
apeatling
Message:

Fixes #1755

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-themes/bp-default/_inc/global.js

    r2545 r2546  
    843843
    844844    /* Marking private messages as read and unread */
    845     j("a#mark_as_read, a#mark_as_unread").click(
    846         function() {
    847             var checkboxes_tosend = '';
    848             var checkboxes = j("#message-threads tr td input[type='checkbox']");
    849 
    850             if ( 'mark_as_unread' == j(this).attr('id') ) {
    851                 var currentClass = 'read'
    852                 var newClass = 'unread'
    853                 var unreadCount = 1;
    854                 var inboxCount = 0;
    855                 var unreadCountDisplay = 'inline';
    856                 var action = 'messages_markunread';
    857             } else {
    858                 var currentClass = 'unread'
    859                 var newClass = 'read'
    860                 var unreadCount = 0;
    861                 var inboxCount = 1;
    862                 var unreadCountDisplay = 'none';
    863                 var action = 'messages_markread';
    864             }
    865 
    866             checkboxes.each( function(i) {
    867                 if(checkboxes[i].checked) {
    868                     if ( j('tr#m-' + checkboxes[i].value).hasClass(currentClass) ) {
    869                         checkboxes_tosend += checkboxes[i].value;
    870                         j('tr#m-' + checkboxes[i].value).removeClass(currentClass);
    871                         j('tr#m-' + checkboxes[i].value).addClass(newClass);
    872                         j('tr#m-' + checkboxes[i].value + ' td span.unread-count').html(unreadCount);
    873                         j('tr#m-' + checkboxes[i].value + ' td span.unread-count').css('display', unreadCountDisplay);
    874                         var inboxcount = j('.inbox-count').html();
    875 
    876                         if ( parseInt(inboxcount) == inboxCount ) {
    877                             j('.inbox-count').css('display', unreadCountDisplay);
    878                             j('.inbox-count').html(unreadCount);
    879                         } else {
    880                             if ( 'read' == currentClass )
    881                                 j('.inbox-count').html(parseInt(inboxcount) + 1);
    882                             else
    883                                 j('.inbox-count').html(parseInt(inboxcount) - 1);
    884                         }
    885 
    886                         if ( i != checkboxes.length - 1 ) {
    887                             checkboxes_tosend += ','
    888                         }
     845    j("a#mark_as_read, a#mark_as_unread").click(function() {
     846        var checkboxes_tosend = '';
     847        var checkboxes = j("#message-threads tr td input[type='checkbox']");
     848
     849        if ( 'mark_as_unread' == j(this).attr('id') ) {
     850            var currentClass = 'read'
     851            var newClass = 'unread'
     852            var unreadCount = 1;
     853            var inboxCount = 0;
     854            var unreadCountDisplay = 'inline';
     855            var action = 'messages_markunread';
     856        } else {
     857            var currentClass = 'unread'
     858            var newClass = 'read'
     859            var unreadCount = 0;
     860            var inboxCount = 1;
     861            var unreadCountDisplay = 'none';
     862            var action = 'messages_markread';
     863        }
     864
     865        checkboxes.each( function(i) {
     866            if(j(this).is(':checked')) {
     867                if ( j('tr#m-' + j(this).attr('value')).hasClass(currentClass) ) {
     868                    checkboxes_tosend += j(this).attr('value');
     869                    j('tr#m-' + j(this).attr('value')).removeClass(currentClass);
     870                    j('tr#m-' + j(this).attr('value')).addClass(newClass);
     871                    var thread_count = j('tr#m-' + j(this).attr('value') + ' td span.unread-count').html();
     872
     873                    j('tr#m-' + j(this).attr('value') + ' td span.unread-count').html(unreadCount);
     874                    j('tr#m-' + j(this).attr('value') + ' td span.unread-count').css('display', unreadCountDisplay);
     875                    var inboxcount = j('.inbox-count').html();
     876
     877                    if ( parseInt(inboxcount) == inboxCount ) {
     878                        j('.inbox-count').css('display', unreadCountDisplay);
     879                        j('.inbox-count').html(unreadCount);
     880                    } else {
     881                        if ( 'read' == currentClass )
     882                            j('.inbox-count').html(parseInt(inboxcount) + 1);
     883                        else
     884                            j('.inbox-count').html(parseInt(inboxcount) - thread_count);
     885                    }
     886
     887                    if ( i != checkboxes.length - 1 ) {
     888                        checkboxes_tosend += ','
    889889                    }
    890890                }
    891             });
    892             j.post( ajaxurl, {
    893                 action: action,
    894                 'thread_ids': checkboxes_tosend
    895             });
    896             return false;
    897         }
    898     );
     891            }
     892        });
     893        j.post( ajaxurl, {
     894            action: action,
     895            'thread_ids': checkboxes_tosend
     896        });
     897        return false;
     898    });
    899899
    900900    /* Selecting unread and read messages in inbox */
Note: See TracChangeset for help on using the changeset viewer.