Changeset 27403
- Timestamp:
- 03/05/2014 03:53:19 AM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/edit.css
r27378 r27403 629 629 left: 0; 630 630 right: 0; 631 -webkit-transform: translateY( -50% ); 632 -ms-transform: translateY( -50% ); 631 633 transform: translateY( -50% ); 632 634 font-size: 40px; -
trunk/src/wp-admin/css/media.css
r27401 r27403 236 236 background-color: #fff; 237 237 width: 600px; 238 max-width: 100%;239 238 overflow: hidden; 240 239 margin-left: -300px; 241 240 position: fixed; 242 241 top: 30px; 242 bottom: 30px; 243 243 left: 50%; 244 244 z-index: 160000; … … 246 246 247 247 .find-box-head { 248 cursor: move;249 248 background: #fcfcfc; 250 249 border-bottom: 1px solid #dfdfdf; 251 height: 40px;250 height: 56px; 252 251 font-size: 22px; 253 252 font-weight: 600; 254 line-height: 40px;253 line-height: 56px; 255 254 padding: 0 40px 0 16px; 256 overflow: hidden; 255 position: absolute; 256 top: 0; 257 left: 0; 258 right: 0; 257 259 } 258 260 … … 261 263 padding: 16px; 262 264 background-color: #fff; 263 max-height: 300px; 265 position: absolute; 266 top: 57px; 267 bottom: 57px; 264 268 overflow-y: scroll; 269 width: 100%; 270 -webkit-box-sizing: border-box; 271 -moz-box-sizing: border-box; 272 box-sizing: border-box; 265 273 } 266 274 … … 273 281 left: 125px; 274 282 position: absolute; 275 top: 9px;283 top: 18px; 276 284 } 277 285 … … 287 295 } 288 296 289 .found-radio { 297 .widefat .found-radio { 298 padding-right: 0; 290 299 width: 16px; 291 300 } … … 316 325 317 326 .find-box-buttons { 318 padding: 6px 16px;327 padding: 14px 16px; 319 328 background: #fcfcfc; 320 329 border-top: 1px solid #dfdfdf; 321 }322 323 .find-box #resize-se {324 330 position: absolute; 325 right: 1px; 326 bottom: 1px; 331 bottom: 0; 332 left: 0; 333 right: 0; 334 } 335 336 @media screen and ( max-width: 660px ) { 337 338 .find-box { 339 top: 0; 340 bottom: 0; 341 left: 0; 342 right: 0; 343 margin: 0; 344 width: 100%; 345 } 346 347 .find-box-inside { 348 bottom: 69px; 349 } 327 350 } 328 351 -
trunk/src/wp-admin/includes/ajax-actions.php
r27401 r27403 1466 1466 $html .= '</tbody></table>'; 1467 1467 1468 $x = new WP_Ajax_Response(); 1469 $x->add( array( 1470 'data' => $html 1471 )); 1472 $x->send(); 1468 wp_send_json_success( $html ); 1473 1469 } 1474 1470 -
trunk/src/wp-admin/js/media.js
r27401 r27403 1 /* global ajaxurl, wpAjax*/1 /* global ajaxurl, attachMediaBoxL10n */ 2 2 3 3 var findPosts; 4 ( function($){4 ( function( $ ){ 5 5 findPosts = { 6 open : function(af_name, af_val) { 7 var st = document.documentElement.scrollTop || $(document).scrollTop(), 8 overlay = $( '.ui-find-overlay' ); 6 open: function( af_name, af_val ) { 7 var overlay = $( '.ui-find-overlay' ); 9 8 10 9 if ( overlay.length === 0 ) { … … 16 15 17 16 if ( af_name && af_val ) { 18 $( '#affected').attr('name', af_name).val(af_val);17 $( '#affected' ).attr( 'name', af_name ).val( af_val ); 19 18 } 20 $('#find-posts').show().draggable({21 handle: '#find-posts-head'22 });23 19 24 $('.find-box-inside').css({ 25 'max-height': $( window ).height() - ( ( 30 + 40 + 1 + 16 ) * 2 ) + 'px' 26 }); 20 $( '#find-posts' ).show(); 27 21 28 $('#find-posts-input').focus().keyup(function(e){ 29 if (e.which == 27) { findPosts.close(); } // close on Escape 22 $('#find-posts-input').focus().keyup( function( event ){ 23 if ( event.which == 27 ) { 24 findPosts.close(); 25 } // close on Escape 30 26 }); 31 27 … … 36 32 }, 37 33 38 close 34 close: function() { 39 35 $('#find-posts-response').html(''); 40 $('#find-posts'). draggable('destroy').hide();36 $('#find-posts').hide(); 41 37 $( '.ui-find-overlay' ).hide(); 42 38 }, 43 39 44 overlay 40 overlay: function() { 45 41 $( '.ui-find-overlay' ).on( 'click', function () { 46 42 findPosts.close(); … … 48 44 }, 49 45 50 send 46 send: function() { 51 47 var post = { 52 ps: $( '#find-posts-input').val(),48 ps: $( '#find-posts-input' ).val(), 53 49 action: 'find_posts', 54 50 _ajax_nonce: $('#_ajax_nonce').val() … … 58 54 spinner.show(); 59 55 60 $.ajax({ 61 type : 'POST', 62 url : ajaxurl, 63 data : post, 64 success : function(x) { findPosts.show(x); spinner.hide(); }, 65 error : function(r) { findPosts.error(r); spinner.hide(); } 56 $.ajax( ajaxurl, { 57 type: 'POST', 58 data: post, 59 dataType: 'json' 60 }).always( function() { 61 spinner.hide(); 62 }).done( function( x ) { 63 if ( ! x.success ) { 64 $( '#find-posts-response' ).text( attachMediaBoxL10n.error ); 65 } 66 67 $( '#find-posts-response' ).html( x.data ); 68 }).fail( function() { 69 $( '#find-posts-response' ).text( attachMediaBoxL10n.error ); 66 70 }); 67 },68 69 show : function(x) {70 71 if ( typeof(x) == 'string' ) {72 this.error({'responseText': x});73 return;74 }75 76 var r = wpAjax.parseAjaxResponse(x);77 78 if ( r.errors ) {79 this.error({'responseText': wpAjax.broken});80 }81 r = r.responses[0];82 $('#find-posts-response').html(r.data);83 84 // Enable whole row to be clicked85 $( '.found-posts td' ).on( 'click', function () {86 $( this ).parent().find( '.found-radio input' ).prop( 'checked', true );87 });88 },89 90 error : function(r) {91 var er = r.statusText;92 93 if ( r.responseText ) {94 er = r.responseText.replace( /<.[^<>]*?>/g, '' );95 }96 if ( er ) {97 $('#find-posts-response').html(er);98 }99 71 } 100 72 }; 101 73 102 $( document).ready(function() {103 $( '#find-posts-submit').click(function(e) {104 if ( '' === $('#find-posts-response').html())105 e .preventDefault();74 $( document ).ready( function() { 75 $( '#find-posts-submit' ).click( function( event ) { 76 if ( ! $( '#find-posts-response input[type="radio"]:checked' ).length ) 77 event.preventDefault(); 106 78 }); 107 79 $( '#find-posts .find-box-search :input' ).keypress( function( event ) { … … 110 82 return false; 111 83 } 112 } 84 }); 113 85 $( '#find-posts-search' ).click( findPosts.send ); 114 86 $( '#find-posts-close' ).click( findPosts.close ); 115 $( '#doaction, #doaction2').click(function(e){116 $( 'select[name^="action"]').each(function(){117 if ( $(this).val() == 'attach' ) {118 e .preventDefault();87 $( '#doaction, #doaction2' ).click( function( event ) { 88 $( 'select[name^="action"]' ).each( function() { 89 if ( $(this).val() === 'attach' ) { 90 event.preventDefault(); 119 91 findPosts.open(); 120 92 } 121 93 }); 122 94 }); 123 }); 124 $(window).resize(function() {125 $( '.find-box-inside').css({126 'max-height': $( window ).height() - ( ( 30 + 40 + 1 + 16 ) * 2 ) + 'px'95 96 // Enable whole row to be clicked 97 $( '.find-box-inside' ).on( 'click', 'tr', function() { 98 $( this ).find( '.found-radio input' ).prop( 'checked', true ); 127 99 }); 128 100 }); 129 })( jQuery);101 })( jQuery ); -
trunk/src/wp-admin/upload.php
r27401 r27403 142 142 $parent_file = 'upload.php'; 143 143 144 wp_enqueue_script( 'wp-ajax-response' );145 wp_enqueue_script( 'jquery-ui-draggable' );146 144 wp_enqueue_script( 'media' ); 147 148 add_action( 'admin_print_footer_scripts', 'find_posts_div' );149 145 150 146 add_screen_option( 'per_page', array('label' => _x( 'Media items', 'items per page (screen options)' )) ); … … 241 237 <?php $wp_list_table->display(); ?> 242 238 239 <div id="ajax-response"></div> 240 <?php find_posts_div(); ?> 243 241 </form> 244 242 </div> 245 243 246 <div id="ajax-response"></div>247 248 244 <?php 249 245 include( ABSPATH . 'wp-admin/admin-footer.php' ); -
trunk/src/wp-includes/script-loader.php
r27389 r27403 494 494 $scripts->add( 'list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js" ); 495 495 496 $scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery-ui-draggable' ), false, 1 ); 496 $scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery' ), false, 1 ); 497 did_action( 'init' ) && $scripts->localize( 'media', 'attachMediaBoxL10n', array( 498 'error' => __( 'An error has occured. Please reload the page and try again.' ) 499 )); 497 500 498 501 $scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array('jquery', 'json2', 'imgareaselect'), false, 1 );
Note: See TracChangeset
for help on using the changeset viewer.