Changeset 5756
- Timestamp:
- 02/13/2012 05:21:58 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-themes/bp-default/_inc/global.js
r5617 r5756 23 23 /* @mention Compose Scrolling */ 24 24 if ( jq.query.get('r') && jq('textarea#whats-new').length ) { 25 jq('#whats-new-options').animate({height:'40px'}); 26 jq("form#whats-new-form textarea").animate({height:'50px'}); 27 jq.scrollTo( jq('textarea#whats-new'), 500, { offset:-125, easing:'easeOutQuad' } ); 25 jq('#whats-new-options').animate({ 26 height:'40px' 27 }); 28 jq("form#whats-new-form textarea").animate({ 29 height:'50px' 30 }); 31 jq.scrollTo( jq('textarea#whats-new'), 500, { 32 offset:-125, 33 easing:'easeOutQuad' 34 } ); 28 35 jq('textarea#whats-new').focus(); 29 36 } … … 33 40 /* Textarea focus */ 34 41 jq('#whats-new').focus( function(){ 35 jq("#whats-new-options").animate({height:'40px'}); 36 jq("form#whats-new-form textarea").animate({height:'50px'}); 42 jq("#whats-new-options").animate({ 43 height:'40px' 44 }); 45 jq("form#whats-new-form textarea").animate({ 46 height:'50px' 47 }); 37 48 jq("#aw-whats-new-submit").prop("disabled", false); 38 49 }); … … 94 105 jq("ul#activity-stream li:first").addClass('new-update'); 95 106 96 if ( 0 != jq(" div#latest-update").length ) {107 if ( 0 != jq("#latest-update").length ) { 97 108 var l = jq("ul#activity-stream li.new-update .activity-content .activity-inner p").html(); 98 109 var v = jq("ul#activity-stream li.new-update .activity-content .activity-header p a.view").attr('href'); … … 106 117 u += '<a href="' + v + '" rel="nofollow">' + BP_DTheme.view + '</a>'; 107 118 108 jq(" div#latest-update").slideUp(300,function(){109 jq(" div#latest-update").html( u );110 jq(" div#latest-update").slideDown(300);119 jq("#latest-update").slideUp(300,function(){ 120 jq("#latest-update").html( u ); 121 jq("#latest-update").slideDown(300); 111 122 }); 112 123 } … … 117 128 } 118 129 119 jq("#whats-new-options").animate({height:'0px'}); 120 jq("form#whats-new-form textarea").animate({height:'20px'}); 130 jq("#whats-new-options").animate({ 131 height:'0px' 132 }); 133 jq("form#whats-new-form textarea").animate({ 134 height:'20px' 135 }); 121 136 jq("#aw-whats-new-submit").prop("disabled", true).removeClass('loading'); 122 137 }); … … 135 150 136 151 /* Reset the page */ 137 jq.cookie( 'bp-activity-oldestpage', 1, {path: '/'} ); 152 jq.cookie( 'bp-activity-oldestpage', 1, { 153 path: '/' 154 } ); 138 155 139 156 /* Activity Stream Tabs */ … … 192 209 193 210 if ( 'fav' == type ) { 194 if ( !jq(' div.item-list-tabs li#activity-favorites').length )195 jq(' div.item-list-tabs ul li#activity-mentions').before( '<li id="activity-favorites"><a href="#">' + BP_DTheme.my_favs + ' <span>0</span></a></li>');211 if ( !jq('.item-list-tabs li#activity-favorites').length ) 212 jq('.item-list-tabs ul li#activity-mentions').before( '<li id="activity-favorites"><a href="#">' + BP_DTheme.my_favs + ' <span>0</span></a></li>'); 196 213 197 214 target.removeClass('fav'); 198 215 target.addClass('unfav'); 199 216 200 jq(' div.item-list-tabs ul li#activity-favorites span').html( Number( jq('div.item-list-tabs ul li#activity-favorites span').html() ) + 1 );217 jq('.item-list-tabs ul li#activity-favorites span').html( Number( jq('.item-list-tabs ul li#activity-favorites span').html() ) + 1 ); 201 218 } else { 202 219 target.removeClass('unfav'); 203 220 target.addClass('fav'); 204 221 205 jq(' div.item-list-tabs ul li#activity-favorites span').html( Number( jq('div.item-list-tabs ul li#activity-favorites span').html() ) - 1 );206 207 if ( !Number( jq(' div.item-list-tabs ul li#activity-favorites span').html() ) ) {208 if ( jq(' div.item-list-tabs ul li#activity-favorites').hasClass('selected') )222 jq('.item-list-tabs ul li#activity-favorites span').html( Number( jq('.item-list-tabs ul li#activity-favorites span').html() ) - 1 ); 223 224 if ( !Number( jq('.item-list-tabs ul li#activity-favorites span').html() ) ) { 225 if ( jq('.item-list-tabs ul li#activity-favorites').hasClass('selected') ) 209 226 bp_activity_request( null, null ); 210 227 211 jq(' div.item-list-tabs ul li#activity-favorites').remove();228 jq('.item-list-tabs ul li#activity-favorites').remove(); 212 229 } 213 230 } 214 231 215 if ( 'activity-favorites' == jq( ' div.item-list-tabs li.selected').attr('id') )232 if ( 'activity-favorites' == jq( '.item-list-tabs li.selected').attr('id') ) 216 233 target.parent().parent().parent().slideUp(100); 217 234 }); … … 279 296 280 297 if ( null == jq.cookie('bp-activity-oldestpage') ) 281 jq.cookie('bp-activity-oldestpage', 1, {path: '/'} ); 298 jq.cookie('bp-activity-oldestpage', 1, { 299 path: '/' 300 } ); 282 301 283 302 var oldest_page = ( jq.cookie('bp-activity-oldestpage') * 1 ) + 1; … … 291 310 { 292 311 jq("#content li.load-more").removeClass('loading'); 293 jq.cookie( 'bp-activity-oldestpage', oldest_page, {path: '/'} ); 312 jq.cookie( 'bp-activity-oldestpage', oldest_page, { 313 path: '/' 314 } ); 294 315 jq("#content ul.activity-list").append(response.contents); 295 316 … … 329 350 330 351 /* Hide excess comments */ 331 if ( jq(' div.activity-comments').length )352 if ( jq('.activity-comments').length ) 332 353 bp_dtheme_hide_comments(); 333 354 … … 359 380 360 381 if ( ids[1] != 'comment' ) { 361 jq(' div.activity-comments li#acomment-' + c_id).append( form );382 jq('.activity-comments li#acomment-' + c_id).append( form ); 362 383 } else { 363 jq('li#activity-' + a_id + ' div.activity-comments').append( form );364 } 365 366 384 jq('li#activity-' + a_id + ' .activity-comments').append( form ); 385 } 386 387 if ( form.parent().hasClass( 'activity-comments' ) ) 367 388 form.addClass('root'); 368 389 369 390 form.slideDown( 200 ); 370 jq.scrollTo( form, 500, { offset:-100, easing:'easeOutQuad' } ); 391 jq.scrollTo( form, 500, { 392 offset:-100, 393 easing:'easeOutQuad' 394 } ); 371 395 jq('#ac-form-' + ids[2] + ' textarea').focus(); 372 396 … … 407 431 408 432 jq.post( ajaxurl, ajaxdata, 409 function(response) 410 { 411 target.removeClass('loading'); 412 413 /* Check for errors and append if found. */ 414 if ( response[0] + response[1] == '-1' ) { 415 form.append( response.substr( 2, response.length ) ).hide().fadeIn( 200 ); 416 } else { 417 form.fadeOut( 200, 418 function() { 419 if ( 0 == form.parent().children('ul').length ) { 420 if ( form.parent().hasClass('activity-comments') ) 421 form.parent().prepend('<ul></ul>'); 422 else 423 form.parent().append('<ul></ul>'); 433 function(response) 434 { 435 target.removeClass('loading'); 436 437 /* Check for errors and append if found. */ 438 if ( response[0] + response[1] == '-1' ) { 439 form.append( response.substr( 2, response.length ) ).hide().fadeIn( 200 ); 440 } else { 441 form.fadeOut( 200, 442 function() { 443 if ( 0 == form.parent().children('ul').length ) { 444 if ( form.parent().hasClass('activity-comments') ) 445 form.parent().prepend('<ul></ul>'); 446 else 447 form.parent().append('<ul></ul>'); 448 } 449 450 form.parent().children('ul').append(response).hide().fadeIn( 200 ); 451 form.children('textarea').val(''); 452 form.parent().parent().addClass('has-comments'); 424 453 } 425 426 form.parent().children('ul').append(response).hide().fadeIn( 200 ); 427 form.children('textarea').val(''); 428 form.parent().parent().addClass('has-comments'); 429 } 430 ); 431 jq( 'form#' + form + ' textarea').val(''); 432 433 /* Increase the "Reply (X)" button count */ 434 jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html( Number( jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html() ) + 1 ); 435 } 436 437 jq(target).prop("disabled", false); 438 }); 454 ); 455 jq( 'form#' + form + ' textarea').val(''); 456 457 /* Increase the "Reply (X)" button count */ 458 jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html( Number( jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html() ) + 1 ); 459 } 460 461 jq(target).prop("disabled", false); 462 }); 439 463 440 464 return false; … … 448 472 449 473 var nonce = link_href.split('_wpnonce='); 450 474 nonce = nonce[1]; 451 475 452 476 var comment_id = link_href.split('cid='); 453 454 477 comment_id = comment_id[1].split('&'); 478 comment_id = comment_id[0]; 455 479 456 480 target.addClass('loading'); 457 481 458 482 /* Remove any error messages */ 459 jq(' div.activity-comments ul div.error').remove();483 jq('.activity-comments ul .error').remove(); 460 484 461 485 /* Reset the form position */ 462 comment_li.parents(' div.activity-comments').append(form);486 comment_li.parents('.activity-comments').append(form); 463 487 464 488 jq.post( ajaxurl, { … … 505 529 506 530 // Remove any error messages 507 jq( ' div.activity-comments ul div.error' ).remove();531 jq( '.activity-comments ul div.error' ).remove(); 508 532 509 533 // Reset the form position 510 comment_li.parents( ' div.activity-comments' ).append( comment_li.parents( 'div.activity-comments' ).children( 'form' ) );534 comment_li.parents( '.activity-comments' ).append( comment_li.parents( '.activity-comments' ).children( 'form' ) ); 511 535 512 536 jq.post( ajaxurl, { … … 582 606 583 607 /* The search form on all directory pages */ 584 jq(' div.dir-search').click( function(event) {608 jq('.dir-search').click( function(event) { 585 609 if ( jq(this).hasClass('no-ajax') ) 586 610 return; … … 589 613 590 614 if ( target.attr('type') == 'submit' ) { 591 var css_id = jq(' div.item-list-tabs li.selected').attr('id').split( '-' );615 var css_id = jq('.item-list-tabs li.selected').attr('id').split( '-' ); 592 616 var object = css_id[0]; 593 617 … … 626 650 /* When the filter select box is changed re-query */ 627 651 jq('li.filter select').change( function() { 628 if ( jq(' div.item-list-tabs li.selected').length )629 var el = jq(' div.item-list-tabs li.selected');652 if ( jq('.item-list-tabs li.selected').length ) 653 var el = jq('.item-list-tabs li.selected'); 630 654 else 631 655 var el = jq(this); … … 637 661 var search_terms = false; 638 662 639 if ( jq(' div.dir-search input').length )640 search_terms = jq(' div.dir-search input').val();663 if ( jq('.dir-search input').length ) 664 search_terms = jq('.dir-search input').val(); 641 665 642 666 if ( 'friends' == object ) … … 659 683 return false; 660 684 661 if ( jq(' div.item-list-tabs li.selected').length )662 var el = jq(' div.item-list-tabs li.selected');685 if ( jq('.item-list-tabs li.selected').length ) 686 var el = jq('.item-list-tabs li.selected'); 663 687 else 664 688 var el = jq('li.filter select'); … … 670 694 671 695 if ( jq('div.dir-search input').length ) 672 search_terms = jq(' div.dir-search input').val();696 search_terms = jq('.dir-search input').val(); 673 697 674 698 if ( jq(target).hasClass('next') ) 675 var page_number = Number( jq(' div.pagination span.current').html() ) + 1;699 var page_number = Number( jq('.pagination span.current').html() ) + 1; 676 700 else if ( jq(target).hasClass('prev') ) 677 var page_number = Number( jq(' div.pagination span.current').html() ) - 1;701 var page_number = Number( jq('.pagination span.current').html() ) - 1; 678 702 else 679 703 var page_number = Number( jq(target).html() ); … … 690 714 /* Hit the "New Topic" button on the forums directory page */ 691 715 jq('a.show-hide-new').click( function() { 692 if ( !jq(' div#new-topic-post').length )693 return false; 694 695 if ( jq(' div#new-topic-post').is(":visible") )696 jq(' div#new-topic-post').slideUp(200);716 if ( !jq('#new-topic-post').length ) 717 return false; 718 719 if ( jq('#new-topic-post').is(":visible") ) 720 jq('#new-topic-post').slideUp(200); 697 721 else 698 jq('div#new-topic-post').slideDown(200, function() { jq('#topic_title').focus(); } ); 722 jq('#new-topic-post').slideDown(200, function() { 723 jq('#topic_title').focus(); 724 } ); 699 725 700 726 return false; … … 703 729 /* Cancel the posting of a new forum topic */ 704 730 jq('input#submit_topic_cancel').click( function() { 705 if ( !jq(' div#new-topic-post').length )706 return false; 707 708 jq(' div#new-topic-post').slideUp(200);731 if ( !jq('#new-topic-post').length ) 732 return false; 733 734 jq('#new-topic-post').slideUp(200); 709 735 return false; 710 736 }); 711 737 712 738 /* Clicking a forum tag */ 713 jq(' div#forum-directory-tags a').click( function() {739 jq('#forum-directory-tags a').click( function() { 714 740 bp_filter_request( 'forums', 'tags', jq.cookie('bp-forums-scope'), 'div.forums', jq(this).html().replace( / /g, '-' ), 1, jq.cookie('bp-forums-extras') ); 715 741 return false; … … 729 755 var friend_action = 'uninvite'; 730 756 731 jq(' div.item-list-tabs li.selected').addClass('loading');757 jq('.item-list-tabs li.selected').addClass('loading'); 732 758 733 759 jq.post( ajaxurl, { … … 752 778 } 753 779 754 jq(' div.item-list-tabs li.selected').removeClass('loading');780 jq('.item-list-tabs li.selected').removeClass('loading'); 755 781 }); 756 782 }); … … 794 820 795 821 var nonce = link_href.split('_wpnonce='); 796 822 nonce = nonce[1]; 797 823 798 824 if ( jq(this).hasClass('accepted') || jq(this).hasClass('rejected') ) … … 840 866 841 867 /* Add / Remove friendship buttons */ 842 jq(" div.friendship-button a").live('click', function() {868 jq(".friendship-button a").live('click', function() { 843 869 jq(this).parent().addClass('loading'); 844 870 var fid = jq(this).attr('id'); … … 872 898 parentdiv.fadeIn(200).html(response); 873 899 } 874 );900 ); 875 901 876 902 } else if ( action == 'remove' ) { … … 882 908 parentdiv.fadeIn(200).html(response); 883 909 } 884 );910 ); 885 911 } 886 912 }); … … 890 916 /** Group Join / Leave Buttons **************************************/ 891 917 892 jq(" div.group-button a").live('click', function() {918 jq(".group-button a").live('click', function() { 893 919 var gid = jq(this).parent().attr('id'); 894 920 gid = gid.split('-'); … … 919 945 parentdiv.fadeIn(200).html(response); 920 946 } 921 );947 ); 922 948 } 923 949 }); … … 927 953 /** Button disabling ************************************************/ 928 954 929 jq(' div.pending').click(function() {955 jq('.pending').click(function() { 930 956 return false; 931 957 }); … … 937 963 function() { 938 964 var order = jq('#messages_order').val() || 'ASC', 939 965 offset = jq('#message-recipients').offset(); 940 966 941 967 var button = jq("input#send_reply_button"); … … 967 993 } 968 994 969 jq(" div.new-message").hide().slideDown( 200, function() {970 jq(' div.new-message').removeClass('new-message');995 jq(".new-message").hide().slideDown( 200, function() { 996 jq('.new-message').removeClass('new-message'); 971 997 }); 972 998 } … … 1039 1065 case 'unread': 1040 1066 var checkboxes = jq("tr.unread td input[type='checkbox']"); 1041 break;1067 break; 1042 1068 case 'read': 1043 1069 var checkboxes = jq("tr.read td input[type='checkbox']"); 1044 break;1070 break; 1045 1071 } 1046 1072 if ( selection != '' ) { … … 1128 1154 /* Clear BP cookies on logout */ 1129 1155 jq('a.logout').click( function() { 1130 jq.cookie('bp-activity-scope', null, {path: '/'}); 1131 jq.cookie('bp-activity-filter', null, {path: '/'}); 1132 jq.cookie('bp-activity-oldestpage', null, {path: '/'}); 1156 jq.cookie('bp-activity-scope', null, { 1157 path: '/' 1158 }); 1159 jq.cookie('bp-activity-filter', null, { 1160 path: '/' 1161 }); 1162 jq.cookie('bp-activity-oldestpage', null, { 1163 path: '/' 1164 }); 1133 1165 1134 1166 var objects = [ 'members', 'groups', 'blogs', 'forums' ]; 1135 1167 jq(objects).each( function(i) { 1136 jq.cookie('bp-' + objects[i] + '-scope', null, {path: '/'} ); 1137 jq.cookie('bp-' + objects[i] + '-filter', null, {path: '/'} ); 1138 jq.cookie('bp-' + objects[i] + '-extras', null, {path: '/'} ); 1168 jq.cookie('bp-' + objects[i] + '-scope', null, { 1169 path: '/' 1170 } ); 1171 jq.cookie('bp-' + objects[i] + '-filter', null, { 1172 path: '/' 1173 } ); 1174 jq.cookie('bp-' + objects[i] + '-extras', null, { 1175 path: '/' 1176 } ); 1139 1177 }); 1140 1178 }); … … 1144 1182 function bp_init_activity() { 1145 1183 /* Reset the page */ 1146 jq.cookie( 'bp-activity-oldestpage', 1, {path: '/'} ); 1184 jq.cookie( 'bp-activity-oldestpage', 1, { 1185 path: '/' 1186 } ); 1147 1187 1148 1188 if ( null != jq.cookie('bp-activity-filter') && jq('#activity-filter-select').length ) … … 1150 1190 1151 1191 /* Activity Tab Set */ 1152 if ( null != jq.cookie('bp-activity-scope') && jq(' div.activity-type-tabs').length ) {1153 jq(' div.activity-type-tabs li').each( function() {1192 if ( null != jq.cookie('bp-activity-scope') && jq('.activity-type-tabs').length ) { 1193 jq('.activity-type-tabs li').each( function() { 1154 1194 jq(this).removeClass('selected'); 1155 1195 }); 1156 jq('li#activity-' + jq.cookie('bp-activity-scope') + ', div.item-list-tabs li.current').addClass('selected');1196 jq('li#activity-' + jq.cookie('bp-activity-scope') + ', .item-list-tabs li.current').addClass('selected'); 1157 1197 } 1158 1198 } … … 1165 1205 1166 1206 if ( null != jq.cookie('bp-' + objects[i] + '-scope') && jq('div.' + objects[i]).length ) { 1167 jq(' div.item-list-tabs li').each( function() {1207 jq('.item-list-tabs li').each( function() { 1168 1208 jq(this).removeClass('selected'); 1169 1209 }); 1170 jq(' div.item-list-tabs li#' + objects[i] + '-' + jq.cookie('bp-' + objects[i] + '-scope') + ', div.item-list-tabs#object-nav li.current').addClass('selected');1210 jq('.item-list-tabs li#' + objects[i] + '-' + jq.cookie('bp-' + objects[i] + '-scope') + ', div.item-list-tabs#object-nav li.current').addClass('selected'); 1171 1211 } 1172 1212 }); … … 1185 1225 1186 1226 /* Save the settings we want to remain persistent to a cookie */ 1187 jq.cookie( 'bp-' + object + '-scope', scope, {path: '/'} ); 1188 jq.cookie( 'bp-' + object + '-filter', filter, {path: '/'} ); 1189 jq.cookie( 'bp-' + object + '-extras', extras, {path: '/'} ); 1227 jq.cookie( 'bp-' + object + '-scope', scope, { 1228 path: '/' 1229 } ); 1230 jq.cookie( 'bp-' + object + '-filter', filter, { 1231 path: '/' 1232 } ); 1233 jq.cookie( 'bp-' + object + '-extras', extras, { 1234 path: '/' 1235 } ); 1190 1236 1191 1237 /* Set the correct selected nav and filter */ 1192 jq(' div.item-list-tabs li').each( function() {1238 jq('.item-list-tabs li').each( function() { 1193 1239 jq(this).removeClass('selected'); 1194 1240 }); 1195 jq(' div.item-list-tabs li#' + object + '-' + scope + ', div.item-list-tabs#object-nav li.current').addClass('selected');1196 jq(' div.item-list-tabs li.selected').addClass('loading');1197 jq(' div.item-list-tabs select option[value="' + filter + '"]').prop( 'selected', true );1241 jq('.item-list-tabs li#' + object + '-' + scope + ', .item-list-tabs#object-nav li.current').addClass('selected'); 1242 jq('.item-list-tabs li.selected').addClass('loading'); 1243 jq('.item-list-tabs select option[value="' + filter + '"]').prop( 'selected', true ); 1198 1244 1199 1245 if ( 'friends' == object ) … … 1218 1264 jq(this).html(response); 1219 1265 jq(this).fadeIn(100); 1220 1221 jq(' div.item-list-tabs li.selected').removeClass('loading');1266 }); 1267 jq('.item-list-tabs li.selected').removeClass('loading'); 1222 1268 }); 1223 1269 } … … 1226 1272 function bp_activity_request(scope, filter) { 1227 1273 /* Save the type and filter to a session cookie */ 1228 jq.cookie( 'bp-activity-scope', scope, {path: '/'} ); 1229 jq.cookie( 'bp-activity-filter', filter, {path: '/'} ); 1230 jq.cookie( 'bp-activity-oldestpage', 1, {path: '/'} ); 1274 jq.cookie( 'bp-activity-scope', scope, { 1275 path: '/' 1276 } ); 1277 jq.cookie( 'bp-activity-filter', filter, { 1278 path: '/' 1279 } ); 1280 jq.cookie( 'bp-activity-oldestpage', 1, { 1281 path: '/' 1282 } ); 1231 1283 1232 1284 /* Remove selected and loading classes from tabs */ 1233 jq(' div.item-list-tabs li').each( function() {1285 jq('.item-list-tabs li').each( function() { 1234 1286 jq(this).removeClass('selected loading'); 1235 1287 }); 1236 1288 /* Set the correct selected nav and filter */ 1237 jq('li#activity-' + scope + ', div.item-list-tabs li.current').addClass('selected');1238 jq(' div#object-nav.item-list-tabs li.selected, div.activity-type-tabs li.selected').addClass('loading');1289 jq('li#activity-' + scope + ', .item-list-tabs li.current').addClass('selected'); 1290 jq('#object-nav.item-list-tabs li.selected, div.activity-type-tabs li.selected').addClass('loading'); 1239 1291 jq('#activity-filter-select select option[value="' + filter + '"]').prop( 'selected', true ); 1240 1292 … … 1266 1318 /* Update the feed link */ 1267 1319 if ( null != response.feed_url ) 1268 jq('.directory div#subnav li.feed a, .home-page div#subnav li.feed a').attr('href', response.feed_url);1269 1270 jq(' div.item-list-tabs li.selected').removeClass('loading');1320 jq('.directory #subnav li.feed a, .home-page #subnav li.feed a').attr('href', response.feed_url); 1321 1322 jq('.item-list-tabs li.selected').removeClass('loading'); 1271 1323 1272 1324 }, 'json' );
Note: See TracChangeset
for help on using the changeset viewer.