WebUI: use template literals instead of string concatenation

PR #22177.
This commit is contained in:
Chocobo1
2025-01-18 20:51:47 +08:00
committed by GitHub
parent f2eecf8a4e
commit 1ee84033ec
19 changed files with 127 additions and 127 deletions

View File

@@ -127,13 +127,13 @@ window.qBittorrent.PropFiles ??= (() => {
};
const isDownloadCheckboxExists = (id) => {
return $("cbPrio" + id) !== null;
return $(`cbPrio${id}`) !== null;
};
const createDownloadCheckbox = (id, fileId, checked) => {
const checkbox = document.createElement("input");
checkbox.type = "checkbox";
checkbox.id = "cbPrio" + id;
checkbox.id = `cbPrio${id}`;
checkbox.setAttribute("data-id", id);
checkbox.setAttribute("data-file-id", fileId);
checkbox.className = "DownloadedCB";
@@ -144,7 +144,7 @@ window.qBittorrent.PropFiles ??= (() => {
};
const updateDownloadCheckbox = (id, checked) => {
const checkbox = $("cbPrio" + id);
const checkbox = $(`cbPrio${id}`);
updateCheckbox(checkbox, checked);
};
@@ -163,7 +163,7 @@ window.qBittorrent.PropFiles ??= (() => {
};
const isPriorityComboExists = (id) => {
return $("comboPrio" + id) !== null;
return $(`comboPrio${id}`) !== null;
};
const createPriorityCombo = (id, fileId, selectedPriority) => {
@@ -176,7 +176,7 @@ window.qBittorrent.PropFiles ??= (() => {
};
const select = document.createElement("select");
select.id = "comboPrio" + id;
select.id = `comboPrio${id}`;
select.setAttribute("data-id", id);
select.setAttribute("data-file-id", fileId);
select.classList.add("combo_priority");
@@ -196,7 +196,7 @@ window.qBittorrent.PropFiles ??= (() => {
};
const updatePriorityCombo = (id, selectedPriority) => {
const combobox = $("comboPrio" + id);
const combobox = $(`comboPrio${id}`);
if (Number(combobox.value) !== selectedPriority)
selectComboboxPriority(combobox, selectedPriority);
};
@@ -324,10 +324,10 @@ window.qBittorrent.PropFiles ??= (() => {
});
const ignore = (priority === FilePriority.Ignored);
ids.forEach((_id) => {
torrentFilesTable.setIgnored(_id, ignore);
ids.forEach((id) => {
torrentFilesTable.setIgnored(id, ignore);
const combobox = $("comboPrio" + _id);
const combobox = $(`comboPrio${id}`);
if (combobox !== null)
selectComboboxPriority(combobox, priority);
});
@@ -522,7 +522,7 @@ window.qBittorrent.PropFiles ??= (() => {
const rowIds = [];
const fileIds = [];
selectedRows.forEach((rowId) => {
const elem = $("comboPrio" + rowId);
const elem = $(`comboPrio${rowId}`);
rowIds.push(rowId);
fileIds.push(elem.getAttribute("data-file-id"));
});
@@ -558,8 +558,7 @@ window.qBittorrent.PropFiles ??= (() => {
icon: "images/qbittorrent-tray.svg",
title: "QBT_TR(Renaming)QBT_TR[CONTEXT=TorrentContentTreeView]",
loadMethod: "iframe",
contentURL: "rename_file.html?hash=" + hash + "&isFolder=" + node.isFolder
+ "&path=" + encodeURIComponent(path),
contentURL: `rename_file.html?hash=${hash}&isFolder=${node.isFolder}&path=${encodeURIComponent(path)}`,
scrollbars: false,
resizable: true,
maximizable: false,
@@ -673,7 +672,7 @@ window.qBittorrent.PropFiles ??= (() => {
* Show/hide a node's row
*/
const _hideNode = (node, shouldHide) => {
const span = $("filesTablefileName" + node.rowId);
const span = $(`filesTablefileName${node.rowId}`);
// span won't exist if row has been filtered out
if (span === null)
return;
@@ -685,7 +684,7 @@ window.qBittorrent.PropFiles ??= (() => {
* Update a node's collapsed state and icon
*/
const _updateNodeState = (node, isCollapsed) => {
const span = $("filesTablefileName" + node.rowId);
const span = $(`filesTablefileName${node.rowId}`);
// span won't exist if row has been filtered out
if (span === null)
return;
@@ -700,7 +699,7 @@ window.qBittorrent.PropFiles ??= (() => {
};
const _isCollapsed = (node) => {
const span = $("filesTablefileName" + node.rowId);
const span = $(`filesTablefileName${node.rowId}`);
if (span === null)
return true;