mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-06 21:21:24 -07:00
WebUI: Add ability to toggle alternating row colors in tables
This commit is contained in:
parent
69a829dfb0
commit
b67495464d
11 changed files with 40 additions and 90 deletions
|
@ -88,6 +88,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
|||
this.setupHeaderEvents();
|
||||
this.setupHeaderMenu();
|
||||
this.setSortedColumnIcon(this.sortedColumn, null, (this.reverseSort === "1"));
|
||||
this.setupAltRow();
|
||||
},
|
||||
|
||||
setupCommonEvents: function() {
|
||||
|
@ -566,17 +567,10 @@ window.qBittorrent.DynamicTable ??= (() => {
|
|||
return this.selectedRows.contains(rowId);
|
||||
},
|
||||
|
||||
altRow: function() {
|
||||
if (!MUI.ieLegacySupport)
|
||||
return;
|
||||
|
||||
const trs = this.tableBody.getElements("tr");
|
||||
trs.each((el, i) => {
|
||||
if (i % 2)
|
||||
el.addClass("alt");
|
||||
else
|
||||
el.removeClass("alt");
|
||||
});
|
||||
setupAltRow: function() {
|
||||
const useAltRowColors = (LocalPreferences.get("use_alt_row_colors", "true") === "true");
|
||||
if (useAltRowColors)
|
||||
document.getElementById(this.dynamicTableDivId).classList.add("altRowColors");
|
||||
},
|
||||
|
||||
selectAll: function() {
|
||||
|
@ -2147,25 +2141,6 @@ window.qBittorrent.DynamicTable ??= (() => {
|
|||
this.updateGlobalCheckbox();
|
||||
},
|
||||
|
||||
altRow: function() {
|
||||
let addClass = false;
|
||||
const trs = this.tableBody.getElements("tr");
|
||||
trs.each((tr) => {
|
||||
if (tr.hasClass("invisible"))
|
||||
return;
|
||||
|
||||
if (addClass) {
|
||||
tr.addClass("alt");
|
||||
tr.removeClass("nonAlt");
|
||||
}
|
||||
else {
|
||||
tr.removeClass("alt");
|
||||
tr.addClass("nonAlt");
|
||||
}
|
||||
addClass = !addClass;
|
||||
});
|
||||
},
|
||||
|
||||
_sortNodesByColumn: function(nodes, column) {
|
||||
nodes.sort((row1, row2) => {
|
||||
// list folders before files when sorting by name
|
||||
|
@ -2496,25 +2471,6 @@ window.qBittorrent.DynamicTable ??= (() => {
|
|||
this.columns["availability"].updateTd = displayPercentage;
|
||||
},
|
||||
|
||||
altRow: function() {
|
||||
let addClass = false;
|
||||
const trs = this.tableBody.getElements("tr");
|
||||
trs.each((tr) => {
|
||||
if (tr.hasClass("invisible"))
|
||||
return;
|
||||
|
||||
if (addClass) {
|
||||
tr.addClass("alt");
|
||||
tr.removeClass("nonAlt");
|
||||
}
|
||||
else {
|
||||
tr.removeClass("alt");
|
||||
tr.addClass("nonAlt");
|
||||
}
|
||||
addClass = !addClass;
|
||||
});
|
||||
},
|
||||
|
||||
_sortNodesByColumn: function(nodes, column) {
|
||||
nodes.sort((row1, row2) => {
|
||||
// list folders before files when sorting by name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue