Make WordPress Core

Ticket #43058: 43058.2.patch

File 43058.2.patch, 2.2 KB (added by dilipbheda, 8 years ago)

Coding Standard Improvement

  • wp-admin/js/theme-plugin-editor.js

     
    7373                        }
    7474                        return undefined;
    7575                } );
     76
     77                $( document ).on( 'keyup', '#plugin-files-search, #theme-files-search', component._searchFile );
    7678        };
    7779
    7880        /**
     81         * Search file.
     82         *
     83         * @since 4.9.2
     84         * @returns {void}
     85         */
     86        component._searchFile = function() {
     87                var parent      = $( '#templateside' );
     88                var directories = parent.find( 'ul ul li' );
     89                var files       = parent.find( 'ul ul li a' );
     90
     91                // Expand all directories.
     92                directories.attr( 'aria-expanded', true );
     93
     94                // Hide Directories. Becuase, Below we show those directories
     95                // which have search term in the file name.
     96                directories.hide();
     97
     98                // Search file and ONLY show these directories which "contain" the file name.
     99                var rex = new RegExp( $( this ).val(), 'i' );
     100                files.filter( function() {
     101                        var file_name = $.trim( $( this ).text() ) || '';
     102                        return rex.test( file_name );
     103                } ).parents( 'li' ).show();
     104        };
     105       
     106        /**
    79107         * Set up and display the warning modal.
    80108         *
    81109         * @since 4.9.0
  • wp-admin/plugin-editor.php

     
    239239
    240240<div id="templateside">
    241241        <h2 id="plugin-files-label"><?php _e( 'Plugin Files' ); ?></h2>
     242        <input id="plugin-files-search" type="text" placeholder="<?php _e( 'Search file..' ); ?>">
    242243
    243244        <?php
    244245        $plugin_editable_files = array();
  • wp-admin/theme-editor.php

     
    243243?>
    244244<div id="templateside">
    245245        <h2 id="theme-files-label"><?php _e( 'Theme Files' ); ?></h2>
     246        <input id="theme-files-search" type="text" placeholder="<?php _e( 'Search file..' ); ?>">
    246247        <ul role="tree" aria-labelledby="theme-files-label">
    247248                <?php if ( ( $has_templates || $theme->parent() ) && $theme->parent() ) : ?>
    248249                        <li class="howto">