Changeset 31562
- Timestamp:
- 02/26/2015 11:00:20 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/upload.php
r31200 r31562 26 26 wp_enqueue_script( 'media' ); 27 27 28 $vars = wp_edit_attachments_query_vars(); 28 $q = $_GET; 29 // let JS handle this 30 unset( $q['s'] ); 31 $vars = wp_edit_attachments_query_vars( $q ); 29 32 $ignore = array( 'mode', 'post_type', 'post_status', 'posts_per_page' ); 30 33 foreach ( $vars as $key => $value ) { … … 68 71 require_once( ABSPATH . 'wp-admin/admin-header.php' ); 69 72 ?> 70 <div class="wrap" id="wp-media-grid" >73 <div class="wrap" id="wp-media-grid" data-search="<?php _admin_search_query() ?>"> 71 74 <h2> 72 75 <?php -
trunk/src/wp-includes/js/media/grid.js
r31494 r31562 683 683 this.bindRegionModeHandlers(); 684 684 this.render(); 685 this.bindSearchHandler(); 686 }, 687 688 /** 689 * The views must interact with form controls that are not part of a frame 690 */ 691 bindSearchHandler: function() { 692 var search = this.$( '#media-search-input' ), 693 currentSearch = this.options.container.data( 'search' ), 694 searchView = this.browserView.toolbar.get( 'search' ).$el, 695 listMode = this.$( '.view-list' ), 696 697 input = _.debounce( function (e) { 698 var val = $( e.currentTarget ).val(), 699 url = ''; 700 701 if ( val ) { 702 url += '?search=' + val; 703 } 704 this.gridRouter.navigate( this.gridRouter.baseUrl( url ) ); 705 }, 1000 ); 685 706 686 707 // Update the URL when entering search string (at most once per second) 687 $( '#media-search-input' ).on( 'input', _.debounce( function(e) { 688 var val = $( e.currentTarget ).val(), url = ''; 689 if ( val ) { 690 url += '?search=' + val; 708 search.on( 'input', _.bind( input, this ) ); 709 searchView.val( currentSearch ).trigger( 'input' ); 710 711 this.gridRouter.on( 'route:search', function () { 712 var href = window.location.href; 713 if ( href.indexOf( 'mode=' ) > -1 ) { 714 href = href.replace( /mode=[^&]+/g, 'mode=list' ); 715 } else { 716 href += href.indexOf( '?' ) > -1 ? '&mode=list' : '?mode=list'; 691 717 } 692 self.gridRouter.navigate( self.gridRouter.baseUrl( url ) ); 693 }, 1000 ) ); 718 href = href.replace( 'search=', 's=' ); 719 listMode.prop( 'href', href ); 720 } ); 694 721 }, 695 722 -
trunk/src/wp-includes/js/media/views/frame/manage.js
r31494 r31562 84 84 this.bindRegionModeHandlers(); 85 85 this.render(); 86 this.bindSearchHandler(); 87 }, 88 89 bindSearchHandler: function() { 90 var search = this.$( '#media-search-input' ), 91 currentSearch = this.options.container.data( 'search' ), 92 searchView = this.browserView.toolbar.get( 'search' ).$el, 93 listMode = this.$( '.view-list' ), 94 95 input = _.debounce( function (e) { 96 var val = $( e.currentTarget ).val(), 97 url = ''; 98 99 if ( val ) { 100 url += '?search=' + val; 101 } 102 this.gridRouter.navigate( this.gridRouter.baseUrl( url ) ); 103 }, 1000 ); 86 104 87 105 // Update the URL when entering search string (at most once per second) 88 $( '#media-search-input' ).on( 'input', _.debounce( function(e) { 89 var val = $( e.currentTarget ).val(), url = ''; 90 if ( val ) { 91 url += '?search=' + val; 106 search.on( 'input', _.bind( input, this ) ); 107 searchView.val( currentSearch ).trigger( 'input' ); 108 109 this.gridRouter.on( 'route:search', function () { 110 var href = window.location.href; 111 if ( href.indexOf( 'mode=' ) > -1 ) { 112 href = href.replace( /mode=[^&]+/g, 'mode=list' ); 113 } else { 114 href += href.indexOf( '?' ) > -1 ? '&mode=list' : '?mode=list'; 92 115 } 93 self.gridRouter.navigate( self.gridRouter.baseUrl( url ) ); 94 }, 1000 ) ); 116 href = href.replace( 'search=', 's=' ); 117 listMode.prop( 'href', href ); 118 } ); 95 119 }, 96 120
Note: See TracChangeset
for help on using the changeset viewer.