MCPcopy Create free account
hub / github.com/error311/FileRise / injectInlineFolderRows

Function injectInlineFolderRows

public/js/fileListView.js:6654–7077  ·  view source on GitHub ↗
(fileListContent, folder, pageSubfolders)

Source from the content-addressed store, hash-verified

6652}
6653
6654function injectInlineFolderRows(fileListContent, folder, pageSubfolders) {
6655 const table = fileListContent.querySelector('table.filr-table');
6656
6657 // Use the paged subfolders if provided, otherwise fall back to all
6658 const subfolders = Array.isArray(pageSubfolders) && pageSubfolders.length
6659 ? pageSubfolders
6660 : (Array.isArray(window.currentSubfolders) ? window.currentSubfolders : []);
6661
6662 if (!table || !subfolders.length) return;
6663
6664 const thead = table.tHead;
6665 const tbody = table.tBodies && table.tBodies[0];
6666 if (!thead || !tbody) return;
6667
6668 const headerRow = thead.rows[0];
6669 if (!headerRow) return;
6670
6671 const headerCells = Array.from(headerRow.cells);
6672 const colCount = headerCells.length;
6673
6674 // --- Column indices -------------------------------------------------------
6675 let checkboxIdx = headerCells.findIndex(th =>
6676 th.classList.contains("checkbox-col") ||
6677 th.querySelector('input[type="checkbox"]')
6678 );
6679
6680 let nameIdx = headerCells.findIndex(th =>
6681 (th.dataset && th.dataset.column === "name") ||
6682 /\bname\b/i.test((th.textContent || "").trim())
6683 );
6684 if (nameIdx < 0) {
6685 nameIdx = Math.min(1, colCount - 1); // fallback to 2nd col
6686 }
6687
6688 let sizeIdx = headerCells.findIndex(th =>
6689 (th.dataset && (th.dataset.column === "size" || th.dataset.column === "filesize")) ||
6690 /\bsize\b/i.test((th.textContent || "").trim())
6691 );
6692 if (sizeIdx < 0) sizeIdx = -1;
6693
6694 let uploaderIdx = headerCells.findIndex(th =>
6695 (th.dataset && th.dataset.column === "uploader") ||
6696 /\buploader\b/i.test((th.textContent || "").trim())
6697 );
6698 if (uploaderIdx < 0) uploaderIdx = -1;
6699
6700 let actionsIdx = headerCells.findIndex(th =>
6701 (th.dataset && th.dataset.column === "actions") ||
6702 /\bactions?\b/i.test((th.textContent || "").trim()) ||
6703 /\bactions?-col\b/i.test(th.className || "")
6704 );
6705 if (actionsIdx < 0) actionsIdx = -1;
6706
6707 // NEW: created / modified column indices (uploaded = created in your header)
6708 let createdIdx = headerCells.findIndex(th =>
6709 (th.dataset && (th.dataset.column === "uploaded" || th.dataset.column === "created")) ||
6710 /\b(uploaded|created)\b/i.test((th.textContent || "").trim())
6711 );

Callers 1

renderFileTableFunction · 0.85

Calls 15

tFunction · 0.85
hideHoverPreviewFunction · 0.85
getPaneKeyForElementFunction · 0.85
setCurrentFolderContextFunction · 0.85
loadFileListFunction · 0.85
folderDropHandlerFunction · 0.85
fetchFolderCapsFunction · 0.85
openMoveFolderUIFunction · 0.85
openColorFolderModalFunction · 0.85

Tested by

no test coverage detected