/* * Vencord, a Discord client mod * Copyright (c) 2024 Vendicated and contributors * SPDX-License-Identifier: GPL-3.0-or-later */ import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu"; import { definePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; import { Flex, Menu } from "@webpack/common"; const DefaultEngines = { Google: "https://www.google.com/search?q=", DuckDuckGo: "https://duckduckgo.com/?q=", Brave: "https://search.brave.com/search?q=", Bing: "https://www.bing.com/search?q=", Yahoo: "https://search.yahoo.com/search?p=", Yandex: "https://yandex.com/search/?text=", GitHub: "https://github.com/search?q=", Reddit: "https://www.reddit.com/search?q=", Wikipedia: "https://wikipedia.org/w/index.php?search=", } as const; const settings = definePluginSettings({ customEngineName: { description: "Name of the custom search engine", type: OptionType.STRING, placeholder: "Google" }, customEngineURL: { description: "The URL of your Engine", type: OptionType.STRING, placeholder: "https://google.com/search?q=" } }); function search(src: string, engine: string) { open(engine + encodeURIComponent(src.trim()), "_blank"); } function makeSearchItem(src: string) { let Engines = {}; if (settings.store.customEngineName && settings.store.customEngineURL) { Engines[settings.store.customEngineName] = settings.store.customEngineURL; } Engines = { ...Engines, ...DefaultEngines }; return (