web/wp-admin/js/plugin-install.dev.js
changeset 194 32102edaa81b
parent 136 bde1974c263b
equal deleted inserted replaced
193:2f6f6f7551ca 194:32102edaa81b
     1 /* Plugin Browser Thickbox related JS*/
     1 /* Plugin Browser Thickbox related JS*/
       
     2 var tb_position;
     2 jQuery(document).ready(function($) {
     3 jQuery(document).ready(function($) {
     3 	var thickDims = function() {
     4 	tb_position = function() {
     4 		var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 720 < width ) ? 720 : width;
     5 		var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 720 < width ) ? 720 : width, adminbar_height = 0;
       
     6 
       
     7 		if ( $('body.admin-bar').length )
       
     8 			adminbar_height = 28;
     5 
     9 
     6 		if ( tbWindow.size() ) {
    10 		if ( tbWindow.size() ) {
     7 			tbWindow.width( W - 50 ).height( H - 45 );
    11 			tbWindow.width( W - 50 ).height( H - 45 - adminbar_height );
     8 			$('#TB_iframeContent').width( W - 50 ).height( H - 75 );
    12 			$('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height );
     9 			tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
    13 			tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
    10 			if ( ! ( $.browser.msie && $.browser.version.substr(0,1) < 7 ) )
    14 			if ( typeof document.body.style.maxWidth != 'undefined' )
    11 				tbWindow.css({'top':'20px','margin-top':'0'});
    15 				tbWindow.css({'top': 20 + adminbar_height + 'px','margin-top':'0'});
    12 		};
    16 		};
    13 
    17 
    14 		return $('#dashboard_plugins a.thickbox, .plugins a.thickbox').each( function() {
    18 		return $('a.thickbox').each( function() {
    15 			var href = $(this).attr('href');
    19 			var href = $(this).attr('href');
    16 			if ( ! href )
    20 			if ( ! href )
    17 				return;
    21 				return;
    18 			href = href.replace(/&width=[0-9]+/g, '');
    22 			href = href.replace(/&width=[0-9]+/g, '');
    19 			href = href.replace(/&height=[0-9]+/g, '');
    23 			href = href.replace(/&height=[0-9]+/g, '');
    20 			$(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 ) );
    24 			$(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 - adminbar_height ) );
    21 		});
    25 		});
    22 	};
    26 	};
    23 
    27 
    24 	thickDims().click( function() {
    28 	$(window).resize(function(){ tb_position(); });
       
    29 
       
    30 	 $('#dashboard_plugins a.thickbox, .plugins a.thickbox').click( function() {
       
    31 		tb_click.call(this);
       
    32 
    25 		$('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
    33 		$('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
    26 		$('#TB_ajaxWindowTitle').html('<strong>' + plugininstallL10n.plugin_information + '</strong>&nbsp;' + $(this).attr('title') );
    34 		$('#TB_ajaxWindowTitle').html('<strong>' + plugininstallL10n.plugin_information + '</strong>&nbsp;' + $(this).attr('title') );
    27 		return false;
    35 		return false;
    28 	});
    36 	});
    29 
    37 
    36 		//Flip the content.
    44 		//Flip the content.
    37 		$('#section-holder div.section').hide(); //Hide 'em all
    45 		$('#section-holder div.section').hide(); //Hide 'em all
    38 		$('#section-' + tab).show();
    46 		$('#section-' + tab).show();
    39 		return false;
    47 		return false;
    40 	});
    48 	});
       
    49 
       
    50 	$('a.install-now').click( function() {
       
    51 		return confirm( plugininstallL10n.ays );
       
    52 	});
    41 });
    53 });