fix(nav): show request panel on home tab select
Jellyfin HomeView only handles Home/Favorites; stop its tabchange handler for Request and sync .hide/is-active so the embedded UI is visible. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
0a5ea07838
commit
2a1fcf0588
8 files changed
+127
-25
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>1.0.0.3</Version>
|
<Version>1.0.0.4</Version>
|
||||||
<AssemblyVersion>1.0.0.3</AssemblyVersion>
|
<AssemblyVersion>1.0.0.4</AssemblyVersion>
|
||||||
<FileVersion>1.0.0.3</FileVersion>
|
<FileVersion>1.0.0.4</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
let ensuring = null;
|
let ensuring = null;
|
||||||
let assetsPromise = null;
|
let assetsPromise = null;
|
||||||
|
let guardAttached = false;
|
||||||
|
|
||||||
function ensureStyle() {
|
function ensureStyle() {
|
||||||
if (document.getElementById(STYLE_ID)) {
|
if (document.getElementById(STYLE_ID)) {
|
||||||
@@ -17,7 +18,7 @@
|
|||||||
const style = document.createElement("style");
|
const style = document.createElement("style");
|
||||||
style.id = STYLE_ID;
|
style.id = STYLE_ID;
|
||||||
style.textContent = [
|
style.textContent = [
|
||||||
".jf-request-tab-panel{padding:1rem 1.25rem 2rem;box-sizing:border-box;}",
|
".jf-request-tab-panel{padding:1rem 1.25rem 2rem;box-sizing:border-box;min-height:50vh;}",
|
||||||
".jf-request-tab-panel .req-embed{max-width:1400px;margin:0 auto;}",
|
".jf-request-tab-panel .req-embed{max-width:1400px;margin:0 auto;}",
|
||||||
".jf-request-menu-item{align-items:center;color:inherit;display:flex!important;gap:1rem;min-height:3rem;padding:.75rem 1.25rem;text-decoration:none;cursor:pointer;background:none;border:0;width:100%;text-align:left;font:inherit;}",
|
".jf-request-menu-item{align-items:center;color:inherit;display:flex!important;gap:1rem;min-height:3rem;padding:.75rem 1.25rem;text-decoration:none;cursor:pointer;background:none;border:0;width:100%;text-align:left;font:inherit;}",
|
||||||
".jf-request-menu-item:hover,.jf-request-menu-item:focus{color:#00a4dc;}",
|
".jf-request-menu-item:hover,.jf-request-menu-item:focus{color:#00a4dc;}",
|
||||||
@@ -99,8 +100,10 @@
|
|||||||
|
|
||||||
function createTabPanel() {
|
function createTabPanel() {
|
||||||
const panel = document.createElement("div");
|
const panel = document.createElement("div");
|
||||||
|
// Match SeerrFin: start without .hide; visibility is synced on tab change.
|
||||||
panel.className = "tabContent pageTabContent hide jf-request-tab-panel";
|
panel.className = "tabContent pageTabContent hide jf-request-tab-panel";
|
||||||
panel.setAttribute(TAB_ATTR, "request");
|
panel.setAttribute(TAB_ATTR, "request");
|
||||||
|
panel.id = "jellyfinRequestTab";
|
||||||
|
|
||||||
const mount = document.createElement("div");
|
const mount = document.createElement("div");
|
||||||
mount.className = "sections jf-request-sections";
|
mount.className = "sections jf-request-sections";
|
||||||
@@ -110,7 +113,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function findNativeButtons(tabsSlider) {
|
function findNativeButtons(tabsSlider) {
|
||||||
return Array.from(tabsSlider.querySelectorAll(".emby-tab-button")).filter((btn) => !btn.hasAttribute(TAB_ATTR));
|
return Array.from(tabsSlider.querySelectorAll(".emby-tab-button")).filter((btn) => {
|
||||||
|
if (btn.hasAttribute(TAB_ATTR)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const id = btn.id || "";
|
||||||
|
return id.indexOf("customTabButton_") !== 0;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function placeInOrder(parent, nodes) {
|
function placeInOrder(parent, nodes) {
|
||||||
@@ -147,7 +157,6 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Native home/favorites panels.
|
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
page.querySelector("#homeTab")?.setAttribute("data-index", "0");
|
page.querySelector("#homeTab")?.setAttribute("data-index", "0");
|
||||||
} else if (index === 1) {
|
} else if (index === 1) {
|
||||||
@@ -156,18 +165,100 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function syncPanelVisibility(selectedIndex) {
|
||||||
|
const page = document.getElementById("indexPage");
|
||||||
|
if (!page || isNaN(selectedIndex)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
page.querySelectorAll(".tabContent[data-index]").forEach((panel) => {
|
||||||
|
const panelIndex = parseInt(panel.getAttribute("data-index"), 10);
|
||||||
|
const active = panelIndex === selectedIndex;
|
||||||
|
panel.classList.toggle("hide", !active);
|
||||||
|
panel.classList.toggle("is-active", active);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async function mountRequestUi(panel) {
|
async function mountRequestUi(panel) {
|
||||||
const mount = panel.querySelector('[data-role="request-mount"]');
|
const mount = panel.querySelector('[data-role="request-mount"]');
|
||||||
if (!mount) {
|
if (!mount) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await loadAssets();
|
try {
|
||||||
|
await loadAssets();
|
||||||
|
} catch (error) {
|
||||||
|
mount.textContent = "Failed to load Request UI.";
|
||||||
|
console.error("[Jellyfin.Plugin.Request]", error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (window.JellyfinRequestUI) {
|
if (window.JellyfinRequestUI) {
|
||||||
window.JellyfinRequestUI.mount(mount, { embed: true });
|
window.JellyfinRequestUI.mount(mount, { embed: true });
|
||||||
|
} else {
|
||||||
|
mount.textContent = "Request UI failed to initialize.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isRequestTabButton(button) {
|
||||||
|
return !!(button && button.getAttribute(TAB_ATTR) === "request");
|
||||||
|
}
|
||||||
|
|
||||||
|
function attachPluginTabGuard(tabsEl) {
|
||||||
|
if (!tabsEl || guardAttached || tabsEl.dataset.jfRequestTabGuard === "true") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
guardAttached = true;
|
||||||
|
tabsEl.dataset.jfRequestTabGuard = "true";
|
||||||
|
|
||||||
|
tabsEl.addEventListener("beforetabchange", (event) => {
|
||||||
|
if (!isHomeTabContext()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const index = parseInt(event.detail && event.detail.selectedTabIndex, 10);
|
||||||
|
if (isNaN(index)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Jellyfin activates panels by NodeList order; keep data-index panels in sync.
|
||||||
|
syncPanelVisibility(index);
|
||||||
|
|
||||||
|
const selectedButton = tabsEl.querySelector(`.emby-tab-button[data-index="${index}"]`);
|
||||||
|
if (isRequestTabButton(selectedButton)) {
|
||||||
|
const panel = document.querySelector(`.tabContent[${TAB_ATTR}="request"]`);
|
||||||
|
if (panel) {
|
||||||
|
mountRequestUi(panel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
|
|
||||||
|
// HomeView only knows Home/Favorites. Stop its handler for our tab so content is not cleared.
|
||||||
|
tabsEl.addEventListener("tabchange", (event) => {
|
||||||
|
if (!isHomeTabContext()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const index = parseInt(event.detail && event.detail.selectedTabIndex, 10);
|
||||||
|
if (isNaN(index)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const selectedButton = tabsEl.querySelector(`.emby-tab-button[data-index="${index}"]`);
|
||||||
|
if (!isRequestTabButton(selectedButton)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.stopImmediatePropagation();
|
||||||
|
syncPanelVisibility(index);
|
||||||
|
const panel = document.querySelector(`.tabContent[${TAB_ATTR}="request"]`);
|
||||||
|
if (panel) {
|
||||||
|
mountRequestUi(panel);
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
function activateRequestTab() {
|
function activateRequestTab() {
|
||||||
if (!isHomeTabContext()) {
|
if (!isHomeTabContext()) {
|
||||||
window.location.hash = "#/home";
|
window.location.hash = "#/home";
|
||||||
@@ -259,6 +350,8 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
attachPluginTabGuard(tabsEl);
|
||||||
|
|
||||||
let button = tabsSlider.querySelector(`[${TAB_ATTR}="request"]`);
|
let button = tabsSlider.querySelector(`[${TAB_ATTR}="request"]`);
|
||||||
if (!button) {
|
if (!button) {
|
||||||
button = createTabButton();
|
button = createTabButton();
|
||||||
@@ -290,7 +383,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await mountRequestUi(panel);
|
// Preload assets so the first click is instant; do not force-show the panel.
|
||||||
|
await loadAssets().catch(() => { /* surfaced on mount */ });
|
||||||
})().finally(() => {
|
})().finally(() => {
|
||||||
ensuring = null;
|
ensuring = null;
|
||||||
});
|
});
|
||||||
@@ -306,11 +400,18 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
window.addEventListener("hashchange", () => ensureRequestTab());
|
window.addEventListener("hashchange", () => ensureRequestTab());
|
||||||
setInterval(() => ensureRequestTab(), 1500);
|
setInterval(() => ensureRequestTab(), 2000);
|
||||||
|
|
||||||
const headerTabs = document.querySelector(".headerTabs");
|
const headerTabs = document.querySelector(".headerTabs");
|
||||||
if (headerTabs) {
|
if (headerTabs) {
|
||||||
new MutationObserver(() => ensureRequestTab()).observe(headerTabs, { childList: true, subtree: true });
|
let timer = null;
|
||||||
|
new MutationObserver(() => {
|
||||||
|
if (timer) {
|
||||||
|
clearTimeout(timer);
|
||||||
|
}
|
||||||
|
|
||||||
|
timer = setTimeout(() => ensureRequestTab(), 250);
|
||||||
|
}).observe(headerTabs, { childList: true, subtree: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,25 +10,26 @@
|
|||||||
--req-warn: #f0ad4e;
|
--req-warn: #f0ad4e;
|
||||||
}
|
}
|
||||||
|
|
||||||
* {
|
.req-root,
|
||||||
|
.req-root * {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
html,
|
body.jellyfin-request-standalone {
|
||||||
body {
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
|
padding: 1.25rem;
|
||||||
background: var(--req-bg);
|
background: var(--req-bg);
|
||||||
color: var(--req-text);
|
color: var(--req-text);
|
||||||
font-family: Inherit, "Segoe UI", Roboto, sans-serif;
|
font-family: Inherit, "Segoe UI", Roboto, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
.req-root {
|
||||||
padding: 1.25rem;
|
color: var(--req-text);
|
||||||
|
font-family: Inherit, "Segoe UI", Roboto, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
.req-embed {
|
.req-embed {
|
||||||
color: inherit;
|
|
||||||
background: transparent;
|
background: transparent;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<title>Request</title>
|
<title>Request</title>
|
||||||
<link rel="stylesheet" href="/Requests/Assets/request.css" />
|
<link rel="stylesheet" href="/Requests/Assets/request.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="jellyfin-request-standalone">
|
||||||
<div id="jellyfin-request-root"></div>
|
<div id="jellyfin-request-root"></div>
|
||||||
<script src="/Requests/Assets/request.js"></script>
|
<script src="/Requests/Assets/request.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
name: "Request"
|
name: "Request"
|
||||||
guid: "11c08950-c4bb-484d-89ff-205b3724416b"
|
guid: "11c08950-c4bb-484d-89ff-205b3724416b"
|
||||||
version: "1.0.0.3"
|
version: "1.0.0.4"
|
||||||
targetAbi: "10.11.11.0"
|
targetAbi: "10.11.11.0"
|
||||||
framework: "net9.0"
|
framework: "net9.0"
|
||||||
overview: "Request movies and TV shows from a local admin review queue"
|
overview: "Request movies and TV shows from a local admin review queue"
|
||||||
|
|||||||
+5
-5
@@ -9,12 +9,12 @@
|
|||||||
"repositoryUrl": "https://git.masengr.com/Michael-A-Sloan/Jellyfin_Request_tvandmovies",
|
"repositoryUrl": "https://git.masengr.com/Michael-A-Sloan/Jellyfin_Request_tvandmovies",
|
||||||
"versions": [
|
"versions": [
|
||||||
{
|
{
|
||||||
"version": "1.0.0.3",
|
"version": "1.0.0.4",
|
||||||
"changelog": "Show Request UI under the home top tabs like Home/Favorites instead of navigating away",
|
"changelog": "Fix blank Request tab by syncing panel visibility and blocking Jellyfin HomeView tab handlers",
|
||||||
"targetAbi": "10.11.11.0",
|
"targetAbi": "10.11.11.0",
|
||||||
"sourceUrl": "https://git.masengr.com/Michael-A-Sloan/Jellyfin_Request_tvandmovies/raw/branch/main/release/Jellyfin.Plugin.Request_1.0.0.3.zip",
|
"sourceUrl": "https://git.masengr.com/Michael-A-Sloan/Jellyfin_Request_tvandmovies/raw/branch/main/release/Jellyfin.Plugin.Request_1.0.0.4.zip",
|
||||||
"checksum": "F11AA68370A2E1B81AC14EB6D1DB123C",
|
"checksum": "5A31B38274F40F3AF3DE0240D2319C1E",
|
||||||
"timestamp": "2026-08-02T21:00:07.1780246Z",
|
"timestamp": "2026-08-02T21:03:57.4534409Z",
|
||||||
"dependencies": []
|
"dependencies": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
|||||||
param(
|
param(
|
||||||
[string]$Version = "1.0.0.3",
|
[string]$Version = "1.0.0.4",
|
||||||
[string]$TargetAbi = "10.11.11.0",
|
[string]$TargetAbi = "10.11.11.0",
|
||||||
[string]$RepoRawBase = "https://git.masengr.com/Michael-A-Sloan/Jellyfin_Request_tvandmovies/raw/branch/main"
|
[string]$RepoRawBase = "https://git.masengr.com/Michael-A-Sloan/Jellyfin_Request_tvandmovies/raw/branch/main"
|
||||||
)
|
)
|
||||||
@@ -17,7 +17,7 @@ $dllPath = Join-Path $root "Jellyfin.Plugin.Request\bin\Release\net9.0\Jellyfin.
|
|||||||
$zipPath = Join-Path $releaseDir $zipFileName
|
$zipPath = Join-Path $releaseDir $zipFileName
|
||||||
$manifestPath = Join-Path $root "manifest.json"
|
$manifestPath = Join-Path $root "manifest.json"
|
||||||
$timestamp = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ")
|
$timestamp = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ")
|
||||||
$changelog = "Show Request UI under the home top tabs like Home/Favorites instead of navigating away"
|
$changelog = "Fix blank Request tab by syncing panel visibility and blocking Jellyfin HomeView tab handlers"
|
||||||
|
|
||||||
Write-Host "Building plugin..."
|
Write-Host "Building plugin..."
|
||||||
dotnet build (Join-Path $root "Jellyfin.Plugin.Request.sln") -c Release
|
dotnet build (Join-Path $root "Jellyfin.Plugin.Request.sln") -c Release
|
||||||
|
|||||||
Reference in new issue
Block a user