X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/dc1231b7312fbdca99e9e887cc2bb35a28f85cdc..refs/tags/wordpress-4.4:/wp-includes/js/thickbox/thickbox.js diff --git a/wp-includes/js/thickbox/thickbox.js b/wp-includes/js/thickbox/thickbox.js index 60a9eb77..58183849 100644 --- a/wp-includes/js/thickbox/thickbox.js +++ b/wp-includes/js/thickbox/thickbox.js @@ -18,9 +18,16 @@ jQuery(document).ready(function(){ imgLoader.src = tb_pathToImage; }); -//add thickbox to href & area elements that have a class of .thickbox +/* + * Add thickbox to href & area elements that have a class of .thickbox. + * Remove the loading indicator when content in an iframe has loaded. + */ function tb_init(domChunk){ - jQuery('body').on('click', domChunk, tb_click); + jQuery( 'body' ) + .on( 'click', domChunk, tb_click ) + .on( 'thickbox:iframe:loaded', function() { + jQuery( '#TB_window' ).removeClass( 'thickbox-loading' ); + }); } function tb_click(){ @@ -39,12 +46,12 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic jQuery("body","html").css({height: "100%", width: "100%"}); jQuery("html").css("overflow","hidden"); if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6 - jQuery("body").append("
"); + jQuery("body").append("
"); jQuery("#TB_overlay").click(tb_remove); } }else{//all others if(document.getElementById("TB_overlay") === null){ - jQuery("body").append("
"); + jQuery("body").append("
"); jQuery("#TB_overlay").click(tb_remove); jQuery( 'body' ).addClass( 'modal-open' ); } @@ -195,10 +202,10 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic urlNoQuery = url.split('TB_'); jQuery("#TB_iframeContent").remove(); if(params['modal'] != "true"){//iframe no modal - jQuery("#TB_window").append("
"+caption+"
"+thickboxL10n.close+"
"); + jQuery("#TB_window").append("
"+caption+"
"+thickboxL10n.close+"
"); }else{//iframe modal jQuery("#TB_overlay").unbind(); - jQuery("#TB_window").append(""); + jQuery("#TB_window").append(""); } }else{// not an iframe, ajax if(jQuery("#TB_window").css("visibility") != "visible"){ @@ -260,7 +267,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic //helper functions below function tb_showIframe(){ jQuery("#TB_load").remove(); - jQuery("#TB_window").css({'visibility':'visible'}); + jQuery("#TB_window").css({'visibility':'visible'}).trigger( 'thickbox:iframe:loaded' ); } function tb_remove() {