Skip to content

Commit

Permalink
exact-filesizes: Fix match row
Browse files Browse the repository at this point in the history
  • Loading branch information
euamotubaina committed Dec 20, 2024
1 parent 62e9210 commit 57637e4
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions ops-red-exact-filesizes.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name OPS-RED: Exact filesizes
// @description Get exact size of files. Click [SZ] next to [PL]
// @version 2024-12-20_02
// @version 2024-12-20_03
// @namespace github.com/euamotubaina
// @author userscript1
// @match https://redacted.sh/torrents.php?id=*
Expand Down Expand Up @@ -76,9 +76,6 @@
function parseFilesData(torRowEl, filesEl, filesData) {
let totalSZ = torRowEl.querySelector('.td_totalexactsize');
const totalSizeEl = torRowEl.querySelector(':scope > td.td_size, :scope > td.nobr:not(.td_filecount, .td_totalexactsize)');
const matchRowEl = document.getElementById(`${torRowEl.id}_match`);
const matchTotalSZ = matchRowEl.querySelector('.td_totalexactsize');
const matchTotalSizeEl = matchRowEl.querySelector('.td_size');
if (!totalSZ) {
totalSZ = totalSizeEl.cloneNode();
totalSZ.classList.add('td_totalexactsize');
Expand All @@ -89,10 +86,16 @@
totalSZ.classList.toggle('hidden');
}

matchTotalSZ.classList.toggle('hidden');
matchTotalSizeEl.classList.toggle('hidden');
totalSizeEl.classList.toggle('hidden');

const matchRowEl = document.getElementById(`${torRowEl.id}_match`);
if (matchRowEl) {
const matchTotalSZ = matchRowEl.querySelector('.td_totalexactsize');
const matchTotalSizeEl = matchRowEl.querySelector('.td_size');
matchTotalSZ.classList.toggle('hidden');
matchTotalSizeEl.classList.toggle('hidden');
}

filesEl.querySelectorAll('tr:not(.colhead_dark)').forEach((tr, i) => {
const fileData = filesData.fileList[i];
if (tr.children[0].textContent === fileData.name) {
Expand Down

0 comments on commit 57637e4

Please sign in to comment.