mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-06 21:21:24 -07:00
Add date column to the built-in search engine
Adds a date column to the built-in search engine to show when a torrent was published/uploaded on the engine site. When a plugin wants to show a date, it can now add a `pub_date` entry to its result dict. The value format is a unix timestamp (an integer representing seconds since epoch). Plugins with no date support will keep working. PR #20703.
This commit is contained in:
parent
775b38079f
commit
42b87963fd
8 changed files with 40 additions and 10 deletions
|
@ -1685,6 +1685,7 @@ window.qBittorrent.DynamicTable = (function() {
|
|||
this.newColumn('nbSeeders', '', 'QBT_TR(Seeders)QBT_TR[CONTEXT=SearchResultsTable]', 100, true);
|
||||
this.newColumn('nbLeechers', '', 'QBT_TR(Leechers)QBT_TR[CONTEXT=SearchResultsTable]', 100, true);
|
||||
this.newColumn('siteUrl', '', 'QBT_TR(Search engine)QBT_TR[CONTEXT=SearchResultsTable]', 250, true);
|
||||
this.newColumn('pubDate', '', 'QBT_TR(Published On)QBT_TR[CONTEXT=SearchResultsTable]', 200, true);
|
||||
|
||||
this.initColumnsFunctions();
|
||||
},
|
||||
|
@ -1701,10 +1702,17 @@ window.qBittorrent.DynamicTable = (function() {
|
|||
td.set('text', formattedValue);
|
||||
td.set('title', formattedValue);
|
||||
};
|
||||
const displayDate = function(td, row) {
|
||||
const value = this.getRowValue(row) * 1000;
|
||||
const formattedValue = (isNaN(value) || (value <= 0)) ? "" : (new Date(value).toLocaleString());
|
||||
td.set('text', formattedValue);
|
||||
td.set('title', formattedValue);
|
||||
};
|
||||
|
||||
this.columns['fileSize'].updateTd = displaySize;
|
||||
this.columns['nbSeeders'].updateTd = displayNum;
|
||||
this.columns['nbLeechers'].updateTd = displayNum;
|
||||
this.columns['pubDate'].updateTd = displayDate;
|
||||
},
|
||||
|
||||
getFilteredAndSortedRows: function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue