From f97146be98e36f7a657c07c9c0a7f05f2e895ef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=93=E3=81=91=E3=81=A3=E3=81=A1?= Date: Sat, 17 Sep 2022 00:07:58 +0900 Subject: [PATCH] fix: disable at mobile and creanup code --- .../client/src/components/MkUrlPreview.vue | 6 +- packages/client/src/pages/ytplayer.vue | 72 ++++++++++--------- 2 files changed, 44 insertions(+), 34 deletions(-) diff --git a/packages/client/src/components/MkUrlPreview.vue b/packages/client/src/components/MkUrlPreview.vue index 02ee4b1b9..2f49d4793 100644 --- a/packages/client/src/components/MkUrlPreview.vue +++ b/packages/client/src/components/MkUrlPreview.vue @@ -10,7 +10,7 @@
- +
@@ -37,6 +37,7 @@ import { onMounted, onUnmounted } from 'vue'; import { url as local, lang } from '@/config'; import { i18n } from '@/i18n'; import * as os from '@/os'; +import { deviceKind } from '@/scripts/device-kind'; const props = withDefaults(defineProps<{ url: string; @@ -47,6 +48,9 @@ const props = withDefaults(defineProps<{ compact: false, }); +const MOBILE_THRESHOLD = 500; +const isMobile = $ref(deviceKind === 'smartphone' || window.innerWidth <= MOBILE_THRESHOLD); + const self = props.url.startsWith(local); const attr = self ? 'to' : 'href'; const target = self ? null : '_blank'; diff --git a/packages/client/src/pages/ytplayer.vue b/packages/client/src/pages/ytplayer.vue index 14f356ca2..bbd758ece 100644 --- a/packages/client/src/pages/ytplayer.vue +++ b/packages/client/src/pages/ytplayer.vue @@ -6,15 +6,14 @@ - +