From 07f65d8a22d6e14d5df0d499548c26fa66ec151e Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Tue, 12 Aug 2008 12:02:30 +0000 Subject: [PATCH] improve the theme changing so it now checks to see if the stylesheet is loaded before refreshing the ui --- deluge/ui/webui/templates/ajax/static/js/deluge.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/deluge/ui/webui/templates/ajax/static/js/deluge.js b/deluge/ui/webui/templates/ajax/static/js/deluge.js index 779dd9129..a85a86f80 100644 --- a/deluge/ui/webui/templates/ajax/static/js/deluge.js +++ b/deluge/ui/webui/templates/ajax/static/js/deluge.js @@ -1120,11 +1120,19 @@ Deluge.UI = { this.themecss = new Asset.css('/template/static/themes/' + name + '/style.css'); Cookie.write('theme', name); if (this.overlay) { - var temp = function() { + var refresh = function() { this.vbox.refresh(); this.vbox.calculatePositions(); - this.overlay.dispose(); - }.bind(this).delay(500); + this.overlay.dispose(); + }.bind(this); + var check = function() { + if (document.styleSheets[2]) { + if (document.styleSheets[2].href == this.themecss.href) { + refresh(); + $clear(check); + } + } + }.periodical(50, this); }; },