Skip to:
Content

BuddyPress.org

Changeset 2519


Ignore:
Timestamp:
02/01/2010 12:26:41 PM (14 years ago)
Author:
apeatling
Message:

Moving object scope and filter init into the global scope for plugins.

File:
1 edited

Legend:

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

    r2510 r2519  
    1717    }
    1818
     19    /* Object filter and scope set. */
     20    var objects = [ 'members', 'groups', 'blogs', 'forums' ];
     21    bp_init_objects( objects );
     22
    1923    /* Hide Forums Post Form */
    2024    if ( j('div.forums').length )
    2125        j('div#new-topic-post').hide();
    22 
    23     /* Object filter and scope set. */
    24     var objects = [ 'members', 'groups', 'blogs', 'forums' ];
    25     j(objects).each( function(i) {
    26         if ( null != j.cookie('bp-' + objects[i] + '-filter') && j('div.' + objects[i]).length )
    27             j('li#' + objects[i] + '-order-select select option[value=' + j.cookie('bp-' + objects[i] + '-filter') + ']').attr( 'selected', 'selected' );
    28 
    29         if ( null != j.cookie('bp-' + objects[i] + '-scope') && j('div.' + objects[i]).length ) {
    30             j('div.item-list-tabs li').each( function() {
    31                 j(this).removeClass('selected');
    32             });
    33             j('div.item-list-tabs li#' + objects[i] + '-' + j.cookie('bp-' + objects[i] + '-scope') + ', div.item-list-tabs#object-nav li.current').addClass('selected');
    34         }
    35 
    36         /* Reset the page cookie on reload */
    37         j.cookie('bp-' + objects[i] + '-page', null);
    38     });
    3926
    4027    /* @mention Compose Scrolling */
     
    995982    });
    996983});
     984
     985/* Setup object scope and filter based on the current cookie settings for the object. */
     986function bp_init_objects(objects) {
     987    j(objects).each( function(i) {
     988        if ( null != j.cookie('bp-' + objects[i] + '-filter') && j('div.' + objects[i]).length )
     989            j('li#' + objects[i] + '-order-select select option[value=' + j.cookie('bp-' + objects[i] + '-filter') + ']').attr( 'selected', 'selected' );
     990
     991        if ( null != j.cookie('bp-' + objects[i] + '-scope') && j('div.' + objects[i]).length ) {
     992            j('div.item-list-tabs li').each( function() {
     993                j(this).removeClass('selected');
     994            });
     995            j('div.item-list-tabs li#' + objects[i] + '-' + j.cookie('bp-' + objects[i] + '-scope') + ', div.item-list-tabs#object-nav li.current').addClass('selected');
     996        }
     997
     998        /* Reset the page cookie on reload */
     999        j.cookie('bp-' + objects[i] + '-page', null);
     1000    });
     1001}
    9971002
    9981003/* Filter the current content list (groups/members/blogs/topics) */
Note: See TracChangeset for help on using the changeset viewer.