mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 05:08:05 -06:00
WebUI: Use Map instead of Mootools Hash in all dynamic tables
PR #21358.
This commit is contained in:
@@ -483,9 +483,8 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
}
|
||||
};
|
||||
|
||||
const all = torrentsTable.rows.size;
|
||||
let uncategorized = 0;
|
||||
for (const { full_data: { category } } of torrentsTable.rows.values()) {
|
||||
for (const { full_data: { category } } of torrentsTable.getRowValues()) {
|
||||
if (category.length === 0)
|
||||
uncategorized += 1;
|
||||
}
|
||||
@@ -517,7 +516,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
});
|
||||
|
||||
const categoriesFragment = new DocumentFragment();
|
||||
categoriesFragment.appendChild(createCategoryLink(CATEGORIES_ALL, "QBT_TR(All)QBT_TR[CONTEXT=CategoryFilterModel]", all));
|
||||
categoriesFragment.appendChild(createCategoryLink(CATEGORIES_ALL, "QBT_TR(All)QBT_TR[CONTEXT=CategoryFilterModel]", torrentsTable.getRowSize()));
|
||||
categoriesFragment.appendChild(createCategoryLink(CATEGORIES_UNCATEGORIZED, "QBT_TR(Uncategorized)QBT_TR[CONTEXT=CategoryFilterModel]", uncategorized));
|
||||
|
||||
if (useSubcategories) {
|
||||
@@ -581,14 +580,13 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
return tagFilterItem;
|
||||
};
|
||||
|
||||
const torrentsCount = torrentsTable.rows.size;
|
||||
let untagged = 0;
|
||||
for (const { full_data: { tags } } of torrentsTable.rows.values()) {
|
||||
for (const { full_data: { tags } } of torrentsTable.getRowValues()) {
|
||||
if (tags.length === 0)
|
||||
untagged += 1;
|
||||
}
|
||||
|
||||
tagFilterList.appendChild(createLink(TAGS_ALL, "QBT_TR(All)QBT_TR[CONTEXT=TagFilterModel]", torrentsCount));
|
||||
tagFilterList.appendChild(createLink(TAGS_ALL, "QBT_TR(All)QBT_TR[CONTEXT=TagFilterModel]", torrentsTable.getRowSize()));
|
||||
tagFilterList.appendChild(createLink(TAGS_UNTAGGED, "QBT_TR(Untagged)QBT_TR[CONTEXT=TagFilterModel]", untagged));
|
||||
|
||||
const sortedTags = [];
|
||||
@@ -634,14 +632,13 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
return trackerFilterItem;
|
||||
};
|
||||
|
||||
const torrentsCount = torrentsTable.rows.size;
|
||||
let trackerlessTorrentsCount = 0;
|
||||
for (const { full_data: { trackers_count: trackersCount } } of torrentsTable.rows.values()) {
|
||||
for (const { full_data: { trackers_count: trackersCount } } of torrentsTable.getRowValues()) {
|
||||
if (trackersCount === 0)
|
||||
trackerlessTorrentsCount += 1;
|
||||
}
|
||||
|
||||
trackerFilterList.appendChild(createLink(TRACKERS_ALL, "QBT_TR(All (%1))QBT_TR[CONTEXT=TrackerFiltersList]", torrentsCount));
|
||||
trackerFilterList.appendChild(createLink(TRACKERS_ALL, "QBT_TR(All (%1))QBT_TR[CONTEXT=TrackerFiltersList]", torrentsTable.getRowSize()));
|
||||
trackerFilterList.appendChild(createLink(TRACKERS_TRACKERLESS, "QBT_TR(Trackerless (%1))QBT_TR[CONTEXT=TrackerFiltersList]", trackerlessTorrentsCount));
|
||||
|
||||
// Remove unused trackers
|
||||
|
||||
@@ -323,7 +323,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
|
||||
const selectedRows = torrentsTable.selectedRowsIds();
|
||||
selectedRows.forEach((item, index) => {
|
||||
const data = torrentsTable.rows.get(item).full_data;
|
||||
const data = torrentsTable.getRow(item).full_data;
|
||||
|
||||
if (data["seq_dl"] !== true)
|
||||
all_are_seq_dl = false;
|
||||
@@ -374,7 +374,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
|
||||
// hide renameFiles when more than 1 torrent is selected
|
||||
if (selectedRows.length === 1) {
|
||||
const data = torrentsTable.rows.get(selectedRows[0]).full_data;
|
||||
const data = torrentsTable.getRow(selectedRows[0]).full_data;
|
||||
const metadata_downloaded = !((data["state"] === "metaDL") || (data["state"] === "forcedMetaDL") || (data["total_size"] === -1));
|
||||
|
||||
// hide renameFiles when metadata hasn't been downloaded yet
|
||||
@@ -655,7 +655,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
this.hideItem("copyFeedURL");
|
||||
break;
|
||||
case 1:
|
||||
if (selectedRows[0] === 0) {
|
||||
if (selectedRows[0] === "0") {
|
||||
// menu when "unread" feed selected
|
||||
this.showItem("update");
|
||||
this.showItem("markRead");
|
||||
@@ -666,7 +666,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
this.hideItem("updateAll");
|
||||
this.hideItem("copyFeedURL");
|
||||
}
|
||||
else if (window.qBittorrent.Rss.rssFeedTable.rows[selectedRows[0]].full_data.dataUid === "") {
|
||||
else if (window.qBittorrent.Rss.rssFeedTable.getRow(selectedRows[0]).full_data.dataUid === "") {
|
||||
// menu when single folder selected
|
||||
this.showItem("update");
|
||||
this.showItem("markRead");
|
||||
|
||||
@@ -76,7 +76,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
this.fixedTableHeader = $(dynamicTableFixedHeaderDivId).getElements("tr")[0];
|
||||
this.hiddenTableHeader = $(dynamicTableDivId).getElements("tr")[0];
|
||||
this.tableBody = $(dynamicTableDivId).getElements("tbody")[0];
|
||||
this.rows = new Hash();
|
||||
this.rows = new Map();
|
||||
this.selectedRows = [];
|
||||
this.columns = [];
|
||||
this.contextMenu = contextMenu;
|
||||
@@ -665,11 +665,9 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
getFilteredAndSortedRows: function() {
|
||||
const filteredRows = [];
|
||||
|
||||
const rows = this.rows.getValues();
|
||||
|
||||
for (let i = 0; i < rows.length; ++i) {
|
||||
filteredRows.push(rows[i]);
|
||||
filteredRows[rows[i].rowId] = rows[i];
|
||||
for (const row of this.getRowValues()) {
|
||||
filteredRows.push(row);
|
||||
filteredRows[row.rowId] = row;
|
||||
}
|
||||
|
||||
filteredRows.sort((row1, row2) => {
|
||||
@@ -828,16 +826,14 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
|
||||
removeRow: function(rowId) {
|
||||
this.selectedRows.erase(rowId);
|
||||
if (this.rows.has(rowId))
|
||||
this.rows.erase(rowId);
|
||||
this.rows.delete(rowId);
|
||||
const tr = this.getTrByRowId(rowId);
|
||||
if (tr !== null)
|
||||
tr.destroy();
|
||||
tr?.destroy();
|
||||
},
|
||||
|
||||
clear: function() {
|
||||
this.deselectAll();
|
||||
this.rows.empty();
|
||||
this.rows.clear();
|
||||
const trs = this.tableBody.getElements("tr");
|
||||
while (trs.length > 0)
|
||||
trs.pop().destroy();
|
||||
@@ -848,7 +844,19 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
},
|
||||
|
||||
getRowIds: function() {
|
||||
return this.rows.getKeys();
|
||||
return this.rows.keys();
|
||||
},
|
||||
|
||||
getRowValues: function() {
|
||||
return this.rows.values();
|
||||
},
|
||||
|
||||
getRowItems: function() {
|
||||
return this.rows.entries();
|
||||
},
|
||||
|
||||
getRowSize: function() {
|
||||
return this.rows.size;
|
||||
},
|
||||
|
||||
selectNextRow: function() {
|
||||
@@ -899,11 +907,6 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
const TorrentsTable = new Class({
|
||||
Extends: DynamicTable,
|
||||
|
||||
setup: function(dynamicTableDivId, dynamicTableFixedHeaderDivId, contextMenu) {
|
||||
this.parent(dynamicTableDivId, dynamicTableFixedHeaderDivId, contextMenu);
|
||||
this.rows = new Map();
|
||||
},
|
||||
|
||||
initColumns: function() {
|
||||
this.newColumn("priority", "", "#", 30, true);
|
||||
this.newColumn("state_icon", "cursor: default", "", 22, true);
|
||||
@@ -1510,25 +1513,6 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
return true;
|
||||
},
|
||||
|
||||
removeRow: function(rowId) {
|
||||
this.selectedRows.erase(rowId);
|
||||
this.rows.delete(rowId);
|
||||
const tr = this.getTrByRowId(rowId);
|
||||
tr?.destroy();
|
||||
},
|
||||
|
||||
clear: function() {
|
||||
this.deselectAll();
|
||||
this.rows.clear();
|
||||
const trs = this.tableBody.getElements("tr");
|
||||
while (trs.length > 0)
|
||||
trs.pop().destroy();
|
||||
},
|
||||
|
||||
getRowIds: function() {
|
||||
return this.rows.keys();
|
||||
},
|
||||
|
||||
getFilteredTorrentsNumber: function(filterName, categoryHash, tagHash, trackerHash) {
|
||||
let cnt = 0;
|
||||
|
||||
@@ -1809,7 +1793,6 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
};
|
||||
|
||||
let filteredRows = [];
|
||||
const rows = this.rows.getValues();
|
||||
const searchTerms = window.qBittorrent.Search.searchText.pattern.toLowerCase().split(" ");
|
||||
const filterTerms = window.qBittorrent.Search.searchText.filterPattern.toLowerCase().split(" ");
|
||||
const sizeFilters = getSizeFilters();
|
||||
@@ -1817,8 +1800,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
const searchInTorrentName = $("searchInTorrentName").value === "names";
|
||||
|
||||
if (searchInTorrentName || (filterTerms.length > 0) || (window.qBittorrent.Search.searchSizeFilter.min > 0.00) || (window.qBittorrent.Search.searchSizeFilter.max > 0.00)) {
|
||||
for (let i = 0; i < rows.length; ++i) {
|
||||
const row = rows[i];
|
||||
for (const row of this.getRowValues()) {
|
||||
|
||||
if (searchInTorrentName && !window.qBittorrent.Misc.containsAllTerms(row.full_data.fileName, searchTerms))
|
||||
continue;
|
||||
@@ -1837,7 +1819,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
}
|
||||
}
|
||||
else {
|
||||
filteredRows = rows;
|
||||
filteredRows = [...this.getRowValues()];
|
||||
}
|
||||
|
||||
filteredRows.sort((row1, row2) => {
|
||||
@@ -1962,7 +1944,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
},
|
||||
|
||||
getRow: function(node) {
|
||||
const rowId = this.fileTree.getRowId(node);
|
||||
const rowId = this.fileTree.getRowId(node).toString();
|
||||
return this.rows.get(rowId);
|
||||
},
|
||||
|
||||
@@ -2234,10 +2216,10 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
if (this.getRoot() === null)
|
||||
return [];
|
||||
|
||||
const generateRowsSignature = function(rows) {
|
||||
const rowsData = rows.map((row) => {
|
||||
return row.full_data;
|
||||
});
|
||||
const generateRowsSignature = () => {
|
||||
const rowsData = [];
|
||||
for (const { full_data } of this.getRowValues())
|
||||
rowsData.push(full_data);
|
||||
return JSON.stringify(rowsData);
|
||||
};
|
||||
|
||||
@@ -2271,7 +2253,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
return (rowsChanged || isFilterChanged || isSortedColumnChanged || isReverseSortChanged);
|
||||
}.bind(this);
|
||||
|
||||
const rowsString = generateRowsSignature(this.rows);
|
||||
const rowsString = generateRowsSignature();
|
||||
if (!hasRowsChanged(rowsString, this.prevRowsString))
|
||||
return this.prevFilteredRows;
|
||||
|
||||
@@ -2368,7 +2350,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
},
|
||||
|
||||
getRow: function(node) {
|
||||
const rowId = this.fileTree.getRowId(node);
|
||||
const rowId = this.fileTree.getRowId(node).toString();
|
||||
return this.rows.get(rowId);
|
||||
},
|
||||
|
||||
@@ -2563,10 +2545,10 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
if (this.getRoot() === null)
|
||||
return [];
|
||||
|
||||
const generateRowsSignature = function(rows) {
|
||||
const rowsData = rows.map((row) => {
|
||||
return row.full_data;
|
||||
});
|
||||
const generateRowsSignature = () => {
|
||||
const rowsData = [];
|
||||
for (const { full_data } of this.getRowValues())
|
||||
rowsData.push(full_data);
|
||||
return JSON.stringify(rowsData);
|
||||
};
|
||||
|
||||
@@ -2600,7 +2582,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
return (rowsChanged || isFilterChanged || isSortedColumnChanged || isReverseSortChanged);
|
||||
}.bind(this);
|
||||
|
||||
const rowsString = generateRowsSignature(this.rows);
|
||||
const rowsString = generateRowsSignature();
|
||||
if (!hasRowsChanged(rowsString, this.prevRowsString))
|
||||
return this.prevFilteredRows;
|
||||
|
||||
@@ -2618,7 +2600,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
},
|
||||
|
||||
setIgnored: function(rowId, ignore) {
|
||||
const row = this.rows.get(rowId);
|
||||
const row = this.rows.get(rowId.toString());
|
||||
if (ignore)
|
||||
row.full_data.remaining = 0;
|
||||
else
|
||||
@@ -2660,18 +2642,17 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
setupHeaderMenu: function() {},
|
||||
setupHeaderEvents: function() {},
|
||||
getFilteredAndSortedRows: function() {
|
||||
return this.rows.getValues();
|
||||
return [...this.getRowValues()];
|
||||
},
|
||||
selectRow: function(rowId) {
|
||||
this.selectedRows.push(rowId);
|
||||
this.setRowClass();
|
||||
this.onSelectedRowChanged();
|
||||
|
||||
const rows = this.rows.getValues();
|
||||
let path = "";
|
||||
for (let i = 0; i < rows.length; ++i) {
|
||||
if (rows[i].rowId === rowId) {
|
||||
path = rows[i].full_data.dataPath;
|
||||
for (const row of this.getRowValues()) {
|
||||
if (row.rowId === rowId) {
|
||||
path = row.full_data.dataPath;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2702,7 +2683,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
},
|
||||
updateIcons: function() {
|
||||
// state_icon
|
||||
this.rows.each(row => {
|
||||
for (const row of this.getRowValues()) {
|
||||
let img_path;
|
||||
switch (row.full_data.status) {
|
||||
case "default":
|
||||
@@ -2743,7 +2724,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
"width": "22px"
|
||||
}));
|
||||
}
|
||||
});
|
||||
};
|
||||
},
|
||||
newColumn: function(name, style, caption, defaultWidth, defaultVisible) {
|
||||
const column = {};
|
||||
@@ -2791,21 +2772,20 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
setupHeaderMenu: function() {},
|
||||
setupHeaderEvents: function() {},
|
||||
getFilteredAndSortedRows: function() {
|
||||
return this.rows.getValues();
|
||||
return [...this.getRowValues()];
|
||||
},
|
||||
selectRow: function(rowId) {
|
||||
this.selectedRows.push(rowId);
|
||||
this.setRowClass();
|
||||
this.onSelectedRowChanged();
|
||||
|
||||
const rows = this.rows.getValues();
|
||||
let articleId = "";
|
||||
let feedUid = "";
|
||||
for (let i = 0; i < rows.length; ++i) {
|
||||
if (rows[i].rowId === rowId) {
|
||||
articleId = rows[i].full_data.dataId;
|
||||
feedUid = rows[i].full_data.feedUid;
|
||||
this.tableBody.rows[rows[i].rowId].removeClass("unreadArticle");
|
||||
for (const row of this.getRowValues()) {
|
||||
if (row.rowId === rowId) {
|
||||
articleId = row.full_data.dataId;
|
||||
feedUid = row.full_data.feedUid;
|
||||
this.tableBody.rows[row.rowId].removeClass("unreadArticle");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2903,7 +2883,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
setupHeaderMenu: function() {},
|
||||
setupHeaderEvents: function() {},
|
||||
getFilteredAndSortedRows: function() {
|
||||
return this.rows.getValues();
|
||||
return [...this.getRowValues()];
|
||||
},
|
||||
setupTr: function(tr) {
|
||||
tr.addEventListener("dblclick", function(e) {
|
||||
@@ -2952,11 +2932,10 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
this.setRowClass();
|
||||
this.onSelectedRowChanged();
|
||||
|
||||
const rows = this.rows.getValues();
|
||||
let name = "";
|
||||
for (let i = 0; i < rows.length; ++i) {
|
||||
if (rows[i].rowId === rowId) {
|
||||
name = rows[i].full_data.name;
|
||||
for (const row of this.getRowValues()) {
|
||||
if (row.rowId === rowId) {
|
||||
name = row.full_data.name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2995,7 +2974,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
setupHeaderMenu: function() {},
|
||||
setupHeaderEvents: function() {},
|
||||
getFilteredAndSortedRows: function() {
|
||||
return this.rows.getValues();
|
||||
return [...this.getRowValues()];
|
||||
},
|
||||
newColumn: function(name, style, caption, defaultWidth, defaultVisible) {
|
||||
const column = {};
|
||||
@@ -3044,7 +3023,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
setupHeaderMenu: function() {},
|
||||
setupHeaderEvents: function() {},
|
||||
getFilteredAndSortedRows: function() {
|
||||
return this.rows.getValues();
|
||||
return [...this.getRowValues()];
|
||||
},
|
||||
newColumn: function(name, style, caption, defaultWidth, defaultVisible) {
|
||||
const column = {};
|
||||
@@ -3160,23 +3139,22 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
|
||||
getFilteredAndSortedRows: function() {
|
||||
let filteredRows = [];
|
||||
const rows = this.rows.getValues();
|
||||
this.filterText = window.qBittorrent.Log.getFilterText();
|
||||
const filterTerms = (this.filterText.length > 0) ? this.filterText.toLowerCase().split(" ") : [];
|
||||
const logLevels = window.qBittorrent.Log.getSelectedLevels();
|
||||
if ((filterTerms.length > 0) || (logLevels.length < 4)) {
|
||||
for (let i = 0; i < rows.length; ++i) {
|
||||
if (!logLevels.includes(rows[i].full_data.type.toString()))
|
||||
for (const row of this.getRowValues()) {
|
||||
if (!logLevels.includes(row.full_data.type.toString()))
|
||||
continue;
|
||||
|
||||
if ((filterTerms.length > 0) && !window.qBittorrent.Misc.containsAllTerms(rows[i].full_data.message, filterTerms))
|
||||
if ((filterTerms.length > 0) && !window.qBittorrent.Misc.containsAllTerms(row.full_data.message, filterTerms))
|
||||
continue;
|
||||
|
||||
filteredRows.push(rows[i]);
|
||||
filteredRows.push(row);
|
||||
}
|
||||
}
|
||||
else {
|
||||
filteredRows = rows;
|
||||
filteredRows = [...this.getRowValues()];
|
||||
}
|
||||
|
||||
filteredRows.sort((row1, row2) => {
|
||||
@@ -3227,19 +3205,18 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
|
||||
getFilteredAndSortedRows: function() {
|
||||
let filteredRows = [];
|
||||
const rows = this.rows.getValues();
|
||||
this.filterText = window.qBittorrent.Log.getFilterText();
|
||||
const filterTerms = (this.filterText.length > 0) ? this.filterText.toLowerCase().split(" ") : [];
|
||||
if (filterTerms.length > 0) {
|
||||
for (let i = 0; i < rows.length; ++i) {
|
||||
if ((filterTerms.length > 0) && !window.qBittorrent.Misc.containsAllTerms(rows[i].full_data.ip, filterTerms))
|
||||
for (const row of this.getRowValues()) {
|
||||
if ((filterTerms.length > 0) && !window.qBittorrent.Misc.containsAllTerms(row.full_data.ip, filterTerms))
|
||||
continue;
|
||||
|
||||
filteredRows.push(rows[i]);
|
||||
filteredRows.push(row);
|
||||
}
|
||||
}
|
||||
else {
|
||||
filteredRows = rows;
|
||||
filteredRows = [...this.getRowValues()];
|
||||
}
|
||||
|
||||
filteredRows.sort((row1, row2) => {
|
||||
|
||||
@@ -310,7 +310,7 @@ const initializeWindows = function() {
|
||||
// check if all selected torrents have same share ratio
|
||||
for (let i = 0; i < hashes.length; ++i) {
|
||||
const hash = hashes[i];
|
||||
const row = torrentsTable.rows.get(hash).full_data;
|
||||
const row = torrentsTable.getRow(hash).full_data;
|
||||
const origValues = row.ratio_limit + "|" + row.seeding_time_limit + "|" + row.inactive_seeding_time_limit + "|"
|
||||
+ row.max_ratio + "|" + row.max_seeding_time + "|" + row.max_inactive_seeding_time;
|
||||
|
||||
@@ -537,7 +537,7 @@ const initializeWindows = function() {
|
||||
if (hashes.length) {
|
||||
let enable = false;
|
||||
hashes.each((hash, index) => {
|
||||
const row = torrentsTable.rows.get(hash);
|
||||
const row = torrentsTable.getRow(hash);
|
||||
if (!row.full_data.auto_tmm)
|
||||
enable = true;
|
||||
});
|
||||
@@ -601,7 +601,7 @@ const initializeWindows = function() {
|
||||
const hashes = torrentsTable.selectedRowsIds();
|
||||
if (hashes.length) {
|
||||
const hash = hashes[0];
|
||||
const row = torrentsTable.rows.get(hash);
|
||||
const row = torrentsTable.getRow(hash);
|
||||
|
||||
new MochaUI.Window({
|
||||
id: "setLocationPage",
|
||||
@@ -624,7 +624,7 @@ const initializeWindows = function() {
|
||||
const hashes = torrentsTable.selectedRowsIds();
|
||||
if (hashes.length === 1) {
|
||||
const hash = hashes[0];
|
||||
const row = torrentsTable.rows.get(hash);
|
||||
const row = torrentsTable.getRow(hash);
|
||||
if (row) {
|
||||
new MochaUI.Window({
|
||||
id: "renamePage",
|
||||
@@ -648,7 +648,7 @@ const initializeWindows = function() {
|
||||
const hashes = torrentsTable.selectedRowsIds();
|
||||
if (hashes.length === 1) {
|
||||
const hash = hashes[0];
|
||||
const row = torrentsTable.rows.get(hash);
|
||||
const row = torrentsTable.getRow(hash);
|
||||
if (row) {
|
||||
new MochaUI.Window({
|
||||
id: "multiRenamePage",
|
||||
@@ -1265,7 +1265,7 @@ const initializeWindows = function() {
|
||||
exportTorrentFN = async function() {
|
||||
const hashes = torrentsTable.selectedRowsIds();
|
||||
for (const hash of hashes) {
|
||||
const row = torrentsTable.rows.get(hash);
|
||||
const row = torrentsTable.getRow(hash);
|
||||
if (!row)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -536,7 +536,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||
const rowId = torrentFilesTable.selectedRowsIds()[0];
|
||||
if (rowId === undefined)
|
||||
return;
|
||||
const row = torrentFilesTable.rows[rowId];
|
||||
const row = torrentFilesTable.rows.get(rowId);
|
||||
if (!row)
|
||||
return;
|
||||
|
||||
|
||||
@@ -352,7 +352,7 @@ window.qBittorrent.Search ??= (() => {
|
||||
searchResultsTable.reselectRows(rowsToSelect);
|
||||
|
||||
$("numSearchResultsVisible").textContent = searchResultsTable.getFilteredAndSortedRows().length;
|
||||
$("numSearchResultsTotal").textContent = searchResultsTable.getRowIds().length;
|
||||
$("numSearchResultsTotal").textContent = searchResultsTable.getRowSize();
|
||||
|
||||
setupSearchTableEvents(true);
|
||||
};
|
||||
@@ -445,15 +445,14 @@ window.qBittorrent.Search ??= (() => {
|
||||
};
|
||||
|
||||
const openSearchTorrentDescriptionUrl = function() {
|
||||
searchResultsTable.selectedRowsIds().each((rowId) => {
|
||||
window.open(searchResultsTable.rows.get(rowId).full_data.descrLink, "_blank");
|
||||
});
|
||||
for (const rowID of searchResultsTable.selectedRowsIds())
|
||||
window.open(searchResultsTable.getRow(rowID).full_data.descrLink, "_blank");
|
||||
};
|
||||
|
||||
const copySearchTorrentName = function() {
|
||||
const names = [];
|
||||
searchResultsTable.selectedRowsIds().each((rowId) => {
|
||||
names.push(searchResultsTable.rows.get(rowId).full_data.fileName);
|
||||
names.push(searchResultsTable.getRow(rowId).full_data.fileName);
|
||||
});
|
||||
return names.join("\n");
|
||||
};
|
||||
@@ -461,7 +460,7 @@ window.qBittorrent.Search ??= (() => {
|
||||
const copySearchTorrentDownloadLink = function() {
|
||||
const urls = [];
|
||||
searchResultsTable.selectedRowsIds().each((rowId) => {
|
||||
urls.push(searchResultsTable.rows.get(rowId).full_data.fileUrl);
|
||||
urls.push(searchResultsTable.getRow(rowId).full_data.fileUrl);
|
||||
});
|
||||
return urls.join("\n");
|
||||
};
|
||||
@@ -469,16 +468,15 @@ window.qBittorrent.Search ??= (() => {
|
||||
const copySearchTorrentDescriptionUrl = function() {
|
||||
const urls = [];
|
||||
searchResultsTable.selectedRowsIds().each((rowId) => {
|
||||
urls.push(searchResultsTable.rows.get(rowId).full_data.descrLink);
|
||||
urls.push(searchResultsTable.getRow(rowId).full_data.descrLink);
|
||||
});
|
||||
return urls.join("\n");
|
||||
};
|
||||
|
||||
const downloadSearchTorrent = function() {
|
||||
const urls = [];
|
||||
searchResultsTable.selectedRowsIds().each((rowId) => {
|
||||
urls.push(searchResultsTable.rows.get(rowId).full_data.fileUrl);
|
||||
});
|
||||
for (const rowID of searchResultsTable.selectedRowsIds())
|
||||
urls.push(searchResultsTable.getRow(rowID).full_data.fileUrl);
|
||||
|
||||
// only proceed if at least 1 row was selected
|
||||
if (!urls.length)
|
||||
@@ -836,7 +834,7 @@ window.qBittorrent.Search ??= (() => {
|
||||
searchResultsTable.updateRowData(row);
|
||||
|
||||
$("numSearchResultsVisible").textContent = searchResultsTable.getFilteredAndSortedRows().length;
|
||||
$("numSearchResultsTotal").textContent = searchResultsTable.getRowIds().length;
|
||||
$("numSearchResultsTotal").textContent = searchResultsTable.getRowSize();
|
||||
|
||||
searchResultsTable.updateTable();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user