Thickbox: spinner should disappear when loading is done.

Props niklasbr, afercia.
Fixes #33311.

Built from https://develop.svn.wordpress.org/trunk@35418


git-svn-id: http://core.svn.wordpress.org/trunk@35382 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-10-28 18:19:26 +00:00
parent 91c191f5d7
commit f507751a40
7 changed files with 97 additions and 32 deletions

View File

@ -2694,21 +2694,50 @@ body.import-php #TB_window,
body.plugins-php #TB_window, body.plugins-php #TB_window,
body.update-core-php #TB_window, body.update-core-php #TB_window,
body.index-php #TB_window { body.index-php #TB_window {
background: #fcfcfc url( ../images/spinner.gif ) no-repeat center; background: #fcfcfc;
}
/* IE 8 needs a change in the pseudo element content */
.ie8 body.plugin-install-php #TB_window:before,
.ie8 body.import-php #TB_window:before,
.ie8 body.plugins-php #TB_window:before,
.ie8 body.update-core-php #TB_window:before,
.ie8 body.index-php #TB_window:before {
content: " ";
background: none;
}
body.plugin-install-php #TB_window.thickbox-loading:before,
body.import-php #TB_window.thickbox-loading:before,
body.plugins-php #TB_window.thickbox-loading:before,
body.update-core-php #TB_window.thickbox-loading:before,
body.index-php #TB_window.thickbox-loading:before {
content: "";
display: block;
width: 20px;
height: 20px;
position: absolute;
right: 50%;
top: 50%;
z-index: -1;
margin: -10px -10px 0 0;
background: #fcfcfc url(../images/spinner.gif) no-repeat center;
-webkit-background-size: 20px 20px;
background-size: 20px 20px;
-webkit-transform: translateZ(0);
transform: translateZ(0);
} }
@media print, @media print,
(-webkit-min-device-pixel-ratio: 1.25), (-webkit-min-device-pixel-ratio: 1.25),
(min-resolution: 120dpi) { (min-resolution: 120dpi) {
body.plugin-install-php #TB_window, body.plugin-install-php #TB_window.thickbox-loading:before,
body.import-php #TB_window, body.import-php #TB_window.thickbox-loading:before,
body.plugins-php #TB_window, body.plugins-php #TB_window.thickbox-loading:before,
body.update-core-php #TB_window, body.update-core-php #TB_window.thickbox-loading:before,
body.index-php #TB_window { body.index-php #TB_window.thickbox-loading:before {
background: #fcfcfc url( ../images/spinner-2x.gif ) no-repeat center; background: #fcfcfc url(../images/spinner-2x.gif) no-repeat center;
-webkit-background-size: 20px 20px;
background-size: 20px 20px;
} }
} }

View File

@ -2694,21 +2694,50 @@ body.import-php #TB_window,
body.plugins-php #TB_window, body.plugins-php #TB_window,
body.update-core-php #TB_window, body.update-core-php #TB_window,
body.index-php #TB_window { body.index-php #TB_window {
background: #fcfcfc url( ../images/spinner.gif ) no-repeat center; background: #fcfcfc;
}
/* IE 8 needs a change in the pseudo element content */
.ie8 body.plugin-install-php #TB_window:before,
.ie8 body.import-php #TB_window:before,
.ie8 body.plugins-php #TB_window:before,
.ie8 body.update-core-php #TB_window:before,
.ie8 body.index-php #TB_window:before {
content: " ";
background: none;
}
body.plugin-install-php #TB_window.thickbox-loading:before,
body.import-php #TB_window.thickbox-loading:before,
body.plugins-php #TB_window.thickbox-loading:before,
body.update-core-php #TB_window.thickbox-loading:before,
body.index-php #TB_window.thickbox-loading:before {
content: "";
display: block;
width: 20px;
height: 20px;
position: absolute;
left: 50%;
top: 50%;
z-index: -1;
margin: -10px 0 0 -10px;
background: #fcfcfc url(../images/spinner.gif) no-repeat center;
-webkit-background-size: 20px 20px;
background-size: 20px 20px;
-webkit-transform: translateZ(0);
transform: translateZ(0);
} }
@media print, @media print,
(-webkit-min-device-pixel-ratio: 1.25), (-webkit-min-device-pixel-ratio: 1.25),
(min-resolution: 120dpi) { (min-resolution: 120dpi) {
body.plugin-install-php #TB_window, body.plugin-install-php #TB_window.thickbox-loading:before,
body.import-php #TB_window, body.import-php #TB_window.thickbox-loading:before,
body.plugins-php #TB_window, body.plugins-php #TB_window.thickbox-loading:before,
body.update-core-php #TB_window, body.update-core-php #TB_window.thickbox-loading:before,
body.index-php #TB_window { body.index-php #TB_window.thickbox-loading:before {
background: #fcfcfc url( ../images/spinner-2x.gif ) no-repeat center; background: #fcfcfc url(../images/spinner-2x.gif) no-repeat center;
-webkit-background-size: 20px 20px;
background-size: 20px 20px;
} }
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -12,7 +12,7 @@
#TB_window { #TB_window {
position: fixed; position: fixed;
background: #fff; background-color: #fff;
z-index: 100050; /* Above DFW. */ z-index: 100050; /* Above DFW. */
visibility: hidden; visibility: hidden;
text-align: left; text-align: left;
@ -55,7 +55,7 @@
float: left; float: left;
font-weight: 600; font-weight: 600;
line-height: 29px; line-height: 29px;
overflow: hidden; overflow: hidden;
padding: 0 29px 0 10px; padding: 0 29px 0 10px;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;

View File

@ -18,9 +18,16 @@ jQuery(document).ready(function(){
imgLoader.src = tb_pathToImage; 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){ 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(){ 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("body","html").css({height: "100%", width: "100%"});
jQuery("html").css("overflow","hidden"); jQuery("html").css("overflow","hidden");
if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6 if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
jQuery("body").append("<iframe id='TB_HideSelect'>"+thickboxL10n.noiframes+"</iframe><div id='TB_overlay'></div><div id='TB_window'></div>"); jQuery("body").append("<iframe id='TB_HideSelect'>"+thickboxL10n.noiframes+"</iframe><div id='TB_overlay'></div><div id='TB_window' class='thickbox-loading'></div>");
jQuery("#TB_overlay").click(tb_remove); jQuery("#TB_overlay").click(tb_remove);
} }
}else{//all others }else{//all others
if(document.getElementById("TB_overlay") === null){ if(document.getElementById("TB_overlay") === null){
jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>"); jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window' class='thickbox-loading'></div>");
jQuery("#TB_overlay").click(tb_remove); jQuery("#TB_overlay").click(tb_remove);
jQuery( 'body' ).addClass( 'modal-open' ); 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_'); urlNoQuery = url.split('TB_');
jQuery("#TB_iframeContent").remove(); jQuery("#TB_iframeContent").remove();
if(params['modal'] != "true"){//iframe no modal if(params['modal'] != "true"){//iframe no modal
jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'><span class='screen-reader-text'>"+thickboxL10n.close+"</span><div class='tb-close-icon'></div></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;' >"+thickboxL10n.noiframes+"</iframe>"); jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'><span class='screen-reader-text'>"+thickboxL10n.close+"</span><div class='tb-close-icon'></div></a></div></div><iframe frameborder='0' hspace='0' allowTransparency='true' 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;' >"+thickboxL10n.noiframes+"</iframe>");
}else{//iframe modal }else{//iframe modal
jQuery("#TB_overlay").unbind(); jQuery("#TB_overlay").unbind();
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;'>"+thickboxL10n.noiframes+"</iframe>"); jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' allowTransparency='true' 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;'>"+thickboxL10n.noiframes+"</iframe>");
} }
}else{// not an iframe, ajax }else{// not an iframe, ajax
if(jQuery("#TB_window").css("visibility") != "visible"){ 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 //helper functions below
function tb_showIframe(){ function tb_showIframe(){
jQuery("#TB_load").remove(); jQuery("#TB_load").remove();
jQuery("#TB_window").css({'visibility':'visible'}); jQuery("#TB_window").css({'visibility':'visible'}).trigger( 'thickbox:iframe:loaded' );
} }
function tb_remove() { function tb_remove() {

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-beta1-35417'; $wp_version = '4.4-beta1-35418';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.