[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

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

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


Generated: Wed Dec 2 01:01:35 2020 Cross-referenced by PHPXref 0.7.1