Changeset 12526
- Timestamp:
- 01/18/2020 11:42:35 AM (5 years ago)
- Location:
- trunk/src/bp-templates/bp-nouveau/js
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-templates/bp-nouveau/js/buddypress-nouveau.js
r12447 r12526 8 8 ( function( exports, $ ) { 9 9 10 // Bail if not set 10 // Bail if not set. 11 11 if ( typeof BP_Nouveau === 'undefined' ) { 12 12 return; … … 24 24 start: function() { 25 25 26 // Setup globals 26 // Setup globals. 27 27 this.setupGlobals(); 28 28 29 // Adjust Document/Forms properties 29 // Adjust Document/Forms properties. 30 30 this.prepareDocument(); 31 31 32 // Init the BuddyPress objects 32 // Init the BuddyPress objects. 33 33 this.initObjects(); 34 34 35 // Set BuddyPress HeartBeat 35 // Set BuddyPress HeartBeat. 36 36 this.setHeartBeat(); 37 37 38 // Listen to events ("Add hooks!") 38 // Listen to events ("Add hooks!"). 39 39 this.addListeners(); 40 40 }, … … 47 47 this.ajax_request = null; 48 48 49 // Object Globals 49 // Object Globals. 50 50 this.objects = $.map( BP_Nouveau.objects, function( value ) { return value; } ); 51 51 this.objectNavParent = BP_Nouveau.object_nav_parent; 52 52 53 // HeartBeat Global 53 // HeartBeat Global. 54 54 this.heartbeat = wp.heartbeat || {}; 55 55 56 // An object containing each query var 56 // An object containing each query var. 57 57 this.querystring = this.getLinkParams(); 58 58 }, … … 64 64 prepareDocument: function() { 65 65 66 // Remove the no-js class and add the js one 66 // Remove the no-js class and add the js one. 67 67 if ( $( 'body' ).hasClass( 'no-js' ) ) { 68 68 $('body').removeClass( 'no-js' ).addClass( 'js' ); 69 69 } 70 70 71 // Log Warnings into the console instead of the screen 71 // Log Warnings into the console instead of the screen. 72 72 if ( BP_Nouveau.warnings && 'undefined' !== typeof console && console.warn ) { 73 73 $.each( BP_Nouveau.warnings, function( w, warning ) { … … 76 76 } 77 77 78 // Remove the directory title if there's a widget containing it 78 // Remove the directory title if there's a widget containing it. 79 79 if ( $( '.buddypress_object_nav .widget-title' ).length ) { 80 80 var text = $( '.buddypress_object_nav .widget-title' ).html(); … … 124 124 delete store[ property ]; 125 125 } else { 126 // Set property 126 // Set property. 127 127 store[ property ] = value; 128 128 } … … 166 166 * 167 167 * @param {string} qv The query variable to decode. 168 * @param {object} chars The specific characters to use. Option nal.168 * @param {object} chars The specific characters to use. Optional. 169 169 * @return {string} The URL decoded variable. 170 170 */ … … 194 194 } 195 195 196 // Extend posted data with stored data and object nonce 196 // Extend posted data with stored data and object nonce. 197 197 var postData = $.extend( {}, bp.Nouveau.getStorage( 'bp-' + object ), { nonce: BP_Nouveau.nonces[object] }, post_data ); 198 198 … … 255 255 }, data ); 256 256 257 // Do not request if we don't have the object or the target to inject results into 257 // Do not request if we don't have the object or the target to inject results into. 258 258 if ( ! data.object || ! data.target ) { 259 259 return; 260 260 } 261 261 262 // Prepare the search terms for the request 262 // Prepare the search terms for the request. 263 263 if ( data.search_terms ) { 264 264 data.search_terms = data.search_terms.replace( /</g, '<' ).replace( />/g, '>' ); 265 265 } 266 266 267 // Set session's data 267 // Set session's data. 268 268 if ( null !== data.scope ) { 269 269 this.setStorage( 'bp-' + data.object, 'scope', data.scope ); … … 353 353 } 354 354 355 // Notifications always need to start with Newest ones 355 // Notifications always need to start with Newest ones. 356 356 if ( undefined !== objectData.extras && 'notifications' !== object ) { 357 357 extras = objectData.extras; … … 375 375 } 376 376 377 // Check the querystring to eventually include the search terms 377 // Check the querystring to eventually include the search terms. 378 378 if ( null !== self.querystring ) { 379 379 if ( undefined !== self.querystring[ object + '_search'] ) { … … 398 398 }; 399 399 400 // Populate the object list 400 // Populate the object list. 401 401 self.objectRequest( queryData ); 402 402 } … … 414 414 this.heartbeat.interval( Number( BP_Nouveau.pulse ) ); 415 415 416 // Extend "send" with BuddyPress namespace 416 // Extend "send" with BuddyPress namespace. 417 417 $.fn.extend( { 418 418 'heartbeat-send': function() { … … 421 421 } ); 422 422 423 // Extend "tick" with BuddyPress namespace 423 // Extend "tick" with BuddyPress namespace. 424 424 $.fn.extend( { 425 425 'heartbeat-tick': function() { … … 435 435 */ 436 436 addListeners: function() { 437 // Disabled inputs 437 // Disabled inputs. 438 438 $( '[data-bp-disable-input]' ).on( 'change', this.toggleDisabledInput ); 439 439 440 // HeartBeat Send and Receive 440 // HeartBeat Send and Receive. 441 441 $( document ).on( 'heartbeat-send.buddypress', this.heartbeatSend ); 442 442 $( document ).on( 'heartbeat-tick.buddypress', this.heartbeatTick ); 443 443 444 // Refreshing 444 // Refreshing. 445 445 $( this.objectNavParent + ' .bp-navs' ).on( 'click', 'a', this, this.scopeQuery ); 446 446 447 // Filtering 447 // Filtering. 448 448 $( '#buddypress [data-bp-filter]' ).on( 'change', this, this.filterQuery ); 449 449 450 // Searching 450 // Searching. 451 451 $( '#buddypress [data-bp-search]' ).on( 'submit', 'form', this, this.searchQuery ); 452 452 $( '#buddypress [data-bp-search] form' ).on( 'search', 'input[type=search]', this.resetSearch ); 453 453 454 // Buttons 454 // Buttons. 455 455 $( '#buddypress [data-bp-list], #buddypress #item-header' ).on( 'click', '[data-bp-btn-action]', this, this.buttonAction ); 456 456 457 // Close notice 457 // Close notice. 458 458 $( '#buddypress [data-bp-close]' ).on( 'click', this, this.closeNotice ); 459 459 460 // Pagination 460 // Pagination. 461 461 $( '#buddypress [data-bp-list]' ).on( 'click', '[data-bp-pagination] a', this, this.paginateAction ); 462 462 }, … … 495 495 */ 496 496 heartbeatSend: function( event, data ) { 497 // Add an heartbeat send event to possibly any BuddyPress pages 497 // Add an heartbeat send event to possibly any BuddyPress pages. 498 498 $( '#buddypress' ).trigger( 'bp_heartbeat_send', data ); 499 499 }, … … 506 506 */ 507 507 heartbeatTick: function( event, data ) { 508 // Add an heartbeat send event to possibly any BuddyPress pages 508 // Add an heartbeat send event to possibly any BuddyPress pages. 509 509 $( '#buddypress' ).trigger( 'bp_heartbeat_tick', data ); 510 510 }, … … 530 530 } 531 531 532 // Stop event propagation 532 // Stop event propagation. 533 533 event.preventDefault(); 534 534 … … 539 539 } 540 540 541 // Remove the New count on dynamic tabs 541 // Remove the New count on dynamic tabs. 542 542 if ( target.hasClass( 'dynamic' ) ) { 543 543 target.find( 'a span' ).html(''); … … 597 597 } 598 598 599 // Stop event propagation 599 // Stop event propagation. 600 600 event.preventDefault(); 601 601 … … 653 653 object = item.data( 'bp-item-component' ), nonce = ''; 654 654 655 // Simply let the event fire if we don't have needed values 655 // Simply let the event fire if we don't have needed values. 656 656 if ( ! action || ! item_id || ! object ) { 657 657 return event; 658 658 } 659 659 660 // Stop event propagation 660 // Stop event propagation. 661 661 event.preventDefault(); 662 662 … … 691 691 } 692 692 693 // Add a pending class to prevent queries while we're processing the action 693 // Add a pending class to prevent queries while we're processing the action. 694 694 target.addClass( 'pending loading' ); 695 695 … … 704 704 item.find( '.bp-feedback' ).fadeOut( 6000 ); 705 705 } else { 706 // Specific cases for groups 706 // Specific cases for groups. 707 707 if ( 'groups' === object ) { 708 708 709 // Group's header button 709 // Group's header button. 710 710 if ( undefined !== response.data.is_group && response.data.is_group ) { 711 711 return window.location.reload(); … … 713 713 } 714 714 715 // User's groups invitations screen & User's friend screens 715 // User's groups invitations screen & User's friend screens. 716 716 if ( undefined !== response.data.is_user && response.data.is_user ) { 717 717 target.parent().html( response.data.feedback ); … … 720 720 } 721 721 722 // Update count 722 // Update count. 723 723 if ( $( self.objectNavParent + ' [data-bp-scope="personal"]' ).length ) { 724 724 var personal_count = Number( $( self.objectNavParent + ' [data-bp-scope="personal"] span' ).html() ) || 0; … … 752 752 event.preventDefault(); 753 753 754 // Make sure cookies are removed 754 // Make sure cookies are removed. 755 755 if ( 'clear' === closeBtn.data( 'bp-close' ) ) { 756 756 if ( undefined !== $.cookie( 'bp-message' ) ) { … … 771 771 } 772 772 773 // Remove the notice 773 // Remove the notice. 774 774 closeBtn.closest( '.bp-feedback' ).remove(); 775 775 }, … … 789 789 object = $( event.delegateTarget ).data( 'bp-list' ) || null; 790 790 791 // Set the scope & filter 791 // Set the scope & filter. 792 792 if ( null !== object ) { 793 793 objectData = self.getStorage( 'bp-' + object ); … … 806 806 } 807 807 808 // Set the search terms 808 // Set the search terms. 809 809 if ( $( '#buddypress [data-bp-search="' + object + '"] input[type=search]' ).length ) { 810 810 search_terms = $( '#buddypress [data-bp-search="' + object + '"] input[type=search]' ).val(); … … 820 820 }; 821 821 822 // Request the page 822 // Request the page. 823 823 self.objectRequest( queryData ); 824 824 } 825 825 }; 826 826 827 // Launch BP Nouveau 827 // Launch BP Nouveau. 828 828 bp.Nouveau.start(); 829 829 -
trunk/src/bp-templates/bp-nouveau/js/buddypress-xprofile.js
r12082 r12526 5 5 ( function( exports, $ ) { 6 6 7 // Bail if not set 7 // Bail if not set. 8 8 if ( typeof BP_Nouveau === 'undefined' ) { 9 9 return; … … 18 18 /** Profile Visibility Settings *********************************/ 19 19 20 // Initially hide the 'field-visibility-settings' block 20 // Initially hide the 'field-visibility-settings' block. 21 21 $( '.field-visibility-settings' ).addClass( 'bp-hide' ); 22 // Add initial aria state to button 22 // Add initial aria state to button. 23 23 $( '.visibility-toggle-link' ).attr( 'aria-expanded', 'false' ); 24 24 -
trunk/src/bp-templates/bp-nouveau/js/customizer.js
r12197 r12526 13 13 userFrontPage = wp.customize.control( 'user_front_page' ); 14 14 15 // If the Main Group setting is disabled, hide all others 15 // If the Main Group setting is disabled, hide all others. 16 16 if ( 'undefined' !== typeof groupFrontPage ) { 17 17 $( groupFrontPage.selector ).on( 'click', 'input[type=checkbox]', function( event ) { … … 30 30 } 31 31 32 // If the Main User setting is disabled, hide all others 32 // If the Main User setting is disabled, hide all others. 33 33 if ( 'undefined' !== typeof userFrontPage ) { 34 34 $( userFrontPage.selector ).on( 'click', 'input[type=checkbox]', function( event ) { -
trunk/src/bp-templates/bp-nouveau/js/password-verify.js
r12397 r12526 15 15 strength; 16 16 17 // Reset classes and result text 17 // Reset classes and result text. 18 18 $( '#pass-strength-result' ).removeClass( 'show mismatch short bad good strong' ); 19 19 if ( ! pass1 ) { … … 43 43 } 44 44 45 // Bind check_pass_strength to keyup events in the password fields 45 // Bind check_pass_strength to keyup events in the password fields. 46 46 $( document ).ready( function() { 47 47 $( '.password-entry' ).val( '' ).keyup( check_pass_strength );
Note: See TracChangeset
for help on using the changeset viewer.