Changeset 2861
- Timestamp:
- 03/19/2010 10:56:42 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.2/bp-themes/bp-default/_inc/global.js
r2831 r2861 1 1 // AJAX Functions 2 var j = jQuery;2 var jq = jQuery; 3 3 4 4 // Global variable to prevent multiple AJAX requests 5 5 var bp_ajax_request = null; 6 6 7 j (document).ready( function() {7 jq(document).ready( function() { 8 8 /**** Page Load Actions *******************************************************/ 9 9 10 10 /* 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(); 13 13 14 14 /* Activity filter and scope set */ … … 20 20 21 21 /* @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(); 26 26 } 27 27 } 28 28 29 29 /* @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(); 32 32 33 33 /**** Activity Posting ********************************************************/ 34 34 35 35 /* 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); 38 38 var form = button.parent().parent().parent().parent(); 39 39 40 40 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(); 46 46 47 47 /* Remove any errors */ 48 j ('div.error').remove();48 jq('div.error').remove(); 49 49 button.attr('disabled','disabled'); 50 50 51 51 /* Default POST values */ 52 52 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(); 55 55 56 56 /* Set object for non-profile posts */ 57 57 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, { 62 62 action: 'post_update', 63 63 'cookie': encodeURIComponent(document.cookie), 64 '_wpnonce_post_update': j ("input#_wpnonce_post_update").val(),64 '_wpnonce_post_update': jq("input#_wpnonce_post_update").val(), 65 65 'content': content, 66 66 'object': object, … … 69 69 function(response) 70 70 { 71 j ( 'form#' + form.attr('id') + ' span.ajax-loader' ).hide();71 jq( 'form#' + form.attr('id') + ' span.ajax-loader' ).hide(); 72 72 73 73 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', '' ); 76 76 }); 77 77 … … 79 79 if ( response[0] + response[1] == '-1' ) { 80 80 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 ); 82 82 button.attr("disabled", ''); 83 83 } 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">' ); 88 88 } 89 89 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(''); 95 95 96 96 /* Re-enable the submit button after 8 seconds. */ … … 103 103 104 104 /* 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(); 107 107 108 108 if ( event.target.nodeName == 'STRONG' || event.target.nodeName == 'SPAN' ) … … 112 112 113 113 /* Reset the page */ 114 j .cookie( 'bp-activity-oldestpage', 1, {path: '/'} );114 jq.cookie( 'bp-activity-oldestpage', 1, {path: '/'} ); 115 115 116 116 /* Activity Stream Tabs */ 117 117 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(); 119 119 120 120 if ( scope == 'mentions' ) 121 j ( 'li#' + target.attr('id') + ' a strong' ).remove();121 jq( 'li#' + target.attr('id') + ' a strong' ).remove(); 122 122 123 123 bp_activity_request(scope, filter, target); … … 127 127 128 128 /* 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' ); 131 131 132 132 if ( !selected_tab.length ) … … 135 135 var scope = selected_tab.attr('id').substr( 9, selected_tab.attr('id').length ); 136 136 137 var filter = j (this).val();137 var filter = jq(this).val(); 138 138 139 139 bp_activity_request(scope, filter); … … 143 143 144 144 /* 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); 147 147 148 148 /* Favoriting activity stream items */ … … 154 154 target.addClass('loading'); 155 155 156 j .post( ajaxurl, {156 jq.post( ajaxurl, { 157 157 action: 'activity_mark_' + type, 158 158 'cookie': encodeURIComponent(document.cookie), … … 163 163 164 164 target.fadeOut( 100, function() { 165 j (this).html(response);166 j (this).fadeIn(100);165 jq(this).html(response); 166 jq(this).fadeIn(100); 167 167 }); 168 168 169 169 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>'); 172 172 173 173 target.removeClass('fav'); 174 174 target.addClass('unfav'); 175 175 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 ); 177 177 } else { 178 178 target.removeClass('unfav'); 179 179 target.addClass('fav'); 180 180 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') ) 185 185 bp_activity_request( null, null ); 186 186 187 j ('div.item-list-tabs ul li#activity-favorites').remove();187 jq('div.item-list-tabs ul li#activity-favorites').remove(); 188 188 } 189 189 } 190 190 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') ) 192 192 target.parent().parent().parent().slideUp(100); 193 193 }); … … 207 207 target.addClass('loading'); 208 208 209 j .post( ajaxurl, {209 jq.post( ajaxurl, { 210 210 action: 'delete_activity', 211 211 'cookie': encodeURIComponent(document.cookie), … … 229 229 /* Load more updates at the end of the page */ 230 230 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, { 239 239 action: 'activity_get_older_updates', 240 240 'cookie': encodeURIComponent(document.cookie), … … 243 243 function(response) 244 244 { 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); 248 248 249 249 target.parent().hide(); … … 257 257 258 258 /* Hide all activity comment forms */ 259 j ('form.ac-form').hide();259 jq('form.ac-form').hide(); 260 260 261 261 /* Hide excess comments */ 262 if ( j ('div.activity-comments').length )262 if ( jq('div.activity-comments').length ) 263 263 bp_dtheme_hide_comments(); 264 264 265 265 /* 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); 268 268 269 269 /* Comment / comment reply links */ … … 277 277 var a_id = ids[2] 278 278 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] ); 282 282 283 283 form.css( 'display', 'none' ); 284 284 form.removeClass('root'); 285 j ('.ac-form').hide();285 jq('.ac-form').hide(); 286 286 287 287 /* Hide any error messages */ 288 288 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(); 291 291 }); 292 292 293 293 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 ); 295 295 } else { 296 j ('li#activity-' + a_id + ' div.activity-comments').append( form );296 jq('li#activity-' + a_id + ' div.activity-comments').append( form ); 297 297 } 298 298 … … 301 301 302 302 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(); 305 305 306 306 return false; … … 321 321 322 322 /* Hide any error messages */ 323 j ( 'form#' + form + ' div.error').hide();323 jq( 'form#' + form + ' div.error').hide(); 324 324 form.addClass('loading'); 325 325 target.css('disabled', 'disabled'); 326 326 327 j .post( ajaxurl, {327 jq.post( ajaxurl, { 328 328 action: 'new_activity_comment', 329 329 '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(), 331 331 'comment_id': comment_id, 332 332 'form_id': form_id[2], 333 'content': j ('form#' + form.attr('id') + ' textarea').val()333 'content': jq('form#' + form.attr('id') + ' textarea').val() 334 334 }, 335 335 function(response) … … 356 356 } 357 357 ); 358 j ( 'form#' + form + ' textarea').val('');358 jq( 'form#' + form + ' textarea').val(''); 359 359 360 360 /* 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 ); 362 362 363 363 /* Re-enable the submit button after 5 seconds. */ … … 385 385 386 386 /* Remove any error messages */ 387 j ('div.activity-comments ul div.error').remove();387 jq('div.activity-comments ul div.error').remove(); 388 388 389 389 /* Reset the form position */ 390 390 comment_li.parents('div.activity-comments').append(form); 391 391 392 j .post( ajaxurl, {392 jq.post( ajaxurl, { 393 393 action: 'delete_activity_comment', 394 394 'cookie': encodeURIComponent(document.cookie), … … 402 402 comment_li.prepend( response.substr( 2, response.length ) ).hide().fadeIn( 200 ); 403 403 } 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'); 405 405 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') ) 408 408 child_count++; 409 409 }); … … 412 412 /* Decrease the "Reply (X)" button count */ 413 413 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 ) ); 415 415 } 416 416 }); … … 434 434 435 435 /* Escape Key Press for cancelling comment forms */ 436 j (document).keydown( function(e) {436 jq(document).keydown( function(e) { 437 437 e = e || window.event; 438 438 if (e.target) … … 451 451 if ( keyCode == 27 ) { 452 452 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 ); 455 455 } 456 456 } … … 459 459 /**** @mention username help tooltip **************************************/ 460 460 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); 465 465 } else { 466 j ('div.help').hide().remove();466 jq('div.help').hide().remove(); 467 467 } 468 468 }) … … 471 471 472 472 /* 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') ) 475 475 return; 476 476 477 var target = j (event.target);477 var target = jq(event.target); 478 478 479 479 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( '-' ); 481 481 var object = css_id[0]; 482 482 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') ); 484 484 485 485 return false; … … 490 490 491 491 /* 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') ) 494 494 return; 495 495 496 var target = j (event.target).parent();496 var target = jq(event.target).parent(); 497 497 498 498 if ( 'LI' == event.target.parentNode.nodeName && !target.hasClass('last') ) { … … 504 504 505 505 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') ); 510 510 511 511 return false; … … 514 514 515 515 /* 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'); 519 519 else 520 var el = j (this);520 var el = jq(this); 521 521 522 522 var css_id = el.attr('id').split('-'); 523 523 var object = css_id[0]; 524 524 var scope = css_id[1]; 525 var filter = j (this).val();525 var filter = jq(this).val(); 526 526 var search_terms = false; 527 527 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(); 530 530 531 531 if ( 'friends' == object ) 532 532 object = 'members'; 533 533 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') ); 535 535 536 536 return false; … … 538 538 539 539 /* 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); 542 542 543 543 if ( target.hasClass('button') ) … … 548 548 return false; 549 549 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'); 552 552 else 553 var el = j ('li.filter select');553 var el = jq('li.filter select'); 554 554 555 555 var page_number = 1; … … 558 558 var search_terms = false; 559 559 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; 567 567 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') ); 571 571 572 572 return false; … … 578 578 579 579 /* 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); 586 586 else 587 j ('div#new-topic-post').slideDown(200);587 jq('div#new-topic-post').slideDown(200); 588 588 589 589 return false; … … 591 591 592 592 /* 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); 598 598 return false; 599 599 }); 600 600 601 601 /* 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( / /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( / /g, '-' ), 1, jq.cookie('bp-forums-extras') ); 604 604 return false; 605 605 }); … … 608 608 609 609 /* 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 ) 616 616 var friend_action = 'invite'; 617 617 else 618 618 var friend_action = 'uninvite'; 619 619 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, { 623 623 action: 'groups_invite_user', 624 624 'friend_action': friend_action, 625 625 'cookie': encodeURIComponent(document.cookie), 626 '_wpnonce': j ("input#_wpnonce_invite_uninvite_user").val(),626 '_wpnonce': jq("input#_wpnonce_invite_uninvite_user").val(), 627 627 'friend_id': friend_id, 628 'group_id': j ("input#group_id").val()628 'group_id': jq("input#group_id").val() 629 629 }, 630 630 function(response) 631 631 { 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(); 636 636 637 637 if ( friend_action == 'invite' ) { 638 j ('#friend-list').append(response);638 jq('#friend-list').append(response); 639 639 } 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'); 644 644 }); 645 645 }); 646 646 647 647 /* 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'); 652 652 friend_id = friend_id.split('-'); 653 653 friend_id = friend_id[1]; 654 654 655 j .post( ajaxurl, {655 jq.post( ajaxurl, { 656 656 action: 'groups_invite_user', 657 657 'friend_action': 'uninvite', 658 658 'cookie': encodeURIComponent(document.cookie), 659 '_wpnonce': j ("input#_wpnonce_invite_uninvite_user").val(),659 '_wpnonce': jq("input#_wpnonce_invite_uninvite_user").val(), 660 660 'friend_id': friend_id, 661 'group_id': j ("input#group_id").val()661 'group_id': jq("input#group_id").val() 662 662 }, 663 663 function(response) 664 664 { 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); 668 668 }); 669 669 … … 674 674 675 675 /* 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'); 680 680 681 681 var id = li.attr('id').substr( 11, li.attr('id').length ); … … 685 685 nonce = nonce[1]; 686 686 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') ) { 691 691 var action = 'accept_friendship'; 692 692 action_div.children('a.reject').css( 'visibility', 'hidden' ); … … 698 698 button.addClass('loading'); 699 699 700 j .post( ajaxurl, {700 jq.post( ajaxurl, { 701 701 action: action, 702 702 'cookie': encodeURIComponent(document.cookie), … … 712 712 } else { 713 713 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'); 717 717 } 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'); 720 720 } 721 721 }); … … 727 727 728 728 /* 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'); 732 732 fid = fid.split('-'); 733 733 fid = fid[1]; 734 734 735 var nonce = j (this).attr('href');735 var nonce = jq(this).attr('href'); 736 736 nonce = nonce.split('?_wpnonce='); 737 737 nonce = nonce[1].split('&'); 738 738 nonce = nonce[0]; 739 739 740 var thelink = j (this);741 742 j .post( ajaxurl, {740 var thelink = jq(this); 741 742 jq.post( ajaxurl, { 743 743 action: 'addremove_friend', 744 744 'cookie': encodeURIComponent(document.cookie), … … 752 752 753 753 if ( action == 'add' ) { 754 j (parentdiv).fadeOut(200,754 jq(parentdiv).fadeOut(200, 755 755 function() { 756 756 parentdiv.removeClass('add_friend'); … … 762 762 763 763 } else if ( action == 'remove' ) { 764 j (parentdiv).fadeOut(200,764 jq(parentdiv).fadeOut(200, 765 765 function() { 766 766 parentdiv.removeClass('remove_friend'); … … 777 777 /** Group Join / Leave Buttons **************************************/ 778 778 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'); 781 781 gid = gid.split('-'); 782 782 gid = gid[1]; 783 783 784 var nonce = j (this).attr('href');784 var nonce = jq(this).attr('href'); 785 785 nonce = nonce.split('?_wpnonce='); 786 786 nonce = nonce[1].split('&'); 787 787 nonce = nonce[0]; 788 788 789 var thelink = j (this);790 791 j .post( ajaxurl, {789 var thelink = jq(this); 790 791 jq.post( ajaxurl, { 792 792 action: 'joinleave_group', 793 793 'cookie': encodeURIComponent(document.cookie), … … 799 799 var parentdiv = thelink.parent(); 800 800 801 if ( !j ('body.directory').length )801 if ( !jq('body.directory').length ) 802 802 location.href = location.href; 803 803 else { 804 j (parentdiv).fadeOut(200,804 jq(parentdiv).fadeOut(200, 805 805 function() { 806 806 parentdiv.fadeIn(200).html(response); … … 814 814 /** Button disabling ************************************************/ 815 815 816 j ('div.pending').click(function() {816 jq('div.pending').click(function() { 817 817 return false; 818 818 }); … … 820 820 /** Alternate Highlighting ******************************************/ 821 821 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) { 823 823 if ( i % 2 != 1 ) 824 j (this).addClass('alt');824 jq(this).addClass('alt'); 825 825 }); 826 826 … … 828 828 829 829 /* AJAX send reply functionality */ 830 j ("input#send_reply_button").click(830 jq("input#send_reply_button").click( 831 831 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, { 835 835 action: 'messages_send_reply', 836 836 '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() 843 843 }, 844 844 function(response) 845 845 { 846 846 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 ) ); 848 848 } 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'); 855 855 }); 856 856 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'); 859 859 if ( i % 2 != 1 ) 860 j (this).addClass('alt');860 jq(this).addClass('alt'); 861 861 }); 862 862 } 863 j ('form#send-reply span.ajax-loader').toggle();863 jq('form#send-reply span.ajax-loader').toggle(); 864 864 }); 865 865 … … 869 869 870 870 /* 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() { 872 872 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') ) { 876 876 var currentClass = 'read' 877 877 var newClass = 'unread' … … 890 890 891 891 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 ); 902 902 var inboxcount = inboxcount.substr( 0, inboxcount.length - 1 ); 903 903 … … 905 905 inboxcount = 0; 906 906 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 + ')' ); 909 909 } else { 910 910 if ( 'read' == currentClass ) 911 j ('a#user-messages strong').html('(' + ( parseInt(inboxcount) + 1 ) + ')');911 jq('a#user-messages strong').html('(' + ( parseInt(inboxcount) + 1 ) + ')'); 912 912 else 913 j ('a#user-messages strong').html('(' + ( parseInt(inboxcount) - thread_count ) + ')');913 jq('a#user-messages strong').html('(' + ( parseInt(inboxcount) - thread_count ) + ')'); 914 914 } 915 915 … … 920 920 } 921 921 }); 922 j .post( ajaxurl, {922 jq.post( ajaxurl, { 923 923 action: action, 924 924 'thread_ids': checkboxes_tosend … … 928 928 929 929 /* Selecting unread and read messages in inbox */ 930 j ("select#message-type-select").change(930 jq("select#message-type-select").change( 931 931 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']"); 934 934 checkboxes.each( function(i) { 935 935 checkboxes[i].checked = ""; … … 938 938 switch(selection) { 939 939 case 'unread': 940 var checkboxes = j ("tr.unread td input[type='checkbox']");940 var checkboxes = jq("tr.unread td input[type='checkbox']"); 941 941 break; 942 942 case 'read': 943 var checkboxes = j ("tr.read td input[type='checkbox']");943 var checkboxes = jq("tr.read td input[type='checkbox']"); 944 944 break; 945 945 } … … 957 957 958 958 /* Bulk delete messages */ 959 j ("a#delete_inbox_messages").click( function() {959 jq("a#delete_inbox_messages").click( function() { 960 960 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') + ','; 969 969 }); 970 970 971 971 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, { 977 977 action: 'messages_delete', 978 978 'thread_ids': checkboxes_tosend 979 979 }, function(response) { 980 980 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 ) ); 982 982 } 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); 988 988 }); 989 989 } 990 990 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'); 993 993 }); 994 994 return false; … … 996 996 997 997 /* 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, { 1003 1003 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 ) 1005 1005 }, 1006 1006 function(response) { 1007 j ("a#close-notice").removeClass('loading');1007 jq("a#close-notice").removeClass('loading'); 1008 1008 1009 1009 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 ); 1012 1012 } else { 1013 j ('.notice').slideUp( 100 );1013 jq('.notice').slideUp( 100 ); 1014 1014 } 1015 1015 }); … … 1018 1018 1019 1019 /* 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'); 1026 1026 }); 1027 1027 1028 1028 /* 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: '/'}); 1033 1033 1034 1034 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: '/'} ); 1039 1039 }); 1040 1040 }); … … 1044 1044 function bp_init_activity() { 1045 1045 /* 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' ); 1050 1050 1051 1051 /* 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'); 1057 1057 } 1058 1058 } … … 1060 1060 /* Setup object scope and filter based on the current cookie settings for the object. */ 1061 1061 function 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'); 1069 1069 }); 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'); 1071 1071 } 1072 1072 }); … … 1078 1078 return false; 1079 1079 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'); 1082 1082 1083 1083 if ( null == scope ) … … 1085 1085 1086 1086 /* 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: '/'} ); 1090 1090 1091 1091 /* 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' ); 1098 1098 1099 1099 if ( 'friends' == object ) … … 1103 1103 bp_ajax_request.abort(); 1104 1104 1105 bp_ajax_request = j .post( ajaxurl, {1105 bp_ajax_request = jq.post( ajaxurl, { 1106 1106 action: object + '_filter', 1107 1107 'cookie': encodeURIComponent(document.cookie), … … 1115 1115 function(response) 1116 1116 { 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); 1120 1120 }); 1121 j ('div.item-list-tabs li.selected').removeClass('loading');1121 jq('div.item-list-tabs li.selected').removeClass('loading'); 1122 1122 }); 1123 1123 } … … 1126 1126 function bp_activity_request(scope, filter) { 1127 1127 /* 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 ); 1131 1131 1132 1132 /* 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'); 1135 1135 }); 1136 1136 /* 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' ); 1140 1140 1141 1141 /* 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(); 1143 1143 1144 1144 if ( bp_ajax_request ) 1145 1145 bp_ajax_request.abort(); 1146 1146 1147 bp_ajax_request = j .post( ajaxurl, {1147 bp_ajax_request = jq.post( ajaxurl, { 1148 1148 action: 'activity_widget_filter', 1149 1149 'cookie': encodeURIComponent(document.cookie), 1150 '_wpnonce_activity_filter': j ("input#_wpnonce_activity_filter").val(),1150 '_wpnonce_activity_filter': jq("input#_wpnonce_activity_filter").val(), 1151 1151 'scope': scope, 1152 1152 'filter': filter … … 1154 1154 function(response) 1155 1155 { 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); 1161 1161 }); 1162 1162 1163 1163 /* Update the feed link */ 1164 1164 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'); 1168 1168 1169 1169 /* Selectively hide comments */ … … 1175 1175 /* Hide long lists of activity comments, only show the latest five root comments. */ 1176 1176 function bp_dtheme_hide_comments() { 1177 var comments_divs = j ('div.activity-comments');1177 var comments_divs = jq('div.activity-comments'); 1178 1178 1179 1179 if ( !comments_divs.length ) … … 1181 1181 1182 1182 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); 1186 1186 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'); 1188 1188 var comment_count = ' '; 1189 1189 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(); 1192 1192 1193 1193 comment_lis.each( function(i) { 1194 1194 /* Show the latest 5 root comments */ 1195 1195 if ( i < comment_lis.length - 5 ) { 1196 j (this).addClass('hidden');1197 j (this).toggle();1196 jq(this).addClass('hidden'); 1197 jq(this).toggle(); 1198 1198 1199 1199 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>' ); 1201 1201 } 1202 1202 });
Note: See TracChangeset
for help on using the changeset viewer.