<!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] [2555] trunk/bp-themes/bp-default/_inc/global.js:
  Load more fixes in JS, added path setting to cookies.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>2555</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-02-03 10:13:54 +0000 (Wed, 03 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Load more fixes in JS, added path setting to cookies.</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 (2554 => 2555)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/global.js        2010-02-03 00:26:45 UTC (rev 2554)
+++ trunk/bp-themes/bp-default/_inc/global.js        2010-02-03 10:13:54 UTC (rev 2555)
</span><span class="lines">@@ -5,17 +5,8 @@
</span><span class="cx">         /**** Page Load Actions *******************************************************/
</span><span class="cx"> 
</span><span class="cx">         /* Activity Filter Select Set */
</span><del>-        if ( null != j.cookie('bp-activity-filter') &amp;&amp; j('#activity-filter-select').length )
-                j('#activity-filter-select select option[value=' + j.cookie('bp-activity-filter') + ']').attr( 'selected', 'selected' );
</del><ins>+        bp_init_activity();
</ins><span class="cx"> 
</span><del>-        /* Activity Tab Set */
-        if ( null != j.cookie('bp-activity-scope') &amp;&amp; j('div.item-list-tabs').length ) {
-                j('div.item-list-tabs li').each( function() {
-                        j(this).removeClass('selected');
-                });
-                j('li#activity-' + j.cookie('bp-activity-scope') + ', div.item-list-tabs li.current').addClass('selected');
-        }
-
</del><span class="cx">         /* Object filter and scope set. */
</span><span class="cx">         var objects = [ 'members', 'groups', 'blogs', 'forums' ];
</span><span class="cx">         bp_init_objects( objects );
</span><span class="lines">@@ -114,6 +105,10 @@
</span><span class="cx">                 if ( event.target.nodeName != 'A' )
</span><span class="cx">                         return false;
</span><span class="cx"> 
</span><ins>+                /* Reset the page */
+                j.cookie( 'bp-activity-oldestpage', 1, {path: '/'} );
+                j.cookie( 'bp-activity-querystring', null, {path: '/'} );
+
</ins><span class="cx">                 /* Activity Stream Tabs */
</span><span class="cx">                 var scope = target.attr('id').substr( 9, target.attr('id').length );
</span><span class="cx">                 var filter = j(&quot;#activity-filter-select select&quot;).val();
</span><span class="lines">@@ -243,8 +238,8 @@
</span><span class="cx">                         {
</span><span class="cx">                                 j(&quot;li.load-more&quot;).removeClass('loading');
</span><span class="cx"> 
</span><del>-                                j.cookie( 'bp-activity-querystring', response.query_string );
-                                j.cookie( 'bp-activity-oldestpage', oldest_page );
</del><ins>+                                j.cookie( 'bp-activity-querystring', response.query_string, {path: '/'} );
+                                j.cookie( 'bp-activity-oldestpage', oldest_page, {path: '/'} );
</ins><span class="cx"> 
</span><span class="cx">                                 j(&quot;ul.activity-list&quot;).append(response.contents);
</span><span class="cx"> 
</span><span class="lines">@@ -1009,21 +1004,39 @@
</span><span class="cx"> 
</span><span class="cx">         /* Clear BP cookies on logout */
</span><span class="cx">         j('a.logout').click( function() {
</span><del>-                j.cookie('bp-activity-scope', null);
-                j.cookie('bp-activity-filter', null);
-                j.cookie('bp-activity-querystring', null);
</del><ins>+                j.cookie('bp-activity-scope', null, {path: '/'});
+                j.cookie('bp-activity-filter', null, {path: '/'});
+                j.cookie('bp-activity-querystring', null, {path: '/'});
</ins><span class="cx"> 
</span><span class="cx">                 var objects = [ 'members', 'groups', 'blogs', 'forums' ];
</span><span class="cx">                 j(objects).each( function(i) {
</span><del>-                        j.cookie('bp-' + objects[i] + '-scope', null );
-                        j.cookie('bp-' + objects[i] + '-filter', null );
-                        j.cookie('bp-' + objects[i] + '-search-terms', null );
-                        j.cookie('bp-' + objects[i] + '-page', null );
-                        j.cookie('bp-' + objects[i] + '-extras', null );
</del><ins>+                        j.cookie('bp-' + objects[i] + '-scope', null, {path: '/'} );
+                        j.cookie('bp-' + objects[i] + '-filter', null, {path: '/'} );
+                        j.cookie('bp-' + objects[i] + '-search-terms', null, {path: '/'} );
+                        j.cookie('bp-' + objects[i] + '-page', null, {path: '/'} );
+                        j.cookie('bp-' + objects[i] + '-extras', null, {path: '/'} );
</ins><span class="cx">                 });
</span><span class="cx">         });
</span><span class="cx"> });
</span><span class="cx"> 
</span><ins>+/* Setup activity scope and filter based on the current cookie settings. */
+function bp_init_activity() {
+        /* Reset the page */
+        j.cookie( 'bp-activity-oldestpage', 1, {path: '/'} );
+        j.cookie( 'bp-activity-querystring', null, {path: '/'} );
+
+        if ( null != j.cookie('bp-activity-filter') &amp;&amp; j('#activity-filter-select').length )
+                j('#activity-filter-select select option[value=' + j.cookie('bp-activity-filter') + ']').attr( 'selected', 'selected' );
+
+        /* Activity Tab Set */
+        if ( null != j.cookie('bp-activity-scope') &amp;&amp; j('div.item-list-tabs').length ) {
+                j('div.item-list-tabs li').each( function() {
+                        j(this).removeClass('selected');
+                });
+                j('li#activity-' + j.cookie('bp-activity-scope') + ', div.item-list-tabs li.current').addClass('selected');
+        }
+}
+
</ins><span class="cx"> /* Setup object scope and filter based on the current cookie settings for the object. */
</span><span class="cx"> function bp_init_objects(objects) {
</span><span class="cx">         j(objects).each( function(i) {
</span><span class="lines">@@ -1038,7 +1051,7 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 /* Reset the page cookie on reload */
</span><del>-                j.cookie('bp-' + objects[i] + '-page', null);
</del><ins>+                j.cookie('bp-' + objects[i] + '-page', null, {path: '/'});
</ins><span class="cx">         });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1066,11 +1079,11 @@
</span><span class="cx">                 search_terms = j.query.get('s');
</span><span class="cx"> 
</span><span class="cx">         /* Save the type and filter to a session cookie */
</span><del>-        j.cookie( 'bp-' + object + '-scope', scope, null );
-        j.cookie( 'bp-' + object + '-filter', filter, null );
-        j.cookie( 'bp-' + object + '-page', page, null );
-        j.cookie( 'bp-' + object + '-search-terms', search_terms, null );
-        j.cookie( 'bp-' + object + '-extras', extras, null );
</del><ins>+        j.cookie( 'bp-' + object + '-scope', scope, null, {path: '/'} );
+        j.cookie( 'bp-' + object + '-filter', filter, null, {path: '/'} );
+        j.cookie( 'bp-' + object + '-page', page, null, {path: '/'} );
+        j.cookie( 'bp-' + object + '-search-terms', search_terms, null, {path: '/'} );
+        j.cookie( 'bp-' + object + '-extras', extras, null, {path: '/'} );
</ins><span class="cx"> 
</span><span class="cx">         /* Set the correct selected nav and filter */
</span><span class="cx">         j('div.item-list-tabs li').each( function() {
</span><span class="lines">@@ -1112,9 +1125,9 @@
</span><span class="cx">                 var filter = '-1';
</span><span class="cx"> 
</span><span class="cx">         /* Save the type and filter to a session cookie */
</span><del>-        j.cookie( 'bp-activity-scope', scope, null );
-        j.cookie( 'bp-activity-filter', filter, null );
-        j.cookie( 'bp-activity-oldestpage', 1 );
</del><ins>+        j.cookie( 'bp-activity-scope', scope, null, {path: '/'} );
+        j.cookie( 'bp-activity-filter', filter, null, {path: '/'} );
+        j.cookie( 'bp-activity-oldestpage', 1, {path: '/'} );
</ins><span class="cx"> 
</span><span class="cx">         /* Set the correct selected nav and filter */
</span><span class="cx">         j('div.item-list-tabs li').each( function() {
</span><span class="lines">@@ -1137,7 +1150,7 @@
</span><span class="cx">         function(response)
</span><span class="cx">         {
</span><span class="cx">                 j('.widget_bp_activity_widget h2 span.ajax-loader').hide();
</span><del>-                j.cookie( 'bp-activity-querystring', response.query_string );
</del><ins>+                j.cookie( 'bp-activity-querystring', response.query_string, {path: '/'} );
</ins><span class="cx"> 
</span><span class="cx">                 j('div.activity').fadeOut( 100, function() {
</span><span class="cx">                         j(this).html(response.contents);
</span></span></pre>
</div>
</div>

</body>
</html>