diff --git a/public/video.js b/public/video.js
index 20bdba9..705f566 100644
--- a/public/video.js
+++ b/public/video.js
@@ -82,7 +82,7 @@ async function videoHome(st, libKey) {
v.innerHTML = `
Movies & TV ${secs.length > 1 ? `
` : ''}
${esc(cur.title)}
-
Title Date added Year, newest Year, oldest Rating Recently watched All genres Any decade Any rating Watched or not Unwatched Watched Unwatched only
`;
+ Title Date added Year, newest Year, oldest Rating Recently watched All genres Any decade Any rating Watched or not Unwatched Watched
`;
plexHomeBadge(st); // "Watching as …" with the switch, when the Plex Home has more than one person
// Continue watching, Recently added, Unwatched and the library load side by side. The rows are kept on this device (see vcGet) so they draw at once.
const vcK = k => 'vc:' + (ME ? ME.id : '') + ':' + k;
@@ -107,21 +107,21 @@ async function videoHome(st, libKey) {
px.get(`/library/sections/${cur.key}/collections`).then(mc => { const el = $('#vcolr'), items = mc.Metadata || []; if (el) el.innerHTML = items.length ? `Collections ${items.slice(0, 30).map(m => vdCard(m, false)).join('')}
` : ''; }).catch(() => {});
// sort and filter the library below
const fs = store.get('video_sort', 'titleSort:asc'), fu = store.get('video_unw', '0') === '1'; let genre = '';
- $('#vsort').value = fs; $('#vunwc').checked = fu;
+ $('#vsort').value = fs; $('#vwatch').value = fu ? '1' : '';
px.get(`/library/sections/${cur.key}/decade`).then(mc => { const g = $('#vdec'); if (g) g.insertAdjacentHTML('beforeend', (mc.Directory || []).sort((a, b) => b.key - a.key).map(d => `${esc(d.title)} `).join('')); }).catch(() => {});
px.get(`/library/sections/${cur.key}/contentRating`).then(mc => { const g = $('#vcr'); if (g) g.insertAdjacentHTML('beforeend', (mc.Directory || []).map(d => `${esc(d.title)} `).join('')); }).catch(() => {});
px.get(`/library/sections/${cur.key}/genre`).then(mc => { const g = $('#vgen'); if (g) g.insertAdjacentHTML('beforeend', (mc.Directory || []).map(d => `${esc(d.title)} `).join('')); }).catch(() => {});
let start = 0, total = 0, all = [], gen = 0;
const load = async () => {
- const my = gen, mc = await px.get(`/library/sections/${cur.key}/all?type=${type}&sort=${vdEnc($('#vsort').value)}${$('#vunwc').checked || $('#vwatch').value === '1' ? '&unwatched=1' : ''}${$('#vwatch').value === '0' ? '&unwatched=0' : ''}${genre ? '&genre=' + vdEnc(genre) : ''}${$('#vdec').value ? '&decade=' + vdEnc($('#vdec').value) : ''}${$('#vcr').value ? '&contentRating=' + vdEnc($('#vcr').value) : ''}${vd.person ? '&' + vd.person.filter : ''}&X-Plex-Container-Start=${start}&X-Plex-Container-Size=${size}`);
+ const my = gen, mc = await px.get(`/library/sections/${cur.key}/all?type=${type}&sort=${vdEnc($('#vsort').value)}${$('#vwatch').value === '1' ? '&unwatched=1' : ''}${$('#vwatch').value === '0' ? '&unwatched=0' : ''}${genre ? '&genre=' + vdEnc(genre) : ''}${$('#vdec').value ? '&decade=' + vdEnc($('#vdec').value) : ''}${$('#vcr').value ? '&contentRating=' + vdEnc($('#vcr').value) : ''}${vd.person ? '&' + vd.person.filter : ''}&X-Plex-Container-Start=${start}&X-Plex-Container-Size=${size}`);
if (!$('#vgrid') || my !== gen) return; total = mc.totalSize || mc.size || 0; const items = mc.Metadata || []; start += items.length; all = all.concat(items);
$('#vgrid').insertAdjacentHTML('beforeend', items.map(m => vdCard(m)).join('')); if (start === items.length) $('#vgrid .vsk') && $('#vgrid').querySelectorAll('.vsk').forEach(x => x.remove());
$('#vmore').innerHTML = start < total ? `Show more (${total - start} left)
` : '';
if ($('#vmb')) $('#vmb').onclick = () => load().catch(e => toast(e.message));
- if (!all.length) { $('#vgrid').innerHTML = `${icon('film')}
Nothing matches.
${$('#vunwc').checked || genre ? '
Clear filters ' : ''}
`; if ($('#vfc')) $('#vfc').onclick = () => { $('#vunwc').checked = false; store.set('video_unw', '0'); genre = ''; $('#vgen').value = ''; reload(); }; }
+ if (!all.length) { $('#vgrid').innerHTML = `${icon('film')}
Nothing matches.
${$('#vwatch').value || genre ? '
Clear filters ' : ''}
`; if ($('#vfc')) $('#vfc').onclick = () => { $('#vwatch').value = ''; store.set('video_unw', '0'); genre = ''; $('#vgen').value = ''; reload(); }; }
};
const reload = () => { gen++; start = 0; total = 0; all = []; $('#vmore').innerHTML = ''; $('#vgrid').innerHTML = ' '.repeat(12); load().catch(e => { if ($('#vgrid')) $('#vgrid').innerHTML = `${esc(e.message)}
`; }); };
- $('#vsort').onchange = () => { store.set('video_sort', $('#vsort').value); reload(); }; $('#vunwc').onchange = () => { store.set('video_unw', $('#vunwc').checked ? '1' : '0'); reload(); }; $('#vgen').onchange = () => { genre = $('#vgen').value; reload(); }; for (const id of ['#vdec', '#vcr', '#vwatch']) $(id).onchange = () => reload();
+ $('#vsort').onchange = () => { store.set('video_sort', $('#vsort').value); reload(); }; $('#vwatch').onchange = () => { store.set('video_unw', $('#vwatch').value === '1' ? '1' : '0'); reload(); }; $('#vgen').onchange = () => { genre = $('#vgen').value; reload(); }; for (const id of ['#vdec', '#vcr']) $(id).onchange = () => reload();
reload();
// press and hold (or right-click) a card: quick actions
const vv = $('#view .wrap') || $('#view'); let hold = 0, held = false; // (the page's own wrapper, new on every draw, so the handlers never pile up)