Improve handling of Version Preferences

This commit is contained in:
HighImKevin
2026-09-25 05:05:45 -04:00
parent 165450bb52
commit b97d097d5d
2 changed files with 12 additions and 25 deletions
@@ -142,9 +142,6 @@
<div class="listItemContent">
<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.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)}">
${terms.map((term, i) => buildTermRowHTML(term, i, listKey)).join('')}
</div>
@@ -180,12 +177,7 @@
[data-name="kefin-modal-content"]:has(.kefin-vp-lists-grid) > div {
height: 100% !important;
}
[data-name="kefin-modal-content"]:has(.kefin-vp-lists-grid) > div > div {
height: 100%;
}
.listItem.kefin-vp-list-section {
height: calc(100% - 1.5em);
align-items: start;
}
.kefin-vp-label-order-card {
@@ -283,13 +275,13 @@
<div class="kefin-vp-lists-grid">
${buildListSectionHTML(
'Version Terms',
'Resolution / quality labels (e.g. 4k, 1080p). Order is priority.',
'Resolution / quality labels (e.g. 4k, 1080p).',
'versions',
config.versions
)}
${buildListSectionHTML(
'Edition Terms',
'Edition labels (e.g. Theatrical, Director\'s Cut). Order is priority.',
'Edition labels (e.g. Theatrical, Director\'s Cut).',
'editions',
config.editions
)}
+10 -15
View File
@@ -259,7 +259,6 @@
applyScheduled = true;
requestAnimationFrame(() => {
applyScheduled = false;
if (!observer) return;
tryApply();
});
}
@@ -287,26 +286,26 @@
return false;
}
function observeForSelect() {
disconnectObserver();
/** Long-lived document observer; gates on unbound visible details select. */
function ensureDocumentObserver() {
if (observer) return;
tryApply();
const container = document.querySelector(CONTAINER_SELECTOR);
if (!container) {
return;
}
const root = document.body || document.documentElement;
if (!root) return;
observer = new MutationObserver((mutations) => {
if (isApplying) return;
if (!isRelevantMutation(mutations)) return;
scheduleTryApply();
});
observer.observe(container, { childList: true, subtree: true });
observer.observe(root, { childList: true, subtree: true });
}
function onDetailsPage() {
observeForSelect();
ensureDocumentObserver();
tryApply();
}
function init() {
@@ -315,6 +314,8 @@
return;
}
ensureDocumentObserver();
window.KefinTweaksUtils.onViewPage(() => {
try {
onDetailsPage();
@@ -323,12 +324,6 @@
}
}, { pages: ['details'] });
window.KefinTweaksUtils.onViewPage((_view, _element, hash) => {
if (!isDetailsHash(hash)) {
disconnectObserver();
}
});
LOG('Initialized');
}