mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-22 22:33:34 -07:00
WebUI: Use classlist.contains() instead of hasClass()
This commit is contained in:
parent
0442fe8e70
commit
8a494fbf95
11 changed files with 20 additions and 20 deletions
|
@ -185,7 +185,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||
|
||||
window.addEventListener("resize", window.qBittorrent.Misc.createDebounceHandler(500, (e) => {
|
||||
// only save sizes if the columns are visible
|
||||
if (!$("mainColumn").hasClass("invisible"))
|
||||
if (!$("mainColumn").classList.contains("invisible"))
|
||||
saveColumnSizes();
|
||||
}));
|
||||
|
||||
|
@ -1225,7 +1225,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||
else {
|
||||
$("showRssReaderLink").firstElementChild.style.opacity = "0";
|
||||
$("rssTabLink").classList.add("invisible");
|
||||
if ($("rssTabLink").hasClass("selected"))
|
||||
if ($("rssTabLink").classList.contains("selected"))
|
||||
$("transfersTabLink").click();
|
||||
}
|
||||
|
||||
|
@ -1239,7 +1239,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||
else {
|
||||
$("showSearchEngineLink").firstElementChild.style.opacity = "0";
|
||||
$("searchTabLink").classList.add("invisible");
|
||||
if ($("searchTabLink").hasClass("selected"))
|
||||
if ($("searchTabLink").classList.contains("selected"))
|
||||
$("transfersTabLink").click();
|
||||
}
|
||||
|
||||
|
@ -1253,7 +1253,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||
else {
|
||||
$("showLogViewerLink").firstElementChild.style.opacity = "0";
|
||||
$("logTabLink").classList.add("invisible");
|
||||
if ($("logTabLink").hasClass("selected"))
|
||||
if ($("logTabLink").classList.contains("selected"))
|
||||
$("transfersTabLink").click();
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
|||
|
||||
const scrollableMenuMaxHeight = document.documentElement.clientHeight * 0.75;
|
||||
|
||||
if (this.menu.hasClass("scrollableMenu"))
|
||||
if (this.menu.classList.contains("scrollableMenu"))
|
||||
this.menu.style.maxHeight = `${scrollableMenuMaxHeight}px`;
|
||||
|
||||
// draw the menu off-screen to know the menu dimensions
|
||||
|
@ -119,7 +119,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
|||
const uls = this.menu.getElementsByTagName("ul");
|
||||
for (let i = 0; i < uls.length; ++i) {
|
||||
const ul = uls[i];
|
||||
if (ul.hasClass("scrollableMenu"))
|
||||
if (ul.classList.contains("scrollableMenu"))
|
||||
ul.style.maxHeight = `${scrollableMenuMaxHeight}px`;
|
||||
const rectParent = ul.parentNode.getBoundingClientRect();
|
||||
const xPosOrigin = rectParent.left;
|
||||
|
|
|
@ -711,7 +711,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
|||
for (let i = 0; i < trs.length; ++i) {
|
||||
const tr = trs[i];
|
||||
this.selectedRows.push(tr.rowId);
|
||||
if (!tr.hasClass("selected"))
|
||||
if (!tr.classList.contains("selected"))
|
||||
tr.classList.add("selected");
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -76,8 +76,8 @@ window.qBittorrent.PropGeneral ??= (() => {
|
|||
|
||||
let loadTorrentDataTimer = -1;
|
||||
const loadTorrentData = () => {
|
||||
if ($("propGeneral").hasClass("invisible")
|
||||
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
|
||||
if ($("propGeneral").classList.contains("invisible")
|
||||
|| $("propertiesPanel_collapseToggle").classList.contains("panel-expand")) {
|
||||
// Tab changed, don't do anything
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -43,8 +43,8 @@ window.qBittorrent.PropPeers ??= (() => {
|
|||
let show_flags = true;
|
||||
|
||||
const loadTorrentPeersData = () => {
|
||||
if ($("propPeers").hasClass("invisible")
|
||||
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
|
||||
if ($("propPeers").classList.contains("invisible")
|
||||
|| $("propertiesPanel_collapseToggle").classList.contains("panel-expand")) {
|
||||
syncTorrentPeersLastResponseId = 0;
|
||||
torrentPeersTable.clear();
|
||||
return;
|
||||
|
|
|
@ -43,8 +43,8 @@ window.qBittorrent.PropTrackers ??= (() => {
|
|||
let loadTrackersDataTimer = -1;
|
||||
|
||||
const loadTrackersData = () => {
|
||||
if ($("propTrackers").hasClass("invisible")
|
||||
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
|
||||
if ($("propTrackers").classList.contains("invisible")
|
||||
|| $("propertiesPanel_collapseToggle").classList.contains("panel-expand")) {
|
||||
// Tab changed, don't do anything
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -43,8 +43,8 @@ window.qBittorrent.PropWebseeds ??= (() => {
|
|||
|
||||
let loadWebSeedsDataTimer = -1;
|
||||
const loadWebSeedsData = () => {
|
||||
if ($("propWebSeeds").hasClass("invisible")
|
||||
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
|
||||
if ($("propWebSeeds").classList.contains("invisible")
|
||||
|| $("propertiesPanel_collapseToggle").classList.contains("panel-expand")) {
|
||||
// Tab changed, don't do anything
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ window.qBittorrent.Search ??= (() => {
|
|||
return;
|
||||
|
||||
const searchId = getSearchIdFromTab(tab);
|
||||
const isTabSelected = tab.hasClass("selected");
|
||||
const isTabSelected = tab.classList.contains("selected");
|
||||
const newTabToSelect = isTabSelected ? (tab.nextSibling || tab.previousSibling) : null;
|
||||
|
||||
const currentSearchId = getSelectedSearchId();
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
};
|
||||
|
||||
const save = () => {
|
||||
const rows = [...document.querySelectorAll("#manageCookiesTable tbody tr")].filter(e => !e.hasClass("invisible"));
|
||||
const rows = [...document.querySelectorAll("#manageCookiesTable tbody tr")].filter(e => !e.classList.contains("invisible"));
|
||||
const cookies = rows.map(row => {
|
||||
const expDateValue = row.querySelector("td.expDate input").valueAsNumber;
|
||||
// remove ms from string
|
||||
|
|
|
@ -370,7 +370,7 @@
|
|||
onSuccess: (response) => {
|
||||
$("error_div").textContent = "";
|
||||
|
||||
if ($("logTabColumn").hasClass("invisible"))
|
||||
if ($("logTabColumn").classList.contains("invisible"))
|
||||
return;
|
||||
|
||||
if (response.length > 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue