bep40 commited on
Commit
c0d8daa
verified
1 Parent(s): 45038e9

Adjust VTVGO popup height to fit player (max-height:60vh), add fallback to new window if blocked

Browse files
Files changed (1) hide show
  1. static/yt_live.js +13 -3
static/yt_live.js CHANGED
@@ -158,14 +158,14 @@
158
  .vtv-mini-btn.x:hover{background:#900;color:#fff}
159
  .vtv-mini-peek{position:absolute;bottom:-18px;right:10px;background:#0066cc;color:#fff;font-size:9px;padding:2px 8px;border-radius:0 0 6px 6px;cursor:pointer;display:none}
160
  .vtv-mini.hidden .vtv-mini-peek{display:block}
161
- .vtv-popup{position:fixed;inset:0;background:rgba(0,0,0,.95);z-index:99999;display:none;flex-direction:column}
162
  .vtv-popup.show{display:flex}
163
  .vtv-popup-header{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;background:#111;border-bottom:1px solid #333}
164
  .vtv-popup-title{font-size:14px;font-weight:700;color:#00ccff}
165
  .vtv-popup-close{background:#333;border:none;color:#fff;font-size:18px;width:32px;height:32px;border-radius:6px;cursor:pointer}
166
- .vtv-popup-frame{flex:1;position:relative;background:#000}
167
  .vtv-popup-frame iframe{position:absolute;inset:0;width:100%;height:100%;border:none}
168
- .vtv-popup-loader{display:flex;align-items:center;justify-content:center;height:180px;color:#00ccff;font-size:12px;flex-direction:column;gap:8px}
169
  .vtv-popup-btn{background:#1a2a3a;border:1px solid #2a3a4a;color:#8ab4d8;font-size:9px;padding:3px 8px;border-radius:6px;cursor:pointer;margin-left:4px}
170
  .vtv-popup-btn:hover{background:#0b4a7a;color:#fff}
171
  `;
@@ -847,6 +847,16 @@
847
  if (loader) loader.innerHTML = '<div style="color:#e74c3c">Kh么ng t岷 膽瓢峄 n峄檌 dung. <button onclick="closeVtvPopup()" style="margin-left:8px;background:#333;border:1px solid #666;color:#fff;padding:4px 8px;border-radius:4px;cursor:pointer">膼贸ng</button>';
848
  };
849
 
 
 
 
 
 
 
 
 
 
 
850
  frame.appendChild(iframe);
851
  popup.classList.add('show');
852
  }
 
158
  .vtv-mini-btn.x:hover{background:#900;color:#fff}
159
  .vtv-mini-peek{position:absolute;bottom:-18px;right:10px;background:#0066cc;color:#fff;font-size:9px;padding:2px 8px;border-radius:0 0 6px 6px;cursor:pointer;display:none}
160
  .vtv-mini.hidden .vtv-mini-peek{display:block}
161
+ .vtv-popup{position:fixed;inset:0;background:rgba(0,0,0,.95);z-index:99999;display:none;flex-direction:column;max-height:60vh;max-width:800px;margin:auto;left:20px;right:20px;top:20px;bottom:20px;border-radius:12px;overflow:hidden}
162
  .vtv-popup.show{display:flex}
163
  .vtv-popup-header{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;background:#111;border-bottom:1px solid #333}
164
  .vtv-popup-title{font-size:14px;font-weight:700;color:#00ccff}
165
  .vtv-popup-close{background:#333;border:none;color:#fff;font-size:18px;width:32px;height:32px;border-radius:6px;cursor:pointer}
166
+ .vtv-popup-frame{flex:1;position:relative;background:#000;min-height:280px}
167
  .vtv-popup-frame iframe{position:absolute;inset:0;width:100%;height:100%;border:none}
168
+ .vtv-popup-loader{display:flex;align-items:center;justify-content:center;height:280px;color:#00ccff;font-size:12px;flex-direction:column;gap:8px}
169
  .vtv-popup-btn{background:#1a2a3a;border:1px solid #2a3a4a;color:#8ab4d8;font-size:9px;padding:3px 8px;border-radius:6px;cursor:pointer;margin-left:4px}
170
  .vtv-popup-btn:hover{background:#0b4a7a;color:#fff}
171
  `;
 
847
  if (loader) loader.innerHTML = '<div style="color:#e74c3c">Kh么ng t岷 膽瓢峄 n峄檌 dung. <button onclick="closeVtvPopup()" style="margin-left:8px;background:#333;border:1px solid #666;color:#fff;padding:4px 8px;border-radius:4px;cursor:pointer">膼贸ng</button>';
848
  };
849
 
850
+ // Check if iframe is blocked by X-Frame-Options (detect after timeout)
851
+ setTimeout(() => {
852
+ const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
853
+ if (!iframeDoc || iframeDoc.body.childElementCount === 0) {
854
+ // Fallback: open in new window
855
+ window.open(popupUrl, '_blank');
856
+ closeVtvPopup();
857
+ }
858
+ }, 3000);
859
+
860
  frame.appendChild(iframe);
861
  popup.classList.add('show');
862
  }