Changeset 12205
- Timestamp:
- 11/18/2009 12:19:55 AM (15 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/thickbox/thickbox.js
r10428 r12205 5 5 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php 6 6 */ 7 8 var tb_pathToImage = "../wp-includes/js/thickbox/loadingAnimation.gif"; 9 var tb_closeImage = "../wp-includes/js/thickbox/tb-close.png"; 7 8 if ( typeof tb_pathToImage != 'string' ) { 9 var tb_pathToImage = "../wp-includes/js/thickbox/loadingAnimation.gif"; 10 } 11 if ( typeof tb_closeImage != 'string' ) { 12 var tb_closeImage = "../wp-includes/js/thickbox/tb-close.png"; 13 } 10 14 11 15 /*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/ 12 16 13 17 //on page load call tb_init 14 jQuery(document).ready(function(){ 18 jQuery(document).ready(function(){ 15 19 tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox 16 20 imgLoader = new Image();// preload image … … 46 50 } 47 51 } 48 52 49 53 if(tb_detectMacXFF()){ 50 54 jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash … … 52 56 jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity 53 57 } 54 58 55 59 if(caption===null){caption="";} 56 60 jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page 57 61 jQuery('#TB_load').show();//show loader 58 62 59 63 var baseURL; 60 64 if(url.indexOf("?")!==-1){ //ff there is a query string involved 61 65 baseURL = url.substr(0, url.indexOf("?")); 62 }else{ 66 }else{ 63 67 baseURL = url; 64 68 } 65 69 66 70 var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/; 67 71 var urlType = baseURL.toLowerCase().match(urlString); 68 72 69 73 if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images 70 74 71 75 TB_PrevCaption = ""; 72 76 TB_PrevURL = ""; … … 81 85 for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) { 82 86 var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString); 83 if (!(TB_TempArray[TB_Counter].href == url)) { 87 if (!(TB_TempArray[TB_Counter].href == url)) { 84 88 if (TB_FoundURL) { 85 89 TB_NextCaption = TB_TempArray[TB_Counter].title; … … 93 97 } else { 94 98 TB_FoundURL = true; 95 TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length); 99 TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length); 96 100 } 97 101 } … … 99 103 100 104 imgPreloader = new Image(); 101 imgPreloader.onload = function(){ 105 imgPreloader.onload = function(){ 102 106 imgPreloader.onload = null; 103 107 104 108 // Resizing large images - orginal by Christian Montoya edited by me. 105 109 var pagesize = tb_getPageSize(); … … 109 113 var imageHeight = imgPreloader.height; 110 114 if (imageWidth > x) { 111 imageHeight = imageHeight * (x / imageWidth); 112 imageWidth = x; 113 if (imageHeight > y) { 114 imageWidth = imageWidth * (y / imageHeight); 115 imageHeight = y; 116 } 117 } else if (imageHeight > y) { 118 imageWidth = imageWidth * (y / imageHeight); 119 imageHeight = y; 120 if (imageWidth > x) { 121 imageHeight = imageHeight * (x / imageWidth); 115 imageHeight = imageHeight * (x / imageWidth); 116 imageWidth = x; 117 if (imageHeight > y) { 118 imageWidth = imageWidth * (y / imageHeight); 119 imageHeight = y; 120 } 121 } else if (imageHeight > y) { 122 imageWidth = imageWidth * (y / imageHeight); 123 imageHeight = y; 124 if (imageWidth > x) { 125 imageHeight = imageHeight * (x / imageWidth); 122 126 imageWidth = x; 123 127 } 124 128 } 125 129 // End Resizing 126 130 127 131 TB_WIDTH = imageWidth + 30; 128 132 TB_HEIGHT = imageHeight + 60; 129 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>"); 130 133 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>"); 134 131 135 jQuery("#TB_closeWindowButton").click(tb_remove); 132 136 133 137 if (!(TB_PrevHTML === "")) { 134 138 function goPrev(){ … … 137 141 jQuery("body").append("<div id='TB_window'></div>"); 138 142 tb_show(TB_PrevCaption, TB_PrevURL, imageGroup); 139 return false; 143 return false; 140 144 } 141 145 jQuery("#TB_prev").click(goPrev); 142 146 } 143 144 if (!(TB_NextHTML === "")) { 147 148 if (!(TB_NextHTML === "")) { 145 149 function goNext(){ 146 150 jQuery("#TB_window").remove(); 147 151 jQuery("body").append("<div id='TB_window'></div>"); 148 tb_show(TB_NextCaption, TB_NextURL, imageGroup); 149 return false; 152 tb_show(TB_NextCaption, TB_NextURL, imageGroup); 153 return false; 150 154 } 151 155 jQuery("#TB_next").click(goNext); 152 153 } 154 155 document.onkeydown = function(e){ 156 157 } 158 159 document.onkeydown = function(e){ 156 160 if (e == null) { // ie 157 161 keycode = event.keyCode; … … 171 175 goPrev(); 172 176 } 173 } 177 } 174 178 }; 175 179 176 180 tb_position(); 177 181 jQuery("#TB_load").remove(); … … 179 183 jQuery("#TB_window").css({display:"block"}); //for safari using css instead of show 180 184 }; 181 185 182 186 imgPreloader.src = url; 183 187 }else{//code to show html 184 188 185 189 var queryString = url.replace(/^[^\?]+\??/,''); 186 190 var params = tb_parseQuery( queryString ); … … 190 194 ajaxContentW = TB_WIDTH - 30; 191 195 ajaxContentH = TB_HEIGHT - 45; 192 193 if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window 196 197 if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window 194 198 urlNoQuery = url.split('TB_'); 195 199 jQuery("#TB_iframeContent").remove(); … … 206 210 }else{//ajax modal 207 211 jQuery("#TB_overlay").unbind(); 208 jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>"); 212 jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>"); 209 213 } 210 214 }else{//this means the window is already up, we are just loading new content via ajax … … 215 219 } 216 220 } 217 221 218 222 jQuery("#TB_closeWindowButton").click(tb_remove); 219 220 if(url.indexOf('TB_inline') != -1){ 223 224 if(url.indexOf('TB_inline') != -1){ 221 225 jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children()); 222 226 jQuery("#TB_window").unload(function () { … … 225 229 tb_position(); 226 230 jQuery("#TB_load").remove(); 227 jQuery("#TB_window").css({display:"block"}); 231 jQuery("#TB_window").css({display:"block"}); 228 232 }else if(url.indexOf('TB_iframe') != -1){ 229 233 tb_position(); … … 240 244 }); 241 245 } 242 246 243 247 } 244 248 245 249 if(!params['modal']){ 246 document.onkeyup = function(e){ 250 document.onkeyup = function(e){ 247 251 if (e == null) { // ie 248 252 keycode = event.keyCode; … … 252 256 if(keycode == 27){ // close 253 257 tb_remove(); 254 } 258 } 255 259 }; 256 260 } 257 261 258 262 } catch(e) { 259 263 //nothing here … … 318 322 } 319 323 } 320 321 -
trunk/wp-includes/script-loader.php
r12188 r12205 165 165 $scripts->add_data( 'jquery-table-hotkeys', 'group', 1 ); 166 166 167 $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-2009 0123');167 $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20091117'); 168 168 $scripts->add_data( 'thickbox', 'group', 1 ); 169 169
Note: See TracChangeset
for help on using the changeset viewer.