Changeset 31992
- Timestamp:
- 04/03/2015 01:33:30 AM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/press-this.css
r31925 r31992 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 { -
trunk/src/wp-admin/includes/class-wp-press-this.php
r31930 r31992 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'] ); 165 } 166 167 wp_send_json_success( array( 'redirect' => $redirect ) ); 153 $redirect = false; 154 } 155 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 } … … 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> -
trunk/src/wp-admin/js/press-this.js
r31987 r31992 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' ); … … 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' ); … … 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 ) {}194 195 window.self.close(); 196 } else {197 window.location.href = response.data.redirect;198 }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 ) {} 195 196 window.self.close(); 197 } else { 198 window.location.href = response.data.redirect; 199 199 } 200 } 201 } ); 200 } else if ( response.data.postSaved ) { 201 // show "success" message? 202 } 203 }).fail( function() { 204 renderError( __( 'serverError' ) ); 205 }); 202 206 } 203 207 -
trunk/src/wp-includes/script-loader.php
r31989 r31992 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 */
Note: See TracChangeset
for help on using the changeset viewer.