Add support for sublist at any tree depth in "Filter lists" pane

This commit is contained in:
Raymond Hill 2023-06-21 09:11:21 -04:00
parent 9607cba1f6
commit f6954430d1
No known key found for this signature in database
GPG key ID: 25E1490B761470C2
2 changed files with 41 additions and 24 deletions

View file

@ -272,7 +272,7 @@
"adguard-cookies": { "adguard-cookies": {
"content": "filters", "content": "filters",
"group": "annoyances", "group": "annoyances",
"parent": "AdGuard Annoyances", "parent": "AdGuard Annoyances|AdGuard/uBO Cookie Notices",
"off": true, "off": true,
"title": "AdGuard Cookie Notices", "title": "AdGuard Cookie Notices",
"tags": "annoyances cookies", "tags": "annoyances cookies",
@ -280,6 +280,22 @@
"supportURL": "https://github.com/AdguardTeam/AdguardFilters#adguard-filters", "supportURL": "https://github.com/AdguardTeam/AdguardFilters#adguard-filters",
"instructionURL": "https://kb.adguard.com/en/general/adguard-ad-filters" "instructionURL": "https://kb.adguard.com/en/general/adguard-ad-filters"
}, },
"ublock-cookies-adguard": {
"content": "filters",
"group": "annoyances",
"parent": "AdGuard Annoyances|AdGuard/uBO Cookie Notices",
"off": true,
"title": "uBlock filters Cookie Notices",
"tags": "annoyances cookies",
"contentURL": "https://ublockorigin.github.io/uAssets/filters/annoyances-cookies.txt",
"cdnURLs": [
"https://ublockorigin.github.io/uAssetsCDN/filters/annoyances-cookies.txt",
"https://ublockorigin.pages.dev/filters/annoyances-cookies.txt",
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/annoyances-cookies.txt",
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/annoyances-cookies.txt"
],
"supportURL": "https://github.com/uBlockOrigin/uAssets"
},
"adguard-popup-overlays": { "adguard-popup-overlays": {
"content": "filters", "content": "filters",
"group": "annoyances", "group": "annoyances",
@ -368,7 +384,7 @@
"fanboy-cookiemonster": { "fanboy-cookiemonster": {
"content": "filters", "content": "filters",
"group": "annoyances", "group": "annoyances",
"parent": "EasyList/uBO Cookie Notices", "parent": "EasyList Annoyances|EasyList/uBO Cookie Notices",
"off": true, "off": true,
"title": "EasyList Cookie Notices", "title": "EasyList Cookie Notices",
"tags": "annoyances cookies", "tags": "annoyances cookies",
@ -385,6 +401,22 @@
], ],
"supportURL": "https://github.com/easylist/easylist#fanboy-lists" "supportURL": "https://github.com/easylist/easylist#fanboy-lists"
}, },
"ublock-cookies-easylist": {
"content": "filters",
"group": "annoyances",
"parent": "EasyList Annoyances|EasyList/uBO Cookie Notices",
"off": true,
"title": "uBlock filters Cookie Notices",
"tags": "annoyances cookies",
"contentURL": "https://ublockorigin.github.io/uAssets/filters/annoyances-cookies.txt",
"cdnURLs": [
"https://ublockorigin.github.io/uAssetsCDN/filters/annoyances-cookies.txt",
"https://ublockorigin.pages.dev/filters/annoyances-cookies.txt",
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/annoyances-cookies.txt",
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/annoyances-cookies.txt"
],
"supportURL": "https://github.com/uBlockOrigin/uAssets"
},
"easylist-newsletters": { "easylist-newsletters": {
"content": "filters", "content": "filters",
"group": "annoyances", "group": "annoyances",
@ -441,22 +473,6 @@
], ],
"supportURL": "https://easylist.to/" "supportURL": "https://easylist.to/"
}, },
"ublock-cookies": {
"content": "filters",
"group": "annoyances",
"parent": "EasyList/uBO Cookie Notices",
"off": true,
"title": "uBlock filters Cookie Notices",
"tags": "annoyances cookies",
"contentURL": "https://ublockorigin.github.io/uAssets/filters/annoyances-cookies.txt",
"cdnURLs": [
"https://ublockorigin.github.io/uAssetsCDN/filters/annoyances-cookies.txt",
"https://ublockorigin.pages.dev/filters/annoyances-cookies.txt",
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/annoyances-cookies.txt",
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/annoyances-cookies.txt"
],
"supportURL": "https://github.com/uBlockOrigin/uAssets"
},
"ublock-annoyances": { "ublock-annoyances": {
"content": "filters", "content": "filters",
"group": "annoyances", "group": "annoyances",

View file

@ -236,13 +236,14 @@ const renderFilterLists = ( ) => {
} }
const groupDetails = listTree[groupKey]; const groupDetails = listTree[groupKey];
if ( listDetails.parent !== undefined ) { if ( listDetails.parent !== undefined ) {
if ( groupDetails.lists[listDetails.parent] === undefined ) { let lists = groupDetails.lists;
groupDetails.lists[listDetails.parent] = { for ( const parent of listDetails.parent.split('|') ) {
title: listDetails.parent, if ( lists[parent] === undefined ) {
lists: {}, lists[parent] = { title: parent, lists: {} };
}; }
lists = lists[parent].lists;
} }
groupDetails.lists[listDetails.parent].lists[listkey] = listDetails; lists[listkey] = listDetails;
} else { } else {
listDetails.title = listNameFromListKey(listkey); listDetails.title = listNameFromListKey(listkey);
groupDetails.lists[listkey] = listDetails; groupDetails.lists[listkey] = listDetails;