1 /* global plugininstallL10n, tb_click, confirm */
3 /* Plugin Browser Thickbox related JS*/
5 jQuery(document).ready(function($) {
6 tb_position = function() {
7 var tbWindow = $('#TB_window'),
8 width = $(window).width(),
9 H = $(window).height(),
10 W = ( 720 < width ) ? 720 : width,
13 if ( $('body.admin-bar').length ) {
14 adminbar_height = parseInt( jQuery('#wpadminbar').css('height'), 10 );
17 if ( tbWindow.size() ) {
18 tbWindow.width( W - 50 ).height( H - 45 - adminbar_height );
19 $('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height );
20 tbWindow.css({'margin-left': '-' + parseInt( ( ( W - 50 ) / 2 ), 10 ) + 'px'});
21 if ( typeof document.body.style.maxWidth !== 'undefined' )
22 tbWindow.css({'top': 20 + adminbar_height + 'px', 'margin-top': '0'});
25 return $('a.thickbox').each( function() {
26 var href = $(this).attr('href');
29 href = href.replace(/&width=[0-9]+/g, '');
30 href = href.replace(/&height=[0-9]+/g, '');
31 $(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 - adminbar_height ) );
35 $(window).resize(function(){ tb_position(); });
37 $('.plugins').on( 'click', 'a.thickbox', function() {
40 $('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
41 $('#TB_ajaxWindowTitle').html('<strong>' + plugininstallL10n.plugin_information + '</strong> ' + $(this).attr('title') );
45 /* Plugin install related JS*/
46 $('#plugin-information #sidemenu a').click( function() {
47 var tab = $(this).attr('name');
49 $('#plugin-information-header a.current').removeClass('current');
50 $(this).addClass('current');
52 $('#section-holder div.section').hide(); //Hide 'em all
53 $('#section-' + tab).show();
57 $('a.install-now').click( function() {
58 return confirm( plugininstallL10n.ays );