mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-28 21:38:51 +03:00
WebUI: iterate over own properties only
This commit is contained in:
parent
b07afa3ea9
commit
64dfb7e122
9 changed files with 38 additions and 5 deletions
|
@ -27,6 +27,7 @@ export default [
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
"eqeqeq": "error",
|
"eqeqeq": "error",
|
||||||
|
"guard-for-in": "error",
|
||||||
"no-undef": "off",
|
"no-undef": "off",
|
||||||
"no-unused-vars": "off",
|
"no-unused-vars": "off",
|
||||||
"no-var": "error",
|
"no-var": "error",
|
||||||
|
|
|
@ -825,6 +825,9 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
if (response["torrents"]) {
|
if (response["torrents"]) {
|
||||||
let updateTorrentList = false;
|
let updateTorrentList = false;
|
||||||
for (const key in response["torrents"]) {
|
for (const key in response["torrents"]) {
|
||||||
|
if (!Object.hasOwn(response["torrents"], key))
|
||||||
|
continue;
|
||||||
|
|
||||||
response["torrents"][key]["hash"] = key;
|
response["torrents"][key]["hash"] = key;
|
||||||
response["torrents"][key]["rowId"] = key;
|
response["torrents"][key]["rowId"] = key;
|
||||||
if (response["torrents"][key]["state"])
|
if (response["torrents"][key]["state"])
|
||||||
|
@ -853,8 +856,11 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
torrentsTable.altRow();
|
torrentsTable.altRow();
|
||||||
if (response["server_state"]) {
|
if (response["server_state"]) {
|
||||||
const tmp = response["server_state"];
|
const tmp = response["server_state"];
|
||||||
for (const k in tmp)
|
for (const k in tmp) {
|
||||||
|
if (!Object.hasOwn(tmp, k))
|
||||||
|
continue;
|
||||||
serverState[k] = tmp[k];
|
serverState[k] = tmp[k];
|
||||||
|
}
|
||||||
processServerState();
|
processServerState();
|
||||||
}
|
}
|
||||||
updateFiltersList();
|
updateFiltersList();
|
||||||
|
|
|
@ -47,6 +47,9 @@ window.qBittorrent.Download = (function() {
|
||||||
if (data) {
|
if (data) {
|
||||||
categories = data;
|
categories = data;
|
||||||
for (const i in data) {
|
for (const i in data) {
|
||||||
|
if (!Object.hasOwn(data, i))
|
||||||
|
continue;
|
||||||
|
|
||||||
const category = data[i];
|
const category = data[i];
|
||||||
const option = new Element("option");
|
const option = new Element("option");
|
||||||
option.set("value", category.name);
|
option.set("value", category.name);
|
||||||
|
|
|
@ -672,8 +672,11 @@ window.qBittorrent.DynamicTable = (function() {
|
||||||
row = this.rows.get(rowId);
|
row = this.rows.get(rowId);
|
||||||
|
|
||||||
row["data"] = data;
|
row["data"] = data;
|
||||||
for (const x in data)
|
for (const x in data) {
|
||||||
|
if (!Object.hasOwn(data, x))
|
||||||
|
continue;
|
||||||
row["full_data"][x] = data[x];
|
row["full_data"][x] = data[x];
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getFilteredAndSortedRows: function() {
|
getFilteredAndSortedRows: function() {
|
||||||
|
|
|
@ -80,8 +80,10 @@ window.qBittorrent.PropPeers = (function() {
|
||||||
syncTorrentPeersLastResponseId = response["rid"];
|
syncTorrentPeersLastResponseId = response["rid"];
|
||||||
if (response["peers"]) {
|
if (response["peers"]) {
|
||||||
for (const key in response["peers"]) {
|
for (const key in response["peers"]) {
|
||||||
response["peers"][key]["rowId"] = key;
|
if (!Object.hasOwn(response["peers"], key))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
response["peers"][key]["rowId"] = key;
|
||||||
torrentPeersTable.updateRowData(response["peers"][key]);
|
torrentPeersTable.updateRowData(response["peers"][key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,6 +199,8 @@ window.qBittorrent.MultiRename = (function() {
|
||||||
}
|
}
|
||||||
// Replace named groups
|
// Replace named groups
|
||||||
for (const namedGroup in match.groups) {
|
for (const namedGroup in match.groups) {
|
||||||
|
if (!Object.hasOwn(match.groups, namedGroup))
|
||||||
|
continue;
|
||||||
replacement = replaceGroup(replacement, `$${namedGroup}`, match.groups[namedGroup], "\\", false);
|
replacement = replaceGroup(replacement, `$${namedGroup}`, match.groups[namedGroup], "\\", false);
|
||||||
}
|
}
|
||||||
// Replace auxiliary variables
|
// Replace auxiliary variables
|
||||||
|
|
|
@ -240,8 +240,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const unload = () => {
|
const unload = () => {
|
||||||
for (const table in tableInfo)
|
for (const table in tableInfo) {
|
||||||
|
if (!Object.hasOwn(tableInfo, table))
|
||||||
|
continue;
|
||||||
resetTableTimer(table);
|
resetTableTimer(table);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const load = () => {
|
const load = () => {
|
||||||
|
|
|
@ -447,6 +447,9 @@
|
||||||
const flattenedResp = [];
|
const flattenedResp = [];
|
||||||
const recFlatten = (current, name = "", depth = 0, fullName = "") => {
|
const recFlatten = (current, name = "", depth = 0, fullName = "") => {
|
||||||
for (const child in current) {
|
for (const child in current) {
|
||||||
|
if (!Object.hasOwn(current, child))
|
||||||
|
continue;
|
||||||
|
|
||||||
const currentFullName = fullName ? (fullName + "\\" + child) : child;
|
const currentFullName = fullName ? (fullName + "\\" + child) : child;
|
||||||
if (current[child].uid !== undefined) {
|
if (current[child].uid !== undefined) {
|
||||||
current[child].name = child;
|
current[child].name = child;
|
||||||
|
@ -671,8 +674,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const refreshAllFeeds = () => {
|
const refreshAllFeeds = () => {
|
||||||
for (const feedEntry in feedData)
|
for (const feedEntry in feedData) {
|
||||||
|
if (!Object.hasOwn(feedData, feedEntry))
|
||||||
|
continue;
|
||||||
refreshFeed(feedEntry);
|
refreshFeed(feedEntry);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const moveItem = (oldPath) => {
|
const moveItem = (oldPath) => {
|
||||||
|
|
|
@ -433,6 +433,9 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
onSuccess: (response) => {
|
onSuccess: (response) => {
|
||||||
const combobox = $("assignCategoryCombobox");
|
const combobox = $("assignCategoryCombobox");
|
||||||
for (const cat in response) {
|
for (const cat in response) {
|
||||||
|
if (!Object.hasOwn(response, cat))
|
||||||
|
continue;
|
||||||
|
|
||||||
const 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);
|
||||||
|
@ -476,6 +479,8 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
rssDownloaderRulesTable.clear();
|
rssDownloaderRulesTable.clear();
|
||||||
let rowCount = 0;
|
let rowCount = 0;
|
||||||
for (const rule in response) {
|
for (const rule in response) {
|
||||||
|
if (!Object.hasOwn(response, rule))
|
||||||
|
continue;
|
||||||
rssDownloaderRulesTable.updateRowData({
|
rssDownloaderRulesTable.updateRowData({
|
||||||
rowId: rowCount++,
|
rowId: rowCount++,
|
||||||
checked: response[rule].enabled,
|
checked: response[rule].enabled,
|
||||||
|
@ -641,6 +646,8 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
rssDownloaderArticlesTable.clear();
|
rssDownloaderArticlesTable.clear();
|
||||||
let rowCount = 0;
|
let rowCount = 0;
|
||||||
for (const feed in response) {
|
for (const feed in response) {
|
||||||
|
if (!Object.hasOwn(response, feed))
|
||||||
|
continue;
|
||||||
rssDownloaderArticlesTable.updateRowData({
|
rssDownloaderArticlesTable.updateRowData({
|
||||||
rowId: rowCount++,
|
rowId: rowCount++,
|
||||||
name: feed,
|
name: feed,
|
||||||
|
|
Loading…
Reference in a new issue