[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-core/js/ -> widget-members.js (source)

   1  jQuery( function() {
   2      member_widget_click_handler();
   3  
   4      // WP 4.5 - Customizer selective refresh support.
   5      if ( 'undefined' !== typeof wp && wp.customize && wp.customize.selectiveRefresh ) {
   6          wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function() {
   7              member_widget_click_handler();
   8          } );
   9      }
  10  });
  11  
  12  function member_widget_click_handler() {
  13      jQuery('.widget div#members-list-options a').on('click',
  14          function() {
  15              var link = this;
  16              jQuery(link).addClass('loading');
  17  
  18              jQuery('.widget div#members-list-options a').removeClass('selected');
  19              jQuery(this).addClass('selected');
  20  
  21              jQuery.post( ajaxurl, {
  22                  action: 'widget_members',
  23                  'cookie': encodeURIComponent(document.cookie),
  24                  '_wpnonce': jQuery('input#_wpnonce-members').val(),
  25                  'max-members': jQuery('input#members_widget_max').val(),
  26                  'filter': jQuery(this).attr('id')
  27              },
  28              function(response)
  29              {
  30                  jQuery(link).removeClass('loading');
  31                  member_widget_response(response);
  32              });
  33  
  34              return false;
  35          }
  36      );
  37  }
  38  
  39  function member_widget_response(response) {
  40      response = response.substr(0, response.length-1);
  41      response = response.split('[[SPLIT]]');
  42  
  43      if ( response[0] !== '-1' ) {
  44          jQuery('.widget ul#members-list').fadeOut(200,
  45              function() {
  46                  jQuery('.widget ul#members-list').html(response[1]);
  47                  jQuery('.widget ul#members-list').fadeIn(200);
  48              }
  49          );
  50  
  51      } else {
  52          jQuery('.widget ul#members-list').fadeOut(200,
  53              function() {
  54                  var message = '<p>' + response[1] + '</p>';
  55                  jQuery('.widget ul#members-list').html(message);
  56                  jQuery('.widget ul#members-list').fadeIn(200);
  57              }
  58          );
  59      }
  60  }


Generated: Sun Nov 24 01:00:53 2024 Cross-referenced by PHPXref 0.7.1