Ticket #10278: i18n-thickbox.diff
| File i18n-thickbox.diff, 9.7 KB (added by nbachiyski, 3 years ago) |
|---|
-
wp-includes/js/thickbox/thickbox.js
11 11 /*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/ 12 12 13 13 //on page load call tb_init 14 jQuery(document).ready(function(){ 14 jQuery(document).ready(function(){ 15 15 tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox 16 16 imgLoader = new Image();// preload image 17 17 imgLoader.src = tb_pathToImage; … … 59 59 var baseURL; 60 60 if(url.indexOf("?")!==-1){ //ff there is a query string involved 61 61 baseURL = url.substr(0, url.indexOf("?")); 62 }else{ 62 }else{ 63 63 baseURL = url; 64 64 } 65 65 … … 80 80 TB_TempArray = jQuery("a[rel="+imageGroup+"]").get(); 81 81 for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) { 82 82 var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString); 83 if (!(TB_TempArray[TB_Counter].href == url)) { 83 if (!(TB_TempArray[TB_Counter].href == url)) { 84 84 if (TB_FoundURL) { 85 85 TB_NextCaption = TB_TempArray[TB_Counter].title; 86 86 TB_NextURL = TB_TempArray[TB_Counter].href; 87 TB_NextHTML = "<span id='TB_next'> <a href='#'> Next ></a></span>";87 TB_NextHTML = "<span id='TB_next'> <a href='#'>"+thickboxL10n.next+"</a></span>"; 88 88 } else { 89 89 TB_PrevCaption = TB_TempArray[TB_Counter].title; 90 90 TB_PrevURL = TB_TempArray[TB_Counter].href; 91 TB_PrevHTML = "<span id='TB_prev'> <a href='#'> < Prev</a></span>";91 TB_PrevHTML = "<span id='TB_prev'> <a href='#'>"+thickboxL10n.prev+"</a></span>"; 92 92 } 93 93 } else { 94 94 TB_FoundURL = true; 95 TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);95 TB_imageCount = thickboxL10n.image+" " + (TB_Counter + 1) +" of "+ (TB_TempArray.length); 96 96 } 97 97 } 98 98 } 99 99 100 100 imgPreloader = new Image(); 101 imgPreloader.onload = function(){ 101 imgPreloader.onload = function(){ 102 102 imgPreloader.onload = null; 103 103 104 104 // Resizing large images - orginal by Christian Montoya edited by me. … … 108 108 var imageWidth = imgPreloader.width; 109 109 var imageHeight = imgPreloader.height; 110 110 if (imageWidth > x) { 111 imageHeight = imageHeight * (x / imageWidth); 112 imageWidth = x; 113 if (imageHeight > y) { 114 imageWidth = imageWidth * (y / imageHeight); 115 imageHeight = y; 111 imageHeight = imageHeight * (x / imageWidth); 112 imageWidth = x; 113 if (imageHeight > y) { 114 imageWidth = imageWidth * (y / imageHeight); 115 imageHeight = y; 116 116 } 117 } else if (imageHeight > y) { 118 imageWidth = imageWidth * (y / imageHeight); 119 imageHeight = y; 120 if (imageWidth > x) { 121 imageHeight = imageHeight * (x / imageWidth); 117 } else if (imageHeight > y) { 118 imageWidth = imageWidth * (y / imageHeight); 119 imageHeight = y; 120 if (imageWidth > x) { 121 imageHeight = imageHeight * (x / imageWidth); 122 122 imageWidth = x; 123 123 } 124 124 } … … 126 126 127 127 TB_WIDTH = imageWidth + 30; 128 128 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>");129 jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='"+thickboxL10n.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='"+thickboxL10n.close+"'><img src='" + tb_closeImage + "' /></a></div>"); 130 130 131 131 jQuery("#TB_closeWindowButton").click(tb_remove); 132 132 … … 136 136 jQuery("#TB_window").remove(); 137 137 jQuery("body").append("<div id='TB_window'></div>"); 138 138 tb_show(TB_PrevCaption, TB_PrevURL, imageGroup); 139 return false; 139 return false; 140 140 } 141 141 jQuery("#TB_prev").click(goPrev); 142 142 } 143 143 144 if (!(TB_NextHTML === "")) { 144 if (!(TB_NextHTML === "")) { 145 145 function goNext(){ 146 146 jQuery("#TB_window").remove(); 147 147 jQuery("body").append("<div id='TB_window'></div>"); 148 tb_show(TB_NextCaption, TB_NextURL, imageGroup); 149 return false; 148 tb_show(TB_NextCaption, TB_NextURL, imageGroup); 149 return false; 150 150 } 151 151 jQuery("#TB_next").click(goNext); 152 152 153 153 } 154 154 155 document.onkeydown = function(e){ 155 document.onkeydown = function(e){ 156 156 if (e == null) { // ie 157 157 keycode = event.keyCode; 158 158 } else { // mozilla … … 170 170 document.onkeydown = ""; 171 171 goPrev(); 172 172 } 173 } 173 } 174 174 }; 175 175 176 176 tb_position(); … … 194 194 urlNoQuery = url.split('TB_'); 195 195 jQuery("#TB_iframeContent").remove(); 196 196 if(params['modal'] != "true"){//iframe no modal 197 jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title=' Close'><img src='" + tb_closeImage + "' /></a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");197 jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='"+thickboxL10n.close+"'><img src='" + tb_closeImage + "' /></a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>"); 198 198 }else{//iframe modal 199 199 jQuery("#TB_overlay").unbind(); 200 200 jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>"); … … 205 205 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>"); 206 206 }else{//ajax modal 207 207 jQuery("#TB_overlay").unbind(); 208 jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>"); 208 jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>"); 209 209 } 210 210 }else{//this means the window is already up, we are just loading new content via ajax 211 211 jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px"; … … 217 217 218 218 jQuery("#TB_closeWindowButton").click(tb_remove); 219 219 220 if(url.indexOf('TB_inline') != -1){ 220 if(url.indexOf('TB_inline') != -1){ 221 221 jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children()); 222 222 jQuery("#TB_window").unload(function () { 223 223 jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished 224 224 }); 225 225 tb_position(); 226 226 jQuery("#TB_load").remove(); 227 jQuery("#TB_window").css({display:"block"}); 227 jQuery("#TB_window").css({display:"block"}); 228 228 }else if(url.indexOf('TB_iframe') != -1){ 229 229 tb_position(); 230 230 if($.browser.safari){//safari needs help because it will not fire iframe onload … … 243 243 } 244 244 245 245 if(!params['modal']){ 246 document.onkeyup = function(e){ 246 document.onkeyup = function(e){ 247 247 if (e == null) { // ie 248 248 keycode = event.keyCode; 249 249 } else { // mozilla … … 251 251 } 252 252 if(keycode == 27){ // close 253 253 tb_remove(); 254 } 254 } 255 255 }; 256 256 } 257 257 … … 316 316 if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) { 317 317 return true; 318 318 } 319 } 320 321 319 } 320 No newline at end of file -
wp-includes/script-loader.php
164 164 $scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array('jquery', 'jquery-hotkeys'), '20090102' ); 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-20090 123');167 $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20090629'); 168 168 $scripts->add_data( 'thickbox', 'group', 1 ); 169 $scripts->localize( 'thickbox', 'thickboxL10n', array( 170 'next' => __('Next >'), 171 'prev' => __('< Prev'), 172 'image' => __('Image'), 173 'close' => __('Close'), 174 'l10n_print_after' => 'try{convertEntities(thickboxL10n);}catch(e){};' 175 ) ); 176 169 177 170 178 $scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop$suffix.js", array('jquery'), '0.9.8'); 171 179
