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
commit 1ee84033ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 127 additions and 127 deletions

View file

@ -37,6 +37,7 @@ export default [
"operator-assignment": "error", "operator-assignment": "error",
"prefer-arrow-callback": "error", "prefer-arrow-callback": "error",
"prefer-const": "error", "prefer-const": "error",
"prefer-template": "error",
"radix": "error", "radix": "error",
"PreferArrowFunctions/prefer-arrow-functions": "error", "PreferArrowFunctions/prefer-arrow-functions": "error",
"Stylistic/no-mixed-operators": [ "Stylistic/no-mixed-operators": [

View file

@ -13,7 +13,7 @@
"@stylistic/eslint-plugin": "*", "@stylistic/eslint-plugin": "*",
"eslint": "*", "eslint": "*",
"eslint-plugin-html": "*", "eslint-plugin-html": "*",
"eslint-plugin-prefer-arrow-functions": "3.4.2", "eslint-plugin-prefer-arrow-functions": "*",
"eslint-plugin-regexp": "*", "eslint-plugin-regexp": "*",
"html-validate": "*", "html-validate": "*",
"js-beautify": "*", "js-beautify": "*",

View file

@ -82,7 +82,7 @@
}) })
.then((response) => { .then((response) => {
if (!response.ok) { if (!response.ok) {
alert("QBT_TR(Unable to create category)QBT_TR[CONTEXT=Category] " + window.qBittorrent.Misc.escapeHtml(categoryName)); alert(`QBT_TR(Unable to create category)QBT_TR[CONTEXT=Category] ${window.qBittorrent.Misc.escapeHtml(categoryName)}`);
return; return;
} }

View file

@ -172,7 +172,7 @@
// Update renamed column for matched rows // Update renamed column for matched rows
for (let i = 0; i < matchedRows.length; ++i) { for (let i = 0; i < matchedRows.length; ++i) {
const row = matchedRows[i]; const row = matchedRows[i];
$("filesTablefileRenamed" + row.rowId).textContent = row.renamed; $(`filesTablefileRenamed${row.rowId}`).textContent = row.renamed;
} }
}; };
fileRenamer.onInvalidRegex = (err) => { fileRenamer.onInvalidRegex = (err) => {

View file

@ -88,9 +88,10 @@ window.qBittorrent.Client ??= (() => {
const mainTitle = () => { const mainTitle = () => {
const emDash = "\u2014"; const emDash = "\u2014";
const qbtVersion = window.qBittorrent.Cache.qbtVersion.get(); const qbtVersion = window.qBittorrent.Cache.qbtVersion.get();
const suffix = window.qBittorrent.Cache.preferences.get()["app_instance_name"] || ""; let suffix = window.qBittorrent.Cache.preferences.get()["app_instance_name"] || "";
const title = `qBittorrent ${qbtVersion} QBT_TR(WebUI)QBT_TR[CONTEXT=OptionsDialog]` if (suffix.length > 0)
+ ((suffix.length > 0) ? ` ${emDash} ${suffix}` : ""); suffix = ` ${emDash} ${suffix}`;
const title = `qBittorrent ${qbtVersion} QBT_TR(WebUI)QBT_TR[CONTEXT=OptionsDialog]${suffix}`;
return title; return title;
}; };
@ -952,13 +953,13 @@ window.addEventListener("DOMContentLoaded", () => {
const processServerState = () => { const processServerState = () => {
let transfer_info = window.qBittorrent.Misc.friendlyUnit(serverState.dl_info_speed, true); let transfer_info = window.qBittorrent.Misc.friendlyUnit(serverState.dl_info_speed, true);
if (serverState.dl_rate_limit > 0) if (serverState.dl_rate_limit > 0)
transfer_info += " [" + window.qBittorrent.Misc.friendlyUnit(serverState.dl_rate_limit, true) + "]"; transfer_info += ` [${window.qBittorrent.Misc.friendlyUnit(serverState.dl_rate_limit, true)}]`;
transfer_info += " (" + window.qBittorrent.Misc.friendlyUnit(serverState.dl_info_data, false) + ")"; transfer_info += ` (${window.qBittorrent.Misc.friendlyUnit(serverState.dl_info_data, false)})`;
$("DlInfos").textContent = transfer_info; $("DlInfos").textContent = transfer_info;
transfer_info = window.qBittorrent.Misc.friendlyUnit(serverState.up_info_speed, true); transfer_info = window.qBittorrent.Misc.friendlyUnit(serverState.up_info_speed, true);
if (serverState.up_rate_limit > 0) if (serverState.up_rate_limit > 0)
transfer_info += " [" + window.qBittorrent.Misc.friendlyUnit(serverState.up_rate_limit, true) + "]"; transfer_info += ` [${window.qBittorrent.Misc.friendlyUnit(serverState.up_rate_limit, true)}]`;
transfer_info += " (" + window.qBittorrent.Misc.friendlyUnit(serverState.up_info_data, false) + ")"; transfer_info += ` (${window.qBittorrent.Misc.friendlyUnit(serverState.up_info_data, false)})`;
$("UpInfos").textContent = transfer_info; $("UpInfos").textContent = transfer_info;
document.title = (speedInTitle document.title = (speedInTitle
@ -1010,12 +1011,12 @@ window.addEventListener("DOMContentLoaded", () => {
$("TotalWastedSession").textContent = window.qBittorrent.Misc.friendlyUnit(serverState.total_wasted_session, false); $("TotalWastedSession").textContent = window.qBittorrent.Misc.friendlyUnit(serverState.total_wasted_session, false);
$("GlobalRatio").textContent = serverState.global_ratio; $("GlobalRatio").textContent = serverState.global_ratio;
$("TotalPeerConnections").textContent = serverState.total_peer_connections; $("TotalPeerConnections").textContent = serverState.total_peer_connections;
$("ReadCacheHits").textContent = serverState.read_cache_hits + "%"; $("ReadCacheHits").textContent = `${serverState.read_cache_hits}%`;
$("TotalBuffersSize").textContent = window.qBittorrent.Misc.friendlyUnit(serverState.total_buffers_size, false); $("TotalBuffersSize").textContent = window.qBittorrent.Misc.friendlyUnit(serverState.total_buffers_size, false);
$("WriteCacheOverload").textContent = serverState.write_cache_overload + "%"; $("WriteCacheOverload").textContent = `${serverState.write_cache_overload}%`;
$("ReadCacheOverload").textContent = serverState.read_cache_overload + "%"; $("ReadCacheOverload").textContent = `${serverState.read_cache_overload}%`;
$("QueuedIOJobs").textContent = serverState.queued_io_jobs; $("QueuedIOJobs").textContent = serverState.queued_io_jobs;
$("AverageTimeInQueue").textContent = serverState.average_time_queue + " ms"; $("AverageTimeInQueue").textContent = `${serverState.average_time_queue} ms`;
$("TotalQueuedSize").textContent = window.qBittorrent.Misc.friendlyUnit(serverState.total_queued_size, false); $("TotalQueuedSize").textContent = window.qBittorrent.Misc.friendlyUnit(serverState.total_queued_size, false);
} }
@ -1149,8 +1150,7 @@ window.addEventListener("DOMContentLoaded", () => {
hashParams.set("download", ""); hashParams.set("download", "");
const templateHashString = hashParams.toString().replace("download=", "download=%s"); const templateHashString = hashParams.toString().replace("download=", "download=%s");
const templateUrl = location.origin + location.pathname const templateUrl = `${location.origin}${location.pathname}${location.search}#${templateHashString}`;
+ location.search + "#" + templateHashString;
navigator.registerProtocolHandler("magnet", templateUrl, navigator.registerProtocolHandler("magnet", templateUrl,
"qBittorrent WebUI magnet handler"); "qBittorrent WebUI magnet handler");

View file

@ -81,8 +81,8 @@ window.qBittorrent.DynamicTable ??= (() => {
this.selectedRows = []; this.selectedRows = [];
this.columns = []; this.columns = [];
this.contextMenu = contextMenu; this.contextMenu = contextMenu;
this.sortedColumn = LocalPreferences.get("sorted_column_" + this.dynamicTableDivId, 0); this.sortedColumn = LocalPreferences.get(`sorted_column_${this.dynamicTableDivId}`, 0);
this.reverseSort = LocalPreferences.get("reverse_sort_" + this.dynamicTableDivId, "0"); this.reverseSort = LocalPreferences.get(`reverse_sort_${this.dynamicTableDivId}`, "0");
this.initColumns(); this.initColumns();
this.loadColumnsOrder(); this.loadColumnsOrder();
this.updateTableHeaders(); this.updateTableHeaders();
@ -283,13 +283,13 @@ window.qBittorrent.DynamicTable ??= (() => {
this.saveColumnWidth(this.resizeTh.columnName); this.saveColumnWidth(this.resizeTh.columnName);
if ((this.currentHeaderAction === "drag") && (el !== this.lastHoverTh)) { if ((this.currentHeaderAction === "drag") && (el !== this.lastHoverTh)) {
this.saveColumnsOrder(); this.saveColumnsOrder();
const val = LocalPreferences.get("columns_order_" + this.dynamicTableDivId).split(","); const val = LocalPreferences.get(`columns_order_${this.dynamicTableDivId}`).split(",");
val.erase(el.columnName); val.erase(el.columnName);
let pos = val.indexOf(this.lastHoverTh.columnName); let pos = val.indexOf(this.lastHoverTh.columnName);
if (this.dropSide === "right") if (this.dropSide === "right")
++pos; ++pos;
val.splice(pos, 0, el.columnName); val.splice(pos, 0, el.columnName);
LocalPreferences.set("columns_order_" + this.dynamicTableDivId, val.join(",")); LocalPreferences.set(`columns_order_${this.dynamicTableDivId}`, val.join(","));
this.loadColumnsOrder(); this.loadColumnsOrder();
this.updateTableHeaders(); this.updateTableHeaders();
this.tableBody.replaceChildren(); this.tableBody.replaceChildren();
@ -369,7 +369,7 @@ window.qBittorrent.DynamicTable ??= (() => {
showColumn: function(columnName, show) { showColumn: function(columnName, show) {
this.columns[columnName].visible = show ? "1" : "0"; this.columns[columnName].visible = show ? "1" : "0";
LocalPreferences.set("column_" + columnName + "_visible_" + this.dynamicTableDivId, show ? "1" : "0"); LocalPreferences.set(`column_${columnName}_visible_${this.dynamicTableDivId}`, show ? "1" : "0");
this.updateColumn(columnName); this.updateColumn(columnName);
}, },
@ -430,7 +430,7 @@ window.qBittorrent.DynamicTable ??= (() => {
setupHeaderMenu: function() { setupHeaderMenu: function() {
this.setupDynamicTableHeaderContextMenuClass(); this.setupDynamicTableHeaderContextMenuClass();
const menuId = this.dynamicTableDivId + "_headerMenu"; const menuId = `${this.dynamicTableDivId}_headerMenu`;
// reuse menu if already exists // reuse menu if already exists
let ul = document.getElementById(menuId); let ul = document.getElementById(menuId);
@ -504,7 +504,7 @@ window.qBittorrent.DynamicTable ??= (() => {
document.body.append(ul); document.body.append(ul);
this.headerContextMenu = new DynamicTableHeaderContextMenuClass({ this.headerContextMenu = new DynamicTableHeaderContextMenuClass({
targets: "#" + this.dynamicTableFixedHeaderDivId + " tr th", targets: `#${this.dynamicTableFixedHeaderDivId} tr th`,
actions: actions, actions: actions,
menu: menuId, menu: menuId,
offsets: { offsets: {
@ -522,11 +522,11 @@ window.qBittorrent.DynamicTable ??= (() => {
const column = {}; const column = {};
column["name"] = name; column["name"] = name;
column["title"] = name; column["title"] = name;
column["visible"] = LocalPreferences.get("column_" + name + "_visible_" + this.dynamicTableDivId, defaultVisible ? "1" : "0"); column["visible"] = LocalPreferences.get(`column_${name}_visible_${this.dynamicTableDivId}`, (defaultVisible ? "1" : "0"));
column["force_hide"] = false; column["force_hide"] = false;
column["caption"] = caption; column["caption"] = caption;
column["style"] = style; column["style"] = style;
column["width"] = LocalPreferences.get("column_" + name + "_width_" + this.dynamicTableDivId, defaultWidth); column["width"] = LocalPreferences.get(`column_${name}_width_${this.dynamicTableDivId}`, defaultWidth);
column["dataProperties"] = [name]; column["dataProperties"] = [name];
column["getRowValue"] = function(row, pos) { column["getRowValue"] = function(row, pos) {
if (pos === undefined) if (pos === undefined)
@ -557,7 +557,7 @@ window.qBittorrent.DynamicTable ??= (() => {
loadColumnsOrder: function() { loadColumnsOrder: function() {
const columnsOrder = []; const columnsOrder = [];
const val = LocalPreferences.get("columns_order_" + this.dynamicTableDivId); const val = LocalPreferences.get(`columns_order_${this.dynamicTableDivId}`);
if ((val === null) || (val === undefined)) if ((val === null) || (val === undefined))
return; return;
val.split(",").forEach((v) => { val.split(",").forEach((v) => {
@ -581,7 +581,7 @@ window.qBittorrent.DynamicTable ??= (() => {
val += ","; val += ",";
val += this.columns[i].name; val += this.columns[i].name;
} }
LocalPreferences.set("columns_order_" + this.dynamicTableDivId, val); LocalPreferences.set(`columns_order_${this.dynamicTableDivId}`, val);
}, },
updateTableHeaders: function() { updateTableHeaders: function() {
@ -597,9 +597,9 @@ window.qBittorrent.DynamicTable ??= (() => {
th._this = this; th._this = this;
th.title = this.columns[i].caption; th.title = this.columns[i].caption;
th.textContent = this.columns[i].caption; th.textContent = this.columns[i].caption;
th.setAttribute("style", "width: " + this.columns[i].width + "px;" + this.columns[i].style); th.style.cssText = `width: ${this.columns[i].width}px; ${this.columns[i].style}`;
th.columnName = this.columns[i].name; th.columnName = this.columns[i].name;
th.classList.add("column_" + th.columnName); th.classList.add(`column_${th.columnName}`);
th.classList.toggle("invisible", ((this.columns[i].visible === "0") || this.columns[i].force_hide)); th.classList.toggle("invisible", ((this.columns[i].visible === "0") || this.columns[i].force_hide));
} }
}, },
@ -618,10 +618,10 @@ window.qBittorrent.DynamicTable ??= (() => {
const ths = this.hiddenTableHeader.getElements("th"); const ths = this.hiddenTableHeader.getElements("th");
const fths = this.fixedTableHeader.getElements("th"); const fths = this.fixedTableHeader.getElements("th");
const trs = this.tableBody.getElements("tr"); const trs = this.tableBody.getElements("tr");
const style = "width: " + this.columns[pos].width + "px;" + this.columns[pos].style; const style = `width: ${this.columns[pos].width}px; ${this.columns[pos].style}`;
ths[pos].setAttribute("style", style); ths[pos].style.cssText = style;
fths[pos].setAttribute("style", style); fths[pos].style.cssText = style;
if (visible) { if (visible) {
ths[pos].classList.remove("invisible"); ths[pos].classList.remove("invisible");
@ -640,7 +640,7 @@ window.qBittorrent.DynamicTable ??= (() => {
}, },
getSortedColumn: function() { getSortedColumn: function() {
return LocalPreferences.get("sorted_column_" + this.dynamicTableDivId); return LocalPreferences.get(`sorted_column_${this.dynamicTableDivId}`);
}, },
/** /**
@ -659,14 +659,14 @@ window.qBittorrent.DynamicTable ??= (() => {
this.reverseSort = reverse ?? (this.reverseSort === "0" ? "1" : "0"); this.reverseSort = reverse ?? (this.reverseSort === "0" ? "1" : "0");
this.setSortedColumnIcon(column, null, (this.reverseSort === "1")); this.setSortedColumnIcon(column, null, (this.reverseSort === "1"));
} }
LocalPreferences.set("sorted_column_" + this.dynamicTableDivId, column); LocalPreferences.set(`sorted_column_${this.dynamicTableDivId}`, column);
LocalPreferences.set("reverse_sort_" + this.dynamicTableDivId, this.reverseSort); LocalPreferences.set(`reverse_sort_${this.dynamicTableDivId}`, this.reverseSort);
this.updateTable(false); this.updateTable(false);
}, },
setSortedColumnIcon: function(newColumn, oldColumn, isReverse) { setSortedColumnIcon: function(newColumn, oldColumn, isReverse) {
const getCol = (headerDivId, colName) => { const getCol = (headerDivId, colName) => {
const colElem = $$("#" + headerDivId + " .column_" + colName); const colElem = $$(`#${headerDivId} .column_${colName}`);
if (colElem.length === 1) if (colElem.length === 1)
return colElem[0]; return colElem[0];
return null; return null;
@ -1265,7 +1265,7 @@ window.qBittorrent.DynamicTable ??= (() => {
const num_complete = this.getRowValue(row, 1); const num_complete = this.getRowValue(row, 1);
let value = num_seeds; let value = num_seeds;
if (num_complete !== -1) if (num_complete !== -1)
value += " (" + num_complete + ")"; value += ` (${num_complete})`;
td.textContent = value; td.textContent = value;
td.title = value; td.title = value;
}; };
@ -2125,9 +2125,9 @@ window.qBittorrent.DynamicTable ??= (() => {
initColumns: function() { initColumns: function() {
// Blocks saving header width (because window width isn't saved) // Blocks saving header width (because window width isn't saved)
LocalPreferences.remove("column_" + "checked" + "_width_" + this.dynamicTableDivId); LocalPreferences.remove(`column_checked_width_${this.dynamicTableDivId}`);
LocalPreferences.remove("column_" + "original" + "_width_" + this.dynamicTableDivId); LocalPreferences.remove(`column_original_width_${this.dynamicTableDivId}`);
LocalPreferences.remove("column_" + "renamed" + "_width_" + this.dynamicTableDivId); LocalPreferences.remove(`column_renamed_width_${this.dynamicTableDivId}`);
this.newColumn("checked", "", "", 50, true); this.newColumn("checked", "", "", 50, true);
this.newColumn("original", "", "QBT_TR(Original)QBT_TR[CONTEXT=TrackerListWidget]", 270, true); this.newColumn("original", "", "QBT_TR(Original)QBT_TR[CONTEXT=TrackerListWidget]", 270, true);
this.newColumn("renamed", "", "QBT_TR(Renamed)QBT_TR[CONTEXT=TrackerListWidget]", 220, true); this.newColumn("renamed", "", "QBT_TR(Renamed)QBT_TR[CONTEXT=TrackerListWidget]", 220, true);
@ -2226,7 +2226,7 @@ window.qBittorrent.DynamicTable ??= (() => {
const checkbox = document.createElement("input"); const checkbox = document.createElement("input");
checkbox.type = "checkbox"; checkbox.type = "checkbox";
checkbox.id = "cbRename" + id; checkbox.id = `cbRename${id}`;
checkbox.setAttribute("data-id", id); checkbox.setAttribute("data-id", id);
checkbox.className = "RenamingCB"; checkbox.className = "RenamingCB";
checkbox.addEventListener("click", (e) => { checkbox.addEventListener("click", (e) => {
@ -2247,12 +2247,12 @@ window.qBittorrent.DynamicTable ??= (() => {
// original // original
this.columns["original"].updateTd = function(td, row) { this.columns["original"].updateTd = function(td, row) {
const id = row.rowId; const id = row.rowId;
const fileNameId = "filesTablefileName" + id; const fileNameId = `filesTablefileName${id}`;
const node = that.getNode(id); const node = that.getNode(id);
if (node.isFolder) { if (node.isFolder) {
const value = this.getRowValue(row); const value = this.getRowValue(row);
const dirImgId = "renameTableDirImg" + id; const dirImgId = `renameTableDirImg${id}`;
if ($(dirImgId)) { if ($(dirImgId)) {
// just update file name // just update file name
$(fileNameId).textContent = value; $(fileNameId).textContent = value;
@ -2285,7 +2285,7 @@ window.qBittorrent.DynamicTable ??= (() => {
// renamed // renamed
this.columns["renamed"].updateTd = function(td, row) { this.columns["renamed"].updateTd = function(td, row) {
const id = row.rowId; const id = row.rowId;
const fileNameRenamedId = "filesTablefileRenamed" + id; const fileNameRenamedId = `filesTablefileRenamed${id}`;
const value = this.getRowValue(row); const value = this.getRowValue(row);
const span = document.createElement("span"); const span = document.createElement("span");
@ -2549,13 +2549,13 @@ window.qBittorrent.DynamicTable ??= (() => {
// name // name
this.columns["name"].updateTd = function(td, row) { this.columns["name"].updateTd = function(td, row) {
const id = row.rowId; const id = row.rowId;
const fileNameId = "filesTablefileName" + id; const fileNameId = `filesTablefileName${id}`;
const node = that.getNode(id); const node = that.getNode(id);
if (node.isFolder) { if (node.isFolder) {
const value = this.getRowValue(row); const value = this.getRowValue(row);
const collapseIconId = "filesTableCollapseIcon" + id; const collapseIconId = `filesTableCollapseIcon${id}`;
const dirImgId = "filesTableDirImg" + id; const dirImgId = `filesTableDirImg${id}`;
if ($(dirImgId)) { if ($(dirImgId)) {
// just update file name // just update file name
$(fileNameId).textContent = value; $(fileNameId).textContent = value;
@ -2607,10 +2607,10 @@ window.qBittorrent.DynamicTable ??= (() => {
const id = row.rowId; const id = row.rowId;
const value = this.getRowValue(row); const value = this.getRowValue(row);
const progressBar = $("pbf_" + id); const progressBar = $(`pbf_${id}`);
if (progressBar === null) { if (progressBar === null) {
td.append(new window.qBittorrent.ProgressBar.ProgressBar(value.toFloat(), { td.append(new window.qBittorrent.ProgressBar.ProgressBar(value.toFloat(), {
id: "pbf_" + id, id: `pbf_${id}`,
width: 80 width: 80
})); }));
} }
@ -2790,7 +2790,7 @@ window.qBittorrent.DynamicTable ??= (() => {
this.columns["name"].updateTd = function(td, row) { this.columns["name"].updateTd = function(td, row) {
const name = this.getRowValue(row, 0); const name = this.getRowValue(row, 0);
const unreadCount = this.getRowValue(row, 1); const unreadCount = this.getRowValue(row, 1);
const value = name + " (" + unreadCount + ")"; const value = `${name} (${unreadCount})`;
td.textContent = value; td.textContent = value;
td.title = value; td.title = value;
}; };
@ -2836,8 +2836,8 @@ window.qBittorrent.DynamicTable ??= (() => {
row["data"] = {}; row["data"] = {};
tds[0].style.overflow = "visible"; tds[0].style.overflow = "visible";
const indentation = row.full_data.indentation; const indentation = row.full_data.indentation;
tds[0].style.paddingLeft = (indentation * 32 + 4) + "px"; tds[0].style.paddingLeft = `${indentation * 32 + 4}px`;
tds[1].style.paddingLeft = (indentation * 32 + 4) + "px"; tds[1].style.paddingLeft = `${indentation * 32 + 4}px`;
}, },
updateIcons: function() { updateIcons: function() {
// state_icon // state_icon
@ -3017,10 +3017,10 @@ window.qBittorrent.DynamicTable ??= (() => {
this.newColumn("name", "", "", -1, true); this.newColumn("name", "", "", -1, true);
this.columns["checked"].updateTd = function(td, row) { this.columns["checked"].updateTd = function(td, row) {
if ($("cbRssDlRule" + row.rowId) === null) { if ($(`cbRssDlRule${row.rowId}`) === null) {
const checkbox = document.createElement("input"); const checkbox = document.createElement("input");
checkbox.type = "checkbox"; checkbox.type = "checkbox";
checkbox.id = "cbRssDlRule" + row.rowId; checkbox.id = `cbRssDlRule${row.rowId}`;
checkbox.checked = row.full_data.checked; checkbox.checked = row.full_data.checked;
checkbox.addEventListener("click", function(e) { checkbox.addEventListener("click", function(e) {
@ -3035,7 +3035,7 @@ window.qBittorrent.DynamicTable ??= (() => {
td.append(checkbox); td.append(checkbox);
} }
else { else {
$("cbRssDlRule" + row.rowId).checked = row.full_data.checked; $(`cbRssDlRule${row.rowId}`).checked = row.full_data.checked;
} }
}; };
this.columns["checked"].staticWidth = 50; this.columns["checked"].staticWidth = 50;
@ -3115,10 +3115,10 @@ window.qBittorrent.DynamicTable ??= (() => {
this.newColumn("name", "", "", -1, true); this.newColumn("name", "", "", -1, true);
this.columns["checked"].updateTd = function(td, row) { this.columns["checked"].updateTd = function(td, row) {
if ($("cbRssDlFeed" + row.rowId) === null) { if ($(`cbRssDlFeed${row.rowId}`) === null) {
const checkbox = document.createElement("input"); const checkbox = document.createElement("input");
checkbox.type = "checkbox"; checkbox.type = "checkbox";
checkbox.id = "cbRssDlFeed" + row.rowId; checkbox.id = `cbRssDlFeed${row.rowId}`;
checkbox.checked = row.full_data.checked; checkbox.checked = row.full_data.checked;
checkbox.addEventListener("click", function(e) { checkbox.addEventListener("click", function(e) {
@ -3132,7 +3132,7 @@ window.qBittorrent.DynamicTable ??= (() => {
td.append(checkbox); td.append(checkbox);
} }
else { else {
$("cbRssDlFeed" + row.rowId).checked = row.full_data.checked; $(`cbRssDlFeed${row.rowId}`).checked = row.full_data.checked;
} }
}; };
this.columns["checked"].staticWidth = 50; this.columns["checked"].staticWidth = 50;

View file

@ -123,13 +123,13 @@ window.qBittorrent.Misc ??= (() => {
let ret; let ret;
if (i === 0) { if (i === 0) {
ret = value + " " + units[i]; ret = `${value} ${units[i]}`;
} }
else { else {
const precision = friendlyUnitPrecision(i); const precision = friendlyUnitPrecision(i);
const offset = Math.pow(10, precision); const offset = Math.pow(10, precision);
// Don't round up // Don't round up
ret = (Math.floor(offset * value) / offset).toFixed(precision) + " " + units[i]; ret = `${(Math.floor(offset * value) / offset).toFixed(precision)} ${units[i]}`;
} }
if (isSpeed) if (isSpeed)
@ -169,7 +169,7 @@ window.qBittorrent.Misc ??= (() => {
percentage = 0; percentage = 0;
if (percentage > 100) if (percentage > 100)
percentage = 100; percentage = 100;
return percentage.toFixed(1) + "%"; return `${percentage.toFixed(1)}%`;
}; };
const friendlyFloat = (value, precision) => { const friendlyFloat = (value, precision) => {

View file

@ -152,16 +152,16 @@ let exportTorrentFN = () => {};
const initializeWindows = () => { const initializeWindows = () => {
saveWindowSize = (windowId) => { saveWindowSize = (windowId) => {
const size = $(windowId).getSize(); const size = $(windowId).getSize();
LocalPreferences.set("window_" + windowId + "_width", size.x); LocalPreferences.set(`window_${windowId}_width`, size.x);
LocalPreferences.set("window_" + windowId + "_height", size.y); LocalPreferences.set(`window_${windowId}_height`, size.y);
}; };
loadWindowWidth = (windowId, defaultValue) => { loadWindowWidth = (windowId, defaultValue) => {
return LocalPreferences.get("window_" + windowId + "_width", defaultValue); return LocalPreferences.get(`window_${windowId}_width`, defaultValue);
}; };
loadWindowHeight = (windowId, defaultValue) => { loadWindowHeight = (windowId, defaultValue) => {
return LocalPreferences.get("window_" + windowId + "_height", defaultValue); return LocalPreferences.get(`window_${windowId}_height`, defaultValue);
}; };
const addClickEvent = (el, fn) => { const addClickEvent = (el, fn) => {
@ -340,8 +340,8 @@ const initializeWindows = () => {
for (let i = 0; i < hashes.length; ++i) { for (let i = 0; i < hashes.length; ++i) {
const hash = hashes[i]; const hash = hashes[i];
const row = torrentsTable.getRow(hash).full_data; const row = torrentsTable.getRow(hash).full_data;
const origValues = row.ratio_limit + "|" + row.seeding_time_limit + "|" + row.inactive_seeding_time_limit + "|" const origValues = `${row.ratio_limit}|${row.seeding_time_limit}|${row.inactive_seeding_time_limit}|${row.max_ratio}`
+ row.max_ratio + "|" + row.max_seeding_time + "|" + row.max_inactive_seeding_time; + `|${row.max_seeding_time}|${row.max_inactive_seeding_time}`;
// initialize value // initialize value
if (shareRatio === null) if (shareRatio === null)

View file

@ -42,7 +42,7 @@ window.qBittorrent.pathAutofill ??= (() => {
const showInputSuggestions = (inputElement, names) => { const showInputSuggestions = (inputElement, names) => {
const datalist = document.createElement("datalist"); const datalist = document.createElement("datalist");
datalist.id = inputElement.id + "Suggestions"; datalist.id = `${inputElement.id}Suggestions`;
for (const name of names) { for (const name of names) {
const option = document.createElement("option"); const option = document.createElement("option");
option.value = name; option.value = name;

View file

@ -48,7 +48,7 @@ window.qBittorrent.PiecesBar ??= (() => {
const PiecesBar = new Class({ const PiecesBar = new Class({
initialize: (pieces, parameters) => { initialize: (pieces, parameters) => {
const vals = { const vals = {
id: "piecesbar_" + (piecesBarUniqueId++), id: `piecesbar_${piecesBarUniqueId++}`,
width: 0, width: 0,
height: 0, height: 0,
downloadingColor: "hsl(110deg 94% 27%)", // @TODO palette vars not supported for this value, apply average downloadingColor: "hsl(110deg 94% 27%)", // @TODO palette vars not supported for this value, apply average

View file

@ -40,7 +40,7 @@ window.qBittorrent.ProgressBar ??= (() => {
const ProgressBar = new Class({ const ProgressBar = new Class({
initialize: (value, parameters) => { initialize: (value, parameters) => {
const vals = { const vals = {
id: "progressbar_" + (progressBars++), id: `progressbar_${progressBars++}`,
value: [value, 0].pick(), value: [value, 0].pick(),
width: 0, width: 0,
height: 0, height: 0,

View file

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

View file

@ -137,7 +137,7 @@ window.qBittorrent.PropPeers ??= (() => {
icon: "images/qbittorrent-tray.svg", icon: "images/qbittorrent-tray.svg",
title: "QBT_TR(Add Peers)QBT_TR[CONTEXT=PeersAdditionDialog]", title: "QBT_TR(Add Peers)QBT_TR[CONTEXT=PeersAdditionDialog]",
loadMethod: "iframe", loadMethod: "iframe",
contentURL: "addpeers.html?hash=" + hash, contentURL: `addpeers.html?hash=${hash}`,
scrollbars: false, scrollbars: false,
resizable: false, resizable: false,
maximizable: false, maximizable: false,

View file

@ -177,7 +177,7 @@ window.qBittorrent.PropTrackers ??= (() => {
icon: "images/qbittorrent-tray.svg", icon: "images/qbittorrent-tray.svg",
title: "QBT_TR(Add trackers)QBT_TR[CONTEXT=TrackersAdditionDialog]", title: "QBT_TR(Add trackers)QBT_TR[CONTEXT=TrackersAdditionDialog]",
loadMethod: "iframe", loadMethod: "iframe",
contentURL: "addtrackers.html?hash=" + current_hash, contentURL: `addtrackers.html?hash=${current_hash}`,
scrollbars: true, scrollbars: true,
resizable: false, resizable: false,
maximizable: false, maximizable: false,
@ -202,7 +202,7 @@ window.qBittorrent.PropTrackers ??= (() => {
icon: "images/qbittorrent-tray.svg", icon: "images/qbittorrent-tray.svg",
title: "QBT_TR(Tracker editing)QBT_TR[CONTEXT=TrackerListWidget]", title: "QBT_TR(Tracker editing)QBT_TR[CONTEXT=TrackerListWidget]",
loadMethod: "iframe", loadMethod: "iframe",
contentURL: "edittracker.html?hash=" + current_hash + "&url=" + trackerUrl, contentURL: `edittracker.html?hash=${current_hash}&url=${trackerUrl}`,
scrollbars: true, scrollbars: true,
resizable: false, resizable: false,
maximizable: false, maximizable: false,

View file

@ -150,7 +150,7 @@ window.qBittorrent.PropWebseeds ??= (() => {
id: "webseedsPage", id: "webseedsPage",
title: "QBT_TR(Add web seeds)QBT_TR[CONTEXT=HttpServer]", title: "QBT_TR(Add web seeds)QBT_TR[CONTEXT=HttpServer]",
loadMethod: "iframe", loadMethod: "iframe",
contentURL: "addwebseeds.html?hash=" + current_hash, contentURL: `addwebseeds.html?hash=${current_hash}`,
scrollbars: true, scrollbars: true,
resizable: false, resizable: false,
maximizable: false, maximizable: false,
@ -179,7 +179,7 @@ window.qBittorrent.PropWebseeds ??= (() => {
id: "webseedsPage", id: "webseedsPage",
title: "QBT_TR(Web seed editing)QBT_TR[CONTEXT=PropertiesWidget]", title: "QBT_TR(Web seed editing)QBT_TR[CONTEXT=PropertiesWidget]",
loadMethod: "iframe", loadMethod: "iframe",
contentURL: "editwebseed.html?hash=" + current_hash + "&url=" + encodeURIComponent(webseedUrl), contentURL: `editwebseed.html?hash=${current_hash}&url=${encodeURIComponent(webseedUrl)}`,
scrollbars: true, scrollbars: true,
resizable: false, resizable: false,
maximizable: false, maximizable: false,

View file

@ -159,7 +159,7 @@ window.qBittorrent.MultiRename ??= (() => {
// Get file extension and reappend the "." (only when the file has an extension) // Get file extension and reappend the "." (only when the file has an extension)
let fileExtension = window.qBittorrent.Filesystem.fileExtension(row.original); let fileExtension = window.qBittorrent.Filesystem.fileExtension(row.original);
if (fileExtension) if (fileExtension)
fileExtension = "." + fileExtension; fileExtension = `.${fileExtension}`;
const fileNameWithoutExt = row.original.slice(0, row.original.lastIndexOf(fileExtension)); const fileNameWithoutExt = row.original.slice(0, row.original.lastIndexOf(fileExtension));

View file

@ -1824,42 +1824,42 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
const addWatchFolder = (folder = "", sel = "default_folder", other = "") => { const addWatchFolder = (folder = "", sel = "default_folder", other = "") => {
const pos = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length; const pos = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length;
const myinput = "<input id='text_watch_" + pos + "' type='text' value='" + folder + "'>"; const myinput = `<input id='text_watch_${pos}' type='text' value='${folder}'>`;
const disableInput = (sel !== "other"); const disableInput = (sel !== "other");
const mycb = "<div class='select-watched-folder-editable'>" const mycb = `<div class='select-watched-folder-editable'>`
+ "<select id ='cb_watch_" + pos + "' onchange='qBittorrent.Preferences.changeWatchFolderSelect(this)'>" + `<select id ='cb_watch_${pos}' onchange='qBittorrent.Preferences.changeWatchFolderSelect(this);'>`
+ "<option value='watch_folder'>QBT_TR(Monitored folder)QBT_TR[CONTEXT=ScanFoldersModel]</option>" + `<option value='watch_folder'>QBT_TR(Monitored folder)QBT_TR[CONTEXT=ScanFoldersModel]</option>`
+ "<option value='default_folder'>QBT_TR(Default save location)QBT_TR[CONTEXT=ScanFoldersModel]</option>" + `<option value='default_folder'>QBT_TR(Default save location)QBT_TR[CONTEXT=ScanFoldersModel]</option>`
+ "<option value='other'>QBT_TR(Other...)QBT_TR[CONTEXT=ScanFoldersModel]</option>" + `<option value='other'>QBT_TR(Other...)QBT_TR[CONTEXT=ScanFoldersModel]</option>`
+ "</select>" + `</select>`
+ "<input id='cb_watch_txt_" + pos + "' type='text' " + (disableInput ? "hidden " : "") + "/>" + `<input id='cb_watch_txt_${pos}' type='text' ${disableInput ? "hidden " : ""}/>`
+ "<img src='images/list-add.svg' id='addFolderImg_" + pos + "' alt='Add' style='padding-left:170px;width:16px;cursor:pointer;' onclick='qBittorrent.Preferences.addWatchFolder();'>" + `<img src='images/list-add.svg' id='addFolderImg_${pos}' alt='Add' style='padding-left:170px;width:16px;cursor:pointer;' onclick='qBittorrent.Preferences.addWatchFolder();'>`
+ "</div>"; + `</div>`;
watchedFoldersTable.push([myinput, mycb]); watchedFoldersTable.push([myinput, mycb]);
$("cb_watch_" + pos).value = sel; $(`cb_watch_${pos}`).value = sel;
if (disableInput) { if (disableInput) {
const elt = $("cb_watch_" + pos); const elt = $(`cb_watch_${pos}`);
other = elt.options[elt.selectedIndex].textContent; other = elt.options[elt.selectedIndex].textContent;
} }
$("cb_watch_txt_" + pos).value = other; $(`cb_watch_txt_${pos}`).value = other;
// hide previous img // hide previous img
if (pos > 0) if (pos > 0)
$("addFolderImg_" + (pos - 1)).style.display = "none"; $(`addFolderImg_${pos - 1}`).style.display = "none";
}; };
const getWatchedFolders = () => { const getWatchedFolders = () => {
const nb_folders = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length; const nb_folders = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length;
const folders = new Hash(); const folders = new Hash();
for (let i = 0; i < nb_folders; ++i) { for (let i = 0; i < nb_folders; ++i) {
const fpath = $("text_watch_" + i).value.trim(); const fpath = $(`text_watch_${i}`).value.trim();
if (fpath.length > 0) { if (fpath.length > 0) {
const sel = $("cb_watch_" + i).value.trim(); const sel = $(`cb_watch_${i}`).value.trim();
let other; let other;
if (sel === "other") if (sel === "other")
other = $("cb_watch_txt_" + i).value.trim(); other = $(`cb_watch_txt_${i}`).value.trim();
else else
other = (sel === "watch_folder") ? 0 : 1; other = (sel === "watch_folder") ? 0 : 1;
@ -2096,7 +2096,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
const time_padding = (val) => { const time_padding = (val) => {
let ret = val.toString(); let ret = val.toString();
if (ret.length === 1) if (ret.length === 1)
ret = "0" + ret; ret = `0${ret}`;
return ret; return ret;
}; };

View file

@ -343,7 +343,7 @@
icon: "images/qbittorrent-tray.svg", icon: "images/qbittorrent-tray.svg",
title: "QBT_TR(Please type a RSS feed URL)QBT_TR[CONTEXT=RSSWidget]", title: "QBT_TR(Please type a RSS feed URL)QBT_TR[CONTEXT=RSSWidget]",
loadMethod: "iframe", loadMethod: "iframe",
contentURL: "newfeed.html?path=" + encodeURIComponent(path), contentURL: `newfeed.html?path=${encodeURIComponent(path)}`,
scrollbars: false, scrollbars: false,
resizable: false, resizable: false,
maximizable: false, maximizable: false,
@ -371,7 +371,7 @@
icon: "images/qbittorrent-tray.svg", icon: "images/qbittorrent-tray.svg",
title: "QBT_TR(Please choose a folder name)QBT_TR[CONTEXT=RSSWidget]", title: "QBT_TR(Please choose a folder name)QBT_TR[CONTEXT=RSSWidget]",
loadMethod: "iframe", loadMethod: "iframe",
contentURL: "newfolder.html?path=" + encodeURIComponent(path), contentURL: `newfolder.html?path=${encodeURIComponent(path)}`,
scrollbars: false, scrollbars: false,
resizable: false, resizable: false,
maximizable: false, maximizable: false,
@ -449,7 +449,7 @@
// Place in iframe with sandbox attribute to prevent js execution // Place in iframe with sandbox attribute to prevent js execution
const torrentDescription = document.createRange().createContextualFragment('<iframe sandbox id="rssDescription"></iframe>'); const torrentDescription = document.createRange().createContextualFragment('<iframe sandbox id="rssDescription"></iframe>');
$("rssDetailsView").append(torrentDescription); $("rssDetailsView").append(torrentDescription);
document.getElementById("rssDescription").srcdoc = '<html><head><link rel="stylesheet" type="text/css" href="css/style.css"></head><body>' + article.description + "</body></html>"; document.getElementById("rssDescription").srcdoc = `<html><head><link rel="stylesheet" type="text/css" href="css/style.css"></head><body>${article.description}</body></html>`;
} }
}; };
@ -475,7 +475,7 @@
if (!Object.hasOwn(current, child)) if (!Object.hasOwn(current, child))
continue; continue;
const currentFullName = fullName ? (fullName + "\\" + child) : child; const currentFullName = fullName ? `${fullName}\\${child}` : child;
if (current[child].uid !== undefined) { if (current[child].uid !== undefined) {
current[child].name = child; current[child].name = child;
current[child].isFolder = false; current[child].isFolder = false;
@ -733,7 +733,7 @@
icon: "images/qbittorrent-tray.svg", icon: "images/qbittorrent-tray.svg",
title: "QBT_TR(Please choose a new name for this RSS feed)QBT_TR[CONTEXT=RSSWidget]", title: "QBT_TR(Please choose a new name for this RSS feed)QBT_TR[CONTEXT=RSSWidget]",
loadMethod: "iframe", loadMethod: "iframe",
contentURL: "rename_feed.html?oldPath=" + encodeURIComponent(oldPath), contentURL: `rename_feed.html?oldPath=${encodeURIComponent(oldPath)}`,
scrollbars: false, scrollbars: false,
resizable: false, resizable: false,
maximizable: false, maximizable: false,
@ -769,7 +769,7 @@
icon: "images/qbittorrent-tray.svg", icon: "images/qbittorrent-tray.svg",
title: "QBT_TR(Deletion confirmation)QBT_TR[CONTEXT=RSSWidget]", title: "QBT_TR(Deletion confirmation)QBT_TR[CONTEXT=RSSWidget]",
loadMethod: "iframe", loadMethod: "iframe",
contentURL: "confirmfeeddeletion.html?paths=" + encodeURIComponent(encodedPaths.join("|")), contentURL: `confirmfeeddeletion.html?paths=${encodeURIComponent(encodedPaths.join("|"))}`,
scrollbars: false, scrollbars: false,
resizable: false, resizable: false,
maximizable: false, maximizable: false,

View file

@ -375,17 +375,17 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
// recalculate height // recalculate height
const warningHeight = $("rssDownloaderDisabled").getBoundingClientRect().height; const warningHeight = $("rssDownloaderDisabled").getBoundingClientRect().height;
$("leftRssDownloaderColumn").style.height = "calc(100% - " + warningHeight + "px)"; $("leftRssDownloaderColumn").style.height = `calc(100% - ${warningHeight}px)`;
$("centerRssDownloaderColumn").style.height = "calc(100% - " + warningHeight + "px)"; $("centerRssDownloaderColumn").style.height = `calc(100% - ${warningHeight}px)`;
$("rightRssDownloaderColumn").style.height = "calc(100% - " + warningHeight + "px)"; $("rightRssDownloaderColumn").style.height = `calc(100% - ${warningHeight}px)`;
$("rulesTable").style.height = "calc(100% - " + $("rulesTableDesc").getBoundingClientRect().height + "px)"; $("rulesTable").style.height = `calc(100% - ${$("rulesTableDesc").getBoundingClientRect().height}px)`;
$("rssDownloaderArticlesTable").style.height = "calc(100% - " + $("articleTableDesc").getBoundingClientRect().height + "px)"; $("rssDownloaderArticlesTable").style.height = `calc(100% - ${$("articleTableDesc").getBoundingClientRect().height}px)`;
const centerRowNotTableHeight = $("saveButton").getBoundingClientRect().height const centerRowNotTableHeight = $("saveButton").getBoundingClientRect().height
+ $("ruleSettings").getBoundingClientRect().height + 15; + $("ruleSettings").getBoundingClientRect().height + 15;
$("rssDownloaderFeeds").style.height = "calc(100% - " + centerRowNotTableHeight + "px)"; $("rssDownloaderFeeds").style.height = `calc(100% - ${centerRowNotTableHeight}px)`;
// firefox calculates the height of the table inside fieldset differently and thus doesn't need the offset // firefox calculates the height of the table inside fieldset differently and thus doesn't need the offset
if (navigator.userAgent.toLowerCase().includes("firefox")) { if (navigator.userAgent.toLowerCase().includes("firefox")) {
@ -393,7 +393,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
} }
else { else {
const outsideTableHeight = ($("rssDownloaderFeedsTable").getBoundingClientRect().top - $("rssDownloaderFeeds").getBoundingClientRect().top) - 10; const outsideTableHeight = ($("rssDownloaderFeedsTable").getBoundingClientRect().top - $("rssDownloaderFeeds").getBoundingClientRect().top) - 10;
$("rssDownloaderFeedsTable").style.height = "calc(100% - " + outsideTableHeight + "px)"; $("rssDownloaderFeedsTable").style.height = `calc(100% - ${outsideTableHeight}px)`;
} }
const rssDownloaderRuleContextMenu = new window.qBittorrent.ContextMenu.RssDownloaderRuleContextMenu({ const rssDownloaderRuleContextMenu = new window.qBittorrent.ContextMenu.RssDownloaderRuleContextMenu({
@ -547,7 +547,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
icon: "images/qbittorrent-tray.svg", icon: "images/qbittorrent-tray.svg",
title: "QBT_TR(Rule renaming)QBT_TR[CONTEXT=AutomatedRssDownloader]", title: "QBT_TR(Rule renaming)QBT_TR[CONTEXT=AutomatedRssDownloader]",
loadMethod: "iframe", loadMethod: "iframe",
contentURL: "rename_rule.html?rule=" + encodeURIComponent(rule), contentURL: `rename_rule.html?rule=${encodeURIComponent(rule)}`,
scrollbars: false, scrollbars: false,
resizable: false, resizable: false,
maximizable: false, maximizable: false,
@ -570,7 +570,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
icon: "images/qbittorrent-tray.svg", icon: "images/qbittorrent-tray.svg",
title: "QBT_TR(Rule deletion confirmation)QBT_TR[CONTEXT=AutomatedRssDownloader]", title: "QBT_TR(Rule deletion confirmation)QBT_TR[CONTEXT=AutomatedRssDownloader]",
loadMethod: "iframe", loadMethod: "iframe",
contentURL: "confirmruledeletion.html?rules=" + encodeURIComponent(encodedRules.join("|")), contentURL: `confirmruledeletion.html?rules=${encodeURIComponent(encodedRules.join("|"))}`,
scrollbars: false, scrollbars: false,
resizable: false, resizable: false,
maximizable: false, maximizable: false,
@ -586,7 +586,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
icon: "images/qbittorrent-tray.svg", icon: "images/qbittorrent-tray.svg",
title: "QBT_TR(New rule name)QBT_TR[CONTEXT=AutomatedRssDownloader]", title: "QBT_TR(New rule name)QBT_TR[CONTEXT=AutomatedRssDownloader]",
loadMethod: "iframe", loadMethod: "iframe",
contentURL: "confirmruleclear.html?rules=" + encodeURIComponent(encodedRules.join("|")), contentURL: `confirmruleclear.html?rules=${encodeURIComponent(encodedRules.join("|"))}`,
scrollbars: false, scrollbars: false,
resizable: false, resizable: false,
maximizable: false, maximizable: false,
@ -818,8 +818,8 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
const secondPart = "QBT_TR(An expression with an empty %1 clause (e.g. %2))QBT_TR[CONTEXT=AutomatedRssDownloader]" const secondPart = "QBT_TR(An expression with an empty %1 clause (e.g. %2))QBT_TR[CONTEXT=AutomatedRssDownloader]"
.replace("%1", "|").replace("%2", "expr|"); .replace("%1", "|").replace("%2", "expr|");
$("mustContainText").title = mainPart + secondPart + "QBT_TR( will match all articles.)QBT_TR[CONTEXT=AutomatedRssDownloader]"; $("mustContainText").title = `${mainPart}${secondPart}QBT_TR( will match all articles.)QBT_TR[CONTEXT=AutomatedRssDownloader]`;
$("mustNotContainText").title = mainPart + secondPart + "QBT_TR( will exclude all articles.)QBT_TR[CONTEXT=AutomatedRssDownloader]"; $("mustNotContainText").title = `${mainPart}${secondPart}QBT_TR( will exclude all articles.)QBT_TR[CONTEXT=AutomatedRssDownloader]`;
let episodeFilterTitle = "QBT_TR(Matches articles based on episode filter.)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n" let episodeFilterTitle = "QBT_TR(Matches articles based on episode filter.)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n"
+ "QBT_TR(Example: )QBT_TR[CONTEXT=AutomatedRssDownloader]" + "QBT_TR(Example: )QBT_TR[CONTEXT=AutomatedRssDownloader]"