<!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] [2293] trunk/bp-themes/bp-default/_inc/global.js:
Fixing broken JS event delegation.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>2293</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-01-11 16:43:42 +0000 (Mon, 11 Jan 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fixing broken JS event delegation.</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 (2292 => 2293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/global.js        2010-01-11 14:11:07 UTC (rev 2292)
+++ trunk/bp-themes/bp-default/_inc/global.js        2010-01-11 16:43:42 UTC (rev 2293)
</span><span class="lines">@@ -96,9 +96,12 @@
</span><span class="cx">         });
</span><span class="cx">
</span><span class="cx">         /* List tabs event delegation */
</span><del>-        j('div.activity-type-tabs li a').click( function(event) {
</del><ins>+        j('div.activity-type-tabs').click( function(event) {
</ins><span class="cx">                 var target = j(event.target).parent();
</span><span class="cx">
</span><ins>+                if ( event.target.nodeName != 'A' )
+                        return false;
+
</ins><span class="cx">                 /* Activity Stream Tabs */
</span><span class="cx">                 var type = target.attr('id').substr( 9, target.attr('id').length );
</span><span class="cx">                 var filter = j("#activity-filter-select select").val();
</span><span class="lines">@@ -154,7 +157,7 @@
</span><span class="cx">
</span><span class="cx">                                 if ( 'fav' == type ) {
</span><span class="cx">                                         if ( !j('div.item-list-tabs li#activity-favorites').length )
</span><del>-                                                j('div.item-list-tabs ul li#activity-atme').before( '<li id="activity-favorites"><a href="">My Favorites (<span>0</span>)</a></li>');
</del><ins>+                                                j('div.item-list-tabs ul li#activity-atme').before( '<li id="activity-favorites"><a href="#">My Favorites (<span>0</span>)</a></li>');
</ins><span class="cx">
</span><span class="cx">                                         target.removeClass('fav');
</span><span class="cx">                                         target.addClass('unfav');
</span><span class="lines">@@ -465,7 +468,11 @@
</span><span class="cx">                         var comments_div = j(this);
</span><span class="cx">                         var parent_li = comments_div.parents('ul#activity-stream > li');
</span><span class="cx">                         var comment_lis = j(this).children('ul').children('li');
</span><ins>+                        var comment_count = ' ';
</ins><span class="cx">
</span><ins>+                        if ( j('li#' + parent_li.attr('id') + ' a.acomment-reply span').length )
+                                var comment_count = j('li#' + parent_li.attr('id') + ' a.acomment-reply span').html();
+
</ins><span class="cx">                         comment_lis.each( function(i) {
</span><span class="cx">                                 /* Show the latest 5 root comments */
</span><span class="cx">                                 if ( i < comment_lis.length - 5 ) {
</span><span class="lines">@@ -473,7 +480,7 @@
</span><span class="cx">                                         j(this).toggle();
</span><span class="cx">
</span><span class="cx">                                         if ( !i )
</span><del>-                                                j(this).before( '<li class="show-all"><a href="#' + parent_li.attr('id') + '/show-all/" title="Show all comments for this thread">Show all ' + j('li#' + parent_li.attr('id') + ' a.acomment-reply span').html() + ' comments</a></li>' );
</del><ins>+                                                j(this).before( '<li class="show-all"><a href="#' + parent_li.attr('id') + '/show-all/" title="Show all comments for this thread">Show all ' + comment_count + ' comments</a></li>' );
</ins><span class="cx">                                 }
</span><span class="cx">                         });
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>