Improvements to the plugin information modal:

* Whitespace/braces cleanup for [29040].
* Reduce width of modal to 792px, which is the default banner size.
* Reduce banner height when screen height is smaller than 500px.
* Remove inline CSS.
* Re-use tab var in JS.
* Encode ampersands in links.

props avryl, michalzuber, ocean90.
see #27440.

Built from https://develop.svn.wordpress.org/trunk@29125


git-svn-id: http://core.svn.wordpress.org/trunk@28910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling
2014-07-12 22:08:16 +00:00
parent 5940d4527c
commit 8cbada97be
7 changed files with 211 additions and 188 deletions

View File

@@ -6,8 +6,8 @@ jQuery( document ).ready( function( $ ) {
tb_position = function() {
var tbWindow = $( '#TB_window' ),
width = $( window ).width(),
H = $( window ).height() - ( ( 850 < width ) ? 60 : 20 ),
W = ( 850 < width ) ? 830 : width - 20;
H = $( window ).height() - ( ( 792 < width ) ? 60 : 20 ),
W = ( 792 < width ) ? 772 : width - 20;
if ( tbWindow.size() ) {
tbWindow.width( W ).height( H );
@@ -17,7 +17,7 @@ jQuery( document ).ready( function( $ ) {
});
if ( typeof document.body.style.maxWidth !== 'undefined' ) {
tbWindow.css({
'top': ( ( 850 < width ) ? 30 : 10 ) + 'px',
'top': ( ( 792 < width ) ? 30 : 10 ) + 'px',
'margin-top': '0'
});
}
@@ -46,20 +46,24 @@ jQuery( document ).ready( function( $ ) {
return false;
});
/* Plugin install related JS*/
/* Plugin install related JS */
$( '#plugin-information-tabs a' ).click( function( event ) {
var tab = $( this ).attr( 'name' );
event.preventDefault();
//Flip the tab
// Flip the tab
$( '#plugin-information-tabs a.current' ).removeClass( 'current' );
$( this ).addClass( 'current' );
//Only show the fyi box in the description section, on smaller screen, where it's otherwise always displayed at the top.
if ( 'description' != $( this ).attr( 'name' ) && $( 'body').width() < 830 )
$( '#plugin-information-content div.fyi' ).hide();
else
$( '#plugin-information-content div.fyi' ).show();
//Flip the content.
$( '#section-holder div.section' ).hide(); //Hide 'em all
// Only show the fyi box in the description section, on smaller screen, where it's otherwise always displayed at the top.
if ( 'description' !== tab && $( window ).width() < 772 ) {
$( '#plugin-information-content' ).find( '.fyi' ).hide();
} else {
$( '#plugin-information-content' ).find( '.fyi' ).show();
}
// Flip the content.
$( '#section-holder div.section' ).hide(); // Hide 'em all.
$( '#section-' + tab ).show();
});

View File

@@ -1 +1 @@
var tb_position;jQuery(document).ready(function(a){tb_position=function(){var b=a("#TB_window"),c=a(window).width(),d=a(window).height()-(c>850?60:20),e=c>850?830:c-20;return b.size()&&(b.width(e).height(d),a("#TB_iframeContent").width(e).height(d),b.css({"margin-left":"-"+parseInt(e/2,10)+"px"}),"undefined"!=typeof document.body.style.maxWidth&&b.css({top:(c>850?30:10)+"px","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="+e+"&height="+d))})},a(window).resize(function(){tb_position()}),a(".plugins").on("click","a.thickbox",function(){return tb_click.call(this),a("#TB_title").css({"background-color":"#222",color:"#cfcfcf"}),a("#TB_ajaxWindowTitle").html("<strong>"+plugininstallL10n.plugin_information+"</strong>&nbsp;"+a(this).attr("title")),!1}),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"!=a(this).attr("name")&&a("body").width()<830?a("#plugin-information-content div.fyi").hide():a("#plugin-information-content div.fyi").show(),a("#section-holder div.section").hide(),a("#section-"+c).show()}),a("a.install-now").click(function(){return confirm(plugininstallL10n.ays)})});
var tb_position;jQuery(document).ready(function(a){tb_position=function(){var b=a("#TB_window"),c=a(window).width(),d=a(window).height()-(c>792?60:20),e=c>792?772:c-20;return b.size()&&(b.width(e).height(d),a("#TB_iframeContent").width(e).height(d),b.css({"margin-left":"-"+parseInt(e/2,10)+"px"}),"undefined"!=typeof document.body.style.maxWidth&&b.css({top:(c>792?30:10)+"px","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="+e+"&height="+d))})},a(window).resize(function(){tb_position()}),a(".plugins").on("click","a.thickbox",function(){return tb_click.call(this),a("#TB_title").css({"background-color":"#222",color:"#cfcfcf"}),a("#TB_ajaxWindowTitle").html("<strong>"+plugininstallL10n.plugin_information+"</strong>&nbsp;"+a(this).attr("title")),!1}),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()}),a("a.install-now").click(function(){return confirm(plugininstallL10n.ays)})});