Skip to:
Content

BuddyPress.org

Changeset 2555


Ignore:
Timestamp:
02/03/2010 10:13:54 AM (15 years ago)
Author:
apeatling
Message:

Load more fixes in JS, added path setting to cookies.

File:
1 edited

Legend:

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

    r2552 r2555  
    66
    77    /* Activity Filter Select Set */
    8     if ( null != j.cookie('bp-activity-filter') && j('#activity-filter-select').length )
    9         j('#activity-filter-select select option[value=' + j.cookie('bp-activity-filter') + ']').attr( 'selected', 'selected' );
    10 
    11     /* Activity Tab Set */
    12     if ( null != j.cookie('bp-activity-scope') && j('div.item-list-tabs').length ) {
    13         j('div.item-list-tabs li').each( function() {
    14             j(this).removeClass('selected');
    15         });
    16         j('li#activity-' + j.cookie('bp-activity-scope') + ', div.item-list-tabs li.current').addClass('selected');
    17     }
     8    bp_init_activity();
    189
    1910    /* Object filter and scope set. */
     
    115106            return false;
    116107
     108        /* Reset the page */
     109        j.cookie( 'bp-activity-oldestpage', 1, {path: '/'} );
     110        j.cookie( 'bp-activity-querystring', null, {path: '/'} );
     111
    117112        /* Activity Stream Tabs */
    118113        var scope = target.attr('id').substr( 9, target.attr('id').length );
     
    244239                j("li.load-more").removeClass('loading');
    245240
    246                 j.cookie( 'bp-activity-querystring', response.query_string );
    247                 j.cookie( 'bp-activity-oldestpage', oldest_page );
     241                j.cookie( 'bp-activity-querystring', response.query_string, {path: '/'} );
     242                j.cookie( 'bp-activity-oldestpage', oldest_page, {path: '/'} );
    248243
    249244                j("ul.activity-list").append(response.contents);
     
    10101005    /* Clear BP cookies on logout */
    10111006    j('a.logout').click( function() {
    1012         j.cookie('bp-activity-scope', null);
    1013         j.cookie('bp-activity-filter', null);
    1014         j.cookie('bp-activity-querystring', null);
     1007        j.cookie('bp-activity-scope', null, {path: '/'});
     1008        j.cookie('bp-activity-filter', null, {path: '/'});
     1009        j.cookie('bp-activity-querystring', null, {path: '/'});
    10151010
    10161011        var objects = [ 'members', 'groups', 'blogs', 'forums' ];
    10171012        j(objects).each( function(i) {
    1018             j.cookie('bp-' + objects[i] + '-scope', null );
    1019             j.cookie('bp-' + objects[i] + '-filter', null );
    1020             j.cookie('bp-' + objects[i] + '-search-terms', null );
    1021             j.cookie('bp-' + objects[i] + '-page', null );
    1022             j.cookie('bp-' + objects[i] + '-extras', null );
     1013            j.cookie('bp-' + objects[i] + '-scope', null, {path: '/'} );
     1014            j.cookie('bp-' + objects[i] + '-filter', null, {path: '/'} );
     1015            j.cookie('bp-' + objects[i] + '-search-terms', null, {path: '/'} );
     1016            j.cookie('bp-' + objects[i] + '-page', null, {path: '/'} );
     1017            j.cookie('bp-' + objects[i] + '-extras', null, {path: '/'} );
    10231018        });
    10241019    });
    10251020});
     1021
     1022/* Setup activity scope and filter based on the current cookie settings. */
     1023function bp_init_activity() {
     1024    /* Reset the page */
     1025    j.cookie( 'bp-activity-oldestpage', 1, {path: '/'} );
     1026    j.cookie( 'bp-activity-querystring', null, {path: '/'} );
     1027
     1028    if ( null != j.cookie('bp-activity-filter') && j('#activity-filter-select').length )
     1029        j('#activity-filter-select select option[value=' + j.cookie('bp-activity-filter') + ']').attr( 'selected', 'selected' );
     1030
     1031    /* Activity Tab Set */
     1032    if ( null != j.cookie('bp-activity-scope') && j('div.item-list-tabs').length ) {
     1033        j('div.item-list-tabs li').each( function() {
     1034            j(this).removeClass('selected');
     1035        });
     1036        j('li#activity-' + j.cookie('bp-activity-scope') + ', div.item-list-tabs li.current').addClass('selected');
     1037    }
     1038}
    10261039
    10271040/* Setup object scope and filter based on the current cookie settings for the object. */
     
    10391052
    10401053        /* Reset the page cookie on reload */
    1041         j.cookie('bp-' + objects[i] + '-page', null);
     1054        j.cookie('bp-' + objects[i] + '-page', null, {path: '/'});
    10421055    });
    10431056}
     
    10671080
    10681081    /* Save the type and filter to a session cookie */
    1069     j.cookie( 'bp-' + object + '-scope', scope, null );
    1070     j.cookie( 'bp-' + object + '-filter', filter, null );
    1071     j.cookie( 'bp-' + object + '-page', page, null );
    1072     j.cookie( 'bp-' + object + '-search-terms', search_terms, null );
    1073     j.cookie( 'bp-' + object + '-extras', extras, null );
     1082    j.cookie( 'bp-' + object + '-scope', scope, null, {path: '/'} );
     1083    j.cookie( 'bp-' + object + '-filter', filter, null, {path: '/'} );
     1084    j.cookie( 'bp-' + object + '-page', page, null, {path: '/'} );
     1085    j.cookie( 'bp-' + object + '-search-terms', search_terms, null, {path: '/'} );
     1086    j.cookie( 'bp-' + object + '-extras', extras, null, {path: '/'} );
    10741087
    10751088    /* Set the correct selected nav and filter */
     
    11131126
    11141127    /* Save the type and filter to a session cookie */
    1115     j.cookie( 'bp-activity-scope', scope, null );
    1116     j.cookie( 'bp-activity-filter', filter, null );
    1117     j.cookie( 'bp-activity-oldestpage', 1 );
     1128    j.cookie( 'bp-activity-scope', scope, null, {path: '/'} );
     1129    j.cookie( 'bp-activity-filter', filter, null, {path: '/'} );
     1130    j.cookie( 'bp-activity-oldestpage', 1, {path: '/'} );
    11181131
    11191132    /* Set the correct selected nav and filter */
     
    11381151    {
    11391152        j('.widget_bp_activity_widget h2 span.ajax-loader').hide();
    1140         j.cookie( 'bp-activity-querystring', response.query_string );
     1153        j.cookie( 'bp-activity-querystring', response.query_string, {path: '/'} );
    11411154
    11421155        j('div.activity').fadeOut( 100, function() {
Note: See TracChangeset for help on using the changeset viewer.