[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-templates/bp-nouveau/js/ -> customizer.js (source)

   1  /* global _ */
   2  /* @since 3.0.0 */
   3  /* @version 3.0.0 */
   4  window.wp = window.wp || {};
   5  
   6  ( function( wp, $ ) {
   7  
   8      if ( 'undefined' === typeof wp.customize ) {
   9          return;
  10      }
  11  
  12      wp.customize.bind( 'ready', function() {
  13          var groupFrontPage = wp.customize.control( 'group_front_page' ),
  14              userFrontPage  = wp.customize.control( 'user_front_page' );
  15  
  16          // If the Main Group setting is disabled, hide all others.
  17          if ( 'undefined' !== typeof groupFrontPage ) {
  18              $( groupFrontPage.selector ).on( 'click', 'input[type=checkbox]', function( event ) {
  19                  var checked = $( event.currentTarget ).prop( 'checked' ), controller = $( event.delegateTarget ).prop( 'id' );
  20  
  21                  _.each( wp.customize.section( 'bp_nouveau_group_front_page' ).controls(), function( control ) {
  22                      if ( control.selector !== '#' + controller ) {
  23                          if ( true === checked ) {
  24                              $( control.selector ).show();
  25                          } else {
  26                              $( control.selector ).hide();
  27                          }
  28                      }
  29                  } );
  30              } );
  31          }
  32  
  33          // If the Main User setting is disabled, hide all others.
  34          if ( 'undefined' !== typeof userFrontPage ) {
  35              $( userFrontPage.selector ).on( 'click', 'input[type=checkbox]', function( event ) {
  36                  var checked = $( event.currentTarget ).prop( 'checked' ), controller = $( event.delegateTarget ).prop( 'id' );
  37  
  38                  _.each( wp.customize.section( 'bp_nouveau_user_front_page' ).controls(), function( control ) {
  39                      if ( control.selector !== '#' + controller ) {
  40                          if ( true === checked ) {
  41                              $( control.selector ).show();
  42                          } else {
  43                              $( control.selector ).hide();
  44                          }
  45                      }
  46                  } );
  47              } );
  48          }
  49  
  50          $( 'ul#customize-control-group_nav_order, ul#customize-control-user_nav_order' ).sortable( {
  51              cursor    : 'move',
  52              axis      : 'y',
  53              opacity   : 1,
  54              items     : 'li:not(.ui-sortable-disabled)',
  55              tolerance : 'intersect',
  56  
  57              update: function() {
  58                  var order = [];
  59  
  60                  $( this ).find( '[data-bp-nav]' ).each( function( s, slug ) {
  61                      order.push( $( slug ).data( 'bp-nav' ) );
  62                  } );
  63  
  64                  if ( order.length ) {
  65                      $( '#bp_item_' + $( this ).data( 'bp-type' ) ).val( order.join() ).trigger( 'change' );
  66                  }
  67              }
  68          } ).disableSelection();
  69      } );
  70  
  71  } )( window.wp, jQuery );


Generated: Thu Mar 28 01:00:56 2024 Cross-referenced by PHPXref 0.7.1