2 var thickDims, tbWidth, tbHeight;
3 jQuery(document).ready(function($) {
5 thickDims = function() {
6 var tbWindow = $('#TB_window'), H = $(window).height(), W = $(window).width(), w, h;
8 w = (tbWidth && tbWidth < W - 90) ? tbWidth : W - 90;
9 h = (tbHeight && tbHeight < H - 60) ? tbHeight : H - 60;
11 if ( tbWindow.size() ) {
12 tbWindow.width(w).height(h);
13 $('#TB_iframeContent').width(w).height(h - 27);
14 tbWindow.css({'margin-left': '-' + parseInt((w / 2),10) + 'px'});
15 if ( typeof document.body.style.maxWidth !== 'undefined' ) {
16 tbWindow.css({'top':'30px','margin-top':'0'});
22 $(window).resize( function() { thickDims(); } );
24 $('a.thickbox-preview').click( function() {
27 var alink = $(this).parents('.available-theme').find('.activatelink'), link = '', href = $(this).attr('href'), url, text;
29 if ( tbWidth = href.match(/&tbWidth=[0-9]+/) ) {
30 tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10);
32 tbWidth = $(window).width() - 90;
35 if ( tbHeight = href.match(/&tbHeight=[0-9]+/) ) {
36 tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10);
38 tbHeight = $(window).height() - 60;
42 url = alink.attr('href') || '';
43 text = alink.attr('title') || '';
44 link = ' <a href="' + url + '" target="_top" class="tb-theme-preview-link">' + text + '</a>';
46 text = $(this).attr('title') || '';
47 link = ' <span class="tb-theme-preview-link">' + text + '</span>';
50 $('#TB_title').css({'background-color':'#222','color':'#dfdfdf'});
51 $('#TB_closeAjaxWindow').css({'float':'left'});
52 $('#TB_ajaxWindowTitle').css({'float':'right'}).html(link);
54 $('#TB_iframeContent').width('100%');