Ticket #31875: 31875.patch
File 31875.patch, 6.0 KB (added by , 10 years ago) |
---|
-
src/wp-admin/css/press-this.css
1363 1363 margin: 0 auto; 1364 1364 } 1365 1365 1366 .spinner { 1367 height: 20px; 1368 width: 20px; 1369 display: inline-block; 1370 visibility: hidden; 1371 background: url(../images/spinner.gif) no-repeat center; 1372 -webkit-background-size: 20px 20px; 1373 background-size: 20px 20px; 1374 opacity: 0.7; 1375 filter: alpha(opacity=70); 1376 line-height: 30px; 1377 vertical-align: baseline; 1378 } 1379 1380 @media print, 1381 (-webkit-min-device-pixel-ratio: 1.25), 1382 (min-resolution: 120dpi) { 1383 1384 .spinner { 1385 background-image: url(../images/spinner-2x.gif); 1386 } 1387 } 1388 1389 .spinner.is-visible { 1390 visibility: visible; 1391 } 1392 1366 1393 /* Make the text inside the editor textarea white. Prevents a "flash" on loading the page */ 1367 1394 #pressthis { 1368 1395 color: #fff; -
src/wp-admin/includes/class-wp-press-this.php
148 148 } 149 149 150 150 if ( 'publish' === get_post_status( $post_id ) ) { 151 /** 152 * Filter the URL to redirect to when Press This saves. 153 * 154 * @since 4.2.0 155 * 156 * @param string $url Redirect URL. If `$status` is 'publish', this will be the post permalink. 157 * Otherwise, the post edit URL will be used. 158 * @param int $post_id Post ID. 159 * @param string $status Post status. 160 */ 161 $redirect = apply_filters( 'press_this_save_redirect', get_post_permalink( $post_id ), $post_id, $post['post_status'] ); 151 $redirect = get_post_permalink( $post_id ); 162 152 } else { 163 /** This filter is documented in wp-admin/includes/class-wp-press-this.php */ 164 $redirect = apply_filters( 'press_this_save_redirect', get_edit_post_link( $post_id, 'raw' ), $post_id, $post['post_status'] ); 153 $redirect = false; 165 154 } 166 155 167 wp_send_json_success( array( 'redirect' => $redirect ) ); 156 /** 157 * Filter the URL to redirect to when Press This saves. 158 * 159 * @since 4.2.0 160 * 161 * @param string $url Redirect URL. If `$status` is 'publish', this will be the post permalink. 162 * Otherwise, the post edit URL will be used. 163 * @param int $post_id Post ID. 164 * @param string $status Post status. 165 */ 166 $redirect = apply_filters( 'press_this_save_redirect', $redirect, $post_id, $post['post_status'] ); 167 168 if ( $redirect ) { 169 wp_send_json_success( array( 'redirect' => $redirect ) ); 170 } else { 171 wp_send_json_success( array( 'postSaved' => true ) ); 172 } 168 173 } 169 174 } 170 175 … … 1339 1344 </button> 1340 1345 </div> 1341 1346 <div class="post-actions"> 1347 <span class="spinner"> </span> 1342 1348 <button type="button" class="button-subtle draft-button"><?php _e( 'Save Draft' ); ?></button> 1343 1349 <button type="button" class="button-subtle preview-button"><?php _e( 'Preview' ); ?></button> 1344 1350 <button type="button" class="button-primary publish-button"><?php echo ( current_user_can( 'publish_posts' ) ) ? __( 'Publish' ) : __( 'Submit for Review' ); ?></button> -
src/wp-admin/js/press-this.js
101 101 * Show UX spinner 102 102 */ 103 103 function showSpinner() { 104 $( ' #spinner' ).addClass( 'show' );104 $( '.spinner' ).addClass( 'is-visible' ); 105 105 $( '.post-actions button' ).each( function() { 106 106 $( this ).attr( 'disabled', 'disabled' ); 107 107 } ); … … 111 111 * Hide UX spinner 112 112 */ 113 113 function hideSpinner() { 114 $( ' #spinner' ).removeClass( 'show' );114 $( '.spinner' ).removeClass( 'is-visible' ); 115 115 $( '.post-actions button' ).each( function() { 116 116 $( this ).removeAttr( 'disabled' ); 117 117 } ); … … 181 181 $.ajax( { 182 182 type: 'post', 183 183 url: window.ajaxurl, 184 data: data, 185 success: function( response ) { 186 if ( ! response.success ) { 187 renderError( response.data.errorMessage ); 188 hideSpinner(); 189 } else if ( response.data.redirect ) { 190 if ( window.opener && settings.redirInParent ) { 191 try { 192 window.opener.location.href = response.data.redirect; 193 } catch( er ) {} 184 data: data 185 }).always( function() { 186 hideSpinner(); 187 }).done( function( response ) { 188 if ( ! response.success ) { 189 renderError( response.data.errorMessage ); 190 } else if ( response.data.redirect ) { 191 if ( window.opener && settings.redirInParent ) { 192 try { 193 window.opener.location.href = response.data.redirect; 194 } catch( er ) {} 194 195 195 window.self.close(); 196 } else { 197 window.location.href = response.data.redirect; 198 } 196 window.self.close(); 197 } else { 198 window.location.href = response.data.redirect; 199 199 } 200 } else if ( response.data.postSaved ) { 201 // show "success" message? 200 202 } 201 } ); 203 }).fail( function() { 204 renderError( __( 'serverError' ) ); 205 }); 202 206 } 203 207 204 208 /** -
src/wp-includes/script-loader.php
478 478 $scripts->add( 'press-this', "/wp-admin/js/press-this$suffix.js", array( 'jquery', 'tags-box' ), false, 1 ); 479 479 did_action( 'init' ) && $scripts->localize( 'press-this', 'pressThisL10n', array( 480 480 'newPost' => __( 'Title' ), 481 ' unexpectedError' => __( 'Sorry, but an unexpected error occurred.' ),481 'serverError' => __( 'Connection lost or the server is busy. Please try again later.' ), 482 482 'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ), 483 483 /* translators: %d: nth embed found in a post */ 484 484 'suggestedEmbedAlt' => __( 'Suggested embed #%d' ),