WebUI: access attribute/property natively

It is now clearer to see what property is being accessed.
Previously mootools library would re-map attribute/property to another.

PR #21007.
This commit is contained in:
Chocobo1 2024-07-12 14:06:59 +08:00 committed by GitHub
parent 815ab180c1
commit 9c26e5d4d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 889 additions and 892 deletions

View file

@ -34,7 +34,7 @@
$("addPeersOk").addEvent("click", (e) => { $("addPeersOk").addEvent("click", (e) => {
new Event(e).stop(); new Event(e).stop();
const peers = $("peers").get("value").trim().split(/[\r\n]+/); const peers = $("peers").value.trim().split(/[\r\n]+/);
if (peers.length === 0) if (peers.length === 0)
return; return;

View file

@ -68,7 +68,7 @@
parent.torrentsTable.deselectAll(); parent.torrentsTable.deselectAll();
new Event(e).stop(); new Event(e).stop();
const cmd = "api/v2/torrents/delete"; const cmd = "api/v2/torrents/delete";
const deleteFiles = $("deleteFromDiskCB").get("checked"); const deleteFiles = $("deleteFromDiskCB").checked;
new Request({ new Request({
url: cmd, url: cmd,
method: "post", method: "post",

View file

@ -173,7 +173,7 @@
}); });
if (urls.length) if (urls.length)
$("urls").set("value", urls.join("\n")); $("urls").value = urls.join("\n");
} }
let submitted = false; let submitted = false;

View file

@ -40,13 +40,13 @@
if (!uriCategoryName) if (!uriCategoryName)
return false; return false;
$("categoryName").set("disabled", true); $("categoryName").disabled = true;
$("categoryName").set("value", window.qBittorrent.Misc.escapeHtml(uriCategoryName)); $("categoryName").value = window.qBittorrent.Misc.escapeHtml(uriCategoryName);
$("savePath").set("value", window.qBittorrent.Misc.escapeHtml(uriSavePath)); $("savePath").value = window.qBittorrent.Misc.escapeHtml(uriSavePath);
$("savePath").focus(); $("savePath").focus();
} }
else if (uriAction === "createSubcategory") { else if (uriAction === "createSubcategory") {
$("categoryName").set("value", window.qBittorrent.Misc.escapeHtml(uriCategoryName)); $("categoryName").value = window.qBittorrent.Misc.escapeHtml(uriCategoryName);
$("categoryName").focus(); $("categoryName").focus();
} }
else { else {

View file

@ -27,7 +27,7 @@
menu: "multiRenameFilesMenu", menu: "multiRenameFilesMenu",
actions: { actions: {
ToggleSelection: function(element, ref) { ToggleSelection: function(element, ref) {
const rowId = parseInt(element.get("data-row-id"), 10); const rowId = parseInt(element.getAttribute("data-row-id"), 10);
const row = bulkRenameFilesTable.getNode(rowId); const row = bulkRenameFilesTable.getNode(rowId);
const checkState = (row.checked === 1) ? 0 : 1; const checkState = (row.checked === 1) ? 0 : 1;
bulkRenameFilesTable.toggleNodeTreeCheckbox(rowId, checkState); bulkRenameFilesTable.toggleNodeTreeCheckbox(rowId, checkState);
@ -53,8 +53,8 @@
if (checkboxHeader) if (checkboxHeader)
checkboxHeader.remove(); checkboxHeader.remove();
checkboxHeader = new Element("input"); checkboxHeader = new Element("input");
checkboxHeader.set("type", "checkbox"); checkboxHeader.type = "checkbox";
checkboxHeader.set("id", "rootMultiRename_cb"); checkboxHeader.id = "rootMultiRename_cb";
checkboxHeader.addEvent("click", (e) => { checkboxHeader.addEvent("click", (e) => {
bulkRenameFilesTable.toggleGlobalCheckbox(); bulkRenameFilesTable.toggleGlobalCheckbox();
fileRenamer.selectedFiles = bulkRenameFilesTable.getSelectedRows(); fileRenamer.selectedFiles = bulkRenameFilesTable.getSelectedRows();
@ -90,12 +90,12 @@
// Load Multi Rename Preferences // Load Multi Rename Preferences
const multiRenamePrefChecked = LocalPreferences.get("multirename_rememberPreferences", "true") === "true"; const multiRenamePrefChecked = LocalPreferences.get("multirename_rememberPreferences", "true") === "true";
$("multirename_rememberprefs_checkbox").setProperty("checked", multiRenamePrefChecked); $("multirename_rememberprefs_checkbox").checked = multiRenamePrefChecked;
if (multiRenamePrefChecked) { if (multiRenamePrefChecked) {
const multirename_search = LocalPreferences.get("multirename_search", ""); const multirename_search = LocalPreferences.get("multirename_search", "");
fileRenamer.setSearch(multirename_search); fileRenamer.setSearch(multirename_search);
$("multiRenameSearch").set("value", multirename_search); $("multiRenameSearch").value = multirename_search;
const multirename_useRegex = LocalPreferences.get("multirename_useRegex", false); const multirename_useRegex = LocalPreferences.get("multirename_useRegex", false);
fileRenamer.useRegex = multirename_useRegex === "true"; fileRenamer.useRegex = multirename_useRegex === "true";
@ -111,11 +111,11 @@
const multirename_replace = LocalPreferences.get("multirename_replace", ""); const multirename_replace = LocalPreferences.get("multirename_replace", "");
fileRenamer.setReplacement(multirename_replace); fileRenamer.setReplacement(multirename_replace);
$("multiRenameReplace").set("value", multirename_replace); $("multiRenameReplace").value = multirename_replace;
const multirename_appliesTo = LocalPreferences.get("multirename_appliesTo", window.qBittorrent.MultiRename.AppliesTo.FilenameExtension); const multirename_appliesTo = LocalPreferences.get("multirename_appliesTo", window.qBittorrent.MultiRename.AppliesTo.FilenameExtension);
fileRenamer.appliesTo = window.qBittorrent.MultiRename.AppliesTo[multirename_appliesTo]; fileRenamer.appliesTo = window.qBittorrent.MultiRename.AppliesTo[multirename_appliesTo];
$("applies_to_option").set("value", fileRenamer.appliesTo); $("applies_to_option").value = fileRenamer.appliesTo;
const multirename_includeFiles = LocalPreferences.get("multirename_includeFiles", true); const multirename_includeFiles = LocalPreferences.get("multirename_includeFiles", true);
fileRenamer.includeFiles = multirename_includeFiles === "true"; fileRenamer.includeFiles = multirename_includeFiles === "true";
@ -127,13 +127,13 @@
const multirename_fileEnumerationStart = LocalPreferences.get("multirename_fileEnumerationStart", 0); const multirename_fileEnumerationStart = LocalPreferences.get("multirename_fileEnumerationStart", 0);
fileRenamer.fileEnumerationStart = parseInt(multirename_fileEnumerationStart, 10); fileRenamer.fileEnumerationStart = parseInt(multirename_fileEnumerationStart, 10);
$("file_counter").set("value", fileRenamer.fileEnumerationStart); $("file_counter").value = fileRenamer.fileEnumerationStart;
const multirename_replaceAll = LocalPreferences.get("multirename_replaceAll", false); const multirename_replaceAll = LocalPreferences.get("multirename_replaceAll", false);
fileRenamer.replaceAll = multirename_replaceAll === "true"; fileRenamer.replaceAll = multirename_replaceAll === "true";
const renameButtonValue = fileRenamer.replaceAll ? "Replace All" : "Replace"; const renameButtonValue = fileRenamer.replaceAll ? "Replace All" : "Replace";
$("renameOptions").set("value", renameButtonValue); $("renameOptions").value = renameButtonValue;
$("renameButton").set("value", renameButtonValue); $("renameButton").value = renameButtonValue;
} }
// Fires every time a row's selection changes // Fires every time a row's selection changes
@ -145,7 +145,7 @@
// Setup Search Events that control renaming // Setup Search Events that control renaming
$("multiRenameSearch").addEvent("input", (e) => { $("multiRenameSearch").addEvent("input", (e) => {
const sanitized = e.target.value.replace(/\n/g, ""); const sanitized = e.target.value.replace(/\n/g, "");
$("multiRenameSearch").set("value", sanitized); $("multiRenameSearch").value = sanitized;
// Search input has changed // Search input has changed
$("multiRenameSearch").style["border-color"] = ""; $("multiRenameSearch").style["border-color"] = "";
@ -176,13 +176,13 @@
document document
.querySelectorAll("span[id^='filesTablefileRenamed']") .querySelectorAll("span[id^='filesTablefileRenamed']")
.forEach((span) => { .forEach((span) => {
span.set("text", ""); span.textContent = "";
}); });
// 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).set("text", row.renamed); $("filesTablefileRenamed" + row.rowId).textContent = row.renamed;
} }
}; };
fileRenamer.onInvalidRegex = function(err) { fileRenamer.onInvalidRegex = function(err) {
@ -192,7 +192,7 @@
// Setup Replace Events that control renaming // Setup Replace Events that control renaming
$("multiRenameReplace").addEvent("input", (e) => { $("multiRenameReplace").addEvent("input", (e) => {
const sanitized = e.target.value.replace(/\n/g, ""); const sanitized = e.target.value.replace(/\n/g, "");
$("multiRenameReplace").set("value", sanitized); $("multiRenameReplace").value = sanitized;
// Replace input has changed // Replace input has changed
$("multiRenameReplace").style["border-color"] = ""; $("multiRenameReplace").style["border-color"] = "";
@ -223,7 +223,7 @@
if (value > 99999999) if (value > 99999999)
value = 99999999; value = 99999999;
fileRenamer.fileEnumerationStart = value; fileRenamer.fileEnumerationStart = value;
$("file_counter").set("value", value); $("file_counter").value = value;
LocalPreferences.set("multirename_fileEnumerationStart", value); LocalPreferences.set("multirename_fileEnumerationStart", value);
fileRenamer.update(); fileRenamer.update();
}); });
@ -245,7 +245,7 @@
$("renameButton").disabled = true; $("renameButton").disabled = true;
$("renameOptions").disabled = true; $("renameOptions").disabled = true;
// Clear error text // Clear error text
$("rename_error").set("text", ""); $("rename_error").textContent = "";
fileRenamer.rename(); fileRenamer.rename();
}); });
fileRenamer.onRenamed = function(rows) { fileRenamer.onRenamed = function(rows) {
@ -273,13 +273,13 @@
// Adjust file enumeration count by 1 when replacing single files to prevent naming conflicts // Adjust file enumeration count by 1 when replacing single files to prevent naming conflicts
if (!fileRenamer.replaceAll) { if (!fileRenamer.replaceAll) {
fileRenamer.fileEnumerationStart++; fileRenamer.fileEnumerationStart++;
$("file_counter").set("value", fileRenamer.fileEnumerationStart); $("file_counter").value = fileRenamer.fileEnumerationStart;
} }
setupTable(selectedRows); setupTable(selectedRows);
}; };
fileRenamer.onRenameError = function(err, row) { fileRenamer.onRenameError = function(err, row) {
if (err.xhr.status === 409) if (err.xhr.status === 409)
$("rename_error").set("text", `QBT_TR(Rename failed: file or folder already exists)QBT_TR[CONTEXT=PropertiesWidget] \`${row.renamed}\``); $("rename_error").textContent = `QBT_TR(Rename failed: file or folder already exists)QBT_TR[CONTEXT=PropertiesWidget] \`${row.renamed}\``;
}; };
$("renameOptions").addEvent("change", (e) => { $("renameOptions").addEvent("change", (e) => {
const combobox = e.target; const combobox = e.target;
@ -291,7 +291,7 @@
else else
fileRenamer.replaceAll = false; fileRenamer.replaceAll = false;
LocalPreferences.set("multirename_replaceAll", fileRenamer.replaceAll); LocalPreferences.set("multirename_replaceAll", fileRenamer.replaceAll);
$("renameButton").set("value", replaceOperation); $("renameButton").value = replaceOperation;
}); });
$("closeButton").addEvent("click", () => { $("closeButton").addEvent("click", () => {
window.parent.qBittorrent.Client.closeWindows(); window.parent.qBittorrent.Client.closeWindows();

View file

@ -719,12 +719,12 @@ window.addEventListener("DOMContentLoaded", () => {
onFailure: function() { onFailure: function() {
const errorDiv = $("error_div"); const errorDiv = $("error_div");
if (errorDiv) if (errorDiv)
errorDiv.set("html", "QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]"); errorDiv.textContent = "QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]";
syncRequestInProgress = false; syncRequestInProgress = false;
syncData(2000); syncData(2000);
}, },
onSuccess: function(response) { onSuccess: function(response) {
$("error_div").set("html", ""); $("error_div").textContent = "";
if (response) { if (response) {
clearTimeout(torrentsFilterInputTimer); clearTimeout(torrentsFilterInputTimer);
torrentsFilterInputTimer = -1; torrentsFilterInputTimer = -1;
@ -903,12 +903,12 @@ window.addEventListener("DOMContentLoaded", () => {
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").set("html", 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").set("html", transfer_info); $("UpInfos").textContent = transfer_info;
document.title = (speedInTitle document.title = (speedInTitle
? (`QBT_TR([D: %1, U: %2])QBT_TR[CONTEXT=MainWindow] ` ? (`QBT_TR([D: %1, U: %2])QBT_TR[CONTEXT=MainWindow] `
@ -917,23 +917,23 @@ window.addEventListener("DOMContentLoaded", () => {
: "") : "")
+ window.qBittorrent.Client.mainTitle(); + window.qBittorrent.Client.mainTitle();
$("freeSpaceOnDisk").set("html", "QBT_TR(Free space: %1)QBT_TR[CONTEXT=HttpServer]".replace("%1", window.qBittorrent.Misc.friendlyUnit(serverState.free_space_on_disk))); $("freeSpaceOnDisk").textContent = "QBT_TR(Free space: %1)QBT_TR[CONTEXT=HttpServer]".replace("%1", window.qBittorrent.Misc.friendlyUnit(serverState.free_space_on_disk));
$("DHTNodes").set("html", "QBT_TR(DHT: %1 nodes)QBT_TR[CONTEXT=StatusBar]".replace("%1", serverState.dht_nodes)); $("DHTNodes").textContent = "QBT_TR(DHT: %1 nodes)QBT_TR[CONTEXT=StatusBar]".replace("%1", serverState.dht_nodes);
// Statistics dialog // Statistics dialog
if (document.getElementById("statisticsContent")) { if (document.getElementById("statisticsContent")) {
$("AlltimeDL").set("html", window.qBittorrent.Misc.friendlyUnit(serverState.alltime_dl, false)); $("AlltimeDL").textContent = window.qBittorrent.Misc.friendlyUnit(serverState.alltime_dl, false);
$("AlltimeUL").set("html", window.qBittorrent.Misc.friendlyUnit(serverState.alltime_ul, false)); $("AlltimeUL").textContent = window.qBittorrent.Misc.friendlyUnit(serverState.alltime_ul, false);
$("TotalWastedSession").set("html", window.qBittorrent.Misc.friendlyUnit(serverState.total_wasted_session, false)); $("TotalWastedSession").textContent = window.qBittorrent.Misc.friendlyUnit(serverState.total_wasted_session, false);
$("GlobalRatio").set("html", serverState.global_ratio); $("GlobalRatio").textContent = serverState.global_ratio;
$("TotalPeerConnections").set("html", serverState.total_peer_connections); $("TotalPeerConnections").textContent = serverState.total_peer_connections;
$("ReadCacheHits").set("html", serverState.read_cache_hits + "%"); $("ReadCacheHits").textContent = serverState.read_cache_hits + "%";
$("TotalBuffersSize").set("html", window.qBittorrent.Misc.friendlyUnit(serverState.total_buffers_size, false)); $("TotalBuffersSize").textContent = window.qBittorrent.Misc.friendlyUnit(serverState.total_buffers_size, false);
$("WriteCacheOverload").set("html", serverState.write_cache_overload + "%"); $("WriteCacheOverload").textContent = serverState.write_cache_overload + "%";
$("ReadCacheOverload").set("html", serverState.read_cache_overload + "%"); $("ReadCacheOverload").textContent = serverState.read_cache_overload + "%";
$("QueuedIOJobs").set("html", serverState.queued_io_jobs); $("QueuedIOJobs").textContent = serverState.queued_io_jobs;
$("AverageTimeInQueue").set("html", serverState.average_time_queue + " ms"); $("AverageTimeInQueue").textContent = serverState.average_time_queue + " ms";
$("TotalQueuedSize").set("html", window.qBittorrent.Misc.friendlyUnit(serverState.total_queued_size, false)); $("TotalQueuedSize").textContent = window.qBittorrent.Misc.friendlyUnit(serverState.total_queued_size, false);
} }
switch (serverState.connection_status) { switch (serverState.connection_status) {

View file

@ -186,8 +186,8 @@ window.qBittorrent.ContextMenu = (function() {
addTarget: function(t) { addTarget: function(t) {
// prevent long press from selecting this text // prevent long press from selecting this text
t.style.setProperty("user-select", "none"); t.style.userSelect = "none";
t.style.setProperty("-webkit-user-select", "none"); t.style["-webkit-user-select"] = "none";
this.targets[this.targets.length] = t; this.targets[this.targets.length] = t;
this.setupEventListeners(t); this.setupEventListeners(t);
@ -219,7 +219,7 @@ window.qBittorrent.ContextMenu = (function() {
item.addEvent("click", (e) => { item.addEvent("click", (e) => {
e.preventDefault(); e.preventDefault();
if (!item.hasClass("disabled")) { if (!item.hasClass("disabled")) {
this.execute(item.get("href").split("#")[1], $(this.options.element)); this.execute(item.href.split("#")[1], $(this.options.element));
this.fireEvent("click", [item, e]); this.fireEvent("click", [item, e]);
} }
}); });
@ -540,13 +540,13 @@ window.qBittorrent.ContextMenu = (function() {
const enabledColumnIndex = function(text) { const enabledColumnIndex = function(text) {
const columns = $("searchPluginsTableFixedHeaderRow").getChildren("th"); const columns = $("searchPluginsTableFixedHeaderRow").getChildren("th");
for (let i = 0; i < columns.length; ++i) { for (let i = 0; i < columns.length; ++i) {
if (columns[i].get("html") === "Enabled") if (columns[i].textContent === "Enabled")
return i; return i;
} }
}; };
this.showItem("Enabled"); this.showItem("Enabled");
this.setItemChecked("Enabled", this.options.element.getChildren("td")[enabledColumnIndex()].get("html") === "Yes"); this.setItemChecked("Enabled", (this.options.element.getChildren("td")[enabledColumnIndex()].textContent === "Yes"));
this.showItem("Uninstall"); this.showItem("Uninstall");
} }

View file

@ -51,8 +51,8 @@ window.qBittorrent.Download = (function() {
const category = data[i]; const category = data[i];
const option = new Element("option"); const option = new Element("option");
option.set("value", category.name); option.value = category.name;
option.set("html", category.name); option.textContent = category.name;
$("categorySelect").appendChild(option); $("categorySelect").appendChild(option);
} }
} }
@ -64,7 +64,7 @@ window.qBittorrent.Download = (function() {
const pref = window.parent.qBittorrent.Cache.preferences.get(); const pref = window.parent.qBittorrent.Cache.preferences.get();
defaultSavePath = pref.save_path; defaultSavePath = pref.save_path;
$("savepath").setProperty("value", defaultSavePath); $("savepath").value = defaultSavePath;
$("startTorrent").checked = !pref.add_stopped_enabled; $("startTorrent").checked = !pref.add_stopped_enabled;
$("addToTopOfQueue").checked = pref.add_to_top_of_queue; $("addToTopOfQueue").checked = pref.add_to_top_of_queue;

View file

@ -412,8 +412,8 @@ window.qBittorrent.DynamicTable = (function() {
}; };
column["updateTd"] = function(td, row) { column["updateTd"] = function(td, row) {
const value = this.getRowValue(row); const value = this.getRowValue(row);
td.set("text", value); td.textContent = value;
td.set("title", value); td.title = value;
}; };
column["onResize"] = null; column["onResize"] = null;
this.columns.push(column); this.columns.push(column);
@ -463,8 +463,8 @@ window.qBittorrent.DynamicTable = (function() {
for (let i = 0; i < ths.length; ++i) { for (let i = 0; i < ths.length; ++i) {
const th = ths[i]; const th = ths[i];
th._this = this; th._this = this;
th.setAttribute("title", this.columns[i].caption); th.title = this.columns[i].caption;
th.set("text", this.columns[i].caption); th.textContent = this.columns[i].caption;
th.setAttribute("style", "width: " + this.columns[i].width + "px;" + this.columns[i].style); th.setAttribute("style", "width: " + this.columns[i].width + "px;" + this.columns[i].style);
th.columnName = this.columns[i].name; th.columnName = this.columns[i].name;
th.addClass("column_" + th.columnName); th.addClass("column_" + th.columnName);
@ -740,10 +740,10 @@ window.qBittorrent.DynamicTable = (function() {
const tr = new Element("tr"); const tr = new Element("tr");
// set tabindex so element receives keydown events // set tabindex so element receives keydown events
// more info: https://developer.mozilla.org/en-US/docs/Web/API/Element/keydown_event // more info: https://developer.mozilla.org/en-US/docs/Web/API/Element/keydown_event
tr.setProperty("tabindex", "-1"); tr.tabindex = "-1";
const rowId = rows[rowPos]["rowId"]; const rowId = rows[rowPos]["rowId"];
tr.setProperty("data-row-id", rowId); tr.setAttribute("data-row-id", rowId);
tr["rowId"] = rowId; tr["rowId"] = rowId;
tr._this = this; tr._this = this;
@ -872,7 +872,7 @@ window.qBittorrent.DynamicTable = (function() {
let selectedIndex = -1; let selectedIndex = -1;
for (let i = 0; i < visibleRows.length; ++i) { for (let i = 0; i < visibleRows.length; ++i) {
const row = visibleRows[i]; const row = visibleRows[i];
if (row.getProperty("data-row-id") === selectedRowId) { if (row.getAttribute("data-row-id") === selectedRowId) {
selectedIndex = i; selectedIndex = i;
break; break;
} }
@ -883,7 +883,7 @@ window.qBittorrent.DynamicTable = (function() {
this.deselectAll(); this.deselectAll();
const newRow = visibleRows[selectedIndex + 1]; const newRow = visibleRows[selectedIndex + 1];
this.selectRow(newRow.getProperty("data-row-id")); this.selectRow(newRow.getAttribute("data-row-id"));
} }
}, },
@ -894,7 +894,7 @@ window.qBittorrent.DynamicTable = (function() {
let selectedIndex = -1; let selectedIndex = -1;
for (let i = 0; i < visibleRows.length; ++i) { for (let i = 0; i < visibleRows.length; ++i) {
const row = visibleRows[i]; const row = visibleRows[i];
if (row.getProperty("data-row-id") === selectedRowId) { if (row.getAttribute("data-row-id") === selectedRowId) {
selectedIndex = i; selectedIndex = i;
break; break;
} }
@ -905,7 +905,7 @@ window.qBittorrent.DynamicTable = (function() {
this.deselectAll(); this.deselectAll();
const newRow = visibleRows[selectedIndex - 1]; const newRow = visibleRows[selectedIndex - 1];
this.selectRow(newRow.getProperty("data-row-id")); this.selectRow(newRow.getAttribute("data-row-id"));
} }
}, },
}); });
@ -1025,8 +1025,8 @@ window.qBittorrent.DynamicTable = (function() {
if (td.getChildren("img").length > 0) { if (td.getChildren("img").length > 0) {
const img = td.getChildren("img")[0]; const img = td.getChildren("img")[0];
if (!img.src.includes(img_path)) { if (!img.src.includes(img_path)) {
img.set("src", img_path); img.src = img_path;
img.set("title", state); img.title = state;
} }
} }
else { else {
@ -1101,16 +1101,16 @@ window.qBittorrent.DynamicTable = (function() {
status = "QBT_TR(Unknown)QBT_TR[CONTEXT=HttpServer]"; status = "QBT_TR(Unknown)QBT_TR[CONTEXT=HttpServer]";
} }
td.set("text", status); td.textContent = status;
td.set("title", status); td.title = status;
}; };
// priority // priority
this.columns["priority"].updateTd = function(td, row) { this.columns["priority"].updateTd = function(td, row) {
const queuePos = this.getRowValue(row); const queuePos = this.getRowValue(row);
const formattedQueuePos = (queuePos < 1) ? "*" : queuePos; const formattedQueuePos = (queuePos < 1) ? "*" : queuePos;
td.set("text", formattedQueuePos); td.textContent = formattedQueuePos;
td.set("title", formattedQueuePos); td.title = formattedQueuePos;
}; };
this.columns["priority"].compareRows = function(row1, row2) { this.columns["priority"].compareRows = function(row1, row2) {
@ -1135,8 +1135,8 @@ window.qBittorrent.DynamicTable = (function() {
// size, total_size // size, total_size
this.columns["size"].updateTd = function(td, row) { this.columns["size"].updateTd = function(td, row) {
const size = window.qBittorrent.Misc.friendlyUnit(this.getRowValue(row), false); const size = window.qBittorrent.Misc.friendlyUnit(this.getRowValue(row), false);
td.set("text", size); td.textContent = size;
td.set("title", size); td.title = size;
}; };
this.columns["total_size"].updateTd = this.columns["size"].updateTd; this.columns["total_size"].updateTd = this.columns["size"].updateTd;
@ -1186,8 +1186,8 @@ window.qBittorrent.DynamicTable = (function() {
let value = num_seeds; let value = num_seeds;
if (num_complete !== -1) if (num_complete !== -1)
value += " (" + num_complete + ")"; value += " (" + num_complete + ")";
td.set("text", value); td.textContent = value;
td.set("title", value); td.title = value;
}; };
this.columns["num_seeds"].compareRows = function(row1, row2) { this.columns["num_seeds"].compareRows = function(row1, row2) {
const num_seeds1 = this.getRowValue(row1, 0); const num_seeds1 = this.getRowValue(row1, 0);
@ -1209,8 +1209,8 @@ window.qBittorrent.DynamicTable = (function() {
// dlspeed // dlspeed
this.columns["dlspeed"].updateTd = function(td, row) { this.columns["dlspeed"].updateTd = function(td, row) {
const speed = window.qBittorrent.Misc.friendlyUnit(this.getRowValue(row), true); const speed = window.qBittorrent.Misc.friendlyUnit(this.getRowValue(row), true);
td.set("text", speed); td.textContent = speed;
td.set("title", speed); td.title = speed;
}; };
// upspeed // upspeed
@ -1219,44 +1219,44 @@ window.qBittorrent.DynamicTable = (function() {
// eta // eta
this.columns["eta"].updateTd = function(td, row) { this.columns["eta"].updateTd = function(td, row) {
const eta = window.qBittorrent.Misc.friendlyDuration(this.getRowValue(row), window.qBittorrent.Misc.MAX_ETA); const eta = window.qBittorrent.Misc.friendlyDuration(this.getRowValue(row), window.qBittorrent.Misc.MAX_ETA);
td.set("text", eta); td.textContent = eta;
td.set("title", eta); td.title = eta;
}; };
// ratio // ratio
this.columns["ratio"].updateTd = function(td, row) { this.columns["ratio"].updateTd = function(td, row) {
const ratio = this.getRowValue(row); const ratio = this.getRowValue(row);
const string = (ratio === -1) ? "∞" : window.qBittorrent.Misc.toFixedPointString(ratio, 2); const string = (ratio === -1) ? "∞" : window.qBittorrent.Misc.toFixedPointString(ratio, 2);
td.set("text", string); td.textContent = string;
td.set("title", string); td.title = string;
}; };
// popularity // popularity
this.columns["popularity"].updateTd = function(td, row) { this.columns["popularity"].updateTd = function(td, row) {
const value = this.getRowValue(row); const value = this.getRowValue(row);
const popularity = (value === -1) ? "∞" : window.qBittorrent.Misc.toFixedPointString(value, 2); const popularity = (value === -1) ? "∞" : window.qBittorrent.Misc.toFixedPointString(value, 2);
td.set("text", popularity); td.textContent = popularity;
td.set("title", popularity); td.title = popularity;
}; };
// added on // added on
this.columns["added_on"].updateTd = function(td, row) { this.columns["added_on"].updateTd = function(td, row) {
const date = new Date(this.getRowValue(row) * 1000).toLocaleString(); const date = new Date(this.getRowValue(row) * 1000).toLocaleString();
td.set("text", date); td.textContent = date;
td.set("title", date); td.title = date;
}; };
// completion_on // completion_on
this.columns["completion_on"].updateTd = function(td, row) { this.columns["completion_on"].updateTd = function(td, row) {
const val = this.getRowValue(row); const val = this.getRowValue(row);
if ((val === 0xffffffff) || (val < 0)) { if ((val === 0xffffffff) || (val < 0)) {
td.set("text", ""); td.textContent = "";
td.set("title", ""); td.title = "";
} }
else { else {
const date = new Date(this.getRowValue(row) * 1000).toLocaleString(); const date = new Date(this.getRowValue(row) * 1000).toLocaleString();
td.set("text", date); td.textContent = date;
td.set("title", date); td.title = date;
} }
}; };
@ -1264,13 +1264,13 @@ window.qBittorrent.DynamicTable = (function() {
this.columns["dl_limit"].updateTd = function(td, row) { this.columns["dl_limit"].updateTd = function(td, row) {
const speed = this.getRowValue(row); const speed = this.getRowValue(row);
if (speed === 0) { if (speed === 0) {
td.set("text", "∞"); td.textContent = "∞";
td.set("title", "∞"); td.title = "∞";
} }
else { else {
const formattedSpeed = window.qBittorrent.Misc.friendlyUnit(speed, true); const formattedSpeed = window.qBittorrent.Misc.friendlyUnit(speed, true);
td.set("text", formattedSpeed); td.textContent = formattedSpeed;
td.set("title", formattedSpeed); td.title = formattedSpeed;
} }
}; };
@ -1292,8 +1292,8 @@ window.qBittorrent.DynamicTable = (function() {
.replace("%1", window.qBittorrent.Misc.friendlyDuration(activeTime)) .replace("%1", window.qBittorrent.Misc.friendlyDuration(activeTime))
.replace("%2", window.qBittorrent.Misc.friendlyDuration(seedingTime))) .replace("%2", window.qBittorrent.Misc.friendlyDuration(seedingTime)))
: window.qBittorrent.Misc.friendlyDuration(activeTime); : window.qBittorrent.Misc.friendlyDuration(activeTime);
td.set("text", time); td.textContent = time;
td.set("title", time); td.title = time;
}; };
// completed // completed
@ -1309,28 +1309,28 @@ window.qBittorrent.DynamicTable = (function() {
this.columns["last_activity"].updateTd = function(td, row) { this.columns["last_activity"].updateTd = function(td, row) {
const val = this.getRowValue(row); const val = this.getRowValue(row);
if (val < 1) { if (val < 1) {
td.set("text", "∞"); td.textContent = "∞";
td.set("title", "∞"); td.title = "∞";
} }
else { else {
const formattedVal = "QBT_TR(%1 ago)QBT_TR[CONTEXT=TransferListDelegate]".replace("%1", window.qBittorrent.Misc.friendlyDuration((new Date() / 1000) - val)); const formattedVal = "QBT_TR(%1 ago)QBT_TR[CONTEXT=TransferListDelegate]".replace("%1", window.qBittorrent.Misc.friendlyDuration((new Date() / 1000) - val));
td.set("text", formattedVal); td.textContent = formattedVal;
td.set("title", formattedVal); td.title = formattedVal;
} }
}; };
// availability // availability
this.columns["availability"].updateTd = function(td, row) { this.columns["availability"].updateTd = function(td, row) {
const value = window.qBittorrent.Misc.toFixedPointString(this.getRowValue(row), 3); const value = window.qBittorrent.Misc.toFixedPointString(this.getRowValue(row), 3);
td.set("text", value); td.textContent = value;
td.set("title", value); td.title = value;
}; };
// reannounce // reannounce
this.columns["reannounce"].updateTd = function(td, row) { this.columns["reannounce"].updateTd = function(td, row) {
const time = window.qBittorrent.Misc.friendlyDuration(this.getRowValue(row)); const time = window.qBittorrent.Misc.friendlyDuration(this.getRowValue(row));
td.set("text", time); td.textContent = time;
td.set("title", time); td.title = time;
}; };
// private // private
@ -1342,8 +1342,8 @@ window.qBittorrent.DynamicTable = (function() {
? "QBT_TR(Yes)QBT_TR[CONTEXT=PropertiesWidget]" ? "QBT_TR(Yes)QBT_TR[CONTEXT=PropertiesWidget]"
: "QBT_TR(No)QBT_TR[CONTEXT=PropertiesWidget]") : "QBT_TR(No)QBT_TR[CONTEXT=PropertiesWidget]")
: "QBT_TR(N/A)QBT_TR[CONTEXT=PropertiesWidget]"; : "QBT_TR(N/A)QBT_TR[CONTEXT=PropertiesWidget]";
td.set("text", string); td.textContent = string;
td.set("title", string); td.title = string;
}; };
}, },
@ -1623,10 +1623,10 @@ window.qBittorrent.DynamicTable = (function() {
if (td.getChildren("img").length > 0) { if (td.getChildren("img").length > 0) {
const img = td.getChildren("img")[0]; const img = td.getChildren("img")[0];
img.set("src", img_path); img.src = img_path;
img.set("class", "flags"); img.className = "flags";
img.set("alt", country); img.alt = country;
img.set("title", country); img.title = country;
} }
else { else {
td.adopt(new Element("img", { td.adopt(new Element("img", {
@ -1656,8 +1656,8 @@ window.qBittorrent.DynamicTable = (function() {
// flags // flags
this.columns["flags"].updateTd = function(td, row) { this.columns["flags"].updateTd = function(td, row) {
td.set("text", this.getRowValue(row, 0)); td.textContent = this.getRowValue(row, 0);
td.set("title", this.getRowValue(row, 1)); td.title = this.getRowValue(row, 1);
}; };
// progress // progress
@ -1667,21 +1667,21 @@ window.qBittorrent.DynamicTable = (function() {
if ((progressFormatted === 100.0) && (progress !== 1.0)) if ((progressFormatted === 100.0) && (progress !== 1.0))
progressFormatted = 99.9; progressFormatted = 99.9;
progressFormatted += "%"; progressFormatted += "%";
td.set("text", progressFormatted); td.textContent = progressFormatted;
td.set("title", progressFormatted); td.title = progressFormatted;
}; };
// dl_speed, up_speed // dl_speed, up_speed
this.columns["dl_speed"].updateTd = function(td, row) { this.columns["dl_speed"].updateTd = function(td, row) {
const speed = this.getRowValue(row); const speed = this.getRowValue(row);
if (speed === 0) { if (speed === 0) {
td.set("text", ""); td.textContent = "";
td.set("title", ""); td.title = "";
} }
else { else {
const formattedSpeed = window.qBittorrent.Misc.friendlyUnit(speed, true); const formattedSpeed = window.qBittorrent.Misc.friendlyUnit(speed, true);
td.set("text", formattedSpeed); td.textContent = formattedSpeed;
td.set("title", formattedSpeed); td.title = formattedSpeed;
} }
}; };
this.columns["up_speed"].updateTd = this.columns["dl_speed"].updateTd; this.columns["up_speed"].updateTd = this.columns["dl_speed"].updateTd;
@ -1689,8 +1689,8 @@ window.qBittorrent.DynamicTable = (function() {
// downloaded, uploaded // downloaded, uploaded
this.columns["downloaded"].updateTd = function(td, row) { this.columns["downloaded"].updateTd = function(td, row) {
const downloaded = window.qBittorrent.Misc.friendlyUnit(this.getRowValue(row), false); const downloaded = window.qBittorrent.Misc.friendlyUnit(this.getRowValue(row), false);
td.set("text", downloaded); td.textContent = downloaded;
td.set("title", downloaded); td.title = downloaded;
}; };
this.columns["uploaded"].updateTd = this.columns["downloaded"].updateTd; this.columns["uploaded"].updateTd = this.columns["downloaded"].updateTd;
@ -1700,8 +1700,8 @@ window.qBittorrent.DynamicTable = (function() {
// files // files
this.columns["files"].updateTd = function(td, row) { this.columns["files"].updateTd = function(td, row) {
const value = this.getRowValue(row, 0); const value = this.getRowValue(row, 0);
td.set("text", value.replace(/\n/g, ";")); td.textContent = value.replace(/\n/g, ";");
td.set("title", value); td.title = value;
}; };
} }
@ -1724,20 +1724,20 @@ window.qBittorrent.DynamicTable = (function() {
initColumnsFunctions: function() { initColumnsFunctions: function() {
const displaySize = function(td, row) { const displaySize = function(td, row) {
const size = window.qBittorrent.Misc.friendlyUnit(this.getRowValue(row), false); const size = window.qBittorrent.Misc.friendlyUnit(this.getRowValue(row), false);
td.set("text", size); td.textContent = size;
td.set("title", size); td.title = size;
}; };
const displayNum = function(td, row) { const displayNum = function(td, row) {
const value = this.getRowValue(row); const value = this.getRowValue(row);
const formattedValue = (value === "-1") ? "Unknown" : value; const formattedValue = (value === "-1") ? "Unknown" : value;
td.set("text", formattedValue); td.textContent = formattedValue;
td.set("title", formattedValue); td.title = formattedValue;
}; };
const displayDate = function(td, row) { const displayDate = function(td, row) {
const value = this.getRowValue(row) * 1000; const value = this.getRowValue(row) * 1000;
const formattedValue = (isNaN(value) || (value <= 0)) ? "" : (new Date(value).toLocaleString()); const formattedValue = (isNaN(value) || (value <= 0)) ? "" : (new Date(value).toLocaleString());
td.set("text", formattedValue); td.textContent = formattedValue;
td.set("title", formattedValue); td.title = formattedValue;
}; };
this.columns["fileSize"].updateTd = displaySize; this.columns["fileSize"].updateTd = displaySize;
@ -1785,7 +1785,7 @@ window.qBittorrent.DynamicTable = (function() {
const filterTerms = window.qBittorrent.Search.searchText.filterPattern.toLowerCase().split(" "); const filterTerms = window.qBittorrent.Search.searchText.filterPattern.toLowerCase().split(" ");
const sizeFilters = getSizeFilters(); const sizeFilters = getSizeFilters();
const seedsFilters = getSeedsFilters(); const seedsFilters = getSeedsFilters();
const searchInTorrentName = $("searchInTorrentName").get("value") === "names"; const searchInTorrentName = $("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.00) || (window.qBittorrent.Search.searchSizeFilter.max > 0.00)) {
for (let i = 0; i < rows.length; ++i) { for (let i = 0; i < rows.length; ++i) {
@ -1844,14 +1844,14 @@ window.qBittorrent.DynamicTable = (function() {
this.columns["enabled"].updateTd = function(td, row) { this.columns["enabled"].updateTd = function(td, row) {
const value = this.getRowValue(row); const value = this.getRowValue(row);
if (value) { if (value) {
td.set("text", "QBT_TR(Yes)QBT_TR[CONTEXT=SearchPluginsTable]"); td.textContent = "QBT_TR(Yes)QBT_TR[CONTEXT=SearchPluginsTable]";
td.set("title", "QBT_TR(Yes)QBT_TR[CONTEXT=SearchPluginsTable]"); td.title = "QBT_TR(Yes)QBT_TR[CONTEXT=SearchPluginsTable]";
td.getParent("tr").addClass("green"); td.getParent("tr").addClass("green");
td.getParent("tr").removeClass("red"); td.getParent("tr").removeClass("red");
} }
else { else {
td.set("text", "QBT_TR(No)QBT_TR[CONTEXT=SearchPluginsTable]"); td.textContent = "QBT_TR(No)QBT_TR[CONTEXT=SearchPluginsTable]";
td.set("title", "QBT_TR(No)QBT_TR[CONTEXT=SearchPluginsTable]"); td.title = "QBT_TR(No)QBT_TR[CONTEXT=SearchPluginsTable]";
td.getParent("tr").addClass("red"); td.getParent("tr").addClass("red");
td.getParent("tr").removeClass("green"); td.getParent("tr").removeClass("green");
} }
@ -2047,10 +2047,10 @@ window.qBittorrent.DynamicTable = (function() {
} }
}); });
const checkbox = new Element("input"); const checkbox = new Element("input");
checkbox.set("type", "checkbox"); checkbox.type = "checkbox";
checkbox.set("id", "cbRename" + id); checkbox.id = "cbRename" + id;
checkbox.set("data-id", id); checkbox.setAttribute("data-id", id);
checkbox.set("class", "RenamingCB"); checkbox.className = "RenamingCB";
checkbox.addEvent("click", (e) => { checkbox.addEvent("click", (e) => {
const node = that.getNode(id); const node = that.getNode(id);
node.checked = e.target.checked ? 0 : 1; node.checked = e.target.checked ? 0 : 1;
@ -2076,7 +2076,7 @@ window.qBittorrent.DynamicTable = (function() {
const dirImgId = "renameTableDirImg" + id; const dirImgId = "renameTableDirImg" + id;
if ($(dirImgId)) { if ($(dirImgId)) {
// just update file name // just update file name
$(fileNameId).set("text", value); $(fileNameId).textContent = value;
} }
else { else {
const span = new Element("span", { const span = new Element("span", {
@ -2094,7 +2094,7 @@ window.qBittorrent.DynamicTable = (function() {
id: dirImgId id: dirImgId
}); });
const html = dirImg.outerHTML + span.outerHTML; const html = dirImg.outerHTML + span.outerHTML;
td.set("html", html); td.innerHTML = html;
} }
} }
else { // is file else { // is file
@ -2106,7 +2106,7 @@ window.qBittorrent.DynamicTable = (function() {
"margin-left": ((node.depth + 1) * 20) "margin-left": ((node.depth + 1) * 20)
} }
}); });
td.set("html", span.outerHTML); td.innerHTML = span.outerHTML;
} }
}; };
@ -2120,7 +2120,7 @@ window.qBittorrent.DynamicTable = (function() {
text: value, text: value,
id: fileNameRenamedId, id: fileNameRenamedId,
}); });
td.set("html", span.outerHTML); td.innerHTML = span.outerHTML;
}; };
}, },
@ -2379,13 +2379,13 @@ window.qBittorrent.DynamicTable = (function() {
const that = this; const that = this;
const displaySize = function(td, row) { const displaySize = function(td, row) {
const size = window.qBittorrent.Misc.friendlyUnit(this.getRowValue(row), false); const size = window.qBittorrent.Misc.friendlyUnit(this.getRowValue(row), false);
td.set("text", size); td.textContent = size;
td.set("title", size); td.title = size;
}; };
const displayPercentage = function(td, row) { const displayPercentage = function(td, row) {
const value = window.qBittorrent.Misc.friendlyPercentage(this.getRowValue(row)); const value = window.qBittorrent.Misc.friendlyPercentage(this.getRowValue(row));
td.set("text", value); td.textContent = value;
td.set("title", value); td.title = value;
}; };
// checked // checked
@ -2419,7 +2419,7 @@ window.qBittorrent.DynamicTable = (function() {
const dirImgId = "filesTableDirImg" + id; const dirImgId = "filesTableDirImg" + id;
if ($(dirImgId)) { if ($(dirImgId)) {
// just update file name // just update file name
$(fileNameId).set("text", value); $(fileNameId).textContent = value;
} }
else { else {
const collapseIcon = new Element("img", { const collapseIcon = new Element("img", {
@ -2446,7 +2446,7 @@ window.qBittorrent.DynamicTable = (function() {
id: dirImgId id: dirImgId
}); });
const html = collapseIcon.outerHTML + dirImg.outerHTML + span.outerHTML; const html = collapseIcon.outerHTML + dirImg.outerHTML + span.outerHTML;
td.set("html", html); td.innerHTML = html;
} }
} }
else { else {
@ -2458,7 +2458,7 @@ window.qBittorrent.DynamicTable = (function() {
"margin-left": ((node.depth + 1) * 20) "margin-left": ((node.depth + 1) * 20)
} }
}); });
td.set("html", span.outerHTML); td.innerHTML = span.outerHTML;
} }
}; };
@ -2664,8 +2664,8 @@ window.qBittorrent.DynamicTable = (function() {
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.set("text", value); td.textContent = value;
td.set("title", value); td.title = value;
}; };
}, },
setupHeaderMenu: function() {}, setupHeaderMenu: function() {},
@ -2742,8 +2742,8 @@ window.qBittorrent.DynamicTable = (function() {
if (td.getChildren("img").length > 0) { if (td.getChildren("img").length > 0) {
const img = td.getChildren("img")[0]; const img = td.getChildren("img")[0];
if (!img.src.includes(img_path)) { if (!img.src.includes(img_path)) {
img.set("src", img_path); img.src = img_path;
img.set("title", status); img.title = status;
} }
} }
else { else {
@ -2782,8 +2782,8 @@ window.qBittorrent.DynamicTable = (function() {
}; };
column["updateTd"] = function(td, row) { column["updateTd"] = function(td, row) {
const value = this.getRowValue(row); const value = this.getRowValue(row);
td.set("text", value); td.textContent = value;
td.set("title", value); td.title = value;
}; };
column["onResize"] = null; column["onResize"] = null;
this.columns.push(column); this.columns.push(column);
@ -2877,8 +2877,8 @@ window.qBittorrent.DynamicTable = (function() {
}; };
column["updateTd"] = function(td, row) { column["updateTd"] = function(td, row) {
const value = this.getRowValue(row); const value = this.getRowValue(row);
td.set("text", value); td.textContent = value;
td.set("title", value); td.title = value;
}; };
column["onResize"] = null; column["onResize"] = null;
this.columns.push(column); this.columns.push(column);
@ -2905,8 +2905,8 @@ window.qBittorrent.DynamicTable = (function() {
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 = new Element("input"); const checkbox = new Element("input");
checkbox.set("type", "checkbox"); checkbox.type = "checkbox";
checkbox.set("id", "cbRssDlRule" + row.rowId); checkbox.id = "cbRssDlRule" + row.rowId;
checkbox.checked = row.full_data.checked; checkbox.checked = row.full_data.checked;
checkbox.addEvent("click", function(e) { checkbox.addEvent("click", function(e) {
@ -2962,8 +2962,8 @@ window.qBittorrent.DynamicTable = (function() {
}; };
column["updateTd"] = function(td, row) { column["updateTd"] = function(td, row) {
const value = this.getRowValue(row); const value = this.getRowValue(row);
td.set("text", value); td.textContent = value;
td.set("title", value); td.title = value;
}; };
column["onResize"] = null; column["onResize"] = null;
this.columns.push(column); this.columns.push(column);
@ -2998,8 +2998,8 @@ window.qBittorrent.DynamicTable = (function() {
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 = new Element("input"); const checkbox = new Element("input");
checkbox.set("type", "checkbox"); checkbox.type = "checkbox";
checkbox.set("id", "cbRssDlFeed" + row.rowId); checkbox.id = "cbRssDlFeed" + row.rowId;
checkbox.checked = row.full_data.checked; checkbox.checked = row.full_data.checked;
checkbox.addEvent("click", function(e) { checkbox.addEvent("click", function(e) {
@ -3048,8 +3048,8 @@ window.qBittorrent.DynamicTable = (function() {
}; };
column["updateTd"] = function(td, row) { column["updateTd"] = function(td, row) {
const value = this.getRowValue(row); const value = this.getRowValue(row);
td.set("text", value); td.textContent = value;
td.set("title", value); td.title = value;
}; };
column["onResize"] = null; column["onResize"] = null;
this.columns.push(column); this.columns.push(column);
@ -3097,8 +3097,8 @@ window.qBittorrent.DynamicTable = (function() {
}; };
column["updateTd"] = function(td, row) { column["updateTd"] = function(td, row) {
const value = this.getRowValue(row); const value = this.getRowValue(row);
td.set("text", value); td.textContent = value;
td.set("title", value); td.title = value;
}; };
column["onResize"] = null; column["onResize"] = null;
this.columns.push(column); this.columns.push(column);
@ -3179,7 +3179,7 @@ window.qBittorrent.DynamicTable = (function() {
break; break;
} }
td.set({ "text": logLevel, "title": logLevel }); td.set({ "text": logLevel, "title": logLevel });
td.getParent("tr").set("class", "logTableRow " + addClass); td.getParent("tr").className = `logTableRow${addClass}`;
}; };
}, },
@ -3246,7 +3246,7 @@ window.qBittorrent.DynamicTable = (function() {
addClass = "peerBanned"; addClass = "peerBanned";
} }
td.set({ "text": status, "title": status }); td.set({ "text": status, "title": status });
td.getParent("tr").set("class", "logTableRow " + addClass); td.getParent("tr").className = `logTableRow${addClass}`;
}; };
}, },

View file

@ -1052,8 +1052,8 @@ const initializeWindows = function() {
// download response to file // download response to file
const element = document.createElement("a"); const element = document.createElement("a");
element.setAttribute("href", url); element.href = url;
element.setAttribute("download", (name + ".torrent")); element.download = (name + ".torrent");
document.body.appendChild(element); document.body.appendChild(element);
element.click(); element.click();
document.body.removeChild(element); document.body.removeChild(element);

View file

@ -106,8 +106,8 @@ window.qBittorrent.PropFiles = (function() {
const checkbox = e.target; const checkbox = e.target;
const priority = checkbox.checked ? FilePriority.Normal : FilePriority.Ignored; const priority = checkbox.checked ? FilePriority.Normal : FilePriority.Ignored;
const id = checkbox.get("data-id"); const id = checkbox.getAttribute("data-id");
const fileId = checkbox.get("data-file-id"); const fileId = checkbox.getAttribute("data-file-id");
const rows = getAllChildren(id, fileId); const rows = getAllChildren(id, fileId);
@ -118,8 +118,8 @@ window.qBittorrent.PropFiles = (function() {
const fileComboboxChanged = function(e) { const fileComboboxChanged = function(e) {
const combobox = e.target; const combobox = e.target;
const priority = combobox.value; const priority = combobox.value;
const id = combobox.get("data-id"); const id = combobox.getAttribute("data-id");
const fileId = combobox.get("data-file-id"); const fileId = combobox.getAttribute("data-file-id");
const rows = getAllChildren(id, fileId); const rows = getAllChildren(id, fileId);
@ -133,11 +133,11 @@ window.qBittorrent.PropFiles = (function() {
const createDownloadCheckbox = function(id, fileId, checked) { const createDownloadCheckbox = function(id, fileId, checked) {
const checkbox = new Element("input"); const checkbox = new Element("input");
checkbox.set("type", "checkbox"); checkbox.type = "checkbox";
checkbox.set("id", "cbPrio" + id); checkbox.id = "cbPrio" + id;
checkbox.set("data-id", id); checkbox.setAttribute("data-id", id);
checkbox.set("data-file-id", fileId); checkbox.setAttribute("data-file-id", fileId);
checkbox.set("class", "DownloadedCB"); checkbox.className = "DownloadedCB";
checkbox.addEvent("click", fileCheckboxClicked); checkbox.addEvent("click", fileCheckboxClicked);
updateCheckbox(checkbox, checked); updateCheckbox(checkbox, checked);
@ -169,8 +169,8 @@ window.qBittorrent.PropFiles = (function() {
const createPriorityOptionElement = function(priority, selected, html) { const createPriorityOptionElement = function(priority, selected, html) {
const elem = new Element("option"); const elem = new Element("option");
elem.set("value", priority.toString()); elem.value = priority.toString();
elem.set("html", html); elem.innerHTML = html;
if (selected) if (selected)
elem.selected = true; elem.selected = true;
return elem; return elem;
@ -178,9 +178,9 @@ window.qBittorrent.PropFiles = (function() {
const createPriorityCombo = function(id, fileId, selectedPriority) { const createPriorityCombo = function(id, fileId, selectedPriority) {
const select = new Element("select"); const select = new Element("select");
select.set("id", "comboPrio" + id); select.id = "comboPrio" + id;
select.set("data-id", id); select.setAttribute("data-id", id);
select.set("data-file-id", fileId); select.setAttribute("data-file-id", fileId);
select.addClass("combo_priority"); select.addClass("combo_priority");
select.addEvent("change", fileComboboxChanged); select.addEvent("change", fileComboboxChanged);
@ -191,7 +191,7 @@ window.qBittorrent.PropFiles = (function() {
// "Mixed" priority is for display only; it shouldn't be selectable // "Mixed" priority is for display only; it shouldn't be selectable
const mixedPriorityOption = createPriorityOptionElement(FilePriority.Mixed, (FilePriority.Mixed === selectedPriority), "QBT_TR(Mixed)QBT_TR[CONTEXT=PropListDelegate]"); const mixedPriorityOption = createPriorityOptionElement(FilePriority.Mixed, (FilePriority.Mixed === selectedPriority), "QBT_TR(Mixed)QBT_TR[CONTEXT=PropListDelegate]");
mixedPriorityOption.set("disabled", true); mixedPriorityOption.disabled = true;
mixedPriorityOption.injectInside(select); mixedPriorityOption.injectInside(select);
return select; return select;
@ -483,9 +483,9 @@ window.qBittorrent.PropFiles = (function() {
}; };
const collapseIconClicked = function(event) { const collapseIconClicked = function(event) {
const id = event.get("data-id"); const id = event.getAttribute("data-id");
const node = torrentFilesTable.getNode(id); const node = torrentFilesTable.getNode(id);
const isCollapsed = (event.parentElement.get("data-collapsed") === "true"); const isCollapsed = (event.parentElement.getAttribute("data-collapsed") === "true");
if (isCollapsed) if (isCollapsed)
expandNode(node); expandNode(node);
@ -515,7 +515,7 @@ window.qBittorrent.PropFiles = (function() {
selectedRows.forEach((rowId) => { selectedRows.forEach((rowId) => {
const elem = $("comboPrio" + rowId); const elem = $("comboPrio" + rowId);
rowIds.push(rowId); rowIds.push(rowId);
fileIds.push(elem.get("data-file-id")); fileIds.push(elem.getAttribute("data-file-id"));
}); });
const uniqueRowIds = {}; const uniqueRowIds = {};
@ -623,8 +623,8 @@ window.qBittorrent.PropFiles = (function() {
const tableHeaders = $$("#torrentFilesTableFixedHeaderDiv .dynamicTableHeader th"); const tableHeaders = $$("#torrentFilesTableFixedHeaderDiv .dynamicTableHeader th");
if (tableHeaders.length > 0) { if (tableHeaders.length > 0) {
const checkbox = new Element("input"); const checkbox = new Element("input");
checkbox.set("type", "checkbox"); checkbox.type = "checkbox";
checkbox.set("id", "tristate_cb"); checkbox.id = "tristate_cb";
checkbox.addEvent("click", switchCheckboxState); checkbox.addEvent("click", switchCheckboxState);
const checkboxTH = tableHeaders[0]; const checkboxTH = tableHeaders[0];
@ -640,7 +640,7 @@ window.qBittorrent.PropFiles = (function() {
$("torrentFilesFilterInput").addEvent("input", () => { $("torrentFilesFilterInput").addEvent("input", () => {
clearTimeout(torrentFilesFilterInputTimer); clearTimeout(torrentFilesFilterInputTimer);
const value = $("torrentFilesFilterInput").get("value"); const value = $("torrentFilesFilterInput").value;
torrentFilesTable.setFilter(value); torrentFilesTable.setFilter(value);
torrentFilesFilterInputTimer = setTimeout(() => { torrentFilesFilterInputTimer = setTimeout(() => {
@ -684,7 +684,7 @@ window.qBittorrent.PropFiles = (function() {
const td = span.parentElement; const td = span.parentElement;
// store collapsed state // store collapsed state
td.set("data-collapsed", isCollapsed); td.setAttribute("data-collapsed", isCollapsed);
// rotate the collapse icon // rotate the collapse icon
const collapseIcon = td.getElementsByClassName("filesTableCollapseIcon")[0]; const collapseIcon = td.getElementsByClassName("filesTableCollapseIcon")[0];
@ -700,7 +700,7 @@ window.qBittorrent.PropFiles = (function() {
return true; return true;
const td = span.parentElement; const td = span.parentElement;
return (td.get("data-collapsed") === "true"); return td.getAttribute("data-collapsed") === "true";
}; };
const expandNode = function(node) { const expandNode = function(node) {

View file

@ -44,33 +44,33 @@ window.qBittorrent.PropGeneral = (function() {
$("progress").appendChild(piecesBar); $("progress").appendChild(piecesBar);
const clearData = function() { const clearData = function() {
$("time_elapsed").set("html", ""); $("time_elapsed").textContent = "";
$("eta").set("html", ""); $("eta").textContent = "";
$("nb_connections").set("html", ""); $("nb_connections").textContent = "";
$("total_downloaded").set("html", ""); $("total_downloaded").textContent = "";
$("total_uploaded").set("html", ""); $("total_uploaded").textContent = "";
$("dl_speed").set("html", ""); $("dl_speed").textContent = "";
$("up_speed").set("html", ""); $("up_speed").textContent = "";
$("dl_limit").set("html", ""); $("dl_limit").textContent = "";
$("up_limit").set("html", ""); $("up_limit").textContent = "";
$("total_wasted").set("html", ""); $("total_wasted").textContent = "";
$("seeds").set("html", ""); $("seeds").textContent = "";
$("peers").set("html", ""); $("peers").textContent = "";
$("share_ratio").set("html", ""); $("share_ratio").textContent = "";
$("popularity").set("html", ""); $("popularity").textContent = "";
$("reannounce").set("html", ""); $("reannounce").textContent = "";
$("last_seen").set("html", ""); $("last_seen").textContent = "";
$("total_size").set("html", ""); $("total_size").textContent = "";
$("pieces").set("html", ""); $("pieces").textContent = "";
$("created_by").set("html", ""); $("created_by").textContent = "";
$("addition_date").set("html", ""); $("addition_date").textContent = "";
$("completion_date").set("html", ""); $("completion_date").textContent = "";
$("creation_date").set("html", ""); $("creation_date").textContent = "";
$("torrent_hash_v1").set("html", ""); $("torrent_hash_v1").textContent = "";
$("torrent_hash_v2").set("html", ""); $("torrent_hash_v2").textContent = "";
$("save_path").set("html", ""); $("save_path").textContent = "";
$("comment").set("html", ""); $("comment").innerHTML = "";
$("private").set("html", ""); $("private").textContent = "";
piecesBar.clear(); piecesBar.clear();
}; };
@ -94,12 +94,12 @@ window.qBittorrent.PropGeneral = (function() {
method: "get", method: "get",
noCache: true, noCache: true,
onFailure: function() { onFailure: function() {
$("error_div").set("html", "QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]"); $("error_div").textContent = "QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]";
clearTimeout(loadTorrentDataTimer); clearTimeout(loadTorrentDataTimer);
loadTorrentDataTimer = loadTorrentData.delay(10000); loadTorrentDataTimer = loadTorrentData.delay(10000);
}, },
onSuccess: function(data) { onSuccess: function(data) {
$("error_div").set("html", ""); $("error_div").textContent = "";
if (data) { if (data) {
// Update Torrent data // Update Torrent data
@ -108,70 +108,70 @@ window.qBittorrent.PropGeneral = (function() {
.replace("%1", window.qBittorrent.Misc.friendlyDuration(data.time_elapsed)) .replace("%1", window.qBittorrent.Misc.friendlyDuration(data.time_elapsed))
.replace("%2", window.qBittorrent.Misc.friendlyDuration(data.seeding_time)) .replace("%2", window.qBittorrent.Misc.friendlyDuration(data.seeding_time))
: window.qBittorrent.Misc.friendlyDuration(data.time_elapsed); : window.qBittorrent.Misc.friendlyDuration(data.time_elapsed);
$("time_elapsed").set("html", timeElapsed); $("time_elapsed").textContent = timeElapsed;
$("eta").set("html", window.qBittorrent.Misc.friendlyDuration(data.eta, window.qBittorrent.Misc.MAX_ETA)); $("eta").textContent = window.qBittorrent.Misc.friendlyDuration(data.eta, window.qBittorrent.Misc.MAX_ETA);
const nbConnections = "QBT_TR(%1 (%2 max))QBT_TR[CONTEXT=PropertiesWidget]" const nbConnections = "QBT_TR(%1 (%2 max))QBT_TR[CONTEXT=PropertiesWidget]"
.replace("%1", data.nb_connections) .replace("%1", data.nb_connections)
.replace("%2", ((data.nb_connections_limit < 0) ? "∞" : data.nb_connections_limit)); .replace("%2", ((data.nb_connections_limit < 0) ? "∞" : data.nb_connections_limit));
$("nb_connections").set("html", nbConnections); $("nb_connections").textContent = nbConnections;
const totalDownloaded = "QBT_TR(%1 (%2 this session))QBT_TR[CONTEXT=PropertiesWidget]" const totalDownloaded = "QBT_TR(%1 (%2 this session))QBT_TR[CONTEXT=PropertiesWidget]"
.replace("%1", window.qBittorrent.Misc.friendlyUnit(data.total_downloaded)) .replace("%1", window.qBittorrent.Misc.friendlyUnit(data.total_downloaded))
.replace("%2", window.qBittorrent.Misc.friendlyUnit(data.total_downloaded_session)); .replace("%2", window.qBittorrent.Misc.friendlyUnit(data.total_downloaded_session));
$("total_downloaded").set("html", totalDownloaded); $("total_downloaded").textContent = totalDownloaded;
const totalUploaded = "QBT_TR(%1 (%2 this session))QBT_TR[CONTEXT=PropertiesWidget]" const totalUploaded = "QBT_TR(%1 (%2 this session))QBT_TR[CONTEXT=PropertiesWidget]"
.replace("%1", window.qBittorrent.Misc.friendlyUnit(data.total_uploaded)) .replace("%1", window.qBittorrent.Misc.friendlyUnit(data.total_uploaded))
.replace("%2", window.qBittorrent.Misc.friendlyUnit(data.total_uploaded_session)); .replace("%2", window.qBittorrent.Misc.friendlyUnit(data.total_uploaded_session));
$("total_uploaded").set("html", totalUploaded); $("total_uploaded").textContent = totalUploaded;
const dlSpeed = "QBT_TR(%1 (%2 avg.))QBT_TR[CONTEXT=PropertiesWidget]" const dlSpeed = "QBT_TR(%1 (%2 avg.))QBT_TR[CONTEXT=PropertiesWidget]"
.replace("%1", window.qBittorrent.Misc.friendlyUnit(data.dl_speed, true)) .replace("%1", window.qBittorrent.Misc.friendlyUnit(data.dl_speed, true))
.replace("%2", window.qBittorrent.Misc.friendlyUnit(data.dl_speed_avg, true)); .replace("%2", window.qBittorrent.Misc.friendlyUnit(data.dl_speed_avg, true));
$("dl_speed").set("html", dlSpeed); $("dl_speed").textContent = dlSpeed;
const upSpeed = "QBT_TR(%1 (%2 avg.))QBT_TR[CONTEXT=PropertiesWidget]" const upSpeed = "QBT_TR(%1 (%2 avg.))QBT_TR[CONTEXT=PropertiesWidget]"
.replace("%1", window.qBittorrent.Misc.friendlyUnit(data.up_speed, true)) .replace("%1", window.qBittorrent.Misc.friendlyUnit(data.up_speed, true))
.replace("%2", window.qBittorrent.Misc.friendlyUnit(data.up_speed_avg, true)); .replace("%2", window.qBittorrent.Misc.friendlyUnit(data.up_speed_avg, true));
$("up_speed").set("html", upSpeed); $("up_speed").textContent = upSpeed;
const dlLimit = (data.dl_limit === -1) const dlLimit = (data.dl_limit === -1)
? "∞" ? "∞"
: window.qBittorrent.Misc.friendlyUnit(data.dl_limit, true); : window.qBittorrent.Misc.friendlyUnit(data.dl_limit, true);
$("dl_limit").set("html", dlLimit); $("dl_limit").textContent = dlLimit;
const upLimit = (data.up_limit === -1) const upLimit = (data.up_limit === -1)
? "∞" ? "∞"
: window.qBittorrent.Misc.friendlyUnit(data.up_limit, true); : window.qBittorrent.Misc.friendlyUnit(data.up_limit, true);
$("up_limit").set("html", upLimit); $("up_limit").textContent = upLimit;
$("total_wasted").set("html", window.qBittorrent.Misc.friendlyUnit(data.total_wasted)); $("total_wasted").textContent = window.qBittorrent.Misc.friendlyUnit(data.total_wasted);
const seeds = "QBT_TR(%1 (%2 total))QBT_TR[CONTEXT=PropertiesWidget]" const seeds = "QBT_TR(%1 (%2 total))QBT_TR[CONTEXT=PropertiesWidget]"
.replace("%1", data.seeds) .replace("%1", data.seeds)
.replace("%2", data.seeds_total); .replace("%2", data.seeds_total);
$("seeds").set("html", seeds); $("seeds").textContent = seeds;
const peers = "QBT_TR(%1 (%2 total))QBT_TR[CONTEXT=PropertiesWidget]" const peers = "QBT_TR(%1 (%2 total))QBT_TR[CONTEXT=PropertiesWidget]"
.replace("%1", data.peers) .replace("%1", data.peers)
.replace("%2", data.peers_total); .replace("%2", data.peers_total);
$("peers").set("html", peers); $("peers").textContent = peers;
$("share_ratio").set("html", data.share_ratio.toFixed(2)); $("share_ratio").textContent = data.share_ratio.toFixed(2);
$("popularity").set("html", data.popularity.toFixed(2)); $("popularity").textContent = data.popularity.toFixed(2);
$("reannounce").set("html", window.qBittorrent.Misc.friendlyDuration(data.reannounce)); $("reannounce").textContent = window.qBittorrent.Misc.friendlyDuration(data.reannounce);
const lastSeen = (data.last_seen >= 0) const lastSeen = (data.last_seen >= 0)
? new Date(data.last_seen * 1000).toLocaleString() ? new Date(data.last_seen * 1000).toLocaleString()
: "QBT_TR(Never)QBT_TR[CONTEXT=PropertiesWidget]"; : "QBT_TR(Never)QBT_TR[CONTEXT=PropertiesWidget]";
$("last_seen").set("html", lastSeen); $("last_seen").textContent = lastSeen;
const totalSize = (data.total_size >= 0) ? window.qBittorrent.Misc.friendlyUnit(data.total_size) : ""; const totalSize = (data.total_size >= 0) ? window.qBittorrent.Misc.friendlyUnit(data.total_size) : "";
$("total_size").set("html", totalSize); $("total_size").textContent = totalSize;
const pieces = (data.pieces_num >= 0) const pieces = (data.pieces_num >= 0)
? "QBT_TR(%1 x %2 (have %3))QBT_TR[CONTEXT=PropertiesWidget]" ? "QBT_TR(%1 x %2 (have %3))QBT_TR[CONTEXT=PropertiesWidget]"
@ -179,47 +179,44 @@ window.qBittorrent.PropGeneral = (function() {
.replace("%2", window.qBittorrent.Misc.friendlyUnit(data.piece_size)) .replace("%2", window.qBittorrent.Misc.friendlyUnit(data.piece_size))
.replace("%3", data.pieces_have) .replace("%3", data.pieces_have)
: ""; : "";
$("pieces").set("html", pieces); $("pieces").textContent = pieces;
$("created_by").set("text", data.created_by); $("created_by").textContent = data.created_by;
const additionDate = (data.addition_date >= 0) const additionDate = (data.addition_date >= 0)
? new Date(data.addition_date * 1000).toLocaleString() ? new Date(data.addition_date * 1000).toLocaleString()
: "QBT_TR(Unknown)QBT_TR[CONTEXT=HttpServer]"; : "QBT_TR(Unknown)QBT_TR[CONTEXT=HttpServer]";
$("addition_date").set("html", additionDate); $("addition_date").textContent = additionDate;
const completionDate = (data.completion_date >= 0) const completionDate = (data.completion_date >= 0)
? new Date(data.completion_date * 1000).toLocaleString() ? new Date(data.completion_date * 1000).toLocaleString()
: ""; : "";
$("completion_date").set("html", completionDate); $("completion_date").textContent = completionDate;
const creationDate = (data.creation_date >= 0) const creationDate = (data.creation_date >= 0)
? new Date(data.creation_date * 1000).toLocaleString() ? new Date(data.creation_date * 1000).toLocaleString()
: ""; : "";
$("creation_date").set("html", creationDate); $("creation_date").textContent = creationDate;
const torrentHashV1 = (data.infohash_v1 !== "") const torrentHashV1 = (data.infohash_v1 !== "")
? data.infohash_v1 ? data.infohash_v1
: "QBT_TR(N/A)QBT_TR[CONTEXT=PropertiesWidget]"; : "QBT_TR(N/A)QBT_TR[CONTEXT=PropertiesWidget]";
$("torrent_hash_v1").set("html", torrentHashV1); $("torrent_hash_v1").textContent = torrentHashV1;
const torrentHashV2 = (data.infohash_v2 !== "") const torrentHashV2 = (data.infohash_v2 !== "")
? data.infohash_v2 ? data.infohash_v2
: "QBT_TR(N/A)QBT_TR[CONTEXT=PropertiesWidget]"; : "QBT_TR(N/A)QBT_TR[CONTEXT=PropertiesWidget]";
$("torrent_hash_v2").set("html", torrentHashV2); $("torrent_hash_v2").textContent = torrentHashV2;
$("save_path").set("html", data.save_path); $("save_path").textContent = data.save_path;
$("comment").set("html", window.qBittorrent.Misc.parseHtmlLinks(window.qBittorrent.Misc.escapeHtml(data.comment))); $("comment").innerHTML = window.qBittorrent.Misc.parseHtmlLinks(window.qBittorrent.Misc.escapeHtml(data.comment));
if (data.has_metadata) { $("private").textContent = (data.has_metadata
$("private").set("text", (data.private ? (data.private
? "QBT_TR(Yes)QBT_TR[CONTEXT=PropertiesWidget]" ? "QBT_TR(Yes)QBT_TR[CONTEXT=PropertiesWidget]"
: "QBT_TR(No)QBT_TR[CONTEXT=PropertiesWidget]")); : "QBT_TR(No)QBT_TR[CONTEXT=PropertiesWidget]")
} : "QBT_TR(N/A)QBT_TR[CONTEXT=PropertiesWidget]");
else {
$("private").set("text", "QBT_TR(N/A)QBT_TR[CONTEXT=PropertiesWidget]");
}
} }
else { else {
clearData(); clearData();
@ -235,12 +232,12 @@ window.qBittorrent.PropGeneral = (function() {
method: "get", method: "get",
noCache: true, noCache: true,
onFailure: function() { onFailure: function() {
$("error_div").set("html", "QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]"); $("error_div").textContent = "QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]";
clearTimeout(loadTorrentDataTimer); clearTimeout(loadTorrentDataTimer);
loadTorrentDataTimer = loadTorrentData.delay(10000); loadTorrentDataTimer = loadTorrentData.delay(10000);
}, },
onSuccess: function(data) { onSuccess: function(data) {
$("error_div").set("html", ""); $("error_div").textContent = "";
if (data) if (data)
piecesBar.setPieces(data); piecesBar.setPieces(data);

View file

@ -70,7 +70,7 @@ window.qBittorrent.PropPeers = (function() {
loadTorrentPeersTimer = loadTorrentPeersData.delay(window.qBittorrent.Client.getSyncMainDataInterval()); loadTorrentPeersTimer = loadTorrentPeersData.delay(window.qBittorrent.Client.getSyncMainDataInterval());
}, },
onSuccess: function(response) { onSuccess: function(response) {
$("error_div").set("html", ""); $("error_div").textContent = "";
if (response) { if (response) {
const full_update = (response["full_update"] === true); const full_update = (response["full_update"] === true);
if (full_update) if (full_update)

View file

@ -65,7 +65,7 @@ window.qBittorrent.PropWebseeds = (function() {
updateRow: function(tr, row) { updateRow: function(tr, row) {
const tds = tr.getElements("td"); const tds = tr.getElements("td");
for (let i = 0; i < row.length; ++i) for (let i = 0; i < row.length; ++i)
tds[i].set("html", row[i]); tds[i].innerHTML = row[i];
return true; return true;
}, },
@ -81,7 +81,7 @@ window.qBittorrent.PropWebseeds = (function() {
this.rows.set(url, tr); this.rows.set(url, tr);
for (let i = 0; i < row.length; ++i) { for (let i = 0; i < row.length; ++i) {
const td = new Element("td"); const td = new Element("td");
td.set("html", row[i]); td.innerHTML = row[i];
td.injectInside(tr); td.injectInside(tr);
} }
tr.injectInside(this.table); tr.injectInside(this.table);
@ -114,12 +114,12 @@ window.qBittorrent.PropWebseeds = (function() {
method: "get", method: "get",
noCache: true, noCache: true,
onFailure: function() { onFailure: function() {
$("error_div").set("html", "QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]"); $("error_div").textContent = "QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]";
clearTimeout(loadWebSeedsDataTimer); clearTimeout(loadWebSeedsDataTimer);
loadWebSeedsDataTimer = loadWebSeedsData.delay(20000); loadWebSeedsDataTimer = loadWebSeedsData.delay(20000);
}, },
onSuccess: function(webseeds) { onSuccess: function(webseeds) {
$("error_div").set("html", ""); $("error_div").textContent = "";
if (webseeds) { if (webseeds) {
// Update WebSeeds data // Update WebSeeds data
webseeds.each((webseed) => { webseeds.each((webseed) => {

View file

@ -90,7 +90,7 @@ window.qBittorrent.Search = (function() {
const init = function() { const init = function() {
// load "Search in" preference from local storage // load "Search in" preference from local storage
$("searchInTorrentName").set("value", (LocalPreferences.get("search_in_filter") === "names") ? "names" : "everywhere"); $("searchInTorrentName").value = (LocalPreferences.get("search_in_filter") === "names") ? "names" : "everywhere";
const searchResultsTableContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({ const searchResultsTableContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({
targets: ".searchTableRow", targets: ".searchTableRow",
menu: "searchResultsTableMenu", menu: "searchResultsTableMenu",
@ -114,7 +114,7 @@ window.qBittorrent.Search = (function() {
searchInNameFilterTimer = setTimeout(() => { searchInNameFilterTimer = setTimeout(() => {
searchInNameFilterTimer = -1; searchInNameFilterTimer = -1;
const value = $("searchInNameFilter").get("value"); const value = $("searchInNameFilter").value;
searchText.filterPattern = value; searchText.filterPattern = value;
searchFilterChanged(); searchFilterChanged();
}, window.qBittorrent.Misc.FILTER_INPUT_DELAY); }, window.qBittorrent.Misc.FILTER_INPUT_DELAY);
@ -189,7 +189,7 @@ window.qBittorrent.Search = (function() {
// reinitialize tabs // reinitialize tabs
$("searchTabs").getElements("li").removeEvents("click"); $("searchTabs").getElements("li").removeEvents("click");
$("searchTabs").getElements("li").addEvent("click", function(e) { $("searchTabs").getElements("li").addEvent("click", function(e) {
$("startSearchButton").set("text", "QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]"); $("startSearchButton").textContent = "QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]";
setActiveTab(this); setActiveTab(this);
}); });
@ -248,8 +248,8 @@ window.qBittorrent.Search = (function() {
resetSearchState(); resetSearchState();
resetFilters(); resetFilters();
$("numSearchResultsVisible").set("html", 0); $("numSearchResultsVisible").textContent = 0;
$("numSearchResultsTotal").set("html", 0); $("numSearchResultsTotal").textContent = 0;
$("searchResultsNoSearches").style.display = "block"; $("searchResultsNoSearches").style.display = "block";
$("searchResultsFilters").style.display = "none"; $("searchResultsFilters").style.display = "none";
$("searchResultsTableContainer").style.display = "none"; $("searchResultsTableContainer").style.display = "none";
@ -257,7 +257,7 @@ window.qBittorrent.Search = (function() {
} }
else if (isTabSelected && newTabToSelect) { else if (isTabSelected && newTabToSelect) {
setActiveTab(newTabToSelect); setActiveTab(newTabToSelect);
$("startSearchButton").set("text", "QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]"); $("startSearchButton").textContent = "QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]";
} }
}; };
@ -315,32 +315,32 @@ window.qBittorrent.Search = (function() {
// restore filters // restore filters
searchText.pattern = state.searchPattern; searchText.pattern = state.searchPattern;
searchText.filterPattern = state.filterPattern; searchText.filterPattern = state.filterPattern;
$("searchInNameFilter").set("value", state.filterPattern); $("searchInNameFilter").value = state.filterPattern;
searchSeedsFilter.min = state.seedsFilter.min; searchSeedsFilter.min = state.seedsFilter.min;
searchSeedsFilter.max = state.seedsFilter.max; searchSeedsFilter.max = state.seedsFilter.max;
$("searchMinSeedsFilter").set("value", state.seedsFilter.min); $("searchMinSeedsFilter").value = state.seedsFilter.min;
$("searchMaxSeedsFilter").set("value", state.seedsFilter.max); $("searchMaxSeedsFilter").value = state.seedsFilter.max;
searchSizeFilter.min = state.sizeFilter.min; searchSizeFilter.min = state.sizeFilter.min;
searchSizeFilter.minUnit = state.sizeFilter.minUnit; searchSizeFilter.minUnit = state.sizeFilter.minUnit;
searchSizeFilter.max = state.sizeFilter.max; searchSizeFilter.max = state.sizeFilter.max;
searchSizeFilter.maxUnit = state.sizeFilter.maxUnit; searchSizeFilter.maxUnit = state.sizeFilter.maxUnit;
$("searchMinSizeFilter").set("value", state.sizeFilter.min); $("searchMinSizeFilter").value = state.sizeFilter.min;
$("searchMinSizePrefix").set("value", state.sizeFilter.minUnit); $("searchMinSizePrefix").value = state.sizeFilter.minUnit;
$("searchMaxSizeFilter").set("value", state.sizeFilter.max); $("searchMaxSizeFilter").value = state.sizeFilter.max;
$("searchMaxSizePrefix").set("value", state.sizeFilter.maxUnit); $("searchMaxSizePrefix").value = state.sizeFilter.maxUnit;
const currentSearchPattern = $("searchPattern").getProperty("value").trim(); const currentSearchPattern = $("searchPattern").value.trim();
if (state.running && (state.searchPattern === currentSearchPattern)) { if (state.running && (state.searchPattern === currentSearchPattern)) {
// allow search to be stopped // allow search to be stopped
$("startSearchButton").set("text", "QBT_TR(Stop)QBT_TR[CONTEXT=SearchEngineWidget]"); $("startSearchButton").textContent = "QBT_TR(Stop)QBT_TR[CONTEXT=SearchEngineWidget]";
searchPatternChanged = false; searchPatternChanged = false;
} }
searchResultsTable.setSortedColumn(state.sort.column, state.sort.reverse); searchResultsTable.setSortedColumn(state.sort.column, state.sort.reverse);
$("searchInTorrentName").set("value", state.searchIn); $("searchInTorrentName").value = state.searchIn;
} }
// must restore all filters before calling updateTable // must restore all filters before calling updateTable
@ -351,8 +351,8 @@ window.qBittorrent.Search = (function() {
if (rowsToSelect.length > 0) if (rowsToSelect.length > 0)
searchResultsTable.reselectRows(rowsToSelect); searchResultsTable.reselectRows(rowsToSelect);
$("numSearchResultsVisible").set("html", searchResultsTable.getFilteredAndSortedRows().length); $("numSearchResultsVisible").textContent = searchResultsTable.getFilteredAndSortedRows().length;
$("numSearchResultsTotal").set("html", searchResultsTable.getRowIds().length); $("numSearchResultsTotal").textContent = searchResultsTable.getRowIds().length;
setupSearchTableEvents(true); setupSearchTableEvents(true);
}; };
@ -373,9 +373,9 @@ window.qBittorrent.Search = (function() {
const searchTab = $(`${searchTabIdPrefix}${searchId}`); const searchTab = $(`${searchTabIdPrefix}${searchId}`);
if (searchTab) { if (searchTab) {
const statusIcon = searchTab.getElement(".statusIcon"); const statusIcon = searchTab.getElement(".statusIcon");
statusIcon.set("alt", text); statusIcon.alt = text;
statusIcon.set("title", text); statusIcon.title = text;
statusIcon.set("src", image); statusIcon.src = image;
} }
}; };
@ -392,7 +392,7 @@ window.qBittorrent.Search = (function() {
plugins: plugins plugins: plugins
}, },
onSuccess: function(response) { onSuccess: function(response) {
$("startSearchButton").set("text", "QBT_TR(Stop)QBT_TR[CONTEXT=SearchEngineWidget]"); $("startSearchButton").textContent = "QBT_TR(Stop)QBT_TR[CONTEXT=SearchEngineWidget]";
const searchId = response.id; const searchId = response.id;
createSearchTab(searchId, pattern); createSearchTab(searchId, pattern);
@ -429,9 +429,9 @@ window.qBittorrent.Search = (function() {
const state = searchState.get(currentSearchId); const state = searchState.get(currentSearchId);
const isSearchRunning = state && state.running; const isSearchRunning = state && state.running;
if (!isSearchRunning || searchPatternChanged) { if (!isSearchRunning || searchPatternChanged) {
const pattern = $("searchPattern").getProperty("value").trim(); const pattern = $("searchPattern").value.trim();
const category = $("categorySelect").getProperty("value"); const category = $("categorySelect").value;
const plugins = $("pluginsSelect").getProperty("value"); const plugins = $("pluginsSelect").value;
if (!pattern || !category || !plugins) if (!pattern || !category || !plugins)
return; return;
@ -522,24 +522,24 @@ window.qBittorrent.Search = (function() {
const onSearchPatternChanged = function() { const onSearchPatternChanged = function() {
const currentSearchId = getSelectedSearchId(); const currentSearchId = getSelectedSearchId();
const state = searchState.get(currentSearchId); const state = searchState.get(currentSearchId);
const currentSearchPattern = $("searchPattern").getProperty("value").trim(); const currentSearchPattern = $("searchPattern").value.trim();
// start a new search if pattern has changed, otherwise allow the search to be stopped // start a new search if pattern has changed, otherwise allow the search to be stopped
if (state && (state.searchPattern === currentSearchPattern)) { if (state && (state.searchPattern === currentSearchPattern)) {
searchPatternChanged = false; searchPatternChanged = false;
$("startSearchButton").set("text", "QBT_TR(Stop)QBT_TR[CONTEXT=SearchEngineWidget]"); $("startSearchButton").textContent = "QBT_TR(Stop)QBT_TR[CONTEXT=SearchEngineWidget]";
} }
else { else {
searchPatternChanged = true; searchPatternChanged = true;
$("startSearchButton").set("text", "QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]"); $("startSearchButton").textContent = "QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]";
} }
}; };
const categorySelected = function() { const categorySelected = function() {
selectedCategory = $("categorySelect").get("value"); selectedCategory = $("categorySelect").value;
}; };
const pluginSelected = function() { const pluginSelected = function() {
selectedPlugin = $("pluginsSelect").get("value"); selectedPlugin = $("pluginsSelect").value;
if (selectedPlugin !== prevSelectedPlugin) { if (selectedPlugin !== prevSelectedPlugin) {
prevSelectedPlugin = selectedPlugin; prevSelectedPlugin = selectedPlugin;
@ -566,7 +566,7 @@ window.qBittorrent.Search = (function() {
}; };
const resetSearchState = function(searchId) { const resetSearchState = function(searchId) {
$("startSearchButton").set("text", "QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]"); $("startSearchButton").textContent = "QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]";
const state = searchState.get(searchId); const state = searchState.get(searchId);
if (state) { if (state) {
state.running = false; state.running = false;
@ -579,8 +579,8 @@ window.qBittorrent.Search = (function() {
const categoryHtml = []; const categoryHtml = [];
categories.each((category) => { categories.each((category) => {
const option = new Element("option"); const option = new Element("option");
option.set("value", category.id); option.value = category.id;
option.set("html", category.name); option.textContent = category.name;
categoryHtml.push(option.outerHTML); categoryHtml.push(option.outerHTML);
}); });
@ -588,15 +588,15 @@ window.qBittorrent.Search = (function() {
if (categoryHtml.length > 1) { if (categoryHtml.length > 1) {
// add separator // add separator
const option = new Element("option"); const option = new Element("option");
option.set("disabled", true); option.disabled = true;
option.set("html", "──────────"); option.textContent = "──────────";
categoryHtml.splice(1, 0, option.outerHTML); categoryHtml.splice(1, 0, option.outerHTML);
} }
$("categorySelect").set("html", categoryHtml.join("")); $("categorySelect").innerHTML = categoryHtml.join("");
}; };
const selectedPlugin = $("pluginsSelect").get("value"); const selectedPlugin = $("pluginsSelect").value;
if ((selectedPlugin === "all") || (selectedPlugin === "enabled")) { if ((selectedPlugin === "all") || (selectedPlugin === "enabled")) {
const uniqueCategories = {}; const uniqueCategories = {};
@ -660,12 +660,12 @@ window.qBittorrent.Search = (function() {
pluginsHtml.splice(2, 0, "<option disabled>──────────</option>"); pluginsHtml.splice(2, 0, "<option disabled>──────────</option>");
} }
$("pluginsSelect").set("html", pluginsHtml.join("")); $("pluginsSelect").innerHTML = pluginsHtml.join("");
$("searchPattern").setProperty("disabled", searchPluginsEmpty); $("searchPattern").disabled = searchPluginsEmpty;
$("categorySelect").setProperty("disabled", searchPluginsEmpty); $("categorySelect").disabled = searchPluginsEmpty;
$("pluginsSelect").setProperty("disabled", searchPluginsEmpty); $("pluginsSelect").disabled = searchPluginsEmpty;
$("startSearchButton").setProperty("disabled", searchPluginsEmpty); $("startSearchButton").disabled = searchPluginsEmpty;
if (window.qBittorrent.SearchPlugins !== undefined) if (window.qBittorrent.SearchPlugins !== undefined)
window.qBittorrent.SearchPlugins.updateTable(); window.qBittorrent.SearchPlugins.updateTable();
@ -687,25 +687,25 @@ window.qBittorrent.Search = (function() {
const resetFilters = function() { const resetFilters = function() {
searchText.filterPattern = ""; searchText.filterPattern = "";
$("searchInNameFilter").set("value", ""); $("searchInNameFilter").value = "";
searchSeedsFilter.min = 0; searchSeedsFilter.min = 0;
searchSeedsFilter.max = 0; searchSeedsFilter.max = 0;
$("searchMinSeedsFilter").set("value", searchSeedsFilter.min); $("searchMinSeedsFilter").value = searchSeedsFilter.min;
$("searchMaxSeedsFilter").set("value", searchSeedsFilter.max); $("searchMaxSeedsFilter").value = searchSeedsFilter.max;
searchSizeFilter.min = 0.00; searchSizeFilter.min = 0.00;
searchSizeFilter.minUnit = 2; // B = 0, KiB = 1, MiB = 2, GiB = 3, TiB = 4, PiB = 5, EiB = 6 searchSizeFilter.minUnit = 2; // B = 0, KiB = 1, MiB = 2, GiB = 3, TiB = 4, PiB = 5, EiB = 6
searchSizeFilter.max = 0.00; searchSizeFilter.max = 0.00;
searchSizeFilter.maxUnit = 3; searchSizeFilter.maxUnit = 3;
$("searchMinSizeFilter").set("value", searchSizeFilter.min); $("searchMinSizeFilter").value = searchSizeFilter.min;
$("searchMinSizePrefix").set("value", searchSizeFilter.minUnit); $("searchMinSizePrefix").value = searchSizeFilter.minUnit;
$("searchMaxSizeFilter").set("value", searchSizeFilter.max); $("searchMaxSizeFilter").value = searchSizeFilter.max;
$("searchMaxSizePrefix").set("value", searchSizeFilter.maxUnit); $("searchMaxSizePrefix").value = searchSizeFilter.maxUnit;
}; };
const getSearchInTorrentName = function() { const getSearchInTorrentName = function() {
return $("searchInTorrentName").get("value") === "names" ? "names" : "everywhere"; return ($("searchInTorrentName").value === "names") ? "names" : "everywhere";
}; };
const searchInTorrentName = function() { const searchInTorrentName = function() {
@ -714,29 +714,29 @@ window.qBittorrent.Search = (function() {
}; };
const searchSeedsFilterChanged = function() { const searchSeedsFilterChanged = function() {
searchSeedsFilter.min = $("searchMinSeedsFilter").get("value"); searchSeedsFilter.min = $("searchMinSeedsFilter").value;
searchSeedsFilter.max = $("searchMaxSeedsFilter").get("value"); searchSeedsFilter.max = $("searchMaxSeedsFilter").value;
searchFilterChanged(); searchFilterChanged();
}; };
const searchSizeFilterChanged = function() { const searchSizeFilterChanged = function() {
searchSizeFilter.min = $("searchMinSizeFilter").get("value"); searchSizeFilter.min = $("searchMinSizeFilter").value;
searchSizeFilter.minUnit = $("searchMinSizePrefix").get("value"); searchSizeFilter.minUnit = $("searchMinSizePrefix").value;
searchSizeFilter.max = $("searchMaxSizeFilter").get("value"); searchSizeFilter.max = $("searchMaxSizeFilter").value;
searchSizeFilter.maxUnit = $("searchMaxSizePrefix").get("value"); searchSizeFilter.maxUnit = $("searchMaxSizePrefix").value;
searchFilterChanged(); searchFilterChanged();
}; };
const searchSizeFilterPrefixChanged = function() { const searchSizeFilterPrefixChanged = function() {
if ((Number($("searchMinSizeFilter").get("value")) !== 0) || (Number($("searchMaxSizeFilter").get("value")) !== 0)) if ((Number($("searchMinSizeFilter").value) !== 0) || (Number($("searchMaxSizeFilter").value) !== 0))
searchSizeFilterChanged(); searchSizeFilterChanged();
}; };
const searchFilterChanged = function() { const searchFilterChanged = function() {
searchResultsTable.updateTable(); searchResultsTable.updateTable();
$("numSearchResultsVisible").set("html", searchResultsTable.getFilteredAndSortedRows().length); $("numSearchResultsVisible").textContent = searchResultsTable.getFilteredAndSortedRows().length;
}; };
const setupSearchTableEvents = function(enable) { const setupSearchTableEvents = function(enable) {
@ -778,7 +778,7 @@ window.qBittorrent.Search = (function() {
} }
}, },
onSuccess: function(response) { onSuccess: function(response) {
$("error_div").set("html", ""); $("error_div").textContent = "";
const state = searchState.get(searchId); const state = searchState.get(searchId);
// check if user stopped the search prior to receiving the response // check if user stopped the search prior to receiving the response
@ -821,8 +821,8 @@ window.qBittorrent.Search = (function() {
for (const row of newRows) for (const row of newRows)
searchResultsTable.updateRowData(row); searchResultsTable.updateRowData(row);
$("numSearchResultsVisible").set("html", searchResultsTable.getFilteredAndSortedRows().length); $("numSearchResultsVisible").textContent = searchResultsTable.getFilteredAndSortedRows().length;
$("numSearchResultsTotal").set("html", searchResultsTable.getRowIds().length); $("numSearchResultsTotal").textContent = searchResultsTable.getRowIds().length;
searchResultsTable.updateTable(); searchResultsTable.updateTable();
searchResultsTable.altRow(); searchResultsTable.altRow();

View file

@ -42,7 +42,7 @@
// check field // check field
const location = $("setLocation").value.trim(); const location = $("setLocation").value.trim();
if ((location === null) || (location === "")) { if ((location === null) || (location === "")) {
$("error_div").set("text", "QBT_TR(Save path is empty)QBT_TR[CONTEXT=TorrentsController]"); $("error_div").textContent = "QBT_TR(Save path is empty)QBT_TR[CONTEXT=TorrentsController]";
return false; return false;
} }
@ -58,7 +58,7 @@
window.parent.qBittorrent.Client.closeWindows(); window.parent.qBittorrent.Client.closeWindows();
}, },
onFailure: function(xhr) { onFailure: function(xhr) {
$("error_div").set("text", xhr.response); $("error_div").textContent = xhr.response;
} }
}).send(); }).send();
}); });

View file

@ -60,16 +60,16 @@
else { else {
setSelectedRadioValue("shareLimit", "custom"); setSelectedRadioValue("shareLimit", "custom");
if (values.ratioLimit >= 0) { if (values.ratioLimit >= 0) {
$("setRatio").set("checked", true); $("setRatio").checked = true;
$("ratio").set("value", values.ratioLimit); $("ratio").value = values.ratioLimit;
} }
if (values.seedingTimeLimit >= 0) { if (values.seedingTimeLimit >= 0) {
$("setTotalMinutes").set("checked", true); $("setTotalMinutes").checked = true;
$("totalMinutes").set("value", values.seedingTimeLimit); $("totalMinutes").value = values.seedingTimeLimit;
} }
if (values.inactiveSeedingTimeLimit >= 0) { if (values.inactiveSeedingTimeLimit >= 0) {
$("setInactiveMinutes").set("checked", true); $("setInactiveMinutes").checked = true;
$("inactiveMinutes").set("value", values.inactiveSeedingTimeLimit); $("inactiveMinutes").value = values.inactiveSeedingTimeLimit;
} }
} }
@ -94,9 +94,9 @@
ratioLimitValue = seedingTimeLimitValue = inactiveSeedingTimeLimitValue = NoLimit; ratioLimitValue = seedingTimeLimitValue = inactiveSeedingTimeLimitValue = NoLimit;
} }
else if (shareLimit === "custom") { else if (shareLimit === "custom") {
ratioLimitValue = $("setRatio").get("checked") ? $("ratio").get("value") : -1; ratioLimitValue = $("setRatio").checked ? $("ratio").value : -1;
seedingTimeLimitValue = $("setTotalMinutes").get("checked") ? $("totalMinutes").get("value") : -1; seedingTimeLimitValue = $("setTotalMinutes").checked ? $("totalMinutes").value : -1;
inactiveSeedingTimeLimitValue = $("setInactiveMinutes").get("checked") ? $("inactiveMinutes").get("value") : -1; inactiveSeedingTimeLimitValue = $("setInactiveMinutes").checked ? $("inactiveMinutes").value : -1;
} }
else { else {
return false; return false;
@ -124,7 +124,7 @@
for (let i = 0; i < radios.length; ++i) { for (let i = 0; i < radios.length; ++i) {
const radio = radios[i]; const radio = radios[i];
if (radio.checked) if (radio.checked)
return (radio).get("value"); return radio.value;
} }
} }
@ -140,26 +140,26 @@
function shareLimitChanged() { function shareLimitChanged() {
const customShareLimit = getSelectedRadioValue("shareLimit") === "custom"; const customShareLimit = getSelectedRadioValue("shareLimit") === "custom";
$("setRatio").set("disabled", !customShareLimit); $("setRatio").disabled = !customShareLimit;
$("setTotalMinutes").set("disabled", !customShareLimit); $("setTotalMinutes").disabled = !customShareLimit;
$("setInactiveMinutes").set("disabled", !customShareLimit); $("setInactiveMinutes").disabled = !customShareLimit;
enableInputBoxes(); enableInputBoxes();
$("save").set("disabled", !isFormValid()); $("save").disabled = !isFormValid();
} }
function enableInputBoxes() { function enableInputBoxes() {
$("ratio").set("disabled", ($("setRatio").get("disabled") || !$("setRatio").get("checked"))); $("ratio").disabled = $("setRatio").disabled || !$("setRatio").checked;
$("totalMinutes").set("disabled", ($("setTotalMinutes").get("disabled") || !$("setTotalMinutes").get("checked"))); $("totalMinutes").disabled = $("setTotalMinutes").disabled || !$("setTotalMinutes").checked;
$("inactiveMinutes").set("disabled", ($("setInactiveMinutes").get("disabled") || !$("setInactiveMinutes").get("checked"))); $("inactiveMinutes").disabled = $("setInactiveMinutes").disabled || !$("setInactiveMinutes").checked;
$("save").set("disabled", !isFormValid()); $("save").disabled = !isFormValid();
} }
function isFormValid() { function isFormValid() {
return !((getSelectedRadioValue("shareLimit") === "custom") && !$("setRatio").get("checked") return !((getSelectedRadioValue("shareLimit") === "custom") && !$("setRatio").checked
&& !$("setTotalMinutes").get("checked") && !$("setInactiveMinutes").get("checked")); && !$("setTotalMinutes").checked && !$("setInactiveMinutes").checked);
} }
</script> </script>
</head> </head>

View file

@ -60,7 +60,7 @@
}; };
const newPluginOk = function() { const newPluginOk = function() {
const path = $("newPluginPath").get("value").trim(); const path = $("newPluginPath").value.trim();
if (path) { if (path) {
new Request({ new Request({
url: "api/v2/search/installPlugin", url: "api/v2/search/installPlugin",

View file

@ -288,7 +288,7 @@
}; };
const filterTextChanged = () => { const filterTextChanged = () => {
const value = $("filterTextInput").get("value").trim(); const value = $("filterTextInput").value.trim();
if (inputtedFilterText !== value) { if (inputtedFilterText !== value) {
inputtedFilterText = value; inputtedFilterText = value;
logFilterChanged(); logFilterChanged();
@ -337,8 +337,8 @@
if (curTab === undefined) if (curTab === undefined)
curTab = currentSelectedTab; curTab = currentSelectedTab;
$("numFilteredLogs").set("text", tableInfo[curTab].instance.filteredLength()); $("numFilteredLogs").textContent = tableInfo[curTab].instance.filteredLength();
$("numTotalLogs").set("text", tableInfo[curTab].instance.getRowIds().length); $("numTotalLogs").textContent = tableInfo[curTab].instance.getRowIds().length;
}; };
const syncLogData = (curTab) => { const syncLogData = (curTab) => {
@ -369,12 +369,12 @@
onFailure: function(response) { onFailure: function(response) {
const errorDiv = $("error_div"); const errorDiv = $("error_div");
if (errorDiv) if (errorDiv)
errorDiv.set("text", "QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]"); errorDiv.textContent = "QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]";
tableInfo[curTab].progress = false; tableInfo[curTab].progress = false;
syncLogWithInterval(10000); syncLogWithInterval(10000);
}, },
onSuccess: function(response) { onSuccess: function(response) {
$("error_div").set("text", ""); $("error_div").textContent = "";
if ($("logTabColumn").hasClass("invisible")) if ($("logTabColumn").hasClass("invisible"))
return; return;

File diff suppressed because it is too large Load diff

View file

@ -405,12 +405,12 @@
$("rssDetailsView").append((() => { $("rssDetailsView").append((() => {
const torrentName = document.createElement("p"); const torrentName = document.createElement("p");
torrentName.innerText = article.title; torrentName.innerText = article.title;
torrentName.setAttribute("id", "rssTorrentDetailsName"); torrentName.id = "rssTorrentDetailsName";
return torrentName; return torrentName;
})()); })());
$("rssDetailsView").append((() => { $("rssDetailsView").append((() => {
const torrentDate = document.createElement("div"); const torrentDate = document.createElement("div");
torrentDate.setAttribute("id", "rssTorrentDetailsDate"); torrentDate.id = "rssTorrentDetailsDate";
const torrentDateDesc = document.createElement("b"); const torrentDateDesc = document.createElement("b");
torrentDateDesc.innerText = "QBT_TR(Date: )QBT_TR[CONTEXT=RSSWidget]"; torrentDateDesc.innerText = "QBT_TR(Date: )QBT_TR[CONTEXT=RSSWidget]";

View file

@ -131,7 +131,7 @@ function submitLoginForm(event) {
document.addEventListener("DOMContentLoaded", () => { document.addEventListener("DOMContentLoaded", () => {
const loginForm = document.getElementById("loginform"); const loginForm = document.getElementById("loginform");
loginForm.setAttribute("method", "POST"); loginForm.method = "POST";
loginForm.addEventListener("submit", submitLoginForm); loginForm.addEventListener("submit", submitLoginForm);
setupI18n(); setupI18n();