1 var thickDims,tbWidth,tbHeight;jQuery(document).ready(function(a){thickDims=function(){var f=a("#TB_window"),d=a(window).height(),b=a(window).width(),c,e;c=(tbWidth&&tbWidth<b-90)?tbWidth:b-90;e=(tbHeight&&tbHeight<d-60)?tbHeight:d-60;if(f.size()){f.width(c).height(e);a("#TB_iframeContent").width(c).height(e-27);f.css({"margin-left":"-"+parseInt((c/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){f.css({top:"30px","margin-top":"0"})}}};thickDims();a(window).resize(function(){thickDims()});a("a.thickbox-preview").click(function(){tb_click.call(this);var d=a(this).parents(".available-theme").find(".activatelink"),e="",b=a(this).attr("href"),c,f;if(tbWidth=b.match(/&tbWidth=[0-9]+/)){tbWidth=parseInt(tbWidth[0].replace(/[^0-9]+/g,""),10)}else{tbWidth=a(window).width()-90}if(tbHeight=b.match(/&tbHeight=[0-9]+/)){tbHeight=parseInt(tbHeight[0].replace(/[^0-9]+/g,""),10)}else{tbHeight=a(window).height()-60}if(d.length){c=d.attr("href")||"";f=d.attr("title")||"";e=' <a href="'+c+'" target="_top" class="tb-theme-preview-link">'+f+"</a>"}else{f=a(this).attr("title")||"";e=' <span class="tb-theme-preview-link">'+f+"</span>"}a("#TB_title").css({"background-color":"#222",color:"#dfdfdf"});a("#TB_closeAjaxWindow").css({"float":"left"});a("#TB_ajaxWindowTitle").css({"float":"right"}).html(e);a("#TB_iframeContent").width("100%");thickDims();return false})}); |
1 |
|
2 var thickDims, tbWidth, tbHeight; |
|
3 jQuery(document).ready(function($) { |
|
4 |
|
5 thickDims = function() { |
|
6 var tbWindow = $('#TB_window'), H = $(window).height(), W = $(window).width(), w, h; |
|
7 |
|
8 w = (tbWidth && tbWidth < W - 90) ? tbWidth : W - 90; |
|
9 h = (tbHeight && tbHeight < H - 60) ? tbHeight : H - 60; |
|
10 |
|
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'}); |
|
17 } |
|
18 }; |
|
19 |
|
20 thickDims(); |
|
21 $(window).resize( function() { thickDims() } ); |
|
22 |
|
23 $('a.thickbox-preview').click( function() { |
|
24 tb_click.call(this); |
|
25 |
|
26 var alink = $(this).parents('.available-theme').find('.activatelink'), link = '', href = $(this).attr('href'), url, text; |
|
27 |
|
28 if ( tbWidth = href.match(/&tbWidth=[0-9]+/) ) |
|
29 tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10); |
|
30 else |
|
31 tbWidth = $(window).width() - 90; |
|
32 |
|
33 if ( tbHeight = href.match(/&tbHeight=[0-9]+/) ) |
|
34 tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10); |
|
35 else |
|
36 tbHeight = $(window).height() - 60; |
|
37 |
|
38 if ( alink.length ) { |
|
39 url = alink.attr('href') || ''; |
|
40 text = alink.attr('title') || ''; |
|
41 link = ' <a href="' + url + '" target="_top" class="tb-theme-preview-link">' + text + '</a>'; |
|
42 } else { |
|
43 text = $(this).attr('title') || ''; |
|
44 link = ' <span class="tb-theme-preview-link">' + text + '</span>'; |
|
45 } |
|
46 |
|
47 $('#TB_title').css({'background-color':'#222','color':'#dfdfdf'}); |
|
48 $('#TB_closeAjaxWindow').css({'float':'left'}); |
|
49 $('#TB_ajaxWindowTitle').css({'float':'right'}).html(link); |
|
50 |
|
51 $('#TB_iframeContent').width('100%'); |
|
52 thickDims(); |
|
53 |
|
54 return false; |
|
55 } ); |
|
56 }); |