Skip to content

Commit

Permalink
feat(duckduckgo): add support for blocking news cards (#488)
Browse files Browse the repository at this point in the history
* Add support for blocking News Cards on DuckDuckGo

* Fix scope issue on blocked News cards.

This revision fixes a problem where blocked news cards were not showing up
after interacting with a control due to a lack of a "scope" property.
  • Loading branch information
aug-dev authored Jun 15, 2024
1 parent da8c3ee commit 4e1e209
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/scripts/search-engines/duckduckgo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,39 @@ const serpHandler = handleSerp({
},
actionButtonStyle: "result__a",
},
// News Cards on the main page
{
scope: "all",
target: ".module--carousel__item",
url: "a",
title: "a",
actionPosition: "afterend",
actionTarget: ".module--carousel__footer",
actionStyle: (actionRoot) => {
actionRoot.className = css({
padding: "0 0.75em",
position: "absolute",
bottom: "6px",
zIndex: "1",
fontSize: "12px",
".is-mobile &": {
padding: "0 16px",
},
});
// Increase card size to include the "Block this site" button:
actionRoot.closest(".module--carousel__items")?.classList.add(
css({
height: "320px",
"& > .module--carousel__item": {
height: "300px",
},
"& .module--carousel__footer": {
bottom: "32px",
},
}),
);
},
},
],
pagerHandlers: [
{
Expand Down

0 comments on commit 4e1e209

Please sign in to comment.