Ticket #38211: 38211.8.diff
| File 38211.8.diff, 5.7 KB (added by , 23 months ago) |
|---|
-
src/js/_enqueues/wp/updates.js
142 142 wp.updates.searchTerm = ''; 143 143 144 144 /** 145 * Minimum number of characters before an ajax search is fired. 146 * 147 * @since 6.7.0 148 * 149 * @type {number} 150 */ 151 wp.updates.searchMinCharacters = 2; 152 153 /** 145 154 * Whether filesystem credentials need to be requested from the user. 146 155 * 147 156 * @since 4.2.0 … … 2977 2986 $pluginInstallSearch.attr( 'aria-describedby', 'live-search-desc' ); 2978 2987 } 2979 2988 2989 // Track the previous search string length. 2990 var previousSearchStringLength = 0; 2991 wp.updates.shouldSearch = function( searchStringLength ) { 2992 var shouldSearch = searchStringLength >= wp.updates.searchMinCharacters || 2993 previousSearchStringLength > wp.updates.searchMinCharacters; 2994 previousSearchStringLength = searchStringLength; 2995 return shouldSearch; 2996 }; 2997 2980 2998 /** 2981 2999 * Handles changes to the plugin search box on the new-plugin page, 2982 3000 * searching the repository dynamically. … … 2984 3002 * @since 4.6.0 2985 3003 */ 2986 3004 $pluginInstallSearch.on( 'keyup input', _.debounce( function( event, eventtype ) { 2987 var $searchTab = $( '.plugin-install-search' ), data, searchLocation; 3005 var $searchTab = $( '.plugin-install-search' ), data, searchLocation, 3006 searchStringLength = $pluginInstallSearch.val().length; 2988 3007 2989 3008 data = { 2990 3009 _ajax_nonce: wp.updates.ajaxNonce, … … 2995 3014 }; 2996 3015 searchLocation = location.href.split( '?' )[ 0 ] + '?' + $.param( _.omit( data, [ '_ajax_nonce', 'pagenow' ] ) ); 2997 3016 3017 // Set the autocomplete attribute, turning off autocomplete 1 character before ajax search kicks in. 3018 if ( wp.updates.shouldSearch( searchStringLength ) ) { 3019 $pluginInstallSearch.attr( 'autocomplete', 'off' ); 3020 } else { 3021 $pluginInstallSearch.attr( 'autocomplete', 'on' ); 3022 return; 3023 } 3024 2998 3025 // Clear on escape. 2999 3026 if ( 'keyup' === event.type && 27 === event.which ) { 3000 3027 event.target.value = ''; … … 3054 3081 3055 3082 if ( $pluginSearch.length ) { 3056 3083 $pluginSearch.attr( 'aria-describedby', 'live-search-desc' ); 3084 3057 3085 } 3058 3086 3059 3087 /** … … 3069 3097 pagenow: pagenow, 3070 3098 plugin_status: 'all' 3071 3099 }, 3072 queryArgs; 3100 queryArgs, 3101 searchStringLength = $pluginSearch.val().length; 3073 3102 3103 // Set the autocomplete attribute, turning off autocomplete 1 character before ajax search kicks in. 3104 if ( wp.updates.shouldSearch( searchStringLength ) ) { 3105 $pluginSearch.attr( 'autocomplete', 'off' ); 3106 } else { 3107 $pluginSearch.attr( 'autocomplete', 'on' ); 3108 return; 3109 } 3110 3074 3111 // Clear on escape. 3075 3112 if ( 'keyup' === event.type && 27 === event.which ) { 3076 3113 event.target.value = '';
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)