This commit is contained in:
gorhill 2015-06-08 08:09:08 -04:00
parent c52b4bb780
commit b51e951536
2 changed files with 16 additions and 13 deletions

View File

@ -39,7 +39,6 @@ var oneHour = 60 * oneMinute;
var defaultExternalLists = [
'! Examples:',
'! https://easylist-downloads.adblockplus.org/antiadblockfilters.txt',
'! https://easylist-downloads.adblockplus.org/fb_annoyances_full.txt',
'! https://easylist-downloads.adblockplus.org/fb_annoyances_sidebar.txt',
'! https://easylist-downloads.adblockplus.org/fb_annoyances_newsfeed.txt',

View File

@ -443,19 +443,23 @@
var µb = this;
var onRawListLoaded = function(details) {
if ( details.content !== '' ) {
var listMeta = µb.remoteBlacklists[path];
if ( listMeta && listMeta.title === '' ) {
var matches = details.content.slice(0, 1024).match(/(?:^|\n)!\s*Title:([^\n]+)/i);
if ( matches !== null ) {
listMeta.title = matches[1].trim();
}
}
//console.debug('µBlock.getCompiledFilterList/onRawListLoaded: compiling "%s"', path);
details.content = µb.compileFilters(details.content);
µb.assets.put(compiledPath, details.content);
if ( details.content === '' ) {
callback(details);
return;
}
var listMeta = µb.remoteBlacklists[path];
// https://github.com/gorhill/uBlock/issues/313
// Always try to fetch the name if this is an external filter list.
if ( listMeta && listMeta.title === '' || /^https?:/.test(path) ) {
var matches = details.content.slice(0, 1024).match(/(?:^|\n)!\s*Title:([^\n]+)/i);
if ( matches !== null ) {
listMeta.title = matches[1].trim();
}
}
//console.debug('µBlock.getCompiledFilterList/onRawListLoaded: compiling "%s"', path);
details.content = µb.compileFilters(details.content);
µb.assets.put(compiledPath, details.content);
callback(details);
};