<!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] [2148] trunk/bp-activity: Adding missed widget JS</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>2148</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2009-11-27 16:00:31 +0000 (Fri, 27 Nov 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Adding missed widget JS</pre>

<h3>Added Paths</h3>
<ul>
<li>trunk/bp-activity/js/</li>
<li><a href="#trunkbpactivityjswidgetactivityjs">trunk/bp-activity/js/widget-activity.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpactivityjswidgetactivityjs"></a>
<div class="addfile"><h4>Added: trunk/bp-activity/js/widget-activity.js (0 => 2148)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/js/widget-activity.js                                (rev 0)
+++ trunk/bp-activity/js/widget-activity.js        2009-11-27 16:00:31 UTC (rev 2148)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+jQuery(document).ready( function() {
+        var j = jQuery;
+
+        if ( j('div.widget_bp_activity_widget').length )
+                bp_activity_widget_post( j.cookie('bp_atype'), j.cookie('bp_afilter') );
+
+        /* List tabs event delegation */
+        j('div.item-list-tabs').click( function(event) {
+                var target = j(event.target).parent();
+
+                /* Activity Stream Tabs */
+                if ( target.attr('id') == 'activity-all' ||
+                          target.attr('id') == 'activity-friends' ||
+                         target.attr('id') == 'activity-groups' ) {
+
+                        var type = target.attr('id').substr( 9, target.attr('id').length );
+                        var filter = j(&quot;#activity-filter-select select&quot;).val();
+
+                        bp_activity_widget_post(type, filter);
+
+                        return false;
+                }
+        });
+
+        j('#activity-filter-select select').change( function() {
+                var selected_tab = j( '.' + j(this).parent().parent().parent().attr('class') + ' li.selected');
+                var type = selected_tab.attr('id').substr( 9, selected_tab.attr('id').length );
+                var filter = j(this).val();
+
+                bp_activity_widget_post(type, filter);
+
+                return false;
+        });
+
+        function bp_activity_widget_post(type, filter) {
+                if ( null == type )
+                        var type = 'all';
+
+                if ( null == filter )
+                        var filter = '-1';
+
+                /* Save the type and filter to a session cookie */
+                j.cookie( 'bp_atype', type, null );
+                j.cookie( 'bp_afilter', filter, null );
+
+                /* Set the correct selected nav and filter */
+                j('.widget_bp_activity_widget div.item-list-tabs li').each( function() {
+                        j(this).removeClass('selected');
+                });
+                j('li#activity-' + type).addClass('selected');
+                j('#activity-filter-select select option[value=' + filter + ']').attr( 'selected', 'selected' );
+
+                /* Reload the activity stream based on the selection */
+                j('.widget_bp_activity_widget h2 span.ajax-loader').show();
+
+                j.post( ajaxurl, {
+                        action: 'activity_widget_filter',
+                        'cookie': encodeURIComponent(document.cookie),
+                        '_wpnonce_activity_filter': j(&quot;input#_wpnonce_activity_filter&quot;).val(),
+                        'type': type,
+                        'filter': filter
+                },
+                function(response)
+                {
+                        j('.widget_bp_activity_widget h2 span.ajax-loader').hide();
+
+                        /* Check for errors and append if found. */
+                        if ( response[0] + response[1] == '-1' ) {
+                                j('div.astream').fadeOut( 100, function() {
+                                        j(this).html( response.substr( 2, response.length ) ).hide().fadeIn( 200 );
+                                        j(this).fadeIn(100);
+                                });
+                        } else {
+                                j('div.astream').fadeOut( 100, function() {
+                                        j(this).html(response);
+                                        j(this).fadeIn(100);
+                                });
+                        }
+                });
+        }
+});
+
+/* jQuery Cookie plugin */
+eval(function(p,a,c,k,e,d){e=function(c){return(c&lt;a?'':e(parseInt(c/a)))+((c=c%a)&gt;35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('o.5=B(9,b,2){6(h b!=\'E\'){2=2||{};6(b===n){b=\'\';2.3=-1}4 3=\'\';6(2.3&amp;&amp;(h 2.3==\'j\'||2.3.k)){4 7;6(h 2.3==\'j\'){7=w u();7.t(7.q()+(2.3*r*l*l*x))}m{7=2.3}3=\'; 3=\'+7.k()}4 8=2.8?\'; 8=\'+(2.8):\'\';4 a=2.a?\'; a=\'+(2.a):\'\';4 c=2.c?\'; c\':\'\';d.5=[9,\'=\',C(b),3,8,a,c].y(\'\')}m{4 e=n;6(d.5&amp;&amp;d.5!=\'\'){4 g=d.5.A(\';\');s(4 i=0;i&lt;g.f;i++){4 5=o.z(g[i]);6(5.p(0,9.f+1)==(9+\'=\')){e=D(5.p(9.f+1));v}}}F e}};',42,42,'||options|expires|var|cookie|if|date|path|name|domain|value|secure|document|cookieValue|length|cookies|typeof||number|toUTCString|60|else|null|jQuery|substring|getTime|24|for|setTime|Date|break|new|1000|join|trim|split|function|encodeURIComponent|decodeURIComponent|undefined|return'.split('|'),0,{}))
</ins></span></pre>
</div>
</div>

</body>
</html>