Changeset 32062
- Timestamp:
- 04/07/2015 03:08:38 AM (10 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/plugin-install.php
r31990 r32062 562 562 case 'update_available': 563 563 if ( $status['url'] ) { 564 echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Update Now' ) .'</a>';564 echo '<a data-slug="' . esc_attr( $api->slug ) . '" id="plugin_update_from_iframe" class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Update Now' ) .'</a>'; 565 565 } 566 566 break; -
trunk/src/wp-admin/js/updates.js
r32061 r32062 1 /* global tb_remove */ 1 2 window.wp = window.wp || {}; 2 3 … … 474 475 } ); 475 476 477 // 478 $( '#plugin_update_from_iframe' ).on( 'click' , function( e ) { 479 var target, data; 480 481 target = window.parent == window ? null : window.parent, 482 $.support.postMessage = !! window.postMessage; 483 484 if ( $.support.postMessage === false || target === null ) 485 return; 486 487 e.preventDefault(); 488 489 data = { 490 'action' : 'updatePlugin', 491 'slug' : $(this).data('slug') 492 }; 493 494 target.postMessage( JSON.stringify( data ), window.location.origin ); 495 }); 496 476 497 } ); 477 498 … … 488 509 message = $.parseJSON( event.data ); 489 510 490 if ( typeof message.action === 'undefined' || message.action !== 'decrementUpdateCount' ) { 491 return; 492 } 493 494 wp.updates.decrementCount( message.upgradeType ); 511 if ( typeof message.action === 'undefined' ) { 512 return; 513 } 514 515 switch (message.action){ 516 case 'decrementUpdateCount' : 517 wp.updates.decrementCount( message.upgradeType ); 518 break; 519 case 'updatePlugin' : 520 tb_remove(); 521 if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) { 522 // Return the user to the input box of the plugin's table row after closing the modal. 523 $( '#' + message.slug ).find( '.check-column input' ).focus(); 524 // trigger the update 525 $( '.plugin-update-tr[data-slug="' + message.slug + '"]' ).find( '.update-link' ).trigger( 'click' ); 526 } else if ( 'plugin-install' === pagenow ) { 527 $( '.plugin-card-' + message.slug ).find( 'h4 a' ).focus(); 528 $( '.plugin-card-' + message.slug ).find( '[data-slug="' + message.slug + '"]' ).trigger( 'click' ); 529 } 530 break; 531 } 532 533 495 534 496 535 } );
Note: See TracChangeset
for help on using the changeset viewer.