mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-27 03:30:34 +00:00
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:
parent
815ab180c1
commit
9c26e5d4d6
@ -34,7 +34,7 @@
|
||||
$("addPeersOk").addEvent("click", (e) => {
|
||||
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)
|
||||
return;
|
||||
|
||||
|
@ -68,7 +68,7 @@
|
||||
parent.torrentsTable.deselectAll();
|
||||
new Event(e).stop();
|
||||
const cmd = "api/v2/torrents/delete";
|
||||
const deleteFiles = $("deleteFromDiskCB").get("checked");
|
||||
const deleteFiles = $("deleteFromDiskCB").checked;
|
||||
new Request({
|
||||
url: cmd,
|
||||
method: "post",
|
||||
|
@ -173,7 +173,7 @@
|
||||
});
|
||||
|
||||
if (urls.length)
|
||||
$("urls").set("value", urls.join("\n"));
|
||||
$("urls").value = urls.join("\n");
|
||||
}
|
||||
|
||||
let submitted = false;
|
||||
|
@ -40,13 +40,13 @@
|
||||
if (!uriCategoryName)
|
||||
return false;
|
||||
|
||||
$("categoryName").set("disabled", true);
|
||||
$("categoryName").set("value", window.qBittorrent.Misc.escapeHtml(uriCategoryName));
|
||||
$("savePath").set("value", window.qBittorrent.Misc.escapeHtml(uriSavePath));
|
||||
$("categoryName").disabled = true;
|
||||
$("categoryName").value = window.qBittorrent.Misc.escapeHtml(uriCategoryName);
|
||||
$("savePath").value = window.qBittorrent.Misc.escapeHtml(uriSavePath);
|
||||
$("savePath").focus();
|
||||
}
|
||||
else if (uriAction === "createSubcategory") {
|
||||
$("categoryName").set("value", window.qBittorrent.Misc.escapeHtml(uriCategoryName));
|
||||
$("categoryName").value = window.qBittorrent.Misc.escapeHtml(uriCategoryName);
|
||||
$("categoryName").focus();
|
||||
}
|
||||
else {
|
||||
|
@ -27,7 +27,7 @@
|
||||
menu: "multiRenameFilesMenu",
|
||||
actions: {
|
||||
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 checkState = (row.checked === 1) ? 0 : 1;
|
||||
bulkRenameFilesTable.toggleNodeTreeCheckbox(rowId, checkState);
|
||||
@ -53,8 +53,8 @@
|
||||
if (checkboxHeader)
|
||||
checkboxHeader.remove();
|
||||
checkboxHeader = new Element("input");
|
||||
checkboxHeader.set("type", "checkbox");
|
||||
checkboxHeader.set("id", "rootMultiRename_cb");
|
||||
checkboxHeader.type = "checkbox";
|
||||
checkboxHeader.id = "rootMultiRename_cb";
|
||||
checkboxHeader.addEvent("click", (e) => {
|
||||
bulkRenameFilesTable.toggleGlobalCheckbox();
|
||||
fileRenamer.selectedFiles = bulkRenameFilesTable.getSelectedRows();
|
||||
@ -90,12 +90,12 @@
|
||||
|
||||
// Load Multi Rename Preferences
|
||||
const multiRenamePrefChecked = LocalPreferences.get("multirename_rememberPreferences", "true") === "true";
|
||||
$("multirename_rememberprefs_checkbox").setProperty("checked", multiRenamePrefChecked);
|
||||
$("multirename_rememberprefs_checkbox").checked = multiRenamePrefChecked;
|
||||
|
||||
if (multiRenamePrefChecked) {
|
||||
const multirename_search = LocalPreferences.get("multirename_search", "");
|
||||
fileRenamer.setSearch(multirename_search);
|
||||
$("multiRenameSearch").set("value", multirename_search);
|
||||
$("multiRenameSearch").value = multirename_search;
|
||||
|
||||
const multirename_useRegex = LocalPreferences.get("multirename_useRegex", false);
|
||||
fileRenamer.useRegex = multirename_useRegex === "true";
|
||||
@ -111,11 +111,11 @@
|
||||
|
||||
const multirename_replace = LocalPreferences.get("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);
|
||||
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);
|
||||
fileRenamer.includeFiles = multirename_includeFiles === "true";
|
||||
@ -127,13 +127,13 @@
|
||||
|
||||
const multirename_fileEnumerationStart = LocalPreferences.get("multirename_fileEnumerationStart", 0);
|
||||
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);
|
||||
fileRenamer.replaceAll = multirename_replaceAll === "true";
|
||||
const renameButtonValue = fileRenamer.replaceAll ? "Replace All" : "Replace";
|
||||
$("renameOptions").set("value", renameButtonValue);
|
||||
$("renameButton").set("value", renameButtonValue);
|
||||
$("renameOptions").value = renameButtonValue;
|
||||
$("renameButton").value = renameButtonValue;
|
||||
}
|
||||
|
||||
// Fires every time a row's selection changes
|
||||
@ -145,7 +145,7 @@
|
||||
// Setup Search Events that control renaming
|
||||
$("multiRenameSearch").addEvent("input", (e) => {
|
||||
const sanitized = e.target.value.replace(/\n/g, "");
|
||||
$("multiRenameSearch").set("value", sanitized);
|
||||
$("multiRenameSearch").value = sanitized;
|
||||
|
||||
// Search input has changed
|
||||
$("multiRenameSearch").style["border-color"] = "";
|
||||
@ -176,13 +176,13 @@
|
||||
document
|
||||
.querySelectorAll("span[id^='filesTablefileRenamed']")
|
||||
.forEach((span) => {
|
||||
span.set("text", "");
|
||||
span.textContent = "";
|
||||
});
|
||||
|
||||
// Update renamed column for matched rows
|
||||
for (let i = 0; i < matchedRows.length; ++i) {
|
||||
const row = matchedRows[i];
|
||||
$("filesTablefileRenamed" + row.rowId).set("text", row.renamed);
|
||||
$("filesTablefileRenamed" + row.rowId).textContent = row.renamed;
|
||||
}
|
||||
};
|
||||
fileRenamer.onInvalidRegex = function(err) {
|
||||
@ -192,7 +192,7 @@
|
||||
// Setup Replace Events that control renaming
|
||||
$("multiRenameReplace").addEvent("input", (e) => {
|
||||
const sanitized = e.target.value.replace(/\n/g, "");
|
||||
$("multiRenameReplace").set("value", sanitized);
|
||||
$("multiRenameReplace").value = sanitized;
|
||||
|
||||
// Replace input has changed
|
||||
$("multiRenameReplace").style["border-color"] = "";
|
||||
@ -223,7 +223,7 @@
|
||||
if (value > 99999999)
|
||||
value = 99999999;
|
||||
fileRenamer.fileEnumerationStart = value;
|
||||
$("file_counter").set("value", value);
|
||||
$("file_counter").value = value;
|
||||
LocalPreferences.set("multirename_fileEnumerationStart", value);
|
||||
fileRenamer.update();
|
||||
});
|
||||
@ -245,7 +245,7 @@
|
||||
$("renameButton").disabled = true;
|
||||
$("renameOptions").disabled = true;
|
||||
// Clear error text
|
||||
$("rename_error").set("text", "");
|
||||
$("rename_error").textContent = "";
|
||||
fileRenamer.rename();
|
||||
});
|
||||
fileRenamer.onRenamed = function(rows) {
|
||||
@ -273,13 +273,13 @@
|
||||
// Adjust file enumeration count by 1 when replacing single files to prevent naming conflicts
|
||||
if (!fileRenamer.replaceAll) {
|
||||
fileRenamer.fileEnumerationStart++;
|
||||
$("file_counter").set("value", fileRenamer.fileEnumerationStart);
|
||||
$("file_counter").value = fileRenamer.fileEnumerationStart;
|
||||
}
|
||||
setupTable(selectedRows);
|
||||
};
|
||||
fileRenamer.onRenameError = function(err, row) {
|
||||
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) => {
|
||||
const combobox = e.target;
|
||||
@ -291,7 +291,7 @@
|
||||
else
|
||||
fileRenamer.replaceAll = false;
|
||||
LocalPreferences.set("multirename_replaceAll", fileRenamer.replaceAll);
|
||||
$("renameButton").set("value", replaceOperation);
|
||||
$("renameButton").value = replaceOperation;
|
||||
});
|
||||
$("closeButton").addEvent("click", () => {
|
||||
window.parent.qBittorrent.Client.closeWindows();
|
||||
|
@ -719,12 +719,12 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
onFailure: function() {
|
||||
const errorDiv = $("error_div");
|
||||
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;
|
||||
syncData(2000);
|
||||
},
|
||||
onSuccess: function(response) {
|
||||
$("error_div").set("html", "");
|
||||
$("error_div").textContent = "";
|
||||
if (response) {
|
||||
clearTimeout(torrentsFilterInputTimer);
|
||||
torrentsFilterInputTimer = -1;
|
||||
@ -903,12 +903,12 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
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_info_data, false) + ")";
|
||||
$("DlInfos").set("html", transfer_info);
|
||||
$("DlInfos").textContent = transfer_info;
|
||||
transfer_info = window.qBittorrent.Misc.friendlyUnit(serverState.up_info_speed, true);
|
||||
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_info_data, false) + ")";
|
||||
$("UpInfos").set("html", transfer_info);
|
||||
$("UpInfos").textContent = transfer_info;
|
||||
|
||||
document.title = (speedInTitle
|
||||
? (`QBT_TR([D: %1, U: %2])QBT_TR[CONTEXT=MainWindow] `
|
||||
@ -917,23 +917,23 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
: "")
|
||||
+ 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)));
|
||||
$("DHTNodes").set("html", "QBT_TR(DHT: %1 nodes)QBT_TR[CONTEXT=StatusBar]".replace("%1", serverState.dht_nodes));
|
||||
$("freeSpaceOnDisk").textContent = "QBT_TR(Free space: %1)QBT_TR[CONTEXT=HttpServer]".replace("%1", window.qBittorrent.Misc.friendlyUnit(serverState.free_space_on_disk));
|
||||
$("DHTNodes").textContent = "QBT_TR(DHT: %1 nodes)QBT_TR[CONTEXT=StatusBar]".replace("%1", serverState.dht_nodes);
|
||||
|
||||
// Statistics dialog
|
||||
if (document.getElementById("statisticsContent")) {
|
||||
$("AlltimeDL").set("html", window.qBittorrent.Misc.friendlyUnit(serverState.alltime_dl, false));
|
||||
$("AlltimeUL").set("html", window.qBittorrent.Misc.friendlyUnit(serverState.alltime_ul, false));
|
||||
$("TotalWastedSession").set("html", window.qBittorrent.Misc.friendlyUnit(serverState.total_wasted_session, false));
|
||||
$("GlobalRatio").set("html", serverState.global_ratio);
|
||||
$("TotalPeerConnections").set("html", serverState.total_peer_connections);
|
||||
$("ReadCacheHits").set("html", serverState.read_cache_hits + "%");
|
||||
$("TotalBuffersSize").set("html", window.qBittorrent.Misc.friendlyUnit(serverState.total_buffers_size, false));
|
||||
$("WriteCacheOverload").set("html", serverState.write_cache_overload + "%");
|
||||
$("ReadCacheOverload").set("html", serverState.read_cache_overload + "%");
|
||||
$("QueuedIOJobs").set("html", serverState.queued_io_jobs);
|
||||
$("AverageTimeInQueue").set("html", serverState.average_time_queue + " ms");
|
||||
$("TotalQueuedSize").set("html", window.qBittorrent.Misc.friendlyUnit(serverState.total_queued_size, false));
|
||||
$("AlltimeDL").textContent = window.qBittorrent.Misc.friendlyUnit(serverState.alltime_dl, false);
|
||||
$("AlltimeUL").textContent = window.qBittorrent.Misc.friendlyUnit(serverState.alltime_ul, false);
|
||||
$("TotalWastedSession").textContent = window.qBittorrent.Misc.friendlyUnit(serverState.total_wasted_session, false);
|
||||
$("GlobalRatio").textContent = serverState.global_ratio;
|
||||
$("TotalPeerConnections").textContent = serverState.total_peer_connections;
|
||||
$("ReadCacheHits").textContent = serverState.read_cache_hits + "%";
|
||||
$("TotalBuffersSize").textContent = window.qBittorrent.Misc.friendlyUnit(serverState.total_buffers_size, false);
|
||||
$("WriteCacheOverload").textContent = serverState.write_cache_overload + "%";
|
||||
$("ReadCacheOverload").textContent = serverState.read_cache_overload + "%";
|
||||
$("QueuedIOJobs").textContent = serverState.queued_io_jobs;
|
||||
$("AverageTimeInQueue").textContent = serverState.average_time_queue + " ms";
|
||||
$("TotalQueuedSize").textContent = window.qBittorrent.Misc.friendlyUnit(serverState.total_queued_size, false);
|
||||
}
|
||||
|
||||
switch (serverState.connection_status) {
|
||||
|
@ -186,8 +186,8 @@ window.qBittorrent.ContextMenu = (function() {
|
||||
|
||||
addTarget: function(t) {
|
||||
// prevent long press from selecting this text
|
||||
t.style.setProperty("user-select", "none");
|
||||
t.style.setProperty("-webkit-user-select", "none");
|
||||
t.style.userSelect = "none";
|
||||
t.style["-webkit-user-select"] = "none";
|
||||
|
||||
this.targets[this.targets.length] = t;
|
||||
this.setupEventListeners(t);
|
||||
@ -219,7 +219,7 @@ window.qBittorrent.ContextMenu = (function() {
|
||||
item.addEvent("click", (e) => {
|
||||
e.preventDefault();
|
||||
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]);
|
||||
}
|
||||
});
|
||||
@ -540,13 +540,13 @@ window.qBittorrent.ContextMenu = (function() {
|
||||
const enabledColumnIndex = function(text) {
|
||||
const columns = $("searchPluginsTableFixedHeaderRow").getChildren("th");
|
||||
for (let i = 0; i < columns.length; ++i) {
|
||||
if (columns[i].get("html") === "Enabled")
|
||||
if (columns[i].textContent === "Enabled")
|
||||
return i;
|
||||
}
|
||||
};
|
||||
|
||||
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");
|
||||
}
|
||||
|
@ -51,8 +51,8 @@ window.qBittorrent.Download = (function() {
|
||||
|
||||
const category = data[i];
|
||||
const option = new Element("option");
|
||||
option.set("value", category.name);
|
||||
option.set("html", category.name);
|
||||
option.value = category.name;
|
||||
option.textContent = category.name;
|
||||
$("categorySelect").appendChild(option);
|
||||
}
|
||||
}
|
||||
@ -64,7 +64,7 @@ window.qBittorrent.Download = (function() {
|
||||
const pref = window.parent.qBittorrent.Cache.preferences.get();
|
||||
|
||||
defaultSavePath = pref.save_path;
|
||||
$("savepath").setProperty("value", defaultSavePath);
|
||||
$("savepath").value = defaultSavePath;
|
||||
$("startTorrent").checked = !pref.add_stopped_enabled;
|
||||
$("addToTopOfQueue").checked = pref.add_to_top_of_queue;
|
||||
|
||||
|
@ -412,8 +412,8 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
};
|
||||
column["updateTd"] = function(td, row) {
|
||||
const value = this.getRowValue(row);
|
||||
td.set("text", value);
|
||||
td.set("title", value);
|
||||
td.textContent = value;
|
||||
td.title = value;
|
||||
};
|
||||
column["onResize"] = null;
|
||||
this.columns.push(column);
|
||||
@ -463,8 +463,8 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
for (let i = 0; i < ths.length; ++i) {
|
||||
const th = ths[i];
|
||||
th._this = this;
|
||||
th.setAttribute("title", this.columns[i].caption);
|
||||
th.set("text", this.columns[i].caption);
|
||||
th.title = this.columns[i].caption;
|
||||
th.textContent = this.columns[i].caption;
|
||||
th.setAttribute("style", "width: " + this.columns[i].width + "px;" + this.columns[i].style);
|
||||
th.columnName = this.columns[i].name;
|
||||
th.addClass("column_" + th.columnName);
|
||||
@ -740,10 +740,10 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
const tr = new Element("tr");
|
||||
// set tabindex so element receives keydown events
|
||||
// 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"];
|
||||
tr.setProperty("data-row-id", rowId);
|
||||
tr.setAttribute("data-row-id", rowId);
|
||||
tr["rowId"] = rowId;
|
||||
|
||||
tr._this = this;
|
||||
@ -872,7 +872,7 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
let selectedIndex = -1;
|
||||
for (let i = 0; i < visibleRows.length; ++i) {
|
||||
const row = visibleRows[i];
|
||||
if (row.getProperty("data-row-id") === selectedRowId) {
|
||||
if (row.getAttribute("data-row-id") === selectedRowId) {
|
||||
selectedIndex = i;
|
||||
break;
|
||||
}
|
||||
@ -883,7 +883,7 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
this.deselectAll();
|
||||
|
||||
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;
|
||||
for (let i = 0; i < visibleRows.length; ++i) {
|
||||
const row = visibleRows[i];
|
||||
if (row.getProperty("data-row-id") === selectedRowId) {
|
||||
if (row.getAttribute("data-row-id") === selectedRowId) {
|
||||
selectedIndex = i;
|
||||
break;
|
||||
}
|
||||
@ -905,7 +905,7 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
this.deselectAll();
|
||||
|
||||
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) {
|
||||
const img = td.getChildren("img")[0];
|
||||
if (!img.src.includes(img_path)) {
|
||||
img.set("src", img_path);
|
||||
img.set("title", state);
|
||||
img.src = img_path;
|
||||
img.title = state;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -1101,16 +1101,16 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
status = "QBT_TR(Unknown)QBT_TR[CONTEXT=HttpServer]";
|
||||
}
|
||||
|
||||
td.set("text", status);
|
||||
td.set("title", status);
|
||||
td.textContent = status;
|
||||
td.title = status;
|
||||
};
|
||||
|
||||
// priority
|
||||
this.columns["priority"].updateTd = function(td, row) {
|
||||
const queuePos = this.getRowValue(row);
|
||||
const formattedQueuePos = (queuePos < 1) ? "*" : queuePos;
|
||||
td.set("text", formattedQueuePos);
|
||||
td.set("title", formattedQueuePos);
|
||||
td.textContent = formattedQueuePos;
|
||||
td.title = formattedQueuePos;
|
||||
};
|
||||
|
||||
this.columns["priority"].compareRows = function(row1, row2) {
|
||||
@ -1135,8 +1135,8 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
// size, total_size
|
||||
this.columns["size"].updateTd = function(td, row) {
|
||||
const size = window.qBittorrent.Misc.friendlyUnit(this.getRowValue(row), false);
|
||||
td.set("text", size);
|
||||
td.set("title", size);
|
||||
td.textContent = size;
|
||||
td.title = size;
|
||||
};
|
||||
this.columns["total_size"].updateTd = this.columns["size"].updateTd;
|
||||
|
||||
@ -1186,8 +1186,8 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
let value = num_seeds;
|
||||
if (num_complete !== -1)
|
||||
value += " (" + num_complete + ")";
|
||||
td.set("text", value);
|
||||
td.set("title", value);
|
||||
td.textContent = value;
|
||||
td.title = value;
|
||||
};
|
||||
this.columns["num_seeds"].compareRows = function(row1, row2) {
|
||||
const num_seeds1 = this.getRowValue(row1, 0);
|
||||
@ -1209,8 +1209,8 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
// dlspeed
|
||||
this.columns["dlspeed"].updateTd = function(td, row) {
|
||||
const speed = window.qBittorrent.Misc.friendlyUnit(this.getRowValue(row), true);
|
||||
td.set("text", speed);
|
||||
td.set("title", speed);
|
||||
td.textContent = speed;
|
||||
td.title = speed;
|
||||
};
|
||||
|
||||
// upspeed
|
||||
@ -1219,44 +1219,44 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
// eta
|
||||
this.columns["eta"].updateTd = function(td, row) {
|
||||
const eta = window.qBittorrent.Misc.friendlyDuration(this.getRowValue(row), window.qBittorrent.Misc.MAX_ETA);
|
||||
td.set("text", eta);
|
||||
td.set("title", eta);
|
||||
td.textContent = eta;
|
||||
td.title = eta;
|
||||
};
|
||||
|
||||
// ratio
|
||||
this.columns["ratio"].updateTd = function(td, row) {
|
||||
const ratio = this.getRowValue(row);
|
||||
const string = (ratio === -1) ? "∞" : window.qBittorrent.Misc.toFixedPointString(ratio, 2);
|
||||
td.set("text", string);
|
||||
td.set("title", string);
|
||||
td.textContent = string;
|
||||
td.title = string;
|
||||
};
|
||||
|
||||
// popularity
|
||||
this.columns["popularity"].updateTd = function(td, row) {
|
||||
const value = this.getRowValue(row);
|
||||
const popularity = (value === -1) ? "∞" : window.qBittorrent.Misc.toFixedPointString(value, 2);
|
||||
td.set("text", popularity);
|
||||
td.set("title", popularity);
|
||||
td.textContent = popularity;
|
||||
td.title = popularity;
|
||||
};
|
||||
|
||||
// added on
|
||||
this.columns["added_on"].updateTd = function(td, row) {
|
||||
const date = new Date(this.getRowValue(row) * 1000).toLocaleString();
|
||||
td.set("text", date);
|
||||
td.set("title", date);
|
||||
td.textContent = date;
|
||||
td.title = date;
|
||||
};
|
||||
|
||||
// completion_on
|
||||
this.columns["completion_on"].updateTd = function(td, row) {
|
||||
const val = this.getRowValue(row);
|
||||
if ((val === 0xffffffff) || (val < 0)) {
|
||||
td.set("text", "");
|
||||
td.set("title", "");
|
||||
td.textContent = "";
|
||||
td.title = "";
|
||||
}
|
||||
else {
|
||||
const date = new Date(this.getRowValue(row) * 1000).toLocaleString();
|
||||
td.set("text", date);
|
||||
td.set("title", date);
|
||||
td.textContent = date;
|
||||
td.title = date;
|
||||
}
|
||||
};
|
||||
|
||||
@ -1264,13 +1264,13 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
this.columns["dl_limit"].updateTd = function(td, row) {
|
||||
const speed = this.getRowValue(row);
|
||||
if (speed === 0) {
|
||||
td.set("text", "∞");
|
||||
td.set("title", "∞");
|
||||
td.textContent = "∞";
|
||||
td.title = "∞";
|
||||
}
|
||||
else {
|
||||
const formattedSpeed = window.qBittorrent.Misc.friendlyUnit(speed, true);
|
||||
td.set("text", formattedSpeed);
|
||||
td.set("title", formattedSpeed);
|
||||
td.textContent = formattedSpeed;
|
||||
td.title = formattedSpeed;
|
||||
}
|
||||
};
|
||||
|
||||
@ -1292,8 +1292,8 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
.replace("%1", window.qBittorrent.Misc.friendlyDuration(activeTime))
|
||||
.replace("%2", window.qBittorrent.Misc.friendlyDuration(seedingTime)))
|
||||
: window.qBittorrent.Misc.friendlyDuration(activeTime);
|
||||
td.set("text", time);
|
||||
td.set("title", time);
|
||||
td.textContent = time;
|
||||
td.title = time;
|
||||
};
|
||||
|
||||
// completed
|
||||
@ -1309,28 +1309,28 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
this.columns["last_activity"].updateTd = function(td, row) {
|
||||
const val = this.getRowValue(row);
|
||||
if (val < 1) {
|
||||
td.set("text", "∞");
|
||||
td.set("title", "∞");
|
||||
td.textContent = "∞";
|
||||
td.title = "∞";
|
||||
}
|
||||
else {
|
||||
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.set("title", formattedVal);
|
||||
td.textContent = formattedVal;
|
||||
td.title = formattedVal;
|
||||
}
|
||||
};
|
||||
|
||||
// availability
|
||||
this.columns["availability"].updateTd = function(td, row) {
|
||||
const value = window.qBittorrent.Misc.toFixedPointString(this.getRowValue(row), 3);
|
||||
td.set("text", value);
|
||||
td.set("title", value);
|
||||
td.textContent = value;
|
||||
td.title = value;
|
||||
};
|
||||
|
||||
// reannounce
|
||||
this.columns["reannounce"].updateTd = function(td, row) {
|
||||
const time = window.qBittorrent.Misc.friendlyDuration(this.getRowValue(row));
|
||||
td.set("text", time);
|
||||
td.set("title", time);
|
||||
td.textContent = time;
|
||||
td.title = time;
|
||||
};
|
||||
|
||||
// private
|
||||
@ -1342,8 +1342,8 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
? "QBT_TR(Yes)QBT_TR[CONTEXT=PropertiesWidget]"
|
||||
: "QBT_TR(No)QBT_TR[CONTEXT=PropertiesWidget]")
|
||||
: "QBT_TR(N/A)QBT_TR[CONTEXT=PropertiesWidget]";
|
||||
td.set("text", string);
|
||||
td.set("title", string);
|
||||
td.textContent = string;
|
||||
td.title = string;
|
||||
};
|
||||
},
|
||||
|
||||
@ -1623,10 +1623,10 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
|
||||
if (td.getChildren("img").length > 0) {
|
||||
const img = td.getChildren("img")[0];
|
||||
img.set("src", img_path);
|
||||
img.set("class", "flags");
|
||||
img.set("alt", country);
|
||||
img.set("title", country);
|
||||
img.src = img_path;
|
||||
img.className = "flags";
|
||||
img.alt = country;
|
||||
img.title = country;
|
||||
}
|
||||
else {
|
||||
td.adopt(new Element("img", {
|
||||
@ -1656,8 +1656,8 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
|
||||
// flags
|
||||
this.columns["flags"].updateTd = function(td, row) {
|
||||
td.set("text", this.getRowValue(row, 0));
|
||||
td.set("title", this.getRowValue(row, 1));
|
||||
td.textContent = this.getRowValue(row, 0);
|
||||
td.title = this.getRowValue(row, 1);
|
||||
};
|
||||
|
||||
// progress
|
||||
@ -1667,21 +1667,21 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
if ((progressFormatted === 100.0) && (progress !== 1.0))
|
||||
progressFormatted = 99.9;
|
||||
progressFormatted += "%";
|
||||
td.set("text", progressFormatted);
|
||||
td.set("title", progressFormatted);
|
||||
td.textContent = progressFormatted;
|
||||
td.title = progressFormatted;
|
||||
};
|
||||
|
||||
// dl_speed, up_speed
|
||||
this.columns["dl_speed"].updateTd = function(td, row) {
|
||||
const speed = this.getRowValue(row);
|
||||
if (speed === 0) {
|
||||
td.set("text", "");
|
||||
td.set("title", "");
|
||||
td.textContent = "";
|
||||
td.title = "";
|
||||
}
|
||||
else {
|
||||
const formattedSpeed = window.qBittorrent.Misc.friendlyUnit(speed, true);
|
||||
td.set("text", formattedSpeed);
|
||||
td.set("title", formattedSpeed);
|
||||
td.textContent = formattedSpeed;
|
||||
td.title = formattedSpeed;
|
||||
}
|
||||
};
|
||||
this.columns["up_speed"].updateTd = this.columns["dl_speed"].updateTd;
|
||||
@ -1689,8 +1689,8 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
// downloaded, uploaded
|
||||
this.columns["downloaded"].updateTd = function(td, row) {
|
||||
const downloaded = window.qBittorrent.Misc.friendlyUnit(this.getRowValue(row), false);
|
||||
td.set("text", downloaded);
|
||||
td.set("title", downloaded);
|
||||
td.textContent = downloaded;
|
||||
td.title = downloaded;
|
||||
};
|
||||
this.columns["uploaded"].updateTd = this.columns["downloaded"].updateTd;
|
||||
|
||||
@ -1700,8 +1700,8 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
// files
|
||||
this.columns["files"].updateTd = function(td, row) {
|
||||
const value = this.getRowValue(row, 0);
|
||||
td.set("text", value.replace(/\n/g, ";"));
|
||||
td.set("title", value);
|
||||
td.textContent = value.replace(/\n/g, ";");
|
||||
td.title = value;
|
||||
};
|
||||
|
||||
}
|
||||
@ -1724,20 +1724,20 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
initColumnsFunctions: function() {
|
||||
const displaySize = function(td, row) {
|
||||
const size = window.qBittorrent.Misc.friendlyUnit(this.getRowValue(row), false);
|
||||
td.set("text", size);
|
||||
td.set("title", size);
|
||||
td.textContent = size;
|
||||
td.title = size;
|
||||
};
|
||||
const displayNum = function(td, row) {
|
||||
const value = this.getRowValue(row);
|
||||
const formattedValue = (value === "-1") ? "Unknown" : value;
|
||||
td.set("text", formattedValue);
|
||||
td.set("title", formattedValue);
|
||||
td.textContent = formattedValue;
|
||||
td.title = formattedValue;
|
||||
};
|
||||
const displayDate = function(td, row) {
|
||||
const value = this.getRowValue(row) * 1000;
|
||||
const formattedValue = (isNaN(value) || (value <= 0)) ? "" : (new Date(value).toLocaleString());
|
||||
td.set("text", formattedValue);
|
||||
td.set("title", formattedValue);
|
||||
td.textContent = formattedValue;
|
||||
td.title = formattedValue;
|
||||
};
|
||||
|
||||
this.columns["fileSize"].updateTd = displaySize;
|
||||
@ -1785,7 +1785,7 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
const filterTerms = window.qBittorrent.Search.searchText.filterPattern.toLowerCase().split(" ");
|
||||
const sizeFilters = getSizeFilters();
|
||||
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)) {
|
||||
for (let i = 0; i < rows.length; ++i) {
|
||||
@ -1844,14 +1844,14 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
this.columns["enabled"].updateTd = function(td, row) {
|
||||
const value = this.getRowValue(row);
|
||||
if (value) {
|
||||
td.set("text", "QBT_TR(Yes)QBT_TR[CONTEXT=SearchPluginsTable]");
|
||||
td.set("title", "QBT_TR(Yes)QBT_TR[CONTEXT=SearchPluginsTable]");
|
||||
td.textContent = "QBT_TR(Yes)QBT_TR[CONTEXT=SearchPluginsTable]";
|
||||
td.title = "QBT_TR(Yes)QBT_TR[CONTEXT=SearchPluginsTable]";
|
||||
td.getParent("tr").addClass("green");
|
||||
td.getParent("tr").removeClass("red");
|
||||
}
|
||||
else {
|
||||
td.set("text", "QBT_TR(No)QBT_TR[CONTEXT=SearchPluginsTable]");
|
||||
td.set("title", "QBT_TR(No)QBT_TR[CONTEXT=SearchPluginsTable]");
|
||||
td.textContent = "QBT_TR(No)QBT_TR[CONTEXT=SearchPluginsTable]";
|
||||
td.title = "QBT_TR(No)QBT_TR[CONTEXT=SearchPluginsTable]";
|
||||
td.getParent("tr").addClass("red");
|
||||
td.getParent("tr").removeClass("green");
|
||||
}
|
||||
@ -2047,10 +2047,10 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
}
|
||||
});
|
||||
const checkbox = new Element("input");
|
||||
checkbox.set("type", "checkbox");
|
||||
checkbox.set("id", "cbRename" + id);
|
||||
checkbox.set("data-id", id);
|
||||
checkbox.set("class", "RenamingCB");
|
||||
checkbox.type = "checkbox";
|
||||
checkbox.id = "cbRename" + id;
|
||||
checkbox.setAttribute("data-id", id);
|
||||
checkbox.className = "RenamingCB";
|
||||
checkbox.addEvent("click", (e) => {
|
||||
const node = that.getNode(id);
|
||||
node.checked = e.target.checked ? 0 : 1;
|
||||
@ -2076,7 +2076,7 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
const dirImgId = "renameTableDirImg" + id;
|
||||
if ($(dirImgId)) {
|
||||
// just update file name
|
||||
$(fileNameId).set("text", value);
|
||||
$(fileNameId).textContent = value;
|
||||
}
|
||||
else {
|
||||
const span = new Element("span", {
|
||||
@ -2094,7 +2094,7 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
id: dirImgId
|
||||
});
|
||||
const html = dirImg.outerHTML + span.outerHTML;
|
||||
td.set("html", html);
|
||||
td.innerHTML = html;
|
||||
}
|
||||
}
|
||||
else { // is file
|
||||
@ -2106,7 +2106,7 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
"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,
|
||||
id: fileNameRenamedId,
|
||||
});
|
||||
td.set("html", span.outerHTML);
|
||||
td.innerHTML = span.outerHTML;
|
||||
};
|
||||
},
|
||||
|
||||
@ -2379,13 +2379,13 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
const that = this;
|
||||
const displaySize = function(td, row) {
|
||||
const size = window.qBittorrent.Misc.friendlyUnit(this.getRowValue(row), false);
|
||||
td.set("text", size);
|
||||
td.set("title", size);
|
||||
td.textContent = size;
|
||||
td.title = size;
|
||||
};
|
||||
const displayPercentage = function(td, row) {
|
||||
const value = window.qBittorrent.Misc.friendlyPercentage(this.getRowValue(row));
|
||||
td.set("text", value);
|
||||
td.set("title", value);
|
||||
td.textContent = value;
|
||||
td.title = value;
|
||||
};
|
||||
|
||||
// checked
|
||||
@ -2419,7 +2419,7 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
const dirImgId = "filesTableDirImg" + id;
|
||||
if ($(dirImgId)) {
|
||||
// just update file name
|
||||
$(fileNameId).set("text", value);
|
||||
$(fileNameId).textContent = value;
|
||||
}
|
||||
else {
|
||||
const collapseIcon = new Element("img", {
|
||||
@ -2446,7 +2446,7 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
id: dirImgId
|
||||
});
|
||||
const html = collapseIcon.outerHTML + dirImg.outerHTML + span.outerHTML;
|
||||
td.set("html", html);
|
||||
td.innerHTML = html;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -2458,7 +2458,7 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
"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 unreadCount = this.getRowValue(row, 1);
|
||||
const value = name + " (" + unreadCount + ")";
|
||||
td.set("text", value);
|
||||
td.set("title", value);
|
||||
td.textContent = value;
|
||||
td.title = value;
|
||||
};
|
||||
},
|
||||
setupHeaderMenu: function() {},
|
||||
@ -2742,8 +2742,8 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
if (td.getChildren("img").length > 0) {
|
||||
const img = td.getChildren("img")[0];
|
||||
if (!img.src.includes(img_path)) {
|
||||
img.set("src", img_path);
|
||||
img.set("title", status);
|
||||
img.src = img_path;
|
||||
img.title = status;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -2782,8 +2782,8 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
};
|
||||
column["updateTd"] = function(td, row) {
|
||||
const value = this.getRowValue(row);
|
||||
td.set("text", value);
|
||||
td.set("title", value);
|
||||
td.textContent = value;
|
||||
td.title = value;
|
||||
};
|
||||
column["onResize"] = null;
|
||||
this.columns.push(column);
|
||||
@ -2877,8 +2877,8 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
};
|
||||
column["updateTd"] = function(td, row) {
|
||||
const value = this.getRowValue(row);
|
||||
td.set("text", value);
|
||||
td.set("title", value);
|
||||
td.textContent = value;
|
||||
td.title = value;
|
||||
};
|
||||
column["onResize"] = null;
|
||||
this.columns.push(column);
|
||||
@ -2905,8 +2905,8 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
this.columns["checked"].updateTd = function(td, row) {
|
||||
if ($("cbRssDlRule" + row.rowId) === null) {
|
||||
const checkbox = new Element("input");
|
||||
checkbox.set("type", "checkbox");
|
||||
checkbox.set("id", "cbRssDlRule" + row.rowId);
|
||||
checkbox.type = "checkbox";
|
||||
checkbox.id = "cbRssDlRule" + row.rowId;
|
||||
checkbox.checked = row.full_data.checked;
|
||||
|
||||
checkbox.addEvent("click", function(e) {
|
||||
@ -2962,8 +2962,8 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
};
|
||||
column["updateTd"] = function(td, row) {
|
||||
const value = this.getRowValue(row);
|
||||
td.set("text", value);
|
||||
td.set("title", value);
|
||||
td.textContent = value;
|
||||
td.title = value;
|
||||
};
|
||||
column["onResize"] = null;
|
||||
this.columns.push(column);
|
||||
@ -2998,8 +2998,8 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
this.columns["checked"].updateTd = function(td, row) {
|
||||
if ($("cbRssDlFeed" + row.rowId) === null) {
|
||||
const checkbox = new Element("input");
|
||||
checkbox.set("type", "checkbox");
|
||||
checkbox.set("id", "cbRssDlFeed" + row.rowId);
|
||||
checkbox.type = "checkbox";
|
||||
checkbox.id = "cbRssDlFeed" + row.rowId;
|
||||
checkbox.checked = row.full_data.checked;
|
||||
|
||||
checkbox.addEvent("click", function(e) {
|
||||
@ -3048,8 +3048,8 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
};
|
||||
column["updateTd"] = function(td, row) {
|
||||
const value = this.getRowValue(row);
|
||||
td.set("text", value);
|
||||
td.set("title", value);
|
||||
td.textContent = value;
|
||||
td.title = value;
|
||||
};
|
||||
column["onResize"] = null;
|
||||
this.columns.push(column);
|
||||
@ -3097,8 +3097,8 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
};
|
||||
column["updateTd"] = function(td, row) {
|
||||
const value = this.getRowValue(row);
|
||||
td.set("text", value);
|
||||
td.set("title", value);
|
||||
td.textContent = value;
|
||||
td.title = value;
|
||||
};
|
||||
column["onResize"] = null;
|
||||
this.columns.push(column);
|
||||
@ -3179,7 +3179,7 @@ window.qBittorrent.DynamicTable = (function() {
|
||||
break;
|
||||
}
|
||||
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";
|
||||
}
|
||||
td.set({ "text": status, "title": status });
|
||||
td.getParent("tr").set("class", "logTableRow " + addClass);
|
||||
td.getParent("tr").className = `logTableRow${addClass}`;
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -1052,8 +1052,8 @@ const initializeWindows = function() {
|
||||
|
||||
// download response to file
|
||||
const element = document.createElement("a");
|
||||
element.setAttribute("href", url);
|
||||
element.setAttribute("download", (name + ".torrent"));
|
||||
element.href = url;
|
||||
element.download = (name + ".torrent");
|
||||
document.body.appendChild(element);
|
||||
element.click();
|
||||
document.body.removeChild(element);
|
||||
|
@ -106,8 +106,8 @@ window.qBittorrent.PropFiles = (function() {
|
||||
|
||||
const checkbox = e.target;
|
||||
const priority = checkbox.checked ? FilePriority.Normal : FilePriority.Ignored;
|
||||
const id = checkbox.get("data-id");
|
||||
const fileId = checkbox.get("data-file-id");
|
||||
const id = checkbox.getAttribute("data-id");
|
||||
const fileId = checkbox.getAttribute("data-file-id");
|
||||
|
||||
const rows = getAllChildren(id, fileId);
|
||||
|
||||
@ -118,8 +118,8 @@ window.qBittorrent.PropFiles = (function() {
|
||||
const fileComboboxChanged = function(e) {
|
||||
const combobox = e.target;
|
||||
const priority = combobox.value;
|
||||
const id = combobox.get("data-id");
|
||||
const fileId = combobox.get("data-file-id");
|
||||
const id = combobox.getAttribute("data-id");
|
||||
const fileId = combobox.getAttribute("data-file-id");
|
||||
|
||||
const rows = getAllChildren(id, fileId);
|
||||
|
||||
@ -133,11 +133,11 @@ window.qBittorrent.PropFiles = (function() {
|
||||
|
||||
const createDownloadCheckbox = function(id, fileId, checked) {
|
||||
const checkbox = new Element("input");
|
||||
checkbox.set("type", "checkbox");
|
||||
checkbox.set("id", "cbPrio" + id);
|
||||
checkbox.set("data-id", id);
|
||||
checkbox.set("data-file-id", fileId);
|
||||
checkbox.set("class", "DownloadedCB");
|
||||
checkbox.type = "checkbox";
|
||||
checkbox.id = "cbPrio" + id;
|
||||
checkbox.setAttribute("data-id", id);
|
||||
checkbox.setAttribute("data-file-id", fileId);
|
||||
checkbox.className = "DownloadedCB";
|
||||
checkbox.addEvent("click", fileCheckboxClicked);
|
||||
|
||||
updateCheckbox(checkbox, checked);
|
||||
@ -169,8 +169,8 @@ window.qBittorrent.PropFiles = (function() {
|
||||
|
||||
const createPriorityOptionElement = function(priority, selected, html) {
|
||||
const elem = new Element("option");
|
||||
elem.set("value", priority.toString());
|
||||
elem.set("html", html);
|
||||
elem.value = priority.toString();
|
||||
elem.innerHTML = html;
|
||||
if (selected)
|
||||
elem.selected = true;
|
||||
return elem;
|
||||
@ -178,9 +178,9 @@ window.qBittorrent.PropFiles = (function() {
|
||||
|
||||
const createPriorityCombo = function(id, fileId, selectedPriority) {
|
||||
const select = new Element("select");
|
||||
select.set("id", "comboPrio" + id);
|
||||
select.set("data-id", id);
|
||||
select.set("data-file-id", fileId);
|
||||
select.id = "comboPrio" + id;
|
||||
select.setAttribute("data-id", id);
|
||||
select.setAttribute("data-file-id", fileId);
|
||||
select.addClass("combo_priority");
|
||||
select.addEvent("change", fileComboboxChanged);
|
||||
|
||||
@ -191,7 +191,7 @@ window.qBittorrent.PropFiles = (function() {
|
||||
|
||||
// "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]");
|
||||
mixedPriorityOption.set("disabled", true);
|
||||
mixedPriorityOption.disabled = true;
|
||||
mixedPriorityOption.injectInside(select);
|
||||
|
||||
return select;
|
||||
@ -483,9 +483,9 @@ window.qBittorrent.PropFiles = (function() {
|
||||
};
|
||||
|
||||
const collapseIconClicked = function(event) {
|
||||
const id = event.get("data-id");
|
||||
const id = event.getAttribute("data-id");
|
||||
const node = torrentFilesTable.getNode(id);
|
||||
const isCollapsed = (event.parentElement.get("data-collapsed") === "true");
|
||||
const isCollapsed = (event.parentElement.getAttribute("data-collapsed") === "true");
|
||||
|
||||
if (isCollapsed)
|
||||
expandNode(node);
|
||||
@ -515,7 +515,7 @@ window.qBittorrent.PropFiles = (function() {
|
||||
selectedRows.forEach((rowId) => {
|
||||
const elem = $("comboPrio" + rowId);
|
||||
rowIds.push(rowId);
|
||||
fileIds.push(elem.get("data-file-id"));
|
||||
fileIds.push(elem.getAttribute("data-file-id"));
|
||||
});
|
||||
|
||||
const uniqueRowIds = {};
|
||||
@ -623,8 +623,8 @@ window.qBittorrent.PropFiles = (function() {
|
||||
const tableHeaders = $$("#torrentFilesTableFixedHeaderDiv .dynamicTableHeader th");
|
||||
if (tableHeaders.length > 0) {
|
||||
const checkbox = new Element("input");
|
||||
checkbox.set("type", "checkbox");
|
||||
checkbox.set("id", "tristate_cb");
|
||||
checkbox.type = "checkbox";
|
||||
checkbox.id = "tristate_cb";
|
||||
checkbox.addEvent("click", switchCheckboxState);
|
||||
|
||||
const checkboxTH = tableHeaders[0];
|
||||
@ -640,7 +640,7 @@ window.qBittorrent.PropFiles = (function() {
|
||||
$("torrentFilesFilterInput").addEvent("input", () => {
|
||||
clearTimeout(torrentFilesFilterInputTimer);
|
||||
|
||||
const value = $("torrentFilesFilterInput").get("value");
|
||||
const value = $("torrentFilesFilterInput").value;
|
||||
torrentFilesTable.setFilter(value);
|
||||
|
||||
torrentFilesFilterInputTimer = setTimeout(() => {
|
||||
@ -684,7 +684,7 @@ window.qBittorrent.PropFiles = (function() {
|
||||
const td = span.parentElement;
|
||||
|
||||
// store collapsed state
|
||||
td.set("data-collapsed", isCollapsed);
|
||||
td.setAttribute("data-collapsed", isCollapsed);
|
||||
|
||||
// rotate the collapse icon
|
||||
const collapseIcon = td.getElementsByClassName("filesTableCollapseIcon")[0];
|
||||
@ -700,7 +700,7 @@ window.qBittorrent.PropFiles = (function() {
|
||||
return true;
|
||||
|
||||
const td = span.parentElement;
|
||||
return (td.get("data-collapsed") === "true");
|
||||
return td.getAttribute("data-collapsed") === "true";
|
||||
};
|
||||
|
||||
const expandNode = function(node) {
|
||||
|
@ -44,33 +44,33 @@ window.qBittorrent.PropGeneral = (function() {
|
||||
$("progress").appendChild(piecesBar);
|
||||
|
||||
const clearData = function() {
|
||||
$("time_elapsed").set("html", "");
|
||||
$("eta").set("html", "");
|
||||
$("nb_connections").set("html", "");
|
||||
$("total_downloaded").set("html", "");
|
||||
$("total_uploaded").set("html", "");
|
||||
$("dl_speed").set("html", "");
|
||||
$("up_speed").set("html", "");
|
||||
$("dl_limit").set("html", "");
|
||||
$("up_limit").set("html", "");
|
||||
$("total_wasted").set("html", "");
|
||||
$("seeds").set("html", "");
|
||||
$("peers").set("html", "");
|
||||
$("share_ratio").set("html", "");
|
||||
$("popularity").set("html", "");
|
||||
$("reannounce").set("html", "");
|
||||
$("last_seen").set("html", "");
|
||||
$("total_size").set("html", "");
|
||||
$("pieces").set("html", "");
|
||||
$("created_by").set("html", "");
|
||||
$("addition_date").set("html", "");
|
||||
$("completion_date").set("html", "");
|
||||
$("creation_date").set("html", "");
|
||||
$("torrent_hash_v1").set("html", "");
|
||||
$("torrent_hash_v2").set("html", "");
|
||||
$("save_path").set("html", "");
|
||||
$("comment").set("html", "");
|
||||
$("private").set("html", "");
|
||||
$("time_elapsed").textContent = "";
|
||||
$("eta").textContent = "";
|
||||
$("nb_connections").textContent = "";
|
||||
$("total_downloaded").textContent = "";
|
||||
$("total_uploaded").textContent = "";
|
||||
$("dl_speed").textContent = "";
|
||||
$("up_speed").textContent = "";
|
||||
$("dl_limit").textContent = "";
|
||||
$("up_limit").textContent = "";
|
||||
$("total_wasted").textContent = "";
|
||||
$("seeds").textContent = "";
|
||||
$("peers").textContent = "";
|
||||
$("share_ratio").textContent = "";
|
||||
$("popularity").textContent = "";
|
||||
$("reannounce").textContent = "";
|
||||
$("last_seen").textContent = "";
|
||||
$("total_size").textContent = "";
|
||||
$("pieces").textContent = "";
|
||||
$("created_by").textContent = "";
|
||||
$("addition_date").textContent = "";
|
||||
$("completion_date").textContent = "";
|
||||
$("creation_date").textContent = "";
|
||||
$("torrent_hash_v1").textContent = "";
|
||||
$("torrent_hash_v2").textContent = "";
|
||||
$("save_path").textContent = "";
|
||||
$("comment").innerHTML = "";
|
||||
$("private").textContent = "";
|
||||
piecesBar.clear();
|
||||
};
|
||||
|
||||
@ -94,12 +94,12 @@ window.qBittorrent.PropGeneral = (function() {
|
||||
method: "get",
|
||||
noCache: true,
|
||||
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);
|
||||
loadTorrentDataTimer = loadTorrentData.delay(10000);
|
||||
},
|
||||
onSuccess: function(data) {
|
||||
$("error_div").set("html", "");
|
||||
$("error_div").textContent = "";
|
||||
if (data) {
|
||||
// Update Torrent data
|
||||
|
||||
@ -108,70 +108,70 @@ window.qBittorrent.PropGeneral = (function() {
|
||||
.replace("%1", window.qBittorrent.Misc.friendlyDuration(data.time_elapsed))
|
||||
.replace("%2", window.qBittorrent.Misc.friendlyDuration(data.seeding_time))
|
||||
: 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]"
|
||||
.replace("%1", data.nb_connections)
|
||||
.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]"
|
||||
.replace("%1", window.qBittorrent.Misc.friendlyUnit(data.total_downloaded))
|
||||
.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]"
|
||||
.replace("%1", window.qBittorrent.Misc.friendlyUnit(data.total_uploaded))
|
||||
.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]"
|
||||
.replace("%1", window.qBittorrent.Misc.friendlyUnit(data.dl_speed, 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]"
|
||||
.replace("%1", window.qBittorrent.Misc.friendlyUnit(data.up_speed, 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)
|
||||
? "∞"
|
||||
: window.qBittorrent.Misc.friendlyUnit(data.dl_limit, true);
|
||||
$("dl_limit").set("html", dlLimit);
|
||||
$("dl_limit").textContent = dlLimit;
|
||||
|
||||
const upLimit = (data.up_limit === -1)
|
||||
? "∞"
|
||||
: 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]"
|
||||
.replace("%1", data.seeds)
|
||||
.replace("%2", data.seeds_total);
|
||||
$("seeds").set("html", seeds);
|
||||
$("seeds").textContent = seeds;
|
||||
|
||||
const peers = "QBT_TR(%1 (%2 total))QBT_TR[CONTEXT=PropertiesWidget]"
|
||||
.replace("%1", data.peers)
|
||||
.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)
|
||||
? new Date(data.last_seen * 1000).toLocaleString()
|
||||
: "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) : "";
|
||||
$("total_size").set("html", totalSize);
|
||||
$("total_size").textContent = totalSize;
|
||||
|
||||
const pieces = (data.pieces_num >= 0)
|
||||
? "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("%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)
|
||||
? new Date(data.addition_date * 1000).toLocaleString()
|
||||
: "QBT_TR(Unknown)QBT_TR[CONTEXT=HttpServer]";
|
||||
$("addition_date").set("html", additionDate);
|
||||
$("addition_date").textContent = additionDate;
|
||||
|
||||
const completionDate = (data.completion_date >= 0)
|
||||
? new Date(data.completion_date * 1000).toLocaleString()
|
||||
: "";
|
||||
$("completion_date").set("html", completionDate);
|
||||
$("completion_date").textContent = completionDate;
|
||||
|
||||
const creationDate = (data.creation_date >= 0)
|
||||
? new Date(data.creation_date * 1000).toLocaleString()
|
||||
: "";
|
||||
$("creation_date").set("html", creationDate);
|
||||
$("creation_date").textContent = creationDate;
|
||||
|
||||
const torrentHashV1 = (data.infohash_v1 !== "")
|
||||
? data.infohash_v1
|
||||
: "QBT_TR(N/A)QBT_TR[CONTEXT=PropertiesWidget]";
|
||||
$("torrent_hash_v1").set("html", torrentHashV1);
|
||||
$("torrent_hash_v1").textContent = torrentHashV1;
|
||||
|
||||
const torrentHashV2 = (data.infohash_v2 !== "")
|
||||
? data.infohash_v2
|
||||
: "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").set("text", (data.private
|
||||
$("private").textContent = (data.has_metadata
|
||||
? (data.private
|
||||
? "QBT_TR(Yes)QBT_TR[CONTEXT=PropertiesWidget]"
|
||||
: "QBT_TR(No)QBT_TR[CONTEXT=PropertiesWidget]"));
|
||||
}
|
||||
else {
|
||||
$("private").set("text", "QBT_TR(N/A)QBT_TR[CONTEXT=PropertiesWidget]");
|
||||
}
|
||||
: "QBT_TR(No)QBT_TR[CONTEXT=PropertiesWidget]")
|
||||
: "QBT_TR(N/A)QBT_TR[CONTEXT=PropertiesWidget]");
|
||||
}
|
||||
else {
|
||||
clearData();
|
||||
@ -235,12 +232,12 @@ window.qBittorrent.PropGeneral = (function() {
|
||||
method: "get",
|
||||
noCache: true,
|
||||
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);
|
||||
loadTorrentDataTimer = loadTorrentData.delay(10000);
|
||||
},
|
||||
onSuccess: function(data) {
|
||||
$("error_div").set("html", "");
|
||||
$("error_div").textContent = "";
|
||||
|
||||
if (data)
|
||||
piecesBar.setPieces(data);
|
||||
|
@ -70,7 +70,7 @@ window.qBittorrent.PropPeers = (function() {
|
||||
loadTorrentPeersTimer = loadTorrentPeersData.delay(window.qBittorrent.Client.getSyncMainDataInterval());
|
||||
},
|
||||
onSuccess: function(response) {
|
||||
$("error_div").set("html", "");
|
||||
$("error_div").textContent = "";
|
||||
if (response) {
|
||||
const full_update = (response["full_update"] === true);
|
||||
if (full_update)
|
||||
|
@ -65,7 +65,7 @@ window.qBittorrent.PropWebseeds = (function() {
|
||||
updateRow: function(tr, row) {
|
||||
const tds = tr.getElements("td");
|
||||
for (let i = 0; i < row.length; ++i)
|
||||
tds[i].set("html", row[i]);
|
||||
tds[i].innerHTML = row[i];
|
||||
return true;
|
||||
},
|
||||
|
||||
@ -81,7 +81,7 @@ window.qBittorrent.PropWebseeds = (function() {
|
||||
this.rows.set(url, tr);
|
||||
for (let i = 0; i < row.length; ++i) {
|
||||
const td = new Element("td");
|
||||
td.set("html", row[i]);
|
||||
td.innerHTML = row[i];
|
||||
td.injectInside(tr);
|
||||
}
|
||||
tr.injectInside(this.table);
|
||||
@ -114,12 +114,12 @@ window.qBittorrent.PropWebseeds = (function() {
|
||||
method: "get",
|
||||
noCache: true,
|
||||
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);
|
||||
loadWebSeedsDataTimer = loadWebSeedsData.delay(20000);
|
||||
},
|
||||
onSuccess: function(webseeds) {
|
||||
$("error_div").set("html", "");
|
||||
$("error_div").textContent = "";
|
||||
if (webseeds) {
|
||||
// Update WebSeeds data
|
||||
webseeds.each((webseed) => {
|
||||
|
@ -90,7 +90,7 @@ window.qBittorrent.Search = (function() {
|
||||
|
||||
const init = function() {
|
||||
// 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({
|
||||
targets: ".searchTableRow",
|
||||
menu: "searchResultsTableMenu",
|
||||
@ -114,7 +114,7 @@ window.qBittorrent.Search = (function() {
|
||||
searchInNameFilterTimer = setTimeout(() => {
|
||||
searchInNameFilterTimer = -1;
|
||||
|
||||
const value = $("searchInNameFilter").get("value");
|
||||
const value = $("searchInNameFilter").value;
|
||||
searchText.filterPattern = value;
|
||||
searchFilterChanged();
|
||||
}, window.qBittorrent.Misc.FILTER_INPUT_DELAY);
|
||||
@ -189,7 +189,7 @@ window.qBittorrent.Search = (function() {
|
||||
// reinitialize tabs
|
||||
$("searchTabs").getElements("li").removeEvents("click");
|
||||
$("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);
|
||||
});
|
||||
|
||||
@ -248,8 +248,8 @@ window.qBittorrent.Search = (function() {
|
||||
resetSearchState();
|
||||
resetFilters();
|
||||
|
||||
$("numSearchResultsVisible").set("html", 0);
|
||||
$("numSearchResultsTotal").set("html", 0);
|
||||
$("numSearchResultsVisible").textContent = 0;
|
||||
$("numSearchResultsTotal").textContent = 0;
|
||||
$("searchResultsNoSearches").style.display = "block";
|
||||
$("searchResultsFilters").style.display = "none";
|
||||
$("searchResultsTableContainer").style.display = "none";
|
||||
@ -257,7 +257,7 @@ window.qBittorrent.Search = (function() {
|
||||
}
|
||||
else if (isTabSelected && 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
|
||||
searchText.pattern = state.searchPattern;
|
||||
searchText.filterPattern = state.filterPattern;
|
||||
$("searchInNameFilter").set("value", state.filterPattern);
|
||||
$("searchInNameFilter").value = state.filterPattern;
|
||||
|
||||
searchSeedsFilter.min = state.seedsFilter.min;
|
||||
searchSeedsFilter.max = state.seedsFilter.max;
|
||||
$("searchMinSeedsFilter").set("value", state.seedsFilter.min);
|
||||
$("searchMaxSeedsFilter").set("value", state.seedsFilter.max);
|
||||
$("searchMinSeedsFilter").value = state.seedsFilter.min;
|
||||
$("searchMaxSeedsFilter").value = state.seedsFilter.max;
|
||||
|
||||
searchSizeFilter.min = state.sizeFilter.min;
|
||||
searchSizeFilter.minUnit = state.sizeFilter.minUnit;
|
||||
searchSizeFilter.max = state.sizeFilter.max;
|
||||
searchSizeFilter.maxUnit = state.sizeFilter.maxUnit;
|
||||
$("searchMinSizeFilter").set("value", state.sizeFilter.min);
|
||||
$("searchMinSizePrefix").set("value", state.sizeFilter.minUnit);
|
||||
$("searchMaxSizeFilter").set("value", state.sizeFilter.max);
|
||||
$("searchMaxSizePrefix").set("value", state.sizeFilter.maxUnit);
|
||||
$("searchMinSizeFilter").value = state.sizeFilter.min;
|
||||
$("searchMinSizePrefix").value = state.sizeFilter.minUnit;
|
||||
$("searchMaxSizeFilter").value = state.sizeFilter.max;
|
||||
$("searchMaxSizePrefix").value = state.sizeFilter.maxUnit;
|
||||
|
||||
const currentSearchPattern = $("searchPattern").getProperty("value").trim();
|
||||
const currentSearchPattern = $("searchPattern").value.trim();
|
||||
if (state.running && (state.searchPattern === currentSearchPattern)) {
|
||||
// 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;
|
||||
}
|
||||
|
||||
searchResultsTable.setSortedColumn(state.sort.column, state.sort.reverse);
|
||||
|
||||
$("searchInTorrentName").set("value", state.searchIn);
|
||||
$("searchInTorrentName").value = state.searchIn;
|
||||
}
|
||||
|
||||
// must restore all filters before calling updateTable
|
||||
@ -351,8 +351,8 @@ window.qBittorrent.Search = (function() {
|
||||
if (rowsToSelect.length > 0)
|
||||
searchResultsTable.reselectRows(rowsToSelect);
|
||||
|
||||
$("numSearchResultsVisible").set("html", searchResultsTable.getFilteredAndSortedRows().length);
|
||||
$("numSearchResultsTotal").set("html", searchResultsTable.getRowIds().length);
|
||||
$("numSearchResultsVisible").textContent = searchResultsTable.getFilteredAndSortedRows().length;
|
||||
$("numSearchResultsTotal").textContent = searchResultsTable.getRowIds().length;
|
||||
|
||||
setupSearchTableEvents(true);
|
||||
};
|
||||
@ -373,9 +373,9 @@ window.qBittorrent.Search = (function() {
|
||||
const searchTab = $(`${searchTabIdPrefix}${searchId}`);
|
||||
if (searchTab) {
|
||||
const statusIcon = searchTab.getElement(".statusIcon");
|
||||
statusIcon.set("alt", text);
|
||||
statusIcon.set("title", text);
|
||||
statusIcon.set("src", image);
|
||||
statusIcon.alt = text;
|
||||
statusIcon.title = text;
|
||||
statusIcon.src = image;
|
||||
}
|
||||
};
|
||||
|
||||
@ -392,7 +392,7 @@ window.qBittorrent.Search = (function() {
|
||||
plugins: plugins
|
||||
},
|
||||
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;
|
||||
createSearchTab(searchId, pattern);
|
||||
|
||||
@ -429,9 +429,9 @@ window.qBittorrent.Search = (function() {
|
||||
const state = searchState.get(currentSearchId);
|
||||
const isSearchRunning = state && state.running;
|
||||
if (!isSearchRunning || searchPatternChanged) {
|
||||
const pattern = $("searchPattern").getProperty("value").trim();
|
||||
const category = $("categorySelect").getProperty("value");
|
||||
const plugins = $("pluginsSelect").getProperty("value");
|
||||
const pattern = $("searchPattern").value.trim();
|
||||
const category = $("categorySelect").value;
|
||||
const plugins = $("pluginsSelect").value;
|
||||
|
||||
if (!pattern || !category || !plugins)
|
||||
return;
|
||||
@ -522,24 +522,24 @@ window.qBittorrent.Search = (function() {
|
||||
const onSearchPatternChanged = function() {
|
||||
const currentSearchId = getSelectedSearchId();
|
||||
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
|
||||
if (state && (state.searchPattern === currentSearchPattern)) {
|
||||
searchPatternChanged = false;
|
||||
$("startSearchButton").set("text", "QBT_TR(Stop)QBT_TR[CONTEXT=SearchEngineWidget]");
|
||||
$("startSearchButton").textContent = "QBT_TR(Stop)QBT_TR[CONTEXT=SearchEngineWidget]";
|
||||
}
|
||||
else {
|
||||
searchPatternChanged = true;
|
||||
$("startSearchButton").set("text", "QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]");
|
||||
$("startSearchButton").textContent = "QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]";
|
||||
}
|
||||
};
|
||||
|
||||
const categorySelected = function() {
|
||||
selectedCategory = $("categorySelect").get("value");
|
||||
selectedCategory = $("categorySelect").value;
|
||||
};
|
||||
|
||||
const pluginSelected = function() {
|
||||
selectedPlugin = $("pluginsSelect").get("value");
|
||||
selectedPlugin = $("pluginsSelect").value;
|
||||
|
||||
if (selectedPlugin !== prevSelectedPlugin) {
|
||||
prevSelectedPlugin = selectedPlugin;
|
||||
@ -566,7 +566,7 @@ window.qBittorrent.Search = (function() {
|
||||
};
|
||||
|
||||
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);
|
||||
if (state) {
|
||||
state.running = false;
|
||||
@ -579,8 +579,8 @@ window.qBittorrent.Search = (function() {
|
||||
const categoryHtml = [];
|
||||
categories.each((category) => {
|
||||
const option = new Element("option");
|
||||
option.set("value", category.id);
|
||||
option.set("html", category.name);
|
||||
option.value = category.id;
|
||||
option.textContent = category.name;
|
||||
categoryHtml.push(option.outerHTML);
|
||||
});
|
||||
|
||||
@ -588,15 +588,15 @@ window.qBittorrent.Search = (function() {
|
||||
if (categoryHtml.length > 1) {
|
||||
// add separator
|
||||
const option = new Element("option");
|
||||
option.set("disabled", true);
|
||||
option.set("html", "──────────");
|
||||
option.disabled = true;
|
||||
option.textContent = "──────────";
|
||||
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")) {
|
||||
const uniqueCategories = {};
|
||||
@ -660,12 +660,12 @@ window.qBittorrent.Search = (function() {
|
||||
pluginsHtml.splice(2, 0, "<option disabled>──────────</option>");
|
||||
}
|
||||
|
||||
$("pluginsSelect").set("html", pluginsHtml.join(""));
|
||||
$("pluginsSelect").innerHTML = pluginsHtml.join("");
|
||||
|
||||
$("searchPattern").setProperty("disabled", searchPluginsEmpty);
|
||||
$("categorySelect").setProperty("disabled", searchPluginsEmpty);
|
||||
$("pluginsSelect").setProperty("disabled", searchPluginsEmpty);
|
||||
$("startSearchButton").setProperty("disabled", searchPluginsEmpty);
|
||||
$("searchPattern").disabled = searchPluginsEmpty;
|
||||
$("categorySelect").disabled = searchPluginsEmpty;
|
||||
$("pluginsSelect").disabled = searchPluginsEmpty;
|
||||
$("startSearchButton").disabled = searchPluginsEmpty;
|
||||
|
||||
if (window.qBittorrent.SearchPlugins !== undefined)
|
||||
window.qBittorrent.SearchPlugins.updateTable();
|
||||
@ -687,25 +687,25 @@ window.qBittorrent.Search = (function() {
|
||||
|
||||
const resetFilters = function() {
|
||||
searchText.filterPattern = "";
|
||||
$("searchInNameFilter").set("value", "");
|
||||
$("searchInNameFilter").value = "";
|
||||
|
||||
searchSeedsFilter.min = 0;
|
||||
searchSeedsFilter.max = 0;
|
||||
$("searchMinSeedsFilter").set("value", searchSeedsFilter.min);
|
||||
$("searchMaxSeedsFilter").set("value", searchSeedsFilter.max);
|
||||
$("searchMinSeedsFilter").value = searchSeedsFilter.min;
|
||||
$("searchMaxSeedsFilter").value = searchSeedsFilter.max;
|
||||
|
||||
searchSizeFilter.min = 0.00;
|
||||
searchSizeFilter.minUnit = 2; // B = 0, KiB = 1, MiB = 2, GiB = 3, TiB = 4, PiB = 5, EiB = 6
|
||||
searchSizeFilter.max = 0.00;
|
||||
searchSizeFilter.maxUnit = 3;
|
||||
$("searchMinSizeFilter").set("value", searchSizeFilter.min);
|
||||
$("searchMinSizePrefix").set("value", searchSizeFilter.minUnit);
|
||||
$("searchMaxSizeFilter").set("value", searchSizeFilter.max);
|
||||
$("searchMaxSizePrefix").set("value", searchSizeFilter.maxUnit);
|
||||
$("searchMinSizeFilter").value = searchSizeFilter.min;
|
||||
$("searchMinSizePrefix").value = searchSizeFilter.minUnit;
|
||||
$("searchMaxSizeFilter").value = searchSizeFilter.max;
|
||||
$("searchMaxSizePrefix").value = searchSizeFilter.maxUnit;
|
||||
};
|
||||
|
||||
const getSearchInTorrentName = function() {
|
||||
return $("searchInTorrentName").get("value") === "names" ? "names" : "everywhere";
|
||||
return ($("searchInTorrentName").value === "names") ? "names" : "everywhere";
|
||||
};
|
||||
|
||||
const searchInTorrentName = function() {
|
||||
@ -714,29 +714,29 @@ window.qBittorrent.Search = (function() {
|
||||
};
|
||||
|
||||
const searchSeedsFilterChanged = function() {
|
||||
searchSeedsFilter.min = $("searchMinSeedsFilter").get("value");
|
||||
searchSeedsFilter.max = $("searchMaxSeedsFilter").get("value");
|
||||
searchSeedsFilter.min = $("searchMinSeedsFilter").value;
|
||||
searchSeedsFilter.max = $("searchMaxSeedsFilter").value;
|
||||
|
||||
searchFilterChanged();
|
||||
};
|
||||
|
||||
const searchSizeFilterChanged = function() {
|
||||
searchSizeFilter.min = $("searchMinSizeFilter").get("value");
|
||||
searchSizeFilter.minUnit = $("searchMinSizePrefix").get("value");
|
||||
searchSizeFilter.max = $("searchMaxSizeFilter").get("value");
|
||||
searchSizeFilter.maxUnit = $("searchMaxSizePrefix").get("value");
|
||||
searchSizeFilter.min = $("searchMinSizeFilter").value;
|
||||
searchSizeFilter.minUnit = $("searchMinSizePrefix").value;
|
||||
searchSizeFilter.max = $("searchMaxSizeFilter").value;
|
||||
searchSizeFilter.maxUnit = $("searchMaxSizePrefix").value;
|
||||
|
||||
searchFilterChanged();
|
||||
};
|
||||
|
||||
const searchSizeFilterPrefixChanged = function() {
|
||||
if ((Number($("searchMinSizeFilter").get("value")) !== 0) || (Number($("searchMaxSizeFilter").get("value")) !== 0))
|
||||
if ((Number($("searchMinSizeFilter").value) !== 0) || (Number($("searchMaxSizeFilter").value) !== 0))
|
||||
searchSizeFilterChanged();
|
||||
};
|
||||
|
||||
const searchFilterChanged = function() {
|
||||
searchResultsTable.updateTable();
|
||||
$("numSearchResultsVisible").set("html", searchResultsTable.getFilteredAndSortedRows().length);
|
||||
$("numSearchResultsVisible").textContent = searchResultsTable.getFilteredAndSortedRows().length;
|
||||
};
|
||||
|
||||
const setupSearchTableEvents = function(enable) {
|
||||
@ -778,7 +778,7 @@ window.qBittorrent.Search = (function() {
|
||||
}
|
||||
},
|
||||
onSuccess: function(response) {
|
||||
$("error_div").set("html", "");
|
||||
$("error_div").textContent = "";
|
||||
|
||||
const state = searchState.get(searchId);
|
||||
// check if user stopped the search prior to receiving the response
|
||||
@ -821,8 +821,8 @@ window.qBittorrent.Search = (function() {
|
||||
for (const row of newRows)
|
||||
searchResultsTable.updateRowData(row);
|
||||
|
||||
$("numSearchResultsVisible").set("html", searchResultsTable.getFilteredAndSortedRows().length);
|
||||
$("numSearchResultsTotal").set("html", searchResultsTable.getRowIds().length);
|
||||
$("numSearchResultsVisible").textContent = searchResultsTable.getFilteredAndSortedRows().length;
|
||||
$("numSearchResultsTotal").textContent = searchResultsTable.getRowIds().length;
|
||||
|
||||
searchResultsTable.updateTable();
|
||||
searchResultsTable.altRow();
|
||||
|
@ -42,7 +42,7 @@
|
||||
// check field
|
||||
const location = $("setLocation").value.trim();
|
||||
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;
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
window.parent.qBittorrent.Client.closeWindows();
|
||||
},
|
||||
onFailure: function(xhr) {
|
||||
$("error_div").set("text", xhr.response);
|
||||
$("error_div").textContent = xhr.response;
|
||||
}
|
||||
}).send();
|
||||
});
|
||||
|
@ -60,16 +60,16 @@
|
||||
else {
|
||||
setSelectedRadioValue("shareLimit", "custom");
|
||||
if (values.ratioLimit >= 0) {
|
||||
$("setRatio").set("checked", true);
|
||||
$("ratio").set("value", values.ratioLimit);
|
||||
$("setRatio").checked = true;
|
||||
$("ratio").value = values.ratioLimit;
|
||||
}
|
||||
if (values.seedingTimeLimit >= 0) {
|
||||
$("setTotalMinutes").set("checked", true);
|
||||
$("totalMinutes").set("value", values.seedingTimeLimit);
|
||||
$("setTotalMinutes").checked = true;
|
||||
$("totalMinutes").value = values.seedingTimeLimit;
|
||||
}
|
||||
if (values.inactiveSeedingTimeLimit >= 0) {
|
||||
$("setInactiveMinutes").set("checked", true);
|
||||
$("inactiveMinutes").set("value", values.inactiveSeedingTimeLimit);
|
||||
$("setInactiveMinutes").checked = true;
|
||||
$("inactiveMinutes").value = values.inactiveSeedingTimeLimit;
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,9 +94,9 @@
|
||||
ratioLimitValue = seedingTimeLimitValue = inactiveSeedingTimeLimitValue = NoLimit;
|
||||
}
|
||||
else if (shareLimit === "custom") {
|
||||
ratioLimitValue = $("setRatio").get("checked") ? $("ratio").get("value") : -1;
|
||||
seedingTimeLimitValue = $("setTotalMinutes").get("checked") ? $("totalMinutes").get("value") : -1;
|
||||
inactiveSeedingTimeLimitValue = $("setInactiveMinutes").get("checked") ? $("inactiveMinutes").get("value") : -1;
|
||||
ratioLimitValue = $("setRatio").checked ? $("ratio").value : -1;
|
||||
seedingTimeLimitValue = $("setTotalMinutes").checked ? $("totalMinutes").value : -1;
|
||||
inactiveSeedingTimeLimitValue = $("setInactiveMinutes").checked ? $("inactiveMinutes").value : -1;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
@ -124,7 +124,7 @@
|
||||
for (let i = 0; i < radios.length; ++i) {
|
||||
const radio = radios[i];
|
||||
if (radio.checked)
|
||||
return (radio).get("value");
|
||||
return radio.value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,26 +140,26 @@
|
||||
|
||||
function shareLimitChanged() {
|
||||
const customShareLimit = getSelectedRadioValue("shareLimit") === "custom";
|
||||
$("setRatio").set("disabled", !customShareLimit);
|
||||
$("setTotalMinutes").set("disabled", !customShareLimit);
|
||||
$("setInactiveMinutes").set("disabled", !customShareLimit);
|
||||
$("setRatio").disabled = !customShareLimit;
|
||||
$("setTotalMinutes").disabled = !customShareLimit;
|
||||
$("setInactiveMinutes").disabled = !customShareLimit;
|
||||
|
||||
enableInputBoxes();
|
||||
|
||||
$("save").set("disabled", !isFormValid());
|
||||
$("save").disabled = !isFormValid();
|
||||
}
|
||||
|
||||
function enableInputBoxes() {
|
||||
$("ratio").set("disabled", ($("setRatio").get("disabled") || !$("setRatio").get("checked")));
|
||||
$("totalMinutes").set("disabled", ($("setTotalMinutes").get("disabled") || !$("setTotalMinutes").get("checked")));
|
||||
$("inactiveMinutes").set("disabled", ($("setInactiveMinutes").get("disabled") || !$("setInactiveMinutes").get("checked")));
|
||||
$("ratio").disabled = $("setRatio").disabled || !$("setRatio").checked;
|
||||
$("totalMinutes").disabled = $("setTotalMinutes").disabled || !$("setTotalMinutes").checked;
|
||||
$("inactiveMinutes").disabled = $("setInactiveMinutes").disabled || !$("setInactiveMinutes").checked;
|
||||
|
||||
$("save").set("disabled", !isFormValid());
|
||||
$("save").disabled = !isFormValid();
|
||||
}
|
||||
|
||||
function isFormValid() {
|
||||
return !((getSelectedRadioValue("shareLimit") === "custom") && !$("setRatio").get("checked")
|
||||
&& !$("setTotalMinutes").get("checked") && !$("setInactiveMinutes").get("checked"));
|
||||
return !((getSelectedRadioValue("shareLimit") === "custom") && !$("setRatio").checked
|
||||
&& !$("setTotalMinutes").checked && !$("setInactiveMinutes").checked);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
@ -60,7 +60,7 @@
|
||||
};
|
||||
|
||||
const newPluginOk = function() {
|
||||
const path = $("newPluginPath").get("value").trim();
|
||||
const path = $("newPluginPath").value.trim();
|
||||
if (path) {
|
||||
new Request({
|
||||
url: "api/v2/search/installPlugin",
|
||||
|
@ -288,7 +288,7 @@
|
||||
};
|
||||
|
||||
const filterTextChanged = () => {
|
||||
const value = $("filterTextInput").get("value").trim();
|
||||
const value = $("filterTextInput").value.trim();
|
||||
if (inputtedFilterText !== value) {
|
||||
inputtedFilterText = value;
|
||||
logFilterChanged();
|
||||
@ -337,8 +337,8 @@
|
||||
if (curTab === undefined)
|
||||
curTab = currentSelectedTab;
|
||||
|
||||
$("numFilteredLogs").set("text", tableInfo[curTab].instance.filteredLength());
|
||||
$("numTotalLogs").set("text", tableInfo[curTab].instance.getRowIds().length);
|
||||
$("numFilteredLogs").textContent = tableInfo[curTab].instance.filteredLength();
|
||||
$("numTotalLogs").textContent = tableInfo[curTab].instance.getRowIds().length;
|
||||
};
|
||||
|
||||
const syncLogData = (curTab) => {
|
||||
@ -369,12 +369,12 @@
|
||||
onFailure: function(response) {
|
||||
const errorDiv = $("error_div");
|
||||
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;
|
||||
syncLogWithInterval(10000);
|
||||
},
|
||||
onSuccess: function(response) {
|
||||
$("error_div").set("text", "");
|
||||
$("error_div").textContent = "";
|
||||
|
||||
if ($("logTabColumn").hasClass("invisible"))
|
||||
return;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -405,12 +405,12 @@
|
||||
$("rssDetailsView").append((() => {
|
||||
const torrentName = document.createElement("p");
|
||||
torrentName.innerText = article.title;
|
||||
torrentName.setAttribute("id", "rssTorrentDetailsName");
|
||||
torrentName.id = "rssTorrentDetailsName";
|
||||
return torrentName;
|
||||
})());
|
||||
$("rssDetailsView").append((() => {
|
||||
const torrentDate = document.createElement("div");
|
||||
torrentDate.setAttribute("id", "rssTorrentDetailsDate");
|
||||
torrentDate.id = "rssTorrentDetailsDate";
|
||||
|
||||
const torrentDateDesc = document.createElement("b");
|
||||
torrentDateDesc.innerText = "QBT_TR(Date: )QBT_TR[CONTEXT=RSSWidget]";
|
||||
|
@ -131,7 +131,7 @@ function submitLoginForm(event) {
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const loginForm = document.getElementById("loginform");
|
||||
loginForm.setAttribute("method", "POST");
|
||||
loginForm.method = "POST";
|
||||
loginForm.addEventListener("submit", submitLoginForm);
|
||||
|
||||
setupI18n();
|
||||
|
Loading…
Reference in New Issue
Block a user