Spaces:
Running
Running
fix: remove WC section, fix loadHotTopics call, remove auto-loadHome
Browse files- static/app_v2.js +4 -11
static/app_v2.js
CHANGED
|
@@ -21,22 +21,20 @@ async function loadHome(){
|
|
| 21 |
+'<div class="ai-compose"><div class="ai-compose-title">🤖 AI viết bài</div><div class="ai-compose-row"><input id="topic-input" placeholder="Nhập chủ đề..."><button onclick="searchTopic()">Tìm nguồn</button></div><div class="ai-compose-row"><input id="url-input" placeholder="Dán URL bài viết..."><button class="secondary" onclick="rewriteUrl()">Rewrite</button></div><div id="hot-topics" class="hot-topic-row"></div></div>'
|
| 22 |
+'<div id="hashtag-box"></div>'
|
| 23 |
+'<div class="ls-section"><div class="ls-header"><h3>⚽ Livescore</h3></div><div class="ls-tabs"><span class="ls-tab active" data-tab="today" onclick="loadLivescore(\'today\')">📅 Hôm nay</span><span class="ls-tab" data-tab="live" onclick="loadLivescore(\'live\')">🔴 Live</span><span class="ls-tab" data-tab="incoming" onclick="loadLivescore(\'incoming\')">⏰ Sắp tới</span><span class="ls-tab" data-tab="results" onclick="loadLivescore(\'results\')">✅ Kết quả</span><span class="ls-tab" data-tab="bxh_nha" onclick="loadLivescore(\'bxh_nha\')">🏆 NHA</span><span class="ls-tab" data-tab="bxh_laliga" onclick="loadLivescore(\'bxh_laliga\')">🏆 La Liga</span></div><div class="ls-content" id="ls-content"><div class="loading">Đang tải...</div></div></div>'
|
| 24 |
-
|
| 25 |
+'<div id="home-after-wc"></div>';
|
| 26 |
|
| 27 |
const afterEl = homeEl.querySelector('#home-after-wc');
|
| 28 |
|
| 29 |
loadLivescore('today');
|
| 30 |
-
if
|
| 31 |
|
| 32 |
-
const [featuredData, shortsData, wallData, hlLeagues, aiData
|
| 33 |
_fetchWithTimeout('/api/livescore/featured', 5000),
|
| 34 |
_fetchWithTimeout('/api/shorts', 8000),
|
| 35 |
_fetchWithTimeout('/api/wall', 5000),
|
| 36 |
_fetchWithTimeout('/api/highlights/leagues', 10000),
|
| 37 |
_fetchWithTimeout('/api/genk_ai', 8000),
|
| 38 |
-
_fetchWithTimeout('/api/wc2026', 8000),
|
| 39 |
-
_fetchWithTimeout('/api/shorts/vtvnamo?count=50', 12000),
|
| 40 |
]).then(results => results.map(r => r.status === 'fulfilled' ? r.value : null));
|
| 41 |
|
| 42 |
if(featuredData && featuredData.home){
|
|
@@ -49,10 +47,6 @@ async function loadHome(){
|
|
| 49 |
_shortsData = shortsData || [];
|
| 50 |
_wallPosts = (wallData && wallData.posts) || [];
|
| 51 |
_hlLeagueData = hlLeagues || {};
|
| 52 |
-
_wc2026Data = wcData;
|
| 53 |
-
_wcShortsData = vtvShortsData || [];
|
| 54 |
-
|
| 55 |
-
if(wcData) switchWCTab('news');
|
| 56 |
|
| 57 |
_renderShortsIn(afterEl);
|
| 58 |
_renderWallIn(afterEl);
|
|
@@ -218,7 +212,6 @@ function prependWallPost(post){
|
|
| 218 |
|
| 219 |
let _shortsData=[];
|
| 220 |
let _wallPosts=[];
|
| 221 |
-
let _wcShortsData=[];
|
| 222 |
let _currentView='home';
|
| 223 |
let _currentEventId=null;
|
| 224 |
let _currentMatchUrl=null;
|
|
@@ -339,4 +332,4 @@ async function loadCat(id){const el=document.getElementById('view-cat');el.inner
|
|
| 339 |
fetch('/api/storage_status').then(r=>r.json()).then(j=>{if(!j.persistent){const home=document.getElementById('view-home');if(home){const w=document.createElement('div');w.className='storage-warn';w.innerHTML='⚠️ Persistent Storage chưa bật.';home.prepend(w)}}}).catch(()=>{});
|
| 340 |
(function(){try{var hash=window.location.hash;if(hash&&hash.length>1){var articleUrl=decodeURIComponent(hash.substring(1));if(articleUrl.startsWith('http')){history.replaceState(null,'',window.location.pathname);setTimeout(function(){if(typeof readArticle==='function')readArticle(articleUrl);},1500);}}}catch(e){}})();
|
| 341 |
(function(){try{const pa=localStorage.getItem('pending_article');const pv=localStorage.getItem('pending_video');if(pa){localStorage.removeItem('pending_article');setTimeout(()=>{if(typeof readArticle==='function')readArticle(pa);},1500);}if(pv){localStorage.removeItem('pending_video');try{const v=JSON.parse(pv);if(v&&v.url)setTimeout(()=>{window.open(v.url,'_blank')},1500);}catch(e){}}}catch(e){}})();
|
| 342 |
-
|
|
|
|
| 21 |
+'<div class="ai-compose"><div class="ai-compose-title">🤖 AI viết bài</div><div class="ai-compose-row"><input id="topic-input" placeholder="Nhập chủ đề..."><button onclick="searchTopic()">Tìm nguồn</button></div><div class="ai-compose-row"><input id="url-input" placeholder="Dán URL bài viết..."><button class="secondary" onclick="rewriteUrl()">Rewrite</button></div><div id="hot-topics" class="hot-topic-row"></div></div>'
|
| 22 |
+'<div id="hashtag-box"></div>'
|
| 23 |
+'<div class="ls-section"><div class="ls-header"><h3>⚽ Livescore</h3></div><div class="ls-tabs"><span class="ls-tab active" data-tab="today" onclick="loadLivescore(\'today\')">📅 Hôm nay</span><span class="ls-tab" data-tab="live" onclick="loadLivescore(\'live\')">🔴 Live</span><span class="ls-tab" data-tab="incoming" onclick="loadLivescore(\'incoming\')">⏰ Sắp tới</span><span class="ls-tab" data-tab="results" onclick="loadLivescore(\'results\')">✅ Kết quả</span><span class="ls-tab" data-tab="bxh_nha" onclick="loadLivescore(\'bxh_nha\')">🏆 NHA</span><span class="ls-tab" data-tab="bxh_laliga" onclick="loadLivescore(\'bxh_laliga\')">🏆 La Liga</span></div><div class="ls-content" id="ls-content"><div class="loading">Đang tải...</div></div></div>'
|
| 24 |
+
|
| 25 |
+'<div id="home-after-wc"></div>';
|
| 26 |
|
| 27 |
const afterEl = homeEl.querySelector('#home-after-wc');
|
| 28 |
|
| 29 |
loadLivescore('today');
|
| 30 |
+
if(window.loadHotTopics){window.loadHotTopics();}else{loadHotTopics();}
|
| 31 |
|
| 32 |
+
const [featuredData, shortsData, wallData, hlLeagues, aiData] = await Promise.allSettled([
|
| 33 |
_fetchWithTimeout('/api/livescore/featured', 5000),
|
| 34 |
_fetchWithTimeout('/api/shorts', 8000),
|
| 35 |
_fetchWithTimeout('/api/wall', 5000),
|
| 36 |
_fetchWithTimeout('/api/highlights/leagues', 10000),
|
| 37 |
_fetchWithTimeout('/api/genk_ai', 8000),
|
|
|
|
|
|
|
| 38 |
]).then(results => results.map(r => r.status === 'fulfilled' ? r.value : null));
|
| 39 |
|
| 40 |
if(featuredData && featuredData.home){
|
|
|
|
| 47 |
_shortsData = shortsData || [];
|
| 48 |
_wallPosts = (wallData && wallData.posts) || [];
|
| 49 |
_hlLeagueData = hlLeagues || {};
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
_renderShortsIn(afterEl);
|
| 52 |
_renderWallIn(afterEl);
|
|
|
|
| 212 |
|
| 213 |
let _shortsData=[];
|
| 214 |
let _wallPosts=[];
|
|
|
|
| 215 |
let _currentView='home';
|
| 216 |
let _currentEventId=null;
|
| 217 |
let _currentMatchUrl=null;
|
|
|
|
| 332 |
fetch('/api/storage_status').then(r=>r.json()).then(j=>{if(!j.persistent){const home=document.getElementById('view-home');if(home){const w=document.createElement('div');w.className='storage-warn';w.innerHTML='⚠️ Persistent Storage chưa bật.';home.prepend(w)}}}).catch(()=>{});
|
| 333 |
(function(){try{var hash=window.location.hash;if(hash&&hash.length>1){var articleUrl=decodeURIComponent(hash.substring(1));if(articleUrl.startsWith('http')){history.replaceState(null,'',window.location.pathname);setTimeout(function(){if(typeof readArticle==='function')readArticle(articleUrl);},1500);}}}catch(e){}})();
|
| 334 |
(function(){try{const pa=localStorage.getItem('pending_article');const pv=localStorage.getItem('pending_video');if(pa){localStorage.removeItem('pending_article');setTimeout(()=>{if(typeof readArticle==='function')readArticle(pa);},1500);}if(pv){localStorage.removeItem('pending_video');try{const v=JSON.parse(pv);if(v&&v.url)setTimeout(()=>{window.open(v.url,'_blank')},1500);}catch(e){}}}catch(e){}})();
|
| 335 |
+
// loadHome is called explicitly via switchCat('home') or window.loadHome()
|