WordPress.org

Make WordPress Core

Ticket #15317: 15317-search-v2.patch

File 15317-search-v2.patch, 1.9 KB (added by austinginder, 5 years ago)
  • src/wp-includes/admin-bar.php

    diff --git src/wp-includes/admin-bar.php src/wp-includes/admin-bar.php
    index de33f54..aa9f568 100644
    function wp_admin_bar_wp_menu( $wp_admin_bar ) { 
    150150                'title'     => __('Feedback'),
    151151                'href'      => __('https://wordpress.org/support/forum/requests-and-feedback'),
    152152        ) );
     153
     154        // Add network site search
     155        $wp_admin_bar->add_menu( array(
     156                'parent' => 'my-sites-list',
     157                'id'     => 'my-sites-search',
     158                'title'  => '<input type="search" placeholder="'. __( 'Search sites' ) .'" />',
     159        ) );
    153160}
    154161
    155162/**
  • src/wp-includes/css/admin-bar.css

    diff --git src/wp-includes/css/admin-bar.css src/wp-includes/css/admin-bar.css
    index 86ad745..ef199cf 100644
    html:lang(he-il) .rtl #wpadminbar * { 
    540540        content: "\f102";
    541541}
    542542
     543#wpadminbar #wp-admin-bar-my-sites #wp-admin-bar-my-sites-search {
     544        height: 38px;
     545}
     546#wpadminbar #wp-admin-bar-my-sites #wp-admin-bar-my-sites-search .ab-item {
     547        height: 34px;
     548}
    543549
     550#wpadminbar #wp-admin-bar-my-sites #wp-admin-bar-my-sites-search input[type="search"] {
     551        padding: 0 2px;
     552        width: 95%;
     553        width: calc( 100% - 6px );
     554}
    544555
    545556/**
    546557 * Comments
  • src/wp-includes/js/admin-bar.js

    diff --git src/wp-includes/js/admin-bar.js src/wp-includes/js/admin-bar.js
    index 10d2954..b0f2647 100644
    if ( typeof(jQuery) != 'undefined' ) { 
    9393                        }).focus().select();
    9494                });
    9595
     96                $('#wp-admin-bar-my-sites-search input').bind('keyup search', function() {
     97                        var searchValRegex = new RegExp( $(this).val(), 'i');
     98                        $('#wp-admin-bar-my-sites-list > li.menupop').hide().filter(function() {
     99                                return searchValRegex.test( $(this).children('a').text() );
     100                        }).show();
     101                });
     102
    96103                $('#wpadminbar li.menupop > .ab-item').bind('keydown.adminbar', function(e){
    97104                        if ( e.which != 13 )
    98105                                return;