Ticket #3821: unbind-selectors-from-tokens-#3281-v1.patch
File unbind-selectors-from-tokens-#3281-v1.patch, 15.9 KB (added by , 13 years ago) |
---|
-
bp-themes/bp-default/_inc/global.js
85 85 jq( 'form#' + form.attr('id') + ' div.error').hide().fadeIn( 200 ); 86 86 } else { 87 87 if ( 0 == jq("ul.activity-list").length ) { 88 jq(" div.error").slideUp(100).remove();89 jq(" div#message").slideUp(100).remove();90 jq(" div.activity").append( '<ul id="activity-stream" class="activity-list item-list">' );88 jq(".error").slideUp(100).remove(); 89 jq("#message").slideUp(100).remove(); 90 jq(".activity").append( '<ul id="activity-stream" class="activity-list item-list">' ); 91 91 } 92 92 93 93 jq("ul#activity-stream").prepend(response); 94 94 jq("ul#activity-stream li:first").addClass('new-update'); 95 95 96 if ( 0 != jq(" div#latest-update").length ) {96 if ( 0 != jq("#latest-update").length ) { 97 97 var l = jq("ul#activity-stream li.new-update .activity-content .activity-inner p").html(); 98 98 var v = jq("ul#activity-stream li.new-update .activity-content .activity-header p a.view").attr('href'); 99 99 … … 105 105 106 106 u += '<a href="' + v + '" rel="nofollow">' + BP_DTheme.view + '</a>'; 107 107 108 jq(" div#latest-update").slideUp(300,function(){109 jq(" div#latest-update").html( u );110 jq(" div#latest-update").slideDown(300);108 jq("#latest-update").slideUp(300,function(){ 109 jq("#latest-update").html( u ); 110 jq("#latest-update").slideDown(300); 111 111 }); 112 112 } 113 113 … … 191 191 }); 192 192 193 193 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>');194 if ( !jq('.item-list-tabs li#activity-favorites').length ) 195 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 196 197 197 target.removeClass('fav'); 198 198 target.addClass('unfav'); 199 199 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 );200 jq('.item-list-tabs ul li#activity-favorites span').html( Number( jq('.item-list-tabs ul li#activity-favorites span').html() ) + 1 ); 201 201 } else { 202 202 target.removeClass('unfav'); 203 203 target.addClass('fav'); 204 204 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 );205 jq('.item-list-tabs ul li#activity-favorites span').html( Number( jq('.item-list-tabs ul li#activity-favorites span').html() ) - 1 ); 206 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') )207 if ( !Number( jq('.item-list-tabs ul li#activity-favorites span').html() ) ) { 208 if ( jq('.item-list-tabs ul li#activity-favorites').hasClass('selected') ) 209 209 bp_activity_request( null, null ); 210 210 211 jq(' div.item-list-tabs ul li#activity-favorites').remove();211 jq('.item-list-tabs ul li#activity-favorites').remove(); 212 212 } 213 213 } 214 214 215 if ( 'activity-favorites' == jq( ' div.item-list-tabs li.selected').attr('id') )215 if ( 'activity-favorites' == jq( '.item-list-tabs li.selected').attr('id') ) 216 216 target.parent().parent().parent().slideUp(100); 217 217 }); 218 218 … … 240 240 241 241 if ( response[0] + response[1] == '-1' ) { 242 242 li.prepend( response.substr( 2, response.length ) ); 243 li.children(' div#message').hide().fadeIn(300);243 li.children('#message').hide().fadeIn(300); 244 244 } else { 245 245 li.slideUp(300); 246 246 } … … 251 251 252 252 // Spam activity stream items 253 253 if ( target.hasClass( 'spam-activity' ) ) { 254 var li = target.parents( ' div.activity ul li' );254 var li = target.parents( '.activity ul li' ); 255 255 target.addClass( 'loading' ); 256 256 257 257 jq.post( ajaxurl, { … … 264 264 function(response) { 265 265 if ( response[0] + response[1] === '-1' ) { 266 266 li.prepend( response.substr( 2, response.length ) ); 267 li.children( ' div#message' ).hide().fadeIn(300);267 li.children( '#message' ).hide().fadeIn(300); 268 268 } else { 269 269 li.slideUp( 300 ); 270 270 } … … 328 328 jq('form.ac-form').hide(); 329 329 330 330 /* Hide excess comments */ 331 if ( jq(' div.activity-comments').length )331 if ( jq('.activity-comments').length ) 332 332 bp_dtheme_hide_comments(); 333 333 334 334 /* Activity list event delegation */ 335 jq(' div.activity').click( function(event) {335 jq('.activity').click( function(event) { 336 336 var target = jq(event.target); 337 337 338 338 /* Comment / comment reply links */ … … 358 358 }); 359 359 360 360 if ( ids[1] != 'comment' ) { 361 jq(' div.activity-comments li#acomment-' + c_id).append( form );361 jq('.activity-comments li#acomment-' + c_id).append( form ); 362 362 } else { 363 jq('li#activity-' + a_id + ' div.activity-comments').append( form );363 jq('li#activity-' + a_id + ' .activity-comments').append( form ); 364 364 } 365 365 366 366 if ( form.parent().hasClass( 'activity-comments' ) ) … … 456 456 target.addClass('loading'); 457 457 458 458 /* Remove any error messages */ 459 jq(' div.activity-comments ul div.error').remove();459 jq('.activity-comments ul .error').remove(); 460 460 461 461 /* Reset the form position */ 462 comment_li.parents(' div.activity-comments').append(form);462 comment_li.parents('.activity-comments').append(form); 463 463 464 464 jq.post( ajaxurl, { 465 465 action: 'delete_activity_comment', … … 504 504 target.addClass('loading'); 505 505 506 506 // Remove any error messages 507 jq( ' div.activity-comments ul div.error' ).remove();507 jq( '.activity-comments ul div.error' ).remove(); 508 508 509 509 // Reset the form position 510 comment_li.parents( ' div.activity-comments' ).append( comment_li.parents( 'div.activity-comments' ).children( 'form' ) );510 comment_li.parents( '.activity-comments' ).append( comment_li.parents( '.activity-comments' ).children( 'form' ) ); 511 511 512 512 jq.post( ajaxurl, { 513 513 action: 'spam_activity_comment', … … 581 581 /**** Directory Search ****************************************************/ 582 582 583 583 /* The search form on all directory pages */ 584 jq(' div.dir-search').click( function(event) {584 jq('.dir-search').click( function(event) { 585 585 if ( jq(this).hasClass('no-ajax') ) 586 586 return; 587 587 588 588 var target = jq(event.target); 589 589 590 590 if ( target.attr('type') == 'submit' ) { 591 var css_id = jq(' div.item-list-tabs li.selected').attr('id').split( '-' );591 var css_id = jq('.item-list-tabs li.selected').attr('id').split( '-' ); 592 592 var object = css_id[0]; 593 593 594 594 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') ); … … 625 625 626 626 /* When the filter select box is changed re-query */ 627 627 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');628 if ( jq('.item-list-tabs li.selected').length ) 629 var el = jq('.item-list-tabs li.selected'); 630 630 else 631 631 var el = jq(this); 632 632 … … 636 636 var filter = jq(this).val(); 637 637 var search_terms = false; 638 638 639 if ( jq(' div.dir-search input').length )640 search_terms = jq(' div.dir-search input').val();639 if ( jq('.dir-search input').length ) 640 search_terms = jq('.dir-search input').val(); 641 641 642 642 if ( 'friends' == object ) 643 643 object = 'members'; … … 658 658 if ( target.hasClass('dots') || target.hasClass('current') ) 659 659 return false; 660 660 661 if ( jq(' div.item-list-tabs li.selected').length )662 var el = jq(' div.item-list-tabs li.selected');661 if ( jq('.item-list-tabs li.selected').length ) 662 var el = jq('.item-list-tabs li.selected'); 663 663 else 664 664 var el = jq('li.filter select'); 665 665 … … 669 669 var search_terms = false; 670 670 671 671 if ( jq('div.dir-search input').length ) 672 search_terms = jq(' div.dir-search input').val();672 search_terms = jq('.dir-search input').val(); 673 673 674 674 if ( jq(target).hasClass('next') ) 675 var page_number = Number( jq(' div.pagination span.current').html() ) + 1;675 var page_number = Number( jq('.pagination span.current').html() ) + 1; 676 676 else if ( jq(target).hasClass('prev') ) 677 var page_number = Number( jq(' div.pagination span.current').html() ) - 1;677 var page_number = Number( jq('.pagination span.current').html() ) - 1; 678 678 else 679 679 var page_number = Number( jq(target).html() ); 680 680 … … 689 689 690 690 /* Hit the "New Topic" button on the forums directory page */ 691 691 jq('a.show-hide-new').click( function() { 692 if ( !jq(' div#new-topic-post').length )692 if ( !jq('#new-topic-post').length ) 693 693 return false; 694 694 695 if ( jq(' div#new-topic-post').is(":visible") )696 jq(' div#new-topic-post').slideUp(200);695 if ( jq('#new-topic-post').is(":visible") ) 696 jq('#new-topic-post').slideUp(200); 697 697 else 698 jq(' div#new-topic-post').slideDown(200, function() { jq('#topic_title').focus(); } );698 jq('#new-topic-post').slideDown(200, function() { jq('#topic_title').focus(); } ); 699 699 700 700 return false; 701 701 }); 702 702 703 703 /* Cancel the posting of a new forum topic */ 704 704 jq('input#submit_topic_cancel').click( function() { 705 if ( !jq(' div#new-topic-post').length )705 if ( !jq('#new-topic-post').length ) 706 706 return false; 707 707 708 jq(' div#new-topic-post').slideUp(200);708 jq('#new-topic-post').slideUp(200); 709 709 return false; 710 710 }); 711 711 712 712 /* Clicking a forum tag */ 713 jq(' div#forum-directory-tags a').click( function() {713 jq('#forum-directory-tags a').click( function() { 714 714 bp_filter_request( 'forums', 'tags', jq.cookie('bp-forums-scope'), 'div.forums', jq(this).html().replace( / /g, '-' ), 1, jq.cookie('bp-forums-extras') ); 715 715 return false; 716 716 }); … … 728 728 else 729 729 var friend_action = 'uninvite'; 730 730 731 jq(' div.item-list-tabs li.selected').addClass('loading');731 jq('.item-list-tabs li.selected').addClass('loading'); 732 732 733 733 jq.post( ajaxurl, { 734 734 action: 'groups_invite_user', … … 751 751 jq('#friend-list li#uid-' + friend_id).remove(); 752 752 } 753 753 754 jq(' div.item-list-tabs li.selected').removeClass('loading');754 jq('.item-list-tabs li.selected').removeClass('loading'); 755 755 }); 756 756 }); 757 757 … … 839 839 }); 840 840 841 841 /* Add / Remove friendship buttons */ 842 jq(" div.friendship-button a").live('click', function() {842 jq(".friendship-button a").live('click', function() { 843 843 jq(this).parent().addClass('loading'); 844 844 var fid = jq(this).attr('id'); 845 845 fid = fid.split('-'); … … 889 889 890 890 /** Group Join / Leave Buttons **************************************/ 891 891 892 jq(" div.group-button a").live('click', function() {892 jq(".group-button a").live('click', function() { 893 893 var gid = jq(this).parent().attr('id'); 894 894 gid = gid.split('-'); 895 895 gid = gid[1]; … … 926 926 927 927 /** Button disabling ************************************************/ 928 928 929 jq(' div.pending').click(function() {929 jq('.pending').click(function() { 930 930 return false; 931 931 }); 932 932 … … 966 966 jq(window).scrollTop(offset.top); 967 967 } 968 968 969 jq(" div.new-message").hide().slideDown( 200, function() {970 jq(' div.new-message').removeClass('new-message');969 jq(".new-message").hide().slideDown( 200, function() { 970 jq('.new-message').removeClass('new-message'); 971 971 }); 972 972 } 973 973 jq(button).removeClass('loading'); … … 1097 1097 /* Close site wide notices in the sidebar */ 1098 1098 jq("a#close-notice").click( function() { 1099 1099 jq(this).addClass('loading'); 1100 jq(' div#sidebar div.error').remove();1100 jq('#sidebar div.error').remove(); 1101 1101 1102 1102 jq.post( ajaxurl, { 1103 1103 action: 'messages_close_notice', … … 1108 1108 1109 1109 if ( response[0] + response[1] == '-1' ) { 1110 1110 jq('.notice').prepend( response.substr( 2, response.length ) ); 1111 jq( ' div#sidebar div.error').hide().fadeIn( 200 );1111 jq( '#sidebar div.error').hide().fadeIn( 200 ); 1112 1112 } else { 1113 1113 jq('.notice').slideUp( 100 ); 1114 1114 } … … 1149 1149 jq('#activity-filter-select select option[value="' + jq.cookie('bp-activity-filter') + '"]').prop( 'selected', true ); 1150 1150 1151 1151 /* 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() {1152 if ( null != jq.cookie('bp-activity-scope') && jq('.activity-type-tabs').length ) { 1153 jq('.activity-type-tabs li').each( function() { 1154 1154 jq(this).removeClass('selected'); 1155 1155 }); 1156 jq('li#activity-' + jq.cookie('bp-activity-scope') + ', div.item-list-tabs li.current').addClass('selected');1156 jq('li#activity-' + jq.cookie('bp-activity-scope') + ', .item-list-tabs li.current').addClass('selected'); 1157 1157 } 1158 1158 } 1159 1159 … … 1164 1164 jq('li#' + objects[i] + '-order-select select option[value="' + jq.cookie('bp-' + objects[i] + '-filter') + '"]').prop( 'selected', true ); 1165 1165 1166 1166 if ( null != jq.cookie('bp-' + objects[i] + '-scope') && jq('div.' + objects[i]).length ) { 1167 jq(' div.item-list-tabs li').each( function() {1167 jq('.item-list-tabs li').each( function() { 1168 1168 jq(this).removeClass('selected'); 1169 1169 }); 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');1170 jq('.item-list-tabs li#' + objects[i] + '-' + jq.cookie('bp-' + objects[i] + '-scope') + ', div.item-list-tabs#object-nav li.current').addClass('selected'); 1171 1171 } 1172 1172 }); 1173 1173 } … … 1189 1189 jq.cookie( 'bp-' + object + '-extras', extras, {path: '/'} ); 1190 1190 1191 1191 /* Set the correct selected nav and filter */ 1192 jq(' div.item-list-tabs li').each( function() {1192 jq('.item-list-tabs li').each( function() { 1193 1193 jq(this).removeClass('selected'); 1194 1194 }); 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 );1195 jq('.item-list-tabs li#' + object + '-' + scope + ', .item-list-tabs#object-nav li.current').addClass('selected'); 1196 jq('.item-list-tabs li.selected').addClass('loading'); 1197 jq('.item-list-tabs select option[value="' + filter + '"]').prop( 'selected', true ); 1198 1198 1199 1199 if ( 'friends' == object ) 1200 1200 object = 'members'; … … 1218 1218 jq(this).html(response); 1219 1219 jq(this).fadeIn(100); 1220 1220 }); 1221 jq(' div.item-list-tabs li.selected').removeClass('loading');1221 jq('.item-list-tabs li.selected').removeClass('loading'); 1222 1222 }); 1223 1223 } 1224 1224 … … 1230 1230 jq.cookie( 'bp-activity-oldestpage', 1, {path: '/'} ); 1231 1231 1232 1232 /* Remove selected and loading classes from tabs */ 1233 jq(' div.item-list-tabs li').each( function() {1233 jq('.item-list-tabs li').each( function() { 1234 1234 jq(this).removeClass('selected loading'); 1235 1235 }); 1236 1236 /* 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');1237 jq('li#activity-' + scope + ', .item-list-tabs li.current').addClass('selected'); 1238 jq('#object-nav.item-list-tabs li.selected, div.activity-type-tabs li.selected').addClass('loading'); 1239 1239 jq('#activity-filter-select select option[value="' + filter + '"]').prop( 'selected', true ); 1240 1240 1241 1241 /* Reload the activity stream based on the selection */ … … 1255 1255 { 1256 1256 jq('.widget_bp_activity_widget h2 span.ajax-loader').hide(); 1257 1257 1258 jq(' div.activity').fadeOut( 100, function() {1258 jq('.activity').fadeOut( 100, function() { 1259 1259 jq(this).html(response.contents); 1260 1260 jq(this).fadeIn(100); 1261 1261 … … 1265 1265 1266 1266 /* Update the feed link */ 1267 1267 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);1268 jq('.directory #subnav li.feed a, .home-page #subnav li.feed a').attr('href', response.feed_url); 1269 1269 1270 jq(' div.item-list-tabs li.selected').removeClass('loading');1270 jq('.item-list-tabs li.selected').removeClass('loading'); 1271 1271 1272 1272 }, 'json' ); 1273 1273 }