Browse Source

Don't use Object.prototypes builtins directly

See: https://eslint.org/docs/rules/no-prototype-builtins
adaptive-webui-19844
Chocobo1 4 years ago
parent
commit
5fe0e9395f
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 4
      src/webui/www/private/scripts/client.js
  2. 8
      src/webui/www/private/scripts/dynamicTable.js

4
src/webui/www/private/scripts/client.js

@ -464,7 +464,7 @@ window.addEvent('load', function() {
const torrentsCount = torrentsTable.getRowIds().length; const torrentsCount = torrentsTable.getRowIds().length;
let untagged = 0; let untagged = 0;
for (const key in torrentsTable.rows) { for (const key in torrentsTable.rows) {
if (torrentsTable.rows.hasOwnProperty(key) && torrentsTable.rows[key]['full_data'].tags.length === 0) if (Object.prototype.hasOwnProperty.call(torrentsTable.rows, key) && (torrentsTable.rows[key]['full_data'].tags.length === 0))
untagged += 1; untagged += 1;
} }
tagFilterList.appendChild(createLink(TAGS_ALL, 'QBT_TR(All)QBT_TR[CONTEXT=TagFilterModel]', torrentsCount)); tagFilterList.appendChild(createLink(TAGS_ALL, 'QBT_TR(All)QBT_TR[CONTEXT=TagFilterModel]', torrentsCount));
@ -519,7 +519,7 @@ window.addEvent('load', function() {
trackerFilterList.appendChild(createLink(TRACKERS_ALL, 'QBT_TR(All (%1))QBT_TR[CONTEXT=TrackerFiltersList]', torrentsCount)); trackerFilterList.appendChild(createLink(TRACKERS_ALL, 'QBT_TR(All (%1))QBT_TR[CONTEXT=TrackerFiltersList]', torrentsCount));
let trackerlessTorrentsCount = 0; let trackerlessTorrentsCount = 0;
for (const key in torrentsTable.rows) { for (const key in torrentsTable.rows) {
if (torrentsTable.rows.hasOwnProperty(key) && (torrentsTable.rows[key]['full_data'].trackers_count === 0)) if (Object.prototype.hasOwnProperty.call(torrentsTable.rows, key) && (torrentsTable.rows[key]['full_data'].trackers_count === 0))
trackerlessTorrentsCount += 1; trackerlessTorrentsCount += 1;
} }
trackerFilterList.appendChild(createLink(TRACKERS_TRACKERLESS, 'QBT_TR(Trackerless (%1))QBT_TR[CONTEXT=TrackerFiltersList]', trackerlessTorrentsCount)); trackerFilterList.appendChild(createLink(TRACKERS_TRACKERLESS, 'QBT_TR(Trackerless (%1))QBT_TR[CONTEXT=TrackerFiltersList]', trackerlessTorrentsCount));

8
src/webui/www/private/scripts/dynamicTable.js

@ -778,7 +778,7 @@ window.qBittorrent.DynamicTable = (function() {
const tds = tr.getElements('td'); const tds = tr.getElements('td');
for (let i = 0; i < this.columns.length; ++i) { for (let i = 0; i < this.columns.length; ++i) {
if (data.hasOwnProperty(this.columns[i].dataProperties[0])) if (Object.prototype.hasOwnProperty.call(data, this.columns[i].dataProperties[0]))
this.columns[i].updateTd(tds[i], row); this.columns[i].updateTd(tds[i], row);
} }
row['data'] = {}; row['data'] = {};
@ -2058,7 +2058,7 @@ window.qBittorrent.DynamicTable = (function() {
const tds = tr.getElements('td'); const tds = tr.getElements('td');
for (let i = 0; i < this.columns.length; ++i) { for (let i = 0; i < this.columns.length; ++i) {
if (data.hasOwnProperty(this.columns[i].dataProperties[0])) if (Object.prototype.hasOwnProperty.call(data, this.columns[i].dataProperties[0]))
this.columns[i].updateTd(tds[i], row); this.columns[i].updateTd(tds[i], row);
} }
row['data'] = {}; row['data'] = {};
@ -2203,7 +2203,7 @@ window.qBittorrent.DynamicTable = (function() {
const tds = tr.getElements('td'); const tds = tr.getElements('td');
for (let i = 0; i < this.columns.length; ++i) { for (let i = 0; i < this.columns.length; ++i) {
if (data.hasOwnProperty(this.columns[i].dataProperties[0])) if (Object.prototype.hasOwnProperty.call(data, this.columns[i].dataProperties[0]))
this.columns[i].updateTd(tds[i], row); this.columns[i].updateTd(tds[i], row);
} }
row['data'] = {}; row['data'] = {};
@ -2484,7 +2484,7 @@ window.qBittorrent.DynamicTable = (function() {
const tds = tr.getElements('td'); const tds = tr.getElements('td');
for (let i = 0; i < this.columns.length; ++i) { for (let i = 0; i < this.columns.length; ++i) {
if (data.hasOwnProperty(this.columns[i].dataProperties[0])) if (Object.prototype.hasOwnProperty.call(data, this.columns[i].dataProperties[0]))
this.columns[i].updateTd(tds[i], row); this.columns[i].updateTd(tds[i], row);
} }
row['data'] = {}; row['data'] = {};

Loading…
Cancel
Save