Skip to content

Commit 75f1544

Browse files
Improve docker clone row matching for left-column centering
1 parent 5ae5fbb commit 75f1544

3 files changed

Lines changed: 80 additions & 21 deletions

File tree

209 KB
Binary file not shown.

folderview.plus.plg

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@
66
<!ENTITY launch "Settings/FolderViewPlus">
77
<!ENTITY plugdir "/usr/local/emhttp/plugins/&name;">
88
<!ENTITY pluginURL "https://raw.githubusercontent.com/&github;/main/folderview.plus.plg">
9-
<!ENTITY version "2026.03.08.5">
10-
<!ENTITY md5 "292969f4dacb98f9268ce80256b6324f">
9+
<!ENTITY version "2026.03.08.6">
10+
<!ENTITY md5 "0006d7b11b6eb358a9685ebee00735a7">
1111
]>
1212

1313
<PLUGIN name="&name;" author="&author;" version="&version;" launch="&launch;" pluginURL="&pluginURL;" icon="folder-open-o" support="https://github.com/alexphillips-dev/FolderView-Plus/issues" min="7.0.0">
1414
<CHANGES>
1515

16+
###2026.03.08.6
17+
- Improve clone-row height matching reliability for Docker folder left column:
18+
- match clone rows to main rows by folder id, then folder name, with index fallback,
19+
- source canonical heights from `#docker_list` rows only,
20+
- keep main rows natural while applying synced heights to clone rows for true visual centering.
21+
1622
###2026.03.08.5
1723
- Rework Docker left-column centering sync to match by folder id content:
1824
- derive folder id from row class or hidden `folder-(id)` marker,

src/folderview.plus/usr/local/emhttp/plugins/folderview.plus/scripts/docker.js

Lines changed: 72 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,17 @@ const getFolderIdFromRow = (row) => {
8585
return '';
8686
};
8787

88+
const getFolderNameFromRow = (row) => {
89+
if (!row || !row.querySelector) {
90+
return '';
91+
}
92+
const label = row.querySelector('td.ct-name.folder-name a.exec.folder-appname');
93+
if (!label || typeof label.textContent !== 'string') {
94+
return '';
95+
}
96+
return label.textContent.trim();
97+
};
98+
8899
const getRenderedRowHeight = (row) => {
89100
if (!row) {
90101
return 0;
@@ -121,6 +132,37 @@ const applyRowHeight = (row, height = 0) => {
121132
});
122133
};
123134

135+
const buildMainFolderHeightLookup = () => {
136+
const byId = new Map();
137+
const byName = new Map();
138+
const ordered = [];
139+
140+
const mainRows = Array.from(document.querySelectorAll('#docker_list tr')).filter((row) => {
141+
return !!(row && row.querySelector && row.querySelector('td.ct-name.folder-name'));
142+
});
143+
144+
mainRows.forEach((row) => {
145+
const height = getRenderedRowHeight(row);
146+
if (height <= 0) {
147+
return;
148+
}
149+
150+
ordered.push(height);
151+
152+
const folderId = getFolderIdFromRow(row);
153+
if (folderId && !byId.has(folderId)) {
154+
byId.set(folderId, height);
155+
}
156+
157+
const folderName = getFolderNameFromRow(row);
158+
if (folderName && !byName.has(folderName)) {
159+
byName.set(folderName, height);
160+
}
161+
});
162+
163+
return { byId, byName, ordered };
164+
};
165+
124166
const applyFolderCellCentering = (cell, rowHeight = 0) => {
125167
if (!cell) {
126168
return false;
@@ -171,31 +213,42 @@ const applyFolderCellCentering = (cell, rowHeight = 0) => {
171213
};
172214

173215
const forceAllFolderRowsVerticalCenter = () => {
174-
const mainRowHeightByFolderId = new Map();
175-
document.querySelectorAll('#docker_list tr').forEach((row) => {
176-
const id = getFolderIdFromRow(row);
177-
if (!id) {
216+
const lookup = buildMainFolderHeightLookup();
217+
218+
const cloneRows = [];
219+
const cloneSeen = new Set();
220+
document.querySelectorAll('td.ct-name.folder-name').forEach((cell) => {
221+
const row = cell.parentElement;
222+
if (!row || isMainDockerRow(row) || cloneSeen.has(row)) {
178223
return;
179224
}
180-
const height = getRenderedRowHeight(row);
181-
if (height > 0) {
182-
mainRowHeightByFolderId.set(id, height);
183-
}
225+
cloneSeen.add(row);
226+
cloneRows.push(row);
184227
});
185228

186-
const processedRows = new Set();
187-
document.querySelectorAll('td.ct-name.folder-name').forEach((cell) => {
188-
const parentRow = cell.parentElement;
189-
if (!parentRow || processedRows.has(parentRow)) {
190-
return;
229+
cloneRows.forEach((row, index) => {
230+
const folderId = getFolderIdFromRow(row);
231+
const folderName = getFolderNameFromRow(row);
232+
let targetHeight = 0;
233+
234+
if (folderId && lookup.byId.has(folderId)) {
235+
targetHeight = lookup.byId.get(folderId);
236+
} else if (folderName && lookup.byName.has(folderName)) {
237+
targetHeight = lookup.byName.get(folderName);
238+
} else if (lookup.ordered.length > 0) {
239+
targetHeight = lookup.ordered[Math.min(index, lookup.ordered.length - 1)];
191240
}
192-
processedRows.add(parentRow);
193241

194-
const folderId = getFolderIdFromRow(parentRow);
195-
const mainHeight = folderId ? (mainRowHeightByFolderId.get(folderId) || 0) : 0;
196-
const targetHeight = !isMainDockerRow(parentRow) && mainHeight > 0 ? mainHeight : 0;
197-
applyRowHeight(parentRow, targetHeight);
198-
applyFolderCellCentering(cell, targetHeight);
242+
applyRowHeight(row, targetHeight);
243+
row.querySelectorAll('td.ct-name.folder-name').forEach((cell) => {
244+
applyFolderCellCentering(cell, targetHeight);
245+
});
246+
});
247+
248+
document.querySelectorAll('#docker_list td.ct-name.folder-name').forEach((cell) => {
249+
const row = cell.parentElement;
250+
applyRowHeight(row, 0);
251+
applyFolderCellCentering(cell, 0);
199252
});
200253
};
201254

0 commit comments

Comments
 (0)