bep40 commited on
Commit
de1189c
·
verified ·
1 Parent(s): 8699933

fix: remove WC section, fix loadHotTopics call, remove auto-loadHome

Browse files
Files changed (1) hide show
  1. 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
- +'<div id="wc2026-live-section" class="wc2026-section"><div class="wc-header"><h2>🏆 World Cup 2026</h2><span class="wc-live-badge">● LIVE</span></div><div class="wc-tabs"><span class="wc-tab active" onclick="switchWCTab(\'news\')">📰 Tin tức</span><span class="wc-tab" onclick="switchWCTab(\'fixtures\')">📅 Lịch thi đấu</span><span class="wc-tab" onclick="switchWCTab(\'standings\')">🏆 BXH</span><span class="wc-tab" onclick="switchWCTab(\'highlights\')">🎬 Highlight</span><span class="wc-tab" onclick="switchWCTab(\'stats\')">📊 Thống kê</span></div><div class="wc-content" id="wc-content"><div class="loading">Đang tải World Cup 2026...</div></div></div>'
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, wcData, vtvShortsData] = 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
- _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
- if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',function(){if(typeof loadHome==='function')loadHome();});}else{if(typeof loadHome==='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(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()