Live TV tabs #7443
Closed
plexbackupus-del
started this conversation in
Ideas
Live TV tabs
#7443
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone, I use the "Live TV" folder and I miss being able to manage the tabs that appear there, because because I use an .m3u file to display the channels, the only relevant page for me is "channels", the others are always empty.
In the index.html file I added the following lines:
<script> // Persistent filter: keep only the Channels tab when Live TV renders or re-renders (function(){ var preferredNames = ["channels","canais","canales","canali","kanaler","каналы","kanały"]; function matchChannelText(text){ if(!text) return false; text = text.trim().toLowerCase(); return preferredNames.some(function(n){return text.indexOf(n)!==-1}) || /channel/.test(text); } function processTabs(container){ // Detect Live TV tabbars by checking for multiple Live TV tab labels container = container || document.querySelector('.tabs-viewmenubar') || document; var embyTabs = container.querySelector && (container.querySelector('[is="emby-tabs"]') || container.querySelector('.emby-tabs')) || (container.matches && container.matches('[is="emby-tabs"],.emby-tabs') ? container : null); if(!embyTabs) return false; // If we've already processed this embyTabs element, skip to avoid repeated work if(embyTabs.getAttribute && embyTabs.getAttribute('data-channels-only')==='1') return false; var buttons = Array.prototype.slice.call(embyTabs.querySelectorAll('.emby-tab-button')); if(!buttons.length) return false; // Count how many of the expected Live TV labels appear in the tabs — require at least 2 matches var expected = ["programs","programas","guide","guia","channels","canais","recordings","grava","schedule","programa","series","seriestimers","seriados"]; var matchCount = 0; var texts = buttons.map(function(b){ return (b.textContent||b.innerText||"").trim().toLowerCase(); }); for(var ti=0; ti<texts.length; ti++){ for(var ei=0; ei<expected.length; ei++){ if(texts[ti].indexOf(expected[ei])!==-1){ matchCount++; break; } } } if(matchCount < 2) return false; // probably not the Live TV tabs var channelIndex = -1; for(var i=0;i<buttons.length;i++){ var txt = texts[i]; if(matchChannelText(txt)) { channelIndex = i; break; } } if(channelIndex===-1 && buttons[2]) channelIndex = 2; if(channelIndex<0) return false; // Hide other buttons and keep only channel (only change display if different) buttons.forEach(function(b,idx){ var want = (idx===channelIndex)?'':'none'; if(b.style.display!==want) b.style.display = want; }); // Hide page content panes that don't match (only change if different) document.querySelectorAll('.pageTabContent').forEach(function(p){ var idx=p.getAttribute('data-index'); var want = (String(idx)===String(channelIndex))? '':'none'; if(p.style.display!==want) p.style.display = want; }); // Mark as processed so we don't reapply repeatedly to the same element try{ embyTabs.setAttribute('data-channels-only','1'); }catch(e){} // Activate kept tab if possible (best-effort) try{ if(typeof embyTabs.selectedIndex==='function') embyTabs.selectedIndex(channelIndex); else if(buttons[channelIndex]) buttons[channelIndex].click(); }catch(e){} return true; } // Debounced scheduler var debounceTimer = null; function scheduleProcess(){ clearTimeout(debounceTimer); debounceTimer = setTimeout(function(){ processTabs(); }, 120); } // Persistent observer: re-run when new nodes are added (e.g. SPA navigation creates new tabs) var mo = new MutationObserver(function(muts){ for(var i=0;i<muts.length;i++){ var m = muts[i]; if(m.addedNodes && m.addedNodes.length) { // Only schedule if a tabs container was added or the live-tv view changed for(var j=0;j<m.addedNodes.length;j++){ var node = m.addedNodes[j]; if(node && node.querySelector && (node.querySelector('.emby-tabs') || node.querySelector('.tabs-viewmenubar') || node.matches && node.matches('.emby-tabs,.tabs-viewmenubar'))){ scheduleProcess(); return; } } // Generic schedule otherwise scheduleProcess(); return; } } }); mo.observe(document.documentElement||document.body,{childList:true,subtree:true}); // Initial attempts + periodic retries for SPA navigation if(document.readyState==='complete' || document.readyState==='interactive') scheduleProcess(); var retryCount=0, retryInterval=setInterval(function(){ if(processTabs() || ++retryCount>40) clearInterval(retryInterval); },250); })(); </script>With this code, all the other tabs that I don't need disappeared, if anyone else is interested, I will send the complete file:
index.html Version 10.11.5
I don't know how to make the request for this to become something in the future, I'm new to the community, I created my account just for this, thank you very much in advance.
Beta Was this translation helpful? Give feedback.
All reactions