1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-15 07:22:28 +02:00
This commit is contained in:
gorhill 2014-09-15 14:28:07 -04:00
parent 36236e7537
commit 2c7b8800b7

View File

@ -442,26 +442,27 @@
// revisited.
µBlock.reloadPresetBlacklists = function(switches, update) {
var presetBlacklists = this.remoteBlacklists;
var µb = µBlock;
var onFilterListsReady = function() {
µb.loadUpdatableAssets({ update: update, psl: update });
};
// Toggle switches, if any
if ( switches !== undefined ) {
var filterLists = this.remoteBlacklists;
var i = switches.length;
while ( i-- ) {
if ( !presetBlacklists[switches[i].location] ) {
if ( filterLists.hasOwnProperty(switches[i].location) === false ) {
continue;
}
presetBlacklists[switches[i].location].off = !!switches[i].off;
filterLists[switches[i].location].off = !!switches[i].off;
}
// Save switch states
chrome.storage.local.set({ 'remoteBlacklists': presetBlacklists }, function() {
µBlock.getBytesInUse();
});
chrome.storage.local.set({ 'remoteBlacklists': filterLists }, onFilterListsReady);
} else {
onFilterListsReady();
}
// Now force reload
this.loadUpdatableAssets({ update: update, psl: update });
};
/******************************************************************************/