<!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>[12205] trunk/wp-includes: Let plugins predefine thickbox image vars,
  props aaroncampbell, fixes #6453</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12205">12205</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2009-11-18 00:19:55 +0000 (Wed, 18 Nov 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Let plugins predefine thickbox image vars, props aaroncampbell, fixes <a href="http://trac.wordpress.org/ticket/6453">#6453</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesjsthickboxthickboxjs">trunk/wp-includes/js/thickbox/thickbox.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="trunkwpincludesjsthickboxthickboxjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/thickbox/thickbox.js (12204 => 12205)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/thickbox/thickbox.js        2009-11-17 22:49:00 UTC (rev 12204)
+++ trunk/wp-includes/js/thickbox/thickbox.js        2009-11-18 00:19:55 UTC (rev 12205)
</span><span class="lines">@@ -4,14 +4,18 @@
</span><span class="cx">  * Copyright (c) 2007 cody lindley
</span><span class="cx">  * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
</span><span class="cx"> */
</span><del>-                  
-var tb_pathToImage = &quot;../wp-includes/js/thickbox/loadingAnimation.gif&quot;;
-var tb_closeImage = &quot;../wp-includes/js/thickbox/tb-close.png&quot;;
</del><span class="cx"> 
</span><ins>+if ( typeof tb_pathToImage != 'string' ) {
+        var tb_pathToImage = &quot;../wp-includes/js/thickbox/loadingAnimation.gif&quot;;
+}
+if ( typeof tb_closeImage != 'string' ) {
+        var tb_closeImage = &quot;../wp-includes/js/thickbox/tb-close.png&quot;;
+}
+
</ins><span class="cx"> /*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
</span><span class="cx"> 
</span><span class="cx"> //on page load call tb_init
</span><del>-jQuery(document).ready(function(){   
</del><ins>+jQuery(document).ready(function(){
</ins><span class="cx">         tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
</span><span class="cx">         imgLoader = new Image();// preload image
</span><span class="cx">         imgLoader.src = tb_pathToImage;
</span><span class="lines">@@ -45,29 +49,29 @@
</span><span class="cx">                                 jQuery(&quot;#TB_overlay&quot;).click(tb_remove);
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-                
</del><ins>+
</ins><span class="cx">                 if(tb_detectMacXFF()){
</span><span class="cx">                         jQuery(&quot;#TB_overlay&quot;).addClass(&quot;TB_overlayMacFFBGHack&quot;);//use png overlay so hide flash
</span><span class="cx">                 }else{
</span><span class="cx">                         jQuery(&quot;#TB_overlay&quot;).addClass(&quot;TB_overlayBG&quot;);//use background and opacity
</span><span class="cx">                 }
</span><del>-                
</del><ins>+
</ins><span class="cx">                 if(caption===null){caption=&quot;&quot;;}
</span><span class="cx">                 jQuery(&quot;body&quot;).append(&quot;&lt;div id='TB_load'&gt;&lt;img src='&quot;+imgLoader.src+&quot;' /&gt;&lt;/div&gt;&quot;);//add loader to the page
</span><span class="cx">                 jQuery('#TB_load').show();//show loader
</span><del>-                
</del><ins>+
</ins><span class="cx">                 var baseURL;
</span><span class="cx">            if(url.indexOf(&quot;?&quot;)!==-1){ //ff there is a query string involved
</span><span class="cx">                         baseURL = url.substr(0, url.indexOf(&quot;?&quot;));
</span><del>-           }else{ 
</del><ins>+           }else{
</ins><span class="cx">                            baseURL = url;
</span><span class="cx">            }
</span><del>-           
</del><ins>+
</ins><span class="cx">            var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
</span><span class="cx">            var urlType = baseURL.toLowerCase().match(urlString);
</span><span class="cx"> 
</span><span class="cx">                 if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
</span><del>-                                
</del><ins>+
</ins><span class="cx">                         TB_PrevCaption = &quot;&quot;;
</span><span class="cx">                         TB_PrevURL = &quot;&quot;;
</span><span class="cx">                         TB_PrevHTML = &quot;&quot;;
</span><span class="lines">@@ -80,7 +84,7 @@
</span><span class="cx">                                 TB_TempArray = jQuery(&quot;a[rel=&quot;+imageGroup+&quot;]&quot;).get();
</span><span class="cx">                                 for (TB_Counter = 0; ((TB_Counter &lt; TB_TempArray.length) &amp;&amp; (TB_NextHTML === &quot;&quot;)); TB_Counter++) {
</span><span class="cx">                                         var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
</span><del>-                                                if (!(TB_TempArray[TB_Counter].href == url)) {                                                
</del><ins>+                                                if (!(TB_TempArray[TB_Counter].href == url)) {
</ins><span class="cx">                                                         if (TB_FoundURL) {
</span><span class="cx">                                                                 TB_NextCaption = TB_TempArray[TB_Counter].title;
</span><span class="cx">                                                                 TB_NextURL = TB_TempArray[TB_Counter].href;
</span><span class="lines">@@ -92,15 +96,15 @@
</span><span class="cx">                                                         }
</span><span class="cx">                                                 } else {
</span><span class="cx">                                                         TB_FoundURL = true;
</span><del>-                                                        TB_imageCount = &quot;Image &quot; + (TB_Counter + 1) +&quot; of &quot;+ (TB_TempArray.length);                                                                                        
</del><ins>+                                                        TB_imageCount = &quot;Image &quot; + (TB_Counter + 1) +&quot; of &quot;+ (TB_TempArray.length);
</ins><span class="cx">                                                 }
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         imgPreloader = new Image();
</span><del>-                        imgPreloader.onload = function(){                
</del><ins>+                        imgPreloader.onload = function(){
</ins><span class="cx">                         imgPreloader.onload = null;
</span><del>-                                
</del><ins>+
</ins><span class="cx">                         // Resizing large images - orginal by Christian Montoya edited by me.
</span><span class="cx">                         var pagesize = tb_getPageSize();
</span><span class="cx">                         var x = pagesize[0] - 150;
</span><span class="lines">@@ -108,51 +112,51 @@
</span><span class="cx">                         var imageWidth = imgPreloader.width;
</span><span class="cx">                         var imageHeight = imgPreloader.height;
</span><span class="cx">                         if (imageWidth &gt; x) {
</span><del>-                                imageHeight = imageHeight * (x / imageWidth); 
-                                imageWidth = x; 
-                                if (imageHeight &gt; y) { 
-                                        imageWidth = imageWidth * (y / imageHeight); 
-                                        imageHeight = y; 
</del><ins>+                                imageHeight = imageHeight * (x / imageWidth);
+                                imageWidth = x;
+                                if (imageHeight &gt; y) {
+                                        imageWidth = imageWidth * (y / imageHeight);
+                                        imageHeight = y;
</ins><span class="cx">                                 }
</span><del>-                        } else if (imageHeight &gt; y) { 
-                                imageWidth = imageWidth * (y / imageHeight); 
-                                imageHeight = y; 
-                                if (imageWidth &gt; x) { 
-                                        imageHeight = imageHeight * (x / imageWidth); 
</del><ins>+                        } else if (imageHeight &gt; y) {
+                                imageWidth = imageWidth * (y / imageHeight);
+                                imageHeight = y;
+                                if (imageWidth &gt; x) {
+                                        imageHeight = imageHeight * (x / imageWidth);
</ins><span class="cx">                                         imageWidth = x;
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="cx">                         // End Resizing
</span><del>-                        
</del><ins>+
</ins><span class="cx">                         TB_WIDTH = imageWidth + 30;
</span><span class="cx">                         TB_HEIGHT = imageHeight + 60;
</span><del>-                        jQuery(&quot;#TB_window&quot;).append(&quot;&lt;a href='' id='TB_ImageOff' title='Close'&gt;&lt;img id='TB_Image' src='&quot;+url+&quot;' width='&quot;+imageWidth+&quot;' height='&quot;+imageHeight+&quot;' alt='&quot;+caption+&quot;'/&gt;&lt;/a&gt;&quot; + &quot;&lt;div id='TB_caption'&gt;&quot;+caption+&quot;&lt;div id='TB_secondLine'&gt;&quot; + TB_imageCount + TB_PrevHTML + TB_NextHTML + &quot;&lt;/div&gt;&lt;/div&gt;&lt;div id='TB_closeWindow'&gt;&lt;a href='#' id='TB_closeWindowButton' title='Close'&gt;&lt;img src='&quot; + tb_closeImage + &quot;' /&gt;&lt;/a&gt;&lt;/div&gt;&quot;);                 
-                        
</del><ins>+                        jQuery(&quot;#TB_window&quot;).append(&quot;&lt;a href='' id='TB_ImageOff' title='Close'&gt;&lt;img id='TB_Image' src='&quot;+url+&quot;' width='&quot;+imageWidth+&quot;' height='&quot;+imageHeight+&quot;' alt='&quot;+caption+&quot;'/&gt;&lt;/a&gt;&quot; + &quot;&lt;div id='TB_caption'&gt;&quot;+caption+&quot;&lt;div id='TB_secondLine'&gt;&quot; + TB_imageCount + TB_PrevHTML + TB_NextHTML + &quot;&lt;/div&gt;&lt;/div&gt;&lt;div id='TB_closeWindow'&gt;&lt;a href='#' id='TB_closeWindowButton' title='Close'&gt;&lt;img src='&quot; + tb_closeImage + &quot;' /&gt;&lt;/a&gt;&lt;/div&gt;&quot;);
+
</ins><span class="cx">                         jQuery(&quot;#TB_closeWindowButton&quot;).click(tb_remove);
</span><del>-                        
</del><ins>+
</ins><span class="cx">                         if (!(TB_PrevHTML === &quot;&quot;)) {
</span><span class="cx">                                 function goPrev(){
</span><span class="cx">                                         if(jQuery(document).unbind(&quot;click&quot;,goPrev)){jQuery(document).unbind(&quot;click&quot;,goPrev);}
</span><span class="cx">                                         jQuery(&quot;#TB_window&quot;).remove();
</span><span class="cx">                                         jQuery(&quot;body&quot;).append(&quot;&lt;div id='TB_window'&gt;&lt;/div&gt;&quot;);
</span><span class="cx">                                         tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
</span><del>-                                        return false;        
</del><ins>+                                        return false;
</ins><span class="cx">                                 }
</span><span class="cx">                                 jQuery(&quot;#TB_prev&quot;).click(goPrev);
</span><span class="cx">                         }
</span><del>-                        
-                        if (!(TB_NextHTML === &quot;&quot;)) {                
</del><ins>+
+                        if (!(TB_NextHTML === &quot;&quot;)) {
</ins><span class="cx">                                 function goNext(){
</span><span class="cx">                                         jQuery(&quot;#TB_window&quot;).remove();
</span><span class="cx">                                         jQuery(&quot;body&quot;).append(&quot;&lt;div id='TB_window'&gt;&lt;/div&gt;&quot;);
</span><del>-                                        tb_show(TB_NextCaption, TB_NextURL, imageGroup);                                
-                                        return false;        
</del><ins>+                                        tb_show(TB_NextCaption, TB_NextURL, imageGroup);
+                                        return false;
</ins><span class="cx">                                 }
</span><span class="cx">                                 jQuery(&quot;#TB_next&quot;).click(goNext);
</span><del>-                                
</del><ins>+
</ins><span class="cx">                         }
</span><span class="cx"> 
</span><del>-                        document.onkeydown = function(e){         
</del><ins>+                        document.onkeydown = function(e){
</ins><span class="cx">                                 if (e == null) { // ie
</span><span class="cx">                                         keycode = event.keyCode;
</span><span class="cx">                                 } else { // mozilla
</span><span class="lines">@@ -170,18 +174,18 @@
</span><span class="cx">                                                 document.onkeydown = &quot;&quot;;
</span><span class="cx">                                                 goPrev();
</span><span class="cx">                                         }
</span><del>-                                }        
</del><ins>+                                }
</ins><span class="cx">                         };
</span><del>-                        
</del><ins>+
</ins><span class="cx">                         tb_position();
</span><span class="cx">                         jQuery(&quot;#TB_load&quot;).remove();
</span><span class="cx">                         jQuery(&quot;#TB_ImageOff&quot;).click(tb_remove);
</span><span class="cx">                         jQuery(&quot;#TB_window&quot;).css({display:&quot;block&quot;}); //for safari using css instead of show
</span><span class="cx">                         };
</span><del>-                        
</del><ins>+
</ins><span class="cx">                         imgPreloader.src = url;
</span><span class="cx">                 }else{//code to show html
</span><del>-                        
</del><ins>+
</ins><span class="cx">                         var queryString = url.replace(/^[^\?]+\??/,'');
</span><span class="cx">                         var params = tb_parseQuery( queryString );
</span><span class="cx"> 
</span><span class="lines">@@ -189,8 +193,8 @@
</span><span class="cx">                         TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
</span><span class="cx">                         ajaxContentW = TB_WIDTH - 30;
</span><span class="cx">                         ajaxContentH = TB_HEIGHT - 45;
</span><del>-                        
-                        if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window                
</del><ins>+
+                        if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window
</ins><span class="cx">                                         urlNoQuery = url.split('TB_');
</span><span class="cx">                                         jQuery(&quot;#TB_iframeContent&quot;).remove();
</span><span class="cx">                                         if(params['modal'] != &quot;true&quot;){//iframe no modal
</span><span class="lines">@@ -205,7 +209,7 @@
</span><span class="cx">                                                 jQuery(&quot;#TB_window&quot;).append(&quot;&lt;div id='TB_title'&gt;&lt;div id='TB_ajaxWindowTitle'&gt;&quot;+caption+&quot;&lt;/div&gt;&lt;div id='TB_closeAjaxWindow'&gt;&lt;a href='#' id='TB_closeWindowButton'&gt;&lt;img src='&quot; + tb_closeImage + &quot;' /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div id='TB_ajaxContent' style='width:&quot;+ajaxContentW+&quot;px;height:&quot;+ajaxContentH+&quot;px'&gt;&lt;/div&gt;&quot;);
</span><span class="cx">                                                 }else{//ajax modal
</span><span class="cx">                                                 jQuery(&quot;#TB_overlay&quot;).unbind();
</span><del>-                                                jQuery(&quot;#TB_window&quot;).append(&quot;&lt;div id='TB_ajaxContent' class='TB_modal' style='width:&quot;+ajaxContentW+&quot;px;height:&quot;+ajaxContentH+&quot;px;'&gt;&lt;/div&gt;&quot;);        
</del><ins>+                                                jQuery(&quot;#TB_window&quot;).append(&quot;&lt;div id='TB_ajaxContent' class='TB_modal' style='width:&quot;+ajaxContentW+&quot;px;height:&quot;+ajaxContentH+&quot;px;'&gt;&lt;/div&gt;&quot;);
</ins><span class="cx">                                                 }
</span><span class="cx">                                         }else{//this means the window is already up, we are just loading new content via ajax
</span><span class="cx">                                                 jQuery(&quot;#TB_ajaxContent&quot;)[0].style.width = ajaxContentW +&quot;px&quot;;
</span><span class="lines">@@ -214,17 +218,17 @@
</span><span class="cx">                                                 jQuery(&quot;#TB_ajaxWindowTitle&quot;).html(caption);
</span><span class="cx">                                         }
</span><span class="cx">                         }
</span><del>-                                        
</del><ins>+
</ins><span class="cx">                         jQuery(&quot;#TB_closeWindowButton&quot;).click(tb_remove);
</span><del>-                        
-                                if(url.indexOf('TB_inline') != -1){        
</del><ins>+
+                                if(url.indexOf('TB_inline') != -1){
</ins><span class="cx">                                         jQuery(&quot;#TB_ajaxContent&quot;).append(jQuery('#' + params['inlineId']).children());
</span><span class="cx">                                         jQuery(&quot;#TB_window&quot;).unload(function () {
</span><span class="cx">                                                 jQuery('#' + params['inlineId']).append( jQuery(&quot;#TB_ajaxContent&quot;).children() ); // move elements back when you're finished
</span><span class="cx">                                         });
</span><span class="cx">                                         tb_position();
</span><span class="cx">                                         jQuery(&quot;#TB_load&quot;).remove();
</span><del>-                                        jQuery(&quot;#TB_window&quot;).css({display:&quot;block&quot;}); 
</del><ins>+                                        jQuery(&quot;#TB_window&quot;).css({display:&quot;block&quot;});
</ins><span class="cx">                                 }else if(url.indexOf('TB_iframe') != -1){
</span><span class="cx">                                         tb_position();
</span><span class="cx">                                         if($.browser.safari){//safari needs help because it will not fire iframe onload
</span><span class="lines">@@ -239,11 +243,11 @@
</span><span class="cx">                                                 jQuery(&quot;#TB_window&quot;).css({display:&quot;block&quot;});
</span><span class="cx">                                         });
</span><span class="cx">                                 }
</span><del>-                        
</del><ins>+
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 if(!params['modal']){
</span><del>-                        document.onkeyup = function(e){         
</del><ins>+                        document.onkeyup = function(e){
</ins><span class="cx">                                 if (e == null) { // ie
</span><span class="cx">                                         keycode = event.keyCode;
</span><span class="cx">                                 } else { // mozilla
</span><span class="lines">@@ -251,10 +255,10 @@
</span><span class="cx">                                 }
</span><span class="cx">                                 if(keycode == 27){ // close
</span><span class="cx">                                         tb_remove();
</span><del>-                                }        
</del><ins>+                                }
</ins><span class="cx">                         };
</span><span class="cx">                 }
</span><del>-                
</del><ins>+
</ins><span class="cx">         } catch(e) {
</span><span class="cx">                 //nothing here
</span><span class="cx">         }
</span><span class="lines">@@ -317,5 +321,3 @@
</span><span class="cx">     return true;
</span><span class="cx">   }
</span><span class="cx"> }
</span><del>-
-
</del></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (12204 => 12205)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2009-11-17 22:49:00 UTC (rev 12204)
+++ trunk/wp-includes/script-loader.php        2009-11-18 00:19:55 UTC (rev 12205)
</span><span class="lines">@@ -164,7 +164,7 @@
</span><span class="cx">         $scripts-&gt;add( 'jquery-table-hotkeys', &quot;/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js&quot;, array('jquery', 'jquery-hotkeys'), '20090102' );
</span><span class="cx">         $scripts-&gt;add_data( 'jquery-table-hotkeys', 'group', 1 );
</span><span class="cx"> 
</span><del>-        $scripts-&gt;add( 'thickbox', &quot;/wp-includes/js/thickbox/thickbox.js&quot;, array('jquery'), '3.1-20090123');
</del><ins>+        $scripts-&gt;add( 'thickbox', &quot;/wp-includes/js/thickbox/thickbox.js&quot;, array('jquery'), '3.1-20091117');
</ins><span class="cx">         $scripts-&gt;add_data( 'thickbox', 'group', 1 );
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'jcrop', &quot;/wp-includes/js/jcrop/jquery.Jcrop$suffix.js&quot;, array('jquery'), '0.9.8');
</span></span></pre>
</div>
</div>

</body>
</html>