Skip to:
Content

BuddyPress.org

Changeset 2861


Ignore:
Timestamp:
03/19/2010 10:56:42 AM (16 years ago)
Author:
apeatling
Message:

Change jQuery var from j to jq to avoid potential iterator conflicts. Fixes #2151 props andrew_s1

File:
1 edited

Legend:

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

    r2831 r2861  
    11// AJAX Functions
    2 var j = jQuery;
     2var jq = jQuery;
    33
    44// Global variable to prevent multiple AJAX requests
    55var bp_ajax_request = null;
    66
    7 j(document).ready( function() {
     7jq(document).ready( function() {
    88        /**** Page Load Actions *******************************************************/
    99
    1010        /* Hide Forums Post Form */
    11         if ( j('div.forums').length )
    12                 j('div#new-topic-post').hide();
     11        if ( jq('div.forums').length )
     12                jq('div#new-topic-post').hide();
    1313
    1414        /* Activity filter and scope set */
     
    2020
    2121        /* @mention Compose Scrolling */
    22         if ( j.query.get('r') ) {
    23                 if ( j('textarea#whats-new').length ) {
    24                         j.scrollTo( j('textarea#whats-new'), 500, { offset:-125, easing:'easeout' } );
    25                         j('textarea#whats-new').focus();
     22        if ( jq.query.get('r') ) {
     23                if ( jq('textarea#whats-new').length ) {
     24                        jq.scrollTo( jq('textarea#whats-new'), 500, { offset:-125, easing:'easeout' } );
     25                        jq('textarea#whats-new').focus();
    2626                }
    2727        }
    2828
    2929        /* @mention username help button display */
    30         if ( j( 'span.highlight span' ).length )
    31                 j( 'span.highlight span' ).toggle();
     30        if ( jq( 'span.highlight span' ).length )
     31                jq( 'span.highlight span' ).toggle();
    3232
    3333        /**** Activity Posting ********************************************************/
    3434
    3535        /* New posts */
    36         j("input#aw-whats-new-submit").click( function() {
    37                 var button = j(this);
     36        jq("input#aw-whats-new-submit").click( function() {
     37                var button = jq(this);
    3838                var form = button.parent().parent().parent().parent();
    3939
    4040                form.children().each( function() {
    41                         if ( j.nodeName(this, "textarea") || j.nodeName(this, "input") )
    42                                 j(this).attr( 'disabled', 'disabled' );
    43                 });
    44 
    45                 j( 'form#' + form.attr('id') + ' span.ajax-loader' ).show();
     41                        if ( jq.nodeName(this, "textarea") || jq.nodeName(this, "input") )
     42                                jq(this).attr( 'disabled', 'disabled' );
     43                });
     44
     45                jq( 'form#' + form.attr('id') + ' span.ajax-loader' ).show();
    4646
    4747                /* Remove any errors */
    48                 j('div.error').remove();
     48                jq('div.error').remove();
    4949                button.attr('disabled','disabled');
    5050
    5151                /* Default POST values */
    5252                var object = '';
    53                 var item_id = j("#whats-new-post-in").val();
    54                 var content = j("textarea#whats-new").val();
     53                var item_id = jq("#whats-new-post-in").val();
     54                var content = jq("textarea#whats-new").val();
    5555
    5656                /* Set object for non-profile posts */
    5757                if ( item_id > 0 ) {
    58                         object = j("#whats-new-post-object").val();
    59                 }
    60 
    61                 j.post( ajaxurl, {
     58                        object = jq("#whats-new-post-object").val();
     59                }
     60
     61                jq.post( ajaxurl, {
    6262                        action: 'post_update',
    6363                        'cookie': encodeURIComponent(document.cookie),
    64                         '_wpnonce_post_update': j("input#_wpnonce_post_update").val(),
     64                        '_wpnonce_post_update': jq("input#_wpnonce_post_update").val(),
    6565                        'content': content,
    6666                        'object': object,
     
    6969                function(response)
    7070                {
    71                         j( 'form#' + form.attr('id') + ' span.ajax-loader' ).hide();
     71                        jq( 'form#' + form.attr('id') + ' span.ajax-loader' ).hide();
    7272
    7373                        form.children().each( function() {
    74                                 if ( j.nodeName(this, "textarea") || j.nodeName(this, "input") )
    75                                         j(this).attr( 'disabled', '' );
     74                                if ( jq.nodeName(this, "textarea") || jq.nodeName(this, "input") )
     75                                        jq(this).attr( 'disabled', '' );
    7676                        });
    7777
     
    7979                        if ( response[0] + response[1] == '-1' ) {
    8080                                form.prepend( response.substr( 2, response.length ) );
    81                                 j( 'form#' + form.attr('id') + ' div.error').hide().fadeIn( 200 );
     81                                jq( 'form#' + form.attr('id') + ' div.error').hide().fadeIn( 200 );
    8282                                button.attr("disabled", '');
    8383                        } else {
    84                                 if ( 0 == j("ul.activity-list").length ) {
    85                                         j("div.error").slideUp(100).remove();
    86                                         j("div#message").slideUp(100).remove();
    87                                         j("div.activity").append( '<ul id="activity-stream" class="activity-list item-list">' );
     84                                if ( 0 == jq("ul.activity-list").length ) {
     85                                        jq("div.error").slideUp(100).remove();
     86                                        jq("div#message").slideUp(100).remove();
     87                                        jq("div.activity").append( '<ul id="activity-stream" class="activity-list item-list">' );
    8888                                }
    8989
    90                                 j("ul.activity-list").prepend(response);
    91                                 j("ul.activity-list li:first").addClass('new-update');
    92                                 j("li.new-update").hide().slideDown( 300 );
    93                                 j("li.new-update").removeClass( 'new-update' );
    94                                 j("textarea#whats-new").val('');
     90                                jq("ul.activity-list").prepend(response);
     91                                jq("ul.activity-list li:first").addClass('new-update');
     92                                jq("li.new-update").hide().slideDown( 300 );
     93                                jq("li.new-update").removeClass( 'new-update' );
     94                                jq("textarea#whats-new").val('');
    9595
    9696                                /* Re-enable the submit button after 8 seconds. */
     
    103103
    104104        /* List tabs event delegation */
    105         j('div.activity-type-tabs').click( function(event) {
    106                 var target = j(event.target).parent();
     105        jq('div.activity-type-tabs').click( function(event) {
     106                var target = jq(event.target).parent();
    107107
    108108                if ( event.target.nodeName == 'STRONG' || event.target.nodeName == 'SPAN' )
     
    112112
    113113                /* Reset the page */
    114                 j.cookie( 'bp-activity-oldestpage', 1, {path: '/'} );
     114                jq.cookie( 'bp-activity-oldestpage', 1, {path: '/'} );
    115115
    116116                /* Activity Stream Tabs */
    117117                var scope = target.attr('id').substr( 9, target.attr('id').length );
    118                 var filter = j("#activity-filter-select select").val();
     118                var filter = jq("#activity-filter-select select").val();
    119119
    120120                if ( scope == 'mentions' )
    121                         j( 'li#' + target.attr('id') + ' a strong' ).remove();
     121                        jq( 'li#' + target.attr('id') + ' a strong' ).remove();
    122122
    123123                bp_activity_request(scope, filter, target);
     
    127127
    128128        /* Activity filter select */
    129         j('#activity-filter-select select').change( function() {
    130                 var selected_tab = j( 'div.activity-type-tabs li.selected' );
     129        jq('#activity-filter-select select').change( function() {
     130                var selected_tab = jq( 'div.activity-type-tabs li.selected' );
    131131
    132132                if ( !selected_tab.length )
     
    135135                        var scope = selected_tab.attr('id').substr( 9, selected_tab.attr('id').length );
    136136
    137                 var filter = j(this).val();
     137                var filter = jq(this).val();
    138138
    139139                bp_activity_request(scope, filter);
     
    143143
    144144        /* Stream event delegation */
    145         j('div.activity').click( function(event) {
    146                 var target = j(event.target);
     145        jq('div.activity').click( function(event) {
     146                var target = jq(event.target);
    147147
    148148                /* Favoriting activity stream items */
     
    154154                        target.addClass('loading');
    155155
    156                         j.post( ajaxurl, {
     156                        jq.post( ajaxurl, {
    157157                                action: 'activity_mark_' + type,
    158158                                'cookie': encodeURIComponent(document.cookie),
     
    163163
    164164                                target.fadeOut( 100, function() {
    165                                         j(this).html(response);
    166                                         j(this).fadeIn(100);
     165                                        jq(this).html(response);
     166                                        jq(this).fadeIn(100);
    167167                                });
    168168
    169169                                if ( 'fav' == type ) {
    170                                         if ( !j('div.item-list-tabs li#activity-favorites').length )
    171                                                 j('div.item-list-tabs ul li#activity-mentions').before( '<li id="activity-favorites"><a href="#">' + bp_terms_my_favs + ' (<span>0</span>)</a></li>');
     170                                        if ( !jq('div.item-list-tabs li#activity-favorites').length )
     171                                                jq('div.item-list-tabs ul li#activity-mentions').before( '<li id="activity-favorites"><a href="#">' + bp_terms_my_favs + ' (<span>0</span>)</a></li>');
    172172
    173173                                        target.removeClass('fav');
    174174                                        target.addClass('unfav');
    175175
    176                                         j('div.item-list-tabs ul li#activity-favorites span').html( Number( j('div.item-list-tabs ul li#activity-favorites span').html() ) + 1 );
     176                                        jq('div.item-list-tabs ul li#activity-favorites span').html( Number( jq('div.item-list-tabs ul li#activity-favorites span').html() ) + 1 );
    177177                                } else {
    178178                                        target.removeClass('unfav');
    179179                                        target.addClass('fav');
    180180
    181                                         j('div.item-list-tabs ul li#activity-favorites span').html( Number( j('div.item-list-tabs ul li#activity-favorites span').html() ) - 1 );
    182 
    183                                         if ( !Number( j('div.item-list-tabs ul li#activity-favorites span').html() ) ) {
    184                                                 if ( j('div.item-list-tabs ul li#activity-favorites').hasClass('selected') )
     181                                        jq('div.item-list-tabs ul li#activity-favorites span').html( Number( jq('div.item-list-tabs ul li#activity-favorites span').html() ) - 1 );
     182
     183                                        if ( !Number( jq('div.item-list-tabs ul li#activity-favorites span').html() ) ) {
     184                                                if ( jq('div.item-list-tabs ul li#activity-favorites').hasClass('selected') )
    185185                                                        bp_activity_request( null, null );
    186186
    187                                                 j('div.item-list-tabs ul li#activity-favorites').remove();
     187                                                jq('div.item-list-tabs ul li#activity-favorites').remove();
    188188                                        }
    189189                                }
    190190
    191                                 if ( 'activity-favorites' == j( 'div.item-list-tabs li.selected').attr('id') )
     191                                if ( 'activity-favorites' == jq( 'div.item-list-tabs li.selected').attr('id') )
    192192                                        target.parent().parent().parent().slideUp(100);
    193193                        });
     
    207207                        target.addClass('loading');
    208208
    209                         j.post( ajaxurl, {
     209                        jq.post( ajaxurl, {
    210210                                action: 'delete_activity',
    211211                                'cookie': encodeURIComponent(document.cookie),
     
    229229                /* Load more updates at the end of the page */
    230230                if ( target.parent().attr('class') == 'load-more' ) {
    231                         j("li.load-more").addClass('loading');
    232 
    233                         if ( null == j.cookie('bp-activity-oldestpage') )
    234                                 j.cookie('bp-activity-oldestpage', 1, {path: '/'} );
    235 
    236                         var oldest_page = ( j.cookie('bp-activity-oldestpage') * 1 ) + 1;
    237 
    238                         j.post( ajaxurl, {
     231                        jq("li.load-more").addClass('loading');
     232
     233                        if ( null == jq.cookie('bp-activity-oldestpage') )
     234                                jq.cookie('bp-activity-oldestpage', 1, {path: '/'} );
     235
     236                        var oldest_page = ( jq.cookie('bp-activity-oldestpage') * 1 ) + 1;
     237
     238                        jq.post( ajaxurl, {
    239239                                action: 'activity_get_older_updates',
    240240                                'cookie': encodeURIComponent(document.cookie),
     
    243243                        function(response)
    244244                        {
    245                                 j("li.load-more").removeClass('loading');
    246                                 j.cookie( 'bp-activity-oldestpage', oldest_page, {path: '/'} );
    247                                 j("ul.activity-list").append(response.contents);
     245                                jq("li.load-more").removeClass('loading');
     246                                jq.cookie( 'bp-activity-oldestpage', oldest_page, {path: '/'} );
     247                                jq("ul.activity-list").append(response.contents);
    248248
    249249                                target.parent().hide();
     
    257257
    258258        /* Hide all activity comment forms */
    259         j('form.ac-form').hide();
     259        jq('form.ac-form').hide();
    260260
    261261        /* Hide excess comments */
    262         if ( j('div.activity-comments').length )
     262        if ( jq('div.activity-comments').length )
    263263                bp_dtheme_hide_comments();
    264264
    265265        /* Activity list event delegation */
    266         j('div.activity').click( function(event) {
    267                 var target = j(event.target);
     266        jq('div.activity').click( function(event) {
     267                var target = jq(event.target);
    268268
    269269                /* Comment / comment reply links */
     
    277277                        var a_id = ids[2]
    278278                        var c_id = target.attr('href').substr( 10, target.attr('href').length );
    279                         var form = j( '#ac-form-' + a_id );
    280 
    281                         var form = j( '#ac-form-' + ids[2] );
     279                        var form = jq( '#ac-form-' + a_id );
     280
     281                        var form = jq( '#ac-form-' + ids[2] );
    282282
    283283                        form.css( 'display', 'none' );
    284284                        form.removeClass('root');
    285                         j('.ac-form').hide();
     285                        jq('.ac-form').hide();
    286286
    287287                        /* Hide any error messages */
    288288                        form.children('div').each( function() {
    289                                 if ( j(this).hasClass( 'error' ) )
    290                                         j(this).hide();
     289                                if ( jq(this).hasClass( 'error' ) )
     290                                        jq(this).hide();
    291291                        });
    292292
    293293                        if ( ids[1] != 'comment' ) {
    294                                 j('div.activity-comments li#acomment-' + c_id).append( form );
     294                                jq('div.activity-comments li#acomment-' + c_id).append( form );
    295295                        } else {
    296                                 j('li#activity-' + a_id + ' div.activity-comments').append( form );
     296                                jq('li#activity-' + a_id + ' div.activity-comments').append( form );
    297297                        }
    298298
     
    301301
    302302                        form.slideDown( 200 );
    303                         j.scrollTo( form, 500, { offset:-100, easing:'easeout' } );
    304                         j('#ac-form-' + ids[2] + ' textarea').focus();
     303                        jq.scrollTo( form, 500, { offset:-100, easing:'easeout' } );
     304                        jq('#ac-form-' + ids[2] + ' textarea').focus();
    305305
    306306                        return false;
     
    321321
    322322                        /* Hide any error messages */
    323                         j( 'form#' + form + ' div.error').hide();
     323                        jq( 'form#' + form + ' div.error').hide();
    324324                        form.addClass('loading');
    325325                        target.css('disabled', 'disabled');
    326326
    327                         j.post( ajaxurl, {
     327                        jq.post( ajaxurl, {
    328328                                action: 'new_activity_comment',
    329329                                'cookie': encodeURIComponent(document.cookie),
    330                                 '_wpnonce_new_activity_comment': j("input#_wpnonce_new_activity_comment").val(),
     330                                '_wpnonce_new_activity_comment': jq("input#_wpnonce_new_activity_comment").val(),
    331331                                'comment_id': comment_id,
    332332                                'form_id': form_id[2],
    333                                 'content': j('form#' + form.attr('id') + ' textarea').val()
     333                                'content': jq('form#' + form.attr('id') + ' textarea').val()
    334334                        },
    335335                        function(response)
     
    356356                                                }
    357357                                        );
    358                                         j( 'form#' + form + ' textarea').val('');
     358                                        jq( 'form#' + form + ' textarea').val('');
    359359
    360360                                        /* Increase the "Reply (X)" button count */
    361                                         j('li#activity-' + form_id[2] + ' a.acomment-reply span').html( Number( j('li#activity-' + form_id[2] + ' a.acomment-reply span').html() ) + 1 );
     361                                        jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html( Number( jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html() ) + 1 );
    362362
    363363                                        /* Re-enable the submit button after 5 seconds. */
     
    385385
    386386                        /* Remove any error messages */
    387                         j('div.activity-comments ul div.error').remove();
     387                        jq('div.activity-comments ul div.error').remove();
    388388
    389389                        /* Reset the form position */
    390390                        comment_li.parents('div.activity-comments').append(form);
    391391
    392                         j.post( ajaxurl, {
     392                        jq.post( ajaxurl, {
    393393                                action: 'delete_activity_comment',
    394394                                'cookie': encodeURIComponent(document.cookie),
     
    402402                                        comment_li.prepend( response.substr( 2, response.length ) ).hide().fadeIn( 200 );
    403403                                } else {
    404                                         var children = j( 'li#' + comment_li.attr('id') + ' ul' ).children('li');
     404                                        var children = jq( 'li#' + comment_li.attr('id') + ' ul' ).children('li');
    405405                                        var child_count = 0;
    406                                         j(children).each( function() {
    407                                                 if ( !j(this).is(':hidden') )
     406                                        jq(children).each( function() {
     407                                                if ( !jq(this).is(':hidden') )
    408408                                                        child_count++;
    409409                                        });
     
    412412                                        /* Decrease the "Reply (X)" button count */
    413413                                        var parent_li = comment_li.parents('ul#activity-stream > li');
    414                                         j('li#' + parent_li.attr('id') + ' a.acomment-reply span').html( j('li#' + parent_li.attr('id') + ' a.acomment-reply span').html() - ( 1 + child_count ) );
     414                                        jq('li#' + parent_li.attr('id') + ' a.acomment-reply span').html( jq('li#' + parent_li.attr('id') + ' a.acomment-reply span').html() - ( 1 + child_count ) );
    415415                                }
    416416                        });
     
    434434
    435435        /* Escape Key Press for cancelling comment forms */
    436         j(document).keydown( function(e) {
     436        jq(document).keydown( function(e) {
    437437                e = e || window.event;
    438438                if (e.target)
     
    451451                if ( keyCode == 27 ) {
    452452                        if (element.tagName == 'TEXTAREA') {
    453                                 if ( j(element).attr('class') == 'ac-input' )
    454                                         j(element).parent().parent().parent().slideUp( 200 );
     453                                if ( jq(element).attr('class') == 'ac-input' )
     454                                        jq(element).parent().parent().parent().slideUp( 200 );
    455455                        }
    456456                }
     
    459459        /**** @mention username help tooltip **************************************/
    460460
    461         j('span.highlight span').click( function() {
    462                 if ( !j('div.help').length ) {
    463                         j(this).parent().after( '<div id="message" class="info help"><p>' + bp_terms_mention_explain + '</p></div>' );
    464                         j('div.help').hide().slideDown(200);
     461        jq('span.highlight span').click( function() {
     462                if ( !jq('div.help').length ) {
     463                        jq(this).parent().after( '<div id="message" class="info help"><p>' + bp_terms_mention_explain + '</p></div>' );
     464                        jq('div.help').hide().slideDown(200);
    465465                } else {
    466                         j('div.help').hide().remove();
     466                        jq('div.help').hide().remove();
    467467                }
    468468        })
     
    471471
    472472        /* The search form on all directory pages */
    473         j('div.dir-search').click( function(event) {
    474                 if ( j(this).hasClass('no-ajax') )
     473        jq('div.dir-search').click( function(event) {
     474                if ( jq(this).hasClass('no-ajax') )
    475475                        return;
    476476
    477                 var target = j(event.target);
     477                var target = jq(event.target);
    478478
    479479                if ( target.attr('type') == 'submit' ) {
    480                         var css_id = j('div.item-list-tabs li.selected').attr('id').split( '-' );
     480                        var css_id = jq('div.item-list-tabs li.selected').attr('id').split( '-' );
    481481                        var object = css_id[0];
    482482
    483                         bp_filter_request( object, j.cookie('bp-' + object + '-filter'), j.cookie('bp-' + object + '-scope') , 'div.' + object, target.parent().children('label').children('input').val(), 1, j.cookie('bp-' + object + '-extras') );
     483                        bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope') , 'div.' + object, target.parent().children('label').children('input').val(), 1, jq.cookie('bp-' + object + '-extras') );
    484484
    485485                        return false;
     
    490490
    491491        /* When a navigation tab is clicked - e.g. | All Groups | My Groups | */
    492         j('div.item-list-tabs').click( function(event) {
    493                 if ( j(this).hasClass('no-ajax') )
     492        jq('div.item-list-tabs').click( function(event) {
     493                if ( jq(this).hasClass('no-ajax') )
    494494                        return;
    495495
    496                 var target = j(event.target).parent();
     496                var target = jq(event.target).parent();
    497497
    498498                if ( 'LI' == event.target.parentNode.nodeName && !target.hasClass('last') ) {
     
    504504
    505505                        var scope = css_id[1];
    506                         var filter = j("#" + object + "-order-select select").val();
    507                         var search_terms = j("#" + object + "_search").val();
    508 
    509                         bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, j.cookie('bp-' + object + '-extras') );
     506                        var filter = jq("#" + object + "-order-select select").val();
     507                        var search_terms = jq("#" + object + "_search").val();
     508
     509                        bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, jq.cookie('bp-' + object + '-extras') );
    510510
    511511                        return false;
     
    514514
    515515        /* When the filter select box is changed re-query */
    516         j('li.filter select').change( function() {
    517                 if ( j('div.item-list-tabs li.selected').length )
    518                         var el = j('div.item-list-tabs li.selected');
     516        jq('li.filter select').change( function() {
     517                if ( jq('div.item-list-tabs li.selected').length )
     518                        var el = jq('div.item-list-tabs li.selected');
    519519                else
    520                         var el = j(this);
     520                        var el = jq(this);
    521521
    522522                var css_id = el.attr('id').split('-');
    523523                var object = css_id[0];
    524524                var scope = css_id[1];
    525                 var filter = j(this).val();
     525                var filter = jq(this).val();
    526526                var search_terms = false;
    527527
    528                 if ( j('div.dir-search input').length )
    529                         search_terms = j('div.dir-search input').val();
     528                if ( jq('div.dir-search input').length )
     529                        search_terms = jq('div.dir-search input').val();
    530530
    531531                if ( 'friends' == object )
    532532                        object = 'members';
    533533
    534                 bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, j.cookie('bp-' + object + '-extras') );
     534                bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, jq.cookie('bp-' + object + '-extras') );
    535535
    536536                return false;
     
    538538
    539539        /* All pagination links run through this function */
    540         j('div#content').click( function(event) {
    541                 var target = j(event.target);
     540        jq('div#content').click( function(event) {
     541                var target = jq(event.target);
    542542
    543543                if ( target.hasClass('button') )
     
    548548                                return false;
    549549
    550                         if ( j('div.item-list-tabs li.selected').length )
    551                                 var el = j('div.item-list-tabs li.selected');
     550                        if ( jq('div.item-list-tabs li.selected').length )
     551                                var el = jq('div.item-list-tabs li.selected');
    552552                        else
    553                                 var el = j('li.filter select');
     553                                var el = jq('li.filter select');
    554554
    555555                        var page_number = 1;
     
    558558                        var search_terms = false;
    559559
    560                         if ( j('div.dir-search input').length )
    561                                 search_terms = j('div.dir-search input').val();
    562 
    563                         if ( j(target).hasClass('next') )
    564                                 var page_number = Number( j('div.pagination span.current').html() ) + 1;
    565                         else if ( j(target).hasClass('prev') )
    566                                 var page_number = Number( j('div.pagination span.current').html() ) - 1;
     560                        if ( jq('div.dir-search input').length )
     561                                search_terms = jq('div.dir-search input').val();
     562
     563                        if ( jq(target).hasClass('next') )
     564                                var page_number = Number( jq('div.pagination span.current').html() ) + 1;
     565                        else if ( jq(target).hasClass('prev') )
     566                                var page_number = Number( jq('div.pagination span.current').html() ) - 1;
    567567                        else
    568                                 var page_number = Number( j(target).html() );
    569 
    570                         bp_filter_request( object, j.cookie('bp-' + object + '-filter'), j.cookie('bp-' + object + '-scope'), 'div.' + object, search_terms, page_number, j.cookie('bp-' + object + '-extras') );
     568                                var page_number = Number( jq(target).html() );
     569
     570                        bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope'), 'div.' + object, search_terms, page_number, jq.cookie('bp-' + object + '-extras') );
    571571
    572572                        return false;
     
    578578
    579579        /* Hit the "New Topic" button on the forums directory page */
    580         j('a#new-topic-button').click( function() {
    581                 if ( !j('div#new-topic-post').length )
    582                         return false;
    583 
    584                 if ( j('div#new-topic-post').is(":visible") )
    585                         j('div#new-topic-post').slideUp(200);
     580        jq('a#new-topic-button').click( function() {
     581                if ( !jq('div#new-topic-post').length )
     582                        return false;
     583
     584                if ( jq('div#new-topic-post').is(":visible") )
     585                        jq('div#new-topic-post').slideUp(200);
    586586                else
    587                         j('div#new-topic-post').slideDown(200);
     587                        jq('div#new-topic-post').slideDown(200);
    588588
    589589                return false;
     
    591591
    592592        /* Cancel the posting of a new forum topic */
    593         j('input#submit_topic_cancel').click( function() {
    594                 if ( !j('div#new-topic-post').length )
    595                         return false;
    596 
    597                 j('div#new-topic-post').slideUp(200);
     593        jq('input#submit_topic_cancel').click( function() {
     594                if ( !jq('div#new-topic-post').length )
     595                        return false;
     596
     597                jq('div#new-topic-post').slideUp(200);
    598598                return false;
    599599        });
    600600
    601601        /* Clicking a forum tag */
    602         j('div#forum-directory-tags a').click( function() {
    603                 bp_filter_request( 'forums', 'tags', j.cookie('bp-forums-scope'), 'div.forums', j(this).html().replace( /&nbsp;/g, '-' ), 1, j.cookie('bp-forums-extras') );
     602        jq('div#forum-directory-tags a').click( function() {
     603                bp_filter_request( 'forums', 'tags', jq.cookie('bp-forums-scope'), 'div.forums', jq(this).html().replace( /&nbsp;/g, '-' ), 1, jq.cookie('bp-forums-extras') );
    604604                return false;
    605605        });
     
    608608
    609609        /* Select a user from the list of friends and add them to the invite list */
    610         j("div#invite-list input").click( function() {
    611                 j('.ajax-loader').toggle();
    612 
    613                 var friend_id = j(this).val();
    614 
    615                 if ( j(this).attr('checked') == true )
     610        jq("div#invite-list input").click( function() {
     611                jq('.ajax-loader').toggle();
     612
     613                var friend_id = jq(this).val();
     614
     615                if ( jq(this).attr('checked') == true )
    616616                        var friend_action = 'invite';
    617617                else
    618618                        var friend_action = 'uninvite';
    619619
    620                 j('div.item-list-tabs li.selected').addClass('loading');
    621 
    622                 j.post( ajaxurl, {
     620                jq('div.item-list-tabs li.selected').addClass('loading');
     621
     622                jq.post( ajaxurl, {
    623623                        action: 'groups_invite_user',
    624624                        'friend_action': friend_action,
    625625                        'cookie': encodeURIComponent(document.cookie),
    626                         '_wpnonce': j("input#_wpnonce_invite_uninvite_user").val(),
     626                        '_wpnonce': jq("input#_wpnonce_invite_uninvite_user").val(),
    627627                        'friend_id': friend_id,
    628                         'group_id': j("input#group_id").val()
     628                        'group_id': jq("input#group_id").val()
    629629                },
    630630                function(response)
    631631                {
    632                         if ( j("#message") )
    633                                 j("#message").hide();
    634 
    635                         j('.ajax-loader').toggle();
     632                        if ( jq("#message") )
     633                                jq("#message").hide();
     634
     635                        jq('.ajax-loader').toggle();
    636636
    637637                        if ( friend_action == 'invite' ) {
    638                                 j('#friend-list').append(response);
     638                                jq('#friend-list').append(response);
    639639                        } else if ( friend_action == 'uninvite' ) {
    640                                 j('#friend-list li#uid-' + friend_id).remove();
    641                         }
    642 
    643                         j('div.item-list-tabs li.selected').removeClass('loading');
     640                                jq('#friend-list li#uid-' + friend_id).remove();
     641                        }
     642
     643                        jq('div.item-list-tabs li.selected').removeClass('loading');
    644644                });
    645645        });
    646646
    647647        /* Remove a user from the list of users to invite to a group */
    648         j("#friend-list li a.remove").live('click', function() {
    649                 j('.ajax-loader').toggle();
    650 
    651                 var friend_id = j(this).attr('id');
     648        jq("#friend-list li a.remove").live('click', function() {
     649                jq('.ajax-loader').toggle();
     650
     651                var friend_id = jq(this).attr('id');
    652652                friend_id = friend_id.split('-');
    653653                friend_id = friend_id[1];
    654654
    655                 j.post( ajaxurl, {
     655                jq.post( ajaxurl, {
    656656                        action: 'groups_invite_user',
    657657                        'friend_action': 'uninvite',
    658658                        'cookie': encodeURIComponent(document.cookie),
    659                         '_wpnonce': j("input#_wpnonce_invite_uninvite_user").val(),
     659                        '_wpnonce': jq("input#_wpnonce_invite_uninvite_user").val(),
    660660                        'friend_id': friend_id,
    661                         'group_id': j("input#group_id").val()
     661                        'group_id': jq("input#group_id").val()
    662662                },
    663663                function(response)
    664664                {
    665                         j('.ajax-loader').toggle();
    666                         j('#friend-list li#uid-' + friend_id).remove();
    667                         j('#invite-list input#f-' + friend_id).attr('checked', false);
     665                        jq('.ajax-loader').toggle();
     666                        jq('#friend-list li#uid-' + friend_id).remove();
     667                        jq('#invite-list input#f-' + friend_id).attr('checked', false);
    668668                });
    669669
     
    674674
    675675        /* Accept and Reject friendship request buttons */
    676         j("ul#friend-list a.accept, ul#friend-list a.reject").click( function() {
    677                 var button = j(this);
    678                 var li = j(this).parents('ul#friend-list li');
    679                 var action_div = j(this).parents('li div.action');
     676        jq("ul#friend-list a.accept, ul#friend-list a.reject").click( function() {
     677                var button = jq(this);
     678                var li = jq(this).parents('ul#friend-list li');
     679                var action_div = jq(this).parents('li div.action');
    680680
    681681                var id = li.attr('id').substr( 11, li.attr('id').length );
     
    685685                        nonce = nonce[1];
    686686
    687                 if ( j(this).hasClass('accepted') || j(this).hasClass('rejected') )
    688                         return false;
    689 
    690                 if ( j(this).hasClass('accept') ) {
     687                if ( jq(this).hasClass('accepted') || jq(this).hasClass('rejected') )
     688                        return false;
     689
     690                if ( jq(this).hasClass('accept') ) {
    691691                        var action = 'accept_friendship';
    692692                        action_div.children('a.reject').css( 'visibility', 'hidden' );
     
    698698                button.addClass('loading');
    699699
    700                 j.post( ajaxurl, {
     700                jq.post( ajaxurl, {
    701701                        action: action,
    702702                        'cookie': encodeURIComponent(document.cookie),
     
    712712                        } else {
    713713                                button.fadeOut( 100, function() {
    714                                         if ( j(this).hasClass('accept') ) {
    715                                                 j(this).html( bp_terms_accepted ).fadeIn(50);
    716                                                 j(this).addClass('accepted');
     714                                        if ( jq(this).hasClass('accept') ) {
     715                                                jq(this).html( bp_terms_accepted ).fadeIn(50);
     716                                                jq(this).addClass('accepted');
    717717                                        } else {
    718                                                 j(this).html( bp_terms_rejected ).fadeIn(50);
    719                                                 j(this).addClass('rejected');
     718                                                jq(this).html( bp_terms_rejected ).fadeIn(50);
     719                                                jq(this).addClass('rejected');
    720720                                        }
    721721                                });
     
    727727
    728728        /* Add / Remove friendship buttons */
    729         j("div.friendship-button a").live('click', function() {
    730                 j(this).parent().addClass('loading');
    731                 var fid = j(this).attr('id');
     729        jq("div.friendship-button a").live('click', function() {
     730                jq(this).parent().addClass('loading');
     731                var fid = jq(this).attr('id');
    732732                fid = fid.split('-');
    733733                fid = fid[1];
    734734
    735                 var nonce = j(this).attr('href');
     735                var nonce = jq(this).attr('href');
    736736                nonce = nonce.split('?_wpnonce=');
    737737                nonce = nonce[1].split('&');
    738738                nonce = nonce[0];
    739739
    740                 var thelink = j(this);
    741 
    742                 j.post( ajaxurl, {
     740                var thelink = jq(this);
     741
     742                jq.post( ajaxurl, {
    743743                        action: 'addremove_friend',
    744744                        'cookie': encodeURIComponent(document.cookie),
     
    752752
    753753                        if ( action == 'add' ) {
    754                                 j(parentdiv).fadeOut(200,
     754                                jq(parentdiv).fadeOut(200,
    755755                                        function() {
    756756                                                parentdiv.removeClass('add_friend');
     
    762762
    763763                        } else if ( action == 'remove' ) {
    764                                 j(parentdiv).fadeOut(200,
     764                                jq(parentdiv).fadeOut(200,
    765765                                        function() {
    766766                                                parentdiv.removeClass('remove_friend');
     
    777777        /** Group Join / Leave Buttons **************************************/
    778778
    779         j("div.group-button a").live('click', function() {
    780                 var gid = j(this).parent().attr('id');
     779        jq("div.group-button a").live('click', function() {
     780                var gid = jq(this).parent().attr('id');
    781781                gid = gid.split('-');
    782782                gid = gid[1];
    783783
    784                 var nonce = j(this).attr('href');
     784                var nonce = jq(this).attr('href');
    785785                nonce = nonce.split('?_wpnonce=');
    786786                nonce = nonce[1].split('&');
    787787                nonce = nonce[0];
    788788
    789                 var thelink = j(this);
    790 
    791                 j.post( ajaxurl, {
     789                var thelink = jq(this);
     790
     791                jq.post( ajaxurl, {
    792792                        action: 'joinleave_group',
    793793                        'cookie': encodeURIComponent(document.cookie),
     
    799799                        var parentdiv = thelink.parent();
    800800
    801                         if ( !j('body.directory').length )
     801                        if ( !jq('body.directory').length )
    802802                                location.href = location.href;
    803803                        else {
    804                                 j(parentdiv).fadeOut(200,
     804                                jq(parentdiv).fadeOut(200,
    805805                                        function() {
    806806                                                parentdiv.fadeIn(200).html(response);
     
    814814        /** Button disabling ************************************************/
    815815
    816         j('div.pending').click(function() {
     816        jq('div.pending').click(function() {
    817817                return false;
    818818        });
     
    820820        /** Alternate Highlighting ******************************************/
    821821
    822         j('table tr, div.message-box, ul#topic-post-list li').each( function(i) {
     822        jq('table tr, div.message-box, ul#topic-post-list li').each( function(i) {
    823823                if ( i % 2 != 1 )
    824                         j(this).addClass('alt');
     824                        jq(this).addClass('alt');
    825825        });
    826826
     
    828828
    829829        /* AJAX send reply functionality */
    830         j("input#send_reply_button").click(
     830        jq("input#send_reply_button").click(
    831831                function() {
    832                         j('form#send-reply span.ajax-loader').toggle();
    833 
    834                         j.post( ajaxurl, {
     832                        jq('form#send-reply span.ajax-loader').toggle();
     833
     834                        jq.post( ajaxurl, {
    835835                                action: 'messages_send_reply',
    836836                                'cookie': encodeURIComponent(document.cookie),
    837                                 '_wpnonce': j("input#send_message_nonce").val(),
    838 
    839                                 'content': j("#message_content").val(),
    840                                 'send_to': j("input#send_to").val(),
    841                                 'subject': j("input#subject").val(),
    842                                 'thread_id': j("input#thread_id").val()
     837                                '_wpnonce': jq("input#send_message_nonce").val(),
     838
     839                                'content': jq("#message_content").val(),
     840                                'send_to': jq("input#send_to").val(),
     841                                'subject': jq("input#subject").val(),
     842                                'thread_id': jq("input#thread_id").val()
    843843                        },
    844844                        function(response)
    845845                        {
    846846                                if ( response[0] + response[1] == "-1" ) {
    847                                         j('form#send-reply').prepend( response.substr( 2, response.length ) );
     847                                        jq('form#send-reply').prepend( response.substr( 2, response.length ) );
    848848                                } else {
    849                                         j('form#send-reply div#message').remove();
    850                                         j("#message_content").val('');
    851                                         j('form#send-reply').before( response );
    852 
    853                                         j("div.new-message").hide().slideDown( 200, function() {
    854                                                 j('div.new-message').removeClass('new-message');
     849                                        jq('form#send-reply div#message').remove();
     850                                        jq("#message_content").val('');
     851                                        jq('form#send-reply').before( response );
     852
     853                                        jq("div.new-message").hide().slideDown( 200, function() {
     854                                                jq('div.new-message').removeClass('new-message');
    855855                                        });
    856856
    857                                         j('div.message-box').each( function(i) {
    858                                                 j(this).removeClass('alt');
     857                                        jq('div.message-box').each( function(i) {
     858                                                jq(this).removeClass('alt');
    859859                                                if ( i % 2 != 1 )
    860                                                         j(this).addClass('alt');
     860                                                        jq(this).addClass('alt');
    861861                                        });
    862862                                }
    863                                 j('form#send-reply span.ajax-loader').toggle();
     863                                jq('form#send-reply span.ajax-loader').toggle();
    864864                        });
    865865
     
    869869
    870870        /* Marking private messages as read and unread */
    871         j("a#mark_as_read, a#mark_as_unread").click(function() {
     871        jq("a#mark_as_read, a#mark_as_unread").click(function() {
    872872                var checkboxes_tosend = '';
    873                 var checkboxes = j("#message-threads tr td input[type='checkbox']");
    874 
    875                 if ( 'mark_as_unread' == j(this).attr('id') ) {
     873                var checkboxes = jq("#message-threads tr td input[type='checkbox']");
     874
     875                if ( 'mark_as_unread' == jq(this).attr('id') ) {
    876876                        var currentClass = 'read'
    877877                        var newClass = 'unread'
     
    890890
    891891                checkboxes.each( function(i) {
    892                         if(j(this).is(':checked')) {
    893                                 if ( j('tr#m-' + j(this).attr('value')).hasClass(currentClass) ) {
    894                                         checkboxes_tosend += j(this).attr('value');
    895                                         j('tr#m-' + j(this).attr('value')).removeClass(currentClass);
    896                                         j('tr#m-' + j(this).attr('value')).addClass(newClass);
    897                                         var thread_count = j('tr#m-' + j(this).attr('value') + ' td span.unread-count').html();
    898 
    899                                         j('tr#m-' + j(this).attr('value') + ' td span.unread-count').html(unreadCount);
    900                                         j('tr#m-' + j(this).attr('value') + ' td span.unread-count').css('display', unreadCountDisplay);
    901                                         var inboxcount = j('a#user-messages strong').html().substr( 1, j('a#user-messages strong').html().length );
     892                        if(jq(this).is(':checked')) {
     893                                if ( jq('tr#m-' + jq(this).attr('value')).hasClass(currentClass) ) {
     894                                        checkboxes_tosend += jq(this).attr('value');
     895                                        jq('tr#m-' + jq(this).attr('value')).removeClass(currentClass);
     896                                        jq('tr#m-' + jq(this).attr('value')).addClass(newClass);
     897                                        var thread_count = jq('tr#m-' + jq(this).attr('value') + ' td span.unread-count').html();
     898
     899                                        jq('tr#m-' + jq(this).attr('value') + ' td span.unread-count').html(unreadCount);
     900                                        jq('tr#m-' + jq(this).attr('value') + ' td span.unread-count').css('display', unreadCountDisplay);
     901                                        var inboxcount = jq('a#user-messages strong').html().substr( 1, jq('a#user-messages strong').html().length );
    902902                                        var inboxcount = inboxcount.substr( 0, inboxcount.length - 1 );
    903903
     
    905905                                                inboxcount = 0;
    906906                                        if ( parseInt(inboxcount) == inboxCount ) {
    907                                                 j('a#user-messages strong').css('display', unreadCountDisplay);
    908                                                 j('a#user-messages strong').html( '(' + unreadCount + ')' );
     907                                                jq('a#user-messages strong').css('display', unreadCountDisplay);
     908                                                jq('a#user-messages strong').html( '(' + unreadCount + ')' );
    909909                                        } else {
    910910                                                if ( 'read' == currentClass )
    911                                                         j('a#user-messages strong').html('(' + ( parseInt(inboxcount) + 1 ) + ')');
     911                                                        jq('a#user-messages strong').html('(' + ( parseInt(inboxcount) + 1 ) + ')');
    912912                                                else
    913                                                         j('a#user-messages strong').html('(' + ( parseInt(inboxcount) - thread_count ) + ')');
     913                                                        jq('a#user-messages strong').html('(' + ( parseInt(inboxcount) - thread_count ) + ')');
    914914                                        }
    915915
     
    920920                        }
    921921                });
    922                 j.post( ajaxurl, {
     922                jq.post( ajaxurl, {
    923923                        action: action,
    924924                        'thread_ids': checkboxes_tosend
     
    928928
    929929        /* Selecting unread and read messages in inbox */
    930         j("select#message-type-select").change(
     930        jq("select#message-type-select").change(
    931931                function() {
    932                         var selection = j("select#message-type-select").val();
    933                         var checkboxes = j("td input[type='checkbox']");
     932                        var selection = jq("select#message-type-select").val();
     933                        var checkboxes = jq("td input[type='checkbox']");
    934934                        checkboxes.each( function(i) {
    935935                                checkboxes[i].checked = "";
     
    938938                        switch(selection) {
    939939                                case 'unread':
    940                                         var checkboxes = j("tr.unread td input[type='checkbox']");
     940                                        var checkboxes = jq("tr.unread td input[type='checkbox']");
    941941                                break;
    942942                                case 'read':
    943                                         var checkboxes = j("tr.read td input[type='checkbox']");
     943                                        var checkboxes = jq("tr.read td input[type='checkbox']");
    944944                                break;
    945945                        }
     
    957957
    958958        /* Bulk delete messages */
    959         j("a#delete_inbox_messages").click( function() {
     959        jq("a#delete_inbox_messages").click( function() {
    960960                checkboxes_tosend = '';
    961                 checkboxes = j("#message-threads tr td input[type='checkbox']");
    962 
    963                 j('div#message').remove();
    964                 j(this).addClass('loading');
    965 
    966                 j(checkboxes).each( function(i) {
    967                         if( j(this).is(':checked') )
    968                                 checkboxes_tosend += j(this).attr('value') + ',';
     961                checkboxes = jq("#message-threads tr td input[type='checkbox']");
     962
     963                jq('div#message').remove();
     964                jq(this).addClass('loading');
     965
     966                jq(checkboxes).each( function(i) {
     967                        if( jq(this).is(':checked') )
     968                                checkboxes_tosend += jq(this).attr('value') + ',';
    969969                });
    970970
    971971                if ( '' == checkboxes_tosend ) {
    972                         j(this).removeClass('loading');
    973                         return false;
    974                 }
    975 
    976                 j.post( ajaxurl, {
     972                        jq(this).removeClass('loading');
     973                        return false;
     974                }
     975
     976                jq.post( ajaxurl, {
    977977                        action: 'messages_delete',
    978978                        'thread_ids': checkboxes_tosend
    979979                }, function(response) {
    980980                        if ( response[0] + response[1] == "-1" ) {
    981                                 j('#message-threads').prepend( response.substr( 2, response.length ) );
     981                                jq('#message-threads').prepend( response.substr( 2, response.length ) );
    982982                        } else {
    983                                 j('#message-threads').before( '<div id="message" class="updated"><p>' + response + '</p></div>' );
    984 
    985                                 j(checkboxes).each( function(i) {
    986                                         if( j(this).is(':checked') )
    987                                                 j(this).parent().parent().fadeOut(150);
     983                                jq('#message-threads').before( '<div id="message" class="updated"><p>' + response + '</p></div>' );
     984
     985                                jq(checkboxes).each( function(i) {
     986                                        if( jq(this).is(':checked') )
     987                                                jq(this).parent().parent().fadeOut(150);
    988988                                });
    989989                        }
    990990
    991                         j('div#message').hide().slideDown(150);
    992                         j("a#delete_inbox_messages").removeClass('loading');
     991                        jq('div#message').hide().slideDown(150);
     992                        jq("a#delete_inbox_messages").removeClass('loading');
    993993                });
    994994                return false;
     
    996996
    997997        /* Close site wide notices in the sidebar */
    998         j("a#close-notice").click( function() {
    999                 j(this).addClass('loading');
    1000                 j('div#sidebar div.error').remove();
    1001 
    1002                 j.post( ajaxurl, {
     998        jq("a#close-notice").click( function() {
     999                jq(this).addClass('loading');
     1000                jq('div#sidebar div.error').remove();
     1001
     1002                jq.post( ajaxurl, {
    10031003                        action: 'messages_close_notice',
    1004                         'notice_id': j('.notice').attr('rel').substr( 2, j('.notice').attr('rel').length )
     1004                        'notice_id': jq('.notice').attr('rel').substr( 2, jq('.notice').attr('rel').length )
    10051005                },
    10061006                function(response) {
    1007                         j("a#close-notice").removeClass('loading');
     1007                        jq("a#close-notice").removeClass('loading');
    10081008
    10091009                        if ( response[0] + response[1] == '-1' ) {
    1010                                 j('.notice').prepend( response.substr( 2, response.length ) );
    1011                                 j( 'div#sidebar div.error').hide().fadeIn( 200 );
     1010                                jq('.notice').prepend( response.substr( 2, response.length ) );
     1011                                jq( 'div#sidebar div.error').hide().fadeIn( 200 );
    10121012                        } else {
    1013                                 j('.notice').slideUp( 100 );
     1013                                jq('.notice').slideUp( 100 );
    10141014                        }
    10151015                });
     
    10181018
    10191019        /* Admin Bar Javascript */
    1020         j("#wp-admin-bar ul.main-nav li").mouseover( function() {
    1021                 j(this).addClass('sfhover');
    1022         });
    1023 
    1024         j("#wp-admin-bar ul.main-nav li").mouseout( function() {
    1025                 j(this).removeClass('sfhover');
     1020        jq("#wp-admin-bar ul.main-nav li").mouseover( function() {
     1021                jq(this).addClass('sfhover');
     1022        });
     1023
     1024        jq("#wp-admin-bar ul.main-nav li").mouseout( function() {
     1025                jq(this).removeClass('sfhover');
    10261026        });
    10271027
    10281028        /* Clear BP cookies on logout */
    1029         j('a.logout').click( function() {
    1030                 j.cookie('bp-activity-scope', null, {path: '/'});
    1031                 j.cookie('bp-activity-filter', null, {path: '/'});
    1032                 j.cookie('bp-activity-oldestpage', null, {path: '/'});
     1029        jq('a.logout').click( function() {
     1030                jq.cookie('bp-activity-scope', null, {path: '/'});
     1031                jq.cookie('bp-activity-filter', null, {path: '/'});
     1032                jq.cookie('bp-activity-oldestpage', null, {path: '/'});
    10331033
    10341034                var objects = [ 'members', 'groups', 'blogs', 'forums' ];
    1035                 j(objects).each( function(i) {
    1036                         j.cookie('bp-' + objects[i] + '-scope', null, {path: '/'} );
    1037                         j.cookie('bp-' + objects[i] + '-filter', null, {path: '/'} );
    1038                         j.cookie('bp-' + objects[i] + '-extras', null, {path: '/'} );
     1035                jq(objects).each( function(i) {
     1036                        jq.cookie('bp-' + objects[i] + '-scope', null, {path: '/'} );
     1037                        jq.cookie('bp-' + objects[i] + '-filter', null, {path: '/'} );
     1038                        jq.cookie('bp-' + objects[i] + '-extras', null, {path: '/'} );
    10391039                });
    10401040        });
     
    10441044function bp_init_activity() {
    10451045        /* Reset the page */
    1046         j.cookie( 'bp-activity-oldestpage', 1, {path: '/'} );
    1047 
    1048         if ( null != j.cookie('bp-activity-filter') && j('#activity-filter-select').length )
    1049                 j('#activity-filter-select select option[value=' + j.cookie('bp-activity-filter') + ']').attr( 'selected', 'selected' );
     1046        jq.cookie( 'bp-activity-oldestpage', 1, {path: '/'} );
     1047
     1048        if ( null != jq.cookie('bp-activity-filter') && jq('#activity-filter-select').length )
     1049                jq('#activity-filter-select select option[value=' + jq.cookie('bp-activity-filter') + ']').attr( 'selected', 'selected' );
    10501050
    10511051        /* Activity Tab Set */
    1052         if ( null != j.cookie('bp-activity-scope') && j('div.activity-type-tabs').length ) {
    1053                 j('div.activity-type-tabs li').each( function() {
    1054                         j(this).removeClass('selected');
    1055                 });
    1056                 j('li#activity-' + j.cookie('bp-activity-scope') + ', div.item-list-tabs li.current').addClass('selected');
     1052        if ( null != jq.cookie('bp-activity-scope') && jq('div.activity-type-tabs').length ) {
     1053                jq('div.activity-type-tabs li').each( function() {
     1054                        jq(this).removeClass('selected');
     1055                });
     1056                jq('li#activity-' + jq.cookie('bp-activity-scope') + ', div.item-list-tabs li.current').addClass('selected');
    10571057        }
    10581058}
     
    10601060/* Setup object scope and filter based on the current cookie settings for the object. */
    10611061function bp_init_objects(objects) {
    1062         j(objects).each( function(i) {
    1063                 if ( null != j.cookie('bp-' + objects[i] + '-filter') && j('li#' + objects[i] + '-order-select select').length )
    1064                         j('li#' + objects[i] + '-order-select select option[value=' + j.cookie('bp-' + objects[i] + '-filter') + ']').attr( 'selected', 'selected' );
    1065 
    1066                 if ( null != j.cookie('bp-' + objects[i] + '-scope') && j('div.' + objects[i]).length ) {
    1067                         j('div.item-list-tabs li').each( function() {
    1068                                 j(this).removeClass('selected');
     1062        jq(objects).each( function(i) {
     1063                if ( null != jq.cookie('bp-' + objects[i] + '-filter') && jq('li#' + objects[i] + '-order-select select').length )
     1064                        jq('li#' + objects[i] + '-order-select select option[value=' + jq.cookie('bp-' + objects[i] + '-filter') + ']').attr( 'selected', 'selected' );
     1065
     1066                if ( null != jq.cookie('bp-' + objects[i] + '-scope') && jq('div.' + objects[i]).length ) {
     1067                        jq('div.item-list-tabs li').each( function() {
     1068                                jq(this).removeClass('selected');
    10691069                        });
    1070                         j('div.item-list-tabs li#' + objects[i] + '-' + j.cookie('bp-' + objects[i] + '-scope') + ', div.item-list-tabs#object-nav li.current').addClass('selected');
     1070                        jq('div.item-list-tabs li#' + objects[i] + '-' + jq.cookie('bp-' + objects[i] + '-scope') + ', div.item-list-tabs#object-nav li.current').addClass('selected');
    10711071                }
    10721072        });
     
    10781078                return false;
    10791079
    1080         if ( j.query.get('s') )
    1081                 search_terms = j.query.get('s');
     1080        if ( jq.query.get('s') )
     1081                search_terms = jq.query.get('s');
    10821082
    10831083        if ( null == scope )
     
    10851085
    10861086        /* Save the settings we want to remain persistent to a cookie */
    1087         j.cookie( 'bp-' + object + '-scope', scope, {path: '/'} );
    1088         j.cookie( 'bp-' + object + '-filter', filter, {path: '/'} );
    1089         j.cookie( 'bp-' + object + '-extras', extras, {path: '/'} );
     1087        jq.cookie( 'bp-' + object + '-scope', scope, {path: '/'} );
     1088        jq.cookie( 'bp-' + object + '-filter', filter, {path: '/'} );
     1089        jq.cookie( 'bp-' + object + '-extras', extras, {path: '/'} );
    10901090
    10911091        /* Set the correct selected nav and filter */
    1092         j('div.item-list-tabs li').each( function() {
    1093                 j(this).removeClass('selected');
    1094         });
    1095         j('div.item-list-tabs li#' + object + '-' + scope + ', div.item-list-tabs#object-nav li.current').addClass('selected');
    1096         j('div.item-list-tabs li.selected').addClass('loading');
    1097         j('div.item-list-tabs select option[value=' + filter + ']').attr( 'selected', 'selected' );
     1092        jq('div.item-list-tabs li').each( function() {
     1093                jq(this).removeClass('selected');
     1094        });
     1095        jq('div.item-list-tabs li#' + object + '-' + scope + ', div.item-list-tabs#object-nav li.current').addClass('selected');
     1096        jq('div.item-list-tabs li.selected').addClass('loading');
     1097        jq('div.item-list-tabs select option[value=' + filter + ']').attr( 'selected', 'selected' );
    10981098
    10991099        if ( 'friends' == object )
     
    11031103                bp_ajax_request.abort();
    11041104
    1105         bp_ajax_request = j.post( ajaxurl, {
     1105        bp_ajax_request = jq.post( ajaxurl, {
    11061106                action: object + '_filter',
    11071107                'cookie': encodeURIComponent(document.cookie),
     
    11151115        function(response)
    11161116        {
    1117                 j(target).fadeOut( 100, function() {
    1118                         j(this).html(response);
    1119                         j(this).fadeIn(100);
     1117                jq(target).fadeOut( 100, function() {
     1118                        jq(this).html(response);
     1119                        jq(this).fadeIn(100);
    11201120                });
    1121                 j('div.item-list-tabs li.selected').removeClass('loading');
     1121                jq('div.item-list-tabs li.selected').removeClass('loading');
    11221122        });
    11231123}
     
    11261126function bp_activity_request(scope, filter) {
    11271127        /* Save the type and filter to a session cookie */
    1128         j.cookie( 'bp-activity-scope', scope, {path: '/'} );
    1129         j.cookie( 'bp-activity-filter', filter, {path: '/'} );
    1130         j.cookie( 'bp-activity-oldestpage', 1 );
     1128        jq.cookie( 'bp-activity-scope', scope, {path: '/'} );
     1129        jq.cookie( 'bp-activity-filter', filter, {path: '/'} );
     1130        jq.cookie( 'bp-activity-oldestpage', 1 );
    11311131
    11321132        /* Remove selected and loading classes from tabs */
    1133         j('div.item-list-tabs li').each( function() {
    1134                 j(this).removeClass('selected loading');
     1133        jq('div.item-list-tabs li').each( function() {
     1134                jq(this).removeClass('selected loading');
    11351135        });
    11361136        /* Set the correct selected nav and filter */
    1137         j('li#activity-' + scope + ', div.item-list-tabs li.current').addClass('selected');
    1138         j('div#object-nav.item-list-tabs li.selected, div.activity-type-tabs li.selected').addClass('loading');
    1139         j('#activity-filter-select select option[value=' + filter + ']').attr( 'selected', 'selected' );
     1137        jq('li#activity-' + scope + ', div.item-list-tabs li.current').addClass('selected');
     1138        jq('div#object-nav.item-list-tabs li.selected, div.activity-type-tabs li.selected').addClass('loading');
     1139        jq('#activity-filter-select select option[value=' + filter + ']').attr( 'selected', 'selected' );
    11401140
    11411141        /* Reload the activity stream based on the selection */
    1142         j('.widget_bp_activity_widget h2 span.ajax-loader').show();
     1142        jq('.widget_bp_activity_widget h2 span.ajax-loader').show();
    11431143
    11441144        if ( bp_ajax_request )
    11451145                bp_ajax_request.abort();
    11461146
    1147         bp_ajax_request = j.post( ajaxurl, {
     1147        bp_ajax_request = jq.post( ajaxurl, {
    11481148                action: 'activity_widget_filter',
    11491149                'cookie': encodeURIComponent(document.cookie),
    1150                 '_wpnonce_activity_filter': j("input#_wpnonce_activity_filter").val(),
     1150                '_wpnonce_activity_filter': jq("input#_wpnonce_activity_filter").val(),
    11511151                'scope': scope,
    11521152                'filter': filter
     
    11541154        function(response)
    11551155        {
    1156                 j('.widget_bp_activity_widget h2 span.ajax-loader').hide();
    1157 
    1158                 j('div.activity').fadeOut( 100, function() {
    1159                         j(this).html(response.contents);
    1160                         j(this).fadeIn(100);
     1156                jq('.widget_bp_activity_widget h2 span.ajax-loader').hide();
     1157
     1158                jq('div.activity').fadeOut( 100, function() {
     1159                        jq(this).html(response.contents);
     1160                        jq(this).fadeIn(100);
    11611161                });
    11621162
    11631163                /* Update the feed link */
    11641164                if ( null != response.feed_url )
    1165                         j('.directory div#subnav li.feed a, .home-page div#subnav li.feed a').attr('href', response.feed_url);
    1166 
    1167                 j('div.item-list-tabs li.selected').removeClass('loading');
     1165                        jq('.directory div#subnav li.feed a, .home-page div#subnav li.feed a').attr('href', response.feed_url);
     1166
     1167                jq('div.item-list-tabs li.selected').removeClass('loading');
    11681168
    11691169                /* Selectively hide comments */
     
    11751175/* Hide long lists of activity comments, only show the latest five root comments. */
    11761176function bp_dtheme_hide_comments() {
    1177         var comments_divs = j('div.activity-comments');
     1177        var comments_divs = jq('div.activity-comments');
    11781178
    11791179        if ( !comments_divs.length )
     
    11811181
    11821182        comments_divs.each( function() {
    1183                 if ( j(this).children('ul').children('li').length < 5 ) return;
    1184 
    1185                 var comments_div = j(this);
     1183                if ( jq(this).children('ul').children('li').length < 5 ) return;
     1184
     1185                var comments_div = jq(this);
    11861186                var parent_li = comments_div.parents('ul#activity-stream > li');
    1187                 var comment_lis = j(this).children('ul').children('li');
     1187                var comment_lis = jq(this).children('ul').children('li');
    11881188                var comment_count = ' ';
    11891189
    1190                 if ( j('li#' + parent_li.attr('id') + ' a.acomment-reply span').length )
    1191                         var comment_count = j('li#' + parent_li.attr('id') + ' a.acomment-reply span').html();
     1190                if ( jq('li#' + parent_li.attr('id') + ' a.acomment-reply span').length )
     1191                        var comment_count = jq('li#' + parent_li.attr('id') + ' a.acomment-reply span').html();
    11921192
    11931193                comment_lis.each( function(i) {
    11941194                        /* Show the latest 5 root comments */
    11951195                        if ( i < comment_lis.length - 5 ) {
    1196                                 j(this).addClass('hidden');
    1197                                 j(this).toggle();
     1196                                jq(this).addClass('hidden');
     1197                                jq(this).toggle();
    11981198
    11991199                                if ( !i )
    1200                                         j(this).before( '<li class="show-all"><a href="#' + parent_li.attr('id') + '/show-all/" title="' + bp_terms_show_all_comments + '">' + bp_terms_show_all + ' ' + comment_count + ' ' + bp_terms_comments + '</a></li>' );
     1200                                        jq(this).before( '<li class="show-all"><a href="#' + parent_li.attr('id') + '/show-all/" title="' + bp_terms_show_all_comments + '">' + bp_terms_show_all + ' ' + comment_count + ' ' + bp_terms_comments + '</a></li>' );
    12011201                        }
    12021202                });
Note: See TracChangeset for help on using the changeset viewer.