mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-14 09:13:08 -07:00
WebUI: prefer arrow functions whenever applicable
Compared to plain function, arrow function is simpler to understand (without bindings to `this`, `arguments`, `super`) and to read. Now, plain function will only be used when this object is required. PR #21691.
This commit is contained in:
parent
7af6ac18aa
commit
72cbc83569
49 changed files with 574 additions and 570 deletions
|
@ -1,6 +1,7 @@
|
||||||
import Globals from "globals";
|
import Globals from "globals";
|
||||||
import Html from "eslint-plugin-html";
|
import Html from "eslint-plugin-html";
|
||||||
import Js from "@eslint/js";
|
import Js from "@eslint/js";
|
||||||
|
import PreferArrowFunctions from "eslint-plugin-prefer-arrow-functions";
|
||||||
import Stylistic from "@stylistic/eslint-plugin";
|
import Stylistic from "@stylistic/eslint-plugin";
|
||||||
import * as RegexpPlugin from "eslint-plugin-regexp";
|
import * as RegexpPlugin from "eslint-plugin-regexp";
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@ export default [
|
||||||
},
|
},
|
||||||
plugins: {
|
plugins: {
|
||||||
Html,
|
Html,
|
||||||
|
PreferArrowFunctions,
|
||||||
RegexpPlugin,
|
RegexpPlugin,
|
||||||
Stylistic
|
Stylistic
|
||||||
},
|
},
|
||||||
|
@ -36,6 +38,7 @@ export default [
|
||||||
"prefer-arrow-callback": "error",
|
"prefer-arrow-callback": "error",
|
||||||
"prefer-const": "error",
|
"prefer-const": "error",
|
||||||
"radix": "error",
|
"radix": "error",
|
||||||
|
"PreferArrowFunctions/prefer-arrow-functions": "error",
|
||||||
"Stylistic/no-mixed-operators": [
|
"Stylistic/no-mixed-operators": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
"@stylistic/eslint-plugin": "*",
|
"@stylistic/eslint-plugin": "*",
|
||||||
"eslint": "*",
|
"eslint": "*",
|
||||||
"eslint-plugin-html": "*",
|
"eslint-plugin-html": "*",
|
||||||
|
"eslint-plugin-prefer-arrow-functions": "*",
|
||||||
"eslint-plugin-regexp": "*",
|
"eslint-plugin-regexp": "*",
|
||||||
"html-validate": "*",
|
"html-validate": "*",
|
||||||
"js-beautify": "*",
|
"js-beautify": "*",
|
||||||
|
|
|
@ -46,10 +46,10 @@
|
||||||
hashes: hash,
|
hashes: hash,
|
||||||
peers: peers.join("|")
|
peers: peers.join("|")
|
||||||
},
|
},
|
||||||
onFailure: function() {
|
onFailure: () => {
|
||||||
alert("QBT_TR(Unable to add peers. Please ensure you are adhering to the IP:port format.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Unable to add peers. Please ensure you are adhering to the IP:port format.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
hash: hash,
|
hash: hash,
|
||||||
urls: $("trackersUrls").value
|
urls: $("trackersUrls").value
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: () => {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
hash: hash,
|
hash: hash,
|
||||||
urls: $("urls").value.split("\n").map(w => encodeURIComponent(w.trim())).filter(w => (w.length > 0)).join("|")
|
urls: $("urls").value.split("\n").map(w => encodeURIComponent(w.trim())).filter(w => (w.length > 0)).join("|")
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: () => {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
hash: "*",
|
hash: "*",
|
||||||
urls: urls,
|
urls: urls,
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: () => {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const hashes = new URI().getData("hashes").split("|");
|
const hashes = new URI().getData("hashes").split("|");
|
||||||
const setDlLimit = function() {
|
const setDlLimit = () => {
|
||||||
const limit = $("dllimitUpdatevalue").value.toInt() * 1024;
|
const limit = $("dllimitUpdatevalue").value.toInt() * 1024;
|
||||||
if (hashes[0] === "global") {
|
if (hashes[0] === "global") {
|
||||||
new Request({
|
new Request({
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
data: {
|
data: {
|
||||||
"limit": limit
|
"limit": limit
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: () => {
|
||||||
window.parent.updateMainData();
|
window.parent.updateMainData();
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
"hashes": hashes.join("|"),
|
"hashes": hashes.join("|"),
|
||||||
"limit": limit
|
"limit": limit
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: () => {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
origUrl: currentUrl,
|
origUrl: currentUrl,
|
||||||
newUrl: $("trackerUrl").value
|
newUrl: $("trackerUrl").value
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: () => {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
origUrl: origUrl,
|
origUrl: origUrl,
|
||||||
newUrl: encodeURIComponent($("url").value.trim()),
|
newUrl: encodeURIComponent($("url").value.trim()),
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: () => {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
const savePath = $("savePath").value.trim();
|
const savePath = $("savePath").value.trim();
|
||||||
const categoryName = $("categoryName").value.trim();
|
const categoryName = $("categoryName").value.trim();
|
||||||
|
|
||||||
const verifyCategoryName = function(name) {
|
const verifyCategoryName = (name) => {
|
||||||
if ((name === null) || (name === ""))
|
if ((name === null) || (name === ""))
|
||||||
return false;
|
return false;
|
||||||
if (name.match("^([^\\\\\\/]|[^\\\\\\/]([^\\\\\\/]|\\/(?=[^\\/]))*[^\\\\\\/])$") === null) {
|
if (name.match("^([^\\\\\\/]|[^\\\\\\/]([^\\\\\\/]|\\/(?=[^\\/]))*[^\\\\\\/])$") === null) {
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
category: categoryName,
|
category: categoryName,
|
||||||
savePath: savePath
|
savePath: savePath
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
new Request({
|
new Request({
|
||||||
url: "api/v2/torrents/setCategory",
|
url: "api/v2/torrents/setCategory",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -90,16 +90,16 @@
|
||||||
hashes: uriHashes,
|
hashes: uriHashes,
|
||||||
category: categoryName
|
category: categoryName
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
window.parent.updateMainData();
|
window.parent.updateMainData();
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
},
|
},
|
||||||
onFailure: function() {
|
onFailure: () => {
|
||||||
alert("QBT_TR(Unable to set category)QBT_TR[CONTEXT=Category]");
|
alert("QBT_TR(Unable to set category)QBT_TR[CONTEXT=Category]");
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
},
|
},
|
||||||
onFailure: function() {
|
onFailure: () => {
|
||||||
alert("QBT_TR(Unable to create category)QBT_TR[CONTEXT=Category] " + window.qBittorrent.Misc.escapeHtml(categoryName));
|
alert("QBT_TR(Unable to create category)QBT_TR[CONTEXT=Category] " + window.qBittorrent.Misc.escapeHtml(categoryName));
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
@ -116,11 +116,11 @@
|
||||||
category: categoryName,
|
category: categoryName,
|
||||||
savePath: savePath
|
savePath: savePath
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
window.parent.updateMainData();
|
window.parent.updateMainData();
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
},
|
},
|
||||||
onFailure: function() {
|
onFailure: () => {
|
||||||
alert("QBT_TR(Unable to create category)QBT_TR[CONTEXT=Category]");
|
alert("QBT_TR(Unable to create category)QBT_TR[CONTEXT=Category]");
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
@ -133,11 +133,11 @@
|
||||||
category: uriCategoryName, // category name can't be changed
|
category: uriCategoryName, // category name can't be changed
|
||||||
savePath: savePath
|
savePath: savePath
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
window.parent.updateMainData();
|
window.parent.updateMainData();
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
},
|
},
|
||||||
onFailure: function() {
|
onFailure: () => {
|
||||||
alert("QBT_TR(Unable to edit category)QBT_TR[CONTEXT=Category]");
|
alert("QBT_TR(Unable to edit category)QBT_TR[CONTEXT=Category]");
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
const tagName = $("tagName").value.trim();
|
const tagName = $("tagName").value.trim();
|
||||||
|
|
||||||
const verifyTagName = function(name) {
|
const verifyTagName = (name) => {
|
||||||
if ((name === null) || (name === ""))
|
if ((name === null) || (name === ""))
|
||||||
return false;
|
return false;
|
||||||
if (name.includes(",")) {
|
if (name.includes(",")) {
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
hashes: uriHashes,
|
hashes: uriHashes,
|
||||||
tags: tagName,
|
tags: tagName,
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: () => {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
data: {
|
data: {
|
||||||
tags: tagName,
|
tags: tagName,
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: () => {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
hash: hash,
|
hash: hash,
|
||||||
name: name
|
name: name
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: () => {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
|
|
@ -71,10 +71,10 @@
|
||||||
oldPath: oldPath,
|
oldPath: oldPath,
|
||||||
newPath: newPath
|
newPath: newPath
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
},
|
},
|
||||||
onFailure: function() {
|
onFailure: () => {
|
||||||
alert("QBT_TR(Failed to update name)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Failed to update name)QBT_TR[CONTEXT=HttpServer]");
|
||||||
$("renameButton").disabled = false;
|
$("renameButton").disabled = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
targets: "#bulkRenameFilesTableDiv tr",
|
targets: "#bulkRenameFilesTableDiv tr",
|
||||||
menu: "multiRenameFilesMenu",
|
menu: "multiRenameFilesMenu",
|
||||||
actions: {
|
actions: {
|
||||||
ToggleSelection: function(element, ref) {
|
ToggleSelection: (element, ref) => {
|
||||||
const rowId = parseInt(element.getAttribute("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;
|
||||||
|
@ -128,7 +128,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fires every time a row's selection changes
|
// Fires every time a row's selection changes
|
||||||
bulkRenameFilesTable.onRowSelectionChange = function(row) {
|
bulkRenameFilesTable.onRowSelectionChange = (row) => {
|
||||||
fileRenamer.selectedFiles = bulkRenameFilesTable.getSelectedRows();
|
fileRenamer.selectedFiles = bulkRenameFilesTable.getSelectedRows();
|
||||||
fileRenamer.update();
|
fileRenamer.update();
|
||||||
};
|
};
|
||||||
|
@ -162,7 +162,7 @@
|
||||||
/**
|
/**
|
||||||
* Fires every time the filerenamer gets changed, it will update all the rows in the table
|
* Fires every time the filerenamer gets changed, it will update all the rows in the table
|
||||||
*/
|
*/
|
||||||
fileRenamer.onChanged = function(matchedRows) {
|
fileRenamer.onChanged = (matchedRows) => {
|
||||||
// Clear renamed column
|
// Clear renamed column
|
||||||
document
|
document
|
||||||
.querySelectorAll("span[id^='filesTablefileRenamed']")
|
.querySelectorAll("span[id^='filesTablefileRenamed']")
|
||||||
|
@ -176,7 +176,7 @@
|
||||||
$("filesTablefileRenamed" + row.rowId).textContent = row.renamed;
|
$("filesTablefileRenamed" + row.rowId).textContent = row.renamed;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fileRenamer.onInvalidRegex = function(err) {
|
fileRenamer.onInvalidRegex = (err) => {
|
||||||
$("multiRenameSearch").style["border-color"] = "#CC0033";
|
$("multiRenameSearch").style["border-color"] = "#CC0033";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@
|
||||||
$("rename_error").textContent = "";
|
$("rename_error").textContent = "";
|
||||||
fileRenamer.rename();
|
fileRenamer.rename();
|
||||||
});
|
});
|
||||||
fileRenamer.onRenamed = function(rows) {
|
fileRenamer.onRenamed = (rows) => {
|
||||||
// Disable Search Options
|
// Disable Search Options
|
||||||
$("multiRenameSearch").disabled = false;
|
$("multiRenameSearch").disabled = false;
|
||||||
$("use_regex_search").disabled = false;
|
$("use_regex_search").disabled = false;
|
||||||
|
@ -268,7 +268,7 @@
|
||||||
}
|
}
|
||||||
setupTable(selectedRows);
|
setupTable(selectedRows);
|
||||||
};
|
};
|
||||||
fileRenamer.onRenameError = function(err, row) {
|
fileRenamer.onRenameError = (err, row) => {
|
||||||
if (err.xhr.status === 409)
|
if (err.xhr.status === 409)
|
||||||
$("rename_error").textContent = `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}\``;
|
||||||
};
|
};
|
||||||
|
@ -294,7 +294,7 @@
|
||||||
$("bulkRenameFilesTableFixedHeaderDiv").scrollLeft = length;
|
$("bulkRenameFilesTableFixedHeaderDiv").scrollLeft = length;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleTorrentFiles = function(files, selectedRows) {
|
const handleTorrentFiles = (files, selectedRows) => {
|
||||||
const rows = files.map((file, index) => {
|
const rows = files.map((file, index) => {
|
||||||
|
|
||||||
const row = {
|
const row = {
|
||||||
|
@ -312,7 +312,7 @@
|
||||||
addRowsToTable(rows, selectedRows);
|
addRowsToTable(rows, selectedRows);
|
||||||
};
|
};
|
||||||
|
|
||||||
const addRowsToTable = function(rows, selectedRows) {
|
const addRowsToTable = (rows, selectedRows) => {
|
||||||
let rowId = 0;
|
let rowId = 0;
|
||||||
const rootNode = new window.qBittorrent.FileTree.FolderNode();
|
const rootNode = new window.qBittorrent.FileTree.FolderNode();
|
||||||
rootNode.autoCheckFolders = false;
|
rootNode.autoCheckFolders = false;
|
||||||
|
@ -379,12 +379,12 @@
|
||||||
fileRenamer.update();
|
fileRenamer.update();
|
||||||
};
|
};
|
||||||
|
|
||||||
const setupTable = function(selectedRows) {
|
const setupTable = (selectedRows) => {
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: new URI("api/v2/torrents/files?hash=" + data.hash),
|
url: new URI("api/v2/torrents/files?hash=" + data.hash),
|
||||||
noCache: true,
|
noCache: true,
|
||||||
method: "get",
|
method: "get",
|
||||||
onSuccess: function(files) {
|
onSuccess: (files) => {
|
||||||
if (files.length === 0)
|
if (files.length === 0)
|
||||||
bulkRenameFilesTable.clear();
|
bulkRenameFilesTable.clear();
|
||||||
else
|
else
|
||||||
|
|
|
@ -44,18 +44,18 @@ window.qBittorrent.Client ??= (() => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeWindow = function(windowID) {
|
const closeWindow = (windowID) => {
|
||||||
const window = document.getElementById(windowID);
|
const window = document.getElementById(windowID);
|
||||||
if (!window)
|
if (!window)
|
||||||
return;
|
return;
|
||||||
MochaUI.closeWindow(window);
|
MochaUI.closeWindow(window);
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeWindows = function() {
|
const closeWindows = () => {
|
||||||
MochaUI.closeAll();
|
MochaUI.closeAll();
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSyncMainDataInterval = function() {
|
const getSyncMainDataInterval = () => {
|
||||||
return customSyncMainDataInterval ? customSyncMainDataInterval : serverSyncMainDataInterval;
|
return customSyncMainDataInterval ? customSyncMainDataInterval : serverSyncMainDataInterval;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -81,22 +81,22 @@ window.qBittorrent.Client ??= (() => {
|
||||||
let showingRssReader = false;
|
let showingRssReader = false;
|
||||||
let showingLogViewer = false;
|
let showingLogViewer = false;
|
||||||
|
|
||||||
const showSearchEngine = function(bool) {
|
const showSearchEngine = (bool) => {
|
||||||
showingSearchEngine = bool;
|
showingSearchEngine = bool;
|
||||||
};
|
};
|
||||||
const showRssReader = function(bool) {
|
const showRssReader = (bool) => {
|
||||||
showingRssReader = bool;
|
showingRssReader = bool;
|
||||||
};
|
};
|
||||||
const showLogViewer = function(bool) {
|
const showLogViewer = (bool) => {
|
||||||
showingLogViewer = bool;
|
showingLogViewer = bool;
|
||||||
};
|
};
|
||||||
const isShowSearchEngine = function() {
|
const isShowSearchEngine = () => {
|
||||||
return showingSearchEngine;
|
return showingSearchEngine;
|
||||||
};
|
};
|
||||||
const isShowRssReader = function() {
|
const isShowRssReader = () => {
|
||||||
return showingRssReader;
|
return showingRssReader;
|
||||||
};
|
};
|
||||||
const isShowLogViewer = function() {
|
const isShowLogViewer = () => {
|
||||||
return showingLogViewer;
|
return showingLogViewer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -108,9 +108,9 @@ Object.freeze(window.qBittorrent.Client);
|
||||||
|
|
||||||
this.torrentsTable = new window.qBittorrent.DynamicTable.TorrentsTable();
|
this.torrentsTable = new window.qBittorrent.DynamicTable.TorrentsTable();
|
||||||
|
|
||||||
let updatePropertiesPanel = function() {};
|
let updatePropertiesPanel = () => {};
|
||||||
|
|
||||||
this.updateMainData = function() {};
|
this.updateMainData = () => {};
|
||||||
let alternativeSpeedLimits = false;
|
let alternativeSpeedLimits = false;
|
||||||
let queueing_enabled = true;
|
let queueing_enabled = true;
|
||||||
let serverSyncMainDataInterval = 1500;
|
let serverSyncMainDataInterval = 1500;
|
||||||
|
@ -126,7 +126,7 @@ const CATEGORIES_UNCATEGORIZED = 2;
|
||||||
const category_list = new Map();
|
const category_list = new Map();
|
||||||
|
|
||||||
let selectedCategory = Number(LocalPreferences.get("selected_category", CATEGORIES_ALL));
|
let selectedCategory = Number(LocalPreferences.get("selected_category", CATEGORIES_ALL));
|
||||||
let setCategoryFilter = function() {};
|
let setCategoryFilter = () => {};
|
||||||
|
|
||||||
/* Tags filter */
|
/* Tags filter */
|
||||||
const TAGS_ALL = 1;
|
const TAGS_ALL = 1;
|
||||||
|
@ -135,7 +135,7 @@ const TAGS_UNTAGGED = 2;
|
||||||
const tagList = new Map();
|
const tagList = new Map();
|
||||||
|
|
||||||
let selectedTag = Number(LocalPreferences.get("selected_tag", TAGS_ALL));
|
let selectedTag = Number(LocalPreferences.get("selected_tag", TAGS_ALL));
|
||||||
let setTagFilter = function() {};
|
let setTagFilter = () => {};
|
||||||
|
|
||||||
/* Trackers filter */
|
/* Trackers filter */
|
||||||
const TRACKERS_ALL = 1;
|
const TRACKERS_ALL = 1;
|
||||||
|
@ -145,19 +145,19 @@ const TRACKERS_TRACKERLESS = 2;
|
||||||
const trackerList = new Map();
|
const trackerList = new Map();
|
||||||
|
|
||||||
let selectedTracker = Number(LocalPreferences.get("selected_tracker", TRACKERS_ALL));
|
let selectedTracker = Number(LocalPreferences.get("selected_tracker", TRACKERS_ALL));
|
||||||
let setTrackerFilter = function() {};
|
let setTrackerFilter = () => {};
|
||||||
|
|
||||||
/* All filters */
|
/* All filters */
|
||||||
let selectedStatus = LocalPreferences.get("selected_filter", "all");
|
let selectedStatus = LocalPreferences.get("selected_filter", "all");
|
||||||
let setStatusFilter = function() {};
|
let setStatusFilter = () => {};
|
||||||
let toggleFilterDisplay = function() {};
|
let toggleFilterDisplay = () => {};
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", () => {
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
let isSearchPanelLoaded = false;
|
let isSearchPanelLoaded = false;
|
||||||
let isLogPanelLoaded = false;
|
let isLogPanelLoaded = false;
|
||||||
let isRssPanelLoaded = false;
|
let isRssPanelLoaded = false;
|
||||||
|
|
||||||
const saveColumnSizes = function() {
|
const saveColumnSizes = () => {
|
||||||
const filters_width = $("Filters").getSize().x;
|
const filters_width = $("Filters").getSize().x;
|
||||||
LocalPreferences.set("filters_width", filters_width);
|
LocalPreferences.set("filters_width", filters_width);
|
||||||
const properties_height_rel = $("propertiesPanel").getSize().y / Window.getSize().y;
|
const properties_height_rel = $("propertiesPanel").getSize().y / Window.getSize().y;
|
||||||
|
@ -175,7 +175,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
MochaUI.Desktop.desktop.style.visibility = "visible"; */
|
MochaUI.Desktop.desktop.style.visibility = "visible"; */
|
||||||
MochaUI.Desktop.initialize();
|
MochaUI.Desktop.initialize();
|
||||||
|
|
||||||
const buildTransfersTab = function() {
|
const buildTransfersTab = () => {
|
||||||
new MochaUI.Column({
|
new MochaUI.Column({
|
||||||
id: "filtersColumn",
|
id: "filtersColumn",
|
||||||
placement: "left",
|
placement: "left",
|
||||||
|
@ -191,7 +191,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const buildSearchTab = function() {
|
const buildSearchTab = () => {
|
||||||
new MochaUI.Column({
|
new MochaUI.Column({
|
||||||
id: "searchTabColumn",
|
id: "searchTabColumn",
|
||||||
placement: "main",
|
placement: "main",
|
||||||
|
@ -202,7 +202,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
$("searchTabColumn").addClass("invisible");
|
$("searchTabColumn").addClass("invisible");
|
||||||
};
|
};
|
||||||
|
|
||||||
const buildRssTab = function() {
|
const buildRssTab = () => {
|
||||||
new MochaUI.Column({
|
new MochaUI.Column({
|
||||||
id: "rssTabColumn",
|
id: "rssTabColumn",
|
||||||
placement: "main",
|
placement: "main",
|
||||||
|
@ -213,7 +213,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
$("rssTabColumn").addClass("invisible");
|
$("rssTabColumn").addClass("invisible");
|
||||||
};
|
};
|
||||||
|
|
||||||
const buildLogTab = function() {
|
const buildLogTab = () => {
|
||||||
new MochaUI.Column({
|
new MochaUI.Column({
|
||||||
id: "logTabColumn",
|
id: "logTabColumn",
|
||||||
placement: "main",
|
placement: "main",
|
||||||
|
@ -230,7 +230,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
buildLogTab();
|
buildLogTab();
|
||||||
MochaUI.initializeTabs("mainWindowTabsList");
|
MochaUI.initializeTabs("mainWindowTabsList");
|
||||||
|
|
||||||
const handleFilterSelectionChange = function(prevSelectedTorrent, currSelectedTorrent) {
|
const handleFilterSelectionChange = (prevSelectedTorrent, currSelectedTorrent) => {
|
||||||
// clear properties panels when filter changes (e.g. selected torrent is no longer visible)
|
// clear properties panels when filter changes (e.g. selected torrent is no longer visible)
|
||||||
if (prevSelectedTorrent !== currSelectedTorrent) {
|
if (prevSelectedTorrent !== currSelectedTorrent) {
|
||||||
window.qBittorrent.PropGeneral.clear();
|
window.qBittorrent.PropGeneral.clear();
|
||||||
|
@ -241,7 +241,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
setStatusFilter = function(name) {
|
setStatusFilter = (name) => {
|
||||||
const currentHash = torrentsTable.getCurrentTorrentID();
|
const currentHash = torrentsTable.getCurrentTorrentID();
|
||||||
|
|
||||||
LocalPreferences.set("selected_filter", name);
|
LocalPreferences.set("selected_filter", name);
|
||||||
|
@ -253,7 +253,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
handleFilterSelectionChange(currentHash, newHash);
|
handleFilterSelectionChange(currentHash, newHash);
|
||||||
};
|
};
|
||||||
|
|
||||||
setCategoryFilter = function(hash) {
|
setCategoryFilter = (hash) => {
|
||||||
const currentHash = torrentsTable.getCurrentTorrentID();
|
const currentHash = torrentsTable.getCurrentTorrentID();
|
||||||
|
|
||||||
LocalPreferences.set("selected_category", hash);
|
LocalPreferences.set("selected_category", hash);
|
||||||
|
@ -265,7 +265,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
handleFilterSelectionChange(currentHash, newHash);
|
handleFilterSelectionChange(currentHash, newHash);
|
||||||
};
|
};
|
||||||
|
|
||||||
setTagFilter = function(hash) {
|
setTagFilter = (hash) => {
|
||||||
const currentHash = torrentsTable.getCurrentTorrentID();
|
const currentHash = torrentsTable.getCurrentTorrentID();
|
||||||
|
|
||||||
LocalPreferences.set("selected_tag", hash);
|
LocalPreferences.set("selected_tag", hash);
|
||||||
|
@ -277,7 +277,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
handleFilterSelectionChange(currentHash, newHash);
|
handleFilterSelectionChange(currentHash, newHash);
|
||||||
};
|
};
|
||||||
|
|
||||||
setTrackerFilter = function(hash) {
|
setTrackerFilter = (hash) => {
|
||||||
const currentHash = torrentsTable.getCurrentTorrentID();
|
const currentHash = torrentsTable.getCurrentTorrentID();
|
||||||
|
|
||||||
LocalPreferences.set("selected_tracker", hash);
|
LocalPreferences.set("selected_tracker", hash);
|
||||||
|
@ -289,7 +289,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
handleFilterSelectionChange(currentHash, newHash);
|
handleFilterSelectionChange(currentHash, newHash);
|
||||||
};
|
};
|
||||||
|
|
||||||
toggleFilterDisplay = function(filterListID) {
|
toggleFilterDisplay = (filterListID) => {
|
||||||
const filterList = document.getElementById(filterListID);
|
const filterList = document.getElementById(filterListID);
|
||||||
const filterTitle = filterList.previousElementSibling;
|
const filterTitle = filterList.previousElementSibling;
|
||||||
const toggleIcon = filterTitle.firstElementChild;
|
const toggleIcon = filterTitle.firstElementChild;
|
||||||
|
@ -309,7 +309,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
},
|
},
|
||||||
loadMethod: "xhr",
|
loadMethod: "xhr",
|
||||||
contentURL: "views/filters.html",
|
contentURL: "views/filters.html",
|
||||||
onContentLoaded: function() {
|
onContentLoaded: () => {
|
||||||
highlightSelectedStatus();
|
highlightSelectedStatus();
|
||||||
},
|
},
|
||||||
column: "filtersColumn",
|
column: "filtersColumn",
|
||||||
|
@ -354,7 +354,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
let syncMainDataLastResponseId = 0;
|
let syncMainDataLastResponseId = 0;
|
||||||
const serverState = {};
|
const serverState = {};
|
||||||
|
|
||||||
const removeTorrentFromCategoryList = function(hash) {
|
const removeTorrentFromCategoryList = (hash) => {
|
||||||
if (!hash)
|
if (!hash)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
return removed;
|
return removed;
|
||||||
};
|
};
|
||||||
|
|
||||||
const addTorrentToCategoryList = function(torrent) {
|
const addTorrentToCategoryList = (torrent) => {
|
||||||
const category = torrent["category"];
|
const category = torrent["category"];
|
||||||
if (typeof category === "undefined")
|
if (typeof category === "undefined")
|
||||||
return false;
|
return false;
|
||||||
|
@ -395,7 +395,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeTorrentFromTagList = function(hash) {
|
const removeTorrentFromTagList = (hash) => {
|
||||||
if (!hash)
|
if (!hash)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
return removed;
|
return removed;
|
||||||
};
|
};
|
||||||
|
|
||||||
const addTorrentToTagList = function(torrent) {
|
const addTorrentToTagList = (torrent) => {
|
||||||
if (torrent["tags"] === undefined) // Tags haven't changed
|
if (torrent["tags"] === undefined) // Tags haven't changed
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -438,7 +438,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
return added;
|
return added;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateFilter = function(filter, filterTitle) {
|
const updateFilter = (filter, filterTitle) => {
|
||||||
const filterEl = document.getElementById(`${filter}_filter`);
|
const filterEl = document.getElementById(`${filter}_filter`);
|
||||||
const filterTorrentCount = torrentsTable.getFilteredTorrentsNumber(filter, CATEGORIES_ALL, TAGS_ALL, TRACKERS_ALL);
|
const filterTorrentCount = torrentsTable.getFilteredTorrentsNumber(filter, CATEGORIES_ALL, TAGS_ALL, TRACKERS_ALL);
|
||||||
if (useAutoHideZeroStatusFilters) {
|
if (useAutoHideZeroStatusFilters) {
|
||||||
|
@ -449,7 +449,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
filterEl.firstElementChild.lastChild.nodeValue = filterTitle.replace("%1", filterTorrentCount);
|
filterEl.firstElementChild.lastChild.nodeValue = filterTitle.replace("%1", filterTorrentCount);
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateFiltersList = function() {
|
const updateFiltersList = () => {
|
||||||
updateFilter("all", "QBT_TR(All (%1))QBT_TR[CONTEXT=StatusFilterWidget]");
|
updateFilter("all", "QBT_TR(All (%1))QBT_TR[CONTEXT=StatusFilterWidget]");
|
||||||
updateFilter("downloading", "QBT_TR(Downloading (%1))QBT_TR[CONTEXT=StatusFilterWidget]");
|
updateFilter("downloading", "QBT_TR(Downloading (%1))QBT_TR[CONTEXT=StatusFilterWidget]");
|
||||||
updateFilter("seeding", "QBT_TR(Seeding (%1))QBT_TR[CONTEXT=StatusFilterWidget]");
|
updateFilter("seeding", "QBT_TR(Seeding (%1))QBT_TR[CONTEXT=StatusFilterWidget]");
|
||||||
|
@ -466,14 +466,14 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
updateFilter("errored", "QBT_TR(Errored (%1))QBT_TR[CONTEXT=StatusFilterWidget]");
|
updateFilter("errored", "QBT_TR(Errored (%1))QBT_TR[CONTEXT=StatusFilterWidget]");
|
||||||
};
|
};
|
||||||
|
|
||||||
const highlightSelectedStatus = function() {
|
const highlightSelectedStatus = () => {
|
||||||
const statusFilter = document.getElementById("statusFilterList");
|
const statusFilter = document.getElementById("statusFilterList");
|
||||||
const filterID = `${selectedStatus}_filter`;
|
const filterID = `${selectedStatus}_filter`;
|
||||||
for (const status of statusFilter.children)
|
for (const status of statusFilter.children)
|
||||||
status.classList.toggle("selectedFilter", (status.id === filterID));
|
status.classList.toggle("selectedFilter", (status.id === filterID));
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateCategoryList = function() {
|
const updateCategoryList = () => {
|
||||||
const categoryList = document.getElementById("categoryFilterList");
|
const categoryList = document.getElementById("categoryFilterList");
|
||||||
if (!categoryList)
|
if (!categoryList)
|
||||||
return;
|
return;
|
||||||
|
@ -583,7 +583,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
window.qBittorrent.Filters.categoriesFilterContextMenu.searchAndAddTargets();
|
window.qBittorrent.Filters.categoriesFilterContextMenu.searchAndAddTargets();
|
||||||
};
|
};
|
||||||
|
|
||||||
const highlightSelectedCategory = function() {
|
const highlightSelectedCategory = () => {
|
||||||
const categoryList = document.getElementById("categoryFilterList");
|
const categoryList = document.getElementById("categoryFilterList");
|
||||||
if (!categoryList)
|
if (!categoryList)
|
||||||
return;
|
return;
|
||||||
|
@ -592,7 +592,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
category.classList.toggle("selectedFilter", (Number(category.id) === selectedCategory));
|
category.classList.toggle("selectedFilter", (Number(category.id) === selectedCategory));
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateTagList = function() {
|
const updateTagList = () => {
|
||||||
const tagFilterList = $("tagFilterList");
|
const tagFilterList = $("tagFilterList");
|
||||||
if (tagFilterList === null)
|
if (tagFilterList === null)
|
||||||
return;
|
return;
|
||||||
|
@ -601,7 +601,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
|
|
||||||
const tagItemTemplate = document.getElementById("tagFilterItem");
|
const tagItemTemplate = document.getElementById("tagFilterItem");
|
||||||
|
|
||||||
const createLink = function(hash, text, count) {
|
const createLink = (hash, text, count) => {
|
||||||
const tagFilterItem = tagItemTemplate.content.cloneNode(true).firstElementChild;
|
const tagFilterItem = tagItemTemplate.content.cloneNode(true).firstElementChild;
|
||||||
tagFilterItem.id = hash;
|
tagFilterItem.id = hash;
|
||||||
tagFilterItem.classList.toggle("selectedFilter", hash === selectedTag);
|
tagFilterItem.classList.toggle("selectedFilter", hash === selectedTag);
|
||||||
|
@ -635,7 +635,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
window.qBittorrent.Filters.tagsFilterContextMenu.searchAndAddTargets();
|
window.qBittorrent.Filters.tagsFilterContextMenu.searchAndAddTargets();
|
||||||
};
|
};
|
||||||
|
|
||||||
const highlightSelectedTag = function() {
|
const highlightSelectedTag = () => {
|
||||||
const tagFilterList = document.getElementById("tagFilterList");
|
const tagFilterList = document.getElementById("tagFilterList");
|
||||||
if (!tagFilterList)
|
if (!tagFilterList)
|
||||||
return;
|
return;
|
||||||
|
@ -644,7 +644,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
tag.classList.toggle("selectedFilter", (Number(tag.id) === selectedTag));
|
tag.classList.toggle("selectedFilter", (Number(tag.id) === selectedTag));
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateTrackerList = function() {
|
const updateTrackerList = () => {
|
||||||
const trackerFilterList = $("trackerFilterList");
|
const trackerFilterList = $("trackerFilterList");
|
||||||
if (trackerFilterList === null)
|
if (trackerFilterList === null)
|
||||||
return;
|
return;
|
||||||
|
@ -653,7 +653,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
|
|
||||||
const trackerItemTemplate = document.getElementById("trackerFilterItem");
|
const trackerItemTemplate = document.getElementById("trackerFilterItem");
|
||||||
|
|
||||||
const createLink = function(hash, text, count) {
|
const createLink = (hash, text, count) => {
|
||||||
const trackerFilterItem = trackerItemTemplate.content.cloneNode(true).firstElementChild;
|
const trackerFilterItem = trackerItemTemplate.content.cloneNode(true).firstElementChild;
|
||||||
trackerFilterItem.id = hash;
|
trackerFilterItem.id = hash;
|
||||||
trackerFilterItem.classList.toggle("selectedFilter", hash === selectedTracker);
|
trackerFilterItem.classList.toggle("selectedFilter", hash === selectedTracker);
|
||||||
|
@ -695,7 +695,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
window.qBittorrent.Filters.trackersFilterContextMenu.searchAndAddTargets();
|
window.qBittorrent.Filters.trackersFilterContextMenu.searchAndAddTargets();
|
||||||
};
|
};
|
||||||
|
|
||||||
const highlightSelectedTracker = function() {
|
const highlightSelectedTracker = () => {
|
||||||
const trackerFilterList = document.getElementById("trackerFilterList");
|
const trackerFilterList = document.getElementById("trackerFilterList");
|
||||||
if (!trackerFilterList)
|
if (!trackerFilterList)
|
||||||
return;
|
return;
|
||||||
|
@ -728,21 +728,21 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
|
|
||||||
let syncMainDataTimeoutID = -1;
|
let syncMainDataTimeoutID = -1;
|
||||||
let syncRequestInProgress = false;
|
let syncRequestInProgress = false;
|
||||||
const syncMainData = function() {
|
const syncMainData = () => {
|
||||||
const url = new URI("api/v2/sync/maindata");
|
const url = new URI("api/v2/sync/maindata");
|
||||||
url.setData("rid", syncMainDataLastResponseId);
|
url.setData("rid", syncMainDataLastResponseId);
|
||||||
const request = new Request.JSON({
|
const request = new Request.JSON({
|
||||||
url: url,
|
url: url,
|
||||||
noCache: true,
|
noCache: true,
|
||||||
method: "get",
|
method: "get",
|
||||||
onFailure: function() {
|
onFailure: () => {
|
||||||
const errorDiv = $("error_div");
|
const errorDiv = $("error_div");
|
||||||
if (errorDiv)
|
if (errorDiv)
|
||||||
errorDiv.textContent = "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: (response) => {
|
||||||
$("error_div").textContent = "";
|
$("error_div").textContent = "";
|
||||||
if (response) {
|
if (response) {
|
||||||
clearTimeout(torrentsFilterInputTimer);
|
clearTimeout(torrentsFilterInputTimer);
|
||||||
|
@ -909,12 +909,12 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
request.send();
|
request.send();
|
||||||
};
|
};
|
||||||
|
|
||||||
updateMainData = function() {
|
updateMainData = () => {
|
||||||
torrentsTable.updateTable();
|
torrentsTable.updateTable();
|
||||||
syncData(100);
|
syncData(100);
|
||||||
};
|
};
|
||||||
|
|
||||||
const syncData = function(delay) {
|
const syncData = (delay) => {
|
||||||
if (syncRequestInProgress)
|
if (syncRequestInProgress)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -927,7 +927,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
syncMainDataTimeoutID = syncMainData.delay(delay);
|
syncMainDataTimeoutID = syncMainData.delay(delay);
|
||||||
};
|
};
|
||||||
|
|
||||||
const processServerState = function() {
|
const processServerState = () => {
|
||||||
let transfer_info = window.qBittorrent.Misc.friendlyUnit(serverState.dl_info_speed, true);
|
let transfer_info = window.qBittorrent.Misc.friendlyUnit(serverState.dl_info_speed, true);
|
||||||
if (serverState.dl_rate_limit > 0)
|
if (serverState.dl_rate_limit > 0)
|
||||||
transfer_info += " [" + window.qBittorrent.Misc.friendlyUnit(serverState.dl_rate_limit, true) + "]";
|
transfer_info += " [" + window.qBittorrent.Misc.friendlyUnit(serverState.dl_rate_limit, true) + "]";
|
||||||
|
@ -1028,7 +1028,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
serverSyncMainDataInterval = Math.max(serverState.refresh_interval, 500);
|
serverSyncMainDataInterval = Math.max(serverState.refresh_interval, 500);
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateAltSpeedIcon = function(enabled) {
|
const updateAltSpeedIcon = (enabled) => {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
$("alternativeSpeedLimits").src = "images/slow.svg";
|
$("alternativeSpeedLimits").src = "images/slow.svg";
|
||||||
$("alternativeSpeedLimits").alt = "QBT_TR(Alternative speed limits: On)QBT_TR[CONTEXT=MainWindow]";
|
$("alternativeSpeedLimits").alt = "QBT_TR(Alternative speed limits: On)QBT_TR[CONTEXT=MainWindow]";
|
||||||
|
@ -1048,11 +1048,11 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
new Request({
|
new Request({
|
||||||
url: "api/v2/transfer/toggleSpeedLimitsMode",
|
url: "api/v2/transfer/toggleSpeedLimitsMode",
|
||||||
method: "post",
|
method: "post",
|
||||||
onComplete: function() {
|
onComplete: () => {
|
||||||
alternativeSpeedLimits = !alternativeSpeedLimits;
|
alternativeSpeedLimits = !alternativeSpeedLimits;
|
||||||
updateMainData();
|
updateMainData();
|
||||||
},
|
},
|
||||||
onFailure: function() {
|
onFailure: () => {
|
||||||
// Restore icon in case of failure
|
// Restore icon in case of failure
|
||||||
updateAltSpeedIcon(alternativeSpeedLimits);
|
updateAltSpeedIcon(alternativeSpeedLimits);
|
||||||
}
|
}
|
||||||
|
@ -1090,7 +1090,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
MochaUI.Desktop.setDesktopSize();
|
MochaUI.Desktop.setDesktopSize();
|
||||||
});
|
});
|
||||||
|
|
||||||
const registerMagnetHandler = function() {
|
const registerMagnetHandler = () => {
|
||||||
if (typeof navigator.registerProtocolHandler !== "function") {
|
if (typeof navigator.registerProtocolHandler !== "function") {
|
||||||
if (window.location.protocol !== "https:")
|
if (window.location.protocol !== "https:")
|
||||||
alert("QBT_TR(To use this feature, the WebUI needs to be accessed over HTTPS)QBT_TR[CONTEXT=MainWindow]");
|
alert("QBT_TR(To use this feature, the WebUI needs to be accessed over HTTPS)QBT_TR[CONTEXT=MainWindow]");
|
||||||
|
@ -1158,7 +1158,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
updateTabDisplay();
|
updateTabDisplay();
|
||||||
});
|
});
|
||||||
|
|
||||||
const updateTabDisplay = function() {
|
const updateTabDisplay = () => {
|
||||||
if (window.qBittorrent.Client.isShowRssReader()) {
|
if (window.qBittorrent.Client.isShowRssReader()) {
|
||||||
$("showRssReaderLink").firstChild.style.opacity = "1";
|
$("showRssReaderLink").firstChild.style.opacity = "1";
|
||||||
$("mainWindowTabs").removeClass("invisible");
|
$("mainWindowTabs").removeClass("invisible");
|
||||||
|
@ -1210,7 +1210,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
|
|
||||||
// main window tabs
|
// main window tabs
|
||||||
|
|
||||||
const showTransfersTab = function() {
|
const showTransfersTab = () => {
|
||||||
const showFiltersSidebar = LocalPreferences.get("show_filters_sidebar", "true") === "true";
|
const showFiltersSidebar = LocalPreferences.get("show_filters_sidebar", "true") === "true";
|
||||||
if (showFiltersSidebar) {
|
if (showFiltersSidebar) {
|
||||||
$("filtersColumn").removeClass("invisible");
|
$("filtersColumn").removeClass("invisible");
|
||||||
|
@ -1229,7 +1229,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
LocalPreferences.set("selected_window_tab", "transfers");
|
LocalPreferences.set("selected_window_tab", "transfers");
|
||||||
};
|
};
|
||||||
|
|
||||||
const hideTransfersTab = function() {
|
const hideTransfersTab = () => {
|
||||||
$("filtersColumn").addClass("invisible");
|
$("filtersColumn").addClass("invisible");
|
||||||
$("filtersColumn_handle").addClass("invisible");
|
$("filtersColumn_handle").addClass("invisible");
|
||||||
$("mainColumn").addClass("invisible");
|
$("mainColumn").addClass("invisible");
|
||||||
|
@ -1237,7 +1237,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
MochaUI.Desktop.resizePanels();
|
MochaUI.Desktop.resizePanels();
|
||||||
};
|
};
|
||||||
|
|
||||||
const showSearchTab = (function() {
|
const showSearchTab = (() => {
|
||||||
let searchTabInitialized = false;
|
let searchTabInitialized = false;
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
@ -1266,12 +1266,12 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
const hideSearchTab = function() {
|
const hideSearchTab = () => {
|
||||||
$("searchTabColumn").addClass("invisible");
|
$("searchTabColumn").addClass("invisible");
|
||||||
MochaUI.Desktop.resizePanels();
|
MochaUI.Desktop.resizePanels();
|
||||||
};
|
};
|
||||||
|
|
||||||
const showRssTab = (function() {
|
const showRssTab = (() => {
|
||||||
let rssTabInitialized = false;
|
let rssTabInitialized = false;
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
@ -1303,13 +1303,13 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
const hideRssTab = function() {
|
const hideRssTab = () => {
|
||||||
$("rssTabColumn").addClass("invisible");
|
$("rssTabColumn").addClass("invisible");
|
||||||
window.qBittorrent.Rss && window.qBittorrent.Rss.unload();
|
window.qBittorrent.Rss && window.qBittorrent.Rss.unload();
|
||||||
MochaUI.Desktop.resizePanels();
|
MochaUI.Desktop.resizePanels();
|
||||||
};
|
};
|
||||||
|
|
||||||
const showLogTab = (function() {
|
const showLogTab = (() => {
|
||||||
let logTabInitialized = false;
|
let logTabInitialized = false;
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
@ -1341,13 +1341,13 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
const hideLogTab = function() {
|
const hideLogTab = () => {
|
||||||
$("logTabColumn").addClass("invisible");
|
$("logTabColumn").addClass("invisible");
|
||||||
MochaUI.Desktop.resizePanels();
|
MochaUI.Desktop.resizePanels();
|
||||||
window.qBittorrent.Log && window.qBittorrent.Log.unload();
|
window.qBittorrent.Log && window.qBittorrent.Log.unload();
|
||||||
};
|
};
|
||||||
|
|
||||||
const addSearchPanel = function() {
|
const addSearchPanel = () => {
|
||||||
new MochaUI.Panel({
|
new MochaUI.Panel({
|
||||||
id: "SearchPanel",
|
id: "SearchPanel",
|
||||||
title: "Search",
|
title: "Search",
|
||||||
|
@ -1372,7 +1372,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const addRssPanel = function() {
|
const addRssPanel = () => {
|
||||||
new MochaUI.Panel({
|
new MochaUI.Panel({
|
||||||
id: "RssPanel",
|
id: "RssPanel",
|
||||||
title: "Rss",
|
title: "Rss",
|
||||||
|
@ -1394,7 +1394,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const addLogPanel = function() {
|
const addLogPanel = () => {
|
||||||
new MochaUI.Panel({
|
new MochaUI.Panel({
|
||||||
id: "LogPanel",
|
id: "LogPanel",
|
||||||
title: "Log",
|
title: "Log",
|
||||||
|
@ -1415,7 +1415,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
tabsURL: "views/logTabs.html",
|
tabsURL: "views/logTabs.html",
|
||||||
tabsOnload: function() {
|
tabsOnload: () => {
|
||||||
MochaUI.initializeTabs("panelTabs");
|
MochaUI.initializeTabs("panelTabs");
|
||||||
|
|
||||||
$("logMessageLink").addEventListener("click", (e) => {
|
$("logMessageLink").addEventListener("click", (e) => {
|
||||||
|
@ -1433,7 +1433,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDownloadParam = function() {
|
const handleDownloadParam = () => {
|
||||||
// Extract torrent URL from download param in WebUI URL hash
|
// Extract torrent URL from download param in WebUI URL hash
|
||||||
const downloadHash = "#download=";
|
const downloadHash = "#download=";
|
||||||
if (location.hash.indexOf(downloadHash) !== 0)
|
if (location.hash.indexOf(downloadHash) !== 0)
|
||||||
|
@ -1457,7 +1457,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
},
|
},
|
||||||
loadMethod: "xhr",
|
loadMethod: "xhr",
|
||||||
contentURL: "views/transferlist.html",
|
contentURL: "views/transferlist.html",
|
||||||
onContentLoaded: function() {
|
onContentLoaded: () => {
|
||||||
handleDownloadParam();
|
handleDownloadParam();
|
||||||
updateMainData();
|
updateMainData();
|
||||||
},
|
},
|
||||||
|
@ -1484,8 +1484,8 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
contentURL: "views/properties.html",
|
contentURL: "views/properties.html",
|
||||||
require: {
|
require: {
|
||||||
js: ["scripts/prop-general.js", "scripts/prop-trackers.js", "scripts/prop-peers.js", "scripts/prop-webseeds.js", "scripts/prop-files.js"],
|
js: ["scripts/prop-general.js", "scripts/prop-trackers.js", "scripts/prop-peers.js", "scripts/prop-webseeds.js", "scripts/prop-files.js"],
|
||||||
onload: function() {
|
onload: () => {
|
||||||
updatePropertiesPanel = function() {
|
updatePropertiesPanel = () => {
|
||||||
switch (LocalPreferences.get("selected_properties_tab")) {
|
switch (LocalPreferences.get("selected_properties_tab")) {
|
||||||
case "propGeneralLink":
|
case "propGeneralLink":
|
||||||
window.qBittorrent.PropGeneral.updateData();
|
window.qBittorrent.PropGeneral.updateData();
|
||||||
|
@ -1507,7 +1507,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
tabsURL: "views/propertiesToolbar.html",
|
tabsURL: "views/propertiesToolbar.html",
|
||||||
tabsOnload: function() {}, // must be included, otherwise panel won't load properly
|
tabsOnload: () => {}, // must be included, otherwise panel won't load properly
|
||||||
onContentLoaded: function() {
|
onContentLoaded: function() {
|
||||||
this.panelHeaderCollapseBoxEl.classList.add("invisible");
|
this.panelHeaderCollapseBoxEl.classList.add("invisible");
|
||||||
|
|
||||||
|
@ -1703,7 +1703,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
}).activate();
|
}).activate();
|
||||||
|
|
||||||
new ClipboardJS(".copyToClipboard", {
|
new ClipboardJS(".copyToClipboard", {
|
||||||
text: function(trigger) {
|
text: (trigger) => {
|
||||||
switch (trigger.id) {
|
switch (trigger.id) {
|
||||||
case "copyName":
|
case "copyName":
|
||||||
return copyNameFN();
|
return copyNameFN();
|
||||||
|
|
|
@ -642,7 +642,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||||
|
|
||||||
class SearchPluginsTableContextMenu extends ContextMenu {
|
class SearchPluginsTableContextMenu extends ContextMenu {
|
||||||
updateMenuItems() {
|
updateMenuItems() {
|
||||||
const enabledColumnIndex = function(text) {
|
const enabledColumnIndex = (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].textContent === "Enabled")
|
if (columns[i].textContent === "Enabled")
|
||||||
|
|
|
@ -35,12 +35,12 @@ window.qBittorrent.Download ??= (() => {
|
||||||
let categories = {};
|
let categories = {};
|
||||||
let defaultSavePath = "";
|
let defaultSavePath = "";
|
||||||
|
|
||||||
const getCategories = function() {
|
const getCategories = () => {
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: "api/v2/torrents/categories",
|
url: "api/v2/torrents/categories",
|
||||||
method: "get",
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onSuccess: function(data) {
|
onSuccess: (data) => {
|
||||||
if (data) {
|
if (data) {
|
||||||
categories = data;
|
categories = data;
|
||||||
for (const i in data) {
|
for (const i in data) {
|
||||||
|
@ -58,7 +58,7 @@ window.qBittorrent.Download ??= (() => {
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const getPreferences = function() {
|
const getPreferences = () => {
|
||||||
const pref = window.parent.qBittorrent.Cache.preferences.get();
|
const pref = window.parent.qBittorrent.Cache.preferences.get();
|
||||||
|
|
||||||
defaultSavePath = pref.save_path;
|
defaultSavePath = pref.save_path;
|
||||||
|
@ -89,7 +89,7 @@ window.qBittorrent.Download ??= (() => {
|
||||||
$("contentLayout").selectedIndex = 0;
|
$("contentLayout").selectedIndex = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeCategorySelect = function(item) {
|
const changeCategorySelect = (item) => {
|
||||||
if (item.value === "\\other") {
|
if (item.value === "\\other") {
|
||||||
item.nextElementSibling.hidden = false;
|
item.nextElementSibling.hidden = false;
|
||||||
item.nextElementSibling.value = "";
|
item.nextElementSibling.value = "";
|
||||||
|
@ -114,7 +114,7 @@ window.qBittorrent.Download ??= (() => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeTMM = function(item) {
|
const changeTMM = (item) => {
|
||||||
if (item.selectedIndex === 1) {
|
if (item.selectedIndex === 1) {
|
||||||
$("savepath").disabled = true;
|
$("savepath").disabled = true;
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
|
|
||||||
const DynamicTable = new Class({
|
const DynamicTable = new Class({
|
||||||
|
|
||||||
initialize: function() {},
|
initialize: () => {},
|
||||||
|
|
||||||
setup: function(dynamicTableDivId, dynamicTableFixedHeaderDivId, contextMenu) {
|
setup: function(dynamicTableDivId, dynamicTableFixedHeaderDivId, contextMenu) {
|
||||||
this.dynamicTableDivId = dynamicTableDivId;
|
this.dynamicTableDivId = dynamicTableDivId;
|
||||||
|
@ -133,7 +133,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
this.currentHeaderAction = "";
|
this.currentHeaderAction = "";
|
||||||
this.canResize = false;
|
this.canResize = false;
|
||||||
|
|
||||||
const resetElementBorderStyle = function(el, side) {
|
const resetElementBorderStyle = (el, side) => {
|
||||||
if ((side === "left") || (side !== "right"))
|
if ((side === "left") || (side !== "right"))
|
||||||
el.style.borderLeft = "";
|
el.style.borderLeft = "";
|
||||||
if ((side === "right") || (side !== "left"))
|
if ((side === "right") || (side !== "left"))
|
||||||
|
@ -197,9 +197,9 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
this.lastClientX = e.clientX;
|
this.lastClientX = e.clientX;
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
const mouseOutFn = function(e) {
|
const mouseOutFn = (e) => {
|
||||||
resetElementBorderStyle(e.target);
|
resetElementBorderStyle(e.target);
|
||||||
}.bind(this);
|
};
|
||||||
|
|
||||||
const onBeforeStart = function(el) {
|
const onBeforeStart = function(el) {
|
||||||
this.clickedTh = el;
|
this.clickedTh = el;
|
||||||
|
@ -392,7 +392,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
class: "contextMenu scrollableMenu"
|
class: "contextMenu scrollableMenu"
|
||||||
});
|
});
|
||||||
|
|
||||||
const createLi = function(columnName, text) {
|
const createLi = (columnName, text) => {
|
||||||
const anchor = document.createElement("a");
|
const anchor = document.createElement("a");
|
||||||
anchor.href = `#${columnName}`;
|
anchor.href = `#${columnName}`;
|
||||||
anchor.textContent = text;
|
anchor.textContent = text;
|
||||||
|
@ -436,7 +436,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
actions[this.columns[i].name] = onMenuItemClicked;
|
actions[this.columns[i].name] = onMenuItemClicked;
|
||||||
}
|
}
|
||||||
|
|
||||||
const createResizeElement = function(text, href) {
|
const createResizeElement = (text, href) => {
|
||||||
const anchor = document.createElement("a");
|
const anchor = document.createElement("a");
|
||||||
anchor.href = href;
|
anchor.href = href;
|
||||||
anchor.textContent = text;
|
anchor.textContent = text;
|
||||||
|
@ -471,7 +471,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
this.headerContextMenu.dynamicTable = this;
|
this.headerContextMenu.dynamicTable = this;
|
||||||
},
|
},
|
||||||
|
|
||||||
initColumns: function() {},
|
initColumns: () => {},
|
||||||
|
|
||||||
newColumn: function(name, style, caption, defaultWidth, defaultVisible) {
|
newColumn: function(name, style, caption, defaultWidth, defaultVisible) {
|
||||||
const column = {};
|
const column = {};
|
||||||
|
@ -623,7 +623,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
},
|
},
|
||||||
|
|
||||||
setSortedColumnIcon: function(newColumn, oldColumn, isReverse) {
|
setSortedColumnIcon: function(newColumn, oldColumn, isReverse) {
|
||||||
const getCol = function(headerDivId, colName) {
|
const getCol = (headerDivId, colName) => {
|
||||||
const colElem = $$("#" + headerDivId + " .column_" + colName);
|
const colElem = $$("#" + headerDivId + " .column_" + colName);
|
||||||
if (colElem.length === 1)
|
if (colElem.length === 1)
|
||||||
return colElem[0];
|
return colElem[0];
|
||||||
|
@ -730,7 +730,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelectedRowChanged: function() {},
|
onSelectedRowChanged: () => {},
|
||||||
|
|
||||||
updateRowData: function(data) {
|
updateRowData: function(data) {
|
||||||
// ensure rowId is a string
|
// ensure rowId is a string
|
||||||
|
@ -908,7 +908,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
trs.pop().destroy();
|
trs.pop().destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
setupTr: function(tr) {},
|
setupTr: (tr) => {},
|
||||||
|
|
||||||
updateRow: function(tr, fullUpdate) {
|
updateRow: function(tr, fullUpdate) {
|
||||||
const row = this.rows.get(tr.rowId);
|
const row = this.rows.get(tr.rowId);
|
||||||
|
@ -1200,7 +1200,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
td.title = status;
|
td.title = status;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.columns["status"].compareRows = function(row1, row2) {
|
this.columns["status"].compareRows = (row1, row2) => {
|
||||||
return compareNumbers(row1.full_data._statusOrder, row2.full_data._statusOrder);
|
return compareNumbers(row1.full_data._statusOrder, row2.full_data._statusOrder);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1470,7 +1470,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
applyFilter: function(row, filterName, categoryHash, tagHash, trackerHash, filterTerms) {
|
applyFilter: (row, filterName, categoryHash, tagHash, trackerHash, filterTerms) => {
|
||||||
const state = row["full_data"].state;
|
const state = row["full_data"].state;
|
||||||
let inactive = false;
|
let inactive = false;
|
||||||
|
|
||||||
|
@ -1716,7 +1716,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
return this.getSelectedRowId();
|
return this.getSelectedRowId();
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelectedRowChanged: function() {
|
onSelectedRowChanged: () => {
|
||||||
updatePropertiesPanel();
|
updatePropertiesPanel();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1875,7 +1875,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
},
|
},
|
||||||
|
|
||||||
getFilteredAndSortedRows: function() {
|
getFilteredAndSortedRows: function() {
|
||||||
const getSizeFilters = function() {
|
const getSizeFilters = () => {
|
||||||
let minSize = (window.qBittorrent.Search.searchSizeFilter.min > 0.00) ? (window.qBittorrent.Search.searchSizeFilter.min * Math.pow(1024, window.qBittorrent.Search.searchSizeFilter.minUnit)) : 0.00;
|
let minSize = (window.qBittorrent.Search.searchSizeFilter.min > 0.00) ? (window.qBittorrent.Search.searchSizeFilter.min * Math.pow(1024, window.qBittorrent.Search.searchSizeFilter.minUnit)) : 0.00;
|
||||||
let maxSize = (window.qBittorrent.Search.searchSizeFilter.max > 0.00) ? (window.qBittorrent.Search.searchSizeFilter.max * Math.pow(1024, window.qBittorrent.Search.searchSizeFilter.maxUnit)) : 0.00;
|
let maxSize = (window.qBittorrent.Search.searchSizeFilter.max > 0.00) ? (window.qBittorrent.Search.searchSizeFilter.max * Math.pow(1024, window.qBittorrent.Search.searchSizeFilter.maxUnit)) : 0.00;
|
||||||
|
|
||||||
|
@ -1891,7 +1891,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSeedsFilters = function() {
|
const getSeedsFilters = () => {
|
||||||
let minSeeds = (window.qBittorrent.Search.searchSeedsFilter.min > 0) ? window.qBittorrent.Search.searchSeedsFilter.min : 0;
|
let minSeeds = (window.qBittorrent.Search.searchSeedsFilter.min > 0) ? window.qBittorrent.Search.searchSeedsFilter.min : 0;
|
||||||
let maxSeeds = (window.qBittorrent.Search.searchSeedsFilter.max > 0) ? window.qBittorrent.Search.searchSeedsFilter.max : 0;
|
let maxSeeds = (window.qBittorrent.Search.searchSeedsFilter.max > 0) ? window.qBittorrent.Search.searchSeedsFilter.max : 0;
|
||||||
|
|
||||||
|
@ -1949,7 +1949,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
return filteredRows;
|
return filteredRows;
|
||||||
},
|
},
|
||||||
|
|
||||||
setupTr: function(tr) {
|
setupTr: (tr) => {
|
||||||
tr.addClass("searchTableRow");
|
tr.addClass("searchTableRow");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1984,7 +1984,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
setupTr: function(tr) {
|
setupTr: (tr) => {
|
||||||
tr.addClass("searchPluginsTableRow");
|
tr.addClass("searchPluginsTableRow");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -2174,17 +2174,17 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
this.toggleNodeTreeCheckbox(node.children[i].rowId, checkState);
|
this.toggleNodeTreeCheckbox(node.children[i].rowId, checkState);
|
||||||
},
|
},
|
||||||
|
|
||||||
updateGlobalCheckbox: function() {
|
updateGlobalCheckbox: () => {
|
||||||
const checkbox = $("rootMultiRename_cb");
|
const checkbox = $("rootMultiRename_cb");
|
||||||
const checkboxes = $$("input.RenamingCB");
|
const checkboxes = $$("input.RenamingCB");
|
||||||
const isAllChecked = function() {
|
const isAllChecked = () => {
|
||||||
for (let i = 0; i < checkboxes.length; ++i) {
|
for (let i = 0; i < checkboxes.length; ++i) {
|
||||||
if (!checkboxes[i].checked)
|
if (!checkboxes[i].checked)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
const isAllUnchecked = function() {
|
const isAllUnchecked = () => {
|
||||||
for (let i = 0; i < checkboxes.length; ++i) {
|
for (let i = 0; i < checkboxes.length; ++i) {
|
||||||
if (checkboxes[i].checked)
|
if (checkboxes[i].checked)
|
||||||
return false;
|
return false;
|
||||||
|
@ -2300,9 +2300,9 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
onRowSelectionChange: function(row) {},
|
onRowSelectionChange: (row) => {},
|
||||||
|
|
||||||
selectRow: function() {
|
selectRow: () => {
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2618,7 +2618,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
td.replaceChildren(span);
|
td.replaceChildren(span);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.columns["name"].calculateBuffer = function(rowId) {
|
this.columns["name"].calculateBuffer = (rowId) => {
|
||||||
const node = that.getNode(rowId);
|
const node = that.getNode(rowId);
|
||||||
// folders add 20px for folder icon and 15px for collapse icon
|
// folders add 20px for folder icon and 15px for collapse icon
|
||||||
const folderBuffer = node.isFolder ? 35 : 0;
|
const folderBuffer = node.isFolder ? 35 : 0;
|
||||||
|
@ -2814,8 +2814,8 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
td.title = value;
|
td.title = value;
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
setupHeaderMenu: function() {},
|
setupHeaderMenu: () => {},
|
||||||
setupHeaderEvents: function() {},
|
setupHeaderEvents: () => {},
|
||||||
getFilteredAndSortedRows: function() {
|
getFilteredAndSortedRows: function() {
|
||||||
return [...this.getRowValues()];
|
return [...this.getRowValues()];
|
||||||
},
|
},
|
||||||
|
@ -2944,8 +2944,8 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
initColumns: function() {
|
initColumns: function() {
|
||||||
this.newColumn("name", "", "QBT_TR(Torrents: (double-click to download))QBT_TR[CONTEXT=RSSWidget]", -1, true);
|
this.newColumn("name", "", "QBT_TR(Torrents: (double-click to download))QBT_TR[CONTEXT=RSSWidget]", -1, true);
|
||||||
},
|
},
|
||||||
setupHeaderMenu: function() {},
|
setupHeaderMenu: () => {},
|
||||||
setupHeaderEvents: function() {},
|
setupHeaderEvents: () => {},
|
||||||
getFilteredAndSortedRows: function() {
|
getFilteredAndSortedRows: function() {
|
||||||
return [...this.getRowValues()];
|
return [...this.getRowValues()];
|
||||||
},
|
},
|
||||||
|
@ -3056,8 +3056,8 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
};
|
};
|
||||||
this.columns["checked"].staticWidth = 50;
|
this.columns["checked"].staticWidth = 50;
|
||||||
},
|
},
|
||||||
setupHeaderMenu: function() {},
|
setupHeaderMenu: () => {},
|
||||||
setupHeaderEvents: function() {},
|
setupHeaderEvents: () => {},
|
||||||
getFilteredAndSortedRows: function() {
|
getFilteredAndSortedRows: function() {
|
||||||
return [...this.getRowValues()];
|
return [...this.getRowValues()];
|
||||||
},
|
},
|
||||||
|
@ -3148,8 +3148,8 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
};
|
};
|
||||||
this.columns["checked"].staticWidth = 50;
|
this.columns["checked"].staticWidth = 50;
|
||||||
},
|
},
|
||||||
setupHeaderMenu: function() {},
|
setupHeaderMenu: () => {},
|
||||||
setupHeaderEvents: function() {},
|
setupHeaderEvents: () => {},
|
||||||
getFilteredAndSortedRows: function() {
|
getFilteredAndSortedRows: function() {
|
||||||
return [...this.getRowValues()];
|
return [...this.getRowValues()];
|
||||||
},
|
},
|
||||||
|
@ -3189,7 +3189,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
this.hiddenTableHeader.appendChild(new Element("th"));
|
this.hiddenTableHeader.appendChild(new Element("th"));
|
||||||
this.fixedTableHeader.appendChild(new Element("th"));
|
this.fixedTableHeader.appendChild(new Element("th"));
|
||||||
},
|
},
|
||||||
selectRow: function() {}
|
selectRow: () => {}
|
||||||
});
|
});
|
||||||
|
|
||||||
const RssDownloaderArticlesTable = new Class({
|
const RssDownloaderArticlesTable = new Class({
|
||||||
|
@ -3197,8 +3197,8 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
initColumns: function() {
|
initColumns: function() {
|
||||||
this.newColumn("name", "", "", -1, true);
|
this.newColumn("name", "", "", -1, true);
|
||||||
},
|
},
|
||||||
setupHeaderMenu: function() {},
|
setupHeaderMenu: () => {},
|
||||||
setupHeaderEvents: function() {},
|
setupHeaderEvents: () => {},
|
||||||
getFilteredAndSortedRows: function() {
|
getFilteredAndSortedRows: function() {
|
||||||
return [...this.getRowValues()];
|
return [...this.getRowValues()];
|
||||||
},
|
},
|
||||||
|
@ -3238,7 +3238,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
this.hiddenTableHeader.appendChild(new Element("th"));
|
this.hiddenTableHeader.appendChild(new Element("th"));
|
||||||
this.fixedTableHeader.appendChild(new Element("th"));
|
this.fixedTableHeader.appendChild(new Element("th"));
|
||||||
},
|
},
|
||||||
selectRow: function() {},
|
selectRow: () => {},
|
||||||
updateRow: function(tr, fullUpdate) {
|
updateRow: function(tr, fullUpdate) {
|
||||||
const row = this.rows.get(tr.rowId);
|
const row = this.rows.get(tr.rowId);
|
||||||
const data = row[fullUpdate ? "full_data" : "data"];
|
const data = row[fullUpdate ? "full_data" : "data"];
|
||||||
|
@ -3343,9 +3343,9 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
return filteredRows;
|
return filteredRows;
|
||||||
},
|
},
|
||||||
|
|
||||||
setupCommonEvents: function() {},
|
setupCommonEvents: () => {},
|
||||||
|
|
||||||
setupTr: function(tr) {
|
setupTr: (tr) => {
|
||||||
tr.addClass("logTableRow");
|
tr.addClass("logTableRow");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -88,7 +88,7 @@ window.qBittorrent.FileTree ??= (() => {
|
||||||
: this.nodeMap[rowId];
|
: this.nodeMap[rowId];
|
||||||
},
|
},
|
||||||
|
|
||||||
getRowId: function(node) {
|
getRowId: (node) => {
|
||||||
return node.rowId;
|
return node.rowId;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -46,21 +46,21 @@ window.qBittorrent.Filesystem ??= (() => {
|
||||||
/**
|
/**
|
||||||
* Returns the file extension part of a file name.
|
* Returns the file extension part of a file name.
|
||||||
*/
|
*/
|
||||||
const fileExtension = function(filename) {
|
const fileExtension = (filename) => {
|
||||||
const pointIndex = filename.lastIndexOf(".");
|
const pointIndex = filename.lastIndexOf(".");
|
||||||
if (pointIndex === -1)
|
if (pointIndex === -1)
|
||||||
return "";
|
return "";
|
||||||
return filename.substring(pointIndex + 1);
|
return filename.substring(pointIndex + 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
const fileName = function(filepath) {
|
const fileName = (filepath) => {
|
||||||
const slashIndex = filepath.lastIndexOf(PathSeparator);
|
const slashIndex = filepath.lastIndexOf(PathSeparator);
|
||||||
if (slashIndex === -1)
|
if (slashIndex === -1)
|
||||||
return filepath;
|
return filepath;
|
||||||
return filepath.substring(slashIndex + 1);
|
return filepath.substring(slashIndex + 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
const folderName = function(filepath) {
|
const folderName = (filepath) => {
|
||||||
const slashIndex = filepath.lastIndexOf(PathSeparator);
|
const slashIndex = filepath.lastIndexOf(PathSeparator);
|
||||||
if (slashIndex === -1)
|
if (slashIndex === -1)
|
||||||
return "";
|
return "";
|
||||||
|
|
|
@ -37,14 +37,14 @@ window.qBittorrent.LocalPreferences ??= (() => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const LocalPreferencesClass = new Class({
|
const LocalPreferencesClass = new Class({
|
||||||
get: function(key, defaultValue) {
|
get: (key, defaultValue) => {
|
||||||
const value = localStorage.getItem(key);
|
const value = localStorage.getItem(key);
|
||||||
return ((value === null) && (defaultValue !== undefined))
|
return ((value === null) && (defaultValue !== undefined))
|
||||||
? defaultValue
|
? defaultValue
|
||||||
: value;
|
: value;
|
||||||
},
|
},
|
||||||
|
|
||||||
set: function(key, value) {
|
set: (key, value) => {
|
||||||
try {
|
try {
|
||||||
localStorage.setItem(key, value);
|
localStorage.setItem(key, value);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ window.qBittorrent.LocalPreferences ??= (() => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
remove: function(key) {
|
remove: (key) => {
|
||||||
try {
|
try {
|
||||||
localStorage.removeItem(key);
|
localStorage.removeItem(key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ window.qBittorrent.Misc ??= (() => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const genHash = function(string) {
|
const genHash = (string) => {
|
||||||
// origins:
|
// origins:
|
||||||
// https://stackoverflow.com/a/8831937
|
// https://stackoverflow.com/a/8831937
|
||||||
// https://gist.github.com/hyamamoto/fd435505d29ebfa3d9716fd2be8d42f0
|
// https://gist.github.com/hyamamoto/fd435505d29ebfa3d9716fd2be8d42f0
|
||||||
|
@ -64,7 +64,7 @@ window.qBittorrent.Misc ??= (() => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// getHost emulate the GUI version `QString getHost(const QString &url)`
|
// getHost emulate the GUI version `QString getHost(const QString &url)`
|
||||||
const getHost = function(url) {
|
const getHost = (url) => {
|
||||||
// We want the hostname.
|
// We want the hostname.
|
||||||
// If failed to parse the domain, original input should be returned
|
// If failed to parse the domain, original input should be returned
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ window.qBittorrent.Misc ??= (() => {
|
||||||
/*
|
/*
|
||||||
* JS counterpart of the function in src/misc.cpp
|
* JS counterpart of the function in src/misc.cpp
|
||||||
*/
|
*/
|
||||||
const friendlyUnit = function(value, isSpeed) {
|
const friendlyUnit = (value, isSpeed) => {
|
||||||
const units = [
|
const units = [
|
||||||
"QBT_TR(B)QBT_TR[CONTEXT=misc]",
|
"QBT_TR(B)QBT_TR[CONTEXT=misc]",
|
||||||
"QBT_TR(KiB)QBT_TR[CONTEXT=misc]",
|
"QBT_TR(KiB)QBT_TR[CONTEXT=misc]",
|
||||||
|
@ -122,14 +122,14 @@ window.qBittorrent.Misc ??= (() => {
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
function friendlyUnitPrecision(sizeUnit) {
|
const friendlyUnitPrecision = (sizeUnit) => {
|
||||||
if (sizeUnit <= 2) // KiB, MiB
|
if (sizeUnit <= 2) // KiB, MiB
|
||||||
return 1;
|
return 1;
|
||||||
else if (sizeUnit === 3) // GiB
|
else if (sizeUnit === 3) // GiB
|
||||||
return 2;
|
return 2;
|
||||||
else // TiB, PiB, EiB
|
else // TiB, PiB, EiB
|
||||||
return 3;
|
return 3;
|
||||||
}
|
};
|
||||||
|
|
||||||
let ret;
|
let ret;
|
||||||
if (i === 0) {
|
if (i === 0) {
|
||||||
|
@ -150,7 +150,7 @@ window.qBittorrent.Misc ??= (() => {
|
||||||
/*
|
/*
|
||||||
* JS counterpart of the function in src/misc.cpp
|
* JS counterpart of the function in src/misc.cpp
|
||||||
*/
|
*/
|
||||||
const friendlyDuration = function(seconds, maxCap = -1) {
|
const friendlyDuration = (seconds, maxCap = -1) => {
|
||||||
if ((seconds < 0) || ((seconds >= maxCap) && (maxCap >= 0)))
|
if ((seconds < 0) || ((seconds >= maxCap) && (maxCap >= 0)))
|
||||||
return "∞";
|
return "∞";
|
||||||
if (seconds === 0)
|
if (seconds === 0)
|
||||||
|
@ -173,7 +173,7 @@ window.qBittorrent.Misc ??= (() => {
|
||||||
return "QBT_TR(%1y %2d)QBT_TR[CONTEXT=misc]".replace("%1", Math.floor(years)).replace("%2", Math.floor(days));
|
return "QBT_TR(%1y %2d)QBT_TR[CONTEXT=misc]".replace("%1", Math.floor(years)).replace("%2", Math.floor(days));
|
||||||
};
|
};
|
||||||
|
|
||||||
const friendlyPercentage = function(value) {
|
const friendlyPercentage = (value) => {
|
||||||
let percentage = (value * 100).round(1);
|
let percentage = (value * 100).round(1);
|
||||||
if (isNaN(percentage) || (percentage < 0))
|
if (isNaN(percentage) || (percentage < 0))
|
||||||
percentage = 0;
|
percentage = 0;
|
||||||
|
@ -182,19 +182,19 @@ window.qBittorrent.Misc ??= (() => {
|
||||||
return percentage.toFixed(1) + "%";
|
return percentage.toFixed(1) + "%";
|
||||||
};
|
};
|
||||||
|
|
||||||
const friendlyFloat = function(value, precision) {
|
const friendlyFloat = (value, precision) => {
|
||||||
return parseFloat(value).toFixed(precision);
|
return parseFloat(value).toFixed(precision);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* JS counterpart of the function in src/misc.cpp
|
* JS counterpart of the function in src/misc.cpp
|
||||||
*/
|
*/
|
||||||
const parseHtmlLinks = function(text) {
|
const parseHtmlLinks = (text) => {
|
||||||
const exp = /(\b(https?|ftp|file):\/\/[-\w+&@#/%?=~|!:,.;]*[-\w+&@#/%=~|])/gi;
|
const exp = /(\b(https?|ftp|file):\/\/[-\w+&@#/%?=~|!:,.;]*[-\w+&@#/%=~|])/gi;
|
||||||
return text.replace(exp, "<a target='_blank' rel='noopener noreferrer' href='$1'>$1</a>");
|
return text.replace(exp, "<a target='_blank' rel='noopener noreferrer' href='$1'>$1</a>");
|
||||||
};
|
};
|
||||||
|
|
||||||
const parseVersion = function(versionString) {
|
const parseVersion = (versionString) => {
|
||||||
const failure = {
|
const failure = {
|
||||||
valid: false
|
valid: false
|
||||||
};
|
};
|
||||||
|
@ -228,7 +228,7 @@ window.qBittorrent.Misc ??= (() => {
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator#parameters
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator#parameters
|
||||||
const naturalSortCollator = new Intl.Collator(undefined, { numeric: true, usage: "sort" });
|
const naturalSortCollator = new Intl.Collator(undefined, { numeric: true, usage: "sort" });
|
||||||
|
|
||||||
const safeTrim = function(value) {
|
const safeTrim = (value) => {
|
||||||
try {
|
try {
|
||||||
return value.trim();
|
return value.trim();
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ window.qBittorrent.Misc ??= (() => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const toFixedPointString = function(number, digits) {
|
const toFixedPointString = (number, digits) => {
|
||||||
// Do not round up number
|
// Do not round up number
|
||||||
const power = Math.pow(10, digits);
|
const power = Math.pow(10, digits);
|
||||||
return (Math.floor(power * number) / power).toFixed(digits);
|
return (Math.floor(power * number) / power).toFixed(digits);
|
||||||
|
@ -251,7 +251,7 @@ window.qBittorrent.Misc ??= (() => {
|
||||||
* @param {Array<String>} terms terms to search for within the text
|
* @param {Array<String>} terms terms to search for within the text
|
||||||
* @returns {Boolean} true if all terms match the text, false otherwise
|
* @returns {Boolean} true if all terms match the text, false otherwise
|
||||||
*/
|
*/
|
||||||
const containsAllTerms = function(text, terms) {
|
const containsAllTerms = (text, terms) => {
|
||||||
const textToSearch = text.toLowerCase();
|
const textToSearch = text.toLowerCase();
|
||||||
return terms.every((term) => {
|
return terms.every((term) => {
|
||||||
const isTermRequired = (term[0] === "+");
|
const isTermRequired = (term[0] === "+");
|
||||||
|
|
|
@ -87,7 +87,7 @@ window.qBittorrent.Dialog ??= (() => {
|
||||||
},
|
},
|
||||||
resizable: true,
|
resizable: true,
|
||||||
width: 480,
|
width: 480,
|
||||||
onCloseComplete: function() {
|
onCloseComplete: () => {
|
||||||
// make sure overlay is properly hidden upon modal closing
|
// make sure overlay is properly hidden upon modal closing
|
||||||
document.getElementById("modalOverlay").style.display = "none";
|
document.getElementById("modalOverlay").style.display = "none";
|
||||||
}
|
}
|
||||||
|
@ -101,75 +101,75 @@ Object.freeze(window.qBittorrent.Dialog);
|
||||||
|
|
||||||
const LocalPreferences = new window.qBittorrent.LocalPreferences.LocalPreferencesClass();
|
const LocalPreferences = new window.qBittorrent.LocalPreferences.LocalPreferencesClass();
|
||||||
|
|
||||||
let saveWindowSize = function() {};
|
let saveWindowSize = () => {};
|
||||||
let loadWindowWidth = function() {};
|
let loadWindowWidth = () => {};
|
||||||
let loadWindowHeight = function() {};
|
let loadWindowHeight = () => {};
|
||||||
let showDownloadPage = function() {};
|
let showDownloadPage = () => {};
|
||||||
let globalUploadLimitFN = function() {};
|
let globalUploadLimitFN = () => {};
|
||||||
let uploadLimitFN = function() {};
|
let uploadLimitFN = () => {};
|
||||||
let shareRatioFN = function() {};
|
let shareRatioFN = () => {};
|
||||||
let toggleSequentialDownloadFN = function() {};
|
let toggleSequentialDownloadFN = () => {};
|
||||||
let toggleFirstLastPiecePrioFN = function() {};
|
let toggleFirstLastPiecePrioFN = () => {};
|
||||||
let setSuperSeedingFN = function() {};
|
let setSuperSeedingFN = () => {};
|
||||||
let setForceStartFN = function() {};
|
let setForceStartFN = () => {};
|
||||||
let globalDownloadLimitFN = function() {};
|
let globalDownloadLimitFN = () => {};
|
||||||
let StatisticsLinkFN = function() {};
|
let StatisticsLinkFN = () => {};
|
||||||
let downloadLimitFN = function() {};
|
let downloadLimitFN = () => {};
|
||||||
let deleteSelectedTorrentsFN = function() {};
|
let deleteSelectedTorrentsFN = () => {};
|
||||||
let stopFN = function() {};
|
let stopFN = () => {};
|
||||||
let startFN = function() {};
|
let startFN = () => {};
|
||||||
let autoTorrentManagementFN = function() {};
|
let autoTorrentManagementFN = () => {};
|
||||||
let recheckFN = function() {};
|
let recheckFN = () => {};
|
||||||
let reannounceFN = function() {};
|
let reannounceFN = () => {};
|
||||||
let setLocationFN = function() {};
|
let setLocationFN = () => {};
|
||||||
let renameFN = function() {};
|
let renameFN = () => {};
|
||||||
let renameFilesFN = function() {};
|
let renameFilesFN = () => {};
|
||||||
let startVisibleTorrentsFN = function() {};
|
let startVisibleTorrentsFN = () => {};
|
||||||
let stopVisibleTorrentsFN = function() {};
|
let stopVisibleTorrentsFN = () => {};
|
||||||
let deleteVisibleTorrentsFN = function() {};
|
let deleteVisibleTorrentsFN = () => {};
|
||||||
let torrentNewCategoryFN = function() {};
|
let torrentNewCategoryFN = () => {};
|
||||||
let torrentSetCategoryFN = function() {};
|
let torrentSetCategoryFN = () => {};
|
||||||
let createCategoryFN = function() {};
|
let createCategoryFN = () => {};
|
||||||
let createSubcategoryFN = function() {};
|
let createSubcategoryFN = () => {};
|
||||||
let editCategoryFN = function() {};
|
let editCategoryFN = () => {};
|
||||||
let removeCategoryFN = function() {};
|
let removeCategoryFN = () => {};
|
||||||
let deleteUnusedCategoriesFN = function() {};
|
let deleteUnusedCategoriesFN = () => {};
|
||||||
let torrentAddTagsFN = function() {};
|
let torrentAddTagsFN = () => {};
|
||||||
let torrentSetTagsFN = function() {};
|
let torrentSetTagsFN = () => {};
|
||||||
let torrentRemoveAllTagsFN = function() {};
|
let torrentRemoveAllTagsFN = () => {};
|
||||||
let createTagFN = function() {};
|
let createTagFN = () => {};
|
||||||
let removeTagFN = function() {};
|
let removeTagFN = () => {};
|
||||||
let deleteUnusedTagsFN = function() {};
|
let deleteUnusedTagsFN = () => {};
|
||||||
let deleteTrackerFN = function() {};
|
let deleteTrackerFN = () => {};
|
||||||
let copyNameFN = function() {};
|
let copyNameFN = () => {};
|
||||||
let copyInfohashFN = function(policy) {};
|
let copyInfohashFN = (policy) => {};
|
||||||
let copyMagnetLinkFN = function() {};
|
let copyMagnetLinkFN = () => {};
|
||||||
let copyIdFN = function() {};
|
let copyIdFN = () => {};
|
||||||
let copyCommentFN = function() {};
|
let copyCommentFN = () => {};
|
||||||
let setQueuePositionFN = function() {};
|
let setQueuePositionFN = () => {};
|
||||||
let exportTorrentFN = function() {};
|
let exportTorrentFN = () => {};
|
||||||
|
|
||||||
const initializeWindows = function() {
|
const initializeWindows = () => {
|
||||||
saveWindowSize = function(windowId) {
|
saveWindowSize = (windowId) => {
|
||||||
const size = $(windowId).getSize();
|
const size = $(windowId).getSize();
|
||||||
LocalPreferences.set("window_" + windowId + "_width", size.x);
|
LocalPreferences.set("window_" + windowId + "_width", size.x);
|
||||||
LocalPreferences.set("window_" + windowId + "_height", size.y);
|
LocalPreferences.set("window_" + windowId + "_height", size.y);
|
||||||
};
|
};
|
||||||
|
|
||||||
loadWindowWidth = function(windowId, defaultValue) {
|
loadWindowWidth = (windowId, defaultValue) => {
|
||||||
return LocalPreferences.get("window_" + windowId + "_width", defaultValue);
|
return LocalPreferences.get("window_" + windowId + "_width", defaultValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
loadWindowHeight = function(windowId, defaultValue) {
|
loadWindowHeight = (windowId, defaultValue) => {
|
||||||
return LocalPreferences.get("window_" + windowId + "_height", defaultValue);
|
return LocalPreferences.get("window_" + windowId + "_height", defaultValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
function addClickEvent(el, fn) {
|
const addClickEvent = (el, fn) => {
|
||||||
["Link", "Button"].each((item) => {
|
["Link", "Button"].each((item) => {
|
||||||
if ($(el + item))
|
if ($(el + item))
|
||||||
$(el + item).addEventListener("click", fn);
|
$(el + item).addEventListener("click", fn);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
addClickEvent("download", (e) => {
|
addClickEvent("download", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -177,7 +177,7 @@ const initializeWindows = function() {
|
||||||
showDownloadPage();
|
showDownloadPage();
|
||||||
});
|
});
|
||||||
|
|
||||||
showDownloadPage = function(urls) {
|
showDownloadPage = (urls) => {
|
||||||
const id = "downloadPage";
|
const id = "downloadPage";
|
||||||
const contentUri = new URI("download.html");
|
const contentUri = new URI("download.html");
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ const initializeWindows = function() {
|
||||||
paddingHorizontal: 0,
|
paddingHorizontal: 0,
|
||||||
width: loadWindowWidth(id, 900),
|
width: loadWindowWidth(id, 900),
|
||||||
height: loadWindowHeight(id, 400),
|
height: loadWindowHeight(id, 400),
|
||||||
onResize: function() {
|
onResize: () => {
|
||||||
saveWindowSize(id);
|
saveWindowSize(id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -279,7 +279,7 @@ const initializeWindows = function() {
|
||||||
updateMainData();
|
updateMainData();
|
||||||
});
|
});
|
||||||
|
|
||||||
globalUploadLimitFN = function() {
|
globalUploadLimitFN = () => {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: "uploadLimitPage",
|
id: "uploadLimitPage",
|
||||||
icon: "images/qbittorrent-tray.svg",
|
icon: "images/qbittorrent-tray.svg",
|
||||||
|
@ -296,7 +296,7 @@ const initializeWindows = function() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
uploadLimitFN = function() {
|
uploadLimitFN = () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
|
@ -316,7 +316,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
shareRatioFN = function() {
|
shareRatioFN = () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
let shareRatio = null;
|
let shareRatio = null;
|
||||||
|
@ -357,7 +357,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
toggleSequentialDownloadFN = function() {
|
toggleSequentialDownloadFN = () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
|
@ -371,7 +371,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
toggleFirstLastPiecePrioFN = function() {
|
toggleFirstLastPiecePrioFN = () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
|
@ -385,7 +385,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
setSuperSeedingFN = function(val) {
|
setSuperSeedingFN = (val) => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
|
@ -400,7 +400,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
setForceStartFN = function() {
|
setForceStartFN = () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
|
@ -415,7 +415,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
globalDownloadLimitFN = function() {
|
globalDownloadLimitFN = () => {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: "downloadLimitPage",
|
id: "downloadLimitPage",
|
||||||
icon: "images/qbittorrent-tray.svg",
|
icon: "images/qbittorrent-tray.svg",
|
||||||
|
@ -432,7 +432,7 @@ const initializeWindows = function() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
StatisticsLinkFN = function() {
|
StatisticsLinkFN = () => {
|
||||||
const id = "statisticspage";
|
const id = "statisticspage";
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: id,
|
id: id,
|
||||||
|
@ -450,7 +450,7 @@ const initializeWindows = function() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
downloadLimitFN = function() {
|
downloadLimitFN = () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
|
@ -470,7 +470,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
deleteSelectedTorrentsFN = function(forceDeleteFiles = false) {
|
deleteSelectedTorrentsFN = (forceDeleteFiles = false) => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length > 0) {
|
if (hashes.length > 0) {
|
||||||
if (window.qBittorrent.Cache.preferences.get().confirm_torrent_deletion) {
|
if (window.qBittorrent.Cache.preferences.get().confirm_torrent_deletion) {
|
||||||
|
@ -483,11 +483,11 @@ const initializeWindows = function() {
|
||||||
forceDeleteFiles: forceDeleteFiles
|
forceDeleteFiles: forceDeleteFiles
|
||||||
},
|
},
|
||||||
contentURL: "views/confirmdeletion.html",
|
contentURL: "views/confirmdeletion.html",
|
||||||
onContentLoaded: function(w) {
|
onContentLoaded: (w) => {
|
||||||
MochaUI.resizeWindow(w, { centered: true });
|
MochaUI.resizeWindow(w, { centered: true });
|
||||||
MochaUI.centerWindow(w);
|
MochaUI.centerWindow(w);
|
||||||
},
|
},
|
||||||
onCloseComplete: function() {
|
onCloseComplete: () => {
|
||||||
// make sure overlay is properly hidden upon modal closing
|
// make sure overlay is properly hidden upon modal closing
|
||||||
document.getElementById("modalOverlay").style.display = "none";
|
document.getElementById("modalOverlay").style.display = "none";
|
||||||
}
|
}
|
||||||
|
@ -501,12 +501,12 @@ const initializeWindows = function() {
|
||||||
hashes: hashes.join("|"),
|
hashes: hashes.join("|"),
|
||||||
deleteFiles: forceDeleteFiles
|
deleteFiles: forceDeleteFiles
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
torrentsTable.deselectAll();
|
torrentsTable.deselectAll();
|
||||||
updateMainData();
|
updateMainData();
|
||||||
updatePropertiesPanel();
|
updatePropertiesPanel();
|
||||||
},
|
},
|
||||||
onFailure: function() {
|
onFailure: () => {
|
||||||
alert("QBT_TR(Unable to delete torrents.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Unable to delete torrents.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
@ -520,7 +520,7 @@ const initializeWindows = function() {
|
||||||
deleteSelectedTorrentsFN();
|
deleteSelectedTorrentsFN();
|
||||||
});
|
});
|
||||||
|
|
||||||
stopFN = function() {
|
stopFN = () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
|
@ -534,7 +534,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
startFN = function() {
|
startFN = () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
|
@ -548,7 +548,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
autoTorrentManagementFN = function() {
|
autoTorrentManagementFN = () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length > 0) {
|
if (hashes.length > 0) {
|
||||||
const enableAutoTMM = hashes.some((hash) => !(torrentsTable.getRow(hash).full_data.auto_tmm));
|
const enableAutoTMM = hashes.some((hash) => !(torrentsTable.getRow(hash).full_data.auto_tmm));
|
||||||
|
@ -583,7 +583,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
recheckFN = function() {
|
recheckFN = () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length > 0) {
|
if (hashes.length > 0) {
|
||||||
if (window.qBittorrent.Cache.preferences.get().confirm_torrent_recheck) {
|
if (window.qBittorrent.Cache.preferences.get().confirm_torrent_recheck) {
|
||||||
|
@ -602,10 +602,10 @@ const initializeWindows = function() {
|
||||||
data: {
|
data: {
|
||||||
"hashes": hashes.join("|"),
|
"hashes": hashes.join("|"),
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
updateMainData();
|
updateMainData();
|
||||||
},
|
},
|
||||||
onFailure: function() {
|
onFailure: () => {
|
||||||
alert("QBT_TR(Unable to recheck torrents.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Unable to recheck torrents.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
@ -613,7 +613,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
reannounceFN = function() {
|
reannounceFN = () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
|
@ -627,7 +627,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
setLocationFN = function() {
|
setLocationFN = () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
const hash = hashes[0];
|
const hash = hashes[0];
|
||||||
|
@ -650,7 +650,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
renameFN = function() {
|
renameFN = () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length === 1) {
|
if (hashes.length === 1) {
|
||||||
const hash = hashes[0];
|
const hash = hashes[0];
|
||||||
|
@ -674,7 +674,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
renameFilesFN = function() {
|
renameFilesFN = () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length === 1) {
|
if (hashes.length === 1) {
|
||||||
const hash = hashes[0];
|
const hash = hashes[0];
|
||||||
|
@ -700,7 +700,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
startVisibleTorrentsFN = function() {
|
startVisibleTorrentsFN = () => {
|
||||||
const hashes = torrentsTable.getFilteredTorrentsHashes(selectedStatus, selectedCategory, selectedTag, selectedTracker);
|
const hashes = torrentsTable.getFilteredTorrentsHashes(selectedStatus, selectedCategory, selectedTag, selectedTracker);
|
||||||
if (hashes.length > 0) {
|
if (hashes.length > 0) {
|
||||||
new Request({
|
new Request({
|
||||||
|
@ -720,7 +720,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
stopVisibleTorrentsFN = function() {
|
stopVisibleTorrentsFN = () => {
|
||||||
const hashes = torrentsTable.getFilteredTorrentsHashes(selectedStatus, selectedCategory, selectedTag, selectedTracker);
|
const hashes = torrentsTable.getFilteredTorrentsHashes(selectedStatus, selectedCategory, selectedTag, selectedTracker);
|
||||||
if (hashes.length > 0) {
|
if (hashes.length > 0) {
|
||||||
new Request({
|
new Request({
|
||||||
|
@ -740,7 +740,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
deleteVisibleTorrentsFN = function() {
|
deleteVisibleTorrentsFN = () => {
|
||||||
const hashes = torrentsTable.getFilteredTorrentsHashes(selectedStatus, selectedCategory, selectedTag, selectedTracker);
|
const hashes = torrentsTable.getFilteredTorrentsHashes(selectedStatus, selectedCategory, selectedTag, selectedTracker);
|
||||||
if (hashes.length > 0) {
|
if (hashes.length > 0) {
|
||||||
if (window.qBittorrent.Cache.preferences.get().confirm_torrent_deletion) {
|
if (window.qBittorrent.Cache.preferences.get().confirm_torrent_deletion) {
|
||||||
|
@ -753,7 +753,7 @@ const initializeWindows = function() {
|
||||||
isDeletingVisibleTorrents: true
|
isDeletingVisibleTorrents: true
|
||||||
},
|
},
|
||||||
contentURL: "views/confirmdeletion.html",
|
contentURL: "views/confirmdeletion.html",
|
||||||
onContentLoaded: function(w) {
|
onContentLoaded: (w) => {
|
||||||
MochaUI.resizeWindow(w, { centered: true });
|
MochaUI.resizeWindow(w, { centered: true });
|
||||||
MochaUI.centerWindow(w);
|
MochaUI.centerWindow(w);
|
||||||
}
|
}
|
||||||
|
@ -780,7 +780,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
torrentNewCategoryFN = function() {
|
torrentNewCategoryFN = () => {
|
||||||
const action = "set";
|
const action = "set";
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
|
@ -801,7 +801,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
torrentSetCategoryFN = function(categoryHash) {
|
torrentSetCategoryFN = (categoryHash) => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length <= 0)
|
if (hashes.length <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -816,13 +816,13 @@ const initializeWindows = function() {
|
||||||
hashes: hashes.join("|"),
|
hashes: hashes.join("|"),
|
||||||
category: categoryName
|
category: categoryName
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
updateMainData();
|
updateMainData();
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
createCategoryFN = function() {
|
createCategoryFN = () => {
|
||||||
const action = "create";
|
const action = "create";
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: "newCategoryPage",
|
id: "newCategoryPage",
|
||||||
|
@ -840,7 +840,7 @@ const initializeWindows = function() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
createSubcategoryFN = function(categoryHash) {
|
createSubcategoryFN = (categoryHash) => {
|
||||||
const action = "createSubcategory";
|
const action = "createSubcategory";
|
||||||
const categoryName = category_list.get(categoryHash).name + "/";
|
const categoryName = category_list.get(categoryHash).name + "/";
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
|
@ -859,7 +859,7 @@ const initializeWindows = function() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
editCategoryFN = function(categoryHash) {
|
editCategoryFN = (categoryHash) => {
|
||||||
const action = "edit";
|
const action = "edit";
|
||||||
const category = category_list.get(categoryHash);
|
const category = category_list.get(categoryHash);
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
|
@ -878,7 +878,7 @@ const initializeWindows = function() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
removeCategoryFN = function(categoryHash) {
|
removeCategoryFN = (categoryHash) => {
|
||||||
const categoryName = category_list.get(categoryHash).name;
|
const categoryName = category_list.get(categoryHash).name;
|
||||||
new Request({
|
new Request({
|
||||||
url: "api/v2/torrents/removeCategories",
|
url: "api/v2/torrents/removeCategories",
|
||||||
|
@ -886,14 +886,14 @@ const initializeWindows = function() {
|
||||||
data: {
|
data: {
|
||||||
categories: categoryName
|
categories: categoryName
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
setCategoryFilter(CATEGORIES_ALL);
|
setCategoryFilter(CATEGORIES_ALL);
|
||||||
updateMainData();
|
updateMainData();
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
deleteUnusedCategoriesFN = function() {
|
deleteUnusedCategoriesFN = () => {
|
||||||
const categories = [];
|
const categories = [];
|
||||||
category_list.forEach((category, hash) => {
|
category_list.forEach((category, hash) => {
|
||||||
if (torrentsTable.getFilteredTorrentsNumber("all", hash, TAGS_ALL, TRACKERS_ALL) === 0)
|
if (torrentsTable.getFilteredTorrentsNumber("all", hash, TAGS_ALL, TRACKERS_ALL) === 0)
|
||||||
|
@ -906,14 +906,14 @@ const initializeWindows = function() {
|
||||||
data: {
|
data: {
|
||||||
categories: categories.join("\n")
|
categories: categories.join("\n")
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
setCategoryFilter(CATEGORIES_ALL);
|
setCategoryFilter(CATEGORIES_ALL);
|
||||||
updateMainData();
|
updateMainData();
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
torrentAddTagsFN = function() {
|
torrentAddTagsFN = () => {
|
||||||
const action = "set";
|
const action = "set";
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
|
@ -934,7 +934,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
torrentSetTagsFN = function(tagHash, isSet) {
|
torrentSetTagsFN = (tagHash, isSet) => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length <= 0)
|
if (hashes.length <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -950,7 +950,7 @@ const initializeWindows = function() {
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
torrentRemoveAllTagsFN = function() {
|
torrentRemoveAllTagsFN = () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
|
@ -963,7 +963,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
createTagFN = function() {
|
createTagFN = () => {
|
||||||
const action = "create";
|
const action = "create";
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: "newTagPage",
|
id: "newTagPage",
|
||||||
|
@ -982,7 +982,7 @@ const initializeWindows = function() {
|
||||||
updateMainData();
|
updateMainData();
|
||||||
};
|
};
|
||||||
|
|
||||||
removeTagFN = function(tagHash) {
|
removeTagFN = (tagHash) => {
|
||||||
const tagName = tagList.get(tagHash).name;
|
const tagName = tagList.get(tagHash).name;
|
||||||
new Request({
|
new Request({
|
||||||
url: "api/v2/torrents/deleteTags",
|
url: "api/v2/torrents/deleteTags",
|
||||||
|
@ -994,7 +994,7 @@ const initializeWindows = function() {
|
||||||
setTagFilter(TAGS_ALL);
|
setTagFilter(TAGS_ALL);
|
||||||
};
|
};
|
||||||
|
|
||||||
deleteUnusedTagsFN = function() {
|
deleteUnusedTagsFN = () => {
|
||||||
const tags = [];
|
const tags = [];
|
||||||
tagList.forEach((tag, hash) => {
|
tagList.forEach((tag, hash) => {
|
||||||
if (torrentsTable.getFilteredTorrentsNumber("all", CATEGORIES_ALL, hash, TRACKERS_ALL) === 0)
|
if (torrentsTable.getFilteredTorrentsNumber("all", CATEGORIES_ALL, hash, TRACKERS_ALL) === 0)
|
||||||
|
@ -1010,7 +1010,7 @@ const initializeWindows = function() {
|
||||||
setTagFilter(TAGS_ALL);
|
setTagFilter(TAGS_ALL);
|
||||||
};
|
};
|
||||||
|
|
||||||
deleteTrackerFN = function(trackerHash) {
|
deleteTrackerFN = (trackerHash) => {
|
||||||
const trackerHashInt = Number.parseInt(trackerHash, 10);
|
const trackerHashInt = Number.parseInt(trackerHash, 10);
|
||||||
if ((trackerHashInt === TRACKERS_ALL) || (trackerHashInt === TRACKERS_TRACKERLESS))
|
if ((trackerHashInt === TRACKERS_ALL) || (trackerHashInt === TRACKERS_TRACKERLESS))
|
||||||
return;
|
return;
|
||||||
|
@ -1030,14 +1030,14 @@ const initializeWindows = function() {
|
||||||
padding: 10,
|
padding: 10,
|
||||||
width: 424,
|
width: 424,
|
||||||
height: 100,
|
height: 100,
|
||||||
onCloseComplete: function() {
|
onCloseComplete: () => {
|
||||||
updateMainData();
|
updateMainData();
|
||||||
setTrackerFilter(TRACKERS_ALL);
|
setTrackerFilter(TRACKERS_ALL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
copyNameFN = function() {
|
copyNameFN = () => {
|
||||||
const selectedRows = torrentsTable.selectedRowsIds();
|
const selectedRows = torrentsTable.selectedRowsIds();
|
||||||
const names = [];
|
const names = [];
|
||||||
if (selectedRows.length > 0) {
|
if (selectedRows.length > 0) {
|
||||||
|
@ -1050,7 +1050,7 @@ const initializeWindows = function() {
|
||||||
return names.join("\n");
|
return names.join("\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
copyInfohashFN = function(policy) {
|
copyInfohashFN = (policy) => {
|
||||||
const selectedRows = torrentsTable.selectedRowsIds();
|
const selectedRows = torrentsTable.selectedRowsIds();
|
||||||
const infohashes = [];
|
const infohashes = [];
|
||||||
if (selectedRows.length > 0) {
|
if (selectedRows.length > 0) {
|
||||||
|
@ -1075,7 +1075,7 @@ const initializeWindows = function() {
|
||||||
return infohashes.join("\n");
|
return infohashes.join("\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
copyMagnetLinkFN = function() {
|
copyMagnetLinkFN = () => {
|
||||||
const selectedRows = torrentsTable.selectedRowsIds();
|
const selectedRows = torrentsTable.selectedRowsIds();
|
||||||
const magnets = [];
|
const magnets = [];
|
||||||
if (selectedRows.length > 0) {
|
if (selectedRows.length > 0) {
|
||||||
|
@ -1088,11 +1088,11 @@ const initializeWindows = function() {
|
||||||
return magnets.join("\n");
|
return magnets.join("\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
copyIdFN = function() {
|
copyIdFN = () => {
|
||||||
return torrentsTable.selectedRowsIds().join("\n");
|
return torrentsTable.selectedRowsIds().join("\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
copyCommentFN = function() {
|
copyCommentFN = () => {
|
||||||
const selectedRows = torrentsTable.selectedRowsIds();
|
const selectedRows = torrentsTable.selectedRowsIds();
|
||||||
const comments = [];
|
const comments = [];
|
||||||
if (selectedRows.length > 0) {
|
if (selectedRows.length > 0) {
|
||||||
|
@ -1107,7 +1107,7 @@ const initializeWindows = function() {
|
||||||
return comments.join("\n---------\n");
|
return comments.join("\n---------\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
exportTorrentFN = async function() {
|
exportTorrentFN = async () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
for (const hash of hashes) {
|
for (const hash of hashes) {
|
||||||
const row = torrentsTable.getRow(hash);
|
const row = torrentsTable.getRow(hash);
|
||||||
|
@ -1192,7 +1192,7 @@ const initializeWindows = function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
setQueuePositionFN = function(cmd) {
|
setQueuePositionFN = (cmd) => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
|
@ -1238,7 +1238,7 @@ const initializeWindows = function() {
|
||||||
new Request({
|
new Request({
|
||||||
url: "api/v2/auth/logout",
|
url: "api/v2/auth/logout",
|
||||||
method: "post",
|
method: "post",
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
window.location.reload(true);
|
window.location.reload(true);
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
@ -1252,7 +1252,7 @@ const initializeWindows = function() {
|
||||||
new Request({
|
new Request({
|
||||||
url: "api/v2/app/shutdown",
|
url: "api/v2/app/shutdown",
|
||||||
method: "post",
|
method: "post",
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
const shutdownMessage = "QBT_TR(%1 has been shutdown)QBT_TR[CONTEXT=HttpServer]".replace("%1", window.qBittorrent.Client.mainTitle());
|
const shutdownMessage = "QBT_TR(%1 has been shutdown)QBT_TR[CONTEXT=HttpServer]".replace("%1", window.qBittorrent.Client.mainTitle());
|
||||||
document.write(`<!doctype html><html lang="${LANG}"><head> <meta charset="UTF-8"> <meta name="color-scheme" content="light dark"> <title>${shutdownMessage}</title> <style>* {font-family: Arial, Helvetica, sans-serif;}</style></head><body> <h1 style="text-align: center;">${shutdownMessage}</h1></body></html>`);
|
document.write(`<!doctype html><html lang="${LANG}"><head> <meta charset="UTF-8"> <meta name="color-scheme" content="light dark"> <title>${shutdownMessage}</title> <style>* {font-family: Arial, Helvetica, sans-serif;}</style></head><body> <h1 style="text-align: center;">${shutdownMessage}</h1></body></html>`);
|
||||||
document.close();
|
document.close();
|
||||||
|
|
|
@ -40,7 +40,7 @@ window.qBittorrent.pathAutofill ??= (() => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
function showInputSuggestions(inputElement, names) {
|
const showInputSuggestions = (inputElement, names) => {
|
||||||
const datalist = document.createElement("datalist");
|
const datalist = document.createElement("datalist");
|
||||||
datalist.id = inputElement.id + "Suggestions";
|
datalist.id = inputElement.id + "Suggestions";
|
||||||
for (const name of names) {
|
for (const name of names) {
|
||||||
|
@ -57,9 +57,9 @@ window.qBittorrent.pathAutofill ??= (() => {
|
||||||
inputElement.appendChild(datalist);
|
inputElement.appendChild(datalist);
|
||||||
inputElement.setAttribute("list", datalist.id);
|
inputElement.setAttribute("list", datalist.id);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
function showPathSuggestions(element, mode) {
|
const showPathSuggestions = (element, mode) => {
|
||||||
const partialPath = element.value;
|
const partialPath = element.value;
|
||||||
if (partialPath === "")
|
if (partialPath === "")
|
||||||
return;
|
return;
|
||||||
|
@ -68,7 +68,7 @@ window.qBittorrent.pathAutofill ??= (() => {
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(filesList => { showInputSuggestions(element, filesList); })
|
.then(filesList => { showInputSuggestions(element, filesList); })
|
||||||
.catch(error => {});
|
.catch(error => {});
|
||||||
}
|
};
|
||||||
|
|
||||||
function attachPathAutofill() {
|
function attachPathAutofill() {
|
||||||
const directoryInputs = document.querySelectorAll(".pathDirectory:not(.pathAutoFillInitialized)");
|
const directoryInputs = document.querySelectorAll(".pathDirectory:not(.pathAutoFillInitialized)");
|
||||||
|
|
|
@ -46,7 +46,7 @@ window.qBittorrent.PiecesBar ??= (() => {
|
||||||
|
|
||||||
let piecesBarUniqueId = 0;
|
let piecesBarUniqueId = 0;
|
||||||
const PiecesBar = new Class({
|
const PiecesBar = new Class({
|
||||||
initialize(pieces, parameters) {
|
initialize: (pieces, parameters) => {
|
||||||
const vals = {
|
const vals = {
|
||||||
"id": "piecesbar_" + (piecesBarUniqueId++),
|
"id": "piecesbar_" + (piecesBarUniqueId++),
|
||||||
"width": 0,
|
"width": 0,
|
||||||
|
@ -253,7 +253,7 @@ window.qBittorrent.PiecesBar ??= (() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkForParent(id) {
|
const checkForParent = (id) => {
|
||||||
const obj = $(id);
|
const obj = $(id);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return;
|
return;
|
||||||
|
@ -261,7 +261,7 @@ window.qBittorrent.PiecesBar ??= (() => {
|
||||||
return setTimeout(() => { checkForParent(id); }, 100);
|
return setTimeout(() => { checkForParent(id); }, 100);
|
||||||
|
|
||||||
obj.refresh();
|
obj.refresh();
|
||||||
}
|
};
|
||||||
|
|
||||||
return exports();
|
return exports();
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -38,7 +38,7 @@ window.qBittorrent.ProgressBar ??= (() => {
|
||||||
|
|
||||||
let ProgressBars = 0;
|
let ProgressBars = 0;
|
||||||
const ProgressBar = new Class({
|
const ProgressBar = new Class({
|
||||||
initialize: function(value, parameters) {
|
initialize: (value, parameters) => {
|
||||||
const vals = {
|
const vals = {
|
||||||
"id": "progressbar_" + (ProgressBars++),
|
"id": "progressbar_" + (ProgressBars++),
|
||||||
"value": [value, 0].pick(),
|
"value": [value, 0].pick(),
|
||||||
|
@ -107,7 +107,7 @@ window.qBittorrent.ProgressBar ??= (() => {
|
||||||
if (vals.width)
|
if (vals.width)
|
||||||
obj.setValue(vals.value);
|
obj.setValue(vals.value);
|
||||||
else
|
else
|
||||||
setTimeout('ProgressBar_checkForParent("' + obj.id + '")');
|
setTimeout(ProgressBar_checkForParent, 0, obj.id);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -142,19 +142,19 @@ window.qBittorrent.ProgressBar ??= (() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ProgressBar_checkForParent(id) {
|
const ProgressBar_checkForParent = (id) => {
|
||||||
const obj = $(id);
|
const obj = $(id);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return;
|
return;
|
||||||
if (!obj.parentNode)
|
if (!obj.parentNode)
|
||||||
return setTimeout('ProgressBar_checkForParent("' + id + '")', 100);
|
return setTimeout(ProgressBar_checkForParent, 100, id);
|
||||||
obj.style.width = "100%";
|
obj.style.width = "100%";
|
||||||
const w = obj.offsetWidth;
|
const w = obj.offsetWidth;
|
||||||
obj.vals.dark.style.width = `${w}px`;
|
obj.vals.dark.style.width = `${w}px`;
|
||||||
obj.vals.light.style.width = `${w}px`;
|
obj.vals.light.style.width = `${w}px`;
|
||||||
obj.vals.width = w;
|
obj.vals.width = w;
|
||||||
obj.setValue(obj.vals.value);
|
obj.setValue(obj.vals.value);
|
||||||
}
|
};
|
||||||
|
|
||||||
return exports();
|
return exports();
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -53,7 +53,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
let is_seed = true;
|
let is_seed = true;
|
||||||
let current_hash = "";
|
let current_hash = "";
|
||||||
|
|
||||||
const normalizePriority = function(priority) {
|
const normalizePriority = (priority) => {
|
||||||
switch (priority) {
|
switch (priority) {
|
||||||
case FilePriority.Ignored:
|
case FilePriority.Ignored:
|
||||||
case FilePriority.Normal:
|
case FilePriority.Normal:
|
||||||
|
@ -66,7 +66,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getAllChildren = function(id, fileId) {
|
const getAllChildren = (id, fileId) => {
|
||||||
const node = torrentFilesTable.getNode(id);
|
const node = torrentFilesTable.getNode(id);
|
||||||
if (!node.isFolder) {
|
if (!node.isFolder) {
|
||||||
return {
|
return {
|
||||||
|
@ -78,7 +78,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
const rowIds = [];
|
const rowIds = [];
|
||||||
const fileIds = [];
|
const fileIds = [];
|
||||||
|
|
||||||
const getChildFiles = function(node) {
|
const getChildFiles = (node) => {
|
||||||
if (node.isFolder) {
|
if (node.isFolder) {
|
||||||
node.children.each((child) => {
|
node.children.each((child) => {
|
||||||
getChildFiles(child);
|
getChildFiles(child);
|
||||||
|
@ -100,7 +100,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const fileCheckboxClicked = function(e) {
|
const fileCheckboxClicked = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
const checkbox = e.target;
|
const checkbox = e.target;
|
||||||
|
@ -114,7 +114,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
updateGlobalCheckbox();
|
updateGlobalCheckbox();
|
||||||
};
|
};
|
||||||
|
|
||||||
const fileComboboxChanged = function(e) {
|
const fileComboboxChanged = (e) => {
|
||||||
const combobox = e.target;
|
const combobox = e.target;
|
||||||
const priority = combobox.value;
|
const priority = combobox.value;
|
||||||
const id = combobox.getAttribute("data-id");
|
const id = combobox.getAttribute("data-id");
|
||||||
|
@ -126,11 +126,11 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
updateGlobalCheckbox();
|
updateGlobalCheckbox();
|
||||||
};
|
};
|
||||||
|
|
||||||
const isDownloadCheckboxExists = function(id) {
|
const isDownloadCheckboxExists = (id) => {
|
||||||
return ($("cbPrio" + id) !== null);
|
return $("cbPrio" + id) !== null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const createDownloadCheckbox = function(id, fileId, checked) {
|
const createDownloadCheckbox = (id, fileId, checked) => {
|
||||||
const checkbox = new Element("input");
|
const checkbox = new Element("input");
|
||||||
checkbox.type = "checkbox";
|
checkbox.type = "checkbox";
|
||||||
checkbox.id = "cbPrio" + id;
|
checkbox.id = "cbPrio" + id;
|
||||||
|
@ -143,12 +143,12 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
return checkbox;
|
return checkbox;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateDownloadCheckbox = function(id, checked) {
|
const updateDownloadCheckbox = (id, checked) => {
|
||||||
const checkbox = $("cbPrio" + id);
|
const checkbox = $("cbPrio" + id);
|
||||||
updateCheckbox(checkbox, checked);
|
updateCheckbox(checkbox, checked);
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateCheckbox = function(checkbox, checked) {
|
const updateCheckbox = (checkbox, checked) => {
|
||||||
switch (checked) {
|
switch (checked) {
|
||||||
case TriState.Checked:
|
case TriState.Checked:
|
||||||
setCheckboxChecked(checkbox);
|
setCheckboxChecked(checkbox);
|
||||||
|
@ -162,8 +162,8 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const isPriorityComboExists = function(id) {
|
const isPriorityComboExists = (id) => {
|
||||||
return ($("comboPrio" + id) !== null);
|
return $("comboPrio" + id) !== null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const createPriorityCombo = (id, fileId, selectedPriority) => {
|
const createPriorityCombo = (id, fileId, selectedPriority) => {
|
||||||
|
@ -195,13 +195,13 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
return select;
|
return select;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updatePriorityCombo = function(id, selectedPriority) {
|
const updatePriorityCombo = (id, selectedPriority) => {
|
||||||
const combobox = $("comboPrio" + id);
|
const combobox = $("comboPrio" + id);
|
||||||
if (parseInt(combobox.value, 10) !== selectedPriority)
|
if (parseInt(combobox.value, 10) !== selectedPriority)
|
||||||
selectComboboxPriority(combobox, selectedPriority);
|
selectComboboxPriority(combobox, selectedPriority);
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectComboboxPriority = function(combobox, priority) {
|
const selectComboboxPriority = (combobox, priority) => {
|
||||||
const options = combobox.options;
|
const options = combobox.options;
|
||||||
for (let i = 0; i < options.length; ++i) {
|
for (let i = 0; i < options.length; ++i) {
|
||||||
const option = options[i];
|
const option = options[i];
|
||||||
|
@ -214,7 +214,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
combobox.value = priority;
|
combobox.value = priority;
|
||||||
};
|
};
|
||||||
|
|
||||||
const switchCheckboxState = function(e) {
|
const switchCheckboxState = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
const rowIds = [];
|
const rowIds = [];
|
||||||
|
@ -256,7 +256,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
setFilePriority(rowIds, fileIds, priority);
|
setFilePriority(rowIds, fileIds, priority);
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateGlobalCheckbox = function() {
|
const updateGlobalCheckbox = () => {
|
||||||
const checkbox = $("tristate_cb");
|
const checkbox = $("tristate_cb");
|
||||||
if (isAllCheckboxesChecked())
|
if (isAllCheckboxesChecked())
|
||||||
setCheckboxChecked(checkbox);
|
setCheckboxChecked(checkbox);
|
||||||
|
@ -266,24 +266,24 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
setCheckboxPartial(checkbox);
|
setCheckboxPartial(checkbox);
|
||||||
};
|
};
|
||||||
|
|
||||||
const setCheckboxChecked = function(checkbox) {
|
const setCheckboxChecked = (checkbox) => {
|
||||||
checkbox.state = "checked";
|
checkbox.state = "checked";
|
||||||
checkbox.indeterminate = false;
|
checkbox.indeterminate = false;
|
||||||
checkbox.checked = true;
|
checkbox.checked = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const setCheckboxUnchecked = function(checkbox) {
|
const setCheckboxUnchecked = (checkbox) => {
|
||||||
checkbox.state = "unchecked";
|
checkbox.state = "unchecked";
|
||||||
checkbox.indeterminate = false;
|
checkbox.indeterminate = false;
|
||||||
checkbox.checked = false;
|
checkbox.checked = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const setCheckboxPartial = function(checkbox) {
|
const setCheckboxPartial = (checkbox) => {
|
||||||
checkbox.state = "partial";
|
checkbox.state = "partial";
|
||||||
checkbox.indeterminate = true;
|
checkbox.indeterminate = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const isAllCheckboxesChecked = function() {
|
const isAllCheckboxesChecked = () => {
|
||||||
const checkboxes = $$("input.DownloadedCB");
|
const checkboxes = $$("input.DownloadedCB");
|
||||||
for (let i = 0; i < checkboxes.length; ++i) {
|
for (let i = 0; i < checkboxes.length; ++i) {
|
||||||
if (!checkboxes[i].checked)
|
if (!checkboxes[i].checked)
|
||||||
|
@ -292,7 +292,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const isAllCheckboxesUnchecked = function() {
|
const isAllCheckboxesUnchecked = () => {
|
||||||
const checkboxes = $$("input.DownloadedCB");
|
const checkboxes = $$("input.DownloadedCB");
|
||||||
for (let i = 0; i < checkboxes.length; ++i) {
|
for (let i = 0; i < checkboxes.length; ++i) {
|
||||||
if (checkboxes[i].checked)
|
if (checkboxes[i].checked)
|
||||||
|
@ -301,7 +301,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const setFilePriority = function(ids, fileIds, priority) {
|
const setFilePriority = (ids, fileIds, priority) => {
|
||||||
if (current_hash === "")
|
if (current_hash === "")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
"id": fileIds.join("|"),
|
"id": fileIds.join("|"),
|
||||||
"priority": priority
|
"priority": priority
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: () => {
|
||||||
loadTorrentFilesDataTimer = loadTorrentFilesData.delay(1000);
|
loadTorrentFilesDataTimer = loadTorrentFilesData.delay(1000);
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
@ -334,7 +334,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
};
|
};
|
||||||
|
|
||||||
let loadTorrentFilesDataTimer = -1;
|
let loadTorrentFilesDataTimer = -1;
|
||||||
const loadTorrentFilesData = function() {
|
const loadTorrentFilesData = () => {
|
||||||
if ($("propFiles").hasClass("invisible")
|
if ($("propFiles").hasClass("invisible")
|
||||||
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
|
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
|
||||||
// Tab changed, don't do anything
|
// Tab changed, don't do anything
|
||||||
|
@ -357,11 +357,11 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
url: url,
|
url: url,
|
||||||
method: "get",
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onComplete: function() {
|
onComplete: () => {
|
||||||
clearTimeout(loadTorrentFilesDataTimer);
|
clearTimeout(loadTorrentFilesDataTimer);
|
||||||
loadTorrentFilesDataTimer = loadTorrentFilesData.delay(5000);
|
loadTorrentFilesDataTimer = loadTorrentFilesData.delay(5000);
|
||||||
},
|
},
|
||||||
onSuccess: function(files) {
|
onSuccess: (files) => {
|
||||||
clearTimeout(torrentFilesFilterInputTimer);
|
clearTimeout(torrentFilesFilterInputTimer);
|
||||||
torrentFilesFilterInputTimer = -1;
|
torrentFilesFilterInputTimer = -1;
|
||||||
|
|
||||||
|
@ -377,13 +377,13 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateData = function() {
|
const updateData = () => {
|
||||||
clearTimeout(loadTorrentFilesDataTimer);
|
clearTimeout(loadTorrentFilesDataTimer);
|
||||||
loadTorrentFilesDataTimer = -1;
|
loadTorrentFilesDataTimer = -1;
|
||||||
loadTorrentFilesData();
|
loadTorrentFilesData();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleNewTorrentFiles = function(files) {
|
const handleNewTorrentFiles = (files) => {
|
||||||
is_seed = (files.length > 0) ? files[0].is_seed : true;
|
is_seed = (files.length > 0) ? files[0].is_seed : true;
|
||||||
|
|
||||||
const rows = files.map((file, index) => {
|
const rows = files.map((file, index) => {
|
||||||
|
@ -413,7 +413,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
updateGlobalCheckbox();
|
updateGlobalCheckbox();
|
||||||
};
|
};
|
||||||
|
|
||||||
const addRowsToTable = function(rows) {
|
const addRowsToTable = (rows) => {
|
||||||
const selectedFiles = torrentFilesTable.selectedRowsIds();
|
const selectedFiles = torrentFilesTable.selectedRowsIds();
|
||||||
let rowId = 0;
|
let rowId = 0;
|
||||||
|
|
||||||
|
@ -481,7 +481,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
torrentFilesTable.reselectRows(selectedFiles);
|
torrentFilesTable.reselectRows(selectedFiles);
|
||||||
};
|
};
|
||||||
|
|
||||||
const collapseIconClicked = function(event) {
|
const collapseIconClicked = (event) => {
|
||||||
const id = event.getAttribute("data-id");
|
const id = event.getAttribute("data-id");
|
||||||
const node = torrentFilesTable.getNode(id);
|
const node = torrentFilesTable.getNode(id);
|
||||||
const isCollapsed = (event.parentElement.getAttribute("data-collapsed") === "true");
|
const isCollapsed = (event.parentElement.getAttribute("data-collapsed") === "true");
|
||||||
|
@ -492,19 +492,19 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
collapseNode(node);
|
collapseNode(node);
|
||||||
};
|
};
|
||||||
|
|
||||||
const expandFolder = function(id) {
|
const expandFolder = (id) => {
|
||||||
const node = torrentFilesTable.getNode(id);
|
const node = torrentFilesTable.getNode(id);
|
||||||
if (node.isFolder)
|
if (node.isFolder)
|
||||||
expandNode(node);
|
expandNode(node);
|
||||||
};
|
};
|
||||||
|
|
||||||
const collapseFolder = function(id) {
|
const collapseFolder = (id) => {
|
||||||
const node = torrentFilesTable.getNode(id);
|
const node = torrentFilesTable.getNode(id);
|
||||||
if (node.isFolder)
|
if (node.isFolder)
|
||||||
collapseNode(node);
|
collapseNode(node);
|
||||||
};
|
};
|
||||||
|
|
||||||
const filesPriorityMenuClicked = function(priority) {
|
const filesPriorityMenuClicked = (priority) => {
|
||||||
const selectedRows = torrentFilesTable.selectedRowsIds();
|
const selectedRows = torrentFilesTable.selectedRowsIds();
|
||||||
if (selectedRows.length === 0)
|
if (selectedRows.length === 0)
|
||||||
return;
|
return;
|
||||||
|
@ -532,7 +532,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
setFilePriority(Object.keys(uniqueRowIds), Object.keys(uniqueFileIds), priority);
|
setFilePriority(Object.keys(uniqueRowIds), Object.keys(uniqueFileIds), priority);
|
||||||
};
|
};
|
||||||
|
|
||||||
const singleFileRename = function(hash) {
|
const singleFileRename = (hash) => {
|
||||||
const rowId = torrentFilesTable.selectedRowsIds()[0];
|
const rowId = torrentFilesTable.selectedRowsIds()[0];
|
||||||
if (rowId === undefined)
|
if (rowId === undefined)
|
||||||
return;
|
return;
|
||||||
|
@ -560,7 +560,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const multiFileRename = function(hash) {
|
const multiFileRename = (hash) => {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: "multiRenamePage",
|
id: "multiRenamePage",
|
||||||
icon: "images/qbittorrent-tray.svg",
|
icon: "images/qbittorrent-tray.svg",
|
||||||
|
@ -583,7 +583,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
targets: "#torrentFilesTableDiv tr",
|
targets: "#torrentFilesTableDiv tr",
|
||||||
menu: "torrentFilesMenu",
|
menu: "torrentFilesMenu",
|
||||||
actions: {
|
actions: {
|
||||||
Rename: function(element, ref) {
|
Rename: (element, ref) => {
|
||||||
const hash = torrentsTable.getCurrentTorrentID();
|
const hash = torrentsTable.getCurrentTorrentID();
|
||||||
if (!hash)
|
if (!hash)
|
||||||
return;
|
return;
|
||||||
|
@ -594,16 +594,16 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
singleFileRename(hash);
|
singleFileRename(hash);
|
||||||
},
|
},
|
||||||
|
|
||||||
FilePrioIgnore: function(element, ref) {
|
FilePrioIgnore: (element, ref) => {
|
||||||
filesPriorityMenuClicked(FilePriority.Ignored);
|
filesPriorityMenuClicked(FilePriority.Ignored);
|
||||||
},
|
},
|
||||||
FilePrioNormal: function(element, ref) {
|
FilePrioNormal: (element, ref) => {
|
||||||
filesPriorityMenuClicked(FilePriority.Normal);
|
filesPriorityMenuClicked(FilePriority.Normal);
|
||||||
},
|
},
|
||||||
FilePrioHigh: function(element, ref) {
|
FilePrioHigh: (element, ref) => {
|
||||||
filesPriorityMenuClicked(FilePriority.High);
|
filesPriorityMenuClicked(FilePriority.High);
|
||||||
},
|
},
|
||||||
FilePrioMaximum: function(element, ref) {
|
FilePrioMaximum: (element, ref) => {
|
||||||
filesPriorityMenuClicked(FilePriority.Maximum);
|
filesPriorityMenuClicked(FilePriority.Maximum);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -662,7 +662,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
/**
|
/**
|
||||||
* Show/hide a node's row
|
* Show/hide a node's row
|
||||||
*/
|
*/
|
||||||
const _hideNode = function(node, shouldHide) {
|
const _hideNode = (node, shouldHide) => {
|
||||||
const span = $("filesTablefileName" + node.rowId);
|
const span = $("filesTablefileName" + node.rowId);
|
||||||
// span won't exist if row has been filtered out
|
// span won't exist if row has been filtered out
|
||||||
if (span === null)
|
if (span === null)
|
||||||
|
@ -677,7 +677,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
/**
|
/**
|
||||||
* Update a node's collapsed state and icon
|
* Update a node's collapsed state and icon
|
||||||
*/
|
*/
|
||||||
const _updateNodeState = function(node, isCollapsed) {
|
const _updateNodeState = (node, isCollapsed) => {
|
||||||
const span = $("filesTablefileName" + node.rowId);
|
const span = $("filesTablefileName" + node.rowId);
|
||||||
// span won't exist if row has been filtered out
|
// span won't exist if row has been filtered out
|
||||||
if (span === null)
|
if (span === null)
|
||||||
|
@ -695,7 +695,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
collapseIcon.removeClass("rotate");
|
collapseIcon.removeClass("rotate");
|
||||||
};
|
};
|
||||||
|
|
||||||
const _isCollapsed = function(node) {
|
const _isCollapsed = (node) => {
|
||||||
const span = $("filesTablefileName" + node.rowId);
|
const span = $("filesTablefileName" + node.rowId);
|
||||||
if (span === null)
|
if (span === null)
|
||||||
return true;
|
return true;
|
||||||
|
@ -704,15 +704,15 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
return td.getAttribute("data-collapsed") === "true";
|
return td.getAttribute("data-collapsed") === "true";
|
||||||
};
|
};
|
||||||
|
|
||||||
const expandNode = function(node) {
|
const expandNode = (node) => {
|
||||||
_collapseNode(node, false, false, false);
|
_collapseNode(node, false, false, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const collapseNode = function(node) {
|
const collapseNode = (node) => {
|
||||||
_collapseNode(node, true, false, false);
|
_collapseNode(node, true, false, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const expandAllNodes = function() {
|
const expandAllNodes = () => {
|
||||||
const root = torrentFilesTable.getRoot();
|
const root = torrentFilesTable.getRoot();
|
||||||
root.children.each((node) => {
|
root.children.each((node) => {
|
||||||
node.children.each((child) => {
|
node.children.each((child) => {
|
||||||
|
@ -721,7 +721,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const collapseAllNodes = function() {
|
const collapseAllNodes = () => {
|
||||||
const root = torrentFilesTable.getRoot();
|
const root = torrentFilesTable.getRoot();
|
||||||
root.children.each((node) => {
|
root.children.each((node) => {
|
||||||
node.children.each((child) => {
|
node.children.each((child) => {
|
||||||
|
@ -737,7 +737,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
* @param {boolean} applyToChildren true if the node's children should also be collapsed, recursively
|
* @param {boolean} applyToChildren true if the node's children should also be collapsed, recursively
|
||||||
* @param {boolean} isChildNode true if the current node is a child of the original node we collapsed/expanded
|
* @param {boolean} isChildNode true if the current node is a child of the original node we collapsed/expanded
|
||||||
*/
|
*/
|
||||||
const _collapseNode = function(node, shouldCollapse, applyToChildren, isChildNode) {
|
const _collapseNode = (node, shouldCollapse, applyToChildren, isChildNode) => {
|
||||||
if (!node.isFolder)
|
if (!node.isFolder)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -764,7 +764,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const clear = function() {
|
const clear = () => {
|
||||||
torrentFilesTable.clear();
|
torrentFilesTable.clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ window.qBittorrent.PropGeneral ??= (() => {
|
||||||
});
|
});
|
||||||
$("progress").appendChild(piecesBar);
|
$("progress").appendChild(piecesBar);
|
||||||
|
|
||||||
const clearData = function() {
|
const clearData = () => {
|
||||||
$("time_elapsed").textContent = "";
|
$("time_elapsed").textContent = "";
|
||||||
$("eta").textContent = "";
|
$("eta").textContent = "";
|
||||||
$("nb_connections").textContent = "";
|
$("nb_connections").textContent = "";
|
||||||
|
@ -74,7 +74,7 @@ window.qBittorrent.PropGeneral ??= (() => {
|
||||||
};
|
};
|
||||||
|
|
||||||
let loadTorrentDataTimer = -1;
|
let loadTorrentDataTimer = -1;
|
||||||
const loadTorrentData = function() {
|
const loadTorrentData = () => {
|
||||||
if ($("propGeneral").hasClass("invisible")
|
if ($("propGeneral").hasClass("invisible")
|
||||||
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
|
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
|
||||||
// Tab changed, don't do anything
|
// Tab changed, don't do anything
|
||||||
|
@ -91,12 +91,12 @@ window.qBittorrent.PropGeneral ??= (() => {
|
||||||
url: url,
|
url: url,
|
||||||
method: "get",
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onFailure: function() {
|
onFailure: () => {
|
||||||
$("error_div").textContent = "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: (data) => {
|
||||||
$("error_div").textContent = "";
|
$("error_div").textContent = "";
|
||||||
if (data) {
|
if (data) {
|
||||||
// Update Torrent data
|
// Update Torrent data
|
||||||
|
@ -229,12 +229,12 @@ window.qBittorrent.PropGeneral ??= (() => {
|
||||||
url: piecesUrl,
|
url: piecesUrl,
|
||||||
method: "get",
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onFailure: function() {
|
onFailure: () => {
|
||||||
$("error_div").textContent = "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: (data) => {
|
||||||
$("error_div").textContent = "";
|
$("error_div").textContent = "";
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
|
@ -248,13 +248,13 @@ window.qBittorrent.PropGeneral ??= (() => {
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateData = function() {
|
const updateData = () => {
|
||||||
clearTimeout(loadTorrentDataTimer);
|
clearTimeout(loadTorrentDataTimer);
|
||||||
loadTorrentDataTimer = -1;
|
loadTorrentDataTimer = -1;
|
||||||
loadTorrentData();
|
loadTorrentData();
|
||||||
};
|
};
|
||||||
|
|
||||||
const clear = function() {
|
const clear = () => {
|
||||||
clearData();
|
clearData();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ window.qBittorrent.PropPeers ??= (() => {
|
||||||
let syncTorrentPeersLastResponseId = 0;
|
let syncTorrentPeersLastResponseId = 0;
|
||||||
let show_flags = true;
|
let show_flags = true;
|
||||||
|
|
||||||
const loadTorrentPeersData = function() {
|
const loadTorrentPeersData = () => {
|
||||||
if ($("propPeers").hasClass("invisible")
|
if ($("propPeers").hasClass("invisible")
|
||||||
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
|
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
|
||||||
syncTorrentPeersLastResponseId = 0;
|
syncTorrentPeersLastResponseId = 0;
|
||||||
|
@ -63,11 +63,11 @@ window.qBittorrent.PropPeers ??= (() => {
|
||||||
url: url,
|
url: url,
|
||||||
method: "get",
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onComplete: function() {
|
onComplete: () => {
|
||||||
clearTimeout(loadTorrentPeersTimer);
|
clearTimeout(loadTorrentPeersTimer);
|
||||||
loadTorrentPeersTimer = loadTorrentPeersData.delay(window.qBittorrent.Client.getSyncMainDataInterval());
|
loadTorrentPeersTimer = loadTorrentPeersData.delay(window.qBittorrent.Client.getSyncMainDataInterval());
|
||||||
},
|
},
|
||||||
onSuccess: function(response) {
|
onSuccess: (response) => {
|
||||||
$("error_div").textContent = "";
|
$("error_div").textContent = "";
|
||||||
if (response) {
|
if (response) {
|
||||||
const full_update = (response["full_update"] === true);
|
const full_update = (response["full_update"] === true);
|
||||||
|
@ -106,13 +106,13 @@ window.qBittorrent.PropPeers ??= (() => {
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateData = function() {
|
const updateData = () => {
|
||||||
clearTimeout(loadTorrentPeersTimer);
|
clearTimeout(loadTorrentPeersTimer);
|
||||||
loadTorrentPeersTimer = -1;
|
loadTorrentPeersTimer = -1;
|
||||||
loadTorrentPeersData();
|
loadTorrentPeersData();
|
||||||
};
|
};
|
||||||
|
|
||||||
const clear = function() {
|
const clear = () => {
|
||||||
torrentPeersTable.clear();
|
torrentPeersTable.clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ window.qBittorrent.PropPeers ??= (() => {
|
||||||
targets: "#torrentPeersTableDiv",
|
targets: "#torrentPeersTableDiv",
|
||||||
menu: "torrentPeersMenu",
|
menu: "torrentPeersMenu",
|
||||||
actions: {
|
actions: {
|
||||||
addPeer: function(element, ref) {
|
addPeer: (element, ref) => {
|
||||||
const hash = torrentsTable.getCurrentTorrentID();
|
const hash = torrentsTable.getCurrentTorrentID();
|
||||||
if (!hash)
|
if (!hash)
|
||||||
return;
|
return;
|
||||||
|
@ -140,7 +140,7 @@ window.qBittorrent.PropPeers ??= (() => {
|
||||||
height: 260
|
height: 260
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
banPeer: function(element, ref) {
|
banPeer: (element, ref) => {
|
||||||
const selectedPeers = torrentPeersTable.selectedRowsIds();
|
const selectedPeers = torrentPeersTable.selectedRowsIds();
|
||||||
if (selectedPeers.length === 0)
|
if (selectedPeers.length === 0)
|
||||||
return;
|
return;
|
||||||
|
@ -176,7 +176,7 @@ window.qBittorrent.PropPeers ??= (() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
new ClipboardJS("#CopyPeerInfo", {
|
new ClipboardJS("#CopyPeerInfo", {
|
||||||
text: function(trigger) {
|
text: (trigger) => {
|
||||||
return torrentPeersTable.selectedRowsIds().join("\n");
|
return torrentPeersTable.selectedRowsIds().join("\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -42,7 +42,7 @@ window.qBittorrent.PropTrackers ??= (() => {
|
||||||
const torrentTrackersTable = new window.qBittorrent.DynamicTable.TorrentTrackersTable();
|
const torrentTrackersTable = new window.qBittorrent.DynamicTable.TorrentTrackersTable();
|
||||||
let loadTrackersDataTimer = -1;
|
let loadTrackersDataTimer = -1;
|
||||||
|
|
||||||
const loadTrackersData = function() {
|
const loadTrackersData = () => {
|
||||||
if ($("propTrackers").hasClass("invisible")
|
if ($("propTrackers").hasClass("invisible")
|
||||||
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
|
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
|
||||||
// Tab changed, don't do anything
|
// Tab changed, don't do anything
|
||||||
|
@ -63,11 +63,11 @@ window.qBittorrent.PropTrackers ??= (() => {
|
||||||
url: url,
|
url: url,
|
||||||
method: "get",
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onComplete: function() {
|
onComplete: () => {
|
||||||
clearTimeout(loadTrackersDataTimer);
|
clearTimeout(loadTrackersDataTimer);
|
||||||
loadTrackersDataTimer = loadTrackersData.delay(10000);
|
loadTrackersDataTimer = loadTrackersData.delay(10000);
|
||||||
},
|
},
|
||||||
onSuccess: function(trackers) {
|
onSuccess: (trackers) => {
|
||||||
const selectedTrackers = torrentTrackersTable.selectedRowsIds();
|
const selectedTrackers = torrentTrackersTable.selectedRowsIds();
|
||||||
torrentTrackersTable.clear();
|
torrentTrackersTable.clear();
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ window.qBittorrent.PropTrackers ??= (() => {
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateData = function() {
|
const updateData = () => {
|
||||||
clearTimeout(loadTrackersDataTimer);
|
clearTimeout(loadTrackersDataTimer);
|
||||||
loadTrackersDataTimer = -1;
|
loadTrackersDataTimer = -1;
|
||||||
loadTrackersData();
|
loadTrackersData();
|
||||||
|
@ -127,15 +127,15 @@ window.qBittorrent.PropTrackers ??= (() => {
|
||||||
targets: "#torrentTrackersTableDiv",
|
targets: "#torrentTrackersTableDiv",
|
||||||
menu: "torrentTrackersMenu",
|
menu: "torrentTrackersMenu",
|
||||||
actions: {
|
actions: {
|
||||||
AddTracker: function(element, ref) {
|
AddTracker: (element, ref) => {
|
||||||
addTrackerFN();
|
addTrackerFN();
|
||||||
},
|
},
|
||||||
EditTracker: function(element, ref) {
|
EditTracker: (element, ref) => {
|
||||||
// only allow editing of one row
|
// only allow editing of one row
|
||||||
element.firstChild.click();
|
element.firstChild.click();
|
||||||
editTrackerFN(element);
|
editTrackerFN(element);
|
||||||
},
|
},
|
||||||
RemoveTracker: function(element, ref) {
|
RemoveTracker: (element, ref) => {
|
||||||
removeTrackerFN(element);
|
removeTrackerFN(element);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -162,7 +162,7 @@ window.qBittorrent.PropTrackers ??= (() => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const addTrackerFN = function() {
|
const addTrackerFN = () => {
|
||||||
if (current_hash.length === 0)
|
if (current_hash.length === 0)
|
||||||
return;
|
return;
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
|
@ -179,13 +179,13 @@ window.qBittorrent.PropTrackers ??= (() => {
|
||||||
paddingHorizontal: 0,
|
paddingHorizontal: 0,
|
||||||
width: 500,
|
width: 500,
|
||||||
height: 260,
|
height: 260,
|
||||||
onCloseComplete: function() {
|
onCloseComplete: () => {
|
||||||
updateData();
|
updateData();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const editTrackerFN = function(element) {
|
const editTrackerFN = (element) => {
|
||||||
if (current_hash.length === 0)
|
if (current_hash.length === 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -204,13 +204,13 @@ window.qBittorrent.PropTrackers ??= (() => {
|
||||||
paddingHorizontal: 0,
|
paddingHorizontal: 0,
|
||||||
width: 500,
|
width: 500,
|
||||||
height: 150,
|
height: 150,
|
||||||
onCloseComplete: function() {
|
onCloseComplete: () => {
|
||||||
updateData();
|
updateData();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeTrackerFN = function(element) {
|
const removeTrackerFN = (element) => {
|
||||||
if (current_hash.length === 0)
|
if (current_hash.length === 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -222,18 +222,18 @@ window.qBittorrent.PropTrackers ??= (() => {
|
||||||
hash: current_hash,
|
hash: current_hash,
|
||||||
urls: selectedTrackers.map(encodeURIComponent).join("|")
|
urls: selectedTrackers.map(encodeURIComponent).join("|")
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
updateData();
|
updateData();
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const clear = function() {
|
const clear = () => {
|
||||||
torrentTrackersTable.clear();
|
torrentTrackersTable.clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
new ClipboardJS("#CopyTrackerUrl", {
|
new ClipboardJS("#CopyTrackerUrl", {
|
||||||
text: function(trigger) {
|
text: (trigger) => {
|
||||||
return torrentTrackersTable.selectedRowsIds().join("\n");
|
return torrentTrackersTable.selectedRowsIds().join("\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -42,7 +42,7 @@ window.qBittorrent.PropWebseeds ??= (() => {
|
||||||
let current_hash = "";
|
let current_hash = "";
|
||||||
|
|
||||||
let loadWebSeedsDataTimer = -1;
|
let loadWebSeedsDataTimer = -1;
|
||||||
const loadWebSeedsData = function() {
|
const loadWebSeedsData = () => {
|
||||||
if ($("propWebSeeds").hasClass("invisible")
|
if ($("propWebSeeds").hasClass("invisible")
|
||||||
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
|
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
|
||||||
// Tab changed, don't do anything
|
// Tab changed, don't do anything
|
||||||
|
@ -62,11 +62,11 @@ window.qBittorrent.PropWebseeds ??= (() => {
|
||||||
url: new URI("api/v2/torrents/webseeds").setData("hash", current_hash),
|
url: new URI("api/v2/torrents/webseeds").setData("hash", current_hash),
|
||||||
method: "get",
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onComplete: function() {
|
onComplete: () => {
|
||||||
clearTimeout(loadWebSeedsDataTimer);
|
clearTimeout(loadWebSeedsDataTimer);
|
||||||
loadWebSeedsDataTimer = loadWebSeedsData.delay(10000);
|
loadWebSeedsDataTimer = loadWebSeedsData.delay(10000);
|
||||||
},
|
},
|
||||||
onSuccess: function(webseeds) {
|
onSuccess: (webseeds) => {
|
||||||
const selectedWebseeds = torrentWebseedsTable.selectedRowsIds();
|
const selectedWebseeds = torrentWebseedsTable.selectedRowsIds();
|
||||||
torrentWebseedsTable.clear();
|
torrentWebseedsTable.clear();
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ window.qBittorrent.PropWebseeds ??= (() => {
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateData = function() {
|
const updateData = () => {
|
||||||
clearTimeout(loadWebSeedsDataTimer);
|
clearTimeout(loadWebSeedsDataTimer);
|
||||||
loadWebSeedsDataTimer = -1;
|
loadWebSeedsDataTimer = -1;
|
||||||
loadWebSeedsData();
|
loadWebSeedsData();
|
||||||
|
@ -98,15 +98,15 @@ window.qBittorrent.PropWebseeds ??= (() => {
|
||||||
targets: "#torrentWebseedsTableDiv",
|
targets: "#torrentWebseedsTableDiv",
|
||||||
menu: "torrentWebseedsMenu",
|
menu: "torrentWebseedsMenu",
|
||||||
actions: {
|
actions: {
|
||||||
AddWebSeeds: function(element, ref) {
|
AddWebSeeds: (element, ref) => {
|
||||||
addWebseedFN();
|
addWebseedFN();
|
||||||
},
|
},
|
||||||
EditWebSeed: function(element, ref) {
|
EditWebSeed: (element, ref) => {
|
||||||
// only allow editing of one row
|
// only allow editing of one row
|
||||||
element.firstChild.click();
|
element.firstChild.click();
|
||||||
editWebSeedFN(element);
|
editWebSeedFN(element);
|
||||||
},
|
},
|
||||||
RemoveWebSeed: function(element, ref) {
|
RemoveWebSeed: (element, ref) => {
|
||||||
removeWebSeedFN(element);
|
removeWebSeedFN(element);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -134,7 +134,7 @@ window.qBittorrent.PropWebseeds ??= (() => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const addWebseedFN = function() {
|
const addWebseedFN = () => {
|
||||||
if (current_hash.length === 0)
|
if (current_hash.length === 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -151,13 +151,13 @@ window.qBittorrent.PropWebseeds ??= (() => {
|
||||||
paddingHorizontal: 0,
|
paddingHorizontal: 0,
|
||||||
width: 500,
|
width: 500,
|
||||||
height: 260,
|
height: 260,
|
||||||
onCloseComplete: function() {
|
onCloseComplete: () => {
|
||||||
updateData();
|
updateData();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const editWebSeedFN = function(element) {
|
const editWebSeedFN = (element) => {
|
||||||
if (current_hash.length === 0)
|
if (current_hash.length === 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -180,13 +180,13 @@ window.qBittorrent.PropWebseeds ??= (() => {
|
||||||
paddingHorizontal: 0,
|
paddingHorizontal: 0,
|
||||||
width: 500,
|
width: 500,
|
||||||
height: 150,
|
height: 150,
|
||||||
onCloseComplete: function() {
|
onCloseComplete: () => {
|
||||||
updateData();
|
updateData();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeWebSeedFN = function(element) {
|
const removeWebSeedFN = (element) => {
|
||||||
if (current_hash.length === 0)
|
if (current_hash.length === 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -198,18 +198,18 @@ window.qBittorrent.PropWebseeds ??= (() => {
|
||||||
hash: current_hash,
|
hash: current_hash,
|
||||||
urls: selectedWebseeds.map(webseed => encodeURIComponent(webseed)).join("|")
|
urls: selectedWebseeds.map(webseed => encodeURIComponent(webseed)).join("|")
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
updateData();
|
updateData();
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const clear = function() {
|
const clear = () => {
|
||||||
torrentWebseedsTable.clear();
|
torrentWebseedsTable.clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
new ClipboardJS("#CopyWebseedUrl", {
|
new ClipboardJS("#CopyWebseedUrl", {
|
||||||
text: function(trigger) {
|
text: (trigger) => {
|
||||||
return torrentWebseedsTable.selectedRowsIds().join("\n");
|
return torrentWebseedsTable.selectedRowsIds().join("\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -44,10 +44,10 @@ window.qBittorrent.MultiRename ??= (() => {
|
||||||
replaceAll: false,
|
replaceAll: false,
|
||||||
fileEnumerationStart: 0,
|
fileEnumerationStart: 0,
|
||||||
|
|
||||||
onChanged: function(rows) {},
|
onChanged: (rows) => {},
|
||||||
onInvalidRegex: function(err) {},
|
onInvalidRegex: (err) => {},
|
||||||
onRenamed: function(rows) {},
|
onRenamed: (rows) => {},
|
||||||
onRenameError: function(err) {},
|
onRenameError: (err) => {},
|
||||||
|
|
||||||
_inner_update: function() {
|
_inner_update: function() {
|
||||||
const findMatches = (regex, str) => {
|
const findMatches = (regex, str) => {
|
||||||
|
|
|
@ -105,7 +105,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const init = function() {
|
const init = () => {
|
||||||
// load "Search in" preference from local storage
|
// load "Search in" preference from local storage
|
||||||
$("searchInTorrentName").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({
|
||||||
|
@ -166,15 +166,15 @@ window.qBittorrent.Search ??= (() => {
|
||||||
createSearchTab(id, pattern);
|
createSearchTab(id, pattern);
|
||||||
};
|
};
|
||||||
|
|
||||||
const numSearchTabs = function() {
|
const numSearchTabs = () => {
|
||||||
return $("searchTabs").getElements("li").length;
|
return $("searchTabs").getElements("li").length;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSearchIdFromTab = function(tab) {
|
const getSearchIdFromTab = (tab) => {
|
||||||
return Number(tab.id.substring(searchTabIdPrefix.length));
|
return Number(tab.id.substring(searchTabIdPrefix.length));
|
||||||
};
|
};
|
||||||
|
|
||||||
const createSearchTab = function(searchId, pattern) {
|
const createSearchTab = (searchId, pattern) => {
|
||||||
const newTabId = `${searchTabIdPrefix}${searchId}`;
|
const newTabId = `${searchTabIdPrefix}${searchId}`;
|
||||||
const tabElem = new Element("a", {
|
const tabElem = new Element("a", {
|
||||||
text: pattern,
|
text: pattern,
|
||||||
|
@ -233,7 +233,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
updateSearchResultsData(searchId);
|
updateSearchResultsData(searchId);
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeSearchTab = function(el) {
|
const closeSearchTab = (el) => {
|
||||||
const tab = el.closest("li.searchTab");
|
const tab = el.closest("li.searchTab");
|
||||||
if (!tab)
|
if (!tab)
|
||||||
return;
|
return;
|
||||||
|
@ -282,7 +282,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveCurrentTabState = function() {
|
const saveCurrentTabState = () => {
|
||||||
const currentSearchId = getSelectedSearchId();
|
const currentSearchId = getSelectedSearchId();
|
||||||
if (!currentSearchId)
|
if (!currentSearchId)
|
||||||
return;
|
return;
|
||||||
|
@ -313,7 +313,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
state.selectedRowIds = [...searchResultsTable.selectedRows];
|
state.selectedRowIds = [...searchResultsTable.selectedRows];
|
||||||
};
|
};
|
||||||
|
|
||||||
const setActiveTab = function(tab) {
|
const setActiveTab = (tab) => {
|
||||||
const searchId = getSearchIdFromTab(tab);
|
const searchId = getSearchIdFromTab(tab);
|
||||||
if (searchId === getSelectedSearchId())
|
if (searchId === getSelectedSearchId())
|
||||||
return;
|
return;
|
||||||
|
@ -377,7 +377,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
setupSearchTableEvents(true);
|
setupSearchTableEvents(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStatusIconElement = function(text, image) {
|
const getStatusIconElement = (text, image) => {
|
||||||
return new Element("img", {
|
return new Element("img", {
|
||||||
alt: text,
|
alt: text,
|
||||||
title: text,
|
title: text,
|
||||||
|
@ -388,7 +388,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateStatusIconElement = function(searchId, text, image) {
|
const updateStatusIconElement = (searchId, text, image) => {
|
||||||
const searchTab = $(`${searchTabIdPrefix}${searchId}`);
|
const searchTab = $(`${searchTabIdPrefix}${searchId}`);
|
||||||
if (searchTab) {
|
if (searchTab) {
|
||||||
const statusIcon = searchTab.getElement(".statusIcon");
|
const statusIcon = searchTab.getElement(".statusIcon");
|
||||||
|
@ -398,7 +398,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const startSearch = function(pattern, category, plugins) {
|
const startSearch = (pattern, category, plugins) => {
|
||||||
searchPatternChanged = false;
|
searchPatternChanged = false;
|
||||||
|
|
||||||
const url = new URI("api/v2/search/start");
|
const url = new URI("api/v2/search/start");
|
||||||
|
@ -422,7 +422,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const stopSearch = function(searchId) {
|
const stopSearch = (searchId) => {
|
||||||
const url = new URI("api/v2/search/stop");
|
const url = new URI("api/v2/search/stop");
|
||||||
new Request({
|
new Request({
|
||||||
url: url,
|
url: url,
|
||||||
|
@ -430,7 +430,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
data: {
|
data: {
|
||||||
id: searchId
|
id: searchId
|
||||||
},
|
},
|
||||||
onSuccess: function(response) {
|
onSuccess: (response) => {
|
||||||
resetSearchState(searchId);
|
resetSearchState(searchId);
|
||||||
// not strictly necessary to do this when the tab is being closed, but there's no harm in it
|
// not strictly necessary to do this when the tab is being closed, but there's no harm in it
|
||||||
updateStatusIconElement(searchId, "QBT_TR(Search aborted)QBT_TR[CONTEXT=SearchJobWidget]", "images/task-reject.svg");
|
updateStatusIconElement(searchId, "QBT_TR(Search aborted)QBT_TR[CONTEXT=SearchJobWidget]", "images/task-reject.svg");
|
||||||
|
@ -438,12 +438,12 @@ window.qBittorrent.Search ??= (() => {
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSelectedSearchId = function() {
|
const getSelectedSearchId = () => {
|
||||||
const selectedTab = $("searchTabs").getElement("li.selected");
|
const selectedTab = $("searchTabs").getElement("li.selected");
|
||||||
return selectedTab ? getSearchIdFromTab(selectedTab) : null;
|
return selectedTab ? getSearchIdFromTab(selectedTab) : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const startStopSearch = function() {
|
const startStopSearch = () => {
|
||||||
const currentSearchId = getSelectedSearchId();
|
const currentSearchId = getSelectedSearchId();
|
||||||
const state = searchState.get(currentSearchId);
|
const state = searchState.get(currentSearchId);
|
||||||
const isSearchRunning = state && state.running;
|
const isSearchRunning = state && state.running;
|
||||||
|
@ -463,12 +463,12 @@ window.qBittorrent.Search ??= (() => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const openSearchTorrentDescriptionUrl = function() {
|
const openSearchTorrentDescriptionUrl = () => {
|
||||||
for (const rowID of searchResultsTable.selectedRowsIds())
|
for (const rowID of searchResultsTable.selectedRowsIds())
|
||||||
window.open(searchResultsTable.getRow(rowID).full_data.descrLink, "_blank");
|
window.open(searchResultsTable.getRow(rowID).full_data.descrLink, "_blank");
|
||||||
};
|
};
|
||||||
|
|
||||||
const copySearchTorrentName = function() {
|
const copySearchTorrentName = () => {
|
||||||
const names = [];
|
const names = [];
|
||||||
searchResultsTable.selectedRowsIds().each((rowId) => {
|
searchResultsTable.selectedRowsIds().each((rowId) => {
|
||||||
names.push(searchResultsTable.getRow(rowId).full_data.fileName);
|
names.push(searchResultsTable.getRow(rowId).full_data.fileName);
|
||||||
|
@ -476,7 +476,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
return names.join("\n");
|
return names.join("\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
const copySearchTorrentDownloadLink = function() {
|
const copySearchTorrentDownloadLink = () => {
|
||||||
const urls = [];
|
const urls = [];
|
||||||
searchResultsTable.selectedRowsIds().each((rowId) => {
|
searchResultsTable.selectedRowsIds().each((rowId) => {
|
||||||
urls.push(searchResultsTable.getRow(rowId).full_data.fileUrl);
|
urls.push(searchResultsTable.getRow(rowId).full_data.fileUrl);
|
||||||
|
@ -484,7 +484,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
return urls.join("\n");
|
return urls.join("\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
const copySearchTorrentDescriptionUrl = function() {
|
const copySearchTorrentDescriptionUrl = () => {
|
||||||
const urls = [];
|
const urls = [];
|
||||||
searchResultsTable.selectedRowsIds().each((rowId) => {
|
searchResultsTable.selectedRowsIds().each((rowId) => {
|
||||||
urls.push(searchResultsTable.getRow(rowId).full_data.descrLink);
|
urls.push(searchResultsTable.getRow(rowId).full_data.descrLink);
|
||||||
|
@ -492,7 +492,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
return urls.join("\n");
|
return urls.join("\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
const downloadSearchTorrent = function() {
|
const downloadSearchTorrent = () => {
|
||||||
const urls = [];
|
const urls = [];
|
||||||
for (const rowID of searchResultsTable.selectedRowsIds())
|
for (const rowID of searchResultsTable.selectedRowsIds())
|
||||||
urls.push(searchResultsTable.getRow(rowID).full_data.fileUrl);
|
urls.push(searchResultsTable.getRow(rowID).full_data.fileUrl);
|
||||||
|
@ -504,7 +504,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
showDownloadPage(urls);
|
showDownloadPage(urls);
|
||||||
};
|
};
|
||||||
|
|
||||||
const manageSearchPlugins = function() {
|
const manageSearchPlugins = () => {
|
||||||
const id = "searchPlugins";
|
const id = "searchPlugins";
|
||||||
if (!$(id)) {
|
if (!$(id)) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
|
@ -522,10 +522,10 @@ window.qBittorrent.Search ??= (() => {
|
||||||
onResize: window.qBittorrent.Misc.createDebounceHandler(500, (e) => {
|
onResize: window.qBittorrent.Misc.createDebounceHandler(500, (e) => {
|
||||||
saveWindowSize(id);
|
saveWindowSize(id);
|
||||||
}),
|
}),
|
||||||
onBeforeBuild: function() {
|
onBeforeBuild: () => {
|
||||||
loadSearchPlugins();
|
loadSearchPlugins();
|
||||||
},
|
},
|
||||||
onClose: function() {
|
onClose: () => {
|
||||||
clearTimeout(loadSearchPluginsTimer);
|
clearTimeout(loadSearchPluginsTimer);
|
||||||
loadSearchPluginsTimer = -1;
|
loadSearchPluginsTimer = -1;
|
||||||
}
|
}
|
||||||
|
@ -533,12 +533,12 @@ window.qBittorrent.Search ??= (() => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadSearchPlugins = function() {
|
const loadSearchPlugins = () => {
|
||||||
getPlugins();
|
getPlugins();
|
||||||
loadSearchPluginsTimer = loadSearchPlugins.delay(2000);
|
loadSearchPluginsTimer = loadSearchPlugins.delay(2000);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSearchPatternChanged = function() {
|
const onSearchPatternChanged = () => {
|
||||||
const currentSearchId = getSelectedSearchId();
|
const currentSearchId = getSelectedSearchId();
|
||||||
const state = searchState.get(currentSearchId);
|
const state = searchState.get(currentSearchId);
|
||||||
const currentSearchPattern = $("searchPattern").value.trim();
|
const currentSearchPattern = $("searchPattern").value.trim();
|
||||||
|
@ -553,11 +553,11 @@ window.qBittorrent.Search ??= (() => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const categorySelected = function() {
|
const categorySelected = () => {
|
||||||
selectedCategory = $("categorySelect").value;
|
selectedCategory = $("categorySelect").value;
|
||||||
};
|
};
|
||||||
|
|
||||||
const pluginSelected = function() {
|
const pluginSelected = () => {
|
||||||
selectedPlugin = $("pluginsSelect").value;
|
selectedPlugin = $("pluginsSelect").value;
|
||||||
|
|
||||||
if (selectedPlugin !== prevSelectedPlugin) {
|
if (selectedPlugin !== prevSelectedPlugin) {
|
||||||
|
@ -566,7 +566,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const reselectCategory = function() {
|
const reselectCategory = () => {
|
||||||
for (let i = 0; i < $("categorySelect").options.length; ++i) {
|
for (let i = 0; i < $("categorySelect").options.length; ++i) {
|
||||||
if ($("categorySelect").options[i].get("value") === selectedCategory)
|
if ($("categorySelect").options[i].get("value") === selectedCategory)
|
||||||
$("categorySelect").options[i].selected = true;
|
$("categorySelect").options[i].selected = true;
|
||||||
|
@ -575,7 +575,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
categorySelected();
|
categorySelected();
|
||||||
};
|
};
|
||||||
|
|
||||||
const reselectPlugin = function() {
|
const reselectPlugin = () => {
|
||||||
for (let i = 0; i < $("pluginsSelect").options.length; ++i) {
|
for (let i = 0; i < $("pluginsSelect").options.length; ++i) {
|
||||||
if ($("pluginsSelect").options[i].get("value") === selectedPlugin)
|
if ($("pluginsSelect").options[i].get("value") === selectedPlugin)
|
||||||
$("pluginsSelect").options[i].selected = true;
|
$("pluginsSelect").options[i].selected = true;
|
||||||
|
@ -584,7 +584,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
pluginSelected();
|
pluginSelected();
|
||||||
};
|
};
|
||||||
|
|
||||||
const resetSearchState = function(searchId) {
|
const resetSearchState = (searchId) => {
|
||||||
document.getElementById("startSearchButton").lastChild.textContent = "QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]";
|
document.getElementById("startSearchButton").lastChild.textContent = "QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]";
|
||||||
const state = searchState.get(searchId);
|
const state = searchState.get(searchId);
|
||||||
if (state) {
|
if (state) {
|
||||||
|
@ -642,7 +642,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
reselectCategory();
|
reselectCategory();
|
||||||
};
|
};
|
||||||
|
|
||||||
const getPlugins = function() {
|
const getPlugins = () => {
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: new URI("api/v2/search/plugins"),
|
url: new URI("api/v2/search/plugins"),
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -706,7 +706,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const getPlugin = function(name) {
|
const getPlugin = (name) => {
|
||||||
for (let i = 0; i < searchPlugins.length; ++i) {
|
for (let i = 0; i < searchPlugins.length; ++i) {
|
||||||
if (searchPlugins[i].name === name)
|
if (searchPlugins[i].name === name)
|
||||||
return searchPlugins[i];
|
return searchPlugins[i];
|
||||||
|
@ -715,7 +715,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const resetFilters = function() {
|
const resetFilters = () => {
|
||||||
searchText.filterPattern = "";
|
searchText.filterPattern = "";
|
||||||
$("searchInNameFilter").value = "";
|
$("searchInNameFilter").value = "";
|
||||||
|
|
||||||
|
@ -734,23 +734,23 @@ window.qBittorrent.Search ??= (() => {
|
||||||
$("searchMaxSizePrefix").value = searchSizeFilter.maxUnit;
|
$("searchMaxSizePrefix").value = searchSizeFilter.maxUnit;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSearchInTorrentName = function() {
|
const getSearchInTorrentName = () => {
|
||||||
return ($("searchInTorrentName").value === "names") ? "names" : "everywhere";
|
return ($("searchInTorrentName").value === "names") ? "names" : "everywhere";
|
||||||
};
|
};
|
||||||
|
|
||||||
const searchInTorrentName = function() {
|
const searchInTorrentName = () => {
|
||||||
LocalPreferences.set("search_in_filter", getSearchInTorrentName());
|
LocalPreferences.set("search_in_filter", getSearchInTorrentName());
|
||||||
searchFilterChanged();
|
searchFilterChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
const searchSeedsFilterChanged = function() {
|
const searchSeedsFilterChanged = () => {
|
||||||
searchSeedsFilter.min = $("searchMinSeedsFilter").value;
|
searchSeedsFilter.min = $("searchMinSeedsFilter").value;
|
||||||
searchSeedsFilter.max = $("searchMaxSeedsFilter").value;
|
searchSeedsFilter.max = $("searchMaxSeedsFilter").value;
|
||||||
|
|
||||||
searchFilterChanged();
|
searchFilterChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
const searchSizeFilterChanged = function() {
|
const searchSizeFilterChanged = () => {
|
||||||
searchSizeFilter.min = $("searchMinSizeFilter").value;
|
searchSizeFilter.min = $("searchMinSizeFilter").value;
|
||||||
searchSizeFilter.minUnit = $("searchMinSizePrefix").value;
|
searchSizeFilter.minUnit = $("searchMinSizePrefix").value;
|
||||||
searchSizeFilter.max = $("searchMaxSizeFilter").value;
|
searchSizeFilter.max = $("searchMaxSizeFilter").value;
|
||||||
|
@ -759,17 +759,17 @@ window.qBittorrent.Search ??= (() => {
|
||||||
searchFilterChanged();
|
searchFilterChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
const searchSizeFilterPrefixChanged = function() {
|
const searchSizeFilterPrefixChanged = () => {
|
||||||
if ((Number($("searchMinSizeFilter").value) !== 0) || (Number($("searchMaxSizeFilter").value) !== 0))
|
if ((Number($("searchMinSizeFilter").value) !== 0) || (Number($("searchMaxSizeFilter").value) !== 0))
|
||||||
searchSizeFilterChanged();
|
searchSizeFilterChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
const searchFilterChanged = function() {
|
const searchFilterChanged = () => {
|
||||||
searchResultsTable.updateTable();
|
searchResultsTable.updateTable();
|
||||||
$("numSearchResultsVisible").textContent = searchResultsTable.getFilteredAndSortedRows().length;
|
$("numSearchResultsVisible").textContent = searchResultsTable.getFilteredAndSortedRows().length;
|
||||||
};
|
};
|
||||||
|
|
||||||
const setupSearchTableEvents = function(enable) {
|
const setupSearchTableEvents = (enable) => {
|
||||||
const clickHandler = (e) => { downloadSearchTorrent(); };
|
const clickHandler = (e) => { downloadSearchTorrent(); };
|
||||||
if (enable) {
|
if (enable) {
|
||||||
$$(".searchTableRow").each((target) => {
|
$$(".searchTableRow").each((target) => {
|
||||||
|
@ -881,7 +881,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
};
|
};
|
||||||
|
|
||||||
new ClipboardJS(".copySearchDataToClipboard", {
|
new ClipboardJS(".copySearchDataToClipboard", {
|
||||||
text: function(trigger) {
|
text: (trigger) => {
|
||||||
switch (trigger.id) {
|
switch (trigger.id) {
|
||||||
case "copySearchTorrentName":
|
case "copySearchTorrentName":
|
||||||
return copySearchTorrentName();
|
return copySearchTorrentName();
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
MochaUI.extend({
|
MochaUI.extend({
|
||||||
addUpLimitSlider: function(hashes) {
|
addUpLimitSlider: (hashes) => {
|
||||||
if ($("uplimitSliderarea")) {
|
if ($("uplimitSliderarea")) {
|
||||||
// Get global upload limit
|
// Get global upload limit
|
||||||
let maximum = 500;
|
let maximum = 500;
|
||||||
|
@ -37,7 +37,7 @@ MochaUI.extend({
|
||||||
url: "api/v2/transfer/uploadLimit",
|
url: "api/v2/transfer/uploadLimit",
|
||||||
method: "get",
|
method: "get",
|
||||||
data: {},
|
data: {},
|
||||||
onSuccess: function(data) {
|
onSuccess: (data) => {
|
||||||
if (data) {
|
if (data) {
|
||||||
const tmp = data.toInt();
|
const tmp = data.toInt();
|
||||||
if (tmp > 0) {
|
if (tmp > 0) {
|
||||||
|
@ -61,7 +61,7 @@ MochaUI.extend({
|
||||||
steps: maximum,
|
steps: maximum,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
initialStep: up_limit.round(),
|
initialStep: up_limit.round(),
|
||||||
onChange: function(pos) {
|
onChange: (pos) => {
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
$("uplimitUpdatevalue").value = pos;
|
$("uplimitUpdatevalue").value = pos;
|
||||||
$("upLimitUnit").style.visibility = "visible";
|
$("upLimitUnit").style.visibility = "visible";
|
||||||
|
@ -70,7 +70,7 @@ MochaUI.extend({
|
||||||
$("uplimitUpdatevalue").value = "∞";
|
$("uplimitUpdatevalue").value = "∞";
|
||||||
$("upLimitUnit").style.visibility = "hidden";
|
$("upLimitUnit").style.visibility = "hidden";
|
||||||
}
|
}
|
||||||
}.bind(this)
|
}
|
||||||
});
|
});
|
||||||
// Set default value
|
// Set default value
|
||||||
if (up_limit === 0) {
|
if (up_limit === 0) {
|
||||||
|
@ -89,7 +89,7 @@ MochaUI.extend({
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join("|")
|
hashes: hashes.join("|")
|
||||||
},
|
},
|
||||||
onSuccess: function(data) {
|
onSuccess: (data) => {
|
||||||
if (data) {
|
if (data) {
|
||||||
let up_limit = data[hashes[0]];
|
let up_limit = data[hashes[0]];
|
||||||
for (const key in data) {
|
for (const key in data) {
|
||||||
|
@ -104,7 +104,7 @@ MochaUI.extend({
|
||||||
steps: maximum,
|
steps: maximum,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
initialStep: (up_limit / 1024.0).round(),
|
initialStep: (up_limit / 1024.0).round(),
|
||||||
onChange: function(pos) {
|
onChange: (pos) => {
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
$("uplimitUpdatevalue").value = pos;
|
$("uplimitUpdatevalue").value = pos;
|
||||||
$("upLimitUnit").style.visibility = "visible";
|
$("upLimitUnit").style.visibility = "visible";
|
||||||
|
@ -113,7 +113,7 @@ MochaUI.extend({
|
||||||
$("uplimitUpdatevalue").value = "∞";
|
$("uplimitUpdatevalue").value = "∞";
|
||||||
$("upLimitUnit").style.visibility = "hidden";
|
$("upLimitUnit").style.visibility = "hidden";
|
||||||
}
|
}
|
||||||
}.bind(this)
|
}
|
||||||
});
|
});
|
||||||
// Set default value
|
// Set default value
|
||||||
if (up_limit === 0) {
|
if (up_limit === 0) {
|
||||||
|
@ -133,7 +133,7 @@ MochaUI.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
addDlLimitSlider: function(hashes) {
|
addDlLimitSlider: (hashes) => {
|
||||||
if ($("dllimitSliderarea")) {
|
if ($("dllimitSliderarea")) {
|
||||||
// Get global upload limit
|
// Get global upload limit
|
||||||
let maximum = 500;
|
let maximum = 500;
|
||||||
|
@ -141,7 +141,7 @@ MochaUI.extend({
|
||||||
url: "api/v2/transfer/downloadLimit",
|
url: "api/v2/transfer/downloadLimit",
|
||||||
method: "get",
|
method: "get",
|
||||||
data: {},
|
data: {},
|
||||||
onSuccess: function(data) {
|
onSuccess: (data) => {
|
||||||
if (data) {
|
if (data) {
|
||||||
const tmp = data.toInt();
|
const tmp = data.toInt();
|
||||||
if (tmp > 0) {
|
if (tmp > 0) {
|
||||||
|
@ -165,7 +165,7 @@ MochaUI.extend({
|
||||||
steps: maximum,
|
steps: maximum,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
initialStep: dl_limit.round(),
|
initialStep: dl_limit.round(),
|
||||||
onChange: function(pos) {
|
onChange: (pos) => {
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
$("dllimitUpdatevalue").value = pos;
|
$("dllimitUpdatevalue").value = pos;
|
||||||
$("dlLimitUnit").style.visibility = "visible";
|
$("dlLimitUnit").style.visibility = "visible";
|
||||||
|
@ -174,7 +174,7 @@ MochaUI.extend({
|
||||||
$("dllimitUpdatevalue").value = "∞";
|
$("dllimitUpdatevalue").value = "∞";
|
||||||
$("dlLimitUnit").style.visibility = "hidden";
|
$("dlLimitUnit").style.visibility = "hidden";
|
||||||
}
|
}
|
||||||
}.bind(this)
|
}
|
||||||
});
|
});
|
||||||
// Set default value
|
// Set default value
|
||||||
if (dl_limit === 0) {
|
if (dl_limit === 0) {
|
||||||
|
@ -193,7 +193,7 @@ MochaUI.extend({
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join("|")
|
hashes: hashes.join("|")
|
||||||
},
|
},
|
||||||
onSuccess: function(data) {
|
onSuccess: (data) => {
|
||||||
if (data) {
|
if (data) {
|
||||||
let dl_limit = data[hashes[0]];
|
let dl_limit = data[hashes[0]];
|
||||||
for (const key in data) {
|
for (const key in data) {
|
||||||
|
@ -208,7 +208,7 @@ MochaUI.extend({
|
||||||
steps: maximum,
|
steps: maximum,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
initialStep: (dl_limit / 1024.0).round(),
|
initialStep: (dl_limit / 1024.0).round(),
|
||||||
onChange: function(pos) {
|
onChange: (pos) => {
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
$("dllimitUpdatevalue").value = pos;
|
$("dllimitUpdatevalue").value = pos;
|
||||||
$("dlLimitUnit").style.visibility = "visible";
|
$("dlLimitUnit").style.visibility = "visible";
|
||||||
|
@ -217,7 +217,7 @@ MochaUI.extend({
|
||||||
$("dllimitUpdatevalue").value = "∞";
|
$("dllimitUpdatevalue").value = "∞";
|
||||||
$("dlLimitUnit").style.visibility = "hidden";
|
$("dlLimitUnit").style.visibility = "hidden";
|
||||||
}
|
}
|
||||||
}.bind(this)
|
}
|
||||||
});
|
});
|
||||||
// Set default value
|
// Set default value
|
||||||
if (dl_limit === 0) {
|
if (dl_limit === 0) {
|
||||||
|
|
|
@ -56,10 +56,10 @@
|
||||||
hashes: hashesList,
|
hashes: hashesList,
|
||||||
location: location
|
location: location
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
},
|
},
|
||||||
onFailure: function(xhr) {
|
onFailure: (xhr) => {
|
||||||
$("error_div").textContent = xhr.response;
|
$("error_div").textContent = xhr.response;
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
|
|
@ -112,14 +112,14 @@
|
||||||
seedingTimeLimit: seedingTimeLimitValue,
|
seedingTimeLimit: seedingTimeLimitValue,
|
||||||
inactiveSeedingTimeLimit: inactiveSeedingTimeLimitValue
|
inactiveSeedingTimeLimit: inactiveSeedingTimeLimitValue
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: () => {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function getSelectedRadioValue(name) {
|
const getSelectedRadioValue = (name) => {
|
||||||
const radios = document.getElementsByName(name);
|
const radios = document.getElementsByName(name);
|
||||||
|
|
||||||
for (let i = 0; i < radios.length; ++i) {
|
for (let i = 0; i < radios.length; ++i) {
|
||||||
|
@ -127,9 +127,9 @@
|
||||||
if (radio.checked)
|
if (radio.checked)
|
||||||
return radio.value;
|
return radio.value;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
function setSelectedRadioValue(name, value) {
|
const setSelectedRadioValue = (name, value) => {
|
||||||
const radios = document.getElementsByName(name);
|
const radios = document.getElementsByName(name);
|
||||||
|
|
||||||
for (let i = 0; i < radios.length; ++i) {
|
for (let i = 0; i < radios.length; ++i) {
|
||||||
|
@ -137,9 +137,9 @@
|
||||||
if (radio.value === value)
|
if (radio.value === value)
|
||||||
radio.checked = true;
|
radio.checked = true;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
function shareLimitChanged() {
|
const shareLimitChanged = () => {
|
||||||
const customShareLimit = getSelectedRadioValue("shareLimit") === "custom";
|
const customShareLimit = getSelectedRadioValue("shareLimit") === "custom";
|
||||||
$("setRatio").disabled = !customShareLimit;
|
$("setRatio").disabled = !customShareLimit;
|
||||||
$("setTotalMinutes").disabled = !customShareLimit;
|
$("setTotalMinutes").disabled = !customShareLimit;
|
||||||
|
@ -148,20 +148,20 @@
|
||||||
enableInputBoxes();
|
enableInputBoxes();
|
||||||
|
|
||||||
$("save").disabled = !isFormValid();
|
$("save").disabled = !isFormValid();
|
||||||
}
|
};
|
||||||
|
|
||||||
function enableInputBoxes() {
|
const enableInputBoxes = () => {
|
||||||
$("ratio").disabled = $("setRatio").disabled || !$("setRatio").checked;
|
$("ratio").disabled = $("setRatio").disabled || !$("setRatio").checked;
|
||||||
$("totalMinutes").disabled = $("setTotalMinutes").disabled || !$("setTotalMinutes").checked;
|
$("totalMinutes").disabled = $("setTotalMinutes").disabled || !$("setTotalMinutes").checked;
|
||||||
$("inactiveMinutes").disabled = $("setInactiveMinutes").disabled || !$("setInactiveMinutes").checked;
|
$("inactiveMinutes").disabled = $("setInactiveMinutes").disabled || !$("setInactiveMinutes").checked;
|
||||||
|
|
||||||
$("save").disabled = !isFormValid();
|
$("save").disabled = !isFormValid();
|
||||||
}
|
};
|
||||||
|
|
||||||
function isFormValid() {
|
const isFormValid = () => {
|
||||||
return !((getSelectedRadioValue("shareLimit") === "custom") && !$("setRatio").checked
|
return !((getSelectedRadioValue("shareLimit") === "custom") && !$("setRatio").checked
|
||||||
&& !$("setTotalMinutes").checked && !$("setInactiveMinutes").checked);
|
&& !$("setTotalMinutes").checked && !$("setInactiveMinutes").checked);
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const hashes = new URI().getData("hashes").split("|");
|
const hashes = new URI().getData("hashes").split("|");
|
||||||
const setUpLimit = function() {
|
const setUpLimit = () => {
|
||||||
const limit = $("uplimitUpdatevalue").value.toInt() * 1024;
|
const limit = $("uplimitUpdatevalue").value.toInt() * 1024;
|
||||||
if (hashes[0] === "global") {
|
if (hashes[0] === "global") {
|
||||||
new Request({
|
new Request({
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
data: {
|
data: {
|
||||||
"limit": limit
|
"limit": limit
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: () => {
|
||||||
window.parent.updateMainData();
|
window.parent.updateMainData();
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
"hashes": hashes.join("|"),
|
"hashes": hashes.join("|"),
|
||||||
"limit": limit
|
"limit": limit
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: () => {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<script>
|
<script>
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
(function() {
|
(() => {
|
||||||
MochaUI.initializeTabs("aboutTabs");
|
MochaUI.initializeTabs("aboutTabs");
|
||||||
|
|
||||||
$("aboutAboutLink").addEventListener("click", () => {
|
$("aboutAboutLink").addEventListener("click", () => {
|
||||||
|
|
|
@ -32,11 +32,11 @@
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join("|"),
|
hashes: hashes.join("|"),
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
updateMainData();
|
updateMainData();
|
||||||
window.qBittorrent.Client.closeWindow("confirmRecheckDialog");
|
window.qBittorrent.Client.closeWindow("confirmRecheckDialog");
|
||||||
},
|
},
|
||||||
onFailure: function() {
|
onFailure: () => {
|
||||||
alert("QBT_TR(Unable to recheck torrents.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Unable to recheck torrents.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
data: {
|
data: {
|
||||||
"delete_torrent_content_files": deleteCB.checked
|
"delete_torrent_content_files": deleteCB.checked
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
prefDeleteContentFiles = deleteCB.checked;
|
prefDeleteContentFiles = deleteCB.checked;
|
||||||
setRememberBtnEnabled(false);
|
setRememberBtnEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -84,13 +84,13 @@
|
||||||
"hashes": hashes.join("|"),
|
"hashes": hashes.join("|"),
|
||||||
"deleteFiles": deleteCB.checked
|
"deleteFiles": deleteCB.checked
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
torrentsTable.deselectAll();
|
torrentsTable.deselectAll();
|
||||||
updateMainData();
|
updateMainData();
|
||||||
updatePropertiesPanel();
|
updatePropertiesPanel();
|
||||||
window.qBittorrent.Client.closeWindows();
|
window.qBittorrent.Client.closeWindows();
|
||||||
},
|
},
|
||||||
onFailure: function() {
|
onFailure: () => {
|
||||||
alert("QBT_TR(Unable to delete torrents.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Unable to delete torrents.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
},
|
},
|
||||||
}).send();
|
}).send();
|
||||||
|
|
|
@ -93,7 +93,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const addCookie = function() {
|
const addCookie = () => {
|
||||||
const newRow = document.querySelector("#manageCookiesTable tr.newRow").cloneNode(true);
|
const newRow = document.querySelector("#manageCookiesTable tr.newRow").cloneNode(true);
|
||||||
newRow.querySelector(".removeCookie").addEventListener("click", (event) => {
|
newRow.querySelector(".removeCookie").addEventListener("click", (event) => {
|
||||||
deleteCookie(event.target);
|
deleteCookie(event.target);
|
||||||
|
@ -103,11 +103,11 @@
|
||||||
return newRow;
|
return newRow;
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteCookie = function(element) {
|
const deleteCookie = (element) => {
|
||||||
element.closest("tr").destroy();
|
element.closest("tr").destroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
const save = function() {
|
const save = () => {
|
||||||
const rows = [...document.querySelectorAll("#manageCookiesTable tbody tr")].filter(e => !e.hasClass("invisible"));
|
const rows = [...document.querySelectorAll("#manageCookiesTable tbody tr")].filter(e => !e.hasClass("invisible"));
|
||||||
const cookies = rows.map(row => {
|
const cookies = rows.map(row => {
|
||||||
const expDateValue = row.querySelector("td.expDate input").valueAsNumber;
|
const expDateValue = row.querySelector("td.expDate input").valueAsNumber;
|
||||||
|
@ -142,7 +142,7 @@
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadCookies = function() {
|
const loadCookies = () => {
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: "api/v2/app/cookies",
|
url: "api/v2/app/cookies",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -171,7 +171,7 @@
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const setup = function() {
|
const setup = () => {
|
||||||
loadCookies();
|
loadCookies();
|
||||||
|
|
||||||
document.querySelector(".addCookie").addEventListener("click", (event) => {
|
document.querySelector(".addCookie").addEventListener("click", (event) => {
|
||||||
|
|
|
@ -114,19 +114,19 @@
|
||||||
targets: ".categoriesFilterContextMenuTarget",
|
targets: ".categoriesFilterContextMenuTarget",
|
||||||
menu: "categoriesFilterMenu",
|
menu: "categoriesFilterMenu",
|
||||||
actions: {
|
actions: {
|
||||||
createCategory: function(element, ref) {
|
createCategory: (element, ref) => {
|
||||||
createCategoryFN();
|
createCategoryFN();
|
||||||
},
|
},
|
||||||
createSubcategory: function(element, ref) {
|
createSubcategory: (element, ref) => {
|
||||||
createSubcategoryFN(Number(element.id));
|
createSubcategoryFN(Number(element.id));
|
||||||
},
|
},
|
||||||
editCategory: function(element, ref) {
|
editCategory: (element, ref) => {
|
||||||
editCategoryFN(Number(element.id));
|
editCategoryFN(Number(element.id));
|
||||||
},
|
},
|
||||||
deleteCategory: function(element, ref) {
|
deleteCategory: (element, ref) => {
|
||||||
removeCategoryFN(Number(element.id));
|
removeCategoryFN(Number(element.id));
|
||||||
},
|
},
|
||||||
deleteUnusedCategories: function(element, ref) {
|
deleteUnusedCategories: (element, ref) => {
|
||||||
deleteUnusedCategoriesFN();
|
deleteUnusedCategoriesFN();
|
||||||
},
|
},
|
||||||
startTorrents: (element, ref) => {
|
startTorrents: (element, ref) => {
|
||||||
|
@ -156,13 +156,13 @@
|
||||||
targets: ".tagsFilterContextMenuTarget",
|
targets: ".tagsFilterContextMenuTarget",
|
||||||
menu: "tagsFilterMenu",
|
menu: "tagsFilterMenu",
|
||||||
actions: {
|
actions: {
|
||||||
createTag: function(element, ref) {
|
createTag: (element, ref) => {
|
||||||
createTagFN();
|
createTagFN();
|
||||||
},
|
},
|
||||||
deleteTag: function(element, ref) {
|
deleteTag: (element, ref) => {
|
||||||
removeTagFN(Number(element.id));
|
removeTagFN(Number(element.id));
|
||||||
},
|
},
|
||||||
deleteUnusedTags: function(element, ref) {
|
deleteUnusedTags: (element, ref) => {
|
||||||
deleteUnusedTagsFN();
|
deleteUnusedTagsFN();
|
||||||
},
|
},
|
||||||
startTorrents: (element, ref) => {
|
startTorrents: (element, ref) => {
|
||||||
|
@ -192,7 +192,7 @@
|
||||||
targets: ".trackersFilterContextMenuTarget",
|
targets: ".trackersFilterContextMenuTarget",
|
||||||
menu: "trackersFilterMenu",
|
menu: "trackersFilterMenu",
|
||||||
actions: {
|
actions: {
|
||||||
deleteTracker: function(element, ref) {
|
deleteTracker: (element, ref) => {
|
||||||
deleteTrackerFN(element.id);
|
deleteTrackerFN(element.id);
|
||||||
},
|
},
|
||||||
startTorrents: (element, ref) => {
|
startTorrents: (element, ref) => {
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const setup = function() {
|
const setup = () => {
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: "keydown",
|
defaultEventType: "keydown",
|
||||||
events: {
|
events: {
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
$("newPluginPath").select();
|
$("newPluginPath").select();
|
||||||
};
|
};
|
||||||
|
|
||||||
const newPluginOk = function() {
|
const newPluginOk = () => {
|
||||||
const path = $("newPluginPath").value.trim();
|
const path = $("newPluginPath").value.trim();
|
||||||
if (path) {
|
if (path) {
|
||||||
new Request({
|
new Request({
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
data: {
|
data: {
|
||||||
sources: path,
|
sources: path,
|
||||||
},
|
},
|
||||||
onRequest: function() {
|
onRequest: () => {
|
||||||
window.qBittorrent.SearchPlugins.closeSearchWindow("installSearchPlugin");
|
window.qBittorrent.SearchPlugins.closeSearchWindow("installSearchPlugin");
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
|
|
@ -361,14 +361,14 @@
|
||||||
url: url,
|
url: url,
|
||||||
method: "get",
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onFailure: function(response) {
|
onFailure: (response) => {
|
||||||
const errorDiv = $("error_div");
|
const errorDiv = $("error_div");
|
||||||
if (errorDiv)
|
if (errorDiv)
|
||||||
errorDiv.textContent = "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: (response) => {
|
||||||
$("error_div").textContent = "";
|
$("error_div").textContent = "";
|
||||||
|
|
||||||
if ($("logTabColumn").hasClass("invisible"))
|
if ($("logTabColumn").hasClass("invisible"))
|
||||||
|
@ -412,7 +412,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
new ClipboardJS(".copyLogDataToClipboard", {
|
new ClipboardJS(".copyLogDataToClipboard", {
|
||||||
text: function() {
|
text: () => {
|
||||||
const msg = [];
|
const msg = [];
|
||||||
tableInfo[currentSelectedTab].instance.selectedRowsIds().forEach((rowId) => {
|
tableInfo[currentSelectedTab].instance.selectedRowsIds().forEach((rowId) => {
|
||||||
msg.push(tableInfo[currentSelectedTab].instance.getRow(rowId).full_data[(currentSelectedTab === "main") ? "message" : "ip"]);
|
msg.push(tableInfo[currentSelectedTab].instance.getRow(rowId).full_data[(currentSelectedTab === "main") ? "message" : "ip"]);
|
||||||
|
|
|
@ -1746,7 +1746,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
input.value = max;
|
input.value = max;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateFileLogEnabled = function() {
|
const updateFileLogEnabled = () => {
|
||||||
const isFileLogEnabled = $("filelog_checkbox").checked;
|
const isFileLogEnabled = $("filelog_checkbox").checked;
|
||||||
$("filelog_save_path_input").disabled = !isFileLogEnabled;
|
$("filelog_save_path_input").disabled = !isFileLogEnabled;
|
||||||
$("filelog_backup_checkbox").disabled = !isFileLogEnabled;
|
$("filelog_backup_checkbox").disabled = !isFileLogEnabled;
|
||||||
|
@ -1756,12 +1756,12 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
updateFileLogDeleteEnabled();
|
updateFileLogDeleteEnabled();
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateFileLogBackupEnabled = function() {
|
const updateFileLogBackupEnabled = () => {
|
||||||
const pros = $("filelog_backup_checkbox").getProperties("disabled", "checked");
|
const pros = $("filelog_backup_checkbox").getProperties("disabled", "checked");
|
||||||
$("filelog_max_size_input").disabled = pros.disabled || !pros.checked;
|
$("filelog_max_size_input").disabled = pros.disabled || !pros.checked;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateFileLogDeleteEnabled = function() {
|
const updateFileLogDeleteEnabled = () => {
|
||||||
const pros = $("filelog_delete_old_checkbox").getProperties("disabled", "checked");
|
const pros = $("filelog_delete_old_checkbox").getProperties("disabled", "checked");
|
||||||
$("filelog_age_input").disabled = pros.disabled || !pros.checked;
|
$("filelog_age_input").disabled = pros.disabled || !pros.checked;
|
||||||
$("filelog_age_type_select").disabled = pros.disabled || !pros.checked;
|
$("filelog_age_type_select").disabled = pros.disabled || !pros.checked;
|
||||||
|
@ -1770,7 +1770,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
// Downloads tab
|
// Downloads tab
|
||||||
let watchedFoldersTable;
|
let watchedFoldersTable;
|
||||||
|
|
||||||
const updateTempDirEnabled = function() {
|
const updateTempDirEnabled = () => {
|
||||||
const isTempDirEnabled = $("temppath_checkbox").checked;
|
const isTempDirEnabled = $("temppath_checkbox").checked;
|
||||||
$("temppath_text").disabled = !isTempDirEnabled;
|
$("temppath_text").disabled = !isTempDirEnabled;
|
||||||
};
|
};
|
||||||
|
@ -1835,22 +1835,22 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
return folders;
|
return folders;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateExcludedFileNamesEnabled = function() {
|
const updateExcludedFileNamesEnabled = () => {
|
||||||
const isAExcludedFileNamesEnabled = $("excludedFileNamesCheckbox").checked;
|
const isAExcludedFileNamesEnabled = $("excludedFileNamesCheckbox").checked;
|
||||||
$("excludedFileNamesTextarea").disabled = !isAExcludedFileNamesEnabled;
|
$("excludedFileNamesTextarea").disabled = !isAExcludedFileNamesEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateExportDirEnabled = function() {
|
const updateExportDirEnabled = () => {
|
||||||
const isExportDirEnabled = $("exportdir_checkbox").checked;
|
const isExportDirEnabled = $("exportdir_checkbox").checked;
|
||||||
$("exportdir_text").disabled = !isExportDirEnabled;
|
$("exportdir_text").disabled = !isExportDirEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateExportDirFinEnabled = function() {
|
const updateExportDirFinEnabled = () => {
|
||||||
const isExportDirFinEnabled = $("exportdirfin_checkbox").checked;
|
const isExportDirFinEnabled = $("exportdirfin_checkbox").checked;
|
||||||
$("exportdirfin_text").disabled = !isExportDirFinEnabled;
|
$("exportdirfin_text").disabled = !isExportDirFinEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateMailNotification = function() {
|
const updateMailNotification = () => {
|
||||||
const isMailNotificationEnabled = $("mail_notification_checkbox").checked;
|
const isMailNotificationEnabled = $("mail_notification_checkbox").checked;
|
||||||
$("src_email_txt").disabled = !isMailNotificationEnabled;
|
$("src_email_txt").disabled = !isMailNotificationEnabled;
|
||||||
$("dest_email_txt").disabled = !isMailNotificationEnabled;
|
$("dest_email_txt").disabled = !isMailNotificationEnabled;
|
||||||
|
@ -1865,65 +1865,65 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateMailAuthSettings = function() {
|
const updateMailAuthSettings = () => {
|
||||||
const isMailAuthEnabled = $("mail_auth_checkbox").checked;
|
const isMailAuthEnabled = $("mail_auth_checkbox").checked;
|
||||||
$("mail_username_text").disabled = !isMailAuthEnabled;
|
$("mail_username_text").disabled = !isMailAuthEnabled;
|
||||||
$("mail_password_text").disabled = !isMailAuthEnabled;
|
$("mail_password_text").disabled = !isMailAuthEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
const sendTestEmail = function() {
|
const sendTestEmail = () => {
|
||||||
new Request({
|
new Request({
|
||||||
url: "api/v2/app/sendTestEmail",
|
url: "api/v2/app/sendTestEmail",
|
||||||
method: "post",
|
method: "post",
|
||||||
onFailure: function() {
|
onFailure: () => {
|
||||||
alert("QBT_TR(Could not contact qBittorrent)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Could not contact qBittorrent)QBT_TR[CONTEXT=HttpServer]");
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
alert("QBT_TR(Attempted to send email. Check your inbox to confirm success)QBT_TR[CONTEXT=OptionsDialog]");
|
alert("QBT_TR(Attempted to send email. Check your inbox to confirm success)QBT_TR[CONTEXT=OptionsDialog]");
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateAutoRunOnTorrentAdded = function() {
|
const updateAutoRunOnTorrentAdded = () => {
|
||||||
const isAutoRunOnTorrentAddedEnabled = $("autorunOnTorrentAddedCheckbox").checked;
|
const isAutoRunOnTorrentAddedEnabled = $("autorunOnTorrentAddedCheckbox").checked;
|
||||||
$("autorunOnTorrentAddedProgram").disabled = !isAutoRunOnTorrentAddedEnabled;
|
$("autorunOnTorrentAddedProgram").disabled = !isAutoRunOnTorrentAddedEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateAutoRun = function() {
|
const updateAutoRun = () => {
|
||||||
const isAutoRunEnabled = $("autorun_checkbox").checked;
|
const isAutoRunEnabled = $("autorun_checkbox").checked;
|
||||||
$("autorunProg_txt").disabled = !isAutoRunEnabled;
|
$("autorunProg_txt").disabled = !isAutoRunEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Connection tab
|
// Connection tab
|
||||||
|
|
||||||
const updateMaxConnecEnabled = function() {
|
const updateMaxConnecEnabled = () => {
|
||||||
const isMaxConnecEnabled = $("max_connec_checkbox").checked;
|
const isMaxConnecEnabled = $("max_connec_checkbox").checked;
|
||||||
$("max_connec_value").disabled = !isMaxConnecEnabled;
|
$("max_connec_value").disabled = !isMaxConnecEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateMaxConnecPerTorrentEnabled = function() {
|
const updateMaxConnecPerTorrentEnabled = () => {
|
||||||
const isMaxConnecPerTorrentEnabled = $("max_connec_per_torrent_checkbox").checked;
|
const isMaxConnecPerTorrentEnabled = $("max_connec_per_torrent_checkbox").checked;
|
||||||
$("max_connec_per_torrent_value").disabled = !isMaxConnecPerTorrentEnabled;
|
$("max_connec_per_torrent_value").disabled = !isMaxConnecPerTorrentEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateMaxUploadsEnabled = function() {
|
const updateMaxUploadsEnabled = () => {
|
||||||
const isMaxUploadsEnabled = $("max_uploads_checkbox").checked;
|
const isMaxUploadsEnabled = $("max_uploads_checkbox").checked;
|
||||||
$("max_uploads_value").disabled = !isMaxUploadsEnabled;
|
$("max_uploads_value").disabled = !isMaxUploadsEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateMaxUploadsPerTorrentEnabled = function() {
|
const updateMaxUploadsPerTorrentEnabled = () => {
|
||||||
const isMaxUploadsPerTorrentEnabled = $("max_uploads_per_torrent_checkbox").checked;
|
const isMaxUploadsPerTorrentEnabled = $("max_uploads_per_torrent_checkbox").checked;
|
||||||
$("max_uploads_per_torrent_value").disabled = !isMaxUploadsPerTorrentEnabled;
|
$("max_uploads_per_torrent_value").disabled = !isMaxUploadsPerTorrentEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateI2PSettingsEnabled = function() {
|
const updateI2PSettingsEnabled = () => {
|
||||||
const isI2PEnabled = $("i2pEnabledCheckbox").checked;
|
const isI2PEnabled = $("i2pEnabledCheckbox").checked;
|
||||||
$("i2pAddress").disabled = !isI2PEnabled;
|
$("i2pAddress").disabled = !isI2PEnabled;
|
||||||
$("i2pPort").disabled = !isI2PEnabled;
|
$("i2pPort").disabled = !isI2PEnabled;
|
||||||
$("i2pMixedMode").disabled = !isI2PEnabled;
|
$("i2pMixedMode").disabled = !isI2PEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updatePeerProxySettings = function() {
|
const updatePeerProxySettings = () => {
|
||||||
const proxyType = $("peer_proxy_type_select").value;
|
const proxyType = $("peer_proxy_type_select").value;
|
||||||
const isProxyDisabled = (proxyType === "None");
|
const isProxyDisabled = (proxyType === "None");
|
||||||
const isProxySocks4 = (proxyType === "SOCKS4");
|
const isProxySocks4 = (proxyType === "SOCKS4");
|
||||||
|
@ -1941,7 +1941,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
updatePeerProxyAuthSettings();
|
updatePeerProxyAuthSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
const updatePeerProxyAuthSettings = function() {
|
const updatePeerProxyAuthSettings = () => {
|
||||||
const proxyType = $("peer_proxy_type_select").value;
|
const proxyType = $("peer_proxy_type_select").value;
|
||||||
const isProxyDisabled = (proxyType === "None");
|
const isProxyDisabled = (proxyType === "None");
|
||||||
const isPeerProxyAuthEnabled = (!$("peer_proxy_auth_checkbox").disabled && $("peer_proxy_auth_checkbox").checked);
|
const isPeerProxyAuthEnabled = (!$("peer_proxy_auth_checkbox").disabled && $("peer_proxy_auth_checkbox").checked);
|
||||||
|
@ -1949,13 +1949,13 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
$("peer_proxy_password_text").disabled = (isProxyDisabled || !isPeerProxyAuthEnabled);
|
$("peer_proxy_password_text").disabled = (isProxyDisabled || !isPeerProxyAuthEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateFilterSettings = function() {
|
const updateFilterSettings = () => {
|
||||||
const isIPFilterEnabled = $("ipfilter_text_checkbox").checked;
|
const isIPFilterEnabled = $("ipfilter_text_checkbox").checked;
|
||||||
$("ipfilter_text").disabled = !isIPFilterEnabled;
|
$("ipfilter_text").disabled = !isIPFilterEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Speed tab
|
// Speed tab
|
||||||
const updateSchedulingEnabled = function() {
|
const updateSchedulingEnabled = () => {
|
||||||
const isLimitSchedulingEnabled = $("limitSchedulingCheckbox").checked;
|
const isLimitSchedulingEnabled = $("limitSchedulingCheckbox").checked;
|
||||||
$("schedule_from_hour").disabled = !isLimitSchedulingEnabled;
|
$("schedule_from_hour").disabled = !isLimitSchedulingEnabled;
|
||||||
$("schedule_from_min").disabled = !isLimitSchedulingEnabled;
|
$("schedule_from_min").disabled = !isLimitSchedulingEnabled;
|
||||||
|
@ -1965,7 +1965,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
};
|
};
|
||||||
|
|
||||||
// Bittorrent tab
|
// Bittorrent tab
|
||||||
const updateQueueingSystem = function() {
|
const updateQueueingSystem = () => {
|
||||||
const isQueueingEnabled = $("queueing_checkbox").checked;
|
const isQueueingEnabled = $("queueing_checkbox").checked;
|
||||||
$("max_active_dl_value").disabled = !isQueueingEnabled;
|
$("max_active_dl_value").disabled = !isQueueingEnabled;
|
||||||
$("max_active_up_value").disabled = !isQueueingEnabled;
|
$("max_active_up_value").disabled = !isQueueingEnabled;
|
||||||
|
@ -1974,14 +1974,14 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
updateSlowTorrentsSettings();
|
updateSlowTorrentsSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateSlowTorrentsSettings = function() {
|
const updateSlowTorrentsSettings = () => {
|
||||||
const isDontCountSlowTorrentsEnabled = (!$("dont_count_slow_torrents_checkbox").disabled) && $("dont_count_slow_torrents_checkbox").checked;
|
const isDontCountSlowTorrentsEnabled = (!$("dont_count_slow_torrents_checkbox").disabled) && $("dont_count_slow_torrents_checkbox").checked;
|
||||||
$("dl_rate_threshold").disabled = !isDontCountSlowTorrentsEnabled;
|
$("dl_rate_threshold").disabled = !isDontCountSlowTorrentsEnabled;
|
||||||
$("ul_rate_threshold").disabled = !isDontCountSlowTorrentsEnabled;
|
$("ul_rate_threshold").disabled = !isDontCountSlowTorrentsEnabled;
|
||||||
$("torrent_inactive_timer").disabled = !isDontCountSlowTorrentsEnabled;
|
$("torrent_inactive_timer").disabled = !isDontCountSlowTorrentsEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateMaxRatioTimeEnabled = function() {
|
const updateMaxRatioTimeEnabled = () => {
|
||||||
const isMaxRatioEnabled = $("max_ratio_checkbox").checked;
|
const isMaxRatioEnabled = $("max_ratio_checkbox").checked;
|
||||||
$("max_ratio_value").disabled = !isMaxRatioEnabled;
|
$("max_ratio_value").disabled = !isMaxRatioEnabled;
|
||||||
|
|
||||||
|
@ -1994,44 +1994,44 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
$("max_ratio_act").disabled = !(isMaxRatioEnabled || isMaxSeedingTimeEnabled || isMaxInactiveSeedingTimeEnabled);
|
$("max_ratio_act").disabled = !(isMaxRatioEnabled || isMaxSeedingTimeEnabled || isMaxInactiveSeedingTimeEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateAddTrackersEnabled = function() {
|
const updateAddTrackersEnabled = () => {
|
||||||
const isAddTrackersEnabled = $("add_trackers_checkbox").checked;
|
const isAddTrackersEnabled = $("add_trackers_checkbox").checked;
|
||||||
$("add_trackers_textarea").disabled = !isAddTrackersEnabled;
|
$("add_trackers_textarea").disabled = !isAddTrackersEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
// WebUI tab
|
// WebUI tab
|
||||||
const updateHttpsSettings = function() {
|
const updateHttpsSettings = () => {
|
||||||
const isUseHttpsEnabled = $("use_https_checkbox").checked;
|
const isUseHttpsEnabled = $("use_https_checkbox").checked;
|
||||||
$("ssl_cert_text").disabled = !isUseHttpsEnabled;
|
$("ssl_cert_text").disabled = !isUseHttpsEnabled;
|
||||||
$("ssl_key_text").disabled = !isUseHttpsEnabled;
|
$("ssl_key_text").disabled = !isUseHttpsEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateBypasssAuthSettings = function() {
|
const updateBypasssAuthSettings = () => {
|
||||||
const isBypassAuthSubnetWhitelistEnabled = $("bypass_auth_subnet_whitelist_checkbox").checked;
|
const isBypassAuthSubnetWhitelistEnabled = $("bypass_auth_subnet_whitelist_checkbox").checked;
|
||||||
$("bypass_auth_subnet_whitelist_textarea").disabled = !isBypassAuthSubnetWhitelistEnabled;
|
$("bypass_auth_subnet_whitelist_textarea").disabled = !isBypassAuthSubnetWhitelistEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateAlternativeWebUISettings = function() {
|
const updateAlternativeWebUISettings = () => {
|
||||||
const isUseAlternativeWebUIEnabled = $("use_alt_webui_checkbox").checked;
|
const isUseAlternativeWebUIEnabled = $("use_alt_webui_checkbox").checked;
|
||||||
$("webui_files_location_textarea").disabled = !isUseAlternativeWebUIEnabled;
|
$("webui_files_location_textarea").disabled = !isUseAlternativeWebUIEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateHostHeaderValidationSettings = function() {
|
const updateHostHeaderValidationSettings = () => {
|
||||||
const isHostHeaderValidationEnabled = $("host_header_validation_checkbox").checked;
|
const isHostHeaderValidationEnabled = $("host_header_validation_checkbox").checked;
|
||||||
$("webui_domain_textarea").disabled = !isHostHeaderValidationEnabled;
|
$("webui_domain_textarea").disabled = !isHostHeaderValidationEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateWebUICustomHTTPHeadersSettings = function() {
|
const updateWebUICustomHTTPHeadersSettings = () => {
|
||||||
const isEnabled = $("webUIUseCustomHTTPHeadersCheckbox").checked;
|
const isEnabled = $("webUIUseCustomHTTPHeadersCheckbox").checked;
|
||||||
$("webUICustomHTTPHeadersTextarea").disabled = !isEnabled;
|
$("webUICustomHTTPHeadersTextarea").disabled = !isEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateWebUIReverseProxySettings = function() {
|
const updateWebUIReverseProxySettings = () => {
|
||||||
const isEnabled = $("webUIReverseProxySupportCheckbox").checked;
|
const isEnabled = $("webUIReverseProxySupportCheckbox").checked;
|
||||||
$("webUIReverseProxiesListTextarea").disabled = !isEnabled;
|
$("webUIReverseProxiesListTextarea").disabled = !isEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateDynDnsSettings = function() {
|
const updateDynDnsSettings = () => {
|
||||||
const isDynDnsEnabled = $("use_dyndns_checkbox").checked;
|
const isDynDnsEnabled = $("use_dyndns_checkbox").checked;
|
||||||
$("dyndns_select").disabled = !isDynDnsEnabled;
|
$("dyndns_select").disabled = !isDynDnsEnabled;
|
||||||
$("dyndns_domain_text").disabled = !isDynDnsEnabled;
|
$("dyndns_domain_text").disabled = !isDynDnsEnabled;
|
||||||
|
@ -2039,21 +2039,21 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
$("dyndns_password_text").disabled = !isDynDnsEnabled;
|
$("dyndns_password_text").disabled = !isDynDnsEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
const registerDynDns = function() {
|
const registerDynDns = () => {
|
||||||
if ($("dyndns_select").value.toInt() === 1)
|
if ($("dyndns_select").value.toInt() === 1)
|
||||||
window.open("http://www.no-ip.com/services/managed_dns/free_dynamic_dns.html", "NO-IP Registration");
|
window.open("http://www.no-ip.com/services/managed_dns/free_dynamic_dns.html", "NO-IP Registration");
|
||||||
else
|
else
|
||||||
window.open("https://www.dyndns.com/account/services/hosts/add.html", "DynDNS Registration");
|
window.open("https://www.dyndns.com/account/services/hosts/add.html", "DynDNS Registration");
|
||||||
};
|
};
|
||||||
|
|
||||||
const generateRandomPort = function() {
|
const generateRandomPort = () => {
|
||||||
const min = 1024;
|
const min = 1024;
|
||||||
const max = 65535;
|
const max = 65535;
|
||||||
const port = Math.floor(Math.random() * (max - min + 1) + min);
|
const port = Math.floor(Math.random() * (max - min + 1) + min);
|
||||||
$("port_value").value = port;
|
$("port_value").value = port;
|
||||||
};
|
};
|
||||||
|
|
||||||
const time_padding = function(val) {
|
const time_padding = (val) => {
|
||||||
let ret = val.toString();
|
let ret = val.toString();
|
||||||
if (ret.length === 1)
|
if (ret.length === 1)
|
||||||
ret = "0" + ret;
|
ret = "0" + ret;
|
||||||
|
@ -2061,17 +2061,17 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
};
|
};
|
||||||
|
|
||||||
// Advanced Tab
|
// Advanced Tab
|
||||||
const updateNetworkInterfaces = function(default_iface, default_iface_name) {
|
const updateNetworkInterfaces = (default_iface, default_iface_name) => {
|
||||||
const url = "api/v2/app/networkInterfaceList";
|
const url = "api/v2/app/networkInterfaceList";
|
||||||
$("networkInterface").getChildren().each(c => c.destroy());
|
$("networkInterface").getChildren().each(c => c.destroy());
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: url,
|
url: url,
|
||||||
method: "get",
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onFailure: function() {
|
onFailure: () => {
|
||||||
alert("Could not contact qBittorrent");
|
alert("Could not contact qBittorrent");
|
||||||
},
|
},
|
||||||
onSuccess: function(ifaces) {
|
onSuccess: (ifaces) => {
|
||||||
if (!Array.isArray(ifaces))
|
if (!Array.isArray(ifaces))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -2088,7 +2088,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateInterfaceAddresses = function(iface, default_addr) {
|
const updateInterfaceAddresses = (iface, default_addr) => {
|
||||||
const url = "api/v2/app/networkInterfaceAddressList";
|
const url = "api/v2/app/networkInterfaceAddressList";
|
||||||
$("optionalIPAddressToBind").getChildren().each(c => c.destroy());
|
$("optionalIPAddressToBind").getChildren().each(c => c.destroy());
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
|
@ -2098,10 +2098,10 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
data: {
|
data: {
|
||||||
"iface": iface
|
"iface": iface
|
||||||
},
|
},
|
||||||
onFailure: function() {
|
onFailure: () => {
|
||||||
alert("Could not contact qBittorrent");
|
alert("Could not contact qBittorrent");
|
||||||
},
|
},
|
||||||
onSuccess: function(addresses) {
|
onSuccess: (addresses) => {
|
||||||
if (!addresses)
|
if (!addresses)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -2128,7 +2128,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
$("locale_select").value = selected;
|
$("locale_select").value = selected;
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadPreferences = function() {
|
const loadPreferences = () => {
|
||||||
window.parent.qBittorrent.Cache.preferences.init({
|
window.parent.qBittorrent.Cache.preferences.init({
|
||||||
onSuccess: (pref) => {
|
onSuccess: (pref) => {
|
||||||
// Behavior tab
|
// Behavior tab
|
||||||
|
@ -2546,7 +2546,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const applyPreferences = function() {
|
const applyPreferences = () => {
|
||||||
const settings = {};
|
const settings = {};
|
||||||
// Validate form data
|
// Validate form data
|
||||||
|
|
||||||
|
@ -3005,11 +3005,11 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
// Send it to qBT
|
// Send it to qBT
|
||||||
window.parent.qBittorrent.Cache.preferences.set({
|
window.parent.qBittorrent.Cache.preferences.set({
|
||||||
data: settings,
|
data: settings,
|
||||||
onFailure: function() {
|
onFailure: () => {
|
||||||
alert("QBT_TR(Unable to save program preferences, qBittorrent is probably unreachable.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Unable to save program preferences, qBittorrent is probably unreachable.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: () => {
|
||||||
// Close window
|
// Close window
|
||||||
window.parent.location.reload();
|
window.parent.location.reload();
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<script>
|
<script>
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
(function() {
|
(() => {
|
||||||
// Tabs
|
// Tabs
|
||||||
MochaUI.initializeTabs("preferencesTabs");
|
MochaUI.initializeTabs("preferencesTabs");
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@
|
||||||
let prevOffsetLeft;
|
let prevOffsetLeft;
|
||||||
let prevOffsetTop;
|
let prevOffsetTop;
|
||||||
|
|
||||||
const setup = function() {
|
const setup = () => {
|
||||||
searchPluginsTable = new window.qBittorrent.DynamicTable.SearchPluginsTable();
|
searchPluginsTable = new window.qBittorrent.DynamicTable.SearchPluginsTable();
|
||||||
searchPluginsTableContextMenu = new window.qBittorrent.ContextMenu.SearchPluginsTableContextMenu({
|
searchPluginsTableContextMenu = new window.qBittorrent.ContextMenu.SearchPluginsTableContextMenu({
|
||||||
targets: ".searchPluginsTableRow",
|
targets: ".searchPluginsTableRow",
|
||||||
|
@ -107,11 +107,11 @@
|
||||||
updateTable();
|
updateTable();
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeSearchWindow = function(id) {
|
const closeSearchWindow = (id) => {
|
||||||
window.parent.MochaUI.closeWindow(window.parent.$(id));
|
window.parent.MochaUI.closeWindow(window.parent.$(id));
|
||||||
};
|
};
|
||||||
|
|
||||||
const installPlugin = function(path) {
|
const installPlugin = (path) => {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: "installSearchPlugin",
|
id: "installSearchPlugin",
|
||||||
icon: "images/qbittorrent-tray.svg",
|
icon: "images/qbittorrent-tray.svg",
|
||||||
|
@ -128,7 +128,7 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const uninstallPlugin = function() {
|
const uninstallPlugin = () => {
|
||||||
const plugins = searchPluginsTable.selectedRowsIds().join("|");
|
const plugins = searchPluginsTable.selectedRowsIds().join("|");
|
||||||
const url = new URI("api/v2/search/uninstallPlugin");
|
const url = new URI("api/v2/search/uninstallPlugin");
|
||||||
new Request({
|
new Request({
|
||||||
|
@ -140,7 +140,7 @@
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const enablePlugin = function() {
|
const enablePlugin = () => {
|
||||||
const plugins = searchPluginsTable.selectedRowsIds();
|
const plugins = searchPluginsTable.selectedRowsIds();
|
||||||
let enable = true;
|
let enable = true;
|
||||||
if (plugins && plugins.length)
|
if (plugins && plugins.length)
|
||||||
|
@ -157,7 +157,7 @@
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkForUpdates = function() {
|
const checkForUpdates = () => {
|
||||||
const url = new URI("api/v2/search/updatePlugins");
|
const url = new URI("api/v2/search/updatePlugins");
|
||||||
new Request({
|
new Request({
|
||||||
url: url,
|
url: url,
|
||||||
|
@ -165,7 +165,7 @@
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const calculateContextMenuOffsets = function() {
|
const calculateContextMenuOffsets = () => {
|
||||||
prevOffsetLeft = document.getElementById("searchPlugins").getBoundingClientRect().left;
|
prevOffsetLeft = document.getElementById("searchPlugins").getBoundingClientRect().left;
|
||||||
prevOffsetTop = document.getElementById("searchPlugins").getBoundingClientRect().top;
|
prevOffsetTop = document.getElementById("searchPlugins").getBoundingClientRect().top;
|
||||||
|
|
||||||
|
@ -175,13 +175,13 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateSearchPluginsTableContextMenuOffset = function() {
|
const updateSearchPluginsTableContextMenuOffset = () => {
|
||||||
// only re-calculate if window has moved
|
// only re-calculate if window has moved
|
||||||
if ((prevOffsetLeft !== document.getElementById("searchPlugins").getBoundingClientRect().left) || (prevOffsetTop !== document.getElementById("searchPlugins").getBoundingClientRect().top))
|
if ((prevOffsetLeft !== document.getElementById("searchPlugins").getBoundingClientRect().left) || (prevOffsetTop !== document.getElementById("searchPlugins").getBoundingClientRect().top))
|
||||||
searchPluginsTableContextMenu.options.offsets = calculateContextMenuOffsets();
|
searchPluginsTableContextMenu.options.offsets = calculateContextMenuOffsets();
|
||||||
};
|
};
|
||||||
|
|
||||||
const setupSearchPluginTableEvents = function(enable) {
|
const setupSearchPluginTableEvents = (enable) => {
|
||||||
const clickHandler = (e) => { enablePlugin(); };
|
const clickHandler = (e) => { enablePlugin(); };
|
||||||
const menuHandler = (e) => { updateSearchPluginsTableContextMenuOffset(); };
|
const menuHandler = (e) => { updateSearchPluginsTableContextMenuOffset(); };
|
||||||
if (enable) {
|
if (enable) {
|
||||||
|
@ -198,7 +198,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateTable = function() {
|
const updateTable = () => {
|
||||||
// clear event listeners
|
// clear event listeners
|
||||||
setupSearchPluginTableEvents(false);
|
setupSearchPluginTableEvents(false);
|
||||||
|
|
||||||
|
|
|
@ -32,75 +32,75 @@
|
||||||
targets: ".torrentsTableContextMenuTarget",
|
targets: ".torrentsTableContextMenuTarget",
|
||||||
menu: "torrentsTableMenu",
|
menu: "torrentsTableMenu",
|
||||||
actions: {
|
actions: {
|
||||||
start: function(element, ref) {
|
start: (element, ref) => {
|
||||||
startFN();
|
startFN();
|
||||||
},
|
},
|
||||||
stop: function(element, ref) {
|
stop: (element, ref) => {
|
||||||
stopFN();
|
stopFN();
|
||||||
},
|
},
|
||||||
forceStart: function(element, ref) {
|
forceStart: (element, ref) => {
|
||||||
setForceStartFN();
|
setForceStartFN();
|
||||||
},
|
},
|
||||||
|
|
||||||
delete: function(element, ref) {
|
delete: (element, ref) => {
|
||||||
deleteSelectedTorrentsFN();
|
deleteSelectedTorrentsFN();
|
||||||
},
|
},
|
||||||
|
|
||||||
setLocation: function(element, ref) {
|
setLocation: (element, ref) => {
|
||||||
setLocationFN();
|
setLocationFN();
|
||||||
},
|
},
|
||||||
|
|
||||||
rename: function(element, ref) {
|
rename: (element, ref) => {
|
||||||
renameFN();
|
renameFN();
|
||||||
},
|
},
|
||||||
renameFiles: function(element, ref) {
|
renameFiles: (element, ref) => {
|
||||||
renameFilesFN();
|
renameFilesFN();
|
||||||
},
|
},
|
||||||
queueTop: function(element, ref) {
|
queueTop: (element, ref) => {
|
||||||
setQueuePositionFN("topPrio");
|
setQueuePositionFN("topPrio");
|
||||||
},
|
},
|
||||||
queueUp: function(element, ref) {
|
queueUp: (element, ref) => {
|
||||||
setQueuePositionFN("increasePrio");
|
setQueuePositionFN("increasePrio");
|
||||||
},
|
},
|
||||||
queueDown: function(element, ref) {
|
queueDown: (element, ref) => {
|
||||||
setQueuePositionFN("decreasePrio");
|
setQueuePositionFN("decreasePrio");
|
||||||
},
|
},
|
||||||
queueBottom: function(element, ref) {
|
queueBottom: (element, ref) => {
|
||||||
setQueuePositionFN("bottomPrio");
|
setQueuePositionFN("bottomPrio");
|
||||||
},
|
},
|
||||||
|
|
||||||
downloadLimit: function(element, ref) {
|
downloadLimit: (element, ref) => {
|
||||||
downloadLimitFN();
|
downloadLimitFN();
|
||||||
},
|
},
|
||||||
uploadLimit: function(element, ref) {
|
uploadLimit: (element, ref) => {
|
||||||
uploadLimitFN();
|
uploadLimitFN();
|
||||||
},
|
},
|
||||||
shareRatio: function(element, ref) {
|
shareRatio: (element, ref) => {
|
||||||
shareRatioFN();
|
shareRatioFN();
|
||||||
},
|
},
|
||||||
|
|
||||||
sequentialDownload: function(element, ref) {
|
sequentialDownload: (element, ref) => {
|
||||||
toggleSequentialDownloadFN();
|
toggleSequentialDownloadFN();
|
||||||
},
|
},
|
||||||
firstLastPiecePrio: function(element, ref) {
|
firstLastPiecePrio: (element, ref) => {
|
||||||
toggleFirstLastPiecePrioFN();
|
toggleFirstLastPiecePrioFN();
|
||||||
},
|
},
|
||||||
|
|
||||||
autoTorrentManagement: function(element, ref) {
|
autoTorrentManagement: (element, ref) => {
|
||||||
autoTorrentManagementFN();
|
autoTorrentManagementFN();
|
||||||
},
|
},
|
||||||
forceRecheck: function(element, ref) {
|
forceRecheck: (element, ref) => {
|
||||||
recheckFN();
|
recheckFN();
|
||||||
},
|
},
|
||||||
forceReannounce: function(element, ref) {
|
forceReannounce: (element, ref) => {
|
||||||
reannounceFN();
|
reannounceFN();
|
||||||
},
|
},
|
||||||
|
|
||||||
superSeeding: function(element, ref) {
|
superSeeding: (element, ref) => {
|
||||||
setSuperSeedingFN(!ref.getItemChecked("superSeeding"));
|
setSuperSeedingFN(!ref.getItemChecked("superSeeding"));
|
||||||
},
|
},
|
||||||
|
|
||||||
exportTorrent: function(element, ref) {
|
exportTorrent: (element, ref) => {
|
||||||
exportTorrentFN();
|
exportTorrentFN();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function submitLoginForm(event) {
|
const submitLoginForm = (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const errorMsgElement = document.getElementById("error_msg");
|
const errorMsgElement = document.getElementById("error_msg");
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ function submitLoginForm(event) {
|
||||||
|
|
||||||
// clear the field
|
// clear the field
|
||||||
passwordElement.value = "";
|
passwordElement.value = "";
|
||||||
}
|
};
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
const loginForm = document.getElementById("loginform");
|
const loginForm = document.getElementById("loginform");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue