From b1c85efe0397db181589449688de238f80eba4ec Mon Sep 17 00:00:00 2001 From: KoloMl Date: Thu, 1 Oct 2026 07:23:20 +0200 Subject: [PATCH] Support updated duplicate reports table from latest Philomena update --- .../philomena/dupe/GridDupeReportsList.ts | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/content/components/philomena/dupe/GridDupeReportsList.ts b/src/content/components/philomena/dupe/GridDupeReportsList.ts index 1e8db67..4ab8d71 100644 --- a/src/content/components/philomena/dupe/GridDupeReportsList.ts +++ b/src/content/components/philomena/dupe/GridDupeReportsList.ts @@ -5,22 +5,16 @@ export default class GridDupeReportsList extends BaseComponent { readonly #reports: DupeReportRow[] = []; protected build() { - const childrenElements = this.container.children; + const repotRowsList = this.container.querySelectorAll('tbody > tr'); - for (let cellIndex = 0; cellIndex < this.container.childElementCount; cellIndex += 4) { - const startingCell = childrenElements.item(cellIndex); - - // First 4 cells are actually table headers, skipping them. - if (!(startingCell instanceof HTMLElement) || startingCell.tagName === 'P') { - continue; - } - - const rightImageCell = startingCell.nextElementSibling; + for (const reportRow of repotRowsList) { + const startingCell = reportRow.firstElementChild; + const rightImageCell = startingCell?.nextElementSibling || null; const diffCell = rightImageCell?.nextElementSibling || null; const reportOptionsCell = diffCell?.nextElementSibling || null; - if (!(rightImageCell instanceof HTMLElement) || !(diffCell instanceof HTMLElement) || !(reportOptionsCell instanceof HTMLElement)) { - console.error(`Unable to capture duplicate report row from starting cell at index ${cellIndex}!`); + if (!(startingCell instanceof HTMLElement) || !(rightImageCell instanceof HTMLElement) || !(diffCell instanceof HTMLElement) || !(reportOptionsCell instanceof HTMLElement)) { + console.error(`Unable to capture duplicate report!`, reportRow); continue; } @@ -42,7 +36,7 @@ export default class GridDupeReportsList extends BaseComponent { } static findAndInitialize() { - for (const container of document.querySelectorAll('.grid--dupe-report-list')) { + for (const container of document.querySelectorAll('.dupe-report-list')) { new GridDupeReportsList(container).initialize(); } }