mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 06:28:03 -06:00
Use natural sort in WebUI
This commit is contained in:
@@ -54,6 +54,8 @@ window.qBittorrent.DynamicTable = (function() {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const naturalSortCollator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' });
|
||||||
|
|
||||||
let DynamicTableHeaderContextMenuClass = null;
|
let DynamicTableHeaderContextMenuClass = null;
|
||||||
let ProgressColumnWidth = -1;
|
let ProgressColumnWidth = -1;
|
||||||
|
|
||||||
@@ -380,12 +382,9 @@ window.qBittorrent.DynamicTable = (function() {
|
|||||||
return row['full_data'][this.dataProperties[pos]];
|
return row['full_data'][this.dataProperties[pos]];
|
||||||
};
|
};
|
||||||
column['compareRows'] = function(row1, row2) {
|
column['compareRows'] = function(row1, row2) {
|
||||||
if (this.getRowValue(row1) < this.getRowValue(row2))
|
const value1 = this.getRowValue(row1);
|
||||||
return -1;
|
const value2 = this.getRowValue(row2);
|
||||||
else if (this.getRowValue(row1) > this.getRowValue(row2))
|
return naturalSortCollator.compare(value1, value2);
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
};
|
};
|
||||||
column['updateTd'] = function(td, row) {
|
column['updateTd'] = function(td, row) {
|
||||||
const value = this.getRowValue(row);
|
const value = this.getRowValue(row);
|
||||||
@@ -2251,12 +2250,9 @@ window.qBittorrent.DynamicTable = (function() {
|
|||||||
return row['full_data'][this.dataProperties[pos]];
|
return row['full_data'][this.dataProperties[pos]];
|
||||||
};
|
};
|
||||||
column['compareRows'] = function(row1, row2) {
|
column['compareRows'] = function(row1, row2) {
|
||||||
if (this.getRowValue(row1) < this.getRowValue(row2))
|
const value1 = this.getRowValue(row1);
|
||||||
return -1;
|
const value2 = this.getRowValue(row2);
|
||||||
else if (this.getRowValue(row1) > this.getRowValue(row2))
|
return naturalSortCollator.compare(value1, value2);
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
};
|
};
|
||||||
column['updateTd'] = function(td, row) {
|
column['updateTd'] = function(td, row) {
|
||||||
const value = this.getRowValue(row);
|
const value = this.getRowValue(row);
|
||||||
@@ -2348,12 +2344,9 @@ window.qBittorrent.DynamicTable = (function() {
|
|||||||
return row['full_data'][this.dataProperties[pos]];
|
return row['full_data'][this.dataProperties[pos]];
|
||||||
};
|
};
|
||||||
column['compareRows'] = function(row1, row2) {
|
column['compareRows'] = function(row1, row2) {
|
||||||
if (this.getRowValue(row1) < this.getRowValue(row2))
|
const value1 = this.getRowValue(row1);
|
||||||
return -1;
|
const value2 = this.getRowValue(row2);
|
||||||
else if (this.getRowValue(row1) > this.getRowValue(row2))
|
return naturalSortCollator.compare(value1, value2);
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
};
|
};
|
||||||
column['updateTd'] = function(td, row) {
|
column['updateTd'] = function(td, row) {
|
||||||
const value = this.getRowValue(row);
|
const value = this.getRowValue(row);
|
||||||
@@ -2435,12 +2428,9 @@ window.qBittorrent.DynamicTable = (function() {
|
|||||||
return row['full_data'][this.dataProperties[pos]];
|
return row['full_data'][this.dataProperties[pos]];
|
||||||
};
|
};
|
||||||
column['compareRows'] = function(row1, row2) {
|
column['compareRows'] = function(row1, row2) {
|
||||||
if (this.getRowValue(row1) < this.getRowValue(row2))
|
const value1 = this.getRowValue(row1);
|
||||||
return -1;
|
const value2 = this.getRowValue(row2);
|
||||||
else if (this.getRowValue(row1) > this.getRowValue(row2))
|
return naturalSortCollator.compare(value1, value2);
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
};
|
};
|
||||||
column['updateTd'] = function(td, row) {
|
column['updateTd'] = function(td, row) {
|
||||||
const value = this.getRowValue(row);
|
const value = this.getRowValue(row);
|
||||||
@@ -2523,12 +2513,9 @@ window.qBittorrent.DynamicTable = (function() {
|
|||||||
return row['full_data'][this.dataProperties[pos]];
|
return row['full_data'][this.dataProperties[pos]];
|
||||||
};
|
};
|
||||||
column['compareRows'] = function(row1, row2) {
|
column['compareRows'] = function(row1, row2) {
|
||||||
if (this.getRowValue(row1) < this.getRowValue(row2))
|
const value1 = this.getRowValue(row1);
|
||||||
return -1;
|
const value2 = this.getRowValue(row2);
|
||||||
else if (this.getRowValue(row1) > this.getRowValue(row2))
|
return naturalSortCollator.compare(value1, value2);
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
};
|
};
|
||||||
column['updateTd'] = function(td, row) {
|
column['updateTd'] = function(td, row) {
|
||||||
const value = this.getRowValue(row);
|
const value = this.getRowValue(row);
|
||||||
@@ -2574,12 +2561,9 @@ window.qBittorrent.DynamicTable = (function() {
|
|||||||
return row['full_data'][this.dataProperties[pos]];
|
return row['full_data'][this.dataProperties[pos]];
|
||||||
};
|
};
|
||||||
column['compareRows'] = function(row1, row2) {
|
column['compareRows'] = function(row1, row2) {
|
||||||
if (this.getRowValue(row1) < this.getRowValue(row2))
|
const value1 = this.getRowValue(row1);
|
||||||
return -1;
|
const value2 = this.getRowValue(row2);
|
||||||
else if (this.getRowValue(row1) > this.getRowValue(row2))
|
return naturalSortCollator.compare(value1, value2);
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
};
|
};
|
||||||
column['updateTd'] = function(td, row) {
|
column['updateTd'] = function(td, row) {
|
||||||
const value = this.getRowValue(row);
|
const value = this.getRowValue(row);
|
||||||
|
|||||||
Reference in New Issue
Block a user