From b5e323e91ed9d5b6b435e2ff91219c508c1e1bc2 Mon Sep 17 00:00:00 2001 From: gorhill Date: Fri, 4 Jul 2014 12:32:18 -0400 Subject: [PATCH] this fixes #44 --- assets/ublock/filter-lists.json | 2 +- assets/update-3rdparties.sh | 4 ++-- js/storage.js | 33 ++++++++++++++++++++++++--------- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/assets/ublock/filter-lists.json b/assets/ublock/filter-lists.json index 5218da16e..da55540ca 100644 --- a/assets/ublock/filter-lists.json +++ b/assets/ublock/filter-lists.json @@ -101,7 +101,7 @@ "off": true, "title": "Liste AR" }, - "adblock-czechoslovaklist.googlecode.com/svn/filters.txt": { + "raw.githubusercontent.com/tomasko126/easylistczechandslovak/master": { "off": true, "title": "EasyList Czech and Slovak" }, diff --git a/assets/update-3rdparties.sh b/assets/update-3rdparties.sh index 9afe93f6d..b653d06a3 100755 --- a/assets/update-3rdparties.sh +++ b/assets/update-3rdparties.sh @@ -34,7 +34,7 @@ THIRDPARTY_REMOTEURLS=( 'http://stanev.org/abp/adblock_bg.txt' 'http://indonesianadblockrules.googlecode.com/hg/subscriptions/abpindo.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/AdBlockPlusIsrael/EasyListHebrew/master/EasyListHebrew.txt' 'http://download.wiltteri.net/wiltteri.txt' @@ -71,7 +71,7 @@ THIRDPARTY_LOCALURLS=( 'thirdparties/stanev.org/abp/adblock_bg.txt' 'thirdparties/indonesianadblockrules.googlecode.com/hg/subscriptions/abpindo.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/AdBlockPlusIsrael/EasyListHebrew/master/EasyListHebrew.txt' 'thirdparties/download.wiltteri.net/wiltteri.txt' diff --git a/js/storage.js b/js/storage.js index 673a8fe43..0c3a373ec 100644 --- a/js/storage.js +++ b/js/storage.js @@ -81,7 +81,6 @@ /******************************************************************************/ µBlock.loadUbiquitousBlacklists = function() { - var blacklists; var blacklistLoadCount; var obsoleteBlacklists = []; @@ -124,21 +123,37 @@ var loadBlacklistsStart = function(store) { var µb = µBlock; + // rhill 2013-12-10: set all existing entries to `false`. µb.abpFilters.reset(); µb.abpHideFilters.reset(); - blacklists = store.remoteBlacklists; - var blacklistLocations = Object.keys(store.remoteBlacklists); + var storedLists = store.remoteBlacklists; + var storedListLocations = Object.keys(storedLists); - blacklistLoadCount = blacklistLocations.length; + blacklistLoadCount = storedListLocations.length; if ( blacklistLoadCount === 0 ) { loadBlacklistsEnd(); 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. var location; - while ( location = blacklistLocations.pop() ) { + while ( location = storedListLocations.pop() ) { // If loaded list location is not part of default list locations, // remove its entry from local storage. if ( !µb.remoteBlacklists[location] ) { @@ -148,15 +163,15 @@ } // https://github.com/gorhill/httpswitchboard/issues/218 // Transfer potentially existing list title into restored list data. - if ( store.remoteBlacklists[location].title !== µb.remoteBlacklists[location].title ) { - store.remoteBlacklists[location].title = µb.remoteBlacklists[location].title; + if ( storedLists[location].title !== µb.remoteBlacklists[location].title ) { + storedLists[location].title = µb.remoteBlacklists[location].title; } // Store details of this preset blacklist - µb.remoteBlacklists[location] = store.remoteBlacklists[location]; + µb.remoteBlacklists[location] = storedLists[location]; // rhill 2013-12-09: // Ignore list if disabled // https://github.com/gorhill/httpswitchboard/issues/78 - if ( store.remoteBlacklists[location].off ) { + if ( storedLists[location].off ) { blacklistLoadCount -= 1; continue; }