mirror of
https://gh.wpcy.net/https://github.com/buddypress/buddypress.git
synced 2026-06-01 06:04:04 +08:00
This widget displays a list of the displayed user's friends, when viewing a user's profile. See #5008 Props megainfo, williamsba1 git-svn-id: https://buddypress.svn.wordpress.org/trunk@7392 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
49 lines
No EOL
1.3 KiB
JavaScript
49 lines
No EOL
1.3 KiB
JavaScript
jQuery(document).ready( function() {
|
|
jQuery(".widget div#friends-list-options a").on('click',
|
|
function() {
|
|
var link = this;
|
|
jQuery(link).addClass('loading');
|
|
|
|
jQuery(".widget div#friends-list-options a").removeClass("selected");
|
|
jQuery(this).addClass('selected');
|
|
|
|
jQuery.post( ajaxurl, {
|
|
action: 'widget_friends',
|
|
'cookie': encodeURIComponent(document.cookie),
|
|
'_wpnonce': jQuery("input#_wpnonce-friends").val(),
|
|
'max-friends': jQuery("input#friends_widget_max").val(),
|
|
'filter': jQuery(this).attr('id')
|
|
},
|
|
function(response)
|
|
{
|
|
jQuery(link).removeClass('loading');
|
|
friend_wiget_response(response);
|
|
});
|
|
|
|
return false;
|
|
}
|
|
);
|
|
});
|
|
|
|
function friend_wiget_response(response) {
|
|
response = response.substr(0, response.length-1);
|
|
response = response.split('[[SPLIT]]');
|
|
|
|
if ( response[0] != "-1" ) {
|
|
jQuery(".widget ul#friends-list").fadeOut(200,
|
|
function() {
|
|
jQuery(".widget ul#friends-list").html(response[1]);
|
|
jQuery(".widget ul#friends-list").fadeIn(200);
|
|
}
|
|
);
|
|
|
|
} else {
|
|
jQuery(".widget ul#friends-list").fadeOut(200,
|
|
function() {
|
|
var message = '<p>' + response[1] + '</p>';
|
|
jQuery(".widget ul#friends-list").html(message);
|
|
jQuery(".widget ul#friends-list").fadeIn(200);
|
|
}
|
|
);
|
|
}
|
|
} |