Browse Source

#130

feature/130
みてるぞ 15 hours ago
parent
commit
e7dac653d5
1 changed files with 14 additions and 7 deletions
  1. +14
    -7
      frontend/src/components/PostEmbed.tsx

+ 14
- 7
frontend/src/components/PostEmbed.tsx View File

@@ -21,23 +21,30 @@ export default (({ post }: Props) => {
const mVideoId = url.pathname.match (/(?<=\/watch\/)[a-zA-Z0-9]+?(?=\/|$)/)
if (!(mVideoId))
break

const [videoId] = mVideoId

return <NicoViewer id={videoId} width={640} height={360}/>
}
case 'twitter.com':
case 'x.com':
const mUserId = url.pathname.match (/(?<=\/)[^\/]+?(?=\/|$|\?)/)
const mStatusId = url.pathname.match (/(?<=\/status\/)\d+?(?=\/|$|\?)/)
if (!(mUserId) || !(mStatusId))
break
const [userId] = mUserId
const [statusId] = mStatusId
return <TwitterEmbed userId={userId} statusId={statusId}/>
{
const mUserId = url.pathname.match (/(?<=\/)[^\/]+?(?=\/|$|\?)/)
const mStatusId = url.pathname.match (/(?<=\/status\/)\d+?(?=\/|$|\?)/)
if (!(mUserId) || !(mStatusId))
break

const [userId] = mUserId
const [statusId] = mStatusId

return <TwitterEmbed userId={userId} statusId={statusId}/>
}
case 'youtube.com':
{
const videoId = url.searchParams.get ('v')
if (!(videoId))
break

return (
<YoutubeEmbed videoId={videoId} opts={{ playerVars: {
playsinline: 1,


Loading…
Cancel
Save