<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[16681] trunk:
  Make sure media upload thickbox takes admin bar height into account.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16681">16681</a></dd>
<dt>Author</dt> <dd>markjaquith</dd>
<dt>Date</dt> <dd>2010-12-02 04:20:48 +0000 (Thu, 02 Dec 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Make sure media upload thickbox takes admin bar height into account. props ocean90. fixes <a href="http://trac.wordpress.org/ticket/15635">#15635</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminjsmediauploaddevjs">trunk/wp-admin/js/media-upload.dev.js</a></li>
<li><a href="#trunkwpadminjsmediauploadjs">trunk/wp-admin/js/media-upload.js</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminjsmediauploaddevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/media-upload.dev.js (16680 => 16681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/media-upload.dev.js        2010-12-02 03:39:26 UTC (rev 16680)
+++ trunk/wp-admin/js/media-upload.dev.js        2010-12-02 04:20:48 UTC (rev 16681)
</span><span class="lines">@@ -33,14 +33,17 @@
</span><span class="cx"> var tb_position;
</span><span class="cx"> (function($) {
</span><span class="cx">         tb_position = function() {
</span><del>-                var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 720 &lt; width ) ? 720 : width;
</del><ins>+                var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 720 &lt; width ) ? 720 : width, adminbar_height = 0;
</ins><span class="cx"> 
</span><ins>+                if ( $('body.admin-bar').length )
+                        adminbar_height = 28;
+
</ins><span class="cx">                 if ( tbWindow.size() ) {
</span><del>-                        tbWindow.width( W - 50 ).height( H - 45 );
-                        $('#TB_iframeContent').width( W - 50 ).height( H - 75 );
</del><ins>+                        tbWindow.width( W - 50 ).height( H - 45 - adminbar_height );
+                        $('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height );
</ins><span class="cx">                         tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
</span><span class="cx">                         if ( typeof document.body.style.maxWidth != 'undefined' )
</span><del>-                                tbWindow.css({'top':'20px','margin-top':'0'});
</del><ins>+                                tbWindow.css({'top': 20 + adminbar_height + 'px','margin-top':'0'});
</ins><span class="cx">                 };
</span><span class="cx"> 
</span><span class="cx">                 return $('a.thickbox').each( function() {
</span><span class="lines">@@ -48,7 +51,7 @@
</span><span class="cx">                         if ( ! href ) return;
</span><span class="cx">                         href = href.replace(/&amp;width=[0-9]+/g, '');
</span><span class="cx">                         href = href.replace(/&amp;height=[0-9]+/g, '');
</span><del>-                        $(this).attr( 'href', href + '&amp;width=' + ( W - 80 ) + '&amp;height=' + ( H - 85 ) );
</del><ins>+                        $(this).attr( 'href', href + '&amp;width=' + ( W - 80 ) + '&amp;height=' + ( H - 85 - adminbar_height ) );
</ins><span class="cx">                 });
</span><span class="cx">         };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminjsmediauploadjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/media-upload.js (16680 => 16681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/media-upload.js        2010-12-02 03:39:26 UTC (rev 16680)
+++ trunk/wp-admin/js/media-upload.js        2010-12-02 04:20:48 UTC (rev 16681)
</span><span class="lines">@@ -1 +1 @@
</span><del>-function send_to_editor(b){var a;if(typeof tinyMCE!=&quot;undefined&quot;&amp;&amp;(a=tinyMCE.activeEditor)&amp;&amp;!a.isHidden()){a.focus();if(tinymce.isIE){a.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark)}if(b.indexOf(&quot;[caption&quot;)===0){if(a.plugins.wpeditimage){b=a.plugins.wpeditimage._do_shcode(b)}}else{if(b.indexOf(&quot;[gallery&quot;)===0){if(a.plugins.wpgallery){b=a.plugins.wpgallery._do_gallery(b)}}else{if(b.indexOf(&quot;[embed&quot;)===0){if(a.plugins.wordpress){b=a.plugins.wordpress._setEmbed(b)}}}}a.execCommand(&quot;mceInsertContent&quot;,false,b)}else{if(typeof edInsertContent==&quot;function&quot;){edInsertContent(edCanvas,b)}else{jQuery(edCanvas).val(jQuery(edCanvas).val()+b)}}tb_remove()}var tb_position;(function(a){tb_position=function(){var e=a(&quot;#TB_window&quot;),d=a(window).width(),c=a(window).height(),b=(720&lt;d)?720:d;if(e.size()){e.width(b-50).height(c-45);a(&quot;#TB_iframeContent&quot;).width(b-50).height(c-75);e.css({&quot;margin-left&quot;:&quot;-&quot;+parseInt(((b-50)/2),10)+&quot;px&quot;});if(typeof document.body.style.maxWidth!=&quot;undefined&quot;){e.css({top:&quot;20px&quot;,&quot;margin-top&quot;:&quot;0&quot;})}}return a(&quot;a.thickbox&quot;).each(function(){var f=a(this).attr(&quot;href&quot;);if(!f){return}f=f.replace(/&amp;width=[0-9]+/g,&quot;&quot;);f=f.replace(/&amp;height=[0-9]+/g,&quot;&quot;);a(this).attr(&quot;href&quot;,f+&quot;&amp;width=&quot;+(b-80)+&quot;&amp;height=&quot;+(c-85))})};a(window).resize(function(){tb_position()})})(jQuery);jQuery(document).ready(function(a){a(&quot;a.thickbox&quot;).click(function(){if(typeof tinyMCE!=&quot;undefined&quot;&amp;&amp;tinyMCE.activeEditor){tinyMCE.get(&quot;content&quot;).focus();tinyMCE.activeEditor.windowManager.bookmark=tinyMCE.activeEditor.selection.getBookmark(&quot;simple&quot;)}})});
</del><span class="cx">\ No newline at end of file
</span><ins>+function send_to_editor(h){var ed;if(typeof tinyMCE!=&quot;undefined&quot;&amp;&amp;(ed=tinyMCE.activeEditor)&amp;&amp;!ed.isHidden()){ed.focus();if(tinymce.isIE){ed.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark)}if(h.indexOf(&quot;[caption&quot;)===0){if(ed.plugins.wpeditimage){h=ed.plugins.wpeditimage._do_shcode(h)}}else{if(h.indexOf(&quot;[gallery&quot;)===0){if(ed.plugins.wpgallery){h=ed.plugins.wpgallery._do_gallery(h)}}else{if(h.indexOf(&quot;[embed&quot;)===0){if(ed.plugins.wordpress){h=ed.plugins.wordpress._setEmbed(h)}}}}ed.execCommand(&quot;mceInsertContent&quot;,false,h)}else{if(typeof edInsertContent==&quot;function&quot;){edInsertContent(edCanvas,h)}else{jQuery(edCanvas).val(jQuery(edCanvas).val()+h)}}tb_remove()}var tb_position;(function($){tb_position=function(){var tbWindow=$(&quot;#TB_window&quot;),width=$(window).width(),H=$(window).height(),W=(720&lt;width)?720:width,adminbar_height=0;if($(&quot;body.admin-bar&quot;).length){adminbar_height=28}if(tbWindow.size()){tbWindow.width(W-50).height(H-45-adminbar_height);$(&quot;#TB_iframeContent&quot;).width(W-50).height(H-75-adminbar_height);tbWindow.css({&quot;margin-left&quot;:&quot;-&quot;+parseInt(((W-50)/2),10)+&quot;px&quot;});if(typeof document.body.style.maxWidth!=&quot;undefined&quot;){tbWindow.css({top:20+adminbar_height+&quot;px&quot;,&quot;margin-top&quot;:&quot;0&quot;})}}return $(&quot;a.thickbox&quot;).each(function(){var href=$(this).attr(&quot;href&quot;);if(!href){return}href=href.replace(/&amp;width=[0-9]+/g,&quot;&quot;);href=href.replace(/&amp;height=[0-9]+/g,&quot;&quot;);$(this).attr(&quot;href&quot;,href+&quot;&amp;width=&quot;+(W-80)+&quot;&amp;height=&quot;+(H-85-adminbar_height))})};$(window).resize(function(){tb_position()})})(jQuery);jQuery(document).ready(function($){$(&quot;a.thickbox&quot;).click(function(){if(typeof tinyMCE!=&quot;undefined&quot;&amp;&amp;tinyMCE.activeEditor){tinyMCE.get(&quot;content&quot;).focus();tinyMCE.activeEditor.windowManager.bookmark=tinyMCE.activeEditor.selection.getBookmark(&quot;simple&quot;)}})});
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (16680 => 16681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2010-12-02 03:39:26 UTC (rev 16680)
+++ trunk/wp-includes/script-loader.php        2010-12-02 04:20:48 UTC (rev 16681)
</span><span class="lines">@@ -369,7 +369,7 @@
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'admin-gallery', &quot;/wp-admin/js/gallery$suffix.js&quot;, array( 'jquery-ui-sortable' ), '20090516' );
</span><span class="cx"> 
</span><del>-                $scripts-&gt;add( 'media-upload', &quot;/wp-admin/js/media-upload$suffix.js&quot;, array( 'thickbox' ), '20091023' );
</del><ins>+                $scripts-&gt;add( 'media-upload', &quot;/wp-admin/js/media-upload$suffix.js&quot;, array( 'thickbox' ), '20101201' );
</ins><span class="cx">                 $scripts-&gt;add_data( 'media-upload', 'group', 1 );
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'admin-widgets', &quot;/wp-admin/js/widgets$suffix.js&quot;, array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), '20101007' );
</span></span></pre>
</div>
</div>

</body>
</html>