Ticket #26952: 26952.4.patch
File 26952.4.patch, 7.3 KB (added by , 11 years ago) |
---|
-
src/wp-admin/css/media.css
235 235 .find-box { 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; 245 245 } 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 259 261 .find-box-inside { 260 262 overflow: auto; 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; 265 269 } 266 270 … … 272 276 float: none; 273 277 left: 125px; 274 278 position: absolute; 275 top: 9px;279 top: 18px; 276 280 } 277 281 278 282 #find-posts-input, … … 286 290 margin: 0 4px 0 0; 287 291 } 288 292 289 .found-radio { 293 .widefat .found-radio { 294 padding-right: 0; 290 295 width: 16px; 291 296 } 292 297 … … 315 320 } 316 321 317 322 .find-box-buttons { 318 padding: 6px 16px;323 padding: 14px 16px; 319 324 background: #fcfcfc; 320 325 border-top: 1px solid #dfdfdf; 326 position: absolute; 327 bottom: 0; 328 left: 0; 329 right: 0; 321 330 } 322 331 323 332 .find-box #resize-se { … … 326 335 bottom: 1px; 327 336 } 328 337 338 @media screen and ( max-width: 660px ) { 339 340 .find-box { 341 top: 0; 342 bottom: 0; 343 left: 0; 344 right: 0; 345 margin: 0; 346 width: 100%; 347 } 348 349 .find-box-inside { 350 bottom: 69px; 351 } 352 353 } 354 329 355 .ui-find-overlay { 330 356 position: fixed; 331 357 top: 0; -
src/wp-admin/js/media.js
1 1 /* global ajaxurl, wpAjax */ 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 ) { 11 10 $( 'body' ).append( '<div class="ui-find-overlay"></div>' ); … … 15 14 overlay.show(); 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 32 28 // Pull some results up by default … … 35 31 return false; 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(); 47 43 }); 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() 55 51 }, … … 58 54 spinner.show(); 59 55 60 56 $.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(); } 57 type: 'POST', 58 url: ajaxurl, 59 data: post, 60 success: function( x ) { 61 findPosts.show( x ); 62 spinner.hide(); 63 }, 64 error: function( r ) { 65 findPosts.error( r ); 66 spinner.hide(); 67 } 66 68 }); 67 69 }, 68 70 69 show : function(x) {71 show: function( x ) { 70 72 71 if ( typeof( x) == 'string' ) {72 this.error({ 'responseText': x});73 if ( typeof( x ) == 'string' ) { 74 this.error({ 'responseText': x }); 73 75 return; 74 76 } 75 77 76 78 var r = wpAjax.parseAjaxResponse(x); 77 79 78 80 if ( r.errors ) { 79 this.error({ 'responseText': wpAjax.broken});81 this.error({ 'responseText': wpAjax.broken }); 80 82 } 81 83 r = r.responses[0]; 82 $( '#find-posts-response').html(r.data);84 $( '#find-posts-response' ).html( r.data ); 83 85 84 86 // Enable whole row to be clicked 85 87 $( '.found-posts td' ).on( 'click', function () { … … 87 89 }); 88 90 }, 89 91 90 error : function(r) {92 error: function( r ) { 91 93 var er = r.statusText; 92 94 93 95 if ( r.responseText ) { 94 96 er = r.responseText.replace( /<.[^<>]*?>/g, '' ); 95 97 } 96 98 if ( er ) { 97 $( '#find-posts-response').html(er);99 $( '#find-posts-response' ).html( er ); 98 100 } 99 101 } 100 102 }; 101 103 102 $( document).ready(function() {103 $( '#find-posts-submit').click(function(e) {104 if ( '' === $( '#find-posts-response').html() )105 e .preventDefault();104 $( document ).ready( function() { 105 $( '#find-posts-submit' ).click( function( event ) { 106 if ( '' === $( '#find-posts-response' ).html() ) 107 event.preventDefault(); 106 108 }); 107 109 $( '#find-posts .find-box-search :input' ).keypress( function( event ) { 108 110 if ( 13 == event.which ) { 109 111 findPosts.send(); 110 112 return false; 111 113 } 112 } 114 }); 113 115 $( '#find-posts-search' ).click( findPosts.send ); 114 116 $( '#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();117 $( '#doaction, #doaction2' ).click( function( event ) { 118 $( 'select[name^="action"]' ).each( function() { 119 if ( $(this).val() === 'attach' ) { 120 event.preventDefault(); 119 121 findPosts.open(); 120 122 } 121 123 }); 122 124 }); 123 125 }); 124 $(window).resize(function() { 125 $('.find-box-inside').css({ 126 'max-height': $( window ).height() - ( ( 30 + 40 + 1 + 16 ) * 2 ) + 'px' 127 }); 128 }); 129 })(jQuery); 126 })( jQuery ); -
src/wp-admin/upload.php
142 142 $parent_file = 'upload.php'; 143 143 144 144 wp_enqueue_script( 'wp-ajax-response' ); 145 wp_enqueue_script( 'jquery-ui-draggable' );146 145 wp_enqueue_script( 'media' ); 147 146 148 147 add_action( 'admin_print_footer_scripts', 'find_posts_div' ); -
src/wp-includes/script-loader.php
493 493 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 497 498 498 $scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array('jquery', 'json2', 'imgareaselect'), false, 1 ); 499 499 did_action( 'init' ) && $scripts->localize( 'image-edit', 'imageEditL10n', array(