Skip to content

Commit

Permalink
fixed video play link look
Browse files Browse the repository at this point in the history
  • Loading branch information
qiyundai committed Apr 5, 2024
1 parent 4b9074a commit 9c18d1f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions express/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,14 @@ async function transpileMarquee(area) {
return firstRow.children.length > 1 && ['default', 'mobile', 'desktop', 'hd'].includes(firstRow.querySelector(':scope > div')?.textContent?.trim().toLowerCase());
}

Check failure on line 237 in express/scripts/utils.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Missing semicolon

const isVideoLink = (url) => {
if (!url) return null;
return url.includes('youtube.com/watch')
|| url.includes('youtu.be/')
|| url.includes('vimeo')
|| /.*\/media_.*(mp4|webm|m3u8)$/.test(new URL(url).pathname);
}

Check failure on line 245 in express/scripts/utils.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Missing semicolon

const transpile = (block) => {
const assetArea = createTag('div');

Expand Down Expand Up @@ -279,6 +287,11 @@ async function transpileMarquee(area) {
if (!btnContainers.includes(a.parentElement)) {
btnContainers.push(a.parentElement);
}

if (isVideoLink(a.href)) {
const playIcon = createTag('span', { class: 'icon icon-play' });
a.prepend(playIcon);
}
})

Check failure on line 295 in express/scripts/utils.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Missing semicolon

const isInlineButtons = btnContainers.length === 1;
Expand Down

0 comments on commit 9c18d1f

Please sign in to comment.