mp4 gallery comments

This commit is contained in:
3nprob 2021-10-08 03:10:06 +09:00
parent 5047952935
commit 9fa22e5200
1 changed files with 2 additions and 2 deletions

View File

@ -3,8 +3,8 @@ export const proxyURL = (url: string): string =>
export const linkify = (content: string) =>
content.replace(
/https?:\/\/[^.]*\.imgur.com\/([\/_a-zA-Z0-9-]+)\.gifv/g,
'<video src="/$1.mp4" class="commentVideo commentObject" loop="" autoplay=""></video>'
/https?:\/\/[^.]*\.imgur.com\/([\/_a-zA-Z0-9-]+)\.(gifv|mp4)/g,
'<video src="/$1.mp4" class="commentVideo commentObject" loop="" autoplay="" controls=""></video>'
).replace(
/https?:\/\/[^.]*\.imgur.com\/([\/_a-zA-Z0-9-]+\.[a-z0-9A-Z]{2,6})/g,
'<a href="/$1" target="_blank"><img class="commentImage commentObject" src="/$1" loading="lazy" /></a>'