Skip to content

Commit

Permalink
Add support for sublist at any tree depth in "Filter lists" pane
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Jun 21, 2023
1 parent 9607cba commit f695443
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 24 deletions.
52 changes: 34 additions & 18 deletions assets/assets.dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -272,14 +272,30 @@
"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",
"contentURL": "https://filters.adtidy.org/extension/ublock/filters/18.txt",
"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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
13 changes: 7 additions & 6 deletions src/js/3p-filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f695443

Please sign in to comment.