mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-10 01:22:31 -06:00
Compare commits
5 Commits
fb4b266828
...
6ac0c5a8b8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ac0c5a8b8 | ||
|
|
2be052e9c4 | ||
|
|
2bd0965906 | ||
|
|
acab056fe4 | ||
|
|
86acc01b1a |
@@ -4,6 +4,8 @@ import Js from "@eslint/js";
|
||||
import PluginQbtWebUI from "eslint-plugin-qbt-webui";
|
||||
import PreferArrowFunctions from "eslint-plugin-prefer-arrow-functions";
|
||||
import Stylistic from "@stylistic/eslint-plugin";
|
||||
import Unicorn from "eslint-plugin-unicorn";
|
||||
|
||||
import * as RegexpPlugin from "eslint-plugin-regexp";
|
||||
|
||||
export default [
|
||||
@@ -27,7 +29,8 @@ export default [
|
||||
PluginQbtWebUI,
|
||||
PreferArrowFunctions,
|
||||
RegexpPlugin,
|
||||
Stylistic
|
||||
Stylistic,
|
||||
Unicorn
|
||||
},
|
||||
rules: {
|
||||
"curly": ["error", "multi-or-nest", "consistent"],
|
||||
@@ -43,6 +46,7 @@ export default [
|
||||
"prefer-template": "error",
|
||||
"radix": "error",
|
||||
"require-await": "error",
|
||||
"sort-imports": ["error", { allowSeparatedGroups: true }],
|
||||
"PluginQbtWebUI/prefix-inc-dec-operators": "error",
|
||||
"PreferArrowFunctions/prefer-arrow-functions": "error",
|
||||
"Stylistic/no-extra-semi": "error",
|
||||
@@ -65,7 +69,11 @@ export default [
|
||||
],
|
||||
"Stylistic/quote-props": ["error", "consistent-as-needed"],
|
||||
"Stylistic/semi": "error",
|
||||
"Stylistic/spaced-comment": ["error", "always", { exceptions: ["*"] }]
|
||||
"Stylistic/spaced-comment": ["error", "always", { exceptions: ["*"] }],
|
||||
"Unicorn/no-array-for-each": "error",
|
||||
"Unicorn/no-zero-fractions": "error",
|
||||
"Unicorn/prefer-number-properties": "error",
|
||||
"Unicorn/switch-case-braces": ["error", "avoid"]
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"eslint-plugin-prefer-arrow-functions": "*",
|
||||
"eslint-plugin-qbt-webui": "https://github.com/Chocobo1/eslint-plugin-qbt-webui/tarball/v1",
|
||||
"eslint-plugin-regexp": "*",
|
||||
"eslint-plugin-unicorn": "*",
|
||||
"happy-dom": "*",
|
||||
"html-validate": "*",
|
||||
"js-beautify": "*",
|
||||
|
||||
@@ -161,11 +161,8 @@
|
||||
*/
|
||||
fileRenamer.onChanged = (matchedRows) => {
|
||||
// Clear renamed column
|
||||
document
|
||||
.querySelectorAll("span[id^='filesTablefileRenamed']")
|
||||
.forEach((span) => {
|
||||
span.textContent = "";
|
||||
});
|
||||
for (const span of document.querySelectorAll("span[id^='filesTablefileRenamed']"))
|
||||
span.textContent = "";
|
||||
|
||||
// Update renamed column for matched rows
|
||||
for (let i = 0; i < matchedRows.length; ++i) {
|
||||
@@ -312,14 +309,14 @@
|
||||
const rootNode = new window.qBittorrent.FileTree.FolderNode();
|
||||
rootNode.autoCalculateCheckedState = false;
|
||||
|
||||
rows.forEach((row) => {
|
||||
for (const row of rows) {
|
||||
const pathItems = row.path.split(window.qBittorrent.Filesystem.PathSeparator);
|
||||
|
||||
pathItems.pop(); // remove last item (i.e. file name)
|
||||
let parent = rootNode;
|
||||
pathItems.forEach((folderName) => {
|
||||
for (const folderName of pathItems) {
|
||||
if (folderName === ".unwanted")
|
||||
return;
|
||||
continue;
|
||||
|
||||
let folderNode = null;
|
||||
if (parent.children !== null) {
|
||||
@@ -349,7 +346,7 @@
|
||||
}
|
||||
|
||||
parent = folderNode;
|
||||
});
|
||||
}
|
||||
|
||||
const childNode = new window.qBittorrent.FileTree.FileNode();
|
||||
childNode.rowId = rowId;
|
||||
@@ -362,7 +359,7 @@
|
||||
parent.addChild(childNode);
|
||||
|
||||
++rowId;
|
||||
});
|
||||
}
|
||||
|
||||
bulkRenameFilesTable.populateTable(rootNode);
|
||||
bulkRenameFilesTable.updateTable(false);
|
||||
|
||||
@@ -583,7 +583,8 @@ window.addEventListener("DOMContentLoaded", (event) => {
|
||||
if (!categoryList)
|
||||
return;
|
||||
|
||||
[...categoryList.children].forEach((el) => { el.remove(); });
|
||||
for (const el of [...categoryList.children])
|
||||
el.remove();
|
||||
|
||||
const categoryItemTemplate = document.getElementById("categoryFilterItem");
|
||||
|
||||
@@ -704,7 +705,8 @@ window.addEventListener("DOMContentLoaded", (event) => {
|
||||
if (tagFilterList === null)
|
||||
return;
|
||||
|
||||
[...tagFilterList.children].forEach((el) => { el.remove(); });
|
||||
for (const el of [...tagFilterList.children])
|
||||
el.remove();
|
||||
|
||||
const tagItemTemplate = document.getElementById("tagFilterItem");
|
||||
|
||||
@@ -757,7 +759,8 @@ window.addEventListener("DOMContentLoaded", (event) => {
|
||||
if (trackerFilterList === null)
|
||||
return;
|
||||
|
||||
[...trackerFilterList.children].forEach((el) => { el.remove(); });
|
||||
for (const el of [...trackerFilterList.children])
|
||||
el.remove();
|
||||
|
||||
const trackerItemTemplate = document.getElementById("trackerFilterItem");
|
||||
|
||||
@@ -1618,7 +1621,7 @@ window.addEventListener("DOMContentLoaded", (event) => {
|
||||
},
|
||||
column: "mainColumn",
|
||||
onResize: window.qBittorrent.Misc.createDebounceHandler(500, (e) => {
|
||||
const isHidden = (parseInt(document.getElementById("propertiesPanel").style.height, 10) === 0);
|
||||
const isHidden = (Number.parseInt(document.getElementById("propertiesPanel").style.height, 10) === 0);
|
||||
if (!isHidden)
|
||||
saveColumnSizes();
|
||||
}),
|
||||
@@ -1628,7 +1631,7 @@ window.addEventListener("DOMContentLoaded", (event) => {
|
||||
if (prop_h !== null)
|
||||
prop_h = Number(prop_h) * Window.getSize().y;
|
||||
else
|
||||
prop_h = Window.getSize().y / 2.0;
|
||||
prop_h = Window.getSize().y / 2;
|
||||
new MochaUI.Panel({
|
||||
id: "propertiesPanel",
|
||||
title: "Panel",
|
||||
|
||||
@@ -166,8 +166,10 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
}
|
||||
|
||||
searchAndAddTargets() {
|
||||
if (this.options.targets.length > 0)
|
||||
document.querySelectorAll(this.options.targets).forEach((target) => { this.addTarget(target); });
|
||||
if (this.options.targets.length > 0) {
|
||||
for (const target of document.querySelectorAll(this.options.targets))
|
||||
this.addTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
triggerMenu(e, el) {
|
||||
@@ -327,7 +329,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
const categoryCount = new Map();
|
||||
|
||||
const selectedRows = torrentsTable.selectedRowsIds();
|
||||
selectedRows.forEach((item, index) => {
|
||||
for (const item of selectedRows) {
|
||||
const data = torrentsTable.getRow(item).full_data;
|
||||
|
||||
if (data["seq_dl"] !== true)
|
||||
@@ -340,7 +342,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
else
|
||||
there_are_f_l_piece_prio = true;
|
||||
|
||||
if (data["progress"] !== 1.0) // not downloaded
|
||||
if (data["progress"] !== 1) // not downloaded
|
||||
all_are_downloaded = false;
|
||||
else if (data["super_seeding"] !== true)
|
||||
all_are_super_seeding = false;
|
||||
@@ -373,7 +375,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
const torrentCategory = data["category"];
|
||||
const count = categoryCount.get(torrentCategory);
|
||||
categoryCount.set(torrentCategory, ((count !== undefined) ? (count + 1) : 1));
|
||||
});
|
||||
}
|
||||
|
||||
// hide renameFiles when more than 1 torrent is selected
|
||||
if (selectedRows.length === 1) {
|
||||
@@ -459,7 +461,9 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
|
||||
updateCategoriesSubMenu(categories) {
|
||||
const contextCategoryList = document.getElementById("contextCategoryList");
|
||||
[...contextCategoryList.children].forEach((el) => { el.remove(); });
|
||||
|
||||
for (const el of [...contextCategoryList.children])
|
||||
el.remove();
|
||||
|
||||
const createMenuItem = (text, imgURL, clickFn) => {
|
||||
const anchor = document.createElement("a");
|
||||
|
||||
@@ -183,18 +183,17 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
return;
|
||||
|
||||
switch (e.key) {
|
||||
case "ArrowUp": {
|
||||
case "ArrowUp":
|
||||
e.preventDefault();
|
||||
this.selectPreviousRow();
|
||||
this.dynamicTableDiv.querySelector(".selected").scrollIntoView({ block: "nearest" });
|
||||
break;
|
||||
}
|
||||
case "ArrowDown": {
|
||||
|
||||
case "ArrowDown":
|
||||
e.preventDefault();
|
||||
this.selectNextRow();
|
||||
this.dynamicTableDiv.querySelector(".selected").scrollIntoView({ block: "nearest" });
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -285,7 +284,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
const onStart = function(el, event) {
|
||||
if (this.canResize) {
|
||||
this.currentHeaderAction = "resize";
|
||||
this.startWidth = parseInt(this.resizeTh.style.width, 10);
|
||||
this.startWidth = Number.parseInt(this.resizeTh.style.width, 10);
|
||||
}
|
||||
else {
|
||||
this.currentHeaderAction = "drag";
|
||||
@@ -604,10 +603,10 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
const val = LocalPreferences.get(`columns_order_${this.dynamicTableDivId}`);
|
||||
if ((val === null) || (val === undefined))
|
||||
return;
|
||||
val.split(",").forEach((v) => {
|
||||
for (const v of val.split(",")) {
|
||||
if ((v in this.columns) && (!columnsOrder.contains(v)))
|
||||
columnsOrder.push(v);
|
||||
});
|
||||
}
|
||||
|
||||
for (let i = 0; i < this.columns.length; ++i) {
|
||||
if (!columnsOrder.contains(this.columns[i].name))
|
||||
@@ -1632,7 +1631,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
return false;
|
||||
break; // do nothing
|
||||
|
||||
default: {
|
||||
default:
|
||||
if (!useSubcategories) {
|
||||
if (category !== row["full_data"].category)
|
||||
return false;
|
||||
@@ -1647,7 +1646,6 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (tag) {
|
||||
@@ -1980,10 +1978,10 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
|
||||
getFilteredAndSortedRows() {
|
||||
const getSizeFilters = () => {
|
||||
let minSize = (window.qBittorrent.Search.searchSizeFilter.min > 0.00) ? (window.qBittorrent.Search.searchSizeFilter.min * Math.pow(1024, window.qBittorrent.Search.searchSizeFilter.minUnit)) : 0.00;
|
||||
let maxSize = (window.qBittorrent.Search.searchSizeFilter.max > 0.00) ? (window.qBittorrent.Search.searchSizeFilter.max * Math.pow(1024, window.qBittorrent.Search.searchSizeFilter.maxUnit)) : 0.00;
|
||||
let minSize = (window.qBittorrent.Search.searchSizeFilter.min > 0) ? (window.qBittorrent.Search.searchSizeFilter.min * Math.pow(1024, window.qBittorrent.Search.searchSizeFilter.minUnit)) : 0;
|
||||
let maxSize = (window.qBittorrent.Search.searchSizeFilter.max > 0) ? (window.qBittorrent.Search.searchSizeFilter.max * Math.pow(1024, window.qBittorrent.Search.searchSizeFilter.maxUnit)) : 0;
|
||||
|
||||
if ((minSize > maxSize) && (maxSize > 0.00)) {
|
||||
if ((minSize > maxSize) && (maxSize > 0)) {
|
||||
const tmp = minSize;
|
||||
minSize = maxSize;
|
||||
maxSize = tmp;
|
||||
@@ -2018,16 +2016,16 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
const seedsFilters = getSeedsFilters();
|
||||
const searchInTorrentName = document.getElementById("searchInTorrentName").value === "names";
|
||||
|
||||
if (searchInTorrentName || (filterTerms.length > 0) || (window.qBittorrent.Search.searchSizeFilter.min > 0.00) || (window.qBittorrent.Search.searchSizeFilter.max > 0.00)) {
|
||||
if (searchInTorrentName || (filterTerms.length > 0) || (window.qBittorrent.Search.searchSizeFilter.min > 0) || (window.qBittorrent.Search.searchSizeFilter.max > 0)) {
|
||||
for (const row of this.getRowValues()) {
|
||||
|
||||
if (searchInTorrentName && !window.qBittorrent.Misc.containsAllTerms(row.full_data.fileName, searchTerms))
|
||||
continue;
|
||||
if ((filterTerms.length > 0) && !window.qBittorrent.Misc.containsAllTerms(row.full_data.fileName, filterTerms))
|
||||
continue;
|
||||
if ((sizeFilters.min > 0.00) && (row.full_data.fileSize < sizeFilters.min))
|
||||
if ((sizeFilters.min > 0) && (row.full_data.fileSize < sizeFilters.min))
|
||||
continue;
|
||||
if ((sizeFilters.max > 0.00) && (row.full_data.fileSize > sizeFilters.max))
|
||||
if ((sizeFilters.max > 0) && (row.full_data.fileSize > sizeFilters.max))
|
||||
continue;
|
||||
if ((seedsFilters.min > 0) && (row.full_data.nbSeeders < seedsFilters.min))
|
||||
continue;
|
||||
@@ -2476,9 +2474,8 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
|
||||
populateTable(root) {
|
||||
this.fileTree.setRoot(root);
|
||||
root.children.forEach((node) => {
|
||||
for (const node of root.children)
|
||||
this.#addNodeToTable(node, 0, root);
|
||||
});
|
||||
}
|
||||
|
||||
#addNodeToTable(node, depth, parent) {
|
||||
@@ -2492,9 +2489,8 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
rowId: node.rowId,
|
||||
});
|
||||
|
||||
node.children.forEach((child) => {
|
||||
for (const child of node.children)
|
||||
this.#addNodeToTable(child, depth + 1, node);
|
||||
});
|
||||
}
|
||||
|
||||
getRoot() {
|
||||
|
||||
@@ -131,7 +131,7 @@ window.qBittorrent.FileTree ??= (() => {
|
||||
}
|
||||
|
||||
calculateRemaining() {
|
||||
this.remaining = this.isIgnored() ? 0 : (this.size * (1.0 - (this.progress / 100)));
|
||||
this.remaining = this.isIgnored() ? 0 : (this.size * (1 - (this.progress / 100)));
|
||||
}
|
||||
|
||||
serialize() {
|
||||
|
||||
@@ -80,9 +80,9 @@ window.qBittorrent.Search ??= (() => {
|
||||
max: 0
|
||||
};
|
||||
const searchSizeFilter = {
|
||||
min: 0.00,
|
||||
min: 0,
|
||||
minUnit: 2, // B = 0, KiB = 1, MiB = 2, GiB = 3, TiB = 4, PiB = 5, EiB = 6
|
||||
max: 0.00,
|
||||
max: 0,
|
||||
maxUnit: 3
|
||||
};
|
||||
|
||||
@@ -142,7 +142,7 @@ window.qBittorrent.Search ??= (() => {
|
||||
|
||||
document.getElementById("SearchPanel").addEventListener("keydown", (event) => {
|
||||
switch (event.key) {
|
||||
case "Enter": {
|
||||
case "Enter":
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
@@ -156,7 +156,6 @@ window.qBittorrent.Search ??= (() => {
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -726,9 +725,8 @@ window.qBittorrent.Search ??= (() => {
|
||||
if (prevSearchPluginsResponse !== responseJSON) {
|
||||
prevSearchPluginsResponse = responseJSON;
|
||||
searchPlugins.length = 0;
|
||||
responseJSON.forEach((plugin) => {
|
||||
for (const plugin of responseJSON)
|
||||
searchPlugins.push(plugin);
|
||||
});
|
||||
|
||||
const pluginOptions = [];
|
||||
pluginOptions.push(createOption("QBT_TR(Only enabled)QBT_TR[CONTEXT=SearchEngineWidget]", "enabled"));
|
||||
@@ -789,9 +787,9 @@ window.qBittorrent.Search ??= (() => {
|
||||
document.getElementById("searchMinSeedsFilter").value = searchSeedsFilter.min;
|
||||
document.getElementById("searchMaxSeedsFilter").value = searchSeedsFilter.max;
|
||||
|
||||
searchSizeFilter.min = 0.00;
|
||||
searchSizeFilter.min = 0;
|
||||
searchSizeFilter.minUnit = 2; // B = 0, KiB = 1, MiB = 2, GiB = 3, TiB = 4, PiB = 5, EiB = 6
|
||||
searchSizeFilter.max = 0.00;
|
||||
searchSizeFilter.max = 0;
|
||||
searchSizeFilter.maxUnit = 3;
|
||||
document.getElementById("searchMinSizeFilter").value = searchSizeFilter.min;
|
||||
document.getElementById("searchMinSizePrefix").value = searchSizeFilter.minUnit;
|
||||
|
||||
@@ -92,15 +92,13 @@ window.qBittorrent.TorrentContent ??= (() => {
|
||||
fileIds.push(node.fileId);
|
||||
|
||||
if (node.isFolder) {
|
||||
node.children.forEach((child) => {
|
||||
for (const child of node.children)
|
||||
getChildFiles(child);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
node.children.forEach((child) => {
|
||||
for (const child of node.children)
|
||||
getChildFiles(child);
|
||||
});
|
||||
|
||||
return {
|
||||
rowIds: rowIds,
|
||||
@@ -228,7 +226,7 @@ window.qBittorrent.TorrentContent ??= (() => {
|
||||
|
||||
if (checkbox.state === TriState.Checked) {
|
||||
setCheckboxUnchecked(checkbox);
|
||||
torrentFilesTable.rows.forEach((row) => {
|
||||
for (const row of torrentFilesTable.rows) {
|
||||
const rowId = row.rowId;
|
||||
const node = torrentFilesTable.getNode(rowId);
|
||||
const fileId = node.fileId;
|
||||
@@ -237,11 +235,11 @@ window.qBittorrent.TorrentContent ??= (() => {
|
||||
rowIds.push(rowId);
|
||||
fileIds.push(fileId);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
setCheckboxChecked(checkbox);
|
||||
torrentFilesTable.rows.forEach((row) => {
|
||||
for (const row of torrentFilesTable.rows) {
|
||||
const rowId = row.rowId;
|
||||
const node = torrentFilesTable.getNode(rowId);
|
||||
const fileId = node.fileId;
|
||||
@@ -250,7 +248,7 @@ window.qBittorrent.TorrentContent ??= (() => {
|
||||
rowIds.push(rowId);
|
||||
fileIds.push(fileId);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (rowIds.length > 0) {
|
||||
@@ -332,14 +330,14 @@ window.qBittorrent.TorrentContent ??= (() => {
|
||||
|
||||
const rootNode = new window.qBittorrent.FileTree.FolderNode();
|
||||
|
||||
rows.forEach((row) => {
|
||||
for (const row of rows) {
|
||||
const pathItems = row.fileName.split(window.qBittorrent.Filesystem.PathSeparator);
|
||||
|
||||
pathItems.pop(); // remove last item (i.e. file name)
|
||||
let parent = rootNode;
|
||||
pathItems.forEach((folderName) => {
|
||||
for (const folderName of pathItems) {
|
||||
if (folderName === ".unwanted")
|
||||
return;
|
||||
continue;
|
||||
|
||||
let folderNode = null;
|
||||
if (parent.children !== null) {
|
||||
@@ -366,7 +364,7 @@ window.qBittorrent.TorrentContent ??= (() => {
|
||||
}
|
||||
|
||||
parent = folderNode;
|
||||
});
|
||||
}
|
||||
|
||||
const isChecked = row.checked ? TriState.Checked : TriState.Unchecked;
|
||||
const childNode = new window.qBittorrent.FileTree.FileNode();
|
||||
@@ -383,7 +381,7 @@ window.qBittorrent.TorrentContent ??= (() => {
|
||||
parent.addChild(childNode);
|
||||
|
||||
++rowId;
|
||||
});
|
||||
}
|
||||
|
||||
torrentFilesTable.populateTable(rootNode);
|
||||
torrentFilesTable.updateTable();
|
||||
@@ -399,21 +397,19 @@ window.qBittorrent.TorrentContent ??= (() => {
|
||||
|
||||
const rowIds = [];
|
||||
const fileIds = [];
|
||||
selectedRows.forEach((rowId) => {
|
||||
for (const rowId of selectedRows) {
|
||||
rowIds.push(rowId);
|
||||
fileIds.push(Number(torrentFilesTable.getRowFileId(rowId)));
|
||||
});
|
||||
}
|
||||
|
||||
const uniqueRowIds = new Set();
|
||||
const uniqueFileIds = new Set();
|
||||
for (let i = 0; i < rowIds.length; ++i) {
|
||||
const rows = getAllChildren(rowIds[i], fileIds[i]);
|
||||
rows.rowIds.forEach((rowId) => {
|
||||
for (const rowId of rows.rowIds)
|
||||
uniqueRowIds.add(rowId);
|
||||
});
|
||||
rows.fileIds.forEach((fileId) => {
|
||||
for (const fileId of rows.fileIds)
|
||||
uniqueFileIds.add(fileId);
|
||||
});
|
||||
}
|
||||
|
||||
setFilePriority([...uniqueRowIds.keys()], [...uniqueFileIds.keys()], priority);
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
return;
|
||||
|
||||
const shareLimit = getSelectedRadioValue("shareLimit");
|
||||
let ratioLimitValue = 0.00;
|
||||
let ratioLimitValue = 0;
|
||||
let seedingTimeLimitValue = 0;
|
||||
let inactiveSeedingTimeLimitValue = 0;
|
||||
let shareLimitActionValue = "Default";
|
||||
|
||||
@@ -210,9 +210,8 @@
|
||||
menu: "logTableMenu",
|
||||
actions: {
|
||||
Clear: () => {
|
||||
tableInfo[currentSelectedTab].instance.selectedRowsIds().forEach((rowId) => {
|
||||
for (const rowId of tableInfo[currentSelectedTab].instance.selectedRowsIds())
|
||||
tableInfo[currentSelectedTab].instance.removeRow(rowId);
|
||||
});
|
||||
|
||||
updateLabelCount();
|
||||
}
|
||||
|
||||
@@ -2144,7 +2144,8 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
|
||||
// Advanced Tab
|
||||
const updateNetworkInterfaces = (default_iface, default_iface_name) => {
|
||||
[...document.getElementById("networkInterface").children].forEach((el) => { el.remove(); });
|
||||
for (const el of [...document.getElementById("networkInterface").children])
|
||||
el.remove();
|
||||
|
||||
fetch("api/v2/app/networkInterfaceList", {
|
||||
method: "GET",
|
||||
@@ -2165,15 +2166,15 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
ifaces.push({ name: default_iface_name || default_iface, value: default_iface });
|
||||
|
||||
document.getElementById("networkInterface").options.add(new Option("QBT_TR(Any interface)QBT_TR[CONTEXT=OptionsDialog]", ""));
|
||||
ifaces.forEach((item, index) => {
|
||||
for (const item of ifaces)
|
||||
document.getElementById("networkInterface").options.add(new Option(item.name, item.value));
|
||||
});
|
||||
document.getElementById("networkInterface").value = default_iface;
|
||||
});
|
||||
};
|
||||
|
||||
const updateInterfaceAddresses = (iface, default_addr) => {
|
||||
[...document.getElementById("optionalIPAddressToBind").children].forEach((el) => { el.remove(); });
|
||||
for (const el of [...document.getElementById("optionalIPAddressToBind").children])
|
||||
el.remove();
|
||||
|
||||
const url = new URL("api/v2/app/networkInterfaceAddressList", window.location);
|
||||
url.search = new URLSearchParams({
|
||||
@@ -2196,9 +2197,8 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
document.getElementById("optionalIPAddressToBind").options.add(new Option("QBT_TR(All addresses)QBT_TR[CONTEXT=OptionDialog]", ""));
|
||||
document.getElementById("optionalIPAddressToBind").options.add(new Option("QBT_TR(All IPv4 addresses)QBT_TR[CONTEXT=OptionDialog]", "0.0.0.0"));
|
||||
document.getElementById("optionalIPAddressToBind").options.add(new Option("QBT_TR(All IPv6 addresses)QBT_TR[CONTEXT=OptionDialog]", "::"));
|
||||
addresses.forEach((item, index) => {
|
||||
for (const item of addresses)
|
||||
document.getElementById("optionalIPAddressToBind").options.add(new Option(item, item));
|
||||
});
|
||||
document.getElementById("optionalIPAddressToBind").value = default_addr;
|
||||
});
|
||||
};
|
||||
@@ -2928,7 +2928,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
let maxRatio = -1;
|
||||
if (document.getElementById("maxRatioCheckbox").checked) {
|
||||
maxRatio = Number(document.getElementById("maxRatioValue").value);
|
||||
if (isNaN(maxRatio) || (maxRatio < 0)) {
|
||||
if (Number.isNaN(maxRatio) || (maxRatio < 0)) {
|
||||
alert("QBT_TR(Share ratio limit must not have a negative value.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -233,7 +233,8 @@
|
||||
feedsToUpdate.add(row);
|
||||
}
|
||||
}
|
||||
feedsToUpdate.forEach((feed) => refreshFeed(feed.full_data.dataUid));
|
||||
for (const feed of feedsToUpdate)
|
||||
refreshFeed(feed.full_data.dataUid);
|
||||
},
|
||||
markRead: markSelectedAsRead,
|
||||
rename: (el) => {
|
||||
@@ -424,7 +425,8 @@
|
||||
};
|
||||
|
||||
const clearDetails = () => {
|
||||
[...document.getElementById("rssDetailsView").children].forEach((el) => { el.remove(); });
|
||||
for (const el of [...document.getElementById("rssDetailsView").children])
|
||||
el.remove();
|
||||
};
|
||||
|
||||
const showDetails = (feedUid, articleID) => {
|
||||
|
||||
@@ -789,14 +789,14 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||
|
||||
rssDownloaderFeedSelectionTable.clear();
|
||||
let rowID = -1;
|
||||
feedList.forEach((feed) => {
|
||||
for (const feed of feedList) {
|
||||
rssDownloaderFeedSelectionTable.updateRowData({
|
||||
rowId: ++rowID,
|
||||
checked: rulesList[ruleName].affectedFeeds.contains(feed.url),
|
||||
name: feed.name,
|
||||
url: feed.url
|
||||
});
|
||||
});
|
||||
}
|
||||
rssDownloaderFeedSelectionTable.updateTable(false);
|
||||
updateMatchingArticles(ruleName);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
if (!confirm("QBT_TR(Are you sure you want to delete selected tasks?)QBT_TR[CONTEXT=TorrentCreator]"))
|
||||
return;
|
||||
|
||||
selectedTasks.forEach(task => {
|
||||
for (const task of selectedTasks) {
|
||||
fetch("api/v2/torrentcreator/deleteTask", {
|
||||
method: "POST",
|
||||
body: new URLSearchParams({
|
||||
@@ -100,7 +100,7 @@
|
||||
}).then((response) => {
|
||||
load();
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
exportTorrent: exportTorrents,
|
||||
},
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
*/
|
||||
|
||||
import { expect, test } from "vitest";
|
||||
|
||||
import "../../private/scripts/misc.js";
|
||||
|
||||
test("Test toFixedPointString()", () => {
|
||||
@@ -68,11 +69,11 @@ test("Test toFixedPointString()", () => {
|
||||
expect(toFixedPointString(-35.855, 3)).toBe("-35.855");
|
||||
expect(toFixedPointString(-35.855, 4)).toBe("-35.8550");
|
||||
|
||||
expect(toFixedPointString(100.00, 0)).toBe("100");
|
||||
expect(toFixedPointString(100.00, 1)).toBe("100.0");
|
||||
expect(toFixedPointString(100.00, 2)).toBe("100.00");
|
||||
expect(toFixedPointString(100, 0)).toBe("100");
|
||||
expect(toFixedPointString(100, 1)).toBe("100.0");
|
||||
expect(toFixedPointString(100, 2)).toBe("100.00");
|
||||
|
||||
expect(toFixedPointString(-100.00, 0)).toBe("-100");
|
||||
expect(toFixedPointString(-100.00, 1)).toBe("-100.0");
|
||||
expect(toFixedPointString(-100.00, 2)).toBe("-100.00");
|
||||
expect(toFixedPointString(-100, 0)).toBe("-100");
|
||||
expect(toFixedPointString(-100, 1)).toBe("-100.0");
|
||||
expect(toFixedPointString(-100, 2)).toBe("-100.00");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user