Added custom search engine

This commit is contained in:
maikelthedev 2023-07-30 09:47:50 +00:00 committed by Laura Hausmann
parent ef5accd92c
commit e1481fc8ee
No known key found for this signature in database
GPG Key ID: D044E84C5BE01605
4 changed files with 6 additions and 2 deletions

View File

@ -0,0 +1 @@
export const engine = "https://www.google.com/search?q="

View File

@ -3,6 +3,7 @@ import type * as mfm from "mfm-js";
import config from "@/config/index.js";
import { intersperse } from "@/prelude/array.js";
import type { IMentionedRemoteUsers } from "@/models/entities/note.js";
import { engine } from "@/config/sane-defaults.js";
export function toHtml(
nodes: mfm.MfmNode[] | null,
@ -156,7 +157,7 @@ export function toHtml(
search(node) {
const a = doc.createElement("a");
a.href = `https://search.annoyingorange.xyz/search?q=${node.props.query}`;
a.href = `${engine}{node.props.query}`;
a.textContent = node.props.content;
return a;
},

View File

@ -11,6 +11,7 @@
<script lang="ts" setup>
import { ref } from "vue";
import { i18n } from "@/i18n";
import {engine} from "../../../../sane-defaults"
const props = defineProps<{
q: string;
@ -20,7 +21,7 @@ const query = ref(props.q);
const search = () => {
window.open(
`https://search.annoyingorange.xyz/search?q=${query.value}`,
`${engine}${query.value}`,
"_blank",
);
};

1
sane-defaults.js Normal file
View File

@ -0,0 +1 @@
export const engine = "https://www.google.com/search?q="