Fix thickbox positioning on Manage Themes screen. Adjust thickbox resizing code on various screens for new toolbar height.

see #26078. fixes #26140.

git-svn-id: https://develop.svn.wordpress.org/trunk@26323 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2013-11-22 08:05:42 +00:00
parent bb56197ae6
commit 2af4da91bb
4 changed files with 49 additions and 39 deletions

View File

@ -50,17 +50,22 @@ send_to_editor = function(h) {
var tb_position;
(function($) {
tb_position = function() {
var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 720 < width ) ? 720 : width, adminbar_height = 0;
var tbWindow = $('#TB_window'),
width = $(window).width(),
H = $(window).height(),
W = ( 720 < width ) ? 720 : width,
adminbar_height = 0;
if ( $('body.admin-bar').length )
adminbar_height = 28;
if ( $('body.admin-bar').length ) {
adminbar_height = parseInt( jQuery('#wpadminbar').css('height'), 10 );
}
if ( tbWindow.size() ) {
tbWindow.width( W - 50 ).height( H - 45 - adminbar_height );
$('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height );
tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
if ( typeof document.body.style.maxWidth != 'undefined' )
tbWindow.css({'top': 20 + adminbar_height + 'px','margin-top':'0'});
tbWindow.css({'margin-left': '-' + parseInt( ( ( W - 50 ) / 2 ), 10 ) + 'px'});
if ( typeof document.body.style.maxWidth !== 'undefined' )
tbWindow.css({'top': 20 + adminbar_height + 'px', 'margin-top': '0'});
}
return $('a.thickbox').each( function() {

View File

@ -4,17 +4,22 @@
var tb_position;
jQuery(document).ready(function($) {
tb_position = function() {
var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 720 < width ) ? 720 : width, adminbar_height = 0;
var tbWindow = $('#TB_window'),
width = $(window).width(),
H = $(window).height(),
W = ( 720 < width ) ? 720 : width,
adminbar_height = 0;
if ( $('body.admin-bar').length )
adminbar_height = 28;
if ( $('body.admin-bar').length ) {
adminbar_height = parseInt( jQuery('#wpadminbar').css('height'), 10 );
}
if ( tbWindow.size() ) {
tbWindow.width( W - 50 ).height( H - 45 - adminbar_height );
$('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height );
tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
if ( typeof document.body.style.maxWidth != 'undefined' )
tbWindow.css({'top': 20 + adminbar_height + 'px','margin-top':'0'});
tbWindow.css({'margin-left': '-' + parseInt( ( ( W - 50 ) / 2 ), 10 ) + 'px'});
if ( typeof document.body.style.maxWidth !== 'undefined' )
tbWindow.css({'top': 20 + adminbar_height + 'px', 'margin-top': '0'});
}
return $('a.thickbox').each( function() {

View File

@ -22,33 +22,6 @@ jQuery( function($) {
});
});
/**
* Theme Browser Thickbox
*
* Aligns theme browser thickbox.
*/
var tb_position;
jQuery(document).ready( function($) {
tb_position = function() {
var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 1040 < width ) ? 1040 : width, adminbar_height = 0;
if ( $('body.admin-bar').length ) {
adminbar_height = 28;
}
if ( tbWindow.size() ) {
tbWindow.width( W - 50 ).height( H - 45 - adminbar_height );
$('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height );
tbWindow.css({'margin-left': '-' + parseInt( ( ( W - 50 ) / 2 ), 10 ) + 'px'});
if ( typeof document.body.style.maxWidth !== 'undefined' ) {
tbWindow.css({'top': 20 + adminbar_height + 'px','margin-top':'0'});
}
}
};
$(window).resize(function(){ tb_position(); });
});
/**
* Theme Install
*

View File

@ -661,3 +661,30 @@ jQuery( document ).ready(
);
})( jQuery );
// Align theme browser thickbox
var tb_position;
jQuery(document).ready( function($) {
tb_position = function() {
var tbWindow = $('#TB_window'),
width = $(window).width(),
H = $(window).height(),
W = ( 1040 < width ) ? 1040 : width,
adminbar_height = 0;
if ( $('body.admin-bar').length ) {
adminbar_height = parseInt( jQuery('#wpadminbar').css('height'), 10 );
}
if ( tbWindow.size() ) {
tbWindow.width( W - 50 ).height( H - 45 - adminbar_height );
$('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height );
tbWindow.css({'margin-left': '-' + parseInt( ( ( W - 50 ) / 2 ), 10 ) + 'px'});
if ( typeof document.body.style.maxWidth !== 'undefined' ) {
tbWindow.css({'top': 20 + adminbar_height + 'px', 'margin-top': '0'});
}
}
};
$(window).resize(function(){ tb_position(); });
});