1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-19 11:18:42 +02:00

this fixes #44

This commit is contained in:
gorhill 2014-07-04 12:32:18 -04:00
parent 60295031df
commit b5e323e91e
3 changed files with 27 additions and 12 deletions

View File

@ -101,7 +101,7 @@
"off": true, "off": true,
"title": "Liste AR" "title": "Liste AR"
}, },
"adblock-czechoslovaklist.googlecode.com/svn/filters.txt": { "raw.githubusercontent.com/tomasko126/easylistczechandslovak/master": {
"off": true, "off": true,
"title": "EasyList Czech and Slovak" "title": "EasyList Czech and Slovak"
}, },

View File

@ -34,7 +34,7 @@ THIRDPARTY_REMOTEURLS=(
'http://stanev.org/abp/adblock_bg.txt' 'http://stanev.org/abp/adblock_bg.txt'
'http://indonesianadblockrules.googlecode.com/hg/subscriptions/abpindo.txt' 'http://indonesianadblockrules.googlecode.com/hg/subscriptions/abpindo.txt'
'http://liste-ar-adblock.googlecode.com/hg/Liste_AR.txt' 'http://liste-ar-adblock.googlecode.com/hg/Liste_AR.txt'
'http://adblock-czechoslovaklist.googlecode.com/svn/filters.txt' 'https://raw.githubusercontent.com/tomasko126/easylistczechandslovak/master/filters.txt'
'https://raw.githubusercontent.com/adblockpolska/Adblock_PL_List/master/adblock_polska.txt' 'https://raw.githubusercontent.com/adblockpolska/Adblock_PL_List/master/adblock_polska.txt'
'https://raw.githubusercontent.com/AdBlockPlusIsrael/EasyListHebrew/master/EasyListHebrew.txt' 'https://raw.githubusercontent.com/AdBlockPlusIsrael/EasyListHebrew/master/EasyListHebrew.txt'
'http://download.wiltteri.net/wiltteri.txt' 'http://download.wiltteri.net/wiltteri.txt'
@ -71,7 +71,7 @@ THIRDPARTY_LOCALURLS=(
'thirdparties/stanev.org/abp/adblock_bg.txt' 'thirdparties/stanev.org/abp/adblock_bg.txt'
'thirdparties/indonesianadblockrules.googlecode.com/hg/subscriptions/abpindo.txt' 'thirdparties/indonesianadblockrules.googlecode.com/hg/subscriptions/abpindo.txt'
'thirdparties/liste-ar-adblock.googlecode.com/hg/Liste_AR.txt' 'thirdparties/liste-ar-adblock.googlecode.com/hg/Liste_AR.txt'
'thirdparties/adblock-czechoslovaklist.googlecode.com/svn/filters.txt' 'thirdparties/raw.githubusercontent.com/tomasko126/easylistczechandslovak/master/filters.txt'
'thirdparties/raw.githubusercontent.com/adblockpolska/Adblock_PL_List/master/adblock_polska.txt' 'thirdparties/raw.githubusercontent.com/adblockpolska/Adblock_PL_List/master/adblock_polska.txt'
'thirdparties/raw.githubusercontent.com/AdBlockPlusIsrael/EasyListHebrew/master/EasyListHebrew.txt' 'thirdparties/raw.githubusercontent.com/AdBlockPlusIsrael/EasyListHebrew/master/EasyListHebrew.txt'
'thirdparties/download.wiltteri.net/wiltteri.txt' 'thirdparties/download.wiltteri.net/wiltteri.txt'

View File

@ -81,7 +81,6 @@
/******************************************************************************/ /******************************************************************************/
µBlock.loadUbiquitousBlacklists = function() { µBlock.loadUbiquitousBlacklists = function() {
var blacklists;
var blacklistLoadCount; var blacklistLoadCount;
var obsoleteBlacklists = []; var obsoleteBlacklists = [];
@ -124,21 +123,37 @@
var loadBlacklistsStart = function(store) { var loadBlacklistsStart = function(store) {
var µb = µBlock; var µb = µBlock;
// rhill 2013-12-10: set all existing entries to `false`. // rhill 2013-12-10: set all existing entries to `false`.
µb.abpFilters.reset(); µb.abpFilters.reset();
µb.abpHideFilters.reset(); µb.abpHideFilters.reset();
blacklists = store.remoteBlacklists; var storedLists = store.remoteBlacklists;
var blacklistLocations = Object.keys(store.remoteBlacklists); var storedListLocations = Object.keys(storedLists);
blacklistLoadCount = blacklistLocations.length; blacklistLoadCount = storedListLocations.length;
if ( blacklistLoadCount === 0 ) { if ( blacklistLoadCount === 0 ) {
loadBlacklistsEnd(); loadBlacklistsEnd();
return; return;
} }
// Backward compatibility for when a list changes location
var relocations = [
{
// https://github.com/gorhill/httpswitchboard/issues/361
'bad': 'assets/thirdparties/adblock-czechoslovaklist.googlecode.com/svn/filters.txt',
'good': 'assets/thirdparties/raw.githubusercontent.com/tomasko126/easylistczechandslovak/master'
}
];
var relocation;
while ( relocation = relocations.pop() ) {
if ( µb.remoteBlacklists[relocation.good] && storedLists[relocation.bad] ) {
storedLists[relocation.good].off = storedLists[relocation.bad].off;
}
}
// Load each preset blacklist which is not disabled. // Load each preset blacklist which is not disabled.
var location; var location;
while ( location = blacklistLocations.pop() ) { while ( location = storedListLocations.pop() ) {
// If loaded list location is not part of default list locations, // If loaded list location is not part of default list locations,
// remove its entry from local storage. // remove its entry from local storage.
if ( !µb.remoteBlacklists[location] ) { if ( !µb.remoteBlacklists[location] ) {
@ -148,15 +163,15 @@
} }
// https://github.com/gorhill/httpswitchboard/issues/218 // https://github.com/gorhill/httpswitchboard/issues/218
// Transfer potentially existing list title into restored list data. // Transfer potentially existing list title into restored list data.
if ( store.remoteBlacklists[location].title !== µb.remoteBlacklists[location].title ) { if ( storedLists[location].title !== µb.remoteBlacklists[location].title ) {
store.remoteBlacklists[location].title = µb.remoteBlacklists[location].title; storedLists[location].title = µb.remoteBlacklists[location].title;
} }
// Store details of this preset blacklist // Store details of this preset blacklist
µb.remoteBlacklists[location] = store.remoteBlacklists[location]; µb.remoteBlacklists[location] = storedLists[location];
// rhill 2013-12-09: // rhill 2013-12-09:
// Ignore list if disabled // Ignore list if disabled
// https://github.com/gorhill/httpswitchboard/issues/78 // https://github.com/gorhill/httpswitchboard/issues/78
if ( store.remoteBlacklists[location].off ) { if ( storedLists[location].off ) {
blacklistLoadCount -= 1; blacklistLoadCount -= 1;
continue; continue;
} }