author | Anthony Ly <anthonyly.com@gmail.com> |
Wed, 12 Dec 2012 18:57:40 -0800 | |
changeset 199 | 9ff3c84d7b27 |
parent 194 | 32102edaa81b |
permissions | -rw-r--r-- |
136 | 1 |
/* Plugin Browser Thickbox related JS*/ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
2 |
var tb_position; |
136 | 3 |
jQuery(document).ready(function($) { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
4 |
tb_position = function() { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
5 |
var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 720 < width ) ? 720 : width, adminbar_height = 0; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
6 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
7 |
if ( $('body.admin-bar').length ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
8 |
adminbar_height = 28; |
136 | 9 |
|
10 |
if ( tbWindow.size() ) { |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
11 |
tbWindow.width( W - 50 ).height( H - 45 - adminbar_height ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
12 |
$('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height ); |
136 | 13 |
tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'}); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
14 |
if ( typeof document.body.style.maxWidth != 'undefined' ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
15 |
tbWindow.css({'top': 20 + adminbar_height + 'px','margin-top':'0'}); |
136 | 16 |
}; |
17 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
18 |
return $('a.thickbox').each( function() { |
136 | 19 |
var href = $(this).attr('href'); |
20 |
if ( ! href ) |
|
21 |
return; |
|
22 |
href = href.replace(/&width=[0-9]+/g, ''); |
|
23 |
href = href.replace(/&height=[0-9]+/g, ''); |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
24 |
$(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 - adminbar_height ) ); |
136 | 25 |
}); |
26 |
}; |
|
27 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
28 |
$(window).resize(function(){ tb_position(); }); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
29 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
30 |
$('#dashboard_plugins a.thickbox, .plugins a.thickbox').click( function() { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
31 |
tb_click.call(this); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
32 |
|
136 | 33 |
$('#TB_title').css({'background-color':'#222','color':'#cfcfcf'}); |
34 |
$('#TB_ajaxWindowTitle').html('<strong>' + plugininstallL10n.plugin_information + '</strong> ' + $(this).attr('title') ); |
|
35 |
return false; |
|
36 |
}); |
|
37 |
||
38 |
/* Plugin install related JS*/ |
|
39 |
$('#plugin-information #sidemenu a').click( function() { |
|
40 |
var tab = $(this).attr('name'); |
|
41 |
//Flip the tab |
|
42 |
$('#plugin-information-header a.current').removeClass('current'); |
|
43 |
$(this).addClass('current'); |
|
44 |
//Flip the content. |
|
45 |
$('#section-holder div.section').hide(); //Hide 'em all |
|
46 |
$('#section-' + tab).show(); |
|
47 |
return false; |
|
48 |
}); |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
49 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
50 |
$('a.install-now').click( function() { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
51 |
return confirm( plugininstallL10n.ays ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
52 |
}); |
136 | 53 |
}); |