<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[BuddyPress] [2546] trunk/bp-themes/bp-default/_inc/global.js: Fixes #1755</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>2546</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-02-02 21:22:22 +0000 (Tue, 02 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fixes #1755</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpthemesbpdefault_incglobaljs">trunk/bp-themes/bp-default/_inc/global.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpthemesbpdefault_incglobaljs"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/global.js (2545 => 2546)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/global.js        2010-02-02 21:10:53 UTC (rev 2545)
+++ trunk/bp-themes/bp-default/_inc/global.js        2010-02-02 21:22:22 UTC (rev 2546)
</span><span class="lines">@@ -842,60 +842,60 @@
</span><span class="cx">         );
</span><span class="cx"> 
</span><span class="cx">         /* Marking private messages as read and unread */
</span><del>-        j(&quot;a#mark_as_read, a#mark_as_unread&quot;).click(
-                function() {
-                        var checkboxes_tosend = '';
-                        var checkboxes = j(&quot;#message-threads tr td input[type='checkbox']&quot;);
</del><ins>+        j(&quot;a#mark_as_read, a#mark_as_unread&quot;).click(function() {
+                var checkboxes_tosend = '';
+                var checkboxes = j(&quot;#message-threads tr td input[type='checkbox']&quot;);
</ins><span class="cx"> 
</span><del>-                        if ( 'mark_as_unread' == j(this).attr('id') ) {
-                                var currentClass = 'read'
-                                var newClass = 'unread'
-                                var unreadCount = 1;
-                                var inboxCount = 0;
-                                var unreadCountDisplay = 'inline';
-                                var action = 'messages_markunread';
-                        } else {
-                                var currentClass = 'unread'
-                                var newClass = 'read'
-                                var unreadCount = 0;
-                                var inboxCount = 1;
-                                var unreadCountDisplay = 'none';
-                                var action = 'messages_markread';
-                        }
</del><ins>+                if ( 'mark_as_unread' == j(this).attr('id') ) {
+                        var currentClass = 'read'
+                        var newClass = 'unread'
+                        var unreadCount = 1;
+                        var inboxCount = 0;
+                        var unreadCountDisplay = 'inline';
+                        var action = 'messages_markunread';
+                } else {
+                        var currentClass = 'unread'
+                        var newClass = 'read'
+                        var unreadCount = 0;
+                        var inboxCount = 1;
+                        var unreadCountDisplay = 'none';
+                        var action = 'messages_markread';
+                }
</ins><span class="cx"> 
</span><del>-                        checkboxes.each( function(i) {
-                                if(checkboxes[i].checked) {
-                                        if ( j('tr#m-' + checkboxes[i].value).hasClass(currentClass) ) {
-                                                checkboxes_tosend += checkboxes[i].value;
-                                                j('tr#m-' + checkboxes[i].value).removeClass(currentClass);
-                                                j('tr#m-' + checkboxes[i].value).addClass(newClass);
-                                                j('tr#m-' + checkboxes[i].value + ' td span.unread-count').html(unreadCount);
-                                                j('tr#m-' + checkboxes[i].value + ' td span.unread-count').css('display', unreadCountDisplay);
-                                                var inboxcount = j('.inbox-count').html();
</del><ins>+                checkboxes.each( function(i) {
+                        if(j(this).is(':checked')) {
+                                if ( j('tr#m-' + j(this).attr('value')).hasClass(currentClass) ) {
+                                        checkboxes_tosend += j(this).attr('value');
+                                        j('tr#m-' + j(this).attr('value')).removeClass(currentClass);
+                                        j('tr#m-' + j(this).attr('value')).addClass(newClass);
+                                        var thread_count = j('tr#m-' + j(this).attr('value') + ' td span.unread-count').html();
</ins><span class="cx"> 
</span><del>-                                                if ( parseInt(inboxcount) == inboxCount ) {
-                                                        j('.inbox-count').css('display', unreadCountDisplay);
-                                                        j('.inbox-count').html(unreadCount);
-                                                } else {
-                                                        if ( 'read' == currentClass )
-                                                                j('.inbox-count').html(parseInt(inboxcount) + 1);
-                                                        else
-                                                                j('.inbox-count').html(parseInt(inboxcount) - 1);
-                                                }
</del><ins>+                                        j('tr#m-' + j(this).attr('value') + ' td span.unread-count').html(unreadCount);
+                                        j('tr#m-' + j(this).attr('value') + ' td span.unread-count').css('display', unreadCountDisplay);
+                                        var inboxcount = j('.inbox-count').html();
</ins><span class="cx"> 
</span><del>-                                                if ( i != checkboxes.length - 1 ) {
-                                                        checkboxes_tosend += ','
-                                                }
</del><ins>+                                        if ( parseInt(inboxcount) == inboxCount ) {
+                                                j('.inbox-count').css('display', unreadCountDisplay);
+                                                j('.inbox-count').html(unreadCount);
+                                        } else {
+                                                if ( 'read' == currentClass )
+                                                        j('.inbox-count').html(parseInt(inboxcount) + 1);
+                                                else
+                                                        j('.inbox-count').html(parseInt(inboxcount) - thread_count);
</ins><span class="cx">                                         }
</span><ins>+
+                                        if ( i != checkboxes.length - 1 ) {
+                                                checkboxes_tosend += ','
+                                        }
</ins><span class="cx">                                 }
</span><del>-                        });
-                        j.post( ajaxurl, {
-                                action: action,
-                                'thread_ids': checkboxes_tosend
-                        });
-                        return false;
-                }
-        );
</del><ins>+                        }
+                });
+                j.post( ajaxurl, {
+                        action: action,
+                        'thread_ids': checkboxes_tosend
+                });
+                return false;
+        });
</ins><span class="cx"> 
</span><span class="cx">         /* Selecting unread and read messages in inbox */
</span><span class="cx">         j(&quot;select#message-type-select&quot;).change(
</span></span></pre>
</div>
</div>

</body>
</html>