bep40 commited on
Commit
b78d3dc
·
verified ·
1 Parent(s): 564474a

Upload static/rewrite_fix_v2.js

Browse files
Files changed (1) hide show
  1. static/rewrite_fix_v2.js +4 -3
static/rewrite_fix_v2.js CHANGED
@@ -1,7 +1,8 @@
1
  /**
2
  * VNEWS Rewrite Fix v2
3
  * - rewriteSlide(): auto show slides + auto create Short AI (no page reload)
4
- * - rewriteUrl(): auto rewrite slides when pasting URL + clicking Rewrite
 
5
  */
6
 
7
  /** Auto-create Short AI after slide rewrite succeeds + show slides */
@@ -24,7 +25,7 @@ async function rewriteSlide(url){
24
  let h=`<button class="back-btn" onclick="switchCat('home')">← Tường AI</button><div class="slide-viewer" style="padding:12px;max-width:600px;margin:0 auto">`;
25
  j.post.slides.forEach(s=>{
26
  h+=`<div class="slide-card" style="background:#1a1a1a;border:1px solid #2a2a2a;border-radius:12px;padding:16px;margin-bottom:12px"><div class="slide-num" style="color:#5cb87a;font-size:12px;font-weight:700;margin-bottom:6px">Slide ${s.index}/${j.post.slides.length}</div>${
27
- s.image?`<img src="${_proxyImg(s.image)}" style="width:100%;max-height:300px;object-fit:cover;border-radius:8px;margin-bottom:8px" loading="lazy" onerror="this.style.display=\'none\'">`:''}<p style="color:#ddd;font-size:14px;line-height:1.6;margin:0">${esc(s.text)}</p></div>`;
28
  });
29
  h+=`</div><div style="text-align:center;padding:12px"><div id="short-ai-status" style="color:#888;font-size:12px">⏳ Đang tạo video Short AI...</div></div>`;
30
  el.innerHTML=h;
@@ -81,6 +82,6 @@ async function rewriteSlide(url){
81
  async function rewriteUrl(){
82
  const url=document.getElementById('url-input')?.value.trim();
83
  if(!url){alert('Nhập URL bài viết');return;}
84
- // Auto-trigger slide rewrite!
85
  rewriteSlide(url);
86
  }
 
1
  /**
2
  * VNEWS Rewrite Fix v2
3
  * - rewriteSlide(): auto show slides + auto create Short AI (no page reload)
4
+ * - rewriteUrl(): auto trigger rewrite slides when pasting URL
5
+ * - Fix: Short AI auto-publishes after creation without page reload
6
  */
7
 
8
  /** Auto-create Short AI after slide rewrite succeeds + show slides */
 
25
  let h=`<button class="back-btn" onclick="switchCat('home')">← Tường AI</button><div class="slide-viewer" style="padding:12px;max-width:600px;margin:0 auto">`;
26
  j.post.slides.forEach(s=>{
27
  h+=`<div class="slide-card" style="background:#1a1a1a;border:1px solid #2a2a2a;border-radius:12px;padding:16px;margin-bottom:12px"><div class="slide-num" style="color:#5cb87a;font-size:12px;font-weight:700;margin-bottom:6px">Slide ${s.index}/${j.post.slides.length}</div>${
28
+ s.image?`<img src="${s.image.startsWith('/api/')?s.image:'/api/proxy/img?url='+encodeURIComponent(s.image)}" style="width:100%;max-height:300px;object-fit:cover;border-radius:8px;margin-bottom:8px" loading="lazy" onerror="this.style.display=\'none\'">`:''}<p style="color:#ddd;font-size:14px;line-height:1.6;margin:0">${esc(s.text)}</p></div>`;
29
  });
30
  h+=`</div><div style="text-align:center;padding:12px"><div id="short-ai-status" style="color:#888;font-size:12px">⏳ Đang tạo video Short AI...</div></div>`;
31
  el.innerHTML=h;
 
82
  async function rewriteUrl(){
83
  const url=document.getElementById('url-input')?.value.trim();
84
  if(!url){alert('Nhập URL bài viết');return;}
85
+ // Auto-trigger slide rewrite instead of just reading article
86
  rewriteSlide(url);
87
  }