source: trunk/www.guidonia.net/wp/wp-admin/js/theme-preview.dev.js@ 44

Last change on this file since 44 was 44, checked in by luciano, 15 years ago
File size: 1.8 KB
Line 
1
2var thickDims, tbWidth, tbHeight;
3jQuery(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 var alink = $(this).parents('.available-theme').find('.activatelink'), link = '', href = $(this).attr('href'), url, text;
25
26 if ( tbWidth = href.match(/&tbWidth=[0-9]+/) )
27 tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10);
28 else
29 tbWidth = $(window).width() - 90;
30
31 if ( tbHeight = href.match(/&tbHeight=[0-9]+/) )
32 tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10);
33 else
34 tbHeight = $(window).height() - 60;
35
36 if ( alink.length ) {
37 url = alink.attr('href') || '';
38 text = alink.attr('title') || '';
39 link = '&nbsp; <a href="' + url + '" target="_top" class="tb-theme-preview-link">' + text + '</a>';
40 } else {
41 text = $(this).attr('title') || '';
42 link = '&nbsp; <span class="tb-theme-preview-link">' + text + '</span>';
43 }
44
45 $('#TB_title').css({'background-color':'#222','color':'#dfdfdf'});
46 $('#TB_closeAjaxWindow').css({'float':'left'});
47 $('#TB_ajaxWindowTitle').css({'float':'right'}).html(link);
48
49 $('#TB_iframeContent').width('100%');
50 thickDims();
51 return false;
52 } );
53
54 // Theme details
55 $('.theme-detail').click(function () {
56 $(this).siblings('.themedetaildiv').toggle();
57 return false;
58 });
59
60});
61
Note: See TracBrowser for help on using the repository browser.