mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-22 22:33:34 -07:00
WebUI: Use classlist.toggle() whenever possible
This commit is contained in:
parent
8a494fbf95
commit
00d0725ce1
3 changed files with 9 additions and 33 deletions
|
@ -415,10 +415,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||||
const show_seq_dl = (all_are_seq_dl || !there_are_seq_dl);
|
const show_seq_dl = (all_are_seq_dl || !there_are_seq_dl);
|
||||||
const show_f_l_piece_prio = (all_are_f_l_piece_prio || !there_are_f_l_piece_prio);
|
const show_f_l_piece_prio = (all_are_f_l_piece_prio || !there_are_f_l_piece_prio);
|
||||||
|
|
||||||
if (!show_seq_dl && show_f_l_piece_prio)
|
this.menu.getElement("a[href$=firstLastPiecePrio]").parentNode.classList.toggle("separator", !show_seq_dl && show_f_l_piece_prio);
|
||||||
this.menu.getElement("a[href$=firstLastPiecePrio]").parentNode.classList.add("separator");
|
|
||||||
else
|
|
||||||
this.menu.getElement("a[href$=firstLastPiecePrio]").parentNode.classList.remove("separator");
|
|
||||||
|
|
||||||
if (show_seq_dl)
|
if (show_seq_dl)
|
||||||
this.showItem("sequentialDownload");
|
this.showItem("sequentialDownload");
|
||||||
|
|
|
@ -598,10 +598,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
th.setAttribute("style", "width: " + this.columns[i].width + "px;" + this.columns[i].style);
|
th.setAttribute("style", "width: " + this.columns[i].width + "px;" + this.columns[i].style);
|
||||||
th.columnName = this.columns[i].name;
|
th.columnName = this.columns[i].name;
|
||||||
th.classList.add("column_" + th.columnName);
|
th.classList.add("column_" + th.columnName);
|
||||||
if ((this.columns[i].visible === "0") || this.columns[i].force_hide)
|
th.classList.toggle("invisible", (this.columns[i].visible === "0") || this.columns[i].force_hide);
|
||||||
th.classList.add("invisible");
|
|
||||||
else
|
|
||||||
th.classList.remove("invisible");
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -676,10 +673,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
const colElem = getCol(this.dynamicTableFixedHeaderDivId, newColumn);
|
const colElem = getCol(this.dynamicTableFixedHeaderDivId, newColumn);
|
||||||
if (colElem !== null) {
|
if (colElem !== null) {
|
||||||
colElem.classList.add("sorted");
|
colElem.classList.add("sorted");
|
||||||
if (isReverse)
|
colElem.classList.toggle("reverse", isReverse);
|
||||||
colElem.classList.add("reverse");
|
|
||||||
else
|
|
||||||
colElem.classList.remove("reverse");
|
|
||||||
}
|
}
|
||||||
const oldColElem = getCol(this.dynamicTableFixedHeaderDivId, oldColumn);
|
const oldColElem = getCol(this.dynamicTableFixedHeaderDivId, oldColumn);
|
||||||
if (oldColElem !== null) {
|
if (oldColElem !== null) {
|
||||||
|
@ -711,8 +705,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
for (let i = 0; i < trs.length; ++i) {
|
for (let i = 0; i < trs.length; ++i) {
|
||||||
const tr = trs[i];
|
const tr = trs[i];
|
||||||
this.selectedRows.push(tr.rowId);
|
this.selectedRows.push(tr.rowId);
|
||||||
if (!tr.classList.contains("selected"))
|
tr.classList.add("selected");
|
||||||
tr.classList.add("selected");
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -764,13 +757,8 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
},
|
},
|
||||||
|
|
||||||
setRowClass: function() {
|
setRowClass: function() {
|
||||||
const that = this;
|
for (const tr of this.tableBody.querySelectorAll("tr"))
|
||||||
this.tableBody.getElements("tr").each((tr) => {
|
tr.classList.toggle("selected", this.isRowSelected(tr.rowId));
|
||||||
if (that.isRowSelected(tr.rowId))
|
|
||||||
tr.classList.add("selected");
|
|
||||||
else
|
|
||||||
tr.classList.remove("selected");
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelectedRowChanged: () => {},
|
onSelectedRowChanged: () => {},
|
||||||
|
@ -2987,10 +2975,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
updateRow: function(tr, fullUpdate) {
|
updateRow: function(tr, fullUpdate) {
|
||||||
const row = this.rows.get(tr.rowId);
|
const row = this.rows.get(tr.rowId);
|
||||||
const data = row[fullUpdate ? "full_data" : "data"];
|
const data = row[fullUpdate ? "full_data" : "data"];
|
||||||
if (!row.full_data.isRead)
|
tr.classList.toggle("unreadArticle", !row.full_data.isRead);
|
||||||
tr.classList.add("unreadArticle");
|
|
||||||
else
|
|
||||||
tr.classList.remove("unreadArticle");
|
|
||||||
|
|
||||||
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) {
|
||||||
|
|
|
@ -668,10 +668,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
if (span === null)
|
if (span === null)
|
||||||
return;
|
return;
|
||||||
const rowElem = span.parentElement.parentElement;
|
const rowElem = span.parentElement.parentElement;
|
||||||
if (shouldHide)
|
rowElem.classList.toggle("invisible", shouldHide);
|
||||||
rowElem.classList.add("invisible");
|
|
||||||
else
|
|
||||||
rowElem.classList.remove("invisible");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -689,10 +686,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
|
|
||||||
// rotate the collapse icon
|
// rotate the collapse icon
|
||||||
const collapseIcon = td.getElementsByClassName("filesTableCollapseIcon")[0];
|
const collapseIcon = td.getElementsByClassName("filesTableCollapseIcon")[0];
|
||||||
if (isCollapsed)
|
collapseIcon.classList.toggle("rotate", isCollapsed);
|
||||||
collapseIcon.classList.add("rotate");
|
|
||||||
else
|
|
||||||
collapseIcon.classList.remove("rotate");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const _isCollapsed = (node) => {
|
const _isCollapsed = (node) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue