Updates extensions in workspace. Alters plugin to scrape for NxN tabs for videos to display in the matrix.
This commit is contained in:
1 parent
d5eb687606
commit
93879bc8f7
4 files changed
+34
-40
No files matched your search
+17
-8
@@ -184,8 +184,9 @@ findBtn.addEventListener('click', async () => {
|
||||
[TAGGED_KEY]: items.map(v => v.tab),
|
||||
});
|
||||
|
||||
setStatus(`Found ${items.length} video(s) across ${scanned} tab(s).`);
|
||||
renderList(storedItems.map(v => ({ url: v, label: v.tab })));
|
||||
const skippedTabs = results.filter(r => r === null).length;
|
||||
const statusMsg = `Found ${items.length} video(s) across ${scanned} tab(s).`;
|
||||
setStatus(skippedTabs > 0 ? `${statusMsg} ${skippedTabs} tab(s) skipped (idle).` : statusMsg);
|
||||
btnRow.style.display = 'flex';
|
||||
} catch (e) {
|
||||
setStatus(`Scan failed: ${e.message}`);
|
||||
@@ -203,10 +204,17 @@ openBtn.addEventListener('click', async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
// Take the first 4 (viewer grid is 2x2)
|
||||
const videoUrls = urls.slice(0, 4);
|
||||
const videoTags = tags ? tags.slice(0, 4) : [];
|
||||
console.log('[goon] opening viewer with', videoUrls.length, 'video URLs:', videoUrls);
|
||||
// Dedup by index to preserve tag alignment
|
||||
const videoUrls = urls;
|
||||
const videoTags = tags || [];
|
||||
|
||||
// Compute NxN grid
|
||||
const N = Math.ceil(Math.sqrt(videoUrls.length));
|
||||
const PANEL_MIN_W = 420;
|
||||
const PANEL_MIN_H = 340;
|
||||
const GAP = 2;
|
||||
const winW = Math.max(PANEL_MIN_W * N + GAP * (N - 1), 400);
|
||||
const winH = Math.max(PANEL_MIN_H * N + GAP * (N - 1) + 40, 300);
|
||||
|
||||
const id = 'goonViewer_' + Date.now();
|
||||
await chrome.storage.local.set({ [id]: videoUrls });
|
||||
@@ -218,8 +226,9 @@ openBtn.addEventListener('click', async () => {
|
||||
await new Promise(r => setTimeout(r, 100));
|
||||
|
||||
const tagsParam = videoTags.length > 0 ? '&tags=' + encodeURIComponent(JSON.stringify(videoTags)) : '';
|
||||
const viewerUrl = chrome.runtime.getURL('viewer/viewer.html') + '?id=' + id + tagsParam;
|
||||
chrome.windows.create({ url: viewerUrl, width: 1400, height: 900 });
|
||||
const gridParam = '&grid=' + N;
|
||||
const viewerUrl = chrome.runtime.getURL('viewer/viewer.html') + '?id=' + id + gridParam + tagsParam;
|
||||
chrome.windows.create({ url: viewerUrl, width: winW, height: winH });
|
||||
});
|
||||
|
||||
/* === "Clear" — reset the stored list === */
|
||||
|
||||
Reference in new issue
Block a user