mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-07 05:31:25 -07:00
WebUI: enforce coding style
Actually, not all of them but some that can be enforced by eslint. The changes are made by eslint with minor manual tweaking. PR #17046.
This commit is contained in:
parent
5af96943e3
commit
dbfd6a2368
20 changed files with 155 additions and 98 deletions
|
@ -241,7 +241,8 @@ window.qBittorrent.DynamicTable = (function() {
|
|||
const val = LocalPreferences.get('columns_order_' + this.dynamicTableDivId).split(',');
|
||||
val.erase(el.columnName);
|
||||
let pos = val.indexOf(this.lastHoverTh.columnName);
|
||||
if (this.dropSide === 'right') ++pos;
|
||||
if (this.dropSide === 'right')
|
||||
++pos;
|
||||
val.splice(pos, 0, el.columnName);
|
||||
LocalPreferences.set('columns_order_' + this.dynamicTableDivId, val.join(','));
|
||||
this.loadColumnsOrder();
|
||||
|
@ -383,10 +384,11 @@ window.qBittorrent.DynamicTable = (function() {
|
|||
return -1;
|
||||
else if (this.getRowValue(row1) > this.getRowValue(row2))
|
||||
return 1;
|
||||
else return 0;
|
||||
else
|
||||
return 0;
|
||||
};
|
||||
column['updateTd'] = function(td, row) {
|
||||
const value = this.getRowValue(row)
|
||||
const value = this.getRowValue(row);
|
||||
td.set('text', value);
|
||||
td.set('title', value);
|
||||
};
|
||||
|
@ -401,7 +403,8 @@ window.qBittorrent.DynamicTable = (function() {
|
|||
loadColumnsOrder: function() {
|
||||
const columnsOrder = [];
|
||||
const val = LocalPreferences.get('columns_order_' + this.dynamicTableDivId);
|
||||
if (val === null || val === undefined) return;
|
||||
if (val === null || val === undefined)
|
||||
return;
|
||||
val.split(',').forEach(function(v) {
|
||||
if ((v in this.columns) && (!columnsOrder.contains(v)))
|
||||
columnsOrder.push(v);
|
||||
|
@ -989,7 +992,8 @@ window.qBittorrent.DynamicTable = (function() {
|
|||
// status
|
||||
this.columns['status'].updateTd = function(td, row) {
|
||||
const state = this.getRowValue(row);
|
||||
if (!state) return;
|
||||
if (!state)
|
||||
return;
|
||||
|
||||
let status;
|
||||
switch (state) {
|
||||
|
@ -1071,7 +1075,8 @@ window.qBittorrent.DynamicTable = (function() {
|
|||
return -1;
|
||||
else if (row1_val > row2_val)
|
||||
return 1;
|
||||
else return 0;
|
||||
else
|
||||
return 0;
|
||||
};
|
||||
|
||||
// name, category, tags
|
||||
|
@ -1155,7 +1160,8 @@ window.qBittorrent.DynamicTable = (function() {
|
|||
return -1;
|
||||
else if (num_seeds1 > num_seeds2)
|
||||
return 1;
|
||||
else return 0;
|
||||
else
|
||||
return 0;
|
||||
};
|
||||
|
||||
// num_leechs
|
||||
|
@ -1402,7 +1408,8 @@ window.qBittorrent.DynamicTable = (function() {
|
|||
const rows = this.rows.getValues();
|
||||
|
||||
for (let i = 0; i < rows.length; ++i)
|
||||
if (this.applyFilter(rows[i], filterName, categoryHash, tagHash, trackerHash, null)) ++cnt;
|
||||
if (this.applyFilter(rows[i], filterName, categoryHash, tagHash, trackerHash, null))
|
||||
++cnt;
|
||||
return cnt;
|
||||
},
|
||||
|
||||
|
@ -1608,13 +1615,13 @@ window.qBittorrent.DynamicTable = (function() {
|
|||
const size = window.qBittorrent.Misc.friendlyUnit(this.getRowValue(row), false);
|
||||
td.set('text', size);
|
||||
td.set('title', size);
|
||||
}
|
||||
};
|
||||
const displayNum = function(td, row) {
|
||||
const value = this.getRowValue(row);
|
||||
const formattedValue = (value === "-1") ? "Unknown" : value;
|
||||
td.set('text', formattedValue);
|
||||
td.set('title', formattedValue);
|
||||
}
|
||||
};
|
||||
|
||||
this.columns['fileSize'].updateTd = displaySize;
|
||||
this.columns['nbSeeders'].updateTd = displayNum;
|
||||
|
@ -1635,7 +1642,7 @@ window.qBittorrent.DynamicTable = (function() {
|
|||
return {
|
||||
min: minSize,
|
||||
max: maxSize
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const getSeedsFilters = function() {
|
||||
|
@ -1651,7 +1658,7 @@ window.qBittorrent.DynamicTable = (function() {
|
|||
return {
|
||||
min: minSeeds,
|
||||
max: maxSeeds
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
let filteredRows = [];
|
||||
|
@ -1666,12 +1673,18 @@ window.qBittorrent.DynamicTable = (function() {
|
|||
for (let i = 0; i < rows.length; ++i) {
|
||||
const row = rows[i];
|
||||
|
||||
if (searchInTorrentName && !window.qBittorrent.Misc.containsAllTerms(row.full_data.fileName, searchTerms)) continue;
|
||||
if ((filterTerms.length > 0) && !window.qBittorrent.Misc.containsAllTerms(row.full_data.fileName, filterTerms)) continue;
|
||||
if ((sizeFilters.min > 0.00) && (row.full_data.fileSize < sizeFilters.min)) continue;
|
||||
if ((sizeFilters.max > 0.00) && (row.full_data.fileSize > sizeFilters.max)) continue;
|
||||
if ((seedsFilters.min > 0) && (row.full_data.nbSeeders < seedsFilters.min)) continue;
|
||||
if ((seedsFilters.max > 0) && (row.full_data.nbSeeders > seedsFilters.max)) continue;
|
||||
if (searchInTorrentName && !window.qBittorrent.Misc.containsAllTerms(row.full_data.fileName, searchTerms))
|
||||
continue;
|
||||
if ((filterTerms.length > 0) && !window.qBittorrent.Misc.containsAllTerms(row.full_data.fileName, filterTerms))
|
||||
continue;
|
||||
if ((sizeFilters.min > 0.00) && (row.full_data.fileSize < sizeFilters.min))
|
||||
continue;
|
||||
if ((sizeFilters.max > 0.00) && (row.full_data.fileSize > sizeFilters.max))
|
||||
continue;
|
||||
if ((seedsFilters.min > 0) && (row.full_data.nbSeeders < seedsFilters.min))
|
||||
continue;
|
||||
if ((seedsFilters.max > 0) && (row.full_data.nbSeeders > seedsFilters.max))
|
||||
continue;
|
||||
|
||||
filteredRows.push(row);
|
||||
}
|
||||
|
@ -2226,10 +2239,11 @@ window.qBittorrent.DynamicTable = (function() {
|
|||
return -1;
|
||||
else if (this.getRowValue(row1) > this.getRowValue(row2))
|
||||
return 1;
|
||||
else return 0;
|
||||
else
|
||||
return 0;
|
||||
};
|
||||
column['updateTd'] = function(td, row) {
|
||||
const value = this.getRowValue(row)
|
||||
const value = this.getRowValue(row);
|
||||
td.set('text', value);
|
||||
td.set('title', value);
|
||||
};
|
||||
|
@ -2322,10 +2336,11 @@ window.qBittorrent.DynamicTable = (function() {
|
|||
return -1;
|
||||
else if (this.getRowValue(row1) > this.getRowValue(row2))
|
||||
return 1;
|
||||
else return 0;
|
||||
else
|
||||
return 0;
|
||||
};
|
||||
column['updateTd'] = function(td, row) {
|
||||
const value = this.getRowValue(row)
|
||||
const value = this.getRowValue(row);
|
||||
td.set('text', value);
|
||||
td.set('title', value);
|
||||
};
|
||||
|
@ -2408,10 +2423,11 @@ window.qBittorrent.DynamicTable = (function() {
|
|||
return -1;
|
||||
else if (this.getRowValue(row1) > this.getRowValue(row2))
|
||||
return 1;
|
||||
else return 0;
|
||||
else
|
||||
return 0;
|
||||
};
|
||||
column['updateTd'] = function(td, row) {
|
||||
const value = this.getRowValue(row)
|
||||
const value = this.getRowValue(row);
|
||||
td.set('text', value);
|
||||
td.set('title', value);
|
||||
};
|
||||
|
@ -2495,10 +2511,11 @@ window.qBittorrent.DynamicTable = (function() {
|
|||
return -1;
|
||||
else if (this.getRowValue(row1) > this.getRowValue(row2))
|
||||
return 1;
|
||||
else return 0;
|
||||
else
|
||||
return 0;
|
||||
};
|
||||
column['updateTd'] = function(td, row) {
|
||||
const value = this.getRowValue(row)
|
||||
const value = this.getRowValue(row);
|
||||
td.set('text', value);
|
||||
td.set('title', value);
|
||||
};
|
||||
|
@ -2545,10 +2562,11 @@ window.qBittorrent.DynamicTable = (function() {
|
|||
return -1;
|
||||
else if (this.getRowValue(row1) > this.getRowValue(row2))
|
||||
return 1;
|
||||
else return 0;
|
||||
else
|
||||
return 0;
|
||||
};
|
||||
column['updateTd'] = function(td, row) {
|
||||
const value = this.getRowValue(row)
|
||||
const value = this.getRowValue(row);
|
||||
td.set('text', value);
|
||||
td.set('title', value);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue