Spaces:
Running
Running
fix(wall): CSS card video FPT 100% match Short AI card, remove redundant video button, player uses buildTikTokSlide
Browse files- static/app_v2.js +30 -19
static/app_v2.js
CHANGED
|
@@ -400,10 +400,11 @@ function _fptRender(){
|
|
| 400 |
return;
|
| 401 |
}
|
| 402 |
const vids = _fptVideos.slice(0, 30);
|
| 403 |
-
|
|
|
|
| 404 |
let h = '<div class="slider-wrap"><div class="slider-header"><span class="slider-label">📺 FPT Play Bóng Đá</span><span class="slider-note">' + vids.length + ' video · tự cập nhật</span></div><div class="slider-track" id="fpt-main-track">';
|
| 405 |
vids.forEach((a,i)=>{
|
| 406 |
-
h +=
|
| 407 |
});
|
| 408 |
h += '</div></div>';
|
| 409 |
el.innerHTML = h;
|
|
@@ -565,23 +566,23 @@ async function _ytFetchFeed(){
|
|
| 565 |
}
|
| 566 |
function _makeYTFeedWallItem(v, i){
|
| 567 |
// Render a YouTube feed video using the SAME CSS classes as makeWallItem
|
| 568 |
-
// so it looks like a native Tường AI post
|
| 569 |
-
// TikTok-style viewer
|
| 570 |
var img = (typeof _proxyImg === 'function') ? _proxyImg(v.img) : v.img;
|
| 571 |
var thumbContent = img
|
| 572 |
-
? '<img src="'+img+'"
|
| 573 |
: '<div style="width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,#0d1117,#1a3a2a);color:#5cb87a;font-size:24px">▶</div>';
|
| 574 |
var videoBadge = '<div class="wall-video-badge">🎬</div>';
|
| 575 |
var callOpen = "openYTEmbedFeed('"+esc(v.videoId)+"','"+esc(v.title)+"')";
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
return '<div class="wall-item" style="flex:0 0 260px">' +
|
| 579 |
-
'<div class="wall-thumb" style="aspect-ratio:auto;max-height:340px;background:#000">' +
|
| 580 |
thumbContent + videoBadge +
|
| 581 |
'</div>' +
|
| 582 |
'<div class="wall-title">' + esc(v.title) + '</div>' +
|
| 583 |
'<div class="wall-text">' + esc((v.published||'').replace(/T.*/,'') ) + '</div>' +
|
| 584 |
-
'<div class="wall-actions"><button class="primary" onclick="event.stopPropagation();'+callOpen+'">▶ Xem</button>' +
|
|
|
|
|
|
|
| 585 |
'</div>';
|
| 586 |
}
|
| 587 |
|
|
@@ -615,22 +616,32 @@ function _renderYTFeedInWall(){
|
|
| 615 |
}
|
| 616 |
|
| 617 |
function openYTEmbedFeed(videoId, title){
|
| 618 |
-
// Open a YouTube embed in the
|
|
|
|
| 619 |
showView('view-tiktok');
|
| 620 |
var el = document.getElementById('view-tiktok');
|
| 621 |
if(!el){ return; }
|
| 622 |
var embedUrl = 'https://www.youtube.com/embed/' + videoId + '?autoplay=1&rel=0&enablejsapi=1';
|
| 623 |
-
var
|
| 624 |
-
var h = '<button class="back-btn" onclick="switchCat(\'home\')">← Tường AI</button>'
|
| 625 |
-
+ '<div class="tiktok-container"><div class="tiktok-feed" id="tiktok-feed">'
|
| 626 |
-
+ '<div class="tiktok-slide" style="background:#000">'
|
| 627 |
-
+ '<div class="yt-thumb-wrap" style="background-image:url(\'' + thumb + '\')">'
|
| 628 |
+ '<iframe data-yt-src="' + embedUrl + '" allowfullscreen '
|
| 629 |
+ 'allow="accelerometer;autoplay;clipboard-write;encrypted-media;gyroscope;picture-in-picture" '
|
| 630 |
+ 'referrerpolicy="strict-origin-when-cross-origin"></iframe>'
|
| 631 |
-
+ '</div>'
|
| 632 |
-
|
| 633 |
-
+ '<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 634 |
el.innerHTML = h;
|
| 635 |
setTimeout(function(){ initTikTokFeed(); }, 200);
|
| 636 |
}
|
|
|
|
| 400 |
return;
|
| 401 |
}
|
| 402 |
const vids = _fptVideos.slice(0, 30);
|
| 403 |
+
// Render FPT Play videos using the SAME wall card CSS as Short AI cards
|
| 404 |
+
// (via _makeYTFeedWallItem) — 100% match with card video Short AI.
|
| 405 |
let h = '<div class="slider-wrap"><div class="slider-header"><span class="slider-label">📺 FPT Play Bóng Đá</span><span class="slider-note">' + vids.length + ' video · tự cập nhật</span></div><div class="slider-track" id="fpt-main-track">';
|
| 406 |
vids.forEach((a,i)=>{
|
| 407 |
+
h += _makeYTFeedWallItem(a, i);
|
| 408 |
});
|
| 409 |
h += '</div></div>';
|
| 410 |
el.innerHTML = h;
|
|
|
|
| 566 |
}
|
| 567 |
function _makeYTFeedWallItem(v, i){
|
| 568 |
// Render a YouTube feed video using the SAME CSS classes as makeWallItem
|
| 569 |
+
// so it looks like a native Tường AI post (100% match with card video Short AI).
|
| 570 |
+
// Opens the YouTube embed in the same TikTok-style viewer used by Short AI.
|
| 571 |
var img = (typeof _proxyImg === 'function') ? _proxyImg(v.img) : v.img;
|
| 572 |
var thumbContent = img
|
| 573 |
+
? '<img src="'+img+'" loading="lazy" onerror="this.style.display=\'none\'">'
|
| 574 |
: '<div style="width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,#0d1117,#1a3a2a);color:#5cb87a;font-size:24px">▶</div>';
|
| 575 |
var videoBadge = '<div class="wall-video-badge">🎬</div>';
|
| 576 |
var callOpen = "openYTEmbedFeed('"+esc(v.videoId)+"','"+esc(v.title)+"')";
|
| 577 |
+
return '<div class="wall-item" id="wall-item-yt-'+esc(v.videoId||i)+'" style="flex:0 0 260px">' +
|
| 578 |
+
'<div class="wall-thumb">' +
|
|
|
|
|
|
|
| 579 |
thumbContent + videoBadge +
|
| 580 |
'</div>' +
|
| 581 |
'<div class="wall-title">' + esc(v.title) + '</div>' +
|
| 582 |
'<div class="wall-text">' + esc((v.published||'').replace(/T.*/,'') ) + '</div>' +
|
| 583 |
+
'<div class="wall-actions"><button class="primary" onclick="event.stopPropagation();'+callOpen+'">▶ Xem</button>' +
|
| 584 |
+
'<button class="wall-btn-video" onclick="event.stopPropagation();'+callOpen+'">▶ Xem Short</button>' +
|
| 585 |
+
'</div>' +
|
| 586 |
'</div>';
|
| 587 |
}
|
| 588 |
|
|
|
|
| 616 |
}
|
| 617 |
|
| 618 |
function openYTEmbedFeed(videoId, title){
|
| 619 |
+
// Open a YouTube embed in the SAME TikTok-style viewer used by Short AI
|
| 620 |
+
// (buildTikTokSlide + initTikTokFeed) — 100% match with Short AI player.
|
| 621 |
showView('view-tiktok');
|
| 622 |
var el = document.getElementById('view-tiktok');
|
| 623 |
if(!el){ return; }
|
| 624 |
var embedUrl = 'https://www.youtube.com/embed/' + videoId + '?autoplay=1&rel=0&enablejsapi=1';
|
| 625 |
+
var vtag = '<div class="yt-thumb-wrap" style="background-image:url(\'https://i.ytimg.com/vi/' + videoId + '/hqdefault.jpg\')">'
|
|
|
|
|
|
|
|
|
|
|
|
|
| 626 |
+ '<iframe data-yt-src="' + embedUrl + '" allowfullscreen '
|
| 627 |
+ 'allow="accelerometer;autoplay;clipboard-write;encrypted-media;gyroscope;picture-in-picture" '
|
| 628 |
+ 'referrerpolicy="strict-origin-when-cross-origin"></iframe>'
|
| 629 |
+
+ '</div>';
|
| 630 |
+
var h = '<button class="back-btn" onclick="switchCat(\'home\')">← Tường AI</button>'
|
| 631 |
+
+ '<div class="tiktok-container"><div class="tiktok-feed" id="tiktok-feed">'
|
| 632 |
+
+ buildTikTokSlide({
|
| 633 |
+
vtag: vtag,
|
| 634 |
+
title: title||'Video',
|
| 635 |
+
badge: 'Short AI',
|
| 636 |
+
badgeClass: 'badge-ai',
|
| 637 |
+
videoId: videoId,
|
| 638 |
+
idx: 0,
|
| 639 |
+
total: 1,
|
| 640 |
+
shareUrl: embedUrl,
|
| 641 |
+
postId: '',
|
| 642 |
+
extraBtn: ''
|
| 643 |
+
})
|
| 644 |
+
+ '</div></div>';
|
| 645 |
el.innerHTML = h;
|
| 646 |
setTimeout(function(){ initTikTokFeed(); }, 200);
|
| 647 |
}
|