WebUI: Use classlist.remove() instead of removeClass()

This commit is contained in:
skomerko 2024-12-03 09:57:50 +01:00
commit 0442fe8e70
9 changed files with 61 additions and 61 deletions

View file

@ -1054,12 +1054,12 @@ window.addEventListener("DOMContentLoaded", () => {
torrentsTable.columns["priority"].force_hide = !queueing_enabled; torrentsTable.columns["priority"].force_hide = !queueing_enabled;
torrentsTable.updateColumn("priority"); torrentsTable.updateColumn("priority");
if (queueing_enabled) { if (queueing_enabled) {
$("topQueuePosItem").removeClass("invisible"); $("topQueuePosItem").classList.remove("invisible");
$("increaseQueuePosItem").removeClass("invisible"); $("increaseQueuePosItem").classList.remove("invisible");
$("decreaseQueuePosItem").removeClass("invisible"); $("decreaseQueuePosItem").classList.remove("invisible");
$("bottomQueuePosItem").removeClass("invisible"); $("bottomQueuePosItem").classList.remove("invisible");
$("queueingButtons").removeClass("invisible"); $("queueingButtons").classList.remove("invisible");
$("queueingMenuItems").removeClass("invisible"); $("queueingMenuItems").classList.remove("invisible");
} }
else { else {
$("topQueuePosItem").classList.add("invisible"); $("topQueuePosItem").classList.add("invisible");
@ -1123,7 +1123,7 @@ window.addEventListener("DOMContentLoaded", () => {
LocalPreferences.set("show_top_toolbar", showTopToolbar.toString()); LocalPreferences.set("show_top_toolbar", showTopToolbar.toString());
if (showTopToolbar) { if (showTopToolbar) {
$("showTopToolbarLink").firstElementChild.style.opacity = "1"; $("showTopToolbarLink").firstElementChild.style.opacity = "1";
$("mochaToolbar").removeClass("invisible"); $("mochaToolbar").classList.remove("invisible");
} }
else { else {
$("showTopToolbarLink").firstElementChild.style.opacity = "0"; $("showTopToolbarLink").firstElementChild.style.opacity = "0";
@ -1137,7 +1137,7 @@ window.addEventListener("DOMContentLoaded", () => {
LocalPreferences.set("show_status_bar", showStatusBar.toString()); LocalPreferences.set("show_status_bar", showStatusBar.toString());
if (showStatusBar) { if (showStatusBar) {
$("showStatusBarLink").firstElementChild.style.opacity = "1"; $("showStatusBarLink").firstElementChild.style.opacity = "1";
$("desktopFooterWrapper").removeClass("invisible"); $("desktopFooterWrapper").classList.remove("invisible");
} }
else { else {
$("showStatusBarLink").firstElementChild.style.opacity = "0"; $("showStatusBarLink").firstElementChild.style.opacity = "0";
@ -1175,8 +1175,8 @@ window.addEventListener("DOMContentLoaded", () => {
LocalPreferences.set("show_filters_sidebar", showFiltersSidebar.toString()); LocalPreferences.set("show_filters_sidebar", showFiltersSidebar.toString());
if (showFiltersSidebar) { if (showFiltersSidebar) {
$("showFiltersSidebarLink").firstElementChild.style.opacity = "1"; $("showFiltersSidebarLink").firstElementChild.style.opacity = "1";
$("filtersColumn").removeClass("invisible"); $("filtersColumn").classList.remove("invisible");
$("filtersColumn_handle").removeClass("invisible"); $("filtersColumn_handle").classList.remove("invisible");
} }
else { else {
$("showFiltersSidebarLink").firstElementChild.style.opacity = "0"; $("showFiltersSidebarLink").firstElementChild.style.opacity = "0";
@ -1217,8 +1217,8 @@ window.addEventListener("DOMContentLoaded", () => {
const updateTabDisplay = () => { const updateTabDisplay = () => {
if (window.qBittorrent.Client.isShowRssReader()) { if (window.qBittorrent.Client.isShowRssReader()) {
$("showRssReaderLink").firstElementChild.style.opacity = "1"; $("showRssReaderLink").firstElementChild.style.opacity = "1";
$("mainWindowTabs").removeClass("invisible"); $("mainWindowTabs").classList.remove("invisible");
$("rssTabLink").removeClass("invisible"); $("rssTabLink").classList.remove("invisible");
if (!MochaUI.Panels.instances.RssPanel) if (!MochaUI.Panels.instances.RssPanel)
addRssPanel(); addRssPanel();
} }
@ -1231,8 +1231,8 @@ window.addEventListener("DOMContentLoaded", () => {
if (window.qBittorrent.Client.isShowSearchEngine()) { if (window.qBittorrent.Client.isShowSearchEngine()) {
$("showSearchEngineLink").firstElementChild.style.opacity = "1"; $("showSearchEngineLink").firstElementChild.style.opacity = "1";
$("mainWindowTabs").removeClass("invisible"); $("mainWindowTabs").classList.remove("invisible");
$("searchTabLink").removeClass("invisible"); $("searchTabLink").classList.remove("invisible");
if (!MochaUI.Panels.instances.SearchPanel) if (!MochaUI.Panels.instances.SearchPanel)
addSearchPanel(); addSearchPanel();
} }
@ -1245,8 +1245,8 @@ window.addEventListener("DOMContentLoaded", () => {
if (window.qBittorrent.Client.isShowLogViewer()) { if (window.qBittorrent.Client.isShowLogViewer()) {
$("showLogViewerLink").firstElementChild.style.opacity = "1"; $("showLogViewerLink").firstElementChild.style.opacity = "1";
$("mainWindowTabs").removeClass("invisible"); $("mainWindowTabs").classList.remove("invisible");
$("logTabLink").removeClass("invisible"); $("logTabLink").classList.remove("invisible");
if (!MochaUI.Panels.instances.LogPanel) if (!MochaUI.Panels.instances.LogPanel)
addLogPanel(); addLogPanel();
} }
@ -1269,11 +1269,11 @@ window.addEventListener("DOMContentLoaded", () => {
const showTransfersTab = () => { const showTransfersTab = () => {
const showFiltersSidebar = LocalPreferences.get("show_filters_sidebar", "true") === "true"; const showFiltersSidebar = LocalPreferences.get("show_filters_sidebar", "true") === "true";
if (showFiltersSidebar) { if (showFiltersSidebar) {
$("filtersColumn").removeClass("invisible"); $("filtersColumn").classList.remove("invisible");
$("filtersColumn_handle").removeClass("invisible"); $("filtersColumn_handle").classList.remove("invisible");
} }
$("mainColumn").removeClass("invisible"); $("mainColumn").classList.remove("invisible");
$("torrentsFilterToolbar").removeClass("invisible"); $("torrentsFilterToolbar").classList.remove("invisible");
customSyncMainDataInterval = null; customSyncMainDataInterval = null;
syncData(100); syncData(100);
@ -1312,7 +1312,7 @@ window.addEventListener("DOMContentLoaded", () => {
searchTabInitialized = true; searchTabInitialized = true;
} }
$("searchTabColumn").removeClass("invisible"); $("searchTabColumn").classList.remove("invisible");
customSyncMainDataInterval = 30000; customSyncMainDataInterval = 30000;
hideTransfersTab(); hideTransfersTab();
hideRssTab(); hideRssTab();
@ -1349,7 +1349,7 @@ window.addEventListener("DOMContentLoaded", () => {
window.qBittorrent.Rss.load(); window.qBittorrent.Rss.load();
} }
$("rssTabColumn").removeClass("invisible"); $("rssTabColumn").classList.remove("invisible");
customSyncMainDataInterval = 30000; customSyncMainDataInterval = 30000;
hideTransfersTab(); hideTransfersTab();
hideSearchTab(); hideSearchTab();
@ -1387,7 +1387,7 @@ window.addEventListener("DOMContentLoaded", () => {
window.qBittorrent.Log.load(); window.qBittorrent.Log.load();
} }
$("logTabColumn").removeClass("invisible"); $("logTabColumn").classList.remove("invisible");
customSyncMainDataInterval = 30000; customSyncMainDataInterval = 30000;
hideTransfersTab(); hideTransfersTab();
hideSearchTab(); hideSearchTab();

View file

@ -263,7 +263,7 @@ window.qBittorrent.ContextMenu ??= (() => {
// show an item // show an item
showItem(item) { showItem(item) {
this.menu.getElement("a[href$=" + item + "]").parentNode.removeClass("invisible"); this.menu.getElement("a[href$=" + item + "]").parentNode.classList.remove("invisible");
return this; return this;
} }
@ -418,7 +418,7 @@ window.qBittorrent.ContextMenu ??= (() => {
if (!show_seq_dl && show_f_l_piece_prio) if (!show_seq_dl && show_f_l_piece_prio)
this.menu.getElement("a[href$=firstLastPiecePrio]").parentNode.classList.add("separator"); this.menu.getElement("a[href$=firstLastPiecePrio]").parentNode.classList.add("separator");
else else
this.menu.getElement("a[href$=firstLastPiecePrio]").parentNode.removeClass("separator"); this.menu.getElement("a[href$=firstLastPiecePrio]").parentNode.classList.remove("separator");
if (show_seq_dl) if (show_seq_dl)
this.showItem("sequentialDownload"); this.showItem("sequentialDownload");
@ -434,7 +434,7 @@ window.qBittorrent.ContextMenu ??= (() => {
this.setItemChecked("firstLastPiecePrio", all_are_f_l_piece_prio); this.setItemChecked("firstLastPiecePrio", all_are_f_l_piece_prio);
this.showItem("downloadLimit"); this.showItem("downloadLimit");
this.menu.getElement("a[href$=uploadLimit]").parentNode.removeClass("separator"); this.menu.getElement("a[href$=uploadLimit]").parentNode.classList.remove("separator");
this.hideItem("superSeeding"); this.hideItem("superSeeding");
} }
@ -665,7 +665,7 @@ window.qBittorrent.ContextMenu ??= (() => {
switch (selectedRows.length) { switch (selectedRows.length) {
case 0: case 0:
// remove separator on top of newSubscription entry to avoid double line // remove separator on top of newSubscription entry to avoid double line
this.menu.getElement("a[href$=newSubscription]").parentNode.removeClass("separator"); this.menu.getElement("a[href$=newSubscription]").parentNode.classList.remove("separator");
// menu when nothing selected // menu when nothing selected
this.hideItem("update"); this.hideItem("update");
this.hideItem("markRead"); this.hideItem("markRead");

View file

@ -601,7 +601,7 @@ window.qBittorrent.DynamicTable ??= (() => {
if ((this.columns[i].visible === "0") || this.columns[i].force_hide) if ((this.columns[i].visible === "0") || this.columns[i].force_hide)
th.classList.add("invisible"); th.classList.add("invisible");
else else
th.removeClass("invisible"); th.classList.remove("invisible");
} }
}, },
@ -625,10 +625,10 @@ window.qBittorrent.DynamicTable ??= (() => {
fths[pos].setAttribute("style", style); fths[pos].setAttribute("style", style);
if (visible) { if (visible) {
ths[pos].removeClass("invisible"); ths[pos].classList.remove("invisible");
fths[pos].removeClass("invisible"); fths[pos].classList.remove("invisible");
for (let i = 0; i < trs.length; ++i) for (let i = 0; i < trs.length; ++i)
trs[i].getElements("td")[pos].removeClass("invisible"); trs[i].getElements("td")[pos].classList.remove("invisible");
} }
else { else {
ths[pos].classList.add("invisible"); ths[pos].classList.add("invisible");
@ -679,12 +679,12 @@ window.qBittorrent.DynamicTable ??= (() => {
if (isReverse) if (isReverse)
colElem.classList.add("reverse"); colElem.classList.add("reverse");
else else
colElem.removeClass("reverse"); colElem.classList.remove("reverse");
} }
const oldColElem = getCol(this.dynamicTableFixedHeaderDivId, oldColumn); const oldColElem = getCol(this.dynamicTableFixedHeaderDivId, oldColumn);
if (oldColElem !== null) { if (oldColElem !== null) {
oldColElem.removeClass("sorted"); oldColElem.classList.remove("sorted");
oldColElem.removeClass("reverse"); oldColElem.classList.remove("reverse");
} }
}, },
@ -769,7 +769,7 @@ window.qBittorrent.DynamicTable ??= (() => {
if (that.isRowSelected(tr.rowId)) if (that.isRowSelected(tr.rowId))
tr.classList.add("selected"); tr.classList.add("selected");
else else
tr.removeClass("selected"); tr.classList.remove("selected");
}); });
}, },
@ -1960,13 +1960,13 @@ window.qBittorrent.DynamicTable ??= (() => {
td.textContent = "QBT_TR(Yes)QBT_TR[CONTEXT=SearchPluginsTable]"; td.textContent = "QBT_TR(Yes)QBT_TR[CONTEXT=SearchPluginsTable]";
td.title = "QBT_TR(Yes)QBT_TR[CONTEXT=SearchPluginsTable]"; td.title = "QBT_TR(Yes)QBT_TR[CONTEXT=SearchPluginsTable]";
td.getParent("tr").classList.add("green"); td.getParent("tr").classList.add("green");
td.getParent("tr").removeClass("red"); td.getParent("tr").classList.remove("red");
} }
else { else {
td.textContent = "QBT_TR(No)QBT_TR[CONTEXT=SearchPluginsTable]"; td.textContent = "QBT_TR(No)QBT_TR[CONTEXT=SearchPluginsTable]";
td.title = "QBT_TR(No)QBT_TR[CONTEXT=SearchPluginsTable]"; td.title = "QBT_TR(No)QBT_TR[CONTEXT=SearchPluginsTable]";
td.getParent("tr").classList.add("red"); td.getParent("tr").classList.add("red");
td.getParent("tr").removeClass("green"); td.getParent("tr").classList.remove("green");
} }
}; };
}, },
@ -2967,7 +2967,7 @@ window.qBittorrent.DynamicTable ??= (() => {
if (row.rowId === rowId) { if (row.rowId === rowId) {
articleId = row.full_data.dataId; articleId = row.full_data.dataId;
feedUid = row.full_data.feedUid; feedUid = row.full_data.feedUid;
this.tableBody.rows[row.rowId].removeClass("unreadArticle"); this.tableBody.rows[row.rowId].classList.remove("unreadArticle");
break; break;
} }
} }
@ -2990,7 +2990,7 @@ window.qBittorrent.DynamicTable ??= (() => {
if (!row.full_data.isRead) if (!row.full_data.isRead)
tr.classList.add("unreadArticle"); tr.classList.add("unreadArticle");
else else
tr.removeClass("unreadArticle"); 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) {
@ -3261,10 +3261,10 @@ window.qBittorrent.DynamicTable ??= (() => {
if (row.full_data.isFeed) { if (row.full_data.isFeed) {
tr.classList.add("articleTableFeed"); tr.classList.add("articleTableFeed");
tr.removeClass("articleTableArticle"); tr.classList.remove("articleTableArticle");
} }
else { else {
tr.removeClass("articleTableFeed"); tr.classList.remove("articleTableFeed");
tr.classList.add("articleTableArticle"); tr.classList.add("articleTableArticle");
} }

View file

@ -671,7 +671,7 @@ window.qBittorrent.PropFiles ??= (() => {
if (shouldHide) if (shouldHide)
rowElem.classList.add("invisible"); rowElem.classList.add("invisible");
else else
rowElem.removeClass("invisible"); rowElem.classList.remove("invisible");
}; };
/** /**
@ -692,7 +692,7 @@ window.qBittorrent.PropFiles ??= (() => {
if (isCollapsed) if (isCollapsed)
collapseIcon.classList.add("rotate"); collapseIcon.classList.add("rotate");
else else
collapseIcon.removeClass("rotate"); collapseIcon.classList.remove("rotate");
}; };
const _isCollapsed = (node) => { const _isCollapsed = (node) => {

View file

@ -18,32 +18,32 @@
$("aboutAboutLink").addEventListener("click", () => { $("aboutAboutLink").addEventListener("click", () => {
$$(".aboutTabContent").forEach(tab => { tab.classList.add("invisible"); }); $$(".aboutTabContent").forEach(tab => { tab.classList.add("invisible"); });
$("aboutAboutContent").removeClass("invisible"); $("aboutAboutContent").classList.remove("invisible");
}); });
$("aboutAuthorLink").addEventListener("click", () => { $("aboutAuthorLink").addEventListener("click", () => {
$$(".aboutTabContent").forEach(tab => { tab.classList.add("invisible"); }); $$(".aboutTabContent").forEach(tab => { tab.classList.add("invisible"); });
$("aboutAuthorContent").removeClass("invisible"); $("aboutAuthorContent").classList.remove("invisible");
}); });
$("aboutSpecialThanksLink").addEventListener("click", () => { $("aboutSpecialThanksLink").addEventListener("click", () => {
$$(".aboutTabContent").forEach(tab => { tab.classList.add("invisible"); }); $$(".aboutTabContent").forEach(tab => { tab.classList.add("invisible"); });
$("aboutSpecialThanksContent").removeClass("invisible"); $("aboutSpecialThanksContent").classList.remove("invisible");
}); });
$("aboutTranslatorsLink").addEventListener("click", () => { $("aboutTranslatorsLink").addEventListener("click", () => {
$$(".aboutTabContent").forEach(tab => { tab.classList.add("invisible"); }); $$(".aboutTabContent").forEach(tab => { tab.classList.add("invisible"); });
$("aboutTranslatorsContent").removeClass("invisible"); $("aboutTranslatorsContent").classList.remove("invisible");
}); });
$("aboutLicenseLink").addEventListener("click", () => { $("aboutLicenseLink").addEventListener("click", () => {
$$(".aboutTabContent").forEach(tab => { tab.classList.add("invisible"); }); $$(".aboutTabContent").forEach(tab => { tab.classList.add("invisible"); });
$("aboutLicenseContent").removeClass("invisible"); $("aboutLicenseContent").classList.remove("invisible");
}); });
$("aboutSoftwareUsedLink").addEventListener("click", () => { $("aboutSoftwareUsedLink").addEventListener("click", () => {
$$(".aboutTabContent").forEach(tab => { tab.classList.add("invisible"); }); $$(".aboutTabContent").forEach(tab => { tab.classList.add("invisible"); });
$("aboutSoftwareUsedContent").removeClass("invisible"); $("aboutSoftwareUsedContent").classList.remove("invisible");
}); });
})(); })();
</script> </script>

View file

@ -306,14 +306,14 @@
currentSelectedTab = tab; currentSelectedTab = tab;
if (currentSelectedTab === "main") { if (currentSelectedTab === "main") {
selectBox.enable(); selectBox.enable();
$("logMessageView").removeClass("invisible"); $("logMessageView").classList.remove("invisible");
$("logPeerView").classList.add("invisible"); $("logPeerView").classList.add("invisible");
resetTableTimer("peer"); resetTableTimer("peer");
} }
else { else {
selectBox.disable(); selectBox.disable();
$("logMessageView").classList.add("invisible"); $("logMessageView").classList.add("invisible");
$("logPeerView").removeClass("invisible"); $("logPeerView").classList.remove("invisible");
resetTableTimer("main"); resetTableTimer("main");
} }

View file

@ -38,35 +38,35 @@
$("PrefBehaviorLink").addEventListener("click", (e) => { $("PrefBehaviorLink").addEventListener("click", (e) => {
$$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); }); $$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); });
$("BehaviorTab").removeClass("invisible"); $("BehaviorTab").classList.remove("invisible");
}); });
$("PrefDownloadsLink").addEventListener("click", (e) => { $("PrefDownloadsLink").addEventListener("click", (e) => {
$$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); }); $$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); });
$("DownloadsTab").removeClass("invisible"); $("DownloadsTab").classList.remove("invisible");
}); });
$("PrefConnectionLink").addEventListener("click", (e) => { $("PrefConnectionLink").addEventListener("click", (e) => {
$$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); }); $$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); });
$("ConnectionTab").removeClass("invisible"); $("ConnectionTab").classList.remove("invisible");
}); });
$("PrefSpeedLink").addEventListener("click", (e) => { $("PrefSpeedLink").addEventListener("click", (e) => {
$$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); }); $$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); });
$("SpeedTab").removeClass("invisible"); $("SpeedTab").classList.remove("invisible");
}); });
$("PrefBittorrentLink").addEventListener("click", (e) => { $("PrefBittorrentLink").addEventListener("click", (e) => {
$$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); }); $$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); });
$("BittorrentTab").removeClass("invisible"); $("BittorrentTab").classList.remove("invisible");
}); });
$("PrefRSSLink").addEventListener("click", (e) => { $("PrefRSSLink").addEventListener("click", (e) => {
$$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); }); $$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); });
$("RSSTab").removeClass("invisible"); $("RSSTab").classList.remove("invisible");
}); });
$("PrefWebUILink").addEventListener("click", (e) => { $("PrefWebUILink").addEventListener("click", (e) => {
$$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); }); $$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); });
$("WebUITab").removeClass("invisible"); $("WebUITab").classList.remove("invisible");
}); });
$("PrefAdvancedLink").addEventListener("click", (e) => { $("PrefAdvancedLink").addEventListener("click", (e) => {
$$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); }); $$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); });
$("AdvancedTab").removeClass("invisible"); $("AdvancedTab").classList.remove("invisible");
}); });
})(); })();
</script> </script>

View file

@ -215,7 +215,7 @@
const pref = window.parent.qBittorrent.Cache.preferences.get(); const pref = window.parent.qBittorrent.Cache.preferences.get();
if (!pref.rss_processing_enabled) if (!pref.rss_processing_enabled)
$("rssFetchingDisabled").removeClass("invisible"); $("rssFetchingDisabled").classList.remove("invisible");
const rssFeedContextMenu = new window.qBittorrent.ContextMenu.RssFeedContextMenu({ const rssFeedContextMenu = new window.qBittorrent.ContextMenu.RssFeedContextMenu({
targets: "#rssFeedTableDiv tr", targets: "#rssFeedTableDiv tr",

View file

@ -370,7 +370,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
const pref = window.parent.qBittorrent.Cache.preferences.get(); const pref = window.parent.qBittorrent.Cache.preferences.get();
if (!pref.rss_auto_downloading_enabled) if (!pref.rss_auto_downloading_enabled)
$("rssDownloaderDisabled").removeClass("invisible"); $("rssDownloaderDisabled").classList.remove("invisible");
// recalculate height // recalculate height
const warningHeight = $("rssDownloaderDisabled").getBoundingClientRect().height; const warningHeight = $("rssDownloaderDisabled").getBoundingClientRect().height;