mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-11 15:56:17 -07:00
WebUI: enforce usage of const
whenever possible
This commit is contained in:
parent
cb90b6769c
commit
55bff4f07a
12 changed files with 102 additions and 100 deletions
|
@ -29,6 +29,8 @@ export default [
|
||||||
"eqeqeq": "error",
|
"eqeqeq": "error",
|
||||||
"no-undef": "off",
|
"no-undef": "off",
|
||||||
"no-unused-vars": "off",
|
"no-unused-vars": "off",
|
||||||
|
"no-var": "error",
|
||||||
|
"prefer-const": "error",
|
||||||
"Stylistic/no-mixed-operators": [
|
"Stylistic/no-mixed-operators": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,9 +19,9 @@
|
||||||
}
|
}
|
||||||
window.qBittorrent = window.parent.qBittorrent;
|
window.qBittorrent = window.parent.qBittorrent;
|
||||||
|
|
||||||
var TriState = window.qBittorrent.FileTree.TriState;
|
const TriState = window.qBittorrent.FileTree.TriState;
|
||||||
var data = window.MUI.Windows.instances["multiRenamePage"].options.data;
|
const data = window.MUI.Windows.instances["multiRenamePage"].options.data;
|
||||||
var bulkRenameFilesContextMenu;
|
let bulkRenameFilesContextMenu;
|
||||||
if (!bulkRenameFilesContextMenu) {
|
if (!bulkRenameFilesContextMenu) {
|
||||||
bulkRenameFilesContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({
|
bulkRenameFilesContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({
|
||||||
targets: "#bulkRenameFilesTableDiv tr",
|
targets: "#bulkRenameFilesTableDiv tr",
|
||||||
|
@ -44,12 +44,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the dynamic table for bulk renaming
|
// Setup the dynamic table for bulk renaming
|
||||||
var bulkRenameFilesTable = new window.qBittorrent.DynamicTable.BulkRenameTorrentFilesTable();
|
const bulkRenameFilesTable = new window.qBittorrent.DynamicTable.BulkRenameTorrentFilesTable();
|
||||||
bulkRenameFilesTable.setup("bulkRenameFilesTableDiv", "bulkRenameFilesTableFixedHeaderDiv", bulkRenameFilesContextMenu);
|
bulkRenameFilesTable.setup("bulkRenameFilesTableDiv", "bulkRenameFilesTableFixedHeaderDiv", bulkRenameFilesContextMenu);
|
||||||
|
|
||||||
// Inject checkbox into the first column of the table header
|
// Inject checkbox into the first column of the table header
|
||||||
var tableHeaders = $$("#bulkRenameFilesTableFixedHeaderDiv .dynamicTableHeader th");
|
const tableHeaders = $$("#bulkRenameFilesTableFixedHeaderDiv .dynamicTableHeader th");
|
||||||
var checkboxHeader;
|
let checkboxHeader;
|
||||||
if (tableHeaders.length > 0) {
|
if (tableHeaders.length > 0) {
|
||||||
if (checkboxHeader) {
|
if (checkboxHeader) {
|
||||||
checkboxHeader.remove();
|
checkboxHeader.remove();
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
|
|
||||||
// Register keyboard events to modal window
|
// Register keyboard events to modal window
|
||||||
// https://github.com/qbittorrent/qBittorrent/pull/18687#discussion_r1135045726
|
// https://github.com/qbittorrent/qBittorrent/pull/18687#discussion_r1135045726
|
||||||
var keyboard;
|
let keyboard;
|
||||||
if (!keyboard) {
|
if (!keyboard) {
|
||||||
keyboard = new Keyboard({
|
keyboard = new Keyboard({
|
||||||
defaultEventType: "keydown",
|
defaultEventType: "keydown",
|
||||||
|
@ -87,53 +87,53 @@
|
||||||
keyboard.activate();
|
keyboard.activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
var fileRenamer = new window.qBittorrent.MultiRename.RenameFiles();
|
const fileRenamer = new window.qBittorrent.MultiRename.RenameFiles();
|
||||||
fileRenamer.hash = data.hash;
|
fileRenamer.hash = data.hash;
|
||||||
|
|
||||||
// Load Multi Rename Preferences
|
// Load Multi Rename Preferences
|
||||||
var multiRenamePrefChecked = LocalPreferences.get("multirename_rememberPreferences", "true") === "true";
|
const multiRenamePrefChecked = LocalPreferences.get("multirename_rememberPreferences", "true") === "true";
|
||||||
$("multirename_rememberprefs_checkbox").setProperty("checked", multiRenamePrefChecked);
|
$("multirename_rememberprefs_checkbox").setProperty("checked", multiRenamePrefChecked);
|
||||||
|
|
||||||
if (multiRenamePrefChecked) {
|
if (multiRenamePrefChecked) {
|
||||||
var multirename_search = LocalPreferences.get("multirename_search", "");
|
const multirename_search = LocalPreferences.get("multirename_search", "");
|
||||||
fileRenamer.setSearch(multirename_search);
|
fileRenamer.setSearch(multirename_search);
|
||||||
$("multiRenameSearch").set("value", multirename_search);
|
$("multiRenameSearch").set("value", multirename_search);
|
||||||
|
|
||||||
var multirename_useRegex = LocalPreferences.get("multirename_useRegex", false);
|
const multirename_useRegex = LocalPreferences.get("multirename_useRegex", false);
|
||||||
fileRenamer.useRegex = multirename_useRegex === "true";
|
fileRenamer.useRegex = multirename_useRegex === "true";
|
||||||
$("use_regex_search").checked = fileRenamer.useRegex;
|
$("use_regex_search").checked = fileRenamer.useRegex;
|
||||||
|
|
||||||
var multirename_matchAllOccurrences = LocalPreferences.get("multirename_matchAllOccurrences", false);
|
const multirename_matchAllOccurrences = LocalPreferences.get("multirename_matchAllOccurrences", false);
|
||||||
fileRenamer.matchAllOccurrences = multirename_matchAllOccurrences === "true";
|
fileRenamer.matchAllOccurrences = multirename_matchAllOccurrences === "true";
|
||||||
$("match_all_occurrences").checked = fileRenamer.matchAllOccurrences;
|
$("match_all_occurrences").checked = fileRenamer.matchAllOccurrences;
|
||||||
|
|
||||||
var multirename_caseSensitive = LocalPreferences.get("multirename_caseSensitive", false);
|
const multirename_caseSensitive = LocalPreferences.get("multirename_caseSensitive", false);
|
||||||
fileRenamer.caseSensitive = multirename_caseSensitive === "true";
|
fileRenamer.caseSensitive = multirename_caseSensitive === "true";
|
||||||
$("case_sensitive").checked = fileRenamer.caseSensitive;
|
$("case_sensitive").checked = fileRenamer.caseSensitive;
|
||||||
|
|
||||||
var multirename_replace = LocalPreferences.get("multirename_replace", "");
|
const multirename_replace = LocalPreferences.get("multirename_replace", "");
|
||||||
fileRenamer.setReplacement(multirename_replace);
|
fileRenamer.setReplacement(multirename_replace);
|
||||||
$("multiRenameReplace").set("value", multirename_replace);
|
$("multiRenameReplace").set("value", multirename_replace);
|
||||||
|
|
||||||
var multirename_appliesTo = LocalPreferences.get("multirename_appliesTo", window.qBittorrent.MultiRename.AppliesTo.FilenameExtension);
|
const multirename_appliesTo = LocalPreferences.get("multirename_appliesTo", window.qBittorrent.MultiRename.AppliesTo.FilenameExtension);
|
||||||
fileRenamer.appliesTo = window.qBittorrent.MultiRename.AppliesTo[multirename_appliesTo];
|
fileRenamer.appliesTo = window.qBittorrent.MultiRename.AppliesTo[multirename_appliesTo];
|
||||||
$("applies_to_option").set("value", fileRenamer.appliesTo);
|
$("applies_to_option").set("value", fileRenamer.appliesTo);
|
||||||
|
|
||||||
var multirename_includeFiles = LocalPreferences.get("multirename_includeFiles", true);
|
const multirename_includeFiles = LocalPreferences.get("multirename_includeFiles", true);
|
||||||
fileRenamer.includeFiles = multirename_includeFiles === "true";
|
fileRenamer.includeFiles = multirename_includeFiles === "true";
|
||||||
$("include_files").checked = fileRenamer.includeFiles;
|
$("include_files").checked = fileRenamer.includeFiles;
|
||||||
|
|
||||||
var multirename_includeFolders = LocalPreferences.get("multirename_includeFolders", false);
|
const multirename_includeFolders = LocalPreferences.get("multirename_includeFolders", false);
|
||||||
fileRenamer.includeFolders = multirename_includeFolders === "true";
|
fileRenamer.includeFolders = multirename_includeFolders === "true";
|
||||||
$("include_folders").checked = fileRenamer.includeFolders;
|
$("include_folders").checked = fileRenamer.includeFolders;
|
||||||
|
|
||||||
var multirename_fileEnumerationStart = LocalPreferences.get("multirename_fileEnumerationStart", 0);
|
const multirename_fileEnumerationStart = LocalPreferences.get("multirename_fileEnumerationStart", 0);
|
||||||
fileRenamer.fileEnumerationStart = parseInt(multirename_fileEnumerationStart);
|
fileRenamer.fileEnumerationStart = parseInt(multirename_fileEnumerationStart);
|
||||||
$("file_counter").set("value", fileRenamer.fileEnumerationStart);
|
$("file_counter").set("value", fileRenamer.fileEnumerationStart);
|
||||||
|
|
||||||
var multirename_replaceAll = LocalPreferences.get("multirename_replaceAll", false);
|
const multirename_replaceAll = LocalPreferences.get("multirename_replaceAll", false);
|
||||||
fileRenamer.replaceAll = multirename_replaceAll === "true";
|
fileRenamer.replaceAll = multirename_replaceAll === "true";
|
||||||
var renameButtonValue = fileRenamer.replaceAll ? "Replace All" : "Replace";
|
const renameButtonValue = fileRenamer.replaceAll ? "Replace All" : "Replace";
|
||||||
$("renameOptions").set("value", renameButtonValue);
|
$("renameOptions").set("value", renameButtonValue);
|
||||||
$("renameButton").set("value", renameButtonValue);
|
$("renameButton").set("value", renameButtonValue);
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@
|
||||||
|
|
||||||
// Setup Search Events that control renaming
|
// Setup Search Events that control renaming
|
||||||
$("multiRenameSearch").addEvent("input", function(e) {
|
$("multiRenameSearch").addEvent("input", function(e) {
|
||||||
let sanitized = e.target.value.replace(/\n/g, "");
|
const sanitized = e.target.value.replace(/\n/g, "");
|
||||||
$("multiRenameSearch").set("value", sanitized);
|
$("multiRenameSearch").set("value", sanitized);
|
||||||
|
|
||||||
// Search input has changed
|
// Search input has changed
|
||||||
|
@ -193,7 +193,7 @@
|
||||||
|
|
||||||
// Setup Replace Events that control renaming
|
// Setup Replace Events that control renaming
|
||||||
$("multiRenameReplace").addEvent("input", function(e) {
|
$("multiRenameReplace").addEvent("input", function(e) {
|
||||||
let sanitized = e.target.value.replace(/\n/g, "");
|
const sanitized = e.target.value.replace(/\n/g, "");
|
||||||
$("multiRenameReplace").set("value", sanitized);
|
$("multiRenameReplace").set("value", sanitized);
|
||||||
|
|
||||||
// Replace input has changed
|
// Replace input has changed
|
||||||
|
@ -265,7 +265,7 @@
|
||||||
|
|
||||||
// Recreate table
|
// Recreate table
|
||||||
let selectedRows = bulkRenameFilesTable.getSelectedRows().map(row => row.rowId.toString());
|
let selectedRows = bulkRenameFilesTable.getSelectedRows().map(row => row.rowId.toString());
|
||||||
for (let renamedRow of rows) {
|
for (const renamedRow of rows) {
|
||||||
selectedRows = selectedRows.filter(selectedRow => selectedRow !== renamedRow.rowId.toString());
|
selectedRows = selectedRows.filter(selectedRow => selectedRow !== renamedRow.rowId.toString());
|
||||||
}
|
}
|
||||||
bulkRenameFilesTable.clear();
|
bulkRenameFilesTable.clear();
|
||||||
|
@ -307,7 +307,7 @@
|
||||||
$("bulkRenameFilesTableFixedHeaderDiv").scrollLeft = length;
|
$("bulkRenameFilesTableFixedHeaderDiv").scrollLeft = length;
|
||||||
};
|
};
|
||||||
|
|
||||||
var handleTorrentFiles = function(files, selectedRows) {
|
const handleTorrentFiles = function(files, selectedRows) {
|
||||||
const rows = files.map(function(file, index) {
|
const rows = files.map(function(file, index) {
|
||||||
|
|
||||||
const row = {
|
const row = {
|
||||||
|
@ -325,7 +325,7 @@
|
||||||
addRowsToTable(rows, selectedRows);
|
addRowsToTable(rows, selectedRows);
|
||||||
};
|
};
|
||||||
|
|
||||||
var addRowsToTable = function(rows, selectedRows) {
|
const addRowsToTable = function(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;
|
||||||
|
@ -394,7 +394,7 @@
|
||||||
fileRenamer.update();
|
fileRenamer.update();
|
||||||
};
|
};
|
||||||
|
|
||||||
var setupTable = function(selectedRows) {
|
const setupTable = function(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,
|
||||||
|
|
|
@ -1342,7 +1342,7 @@ window.addEventListener("DOMContentLoaded", function() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var addLogPanel = function() {
|
const addLogPanel = function() {
|
||||||
new MochaUI.Panel({
|
new MochaUI.Panel({
|
||||||
id: "LogPanel",
|
id: "LogPanel",
|
||||||
title: "Log",
|
title: "Log",
|
||||||
|
|
|
@ -363,7 +363,7 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
// hide renameFiles when more than 1 torrent is selected
|
// hide renameFiles when more than 1 torrent is selected
|
||||||
if (selectedRows.length === 1) {
|
if (selectedRows.length === 1) {
|
||||||
const data = torrentsTable.rows.get(selectedRows[0]).full_data;
|
const data = torrentsTable.rows.get(selectedRows[0]).full_data;
|
||||||
let metadata_downloaded = !((data["state"] === "metaDL") || (data["state"] === "forcedMetaDL") || (data["total_size"] === -1));
|
const metadata_downloaded = !((data["state"] === "metaDL") || (data["state"] === "forcedMetaDL") || (data["total_size"] === -1));
|
||||||
|
|
||||||
// hide renameFiles when metadata hasn't been downloaded yet
|
// hide renameFiles when metadata hasn't been downloaded yet
|
||||||
metadata_downloaded
|
metadata_downloaded
|
||||||
|
@ -562,7 +562,7 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
const RssFeedContextMenu = new Class({
|
const RssFeedContextMenu = new Class({
|
||||||
Extends: ContextMenu,
|
Extends: ContextMenu,
|
||||||
updateMenuItems: function() {
|
updateMenuItems: function() {
|
||||||
let selectedRows = window.qBittorrent.Rss.rssFeedTable.selectedRowsIds();
|
const selectedRows = window.qBittorrent.Rss.rssFeedTable.selectedRowsIds();
|
||||||
this.menu.getElement("a[href$=newSubscription]").parentNode.addClass("separator");
|
this.menu.getElement("a[href$=newSubscription]").parentNode.addClass("separator");
|
||||||
switch (selectedRows.length) {
|
switch (selectedRows.length) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -660,7 +660,7 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
updateMenuItems: function() {
|
updateMenuItems: function() {
|
||||||
let selectedRows = window.qBittorrent.RssDownloader.rssDownloaderRulesTable.selectedRowsIds();
|
const selectedRows = window.qBittorrent.RssDownloader.rssDownloaderRulesTable.selectedRowsIds();
|
||||||
this.showItem("addRule");
|
this.showItem("addRule");
|
||||||
switch (selectedRows.length) {
|
switch (selectedRows.length) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
|
@ -814,7 +814,7 @@ window.qBittorrent.DynamicTable = (function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let rowPos = rows.length;
|
const rowPos = rows.length;
|
||||||
|
|
||||||
while ((rowPos < trs.length) && (trs.length > 0)) {
|
while ((rowPos < trs.length) && (trs.length > 0)) {
|
||||||
trs.pop().destroy();
|
trs.pop().destroy();
|
||||||
|
@ -1935,7 +1935,7 @@ window.qBittorrent.DynamicTable = (function() {
|
||||||
const node = this.getNode(i);
|
const node = this.getNode(i);
|
||||||
|
|
||||||
if (checkbox.checked || checkbox.indeterminate) {
|
if (checkbox.checked || checkbox.indeterminate) {
|
||||||
let cb = checkboxes[i];
|
const cb = checkboxes[i];
|
||||||
cb.checked = true;
|
cb.checked = true;
|
||||||
cb.indeterminate = false;
|
cb.indeterminate = false;
|
||||||
cb.state = "checked";
|
cb.state = "checked";
|
||||||
|
@ -1943,7 +1943,7 @@ window.qBittorrent.DynamicTable = (function() {
|
||||||
node.full_data.checked = node.checked;
|
node.full_data.checked = node.checked;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let cb = checkboxes[i];
|
const cb = checkboxes[i];
|
||||||
cb.checked = false;
|
cb.checked = false;
|
||||||
cb.indeterminate = false;
|
cb.indeterminate = false;
|
||||||
cb.state = "unchecked";
|
cb.state = "unchecked";
|
||||||
|
@ -2635,7 +2635,7 @@ window.qBittorrent.DynamicTable = (function() {
|
||||||
this.columns["name"].updateTd = function(td, row) {
|
this.columns["name"].updateTd = function(td, row) {
|
||||||
const name = this.getRowValue(row, 0);
|
const name = this.getRowValue(row, 0);
|
||||||
const unreadCount = this.getRowValue(row, 1);
|
const unreadCount = this.getRowValue(row, 1);
|
||||||
let value = name + " (" + unreadCount + ")";
|
const value = name + " (" + unreadCount + ")";
|
||||||
td.set("text", value);
|
td.set("text", value);
|
||||||
td.set("title", value);
|
td.set("title", value);
|
||||||
};
|
};
|
||||||
|
@ -2679,7 +2679,7 @@ window.qBittorrent.DynamicTable = (function() {
|
||||||
}
|
}
|
||||||
row["data"] = {};
|
row["data"] = {};
|
||||||
tds[0].style.overflow = "visible";
|
tds[0].style.overflow = "visible";
|
||||||
let indentation = row.full_data.indentation;
|
const indentation = row.full_data.indentation;
|
||||||
tds[0].style.paddingLeft = (indentation * 32 + 4) + "px";
|
tds[0].style.paddingLeft = (indentation * 32 + 4) + "px";
|
||||||
tds[1].style.paddingLeft = (indentation * 32 + 4) + "px";
|
tds[1].style.paddingLeft = (indentation * 32 + 4) + "px";
|
||||||
},
|
},
|
||||||
|
|
|
@ -123,7 +123,7 @@ const initializeWindows = function() {
|
||||||
|
|
||||||
showDownloadPage = function(urls) {
|
showDownloadPage = function(urls) {
|
||||||
const id = "downloadPage";
|
const id = "downloadPage";
|
||||||
let contentUri = new URI("download.html");
|
const contentUri = new URI("download.html");
|
||||||
|
|
||||||
if (urls && (urls.length > 0)) {
|
if (urls && (urls.length > 0)) {
|
||||||
contentUri.setData("urls", urls.map(encodeURIComponent).join("|"));
|
contentUri.setData("urls", urls.map(encodeURIComponent).join("|"));
|
||||||
|
|
|
@ -58,7 +58,7 @@ window.qBittorrent.MultiRename = (function() {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
let lastIndex = 0;
|
let lastIndex = 0;
|
||||||
regex.lastIndex = 0;
|
regex.lastIndex = 0;
|
||||||
let matches = [];
|
const matches = [];
|
||||||
do {
|
do {
|
||||||
result = regex.exec(str);
|
result = regex.exec(str);
|
||||||
if (result === null)
|
if (result === null)
|
||||||
|
@ -193,17 +193,17 @@ window.qBittorrent.MultiRename = (function() {
|
||||||
let replacement = this._inner_replacement;
|
let replacement = this._inner_replacement;
|
||||||
// Replace numerical groups
|
// Replace numerical groups
|
||||||
for (let g = 0; g < match.length; ++g) {
|
for (let g = 0; g < match.length; ++g) {
|
||||||
let group = match[g];
|
const group = match[g];
|
||||||
if (!group) { continue; }
|
if (!group) { continue; }
|
||||||
replacement = replaceGroup(replacement, `$${g}`, group, "\\", false);
|
replacement = replaceGroup(replacement, `$${g}`, group, "\\", false);
|
||||||
}
|
}
|
||||||
// Replace named groups
|
// Replace named groups
|
||||||
for (let namedGroup in match.groups) {
|
for (const namedGroup in match.groups) {
|
||||||
replacement = replaceGroup(replacement, `$${namedGroup}`, match.groups[namedGroup], "\\", false);
|
replacement = replaceGroup(replacement, `$${namedGroup}`, match.groups[namedGroup], "\\", false);
|
||||||
}
|
}
|
||||||
// Replace auxiliary variables
|
// Replace auxiliary variables
|
||||||
for (let v = "dddddddd"; v !== ""; v = v.substring(1)) {
|
for (let v = "dddddddd"; v !== ""; v = v.substring(1)) {
|
||||||
let fileCount = fileEnumeration.toString().padStart(v.length, "0");
|
const fileCount = fileEnumeration.toString().padStart(v.length, "0");
|
||||||
replacement = replaceGroup(replacement, `$${v}`, fileCount, "\\", false);
|
replacement = replaceGroup(replacement, `$${v}`, fileCount, "\\", false);
|
||||||
}
|
}
|
||||||
// Remove empty $ variable
|
// Remove empty $ variable
|
||||||
|
@ -225,7 +225,7 @@ window.qBittorrent.MultiRename = (function() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let replaced = [];
|
const replaced = [];
|
||||||
const _inner_rename = async function(i) {
|
const _inner_rename = async function(i) {
|
||||||
const match = this.matchedFiles[i];
|
const match = this.matchedFiles[i];
|
||||||
const newName = match.renamed;
|
const newName = match.renamed;
|
||||||
|
@ -242,7 +242,7 @@ window.qBittorrent.MultiRename = (function() {
|
||||||
const newPath = parentPath
|
const newPath = parentPath
|
||||||
? parentPath + window.qBittorrent.Filesystem.PathSeparator + newName
|
? parentPath + window.qBittorrent.Filesystem.PathSeparator + newName
|
||||||
: newName;
|
: newName;
|
||||||
let renameRequest = new Request({
|
const renameRequest = new Request({
|
||||||
url: isFolder ? "api/v2/torrents/renameFolder" : "api/v2/torrents/renameFile",
|
url: isFolder ? "api/v2/torrents/renameFolder" : "api/v2/torrents/renameFile",
|
||||||
method: "post",
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
|
|
|
@ -435,7 +435,7 @@ window.qBittorrent.Search = (function() {
|
||||||
const isSearchRunning = state && state.running;
|
const isSearchRunning = state && state.running;
|
||||||
if (!isSearchRunning || searchPatternChanged) {
|
if (!isSearchRunning || searchPatternChanged) {
|
||||||
const pattern = $("searchPattern").getProperty("value").trim();
|
const pattern = $("searchPattern").getProperty("value").trim();
|
||||||
let category = $("categorySelect").getProperty("value");
|
const category = $("categorySelect").getProperty("value");
|
||||||
const plugins = $("pluginsSelect").getProperty("value");
|
const plugins = $("pluginsSelect").getProperty("value");
|
||||||
|
|
||||||
if (!pattern || !category || !plugins)
|
if (!pattern || !category || !plugins)
|
||||||
|
|
|
@ -167,7 +167,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
let currentSelectedTab = "main";
|
let currentSelectedTab = "main";
|
||||||
let tableInfo = {
|
const tableInfo = {
|
||||||
main: {
|
main: {
|
||||||
instance: new window.qBittorrent.DynamicTable.LogMessageTable(),
|
instance: new window.qBittorrent.DynamicTable.LogMessageTable(),
|
||||||
progress: false,
|
progress: false,
|
||||||
|
@ -240,7 +240,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const unload = () => {
|
const unload = () => {
|
||||||
for (let table in tableInfo)
|
for (const table in tableInfo)
|
||||||
resetTableTimer(table);
|
resetTableTimer(table);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@
|
||||||
|
|
||||||
new ClipboardJS(".copyLogDataToClipboard", {
|
new ClipboardJS(".copyLogDataToClipboard", {
|
||||||
text: function() {
|
text: function() {
|
||||||
let msg = [];
|
const msg = [];
|
||||||
tableInfo[currentSelectedTab].instance.selectedRowsIds().each(function(rowId) {
|
tableInfo[currentSelectedTab].instance.selectedRowsIds().each(function(rowId) {
|
||||||
msg.push(tableInfo[currentSelectedTab].instance.rows.get(rowId).full_data[(currentSelectedTab === "main") ? "message" : "ip"]);
|
msg.push(tableInfo[currentSelectedTab].instance.rows.get(rowId).full_data[(currentSelectedTab === "main") ? "message" : "ip"]);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1972,7 +1972,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateWebuiLocaleSelect = (selected) => {
|
const updateWebuiLocaleSelect = (selected) => {
|
||||||
let languages = [];
|
const languages = [];
|
||||||
for (let i = 0; i < $("locale_select").options.length; i++)
|
for (let i = 0; i < $("locale_select").options.length; i++)
|
||||||
languages.push($("locale_select").options[i].value);
|
languages.push($("locale_select").options[i].value);
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
let serverSyncRssDataInterval = 1500;
|
const serverSyncRssDataInterval = 1500;
|
||||||
|
|
||||||
window.qBittorrent.Rss = (() => {
|
window.qBittorrent.Rss = (() => {
|
||||||
const exports = () => {
|
const exports = () => {
|
||||||
|
@ -185,8 +185,8 @@
|
||||||
let feedData = {};
|
let feedData = {};
|
||||||
let pathByFeedId = new Map();
|
let pathByFeedId = new Map();
|
||||||
let feedRefreshTimer;
|
let feedRefreshTimer;
|
||||||
let rssFeedTable = new window.qBittorrent.DynamicTable.RssFeedTable();
|
const rssFeedTable = new window.qBittorrent.DynamicTable.RssFeedTable();
|
||||||
let rssArticleTable = new window.qBittorrent.DynamicTable.RssArticleTable();
|
const rssArticleTable = new window.qBittorrent.DynamicTable.RssArticleTable();
|
||||||
|
|
||||||
const init = () => {
|
const init = () => {
|
||||||
const pref = window.parent.qBittorrent.Cache.preferences.get();
|
const pref = window.parent.qBittorrent.Cache.preferences.get();
|
||||||
|
@ -211,9 +211,9 @@
|
||||||
menu: "rssFeedMenu",
|
menu: "rssFeedMenu",
|
||||||
actions: {
|
actions: {
|
||||||
update: (el) => {
|
update: (el) => {
|
||||||
let feedsToUpdate = new Set();
|
const feedsToUpdate = new Set();
|
||||||
rssFeedTable.selectedRows.each((rowId) => {
|
rssFeedTable.selectedRows.each((rowId) => {
|
||||||
let selectedPath = rssFeedTable.rows[rowId].full_data.dataPath;
|
const selectedPath = rssFeedTable.rows[rowId].full_data.dataPath;
|
||||||
rssFeedTable.rows.filter((row) => row.full_data.dataPath.slice(0, selectedPath.length) === selectedPath)
|
rssFeedTable.rows.filter((row) => row.full_data.dataPath.slice(0, selectedPath.length) === selectedPath)
|
||||||
.filter((row) => row.full_data.dataUid !== "")
|
.filter((row) => row.full_data.dataUid !== "")
|
||||||
.each((row) => feedsToUpdate.add(row));
|
.each((row) => feedsToUpdate.add(row));
|
||||||
|
@ -225,11 +225,11 @@
|
||||||
moveItem(rssFeedTable.rows[rssFeedTable.selectedRows[0]].full_data.dataPath);
|
moveItem(rssFeedTable.rows[rssFeedTable.selectedRows[0]].full_data.dataPath);
|
||||||
},
|
},
|
||||||
delete: (el) => {
|
delete: (el) => {
|
||||||
let selectedDatapaths = rssFeedTable.selectedRows
|
const selectedDatapaths = rssFeedTable.selectedRows
|
||||||
.filter((e) => e !== 0)
|
.filter((e) => e !== 0)
|
||||||
.map((sRow) => rssFeedTable.rows[sRow].full_data.dataPath);
|
.map((sRow) => rssFeedTable.rows[sRow].full_data.dataPath);
|
||||||
// filter children
|
// filter children
|
||||||
let reducedDatapaths = selectedDatapaths.filter((path) =>
|
const reducedDatapaths = selectedDatapaths.filter((path) =>
|
||||||
selectedDatapaths.filter((innerPath) => path.slice(0, innerPath.length) === innerPath).length === 1
|
selectedDatapaths.filter((innerPath) => path.slice(0, innerPath.length) === innerPath).length === 1
|
||||||
);
|
);
|
||||||
removeItem(reducedDatapaths);
|
removeItem(reducedDatapaths);
|
||||||
|
@ -307,12 +307,12 @@
|
||||||
const addRSSFeed = () => {
|
const addRSSFeed = () => {
|
||||||
let path = "";
|
let path = "";
|
||||||
if (rssFeedTable.selectedRows.length !== 0) {
|
if (rssFeedTable.selectedRows.length !== 0) {
|
||||||
let row = rssFeedTable.rows[rssFeedTable.selectedRows[0]];
|
const row = rssFeedTable.rows[rssFeedTable.selectedRows[0]];
|
||||||
if (row.full_data.dataUid === "") {
|
if (row.full_data.dataUid === "") {
|
||||||
path = row.full_data.dataPath;
|
path = row.full_data.dataPath;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let lastIndex = row.full_data.dataPath.lastIndexOf("\\");
|
const lastIndex = row.full_data.dataPath.lastIndexOf("\\");
|
||||||
if (lastIndex !== -1)
|
if (lastIndex !== -1)
|
||||||
path = row.full_data.dataPath.slice(0, lastIndex);
|
path = row.full_data.dataPath.slice(0, lastIndex);
|
||||||
}
|
}
|
||||||
|
@ -334,12 +334,12 @@
|
||||||
const addFolder = () => {
|
const addFolder = () => {
|
||||||
let path = "";
|
let path = "";
|
||||||
if (rssFeedTable.selectedRows.length !== 0) {
|
if (rssFeedTable.selectedRows.length !== 0) {
|
||||||
let row = rssFeedTable.rows[rssFeedTable.selectedRows[0]];
|
const row = rssFeedTable.rows[rssFeedTable.selectedRows[0]];
|
||||||
if (row.full_data.dataUid === "") {
|
if (row.full_data.dataUid === "") {
|
||||||
path = row.full_data.dataPath;
|
path = row.full_data.dataPath;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let lastIndex = row.full_data.dataPath.lastIndexOf("\\");
|
const lastIndex = row.full_data.dataPath.lastIndexOf("\\");
|
||||||
if (lastIndex !== -1)
|
if (lastIndex !== -1)
|
||||||
path = row.full_data.dataPath.slice(0, lastIndex);
|
path = row.full_data.dataPath.slice(0, lastIndex);
|
||||||
}
|
}
|
||||||
|
@ -362,13 +362,13 @@
|
||||||
rssArticleTable.clear();
|
rssArticleTable.clear();
|
||||||
let rowCount = 0;
|
let rowCount = 0;
|
||||||
|
|
||||||
let childFeeds = new Set();
|
const childFeeds = new Set();
|
||||||
rssFeedTable.rows.filter((row) => row.full_data.dataPath.slice(0, path.length) === path)
|
rssFeedTable.rows.filter((row) => row.full_data.dataPath.slice(0, path.length) === path)
|
||||||
.filter((row) => row.full_data.dataUid !== "")
|
.filter((row) => row.full_data.dataUid !== "")
|
||||||
.each((row) => childFeeds.add(row.full_data.dataUid));
|
.each((row) => childFeeds.add(row.full_data.dataUid));
|
||||||
|
|
||||||
let visibleArticles = [];
|
let visibleArticles = [];
|
||||||
for (let feedEntry in feedData) {
|
for (const feedEntry in feedData) {
|
||||||
if (childFeeds.has(feedEntry))
|
if (childFeeds.has(feedEntry))
|
||||||
visibleArticles.append(feedData[feedEntry]
|
visibleArticles.append(feedData[feedEntry]
|
||||||
.map((a) => {
|
.map((a) => {
|
||||||
|
@ -400,30 +400,30 @@
|
||||||
const showDetails = (feedUid, articleID) => {
|
const showDetails = (feedUid, articleID) => {
|
||||||
markArticleAsRead(pathByFeedId.get(feedUid), articleID);
|
markArticleAsRead(pathByFeedId.get(feedUid), articleID);
|
||||||
$("rssDetailsView").getChildren().each(c => c.destroy());
|
$("rssDetailsView").getChildren().each(c => c.destroy());
|
||||||
let article = feedData[feedUid].filter((article) => article.id === articleID)[0];
|
const article = feedData[feedUid].filter((article) => article.id === articleID)[0];
|
||||||
if (article) {
|
if (article) {
|
||||||
$("rssDetailsView").append((() => {
|
$("rssDetailsView").append((() => {
|
||||||
let torrentName = document.createElement("p");
|
const torrentName = document.createElement("p");
|
||||||
torrentName.innerText = article.title;
|
torrentName.innerText = article.title;
|
||||||
torrentName.setAttribute("id", "rssTorrentDetailsName");
|
torrentName.setAttribute("id", "rssTorrentDetailsName");
|
||||||
return torrentName;
|
return torrentName;
|
||||||
})());
|
})());
|
||||||
$("rssDetailsView").append((() => {
|
$("rssDetailsView").append((() => {
|
||||||
let torrentDate = document.createElement("div");
|
const torrentDate = document.createElement("div");
|
||||||
torrentDate.setAttribute("id", "rssTorrentDetailsDate");
|
torrentDate.setAttribute("id", "rssTorrentDetailsDate");
|
||||||
|
|
||||||
let torrentDateDesc = document.createElement("b");
|
const torrentDateDesc = document.createElement("b");
|
||||||
torrentDateDesc.innerText = "QBT_TR(Date: )QBT_TR[CONTEXT=RSSWidget]";
|
torrentDateDesc.innerText = "QBT_TR(Date: )QBT_TR[CONTEXT=RSSWidget]";
|
||||||
torrentDate.append(torrentDateDesc);
|
torrentDate.append(torrentDateDesc);
|
||||||
|
|
||||||
let torrentDateData = document.createElement("span");
|
const torrentDateData = document.createElement("span");
|
||||||
torrentDateData.innerText = new Date(article.date).toLocaleString();
|
torrentDateData.innerText = new Date(article.date).toLocaleString();
|
||||||
torrentDate.append(torrentDateData);
|
torrentDate.append(torrentDateData);
|
||||||
|
|
||||||
return torrentDate;
|
return torrentDate;
|
||||||
})());
|
})());
|
||||||
// Place in iframe with sandbox attribute to prevent js execution
|
// Place in iframe with sandbox attribute to prevent js execution
|
||||||
let torrentDescription = document.createRange().createContextualFragment('<iframe sandbox id="rssDescription"></iframe>');
|
const torrentDescription = document.createRange().createContextualFragment('<iframe sandbox id="rssDescription"></iframe>');
|
||||||
$("rssDetailsView").append(torrentDescription);
|
$("rssDetailsView").append(torrentDescription);
|
||||||
document.getElementById("rssDescription").srcdoc = '<html><head><link rel="stylesheet" type="text/css" href="css/style.css" /></head><body>' + article.description + "</body></html>";
|
document.getElementById("rssDescription").srcdoc = '<html><head><link rel="stylesheet" type="text/css" href="css/style.css" /></head><body>' + article.description + "</body></html>";
|
||||||
|
|
||||||
|
@ -444,10 +444,10 @@
|
||||||
},
|
},
|
||||||
onSuccess: (response) => {
|
onSuccess: (response) => {
|
||||||
// flatten folder structure
|
// flatten folder structure
|
||||||
let flattenedResp = [];
|
const flattenedResp = [];
|
||||||
let recFlatten = (current, name = "", depth = 0, fullName = "") => {
|
const recFlatten = (current, name = "", depth = 0, fullName = "") => {
|
||||||
for (let child in current) {
|
for (const child in current) {
|
||||||
let currentFullName = fullName ? (fullName + "\\" + child) : child;
|
const currentFullName = fullName ? (fullName + "\\" + child) : child;
|
||||||
if (current[child].uid !== undefined) {
|
if (current[child].uid !== undefined) {
|
||||||
current[child].name = child;
|
current[child].name = child;
|
||||||
current[child].isFolder = false;
|
current[child].isFolder = false;
|
||||||
|
@ -486,7 +486,7 @@
|
||||||
// update status
|
// update status
|
||||||
let statusDiffers = false;
|
let statusDiffers = false;
|
||||||
for (let i = 0; i < flattenedResp.length; ++i) {
|
for (let i = 0; i < flattenedResp.length; ++i) {
|
||||||
let oldStatus = rssFeedTable.rows[i + 1].full_data.status;
|
const oldStatus = rssFeedTable.rows[i + 1].full_data.status;
|
||||||
let status = "default";
|
let status = "default";
|
||||||
if (flattenedResp[i].hasError)
|
if (flattenedResp[i].hasError)
|
||||||
status = "hasError";
|
status = "hasError";
|
||||||
|
@ -509,7 +509,7 @@
|
||||||
// get currently opened feed
|
// get currently opened feed
|
||||||
let openedFeedPath = undefined;
|
let openedFeedPath = undefined;
|
||||||
if (rssFeedTable.selectedRows.length !== 0) {
|
if (rssFeedTable.selectedRows.length !== 0) {
|
||||||
let lastSelectedRow = rssFeedTable.selectedRows[rssFeedTable.selectedRows.length - 1];
|
const lastSelectedRow = rssFeedTable.selectedRows[rssFeedTable.selectedRows.length - 1];
|
||||||
openedFeedPath = rssFeedTable.rows[lastSelectedRow].full_data.dataPath;
|
openedFeedPath = rssFeedTable.rows[lastSelectedRow].full_data.dataPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,9 +528,9 @@
|
||||||
|
|
||||||
if (articlesDiffer) {
|
if (articlesDiffer) {
|
||||||
// update unread count
|
// update unread count
|
||||||
let oldUnread = feedData[r.uid].map((art) => !art.isRead).filter((v) => v).length;
|
const oldUnread = feedData[r.uid].map((art) => !art.isRead).filter((v) => v).length;
|
||||||
let newUnread = r.articles.map((art) => !art.isRead).filter((v) => v).length;
|
const newUnread = r.articles.map((art) => !art.isRead).filter((v) => v).length;
|
||||||
let unreadDifference = newUnread - oldUnread;
|
const unreadDifference = newUnread - oldUnread;
|
||||||
|
|
||||||
// find all parents (and self) and add unread difference
|
// find all parents (and self) and add unread difference
|
||||||
rssFeedTable.rows.filter((row) => r.fullName.slice(0, row.full_data.dataPath.length) === row.full_data.dataPath)
|
rssFeedTable.rows.filter((row) => r.fullName.slice(0, row.full_data.dataPath.length) === row.full_data.dataPath)
|
||||||
|
@ -549,8 +549,8 @@
|
||||||
let readDifference = 0;
|
let readDifference = 0;
|
||||||
let readChanged = false;
|
let readChanged = false;
|
||||||
for (let i = 0; i < r.articles.length; ++i) {
|
for (let i = 0; i < r.articles.length; ++i) {
|
||||||
let oldRead = feedData[r.uid][i].isRead ? 1 : 0;
|
const oldRead = feedData[r.uid][i].isRead ? 1 : 0;
|
||||||
let newRead = r.articles[i].isRead ? 1 : 0;
|
const newRead = r.articles[i].isRead ? 1 : 0;
|
||||||
feedData[r.uid][i].isRead = r.articles[i].isRead;
|
feedData[r.uid][i].isRead = r.articles[i].isRead;
|
||||||
readDifference += oldRead - newRead;
|
readDifference += oldRead - newRead;
|
||||||
if (readDifference !== 0)
|
if (readDifference !== 0)
|
||||||
|
@ -567,7 +567,7 @@
|
||||||
// if feed that is opened changed update dynamically
|
// if feed that is opened changed update dynamically
|
||||||
if ((openedFeedPath !== undefined) && (r.fullName.slice(0, openedFeedPath.length) === openedFeedPath)) {
|
if ((openedFeedPath !== undefined) && (r.fullName.slice(0, openedFeedPath.length) === openedFeedPath)) {
|
||||||
for (let i = 0; i < r.articles.length; ++i) {
|
for (let i = 0; i < r.articles.length; ++i) {
|
||||||
let matchingRow = rssArticleTable.rows.filter((row) => row.full_data.feedUid === r.uid)
|
const matchingRow = rssArticleTable.rows.filter((row) => row.full_data.feedUid === r.uid)
|
||||||
.filter((row) => row.full_data.dataId === r.articles[i].id);
|
.filter((row) => row.full_data.dataId === r.articles[i].id);
|
||||||
matchingRow[Object.keys(matchingRow)[0]].full_data.isRead = r.articles[i].isRead;
|
matchingRow[Object.keys(matchingRow)[0]].full_data.isRead = r.articles[i].isRead;
|
||||||
}
|
}
|
||||||
|
@ -600,7 +600,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
let rowCount = 1;
|
let rowCount = 1;
|
||||||
for (let dataEntry of flattenedResp) {
|
for (const dataEntry of flattenedResp) {
|
||||||
if (dataEntry.isFolder) {
|
if (dataEntry.isFolder) {
|
||||||
rssFeedTable.updateRowData({
|
rssFeedTable.updateRowData({
|
||||||
rowId: rowCount,
|
rowId: rowCount,
|
||||||
|
@ -632,7 +632,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
// calculate number of unread
|
// calculate number of unread
|
||||||
let numberOfUnread = dataEntry.articles.map((art) => !art.isRead).filter((v) => v).length;
|
const numberOfUnread = dataEntry.articles.map((art) => !art.isRead).filter((v) => v).length;
|
||||||
// find all items that contain this rss feed and add unread count
|
// find all items that contain this rss feed and add unread count
|
||||||
rssFeedTable.rows.filter((row) => dataEntry.fullName.slice(0, row.full_data.dataPath.length) === row.full_data.dataPath)
|
rssFeedTable.rows.filter((row) => dataEntry.fullName.slice(0, row.full_data.dataPath.length) === row.full_data.dataPath)
|
||||||
.each((row) => row.full_data.unread += numberOfUnread);
|
.each((row) => row.full_data.unread += numberOfUnread);
|
||||||
|
@ -671,7 +671,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const refreshAllFeeds = () => {
|
const refreshAllFeeds = () => {
|
||||||
for (let feedEntry in feedData)
|
for (const feedEntry in feedData)
|
||||||
refreshFeed(feedEntry);
|
refreshFeed(feedEntry);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -706,7 +706,7 @@
|
||||||
|
|
||||||
const markItemAsRead = (path) => {
|
const markItemAsRead = (path) => {
|
||||||
// feed data mark as read
|
// feed data mark as read
|
||||||
for (let feedID in feedData)
|
for (const feedID in feedData)
|
||||||
if (pathByFeedId.get(feedID).slice(0, path.length) === path)
|
if (pathByFeedId.get(feedID).slice(0, path.length) === path)
|
||||||
feedData[feedID].each((el) => el.isRead = true);
|
feedData[feedID].each((el) => el.isRead = true);
|
||||||
|
|
||||||
|
@ -790,10 +790,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const markSelectedAsRead = () => {
|
const markSelectedAsRead = () => {
|
||||||
let selectedDatapaths = rssFeedTable.selectedRows
|
const selectedDatapaths = rssFeedTable.selectedRows
|
||||||
.map((sRow) => rssFeedTable.rows[sRow].full_data.dataPath);
|
.map((sRow) => rssFeedTable.rows[sRow].full_data.dataPath);
|
||||||
// filter children
|
// filter children
|
||||||
let reducedDatapaths = selectedDatapaths.filter((path) =>
|
const reducedDatapaths = selectedDatapaths.filter((path) =>
|
||||||
selectedDatapaths.filter((innerPath) => path.slice(0, innerPath.length) === innerPath).length === 1
|
selectedDatapaths.filter((innerPath) => path.slice(0, innerPath.length) === innerPath).length === 1
|
||||||
);
|
);
|
||||||
reducedDatapaths.each((path) => markItemAsRead(path));
|
reducedDatapaths.each((path) => markItemAsRead(path));
|
||||||
|
|
|
@ -350,9 +350,9 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
let rssDownloaderRulesTable = new window.qBittorrent.DynamicTable.RssDownloaderRulesTable();
|
const rssDownloaderRulesTable = new window.qBittorrent.DynamicTable.RssDownloaderRulesTable();
|
||||||
let rssDownloaderFeedSelectionTable = new window.qBittorrent.DynamicTable.RssDownloaderFeedSelectionTable();
|
const rssDownloaderFeedSelectionTable = new window.qBittorrent.DynamicTable.RssDownloaderFeedSelectionTable();
|
||||||
let rssDownloaderArticlesTable = new window.qBittorrent.DynamicTable.RssDownloaderArticlesTable();
|
const rssDownloaderArticlesTable = new window.qBittorrent.DynamicTable.RssDownloaderArticlesTable();
|
||||||
|
|
||||||
let rulesList = {};
|
let rulesList = {};
|
||||||
let feedList = [];
|
let feedList = [];
|
||||||
|
@ -383,7 +383,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
$("rssDownloaderFeedsTable").style.height = "100%";
|
$("rssDownloaderFeedsTable").style.height = "100%";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let outsideTableHeight = ($("rssDownloaderFeedsTable").getBoundingClientRect().top - $("rssDownloaderFeeds").getBoundingClientRect().top) - 10;
|
const outsideTableHeight = ($("rssDownloaderFeedsTable").getBoundingClientRect().top - $("rssDownloaderFeeds").getBoundingClientRect().top) - 10;
|
||||||
$("rssDownloaderFeedsTable").style.height = "calc(100% - " + outsideTableHeight + "px)";
|
$("rssDownloaderFeedsTable").style.height = "calc(100% - " + outsideTableHeight + "px)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,9 +431,9 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
method: "get",
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onSuccess: (response) => {
|
onSuccess: (response) => {
|
||||||
let combobox = $("assignCategoryCombobox");
|
const combobox = $("assignCategoryCombobox");
|
||||||
for (let cat in response) {
|
for (const cat in response) {
|
||||||
let option = document.createElement("option");
|
const option = document.createElement("option");
|
||||||
option.text = option.value = cat;
|
option.text = option.value = cat;
|
||||||
combobox.add(option);
|
combobox.add(option);
|
||||||
}
|
}
|
||||||
|
@ -449,8 +449,8 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
},
|
},
|
||||||
onSuccess: (response) => {
|
onSuccess: (response) => {
|
||||||
feedList = [];
|
feedList = [];
|
||||||
let flatten = (root) => {
|
const flatten = (root) => {
|
||||||
for (let child in root) {
|
for (const child in root) {
|
||||||
if (root[child].uid !== undefined)
|
if (root[child].uid !== undefined)
|
||||||
feedList.push({ name: child, url: root[child].url });
|
feedList.push({ name: child, url: root[child].url });
|
||||||
else
|
else
|
||||||
|
@ -475,7 +475,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
onSuccess: (response) => {
|
onSuccess: (response) => {
|
||||||
rssDownloaderRulesTable.clear();
|
rssDownloaderRulesTable.clear();
|
||||||
let rowCount = 0;
|
let rowCount = 0;
|
||||||
for (let rule in response) {
|
for (const rule in response) {
|
||||||
rssDownloaderRulesTable.updateRowData({
|
rssDownloaderRulesTable.updateRowData({
|
||||||
rowId: rowCount++,
|
rowId: rowCount++,
|
||||||
checked: response[rule].enabled,
|
checked: response[rule].enabled,
|
||||||
|
@ -569,8 +569,8 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveSettings = () => {
|
const saveSettings = () => {
|
||||||
let lastSelectedRow = rssDownloaderRulesTable.selectedRows[rssDownloaderRulesTable.selectedRows.length - 1];
|
const lastSelectedRow = rssDownloaderRulesTable.selectedRows[rssDownloaderRulesTable.selectedRows.length - 1];
|
||||||
let rule = rssDownloaderRulesTable.rows[lastSelectedRow].full_data.name;
|
const rule = rssDownloaderRulesTable.rows[lastSelectedRow].full_data.name;
|
||||||
|
|
||||||
rulesList[rule].useRegex = $("useRegEx").checked;
|
rulesList[rule].useRegex = $("useRegEx").checked;
|
||||||
rulesList[rule].mustContain = $("mustContainText").value;
|
rulesList[rule].mustContain = $("mustContainText").value;
|
||||||
|
@ -640,7 +640,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
onSuccess: (response) => {
|
onSuccess: (response) => {
|
||||||
rssDownloaderArticlesTable.clear();
|
rssDownloaderArticlesTable.clear();
|
||||||
let rowCount = 0;
|
let rowCount = 0;
|
||||||
for (let feed in response) {
|
for (const feed in response) {
|
||||||
rssDownloaderArticlesTable.updateRowData({
|
rssDownloaderArticlesTable.updateRowData({
|
||||||
rowId: rowCount++,
|
rowId: rowCount++,
|
||||||
name: feed,
|
name: feed,
|
||||||
|
@ -728,8 +728,8 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
|
|
||||||
// calculate days since last match
|
// calculate days since last match
|
||||||
if (rulesList[ruleName].lastMatch !== "") {
|
if (rulesList[ruleName].lastMatch !== "") {
|
||||||
let timeDiffInMs = new Date().getTime() - new Date(rulesList[ruleName].lastMatch).getTime();
|
const timeDiffInMs = new Date().getTime() - new Date(rulesList[ruleName].lastMatch).getTime();
|
||||||
let daysAgo = Math.floor(timeDiffInMs / (1000 * 60 * 60 * 24)).toString();
|
const daysAgo = Math.floor(timeDiffInMs / (1000 * 60 * 60 * 24)).toString();
|
||||||
$("lastMatchText").textContent = " QBT_TR(Last Match: %1 days ago)QBT_TR[CONTEXT=AutomatedRssDownloader]".replace("%1", daysAgo);
|
$("lastMatchText").textContent = " QBT_TR(Last Match: %1 days ago)QBT_TR[CONTEXT=AutomatedRssDownloader]".replace("%1", daysAgo);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -776,7 +776,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
+ " ● QBT_TR(| is used as OR operator)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n"
|
+ " ● QBT_TR(| is used as OR operator)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n"
|
||||||
+ "QBT_TR(If word order is important use * instead of whitespace.)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n";
|
+ "QBT_TR(If word order is important use * instead of whitespace.)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n";
|
||||||
}
|
}
|
||||||
let secondPart = "QBT_TR(An expression with an empty %1 clause (e.g. %2))QBT_TR[CONTEXT=AutomatedRssDownloader]"
|
const secondPart = "QBT_TR(An expression with an empty %1 clause (e.g. %2))QBT_TR[CONTEXT=AutomatedRssDownloader]"
|
||||||
.replace("%1", "|").replace("%2", "expr|");
|
.replace("%1", "|").replace("%2", "expr|");
|
||||||
|
|
||||||
$("mustContainText").title = mainPart + secondPart + "QBT_TR( will match all articles.)QBT_TR[CONTEXT=AutomatedRssDownloader]";
|
$("mustContainText").title = mainPart + secondPart + "QBT_TR( will match all articles.)QBT_TR[CONTEXT=AutomatedRssDownloader]";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue