Skip to content

Commit

Permalink
feat: support startpage.com #42
Browse files Browse the repository at this point in the history
  • Loading branch information
EINDEX committed Oct 29, 2023
1 parent 2191dc5 commit 6e80565
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions src/pages/content/searchingEngines/searchingEngines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,29 +208,27 @@ export class Kagi extends SearchingEngine {
return container;
}
}
export class Startpage extends SearchingEngine {
isMatch(): boolean {
const match = window.location.hostname.match(/startpage\.com$/g);
return !!match;
}

getQuery(): string | null {
const query = document.querySelector('#q')?.getAttribute('value') || null;
return query;
}

// todo try to support brave search but the CSP ban the inline sytle.
// export class Brave extends SearchingEngine {
// isMatch(): boolean {
// const match = window.location.hostname.match(/search\.brave\.com$/g);
// return !!match;
// }

// getQuery(): string | null {
// const searchUrl = new URL(window.location.href);
// const query = searchUrl.searchParams.get('q');

// return query;
// }

// gotElement(): Element {
// const container = document.createElement('div');
// const asideElement = document.querySelector('#side-right');
// container.style.paddingTop = '20px';
// asideElement!.insertBefore(container, asideElement!.firstChild);
// return container;
// }
// }
gotElement(): Element {
const container = document.createElement('div');
const asideElement = document.querySelector(
'div.layout-web__sidebar.layout-web__sidebar--web',
);

asideElement!.insertBefore(container, asideElement!.firstChild);
return container;
}
}

const searchEngins = [
new Google(),
Expand All @@ -239,8 +237,8 @@ const searchEngins = [
new Yandex(),
new SearX(),
new Kagi(),
// new Brave(),
new Baidu(),
new Startpage(),
];

export default searchEngins;

0 comments on commit 6e80565

Please sign in to comment.