Skip to content

Commit

Permalink
Merge pull request #491 from iorate/fix-ecosia
Browse files Browse the repository at this point in the history
Fix Ecosia support
  • Loading branch information
iorate committed Jun 16, 2024
2 parents 612d2bf + 8b60121 commit 7ccc94b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/common/search-engines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export const SEARCH_ENGINES: Readonly<
contentScripts: [
{
matches: ["https://www.ecosia.org/search?*"],
runAt: "document_start",
runAt: "document_idle",
},
],
messageNames: {
Expand Down
6 changes: 5 additions & 1 deletion src/scripts/search-engines/ecosia.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SEARCH_ENGINES } from "../../common/search-engines.ts";
import type { SearchEngine, SerpHandler } from "../types.ts";
import { handleSerp } from "./helpers.ts";
import { handleSerp, hasDarkBackground } from "./helpers.ts";

function getSerpHandler(): SerpHandler {
return handleSerp({
Expand Down Expand Up @@ -46,6 +46,10 @@ function getSerpHandler(): SerpHandler {
$site: "ecosia",
$category: "web",
},
getDialogTheme: () => {
const layout = document.querySelector<HTMLElement>(".layout");
return layout && hasDarkBackground(layout) ? "dark" : "light";
},
});
}

Expand Down

0 comments on commit 7ccc94b

Please sign in to comment.