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() - ( ( 792 < width ) ? 60 : 20 ),
10
W = ( 792 < width ) ? 772 : width - 20;
12
if ( tbWindow.size() ) {
13
tbWindow.width( W ).height( H );
14
$( '#TB_iframeContent' ).width( W ).height( H );
16
'margin-left': '-' + parseInt( ( W / 2 ), 10 ) + 'px'
18
if ( typeof document.body.style.maxWidth !== 'undefined' ) {
26
return $( 'a.thickbox' ).each( function() {
27
var href = $( this ).attr( 'href' );
31
href = href.replace( /&width=[0-9]+/g, '' );
32
href = href.replace( /&height=[0-9]+/g, '' );
33
$(this).attr( 'href', href + '&width=' + W + '&height=' + ( H ) );
37
$( window ).resize( function() {
41
$( '.plugin-card, .plugins .column-description' ).on( 'click', 'a.thickbox', function() {
44
$('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
45
$('#TB_ajaxWindowTitle').html( '<strong>' + plugininstallL10n.plugin_information + '</strong> ' + $(this).data( 'title' ) );
46
$('#TB_iframeContent').attr( 'title', plugininstallL10n.plugin_information + ' ' + $(this).data( 'title' ) );
47
$('#TB_closeWindowButton').focus();
52
/* Plugin install related JS */
53
$( '#plugin-information-tabs a' ).click( function( event ) {
54
var tab = $( this ).attr( 'name' );
55
event.preventDefault();
58
$( '#plugin-information-tabs a.current' ).removeClass( 'current' );
59
$( this ).addClass( 'current' );
61
// Only show the fyi box in the description section, on smaller screen, where it's otherwise always displayed at the top.
62
if ( 'description' !== tab && $( window ).width() < 772 ) {
63
$( '#plugin-information-content' ).find( '.fyi' ).hide();
65
$( '#plugin-information-content' ).find( '.fyi' ).show();
69
$( '#section-holder div.section' ).hide(); // Hide 'em all.
70
$( '#section-' + tab ).show();
73
$( 'a.install-now' ).click( function() {
74
return confirm( plugininstallL10n.ays );