WebUI: Replace Mootools class list manipulation methods

All `addClass()`, `removeClass()` and `hasClass()` instances were changed to use `classList` equivalent:
https://developer.mozilla.org/en-US/docs/Web/API/Element/classList

PR #21946.

---------

Co-authored-by: Chocobo1 <Chocobo1@users.noreply.github.com>
This commit is contained in:
skomerko
2024-12-08 09:12:57 +01:00
committed by GitHub
parent 9f0fa4c215
commit 7080f85b59
15 changed files with 143 additions and 167 deletions

View File

@@ -179,7 +179,7 @@ window.qBittorrent.PropFiles ??= (() => {
select.id = "comboPrio" + id;
select.setAttribute("data-id", id);
select.setAttribute("data-file-id", fileId);
select.addClass("combo_priority");
select.classList.add("combo_priority");
select.addEventListener("change", fileComboboxChanged);
select.appendChild(createOption(FilePriority.Ignored, (FilePriority.Ignored === selectedPriority), "QBT_TR(Do not download)QBT_TR[CONTEXT=PropListDelegate]"));
@@ -335,8 +335,8 @@ window.qBittorrent.PropFiles ??= (() => {
let loadTorrentFilesDataTimer = -1;
const loadTorrentFilesData = () => {
if ($("propFiles").hasClass("invisible")
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
if ($("propFiles").classList.contains("invisible")
|| $("propertiesPanel_collapseToggle").classList.contains("panel-expand")) {
// Tab changed, don't do anything
return;
}
@@ -668,10 +668,7 @@ window.qBittorrent.PropFiles ??= (() => {
if (span === null)
return;
const rowElem = span.parentElement.parentElement;
if (shouldHide)
rowElem.addClass("invisible");
else
rowElem.removeClass("invisible");
rowElem.classList.toggle("invisible", shouldHide);
};
/**
@@ -689,10 +686,7 @@ window.qBittorrent.PropFiles ??= (() => {
// rotate the collapse icon
const collapseIcon = td.getElementsByClassName("filesTableCollapseIcon")[0];
if (isCollapsed)
collapseIcon.addClass("rotate");
else
collapseIcon.removeClass("rotate");
collapseIcon.classList.toggle("rotate", isCollapsed);
};
const _isCollapsed = (node) => {