better way to manage loading overlay

This commit is contained in:
gorhill 2014-08-21 12:35:45 -04:00
parent c43fa70fe1
commit c8f796b40d
1 changed files with 2 additions and 5 deletions

View File

@ -33,7 +33,6 @@ var cosmeticSwitch = true;
var externalLists = ''; var externalLists = '';
var cacheWasPurged = false; var cacheWasPurged = false;
var needUpdate = false; var needUpdate = false;
var loading = false;
/******************************************************************************/ /******************************************************************************/
@ -42,7 +41,7 @@ messaging.start('3p-filters.js');
var onMessage = function(msg) { var onMessage = function(msg) {
switch ( msg.what ) { switch ( msg.what ) {
case 'loadUbiquitousBlacklistCompleted': case 'loadUbiquitousBlacklistCompleted':
loading = false; uDom('body').toggleClass('loading', false);
renderBlacklists(); renderBlacklists();
break; break;
@ -291,7 +290,6 @@ var listsContentChanged = function() {
// This is to give a visual hint that the selection of blacklists has changed. // This is to give a visual hint that the selection of blacklists has changed.
var updateWidgets = function() { var updateWidgets = function() {
uDom('body').toggleClass('loading', loading);
uDom('#buttonApply').toggleClass('enabled', listsSelectionChanged()); uDom('#buttonApply').toggleClass('enabled', listsSelectionChanged());
uDom('#buttonUpdate').toggleClass('enabled', listsContentChanged()); uDom('#buttonUpdate').toggleClass('enabled', listsContentChanged());
}; };
@ -342,8 +340,7 @@ var onPurgeClicked = function() {
var reloadAll = function(update) { var reloadAll = function(update) {
// Loading may take a while when resoruces are fetched from remote // Loading may take a while when resoruces are fetched from remote
// servers. We do not want the user to force reload while we are reloading. // servers. We do not want the user to force reload while we are reloading.
loading = true; uDom('body').toggleClass('loading', true);
updateWidgets();
// Reload blacklists // Reload blacklists
messaging.tell({ messaging.tell({