<!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 = "../wp-includes/js/thickbox/loadingAnimation.gif";
-var tb_closeImage = "../wp-includes/js/thickbox/tb-close.png";
</del><span class="cx">
</span><ins>+if ( typeof tb_pathToImage != 'string' ) {
+        var tb_pathToImage = "../wp-includes/js/thickbox/loadingAnimation.gif";
+}
+if ( typeof tb_closeImage != 'string' ) {
+        var tb_closeImage = "../wp-includes/js/thickbox/tb-close.png";
+}
+
</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("#TB_overlay").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("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
</span><span class="cx">                 }else{
</span><span class="cx">                         jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
</span><span class="cx">                 }
</span><del>-                
</del><ins>+
</ins><span class="cx">                 if(caption===null){caption="";}
</span><span class="cx">                 jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//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("?")!==-1){ //ff there is a query string involved
</span><span class="cx">                         baseURL = url.substr(0, url.indexOf("?"));
</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 = "";
</span><span class="cx">                         TB_PrevURL = "";
</span><span class="cx">                         TB_PrevHTML = "";
</span><span class="lines">@@ -80,7 +84,7 @@
</span><span class="cx">                                 TB_TempArray = jQuery("a[rel="+imageGroup+"]").get();
</span><span class="cx">                                 for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); 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 = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);                                                                                        
</del><ins>+                                                        TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (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 > x) {
</span><del>-                                imageHeight = imageHeight * (x / imageWidth);
-                                imageWidth = x;
-                                if (imageHeight > y) {
-                                        imageWidth = imageWidth * (y / imageHeight);
-                                        imageHeight = y;
</del><ins>+                                imageHeight = imageHeight * (x / imageWidth);
+                                imageWidth = x;
+                                if (imageHeight > y) {
+                                        imageWidth = imageWidth * (y / imageHeight);
+                                        imageHeight = y;
</ins><span class="cx">                                 }
</span><del>-                        } else if (imageHeight > y) {
-                                imageWidth = imageWidth * (y / imageHeight);
-                                imageHeight = y;
-                                if (imageWidth > x) {
-                                        imageHeight = imageHeight * (x / imageWidth);
</del><ins>+                        } else if (imageHeight > y) {
+                                imageWidth = imageWidth * (y / imageHeight);
+                                imageHeight = y;
+                                if (imageWidth > 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("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'><img src='" + tb_closeImage + "' /></a></div>");                 
-                        
</del><ins>+                        jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'><img src='" + tb_closeImage + "' /></a></div>");
+
</ins><span class="cx">                         jQuery("#TB_closeWindowButton").click(tb_remove);
</span><del>-                        
</del><ins>+
</ins><span class="cx">                         if (!(TB_PrevHTML === "")) {
</span><span class="cx">                                 function goPrev(){
</span><span class="cx">                                         if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);}
</span><span class="cx">                                         jQuery("#TB_window").remove();
</span><span class="cx">                                         jQuery("body").append("<div id='TB_window'></div>");
</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("#TB_prev").click(goPrev);
</span><span class="cx">                         }
</span><del>-                        
-                        if (!(TB_NextHTML === "")) {                
</del><ins>+
+                        if (!(TB_NextHTML === "")) {
</ins><span class="cx">                                 function goNext(){
</span><span class="cx">                                         jQuery("#TB_window").remove();
</span><span class="cx">                                         jQuery("body").append("<div id='TB_window'></div>");
</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("#TB_next").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 = "";
</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("#TB_load").remove();
</span><span class="cx">                         jQuery("#TB_ImageOff").click(tb_remove);
</span><span class="cx">                         jQuery("#TB_window").css({display:"block"}); //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("#TB_iframeContent").remove();
</span><span class="cx">                                         if(params['modal'] != "true"){//iframe no modal
</span><span class="lines">@@ -205,7 +209,7 @@
</span><span class="cx">                                                 jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'><img src='" + tb_closeImage + "' /></a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
</span><span class="cx">                                                 }else{//ajax modal
</span><span class="cx">                                                 jQuery("#TB_overlay").unbind();
</span><del>-                                                jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");        
</del><ins>+                                                jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");
</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("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
</span><span class="lines">@@ -214,17 +218,17 @@
</span><span class="cx">                                                 jQuery("#TB_ajaxWindowTitle").html(caption);
</span><span class="cx">                                         }
</span><span class="cx">                         }
</span><del>-                                        
</del><ins>+
</ins><span class="cx">                         jQuery("#TB_closeWindowButton").click(tb_remove);
</span><del>-                        
-                                if(url.indexOf('TB_inline') != -1){        
</del><ins>+
+                                if(url.indexOf('TB_inline') != -1){
</ins><span class="cx">                                         jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children());
</span><span class="cx">                                         jQuery("#TB_window").unload(function () {
</span><span class="cx">                                                 jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished
</span><span class="cx">                                         });
</span><span class="cx">                                         tb_position();
</span><span class="cx">                                         jQuery("#TB_load").remove();
</span><del>-                                        jQuery("#TB_window").css({display:"block"});
</del><ins>+                                        jQuery("#TB_window").css({display:"block"});
</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("#TB_window").css({display:"block"});
</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->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array('jquery', 'jquery-hotkeys'), '20090102' );
</span><span class="cx">         $scripts->add_data( 'jquery-table-hotkeys', 'group', 1 );
</span><span class="cx">
</span><del>-        $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20090123');
</del><ins>+        $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20091117');
</ins><span class="cx">         $scripts->add_data( 'thickbox', 'group', 1 );
</span><span class="cx">
</span><span class="cx">         $scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop$suffix.js", array('jquery'), '0.9.8');
</span></span></pre>
</div>
</div>
</body>
</html>