Improve handling of Version Preferences

This commit is contained in:
HighImKevin committed 2026-09-25 05:05:45 -04:00
1 parent 165450bb52
commit b97d097d5d
2 files changed
+12 -25

No files matched your search

@@ -142,9 +142,6 @@
<div class="listItemContent"> <div class="listItemContent">
<div class="listItemBodyText" style="margin-bottom: 0.35em; font-weight: 500;">${escapeHtml(title)}</div> <div class="listItemBodyText" style="margin-bottom: 0.35em; font-weight: 500;">${escapeHtml(title)}</div>
<div class="listItemBodyText secondary" style="margin-bottom: 0.5em; font-size: 0.9em;">${escapeHtml(hint)}</div> <div class="listItemBodyText secondary" style="margin-bottom: 0.5em; font-size: 0.9em;">${escapeHtml(hint)}</div>
<div class="listItemBodyText secondary" style="margin-bottom: 0.75em; font-size: 0.85em;">
None = sources with no matching terms in this list. It cannot be edited or deleted, but you can change its priority.
</div>
<div class="kefin-vp-term-list" data-list="${escapeHtml(listKey)}"> <div class="kefin-vp-term-list" data-list="${escapeHtml(listKey)}">
${terms.map((term, i) => buildTermRowHTML(term, i, listKey)).join('')} ${terms.map((term, i) => buildTermRowHTML(term, i, listKey)).join('')}
</div> </div>
@@ -180,12 +177,7 @@
[data-name="kefin-modal-content"]:has(.kefin-vp-lists-grid) > div { [data-name="kefin-modal-content"]:has(.kefin-vp-lists-grid) > div {
height: 100% !important; height: 100% !important;
} }
[data-name="kefin-modal-content"]:has(.kefin-vp-lists-grid) > div > div {
height: 100%;
}
.listItem.kefin-vp-list-section { .listItem.kefin-vp-list-section {
height: calc(100% - 1.5em);
align-items: start; align-items: start;
} }
.kefin-vp-label-order-card { .kefin-vp-label-order-card {
@@ -283,13 +275,13 @@
<div class="kefin-vp-lists-grid"> <div class="kefin-vp-lists-grid">
${buildListSectionHTML( ${buildListSectionHTML(
'Version Terms', 'Version Terms',
'Resolution / quality labels (e.g. 4k, 1080p). Order is priority.', 'Resolution / quality labels (e.g. 4k, 1080p).',
'versions', 'versions',
config.versions config.versions
)} )}
${buildListSectionHTML( ${buildListSectionHTML(
'Edition Terms', 'Edition Terms',
'Edition labels (e.g. Theatrical, Director\'s Cut). Order is priority.', 'Edition labels (e.g. Theatrical, Director\'s Cut).',
'editions', 'editions',
config.editions config.editions
)} )}
+10 -15
View File
@@ -259,7 +259,6 @@
applyScheduled = true; applyScheduled = true;
requestAnimationFrame(() => { requestAnimationFrame(() => {
applyScheduled = false; applyScheduled = false;
if (!observer) return;
tryApply(); tryApply();
}); });
} }
@@ -287,26 +286,26 @@
return false; return false;
} }
function observeForSelect() { /** Long-lived document observer; gates on unbound visible details select. */
disconnectObserver(); function ensureDocumentObserver() {
if (observer) return;
tryApply(); tryApply();
const container = document.querySelector(CONTAINER_SELECTOR); const root = document.body || document.documentElement;
if (!container) { if (!root) return;
return;
}
observer = new MutationObserver((mutations) => { observer = new MutationObserver((mutations) => {
if (isApplying) return; if (isApplying) return;
if (!isRelevantMutation(mutations)) return; if (!isRelevantMutation(mutations)) return;
scheduleTryApply(); scheduleTryApply();
}); });
observer.observe(container, { childList: true, subtree: true }); observer.observe(root, { childList: true, subtree: true });
} }
function onDetailsPage() { function onDetailsPage() {
observeForSelect(); ensureDocumentObserver();
tryApply();
} }
function init() { function init() {
@@ -315,6 +314,8 @@
return; return;
} }
ensureDocumentObserver();
window.KefinTweaksUtils.onViewPage(() => { window.KefinTweaksUtils.onViewPage(() => {
try { try {
onDetailsPage(); onDetailsPage();
@@ -323,12 +324,6 @@
} }
}, { pages: ['details'] }); }, { pages: ['details'] });
window.KefinTweaksUtils.onViewPage((_view, _element, hash) => {
if (!isDetailsHash(hash)) {
disconnectObserver();
}
});
LOG('Initialized'); LOG('Initialized');
} }