Index: branches/RC/core/admin_templates/js/jquery/thickbox/thickbox.js =================================================================== diff -u -N -r11623 -r11671 --- branches/RC/core/admin_templates/js/jquery/thickbox/thickbox.js (.../thickbox.js) (revision 11623) +++ branches/RC/core/admin_templates/js/jquery/thickbox/thickbox.js (.../thickbox.js) (revision 11671) @@ -305,6 +305,9 @@ var $image_size = TB.scaleImage.call(TB, $fake_image); + TB.setWindowMetaData('window_size', $image_size); + TB.setWindowMetaData('window_maximized', false); + TB.Width = $image_size.width + 30; TB.Height = $image_size.height + 40; @@ -529,20 +532,39 @@ TB.position = function () { var pagesize = TB.getPageSize(); + var $window = $('#' + TB.getId('TB_window')); - $('#' + TB.getId('TB_window')).css( + var $borders = { + horizontal: $window.outerWidth() - $window.width(), + vertical: $window.outerHeight() - $window.height() + }; + + $window.css( { width: TB.Width + 'px', height: TB.Height + 'px', - left: Math.round((pagesize[0] - TB.Width) / 2) + 'px', - top: $(window).scrollTop() + Math.round((pagesize[1] - TB.Height) / 2) + 'px' + left: Math.round((pagesize[0] - TB.Width - $borders.horizontal) / 2) + 'px', + top: $(window).scrollTop() + Math.round((pagesize[1] - TB.Height - $borders.vertical) / 2) + 'px' } - ); - - $('#' + TB.getId('TB_window')) + ) .resizable( { - alsoResize: '#' + TB.getId('TB_iframeContent') + alsoResize: '#' + TB.getId('TB_iframeContent'), + stop: function(event, ui) { + if (TB.getWindowMetaData('window_maximized')) { + return ; + } + + var $window = $(this); + + var $window_size = { + width: $window.width() - 30, + height: $window.height() - 40 + } + + TB.setWindowMetaData('window_size', $window_size); + } + } ) .draggable( @@ -552,7 +574,52 @@ } ); + $('#' + TB.getId('TB_title')).dblclick( + function($e) { + var $window = $('#' + TB.getId('TB_window')); + var $maximized = TB.getWindowMetaData('window_maximized'); + var $borders = { + horizontal: $window.outerWidth() - $window.width(), + vertical: $window.outerHeight() - $window.height() + }; + + if ($maximized) { + var $window_size = TB.getWindowMetaData('window_size'); + var $new_width = $window_size.width + 30; + var $new_height = $window_size.height + 40; + + TB.setWindowMetaData('window_maximized', false); + } + else { + var $new_width = pagesize[0] - $borders.horizontal; + var $new_height = pagesize[1] - $borders.vertical; + + TB.setWindowMetaData('window_maximized', true); + } + + var $window_width = $window.width(); + var $window_height = $window.height(); + + $window.css( + { + width: $new_width + 'px', + height: $new_height + 'px', + left: Math.round((pagesize[0] - $new_width - $borders.horizontal) / 2) + 'px', + top: $(window).scrollTop() + Math.round((pagesize[1] - $new_height - $borders.vertical) / 2) + 'px' + } + ); + + var $width_diff = $new_width - $window_width; + var $height_diff = $new_height - $window_height; + + var $iframe = $('#' + TB.getId('TB_iframeContent')); + $iframe.width( $iframe.width() + $width_diff ); + $iframe.height( $iframe.height() + $height_diff ); + } + ); + + /*$('#' + TB.getId('TB_window')).css( {marginLeft: '-' + parseInt((TB.Width / 2), 10) + 'px', width: TB.Width + 'px'} ); if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { @@ -619,6 +686,10 @@ TB.windowMetaData[TB.windowMetaData.length - 1][$title] = $value; } +TB.getWindowMetaData = function ($title) { + return TB.windowMetaData[TB.windowMetaData.length - 1][$title]; +} + TB.findWindow = function ($name, $diff) { if (!isset($diff)) { $diff = 0;