mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-16 15:46:04 +01:00
291ed370b4
fixes #25348. Built from https://develop.svn.wordpress.org/trunk@27046 git-svn-id: http://core.svn.wordpress.org/trunk@26920 1a063a9b-81f0-0310-95a4-ce76da25c4cd
31 lines
1.0 KiB
JavaScript
31 lines
1.0 KiB
JavaScript
/* global ajaxurl, current_site_id, isRtl */
|
|
|
|
(function( $ ) {
|
|
var id = ( typeof current_site_id !== 'undefined' ) ? '&site_id=' + current_site_id : '';
|
|
$(document).ready( function() {
|
|
var position = { offset: '0, -1' };
|
|
if ( typeof isRtl !== 'undefined' && isRtl ) {
|
|
position.my = 'right top';
|
|
position.at = 'right bottom';
|
|
}
|
|
$( '.wp-suggest-user' ).each( function(){
|
|
var $this = $( this ),
|
|
autocompleteType = ( typeof $this.data( 'autocompleteType' ) !== 'undefined' ) ? $this.data( 'autocompleteType' ) : 'add',
|
|
autocompleteField = ( typeof $this.data( 'autocompleteField' ) !== 'undefined' ) ? $this.data( 'autocompleteField' ) : 'user_login';
|
|
|
|
$this.autocomplete({
|
|
source: ajaxurl + '?action=autocomplete-user&autocomplete_type=' + autocompleteType + '&autocomplete_field=' + autocompleteField + id,
|
|
delay: 500,
|
|
minLength: 2,
|
|
position: position,
|
|
open: function() {
|
|
$( this ).addClass( 'open' );
|
|
},
|
|
close: function() {
|
|
$( this ).removeClass( 'open' );
|
|
}
|
|
});
|
|
});
|
|
});
|
|
})( jQuery );
|