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. Built from https://develop.svn.wordpress.org/trunk@37681 git-svn-id: http://core.svn.wordpress.org/trunk@37647 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d01b200e6e
commit
708b9dc229
|
@ -11,7 +11,9 @@ jQuery( document ).ready( function( $ ) {
|
||||||
$iframeBody,
|
$iframeBody,
|
||||||
$tabbables,
|
$tabbables,
|
||||||
$firstTabbable,
|
$firstTabbable,
|
||||||
$lastTabbable;
|
$lastTabbable,
|
||||||
|
uploadViewToggle = $( '.upload-view-toggle' ),
|
||||||
|
$body = $( document.body );
|
||||||
|
|
||||||
tb_position = function() {
|
tb_position = function() {
|
||||||
var width = $( window ).width(),
|
var width = $( window ).width(),
|
||||||
|
@ -53,7 +55,7 @@ jQuery( document ).ready( function( $ ) {
|
||||||
* Custom events: when a Thickbox iframe has loaded and when the Thickbox
|
* Custom events: when a Thickbox iframe has loaded and when the Thickbox
|
||||||
* modal gets removed from the DOM.
|
* modal gets removed from the DOM.
|
||||||
*/
|
*/
|
||||||
$( 'body' )
|
$body
|
||||||
.on( 'thickbox:iframe:loaded', tbWindow, function() {
|
.on( 'thickbox:iframe:loaded', tbWindow, function() {
|
||||||
iframeLoaded();
|
iframeLoaded();
|
||||||
})
|
})
|
||||||
|
@ -180,19 +182,21 @@ jQuery( document ).ready( function( $ ) {
|
||||||
/*
|
/*
|
||||||
* When a user presses the "Upload Plugin" button, show the upload form in place
|
* When a user presses the "Upload Plugin" button, show the upload form in place
|
||||||
* rather than sending them to the devoted upload plugin page.
|
* 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' ),
|
if ( ! uploadViewToggle.hasClass( 'upload-tab' ) ) {
|
||||||
$body = $( document.body );
|
uploadViewToggle
|
||||||
|
.attr({
|
||||||
uploadViewToggle
|
role: 'button',
|
||||||
.attr({
|
'aria-expanded': 'false'
|
||||||
role: 'button',
|
})
|
||||||
'aria-expanded': 'false'
|
.on( 'click', function( event ) {
|
||||||
})
|
event.preventDefault();
|
||||||
.on( 'click', function( event ) {
|
$body.toggleClass( 'show-upload-view' );
|
||||||
event.preventDefault();
|
uploadViewToggle.attr( 'aria-expanded', $body.hasClass( 'show-upload-view' ) );
|
||||||
$body.toggleClass( 'show-upload-view' );
|
});
|
||||||
uploadViewToggle.attr( 'aria-expanded', $body.hasClass( 'show-upload-view' ) );
|
}
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
var tb_position;jQuery(document).ready(function(a){function b(){var b=e.find("#TB_iframeContent");g=b.contents().find("body"),c(),i.focus(),a("#plugin-information-tabs a",g).on("click",function(){c()}),g.on("keydown",function(a){27===a.which&&tb_remove()})}function c(){var b;h=a(":tabbable",g),i=e.find("#TB_closeWindowButton"),j=h.last(),b=i.add(j),b.off("keydown.wp-plugin-details"),b.on("keydown.wp-plugin-details",function(a){d(a)})}function d(a){9===a.which&&(j[0]!==a.target||a.shiftKey?i[0]===a.target&&a.shiftKey&&(a.preventDefault(),j.focus()):(a.preventDefault(),i.focus()))}var e,f,g,h,i,j;tb_position=function(){var b=a(window).width(),c=a(window).height()-(b>792?60:20),d=b>792?772:b-20;return e=a("#TB_window"),e.length&&(e.width(d).height(c),a("#TB_iframeContent").width(d).height(c),e.css({"margin-left":"-"+parseInt(d/2,10)+"px"}),"undefined"!=typeof document.body.style.maxWidth&&e.css({top:"30px","margin-top":"0"})),a("a.thickbox").each(function(){var b=a(this).attr("href");b&&(b=b.replace(/&width=[0-9]+/g,""),b=b.replace(/&height=[0-9]+/g,""),a(this).attr("href",b+"&width="+d+"&height="+c))})},a(window).resize(function(){tb_position()}),a("body").on("thickbox:iframe:loaded",e,function(){b()}).on("thickbox:removed",function(){f.focus()}),a(".thickbox.open-plugin-details-modal").on("click",function(b){var c=a(this).data("title")?plugininstallL10n.plugin_information+" "+a(this).data("title"):plugininstallL10n.plugin_modal_label;b.preventDefault(),b.stopPropagation(),f=a(this),tb_click.call(this),e.attr({role:"dialog","aria-label":plugininstallL10n.plugin_modal_label}),e.find("#TB_iframeContent").attr("title",c)}),a("#plugin-information-tabs a").click(function(b){var c=a(this).attr("name");b.preventDefault(),a("#plugin-information-tabs a.current").removeClass("current"),a(this).addClass("current"),"description"!==c&&a(window).width()<772?a("#plugin-information-content").find(".fyi").hide():a("#plugin-information-content").find(".fyi").show(),a("#section-holder div.section").hide(),a("#section-"+c).show()});var k=a(".upload-view-toggle"),l=a(document.body);k.attr({role:"button","aria-expanded":"false"}).on("click",function(a){a.preventDefault(),l.toggleClass("show-upload-view"),k.attr("aria-expanded",l.hasClass("show-upload-view"))})});
|
var tb_position;jQuery(document).ready(function(a){function b(){var b=e.find("#TB_iframeContent");g=b.contents().find("body"),c(),i.focus(),a("#plugin-information-tabs a",g).on("click",function(){c()}),g.on("keydown",function(a){27===a.which&&tb_remove()})}function c(){var b;h=a(":tabbable",g),i=e.find("#TB_closeWindowButton"),j=h.last(),b=i.add(j),b.off("keydown.wp-plugin-details"),b.on("keydown.wp-plugin-details",function(a){d(a)})}function d(a){9===a.which&&(j[0]!==a.target||a.shiftKey?i[0]===a.target&&a.shiftKey&&(a.preventDefault(),j.focus()):(a.preventDefault(),i.focus()))}var e,f,g,h,i,j,k=a(".upload-view-toggle"),l=a(document.body);tb_position=function(){var b=a(window).width(),c=a(window).height()-(b>792?60:20),d=b>792?772:b-20;return e=a("#TB_window"),e.length&&(e.width(d).height(c),a("#TB_iframeContent").width(d).height(c),e.css({"margin-left":"-"+parseInt(d/2,10)+"px"}),"undefined"!=typeof document.body.style.maxWidth&&e.css({top:"30px","margin-top":"0"})),a("a.thickbox").each(function(){var b=a(this).attr("href");b&&(b=b.replace(/&width=[0-9]+/g,""),b=b.replace(/&height=[0-9]+/g,""),a(this).attr("href",b+"&width="+d+"&height="+c))})},a(window).resize(function(){tb_position()}),l.on("thickbox:iframe:loaded",e,function(){b()}).on("thickbox:removed",function(){f.focus()}),a(".thickbox.open-plugin-details-modal").on("click",function(b){var c=a(this).data("title")?plugininstallL10n.plugin_information+" "+a(this).data("title"):plugininstallL10n.plugin_modal_label;b.preventDefault(),b.stopPropagation(),f=a(this),tb_click.call(this),e.attr({role:"dialog","aria-label":plugininstallL10n.plugin_modal_label}),e.find("#TB_iframeContent").attr("title",c)}),a("#plugin-information-tabs a").click(function(b){var c=a(this).attr("name");b.preventDefault(),a("#plugin-information-tabs a.current").removeClass("current"),a(this).addClass("current"),"description"!==c&&a(window).width()<772?a("#plugin-information-content").find(".fyi").hide():a("#plugin-information-content").find(".fyi").show(),a("#section-holder div.section").hide(),a("#section-"+c).show()}),k.hasClass("upload-tab")||k.attr({role:"button","aria-expanded":"false"}).on("click",function(a){a.preventDefault(),l.toggleClass("show-upload-view"),k.attr("aria-expanded",l.hasClass("show-upload-view"))})});
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.6-alpha-37680';
|
$wp_version = '4.6-alpha-37681';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue