From a48d554c48a6479d2cd9a3203ea9421fe19216c2 Mon Sep 17 00:00:00 2001
From: Niklas <niklas@lynks.se>
Date: Mon, 10 Aug 2015 20:31:48 +0200
Subject: [PATCH] Fix excessive resource usage due to animating GIF after
ThickBox load finishes
---
wp-admin/css/common-rtl.css | 17 +----------------
wp-admin/css/common.css | 17 +----------------
wp-includes/js/thickbox/thickbox.css | 2 +-
wp-includes/js/thickbox/thickbox.js | 6 +++---
4 files changed, 6 insertions(+), 36 deletions(-)
diff --git a/wp-admin/css/common-rtl.css b/wp-admin/css/common-rtl.css
index b009875..25ecd34 100644
|
a
|
b
|
body.import-php #TB_window, |
| 2610 | 2610 | body.plugins-php #TB_window, |
| 2611 | 2611 | body.update-core-php #TB_window, |
| 2612 | 2612 | body.index-php #TB_window { |
| 2613 | | background: #fcfcfc url( ../images/spinner.gif ) no-repeat center; |
| 2614 | | } |
| 2615 | | |
| 2616 | | @media print, |
| 2617 | | (-webkit-min-device-pixel-ratio: 1.25), |
| 2618 | | (min-resolution: 120dpi) { |
| 2619 | | |
| 2620 | | body.plugin-install-php #TB_window, |
| 2621 | | body.import-php #TB_window, |
| 2622 | | body.plugins-php #TB_window, |
| 2623 | | body.update-core-php #TB_window, |
| 2624 | | body.index-php #TB_window { |
| 2625 | | background: #fcfcfc url( ../images/spinner-2x.gif ) no-repeat center; |
| 2626 | | -webkit-background-size: 20px 20px; |
| 2627 | | background-size: 20px 20px; |
| 2628 | | } |
| | 2613 | background-position: center; |
| 2629 | 2614 | } |
| 2630 | 2615 | |
| 2631 | 2616 | body.plugin-install-php #TB_title, |
diff --git a/wp-admin/css/common.css b/wp-admin/css/common.css
index d3765d9..94f479e 100644
|
a
|
b
|
body.import-php #TB_window, |
| 2610 | 2610 | body.plugins-php #TB_window, |
| 2611 | 2611 | body.update-core-php #TB_window, |
| 2612 | 2612 | body.index-php #TB_window { |
| 2613 | | background: #fcfcfc url( ../images/spinner.gif ) no-repeat center; |
| 2614 | | } |
| 2615 | | |
| 2616 | | @media print, |
| 2617 | | (-webkit-min-device-pixel-ratio: 1.25), |
| 2618 | | (min-resolution: 120dpi) { |
| 2619 | | |
| 2620 | | body.plugin-install-php #TB_window, |
| 2621 | | body.import-php #TB_window, |
| 2622 | | body.plugins-php #TB_window, |
| 2623 | | body.update-core-php #TB_window, |
| 2624 | | body.index-php #TB_window { |
| 2625 | | background: #fcfcfc url( ../images/spinner-2x.gif ) no-repeat center; |
| 2626 | | -webkit-background-size: 20px 20px; |
| 2627 | | background-size: 20px 20px; |
| 2628 | | } |
| | 2613 | background-position: center; |
| 2629 | 2614 | } |
| 2630 | 2615 | |
| 2631 | 2616 | body.plugin-install-php #TB_title, |
diff --git a/wp-includes/js/thickbox/thickbox.css b/wp-includes/js/thickbox/thickbox.css
index 0549c79..e47f5aa 100644
|
a
|
b
|
|
| 12 | 12 | |
| 13 | 13 | #TB_window { |
| 14 | 14 | position: fixed; |
| 15 | | background: #fff; |
| | 15 | background-color: #fff; |
| 16 | 16 | z-index: 100050; /* Above DFW. */ |
| 17 | 17 | visibility: hidden; |
| 18 | 18 | text-align: left; |
diff --git a/wp-includes/js/thickbox/thickbox.js b/wp-includes/js/thickbox/thickbox.js
index 60a9eb7..b5e9d1d 100644
|
a
|
b
|
function tb_show(caption, url, imageGroup) {//function called when the user clic |
| 39 | 39 | jQuery("body","html").css({height: "100%", width: "100%"}); |
| 40 | 40 | jQuery("html").css("overflow","hidden"); |
| 41 | 41 | if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6 |
| 42 | | jQuery("body").append("<iframe id='TB_HideSelect'>"+thickboxL10n.noiframes+"</iframe><div id='TB_overlay'></div><div id='TB_window'></div>"); |
| | 42 | jQuery("body").append("<iframe id='TB_HideSelect'>"+thickboxL10n.noiframes+"</iframe><div id='TB_overlay'></div><div id='TB_window' class='spinner'></div>"); |
| 43 | 43 | jQuery("#TB_overlay").click(tb_remove); |
| 44 | 44 | } |
| 45 | 45 | }else{//all others |
| 46 | 46 | if(document.getElementById("TB_overlay") === null){ |
| 47 | | jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>"); |
| | 47 | jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window' class='spinner'></div>"); |
| 48 | 48 | jQuery("#TB_overlay").click(tb_remove); |
| 49 | 49 | jQuery( 'body' ).addClass( 'modal-open' ); |
| 50 | 50 | } |
| … |
… |
function tb_show(caption, url, imageGroup) {//function called when the user clic |
| 260 | 260 | //helper functions below |
| 261 | 261 | function tb_showIframe(){ |
| 262 | 262 | jQuery("#TB_load").remove(); |
| 263 | | jQuery("#TB_window").css({'visibility':'visible'}); |
| | 263 | jQuery("#TB_window").css({'visibility':'visible'}).removeClass('spinner'); |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | function tb_remove() { |