テーブルのマウント位置の調整

This commit is contained in:
Keisuke Hirata 2026-04-09 03:12:59 +09:00
parent 668574341e
commit 4f401356cd

View File

@ -7,10 +7,12 @@ const CONTAINER_ID = "ytpf-playlist-table";
let currentHandle: PlaylistTableHandle | null = null; let currentHandle: PlaylistTableHandle | null = null;
function findAnchor(): { parent: Element; before: Element | null } | null { function findAnchor(): { parent: Element; before: Element | null } | null {
// Primary: before ytd-playlist-video-list-renderer (sibling) // Primary: top of ytd-item-section-renderer (before any header/content)
const videoList = document.querySelector("ytd-playlist-video-list-renderer"); const itemSection = document.querySelector(
if (videoList?.parentElement) { "ytd-section-list-renderer ytd-item-section-renderer",
return { parent: videoList.parentElement, before: videoList }; );
if (itemSection) {
return { parent: itemSection, before: itemSection.firstElementChild };
} }
// Fallback: end of ytd-section-list-renderer > #contents // Fallback: end of ytd-section-list-renderer > #contents