// === OVERRIDE: loadHotTopics loads from MULTIPLE hashtags === // v3: 5 topics (AI Thế Giới + AI Việt Nam + top 3 hot) + lazy load more // This file loaded AFTER app_v2.js, overrides the function const HT_AI_TOPICS = ['AI Thế Giới', 'AI Việt Nam']; let _htAllSources = []; let _htTopics = []; let _htPages = 0; let _htDates = []; async function loadHotTopics(){ const j=await fetch('/api/hot_topics').then(r=>r.json()).catch(()=>({topics:[]})); const el=document.getElementById('hot-topics');if(!el)return; const topics=j.topics||[]; // Prepend AI topics that aren't already in the list const prepend = HT_AI_TOPICS.filter(ai => !topics.some(t => (t.topic || '').toLowerCase().includes(ai.toLowerCase())) ).map(ai => ({label: '#' + ai.replace(/\s+/g, ''), topic: ai, count: 0})); const finalTopics = [...prepend, ...topics].slice(0, 18); el.innerHTML=finalTopics.map(t=>{ const topicText=t.topic||t.label.replace(/^#/,''); return``; }).join(''); // Load tin HOT = tổng hợp từ TOP 5 hashtag (AI Thế Giới + AI Việt Nam + top 3 hot) const top5 = [...prepend, ...topics].slice(0, 5); if(top5.length>=2){ _htTopics = top5.map(t=>t.topic||t.label.replace(/^#/,'')); loadMultiHashtag(_htTopics); }else if(topics.length){ searchTopic(topics[0].topic||topics[0].label.replace(/^#/,'')); } } async function loadMultiHashtag(topicList){ const box=document.getElementById('hashtag-box');if(!box)return; _htAllSources = []; _htPages = 0; box.innerHTML=`