<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[27403] trunk/src: Restyles the modal for attaching media to posts, take II (also some autoprefixer and imagemin).</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/27403">27403</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2014-03-05 03:53:19 +0000 (Wed, 05 Mar 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Restyles the modal for attaching media to posts, take II (also some autoprefixer and imagemin). Props avryl, see <a href="http://core.trac.wordpress.org/ticket/26952">#26952</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincsseditcss">trunk/src/wp-admin/css/edit.css</a></li>
<li><a href="#trunksrcwpadmincssmediacss">trunk/src/wp-admin/css/media.css</a></li>
<li><a href="#trunksrcwpadminincludesajaxactionsphp">trunk/src/wp-admin/includes/ajax-actions.php</a></li>
<li><a href="#trunksrcwpadminjsmediajs">trunk/src/wp-admin/js/media.js</a></li>
<li><a href="#trunksrcwpadminuploadphp">trunk/src/wp-admin/upload.php</a></li>
<li><a href="#trunksrcwpincludesjstinymceskinswordpressimagesplaylistaudiopng">trunk/src/wp-includes/js/tinymce/skins/wordpress/images/playlist-audio.png</a></li>
<li><a href="#trunksrcwpincludesjstinymceskinswordpressimagesplaylistvideopng">trunk/src/wp-includes/js/tinymce/skins/wordpress/images/playlist-video.png</a></li>
<li><a href="#trunksrcwpincludesscriptloaderphp">trunk/src/wp-includes/script-loader.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadmincsseditcss"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/css/edit.css (27402 => 27403)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/css/edit.css 2014-03-05 01:12:39 UTC (rev 27402)
+++ trunk/src/wp-admin/css/edit.css 2014-03-05 03:53:19 UTC (rev 27403)
</span><span class="lines">@@ -628,6 +628,8 @@
</span><span class="cx"> top: 50%;
</span><span class="cx"> left: 0;
</span><span class="cx"> right: 0;
</span><ins>+ -webkit-transform: translateY( -50% );
+ -ms-transform: translateY( -50% );
</ins><span class="cx"> transform: translateY( -50% );
</span><span class="cx"> font-size: 40px;
</span><span class="cx"> color: #fff;
</span></span></pre></div>
<a id="trunksrcwpadmincssmediacss"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/css/media.css (27402 => 27403)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/css/media.css 2014-03-05 01:12:39 UTC (rev 27402)
+++ trunk/src/wp-admin/css/media.css 2014-03-05 03:53:19 UTC (rev 27403)
</span><span class="lines">@@ -235,33 +235,41 @@
</span><span class="cx"> .find-box {
</span><span class="cx"> background-color: #fff;
</span><span class="cx"> width: 600px;
</span><del>- max-width: 100%;
</del><span class="cx"> overflow: hidden;
</span><span class="cx"> margin-left: -300px;
</span><span class="cx"> position: fixed;
</span><span class="cx"> top: 30px;
</span><ins>+ bottom: 30px;
</ins><span class="cx"> left: 50%;
</span><span class="cx"> z-index: 160000;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .find-box-head {
</span><del>- cursor: move;
</del><span class="cx"> background: #fcfcfc;
</span><span class="cx"> border-bottom: 1px solid #dfdfdf;
</span><del>- height: 40px;
</del><ins>+ height: 56px;
</ins><span class="cx"> font-size: 22px;
</span><span class="cx"> font-weight: 600;
</span><del>- line-height: 40px;
</del><ins>+ line-height: 56px;
</ins><span class="cx"> padding: 0 40px 0 16px;
</span><del>- overflow: hidden;
</del><ins>+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .find-box-inside {
</span><span class="cx"> overflow: auto;
</span><span class="cx"> padding: 16px;
</span><span class="cx"> background-color: #fff;
</span><del>- max-height: 300px;
</del><ins>+ position: absolute;
+ top: 57px;
+ bottom: 57px;
</ins><span class="cx"> overflow-y: scroll;
</span><ins>+ width: 100%;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .find-box-search {
</span><span class="lines">@@ -272,7 +280,7 @@
</span><span class="cx"> float: none;
</span><span class="cx"> left: 125px;
</span><span class="cx"> position: absolute;
</span><del>- top: 9px;
</del><ins>+ top: 18px;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #find-posts-input,
</span><span class="lines">@@ -286,7 +294,8 @@
</span><span class="cx"> margin: 0 4px 0 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.found-radio {
</del><ins>+.widefat .found-radio {
+ padding-right: 0;
</ins><span class="cx"> width: 16px;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -315,15 +324,29 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .find-box-buttons {
</span><del>- padding: 6px 16px;
</del><ins>+ padding: 14px 16px;
</ins><span class="cx"> background: #fcfcfc;
</span><span class="cx"> border-top: 1px solid #dfdfdf;
</span><ins>+ position: absolute;
+ bottom: 0;
+ left: 0;
+ right: 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-.find-box #resize-se {
- position: absolute;
- right: 1px;
- bottom: 1px;
</del><ins>+@media screen and ( max-width: 660px ) {
+
+ .find-box {
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ margin: 0;
+ width: 100%;
+ }
+
+ .find-box-inside {
+ bottom: 69px;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .ui-find-overlay {
</span></span></pre></div>
<a id="trunksrcwpadminincludesajaxactionsphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/ajax-actions.php (27402 => 27403)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/ajax-actions.php 2014-03-05 01:12:39 UTC (rev 27402)
+++ trunk/src/wp-admin/includes/ajax-actions.php 2014-03-05 03:53:19 UTC (rev 27403)
</span><span class="lines">@@ -1465,11 +1465,7 @@
</span><span class="cx">
</span><span class="cx"> $html .= '</tbody></table>';
</span><span class="cx">
</span><del>- $x = new WP_Ajax_Response();
- $x->add( array(
- 'data' => $html
- ));
- $x->send();
</del><ins>+ wp_send_json_success( $html );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_widgets_order() {
</span></span></pre></div>
<a id="trunksrcwpadminjsmediajs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/js/media.js (27402 => 27403)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/media.js 2014-03-05 01:12:39 UTC (rev 27402)
+++ trunk/src/wp-admin/js/media.js 2014-03-05 03:53:19 UTC (rev 27403)
</span><span class="lines">@@ -1,11 +1,10 @@
</span><del>-/* global ajaxurl, wpAjax */
</del><ins>+/* global ajaxurl, attachMediaBoxL10n */
</ins><span class="cx">
</span><span class="cx"> var findPosts;
</span><del>-(function($){
</del><ins>+( function( $ ){
</ins><span class="cx"> findPosts = {
</span><del>- open : function(af_name, af_val) {
- var st = document.documentElement.scrollTop || $(document).scrollTop(),
- overlay = $( '.ui-find-overlay' );
</del><ins>+ open: function( af_name, af_val ) {
+ var overlay = $( '.ui-find-overlay' );
</ins><span class="cx">
</span><span class="cx"> if ( overlay.length === 0 ) {
</span><span class="cx"> $( 'body' ).append( '<div class="ui-find-overlay"></div>' );
</span><span class="lines">@@ -15,18 +14,15 @@
</span><span class="cx"> overlay.show();
</span><span class="cx">
</span><span class="cx"> if ( af_name && af_val ) {
</span><del>- $('#affected').attr('name', af_name).val(af_val);
</del><ins>+ $( '#affected' ).attr( 'name', af_name ).val( af_val );
</ins><span class="cx"> }
</span><del>- $('#find-posts').show().draggable({
- handle: '#find-posts-head'
- });
</del><span class="cx">
</span><del>- $('.find-box-inside').css({
- 'max-height': $( window ).height() - ( ( 30 + 40 + 1 + 16 ) * 2 ) + 'px'
- });
</del><ins>+ $( '#find-posts' ).show();
</ins><span class="cx">
</span><del>- $('#find-posts-input').focus().keyup(function(e){
- if (e.which == 27) { findPosts.close(); } // close on Escape
</del><ins>+ $('#find-posts-input').focus().keyup( function( event ){
+ if ( event.which == 27 ) {
+ findPosts.close();
+ } // close on Escape
</ins><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> // Pull some results up by default
</span><span class="lines">@@ -35,21 +31,21 @@
</span><span class="cx"> return false;
</span><span class="cx"> },
</span><span class="cx">
</span><del>- close : function() {
</del><ins>+ close: function() {
</ins><span class="cx"> $('#find-posts-response').html('');
</span><del>- $('#find-posts').draggable('destroy').hide();
</del><ins>+ $('#find-posts').hide();
</ins><span class="cx"> $( '.ui-find-overlay' ).hide();
</span><span class="cx"> },
</span><span class="cx">
</span><del>- overlay : function() {
</del><ins>+ overlay: function() {
</ins><span class="cx"> $( '.ui-find-overlay' ).on( 'click', function () {
</span><span class="cx"> findPosts.close();
</span><span class="cx"> });
</span><span class="cx"> },
</span><span class="cx">
</span><del>- send : function() {
</del><ins>+ send: function() {
</ins><span class="cx"> var post = {
</span><del>- ps: $('#find-posts-input').val(),
</del><ins>+ ps: $( '#find-posts-input' ).val(),
</ins><span class="cx"> action: 'find_posts',
</span><span class="cx"> _ajax_nonce: $('#_ajax_nonce').val()
</span><span class="cx"> },
</span><span class="lines">@@ -57,73 +53,49 @@
</span><span class="cx">
</span><span class="cx"> spinner.show();
</span><span class="cx">
</span><del>- $.ajax({
- type : 'POST',
- url : ajaxurl,
- data : post,
- success : function(x) { findPosts.show(x); spinner.hide(); },
- error : function(r) { findPosts.error(r); spinner.hide(); }
- });
- },
</del><ins>+ $.ajax( ajaxurl, {
+ type: 'POST',
+ data: post,
+ dataType: 'json'
+ }).always( function() {
+ spinner.hide();
+ }).done( function( x ) {
+ if ( ! x.success ) {
+ $( '#find-posts-response' ).text( attachMediaBoxL10n.error );
+ }
</ins><span class="cx">
</span><del>- show : function(x) {
-
- if ( typeof(x) == 'string' ) {
- this.error({'responseText': x});
- return;
- }
-
- var r = wpAjax.parseAjaxResponse(x);
-
- if ( r.errors ) {
- this.error({'responseText': wpAjax.broken});
- }
- r = r.responses[0];
- $('#find-posts-response').html(r.data);
-
- // Enable whole row to be clicked
- $( '.found-posts td' ).on( 'click', function () {
- $( this ).parent().find( '.found-radio input' ).prop( 'checked', true );
</del><ins>+ $( '#find-posts-response' ).html( x.data );
+ }).fail( function() {
+ $( '#find-posts-response' ).text( attachMediaBoxL10n.error );
</ins><span class="cx"> });
</span><del>- },
-
- error : function(r) {
- var er = r.statusText;
-
- if ( r.responseText ) {
- er = r.responseText.replace( /<.[^<>]*?>/g, '' );
- }
- if ( er ) {
- $('#find-posts-response').html(er);
- }
</del><span class="cx"> }
</span><span class="cx"> };
</span><span class="cx">
</span><del>- $(document).ready(function() {
- $('#find-posts-submit').click(function(e) {
- if ( '' === $('#find-posts-response').html() )
- e.preventDefault();
</del><ins>+ $( document ).ready( function() {
+ $( '#find-posts-submit' ).click( function( event ) {
+ if ( ! $( '#find-posts-response input[type="radio"]:checked' ).length )
+ event.preventDefault();
</ins><span class="cx"> });
</span><span class="cx"> $( '#find-posts .find-box-search :input' ).keypress( function( event ) {
</span><span class="cx"> if ( 13 == event.which ) {
</span><span class="cx"> findPosts.send();
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><del>- } );
</del><ins>+ });
</ins><span class="cx"> $( '#find-posts-search' ).click( findPosts.send );
</span><span class="cx"> $( '#find-posts-close' ).click( findPosts.close );
</span><del>- $('#doaction, #doaction2').click(function(e){
- $('select[name^="action"]').each(function(){
- if ( $(this).val() == 'attach' ) {
- e.preventDefault();
</del><ins>+ $( '#doaction, #doaction2' ).click( function( event ) {
+ $( 'select[name^="action"]' ).each( function() {
+ if ( $(this).val() === 'attach' ) {
+ event.preventDefault();
</ins><span class="cx"> findPosts.open();
</span><span class="cx"> }
</span><span class="cx"> });
</span><span class="cx"> });
</span><del>- });
- $(window).resize(function() {
- $('.find-box-inside').css({
- 'max-height': $( window ).height() - ( ( 30 + 40 + 1 + 16 ) * 2 ) + 'px'
</del><ins>+
+ // Enable whole row to be clicked
+ $( '.find-box-inside' ).on( 'click', 'tr', function() {
+ $( this ).find( '.found-radio input' ).prop( 'checked', true );
</ins><span class="cx"> });
</span><span class="cx"> });
</span><del>-})(jQuery);
</del><ins>+})( jQuery );
</ins></span></pre></div>
<a id="trunksrcwpadminuploadphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/upload.php (27402 => 27403)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/upload.php 2014-03-05 01:12:39 UTC (rev 27402)
+++ trunk/src/wp-admin/upload.php 2014-03-05 03:53:19 UTC (rev 27403)
</span><span class="lines">@@ -141,12 +141,8 @@
</span><span class="cx"> $title = __('Media Library');
</span><span class="cx"> $parent_file = 'upload.php';
</span><span class="cx">
</span><del>-wp_enqueue_script( 'wp-ajax-response' );
-wp_enqueue_script( 'jquery-ui-draggable' );
</del><span class="cx"> wp_enqueue_script( 'media' );
</span><span class="cx">
</span><del>-add_action( 'admin_print_footer_scripts', 'find_posts_div' );
-
</del><span class="cx"> add_screen_option( 'per_page', array('label' => _x( 'Media items', 'items per page (screen options)' )) );
</span><span class="cx">
</span><span class="cx"> get_current_screen()->add_help_tab( array(
</span><span class="lines">@@ -240,10 +236,10 @@
</span><span class="cx">
</span><span class="cx"> <?php $wp_list_table->display(); ?>
</span><span class="cx">
</span><ins>+<div id="ajax-response"></div>
+<?php find_posts_div(); ?>
</ins><span class="cx"> </form>
</span><span class="cx"> </div>
</span><span class="cx">
</span><del>-<div id="ajax-response"></div>
-
</del><span class="cx"> <?php
</span><span class="cx"> include( ABSPATH . 'wp-admin/admin-footer.php' );
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymceskinswordpressimagesplaylistaudiopng"></a>
<div class="binary"><h4>Modified: trunk/src/wp-includes/js/tinymce/skins/wordpress/images/playlist-audio.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymceskinswordpressimagesplaylistvideopng"></a>
<div class="binary"><h4>Modified: trunk/src/wp-includes/js/tinymce/skins/wordpress/images/playlist-video.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunksrcwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/script-loader.php (27402 => 27403)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/script-loader.php 2014-03-05 01:12:39 UTC (rev 27402)
+++ trunk/src/wp-includes/script-loader.php 2014-03-05 03:53:19 UTC (rev 27403)
</span><span class="lines">@@ -493,7 +493,10 @@
</span><span class="cx">
</span><span class="cx"> $scripts->add( 'list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js" );
</span><span class="cx">
</span><del>- $scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery-ui-draggable' ), false, 1 );
</del><ins>+ $scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery' ), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'media', 'attachMediaBoxL10n', array(
+ 'error' => __( 'An error has occured. Please reload the page and try again.' )
+ ));
</ins><span class="cx">
</span><span class="cx"> $scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array('jquery', 'json2', 'imgareaselect'), false, 1 );
</span><span class="cx"> did_action( 'init' ) && $scripts->localize( 'image-edit', 'imageEditL10n', array(
</span></span></pre>
</div>
</div>
</body>
</html>