Ticket #27151: 47540.patch
File 47540.patch, 2.9 KB (added by , 5 years ago) |
---|
-
src/js/_enqueues/admin/widgets.js
501 501 self.closeChooser(); 502 502 } 503 503 }); 504 505 /** 506 * Use feature detection to determine whether inputs should use 507 * the `keyup` or `input` event. Input is preferred but lacks support 508 * in legacy browsers. See changeset 34078, see also ticket #26600#comment:59 509 */ 510 if ( 'oninput' in document.createElement( 'input' ) ) { 511 inputEvent = 'input'; 512 } else { 513 inputEvent = 'keyup'; 514 } 515 516 $( '#widgets-search-input' ).on( inputEvent, function() { 517 518 var search_term = $('#widgets-search-input').val() || '', 519 parent = $('#widgets-left'), 520 widgets = parent.find('.widget'), 521 widget_titles = parent.find('.widget-title'); 522 523 if( search_term.length ) { 524 525 // Hide all widgets. Because, Below we show those widgets 526 // which have search term in the widget title. 527 widgets.addClass('hide-widget').removeClass('show-widget'); 528 529 // Search widget and ONLY show these widgets which "contain" the widget title. 530 var rex = new RegExp( search_term, 'i'); 531 widget_titles.filter(function () { 532 var widget_name = $.trim( $(this).text() ) || ''; 533 return rex.test( widget_name ); 534 }).parents('.widget').removeClass('hide-widget').addClass('show-widget'); 535 536 } else { 537 538 // Show all widgets. 539 widgets.removeClass('hide-widget').addClass('show-widget'); 540 } 541 }); 504 542 }, 505 543 506 544 saveOrder : function( sidebarId ) { -
src/wp-admin/css/widgets.css
773 773 cursor: not-allowed; 774 774 } 775 775 776 /* =Widget Search 777 -------------------------------------------------------------- */ 778 #widgets-search-input { 779 margin: 0 0 .2em 0; 780 width: 100%; 781 font-size: 16px; 782 font-weight: 300; 783 line-height: 1.5; 784 border-width: 1px; 785 border-style: solid; 786 border-color: #ddd; 787 } 788 789 790 .show-widget { 791 display: block; 792 } 793 794 .hide-widget { 795 display: none; 796 } 797 776 798 /* =Media Queries 777 799 -------------------------------------------------------------- */ 778 800 -
src/wp-admin/widgets.php
426 426 427 427 <div class="widget-liquid-left"> 428 428 <div id="widgets-left"> 429 <div class="widgets-search"> 430 <input type="search" id="widgets-search-input" class="regular-text" placeholder="<?php _e('Search widgets...'); ?>"> 431 </div> 429 432 <div id="available-widgets" class="widgets-holder-wrap"> 430 433 <div class="sidebar-name"> 431 434 <button type="button" class="handlediv hide-if-no-js" aria-expanded="true">