[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-members/admin/js/ -> admin.js (source)

   1  /* exported clear */
   2  
   3  ( function( $ ) {
   4      // Profile Visibility Settings
   5      $( '.visibility-toggle-link' ).on( 'click', function( event ) {
   6          event.preventDefault();
   7  
   8          $( this ).attr( 'aria-expanded', 'true' ).parent().hide()
   9                   .siblings( '.field-visibility-settings' ).show();
  10      } );
  11  
  12      $( '.field-visibility-settings-close' ).on( 'click', function( event ) {
  13          event.preventDefault();
  14  
  15          $( '.visibility-toggle-link' ).attr( 'aria-expanded', 'false' );
  16  
  17          var settings_div = $( this ).parent(),
  18              vis_setting_text = settings_div.find( 'input:checked' ).parent().text();
  19  
  20          settings_div.hide()
  21                      .siblings( '.field-visibility-settings-toggle' )
  22                      .find( '.current-visibility-level' ).text( vis_setting_text ).end()
  23                      .show();
  24      } );
  25  
  26  } )( jQuery );
  27  
  28  
  29  /**
  30   * Deselects any select options or input options for the specified field element.
  31   *
  32   * @param {String} container HTML ID of the field
  33   * @since 1.0.0
  34   */
  35  function clear( container ) {
  36      container = document.getElementById( container );
  37      if ( ! container ) {
  38          return;
  39      }
  40  
  41      var radioButtons = container.getElementsByTagName( 'INPUT' ),
  42          options = container.getElementsByTagName( 'OPTION' ),
  43          i       = 0;
  44  
  45      if ( radioButtons ) {
  46          for ( i = 0; i < radioButtons.length; i++ ) {
  47              radioButtons[i].checked = '';
  48          }
  49      }
  50  
  51      if ( options ) {
  52          for ( i = 0; i < options.length; i++ ) {
  53              options[i].selected = false;
  54          }
  55      }
  56  }


Generated: Wed Oct 27 01:00:59 2021 Cross-referenced by PHPXref 0.7.1