Spaces:
Running
Running
| """Extra CSS/JS fixes injected AFTER main PATCH_INJECT.""" | |
| EXTRA_FIX = r''' | |
| <style> | |
| /* Force correct position for Short AI interaction buttons */ | |
| .tiktok-slide{position:relative!important} | |
| .tiktok-right{position:absolute!important;right:8px!important;bottom:100px!important;display:flex!important;flex-direction:column!important;align-items:center!important;gap:14px!important;z-index:5!important} | |
| .tiktok-right-btn{display:flex!important;flex-direction:column!important;align-items:center!important;gap:2px!important;background:none!important;border:0!important;color:#fff!important;font-size:10px!important;cursor:pointer!important} | |
| .tiktok-right-btn .icon{width:42px!important;height:42px!important;border-radius:50%!important;background:rgba(255,255,255,.12)!important;display:flex!important;align-items:center!important;justify-content:center!important;font-size:20px!important} | |
| .tiktok-right-btn .count{font-size:10px!important;color:#ddd!important} | |
| #short-progress-toast{position:fixed;bottom:70px;left:50%;transform:translateX(-50%);background:#2d8659;color:#fff;padding:10px 20px;border-radius:20px;font-size:12px;z-index:99998;box-shadow:0 4px 12px rgba(0,0,0,.4);display:none;white-space:nowrap} | |
| /* Kill ALL duplicate short AI slides from old layers */ | |
| #ai-short-home,.ai-short-home,.ai-short-card-final,[id*="ai-shorts-patched"]{display:none!important} | |
| </style> | |
| <div id="short-progress-toast"></div> | |
| <script> | |
| (function(){ | |
| // Kill old renderers that create duplicate Short AI slides | |
| window.renderAIShortHome=function(){}; | |
| window.renderAIShorts7=function(){}; | |
| window.renderTopicWallE=function(){}; | |
| window.renderAiShorts=function(){}; | |
| // Also remove any already-rendered duplicate slides | |
| setInterval(function(){ | |
| document.querySelectorAll('#ai-short-home,.ai-short-home,[id*="ai-shorts-patched"]').forEach(function(el){el.remove()}); | |
| },2000); | |
| // Progress toast for short creation | |
| window.showShortProgress=function(msg){var t=document.getElementById('short-progress-toast');if(t){t.textContent=msg;t.style.display='block';}}; | |
| window.hideShortProgress=function(){var t=document.getElementById('short-progress-toast');if(t)t.style.display='none';}; | |
| // Override makeShortFromPost to use progress toast | |
| var _origMakeShort=window.makeShortFromPost; | |
| window.makeShortFromPost=async function(pid,btn){ | |
| showShortProgress('⏳ Đang tạo Short AI...'); | |
| if(btn){btn.disabled=true;btn.textContent='Đang tạo...';} | |
| try{ | |
| var r=await fetch('/api/ai/short/'+pid,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({voice:'nu',emotion:'neutral',speed:1.2})}); | |
| var j=await r.json(); | |
| if(!r.ok||j.error)throw new Error(j.error||'Lỗi'); | |
| showShortProgress('✅ Đ�ã tạo Short AI!'); | |
| setTimeout(hideShortProgress,3000); | |
| if(typeof renderShortAISlide==='function')renderShortAISlide(); | |
| }catch(e){ | |
| showShortProgress('❌ Lỗi: '+e.message); | |
| setTimeout(hideShortProgress,4000); | |
| }finally{ | |
| if(btn){btn.disabled=false;btn.textContent='🎬 Tạo Short AI';} | |
| } | |
| }; | |
| })(); | |
| </script> | |
| ''' | |