[ Index ] |
PHP Cross Reference of BuddyPress |
[Summary view] [Print] [Text view]
1 jQuery(document).ready( function() { 2 friend_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 friend_widget_click_handler(); 8 } ); 9 } 10 }); 11 12 function friend_widget_click_handler() { 13 jQuery('.widget div#friends-list-options a').on('click', 14 function() { 15 var link = this; 16 jQuery(link).addClass('loading'); 17 18 jQuery('.widget div#friends-list-options a').removeClass('selected'); 19 jQuery(this).addClass('selected'); 20 21 jQuery.post( ajaxurl, { 22 action: 'widget_friends', 23 'cookie': encodeURIComponent(document.cookie), 24 '_wpnonce': jQuery('input#_wpnonce-friends').val(), 25 'max-friends': jQuery('input#friends_widget_max').val(), 26 'filter': jQuery(this).attr('id') 27 }, 28 function(response) 29 { 30 jQuery(link).removeClass('loading'); 31 friend_widget_response(response); 32 }); 33 34 return false; 35 } 36 ); 37 } 38 39 function friend_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#friends-list').fadeOut(200, 45 function() { 46 jQuery('.widget ul#friends-list').html(response[1]); 47 jQuery('.widget ul#friends-list').fadeIn(200); 48 } 49 ); 50 51 } else { 52 jQuery('.widget ul#friends-list').fadeOut(200, 53 function() { 54 var message = '<p>' + response[1] + '</p>'; 55 jQuery('.widget ul#friends-list').html(message); 56 jQuery('.widget ul#friends-list').fadeIn(200); 57 } 58 ); 59 } 60 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Dec 22 01:00:54 2024 | Cross-referenced by PHPXref 0.7.1 |