Plugin Install: fix edge-case where the tab=upload page can be accessed directly.
The `?tab=upload` page still exists for no-js support and for users who may access it directly (e.g. from bookmarks or history) or plugins doing the same. In this page, the "Browse plugins" link should always behave like a link. Fixes #35429. git-svn-id: https://develop.svn.wordpress.org/trunk@37681 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
18ef7d6225
commit
2aebf33f9d
|
@ -11,7 +11,9 @@ jQuery( document ).ready( function( $ ) {
|
|||
$iframeBody,
|
||||
$tabbables,
|
||||
$firstTabbable,
|
||||
$lastTabbable;
|
||||
$lastTabbable,
|
||||
uploadViewToggle = $( '.upload-view-toggle' ),
|
||||
$body = $( document.body );
|
||||
|
||||
tb_position = function() {
|
||||
var width = $( window ).width(),
|
||||
|
@ -53,7 +55,7 @@ jQuery( document ).ready( function( $ ) {
|
|||
* Custom events: when a Thickbox iframe has loaded and when the Thickbox
|
||||
* modal gets removed from the DOM.
|
||||
*/
|
||||
$( 'body' )
|
||||
$body
|
||||
.on( 'thickbox:iframe:loaded', tbWindow, function() {
|
||||
iframeLoaded();
|
||||
})
|
||||
|
@ -180,11 +182,12 @@ jQuery( document ).ready( function( $ ) {
|
|||
/*
|
||||
* When a user presses the "Upload Plugin" button, show the upload form in place
|
||||
* rather than sending them to the devoted upload plugin page.
|
||||
* @todo consider to abstract this in a generic, reusable, utility, see theme.js
|
||||
* The `?tab=upload` page still exists for no-js support and for plugins that
|
||||
* might access it directly (?). When we're in this page, let the link behave
|
||||
* like a link. Otherwise we're in the normal plugin installer pages and the
|
||||
* link should behave like a toggle button.
|
||||
*/
|
||||
var uploadViewToggle = $( '.upload-view-toggle' ),
|
||||
$body = $( document.body );
|
||||
|
||||
if ( ! uploadViewToggle.hasClass( 'upload-tab' ) ) {
|
||||
uploadViewToggle
|
||||
.attr({
|
||||
role: 'button',
|
||||
|
@ -195,4 +198,5 @@ jQuery( document ).ready( function( $ ) {
|
|||
$body.toggleClass( 'show-upload-view' );
|
||||
uploadViewToggle.attr( 'aria-expanded', $body.hasClass( 'show-upload-view' ) );
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue