diff --git a/src/3p-filters.html b/src/3p-filters.html index 3163db7c7..29ccb5736 100644 --- a/src/3p-filters.html +++ b/src/3p-filters.html @@ -49,10 +49,10 @@ --> +  --> diff --git a/src/css/3p-filters.css b/src/css/3p-filters.css index b3687bae1..07a549af9 100644 --- a/src/css/3p-filters.css +++ b/src/css/3p-filters.css @@ -133,9 +133,6 @@ li.listEntry span.status { li.listEntry span.status:hover { opacity: 1; } -li.listEntry span.status.fa { - /* font-size: 110%; */ - } li.listEntry span.unsecure { color: darkred; } @@ -151,20 +148,19 @@ li.listEntry.failed span.failed { li.listEntry span.cache { cursor: pointer; } -li.listEntry.cached:not(.updating):not(.obsolete) > input[type="checkbox"]:checked ~ span.cache { +li.listEntry.cached:not(.obsolete) > input[type="checkbox"]:checked ~ span.cache { display: inline-block; } li.listEntry span.obsolete { color: hsl(36, 100%, 40%); } -li.listEntry.obsolete:not(.updating) > input[type="checkbox"]:checked ~ span.obsolete { +body:not(.updating) li.listEntry.obsolete > input[type="checkbox"]:checked ~ span.obsolete { display: inline-block; } li.listEntry span.updating { - border: none; - padding: 0; + transform-origin: 50% 46%; } -li.listEntry.updating span.updating { +body.updating li.listEntry.obsolete span.updating { animation: spin 2s linear infinite; display: inline-block; } diff --git a/src/js/3p-filters.js b/src/js/3p-filters.js index 1b52d5276..f478da3ad 100644 --- a/src/js/3p-filters.js +++ b/src/js/3p-filters.js @@ -40,6 +40,9 @@ var onMessage = function(msg) { case 'assetUpdated': updateAssetStatus(msg); break; + case 'assetsUpdated': + document.body.classList.remove('updating'); + break; case 'staticFilteringDataChanged': renderFilterLists(); break; @@ -139,7 +142,6 @@ var renderFilterLists = function(soft) { lastUpdateTemplateString.replace('{{ago}}', renderElapsedTimeToString(asset.writeTime)) ); } - li.classList.remove('updating'); li.classList.remove('discard'); return li; }; @@ -264,12 +266,10 @@ var renderFilterLists = function(soft) { /******************************************************************************/ -// This is to give a visual hint that the selection of blacklists has changed. - var renderWidgets = function() { uDom('#buttonApply').toggleClass('disabled', filteringSettingsHash === hashFromCurrentFromSettings()); uDom('#buttonPurgeAll').toggleClass('disabled', document.querySelector('#lists .listEntry.cached') === null); - uDom('#buttonUpdate').toggleClass('disabled', document.querySelector('#lists .listEntry.obsolete:not(.updating) > input[type="checkbox"]:checked') === null); + uDom('#buttonUpdate').toggleClass('disabled', document.querySelector('body:not(.updating) #lists .listEntry.obsolete > input[type="checkbox"]:checked') === null); }; /******************************************************************************/ @@ -280,7 +280,6 @@ var updateAssetStatus = function(details) { li.classList.toggle('failed', !!details.failed); li.classList.toggle('obsolete', !details.cached); li.classList.toggle('cached', !!details.cached); - li.classList.remove('updating'); if ( details.cached ) { li.querySelector('.status.cache').setAttribute( 'title', @@ -429,9 +428,7 @@ var buttonApplyHandler = function() { var buttonUpdateHandler = function() { var onSelectionDone = function() { - uDom('#lists .listEntry.obsolete > input[type="checkbox"]:checked') - .ancestors('.listEntry[data-listkey]') - .addClass('updating'); + document.body.classList.add('updating'); messaging.send('dashboard', { what: 'forceUpdateAssets' }); renderWidgets(); }; diff --git a/src/js/assets.js b/src/js/assets.js index 9a29812d7..bf15d395c 100644 --- a/src/js/assets.js +++ b/src/js/assets.js @@ -598,17 +598,25 @@ var assetCacheRemove = function(pattern, callback) { getAssetCacheRegistry(onReady); }; -var assetCacheMarkAsDirty = function(pattern, callback) { +var assetCacheMarkAsDirty = function(pattern, exclude, callback) { var onReady = function() { var cacheDict = assetCacheRegistry, cacheEntry, mustSave = false; for ( var assetKey in cacheDict ) { - if ( pattern instanceof RegExp && !pattern.test(assetKey) ) { - continue; + if ( pattern instanceof RegExp ) { + if ( pattern.test(assetKey) === false ) { continue; } + } else if ( typeof pattern === 'string' ) { + if ( assetKey !== pattern ) { continue; } + } else if ( Array.isArray(pattern) ) { + if ( pattern.indexOf(assetKey) === -1 ) { continue; } } - if ( typeof pattern === 'string' && assetKey !== pattern ) { - continue; + if ( exclude instanceof RegExp ) { + if ( exclude.test(assetKey) ) { continue; } + } else if ( typeof exclude === 'string' ) { + if ( assetKey === exclude ) { continue; } + } else if ( Array.isArray(exclude) ) { + if ( exclude.indexOf(assetKey) !== -1 ) { continue; } } cacheEntry = cacheDict[assetKey]; if ( !cacheEntry.writeTime ) { continue; } @@ -623,7 +631,10 @@ var assetCacheMarkAsDirty = function(pattern, callback) { callback(); } }; - + if ( typeof exclude === 'function' ) { + callback = exclude; + exclude = undefined; + } getAssetCacheRegistry(onReady); }; @@ -887,9 +898,7 @@ api.metadata = function(callback) { /******************************************************************************/ -api.purge = function(pattern, callback) { - assetCacheMarkAsDirty(pattern, callback); -}; +api.purge = assetCacheMarkAsDirty; api.remove = function(pattern, callback) { assetCacheRemove(pattern, callback); diff --git a/src/js/messaging.js b/src/js/messaging.js index d5c780b69..cab4802fe 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -979,8 +979,7 @@ var onMessage = function(request, sender, callback) { if ( request.hard ) { µb.assets.remove(/./); } else { - µb.assets.remove(/compiled\//); - µb.assets.purge(/./); + µb.assets.purge(/./, 'public_suffix_list.dat'); } break; diff --git a/src/js/storage.js b/src/js/storage.js index 782d2da24..7d394f52d 100644 --- a/src/js/storage.js +++ b/src/js/storage.js @@ -1131,6 +1131,10 @@ } else { this.scheduleAssetUpdater(0); } + vAPI.messaging.broadcast({ + what: 'assetsUpdated', + assetKeys: details.assetKeys + }); return; }