diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2020-01-30 04:37:25 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-30 04:37:25 +0900 |
| commit | f6154dc0af1a0d65819e87240f4385f9573095cb (patch) | |
| tree | 699a5ca07d6727b7f8497d4769f25d6d62f94b5a /src/client/app/common/scripts/search.ts | |
| parent | Add Event activity-type support (#5785) (diff) | |
| download | misskey-f6154dc0af1a0d65819e87240f4385f9573095cb.tar.gz misskey-f6154dc0af1a0d65819e87240f4385f9573095cb.tar.bz2 misskey-f6154dc0af1a0d65819e87240f4385f9573095cb.zip | |
v12 (#5712)
Co-authored-by: MeiMei <30769358+mei23@users.noreply.github.com>
Co-authored-by: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com>
Diffstat (limited to 'src/client/app/common/scripts/search.ts')
| -rw-r--r-- | src/client/app/common/scripts/search.ts | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/src/client/app/common/scripts/search.ts b/src/client/app/common/scripts/search.ts deleted file mode 100644 index 2897ed6318..0000000000 --- a/src/client/app/common/scripts/search.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { faHistory } from '@fortawesome/free-solid-svg-icons'; - -export async function search(v: any, q: string) { - q = q.trim(); - - if (q.startsWith('@') && !q.includes(' ')) { - v.$router.push(`/${q}`); - return; - } - - if (q.startsWith('#')) { - v.$router.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); - } - - v.$root.$emit('warp', date); - v.$root.dialog({ - icon: faHistory, - splash: true, - }); - return; - } - - if (q.startsWith('https://')) { - const dialog = v.$root.dialog({ - type: 'waiting', - text: v.$t('@.fetching-as-ap-object'), - showOkButton: false, - showCancelButton: false, - cancelableByBgClick: false - }); - - try { - const res = await v.$root.api('ap/show', { - uri: q - }); - dialog.close(); - if (res.type == 'User') { - v.$router.push(`/@${res.object.username}@${res.object.host}`); - } else if (res.type == 'Note') { - v.$router.push(`/notes/${res.object.id}`); - } - } catch (e) { - dialog.close(); - // TODO: Show error - } - - return; - } - - v.$router.push(`/search?q=${encodeURIComponent(q)}`); -} |