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": {
"content": "filters",
"group": "annoyances",
"parent": "AdGuard Annoyances",
"parent": "AdGuard Annoyances|AdGuard/uBO Cookie Notices",
"off": true,
"title": "AdGuard Cookie Notices",
"tags": "annoyances cookies",
@ -280,6 +280,22 @@
"supportURL": "https://github.com/AdguardTeam/AdguardFilters#adguard-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": {
"content": "filters",
"group": "annoyances",
@ -368,7 +384,7 @@
"fanboy-cookiemonster": {
"content": "filters",
"group": "annoyances",
"parent": "EasyList/uBO Cookie Notices",
"parent": "EasyList Annoyances|EasyList/uBO Cookie Notices",
"off": true,
"title": "EasyList Cookie Notices",
"tags": "annoyances cookies",
@ -385,6 +401,22 @@
],
"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": {
"content": "filters",
"group": "annoyances",
@ -441,22 +473,6 @@
],
"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": {
"content": "filters",
"group": "annoyances",

View file

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