Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kagi.ts search-engine #483

Merged
merged 1 commit into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ This extension is available in the below search engines.
| Brave \*3 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| DuckDuckGo | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Ecosia | :heavy_check_mark: | | | |
| Kagi | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Qwant | :heavy_check_mark: | :heavy_check_mark: | \*1 | :heavy_check_mark: |
| SearX \*2 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Startpage | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: |
Expand Down
1 change: 1 addition & 0 deletions src/_locales/de/messages.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export default exportAsMessages({
searchEngines_braveName: "Brave",
searchEngines_duckduckgoName: "DuckDuckGo",
searchEngines_ecosiaName: "Ecosia",
searchEngines_kagiName: "Kagi",
searchEngines_qwantName: "Qwant",
searchEngines_searxName: "SearX",
searchEngines_qwantDescription:
Expand Down
3 changes: 3 additions & 0 deletions src/_locales/en/messages.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,9 @@ export default exportAsMessages({
// The localized name of Ecosia.
searchEngines_ecosiaName: "Ecosia",

// The localized name of Kagi.
searchEngines_kagiName: "Kagi",

// The localized name of Qwant.
searchEngines_qwantName: "Qwant",

Expand Down
1 change: 1 addition & 0 deletions src/_locales/es/messages.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ export default exportAsMessages({
searchEngines_braveName: "Brave",
searchEngines_duckduckgoName: "DuckDuckGo",
searchEngines_ecosiaName: "Ecosia",
searchEngines_kagiName: "Kagi",
searchEngines_qwantName: "Qwant",
searchEngines_searxName: "SearX",
searchEngines_startpageName: "Startpage.com",
Expand Down
1 change: 1 addition & 0 deletions src/_locales/fr/messages.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export default exportAsMessages({
searchEngines_bingName: "Bing",
searchEngines_duckduckgoName: "DuckDuckGo",
searchEngines_ecosiaName: "Ecosia",
searchEngines_kagiName: "Kagi",
searchEngines_qwantName: "Qwant",
searchEngines_searxName: "SearX",
searchEngines_qwantDescription:
Expand Down
1 change: 1 addition & 0 deletions src/_locales/pl/messages.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export default exportAsMessages({
searchEngines_braveName: "Brave",
searchEngines_duckduckgoName: "DuckDuckGo",
searchEngines_ecosiaName: "Ecosia",
searchEngines_kagiName: "Kagi",
searchEngines_qwantName: "Qwant",
searchEngines_searxName: "SearX",
searchEngines_qwantDescription: 'Wyłącz "Odtwarzaj filmy na Qwant.com".',
Expand Down
1 change: 1 addition & 0 deletions src/_locales/pt_BR/messages.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export default exportAsMessages({
searchEngines_braveName: "Brave",
searchEngines_duckduckgoName: "DuckDuckGo",
searchEngines_ecosiaName: "Ecosia",
searchEngines_kagiName: "Kagi",
searchEngines_qwantName: "Qwant",
searchEngines_searxName: "SearX",
searchEngines_qwantDescription:
Expand Down
1 change: 1 addition & 0 deletions src/_locales/ru/messages.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export default exportAsMessages({
searchEngines_braveName: "Brave",
searchEngines_duckduckgoName: "DuckDuckGo",
searchEngines_ecosiaName: "Ecosia",
searchEngines_kagiName: "Kagi",
searchEngines_qwantName: "Qwant",
searchEngines_searxName: "SearX",
searchEngines_startpageName: "Startpage.com",
Expand Down
1 change: 1 addition & 0 deletions src/_locales/uk/messages.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export default exportAsMessages({
searchEngines_braveName: "Brave",
searchEngines_duckduckgoName: "DuckDuckGo",
searchEngines_ecosiaName: "Ecosia",
searchEngines_kagiName: "Kagi",
searchEngines_qwantName: "Qwant",
searchEngines_searxName: "SearX",
searchEngines_startpageName: "Startpage.com",
Expand Down
1 change: 1 addition & 0 deletions src/_locales/zh_CN/messages.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export default exportAsMessages({
searchEngines_braveName: "Brave",
searchEngines_duckduckgoName: "DuckDuckGo",
searchEngines_ecosiaName: "Ecosia",
searchEngines_kagiName: "Kagi",
searchEngines_qwantName: "Qwant",
searchEngines_searxName: "SearX",
searchEngines_startpageName: "Startpage.com",
Expand Down
1 change: 1 addition & 0 deletions src/_locales/zh_TW/messages.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export default exportAsMessages({
searchEngines_braveName: "Brave",
searchEngines_duckduckgoName: "DuckDuckGo",
searchEngines_ecosiaName: "Ecosia",
searchEngines_kagiName: "Kagi",
searchEngines_qwantName: "Qwant",
searchEngines_searxName: "SearX",
searchEngines_qwantDescription: "請關閉「總是在 Qwant.com 播放影片」選項。",
Expand Down
1 change: 1 addition & 0 deletions src/common/locales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export type MessageName =
| "searchEngines_braveName"
| "searchEngines_duckduckgoName"
| "searchEngines_ecosiaName"
| "searchEngines_kagiName"
| "searchEngines_qwantName"
| "searchEngines_qwantDescription"
| "searchEngines_searxName"
Expand Down
18 changes: 18 additions & 0 deletions src/common/search-engines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type SearchEngineId =
| "brave"
| "duckduckgo"
| "ecosia"
| "kagi"
| "qwant"
| "searx"
| "startpage"
Expand Down Expand Up @@ -313,6 +314,23 @@ export const SEARCH_ENGINES: Readonly<
name: "searchEngines_ecosiaName",
},
},
kagi: {
contentScripts: [
{
matches: [
"https://kagi.com/search?*",
"https://kagi.com/images?*",
"https://kagi.com/videos?*",
"https://kagi.com/news?*",
"https://kagi.com/podcasts?*",
],
runAt: "document_idle",
},
],
messageNames: {
name: "searchEngines_kagiName",
},
},
qwant: {
contentScripts: [
{
Expand Down
2 changes: 2 additions & 0 deletions src/scripts/search-engines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { brave } from "./search-engines/brave.ts";
import { duckduckgo } from "./search-engines/duckduckgo.ts";
import { ecosia } from "./search-engines/ecosia.ts";
import { google } from "./search-engines/google.ts";
import { kagi } from "./search-engines/kagi.ts";
import { qwant } from "./search-engines/qwant.ts";
import { searx } from "./search-engines/searx.ts";
import { startpage } from "./search-engines/startpage.ts";
Expand All @@ -18,6 +19,7 @@ export const SEARCH_ENGINES: Readonly<
brave,
duckduckgo,
ecosia,
kagi,
qwant,
searx,
startpage,
Expand Down
43 changes: 43 additions & 0 deletions src/scripts/search-engines/kagi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { SEARCH_ENGINES } from "../../common/search-engines.ts";
import type { SearchEngine, SerpHandler } from "../types.ts";
import { getDialogThemeFromBody, handleSerp } from "./helpers.ts";

function getSerpHandler(): SerpHandler {
return handleSerp({
// https://github.com/iorate/ublacklist/pull/374
delay: 400,

globalStyle: {
'[data-ub-blocked="visible"]': {
backgroundColor:
"var(--ub-block-color, rgba(255, 192, 192, 0.5)) !important",
},
".ub-button:hover": {
textDecoration: "underline",
},
},
controlHandlers: [
{
target: "._ext_filter_box",
position: "afterend",
style: "_ub_filter_box",
},
],
entryHandlers: [
// All
{
target: "._ext_r",
url: "._ext_u",
title: "._ext_t",
actionTarget: "._ext_a",
actionStyle: "_ub_act_btn_box",
},
],
getDialogTheme: getDialogThemeFromBody(),
});
}

export const kagi: Readonly<SearchEngine> = {
...SEARCH_ENGINES.kagi,
getSerpHandler,
};
6 changes: 5 additions & 1 deletion website/docs/advanced-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Comments begin with `#`. Although any line that cannot be interpreted as a rule

## Other search engines {#other-search-engines}

This extension supports [Bing](#bing), [Brave](#brave) (partially), [DuckDuckGo](#duckduckgo), [Ecosia](#ecosia) (partially), [Qwant](#qwant), [SearX](#searx) (partially), [Startpage.com](#startpagecom), [Yahoo! JAPAN](#yahoo-japan) (partially) and [Yandex](#yandex) (partially). This feature is disabled by default and can be enabled in the options page.
This extension supports [Bing](#bing), [Brave](#brave) (partially), [DuckDuckGo](#duckduckgo), [Ecosia](#ecosia) (partially), [Kagi](#kagi), [Qwant](#qwant), [SearX](#searx) (partially), [Startpage.com](#startpagecom), [Yahoo! JAPAN](#yahoo-japan) (partially) and [Yandex](#yandex) (partially). This feature is disabled by default and can be enabled in the options page.

![other search engines](/img/advanced-features/other-search-engines-1.png)

Expand All @@ -110,6 +110,10 @@ You can also enable it by clicking the toolbar icon when a search result page is

![ecosia](/img/advanced-features/ecosia.png)

### Kagi {#kagi}

![kagi](/img/advanced-features/kagi.png)

### Qwant {#qwant}

"Videos" search will only work if you disable qwant custom links by clicking on "Always read on Qwant.com".
Expand Down
2 changes: 1 addition & 1 deletion website/docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ uBlacklist is a Google Search filter for Chrome, Firefox and Safari.
- Block sites with specific URLs using match patterns or regular expressions
- Block sites with specific titles using regular expressions
- Highlight sites
- Support Bing, Brave, DuckDuckGo, Ecosia, Qwant, Searx, Startpage.com, Yahoo! JAPAN and Yandex
- Support Bing, Brave, DuckDuckGo, Ecosia, Kagi, Qwant, Searx, Startpage.com, Yahoo! JAPAN and Yandex
- Synchronize block rules among devices using Google Drive or Dropbox
- Subscribe to public block rules
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ sidebar_position: 2

## Google 以外の検索エンジン {#other-search-engines}

[Bing](#bing)、[Brave](#brave)、[DuckDuckGo](#duckduckgo)、[Ecosia](#ecosia)、[Qwant](#qwant)、[SearX](#searx)、[Startpage.com](#startpagecom)、[Yahoo! JAPAN](#yahoo-japan)、[Yandex](#yandex) がサポートされています。この機能はデフォルトで無効ですが、オプションページで有効にすることができます。
[Bing](#bing)、[Brave](#brave)、[DuckDuckGo](#duckduckgo)、[Ecosia](#ecosia)、[Kagi](#kagi)、[Qwant](#qwant)、[SearX](#searx)、[Startpage.com](#startpagecom)、[Yahoo! JAPAN](#yahoo-japan)、[Yandex](#yandex) がサポートされています。この機能はデフォルトで無効ですが、オプションページで有効にすることができます。

![その他の検索エンジン](/img/advanced-features/other-search-engines-1.png)

Expand All @@ -110,6 +110,10 @@ sidebar_position: 2

![ecosia](/img/advanced-features/ecosia.png)

### Kagi {#kagi}

![kagi](/img/advanced-features/kagi.png)

### Qwant {#qwant}

動画検索上では、"Always read on Qwant.com" を無効にする必要があります。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ uBlacklist は Google の検索結果をフィルタリングするブラウザ
- マッチパターンまたは正規表現でブロックするサイトの URL を指定できます
- 正規表現でブロックするサイトのタイトルを指定できます
- サイトをハイライトできます
- Bing、Brave、DuckDuckGo、Ecosia、Qwant、SearX、Startpage.com、Yahoo! JAPAN、Yandex でも使用できます
- Bing、Brave、DuckDuckGo、Ecosia、Kagi、Qwant、SearX、Startpage.com、Yahoo! JAPAN、Yandex でも使用できます
- ルールを Google ドライブまたは Dropbox で同期できます
- 公開されたルールを購読できます
Binary file added website/static/img/advanced-features/kagi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.