Spaces:
Running
Running
Upload static/yt_live.js with huggingface_hub
Browse files- static/yt_live.js +11 -6
static/yt_live.js
CHANGED
|
@@ -409,8 +409,8 @@
|
|
| 409 |
window.loadHome = async function(){
|
| 410 |
// Save VTV player state before loadHome re-renders #view-home
|
| 411 |
const vtvBlock = document.getElementById('vtv-block');
|
| 412 |
-
const wasPlaying = vtvBlock && !document.getElementById('vtv-player')?.paused;
|
| 413 |
const savedCh = _currentCh;
|
|
|
|
| 414 |
// Don't remove the VTV block — loadHome will overwrite #view-home innerHTML
|
| 415 |
// so we need to save & restore the block after
|
| 416 |
const r = await _origLoadHome.apply(this, arguments);
|
|
@@ -421,13 +421,18 @@
|
|
| 421 |
if(home){
|
| 422 |
home.insertBefore(vtvBlock, home.firstChild);
|
| 423 |
_blockInserted = true;
|
| 424 |
-
// Restore mini player state if active
|
| 425 |
-
if(_miniActive){
|
| 426 |
-
const mini = document.getElementById('vtv-mini');
|
| 427 |
-
if(mini) mini.classList.add('show');
|
| 428 |
-
}
|
| 429 |
}
|
| 430 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 431 |
// If streams were loaded before, just pin (don't re-fetch)
|
| 432 |
if(!_blockInserted){ pinBlock(); }
|
| 433 |
}catch(e){}
|
|
|
|
| 409 |
window.loadHome = async function(){
|
| 410 |
// Save VTV player state before loadHome re-renders #view-home
|
| 411 |
const vtvBlock = document.getElementById('vtv-block');
|
|
|
|
| 412 |
const savedCh = _currentCh;
|
| 413 |
+
const wasMini = _miniActive;
|
| 414 |
// Don't remove the VTV block — loadHome will overwrite #view-home innerHTML
|
| 415 |
// so we need to save & restore the block after
|
| 416 |
const r = await _origLoadHome.apply(this, arguments);
|
|
|
|
| 421 |
if(home){
|
| 422 |
home.insertBefore(vtvBlock, home.firstChild);
|
| 423 |
_blockInserted = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 424 |
}
|
| 425 |
}
|
| 426 |
+
// Auto-hide mini player when returning to home (user comes back from article)
|
| 427 |
+
if(wasMini && _miniActive){
|
| 428 |
+
const mini = document.getElementById('vtv-mini');
|
| 429 |
+
if(mini){
|
| 430 |
+
mini.classList.remove('show');
|
| 431 |
+
mini.classList.add('hidden');
|
| 432 |
+
}
|
| 433 |
+
// Don't fully close — just hide. Main VTV block in #view-home is visible again.
|
| 434 |
+
_miniActive = false;
|
| 435 |
+
}
|
| 436 |
// If streams were loaded before, just pin (don't re-fetch)
|
| 437 |
if(!_blockInserted){ pinBlock(); }
|
| 438 |
}catch(e){}
|