summaryrefslogtreecommitdiff
path: root/packages/frontend/src/scripts
diff options
context:
space:
mode:
authorKhsmty <me@khsmty.com>2023-02-25 09:01:21 +0900
committerGitHub <noreply@github.com>2023-02-25 09:01:21 +0900
commit64be363adca6385104e4af268e2e57a06c4d83a9 (patch)
tree99dc43380b92b6729a1e1789e62df40f24cbc1cb /packages/frontend/src/scripts
parentMerge branch 'develop' of https://github.com/misskey-dev/misskey into develop (diff)
downloadsharkey-64be363adca6385104e4af268e2e57a06c4d83a9.tar.gz
sharkey-64be363adca6385104e4af268e2e57a06c4d83a9.tar.bz2
sharkey-64be363adca6385104e4af268e2e57a06c4d83a9.zip
feat: 2つの検索画面の統合 (#9949) (#10038)
* feat: 検索画面の UI を統一 * fix: エラーの修正 * add: changelog --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Diffstat (limited to 'packages/frontend/src/scripts')
-rw-r--r--packages/frontend/src/scripts/search.ts63
1 files changed, 0 insertions, 63 deletions
diff --git a/packages/frontend/src/scripts/search.ts b/packages/frontend/src/scripts/search.ts
deleted file mode 100644
index 69f1586b77..0000000000
--- a/packages/frontend/src/scripts/search.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-import * as os from '@/os';
-import { i18n } from '@/i18n';
-import { mainRouter } from '@/router';
-
-export async function search() {
- const { canceled, result: query } = await os.inputText({
- title: i18n.ts.search,
- });
- if (canceled || query == null || query === '') return;
-
- const q = query.trim();
-
- if (q.startsWith('@') && !q.includes(' ')) {
- mainRouter.push(`/${q}`);
- return;
- }
-
- if (q.startsWith('#')) {
- mainRouter.push(`/tags/${encodeURIComponent(q.substr(1))}`);
- return;
- }
-
- // like 2018/03/12
- if (/^[0-9]{4}\/[0-9]{2}\/[0-9]{2}/.test(q.replace(/-/g, '/'))) {
- const date = new Date(q.replace(/-/g, '/'));
-
- // 日付しか指定されてない場合、例えば 2018/03/12 ならユーザーは
- // 2018/03/12 のコンテンツを「含む」結果になることを期待するはずなので
- // 23時間59分進める(そのままだと 2018/03/12 00:00:00 「まで」の
- // 結果になってしまい、2018/03/12 のコンテンツは含まれない)
- if (q.replace(/-/g, '/').match(/^[0-9]{4}\/[0-9]{2}\/[0-9]{2}$/)) {
- date.setHours(23, 59, 59, 999);
- }
-
- // TODO
- //v.$root.$emit('warp', date);
- os.alert({
- icon: 'ti ti-history',
- iconOnly: true, autoClose: true,
- });
- return;
- }
-
- if (q.startsWith('https://')) {
- const promise = os.api('ap/show', {
- uri: q,
- });
-
- os.promiseDialog(promise, null, null, i18n.ts.fetchingAsApObject);
-
- const res = await promise;
-
- if (res.type === 'User') {
- mainRouter.push(`/@${res.object.username}@${res.object.host}`);
- } else if (res.type === 'Note') {
- mainRouter.push(`/notes/${res.object.id}`);
- }
-
- return;
- }
-
- mainRouter.push(`/search?q=${encodeURIComponent(q)}`);
-}