diff --git a/src/webui/www/private/scripts/client.js b/src/webui/www/private/scripts/client.js index 102517a74..cd6d5a1a2 100644 --- a/src/webui/www/private/scripts/client.js +++ b/src/webui/www/private/scripts/client.js @@ -490,7 +490,9 @@ window.addEventListener("DOMContentLoaded", () => { const categoryList = document.getElementById("categoryFilterList"); if (!categoryList) return; - categoryList.getChildren().each(c => c.destroy()); + + for (const category of categoryList.querySelectorAll("li")) + category.destroy(); const categoryItemTemplate = document.getElementById("categoryFilterItem"); @@ -611,7 +613,8 @@ window.addEventListener("DOMContentLoaded", () => { if (tagFilterList === null) return; - tagFilterList.getChildren().each(c => c.destroy()); + for (const tag of tagFilterList.querySelectorAll("li")) + tag.destroy(); const tagItemTemplate = document.getElementById("tagFilterItem"); @@ -664,7 +667,8 @@ window.addEventListener("DOMContentLoaded", () => { if (trackerFilterList === null) return; - trackerFilterList.getChildren().each(c => c.destroy()); + for (const tracker of trackerFilterList.querySelectorAll("li")) + tracker.destroy(); const trackerItemTemplate = document.getElementById("trackerFilterItem"); diff --git a/src/webui/www/private/scripts/contextmenu.js b/src/webui/www/private/scripts/contextmenu.js index ffbfb3d86..6adb93d72 100644 --- a/src/webui/www/private/scripts/contextmenu.js +++ b/src/webui/www/private/scripts/contextmenu.js @@ -478,7 +478,8 @@ window.qBittorrent.ContextMenu ??= (() => { updateCategoriesSubMenu(categories) { const contextCategoryList = $("contextCategoryList"); - contextCategoryList.getChildren().each(c => c.destroy()); + for (const category of contextCategoryList.querySelectorAll("li")) + category.destroy(); const createMenuItem = (text, imgURL, clickFn) => { const anchor = document.createElement("a"); @@ -633,7 +634,7 @@ window.qBittorrent.ContextMenu ??= (() => { class SearchPluginsTableContextMenu extends ContextMenu { updateMenuItems() { const enabledColumnIndex = (text) => { - const columns = $("searchPluginsTableFixedHeaderRow").getChildren("th"); + const columns = document.querySelectorAll("#searchPluginsTableFixedHeaderRow th"); for (let i = 0; i < columns.length; ++i) { if (columns[i].textContent === "Enabled") return i; @@ -641,7 +642,7 @@ window.qBittorrent.ContextMenu ??= (() => { }; this.showItem("Enabled"); - this.setItemChecked("Enabled", (this.options.element.getChildren("td")[enabledColumnIndex()].textContent === "Yes")); + this.setItemChecked("Enabled", (this.options.element.children[enabledColumnIndex()].textContent === "Yes")); this.showItem("Uninstall"); } diff --git a/src/webui/www/private/scripts/dynamicTable.js b/src/webui/www/private/scripts/dynamicTable.js index fd9c47204..59800e010 100644 --- a/src/webui/www/private/scripts/dynamicTable.js +++ b/src/webui/www/private/scripts/dynamicTable.js @@ -1247,8 +1247,8 @@ window.qBittorrent.DynamicTable ??= (() => { if ((progressFormatted === 100.0) && (progress !== 1.0)) progressFormatted = 99.9; - if (td.getChildren("div").length > 0) { - const div = td.getChildren("div")[0]; + const div = td.firstElementChild; + if (div !== null) { if (td.resized) { td.resized = false; div.setWidth(progressColumnWidth - 5); diff --git a/src/webui/www/private/views/preferences.html b/src/webui/www/private/views/preferences.html index df873927d..a8e27fc3a 100644 --- a/src/webui/www/private/views/preferences.html +++ b/src/webui/www/private/views/preferences.html @@ -2102,7 +2102,9 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD // Advanced Tab const updateNetworkInterfaces = (default_iface, default_iface_name) => { - $("networkInterface").getChildren().each(c => c.destroy()); + for (const option of document.querySelectorAll("#networkInterface option")) + option.destroy(); + fetch("api/v2/app/networkInterfaceList", { method: "GET", cache: "no-store" @@ -2130,7 +2132,9 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD }; const updateInterfaceAddresses = (iface, default_addr) => { - $("optionalIPAddressToBind").getChildren().each(c => c.destroy()); + for (const option of document.querySelectorAll("#optionalIPAddressToBind option")) + option.destroy(); + const url = new URL("api/v2/app/networkInterfaceAddressList", window.location); url.search = new URLSearchParams({ iface: iface diff --git a/src/webui/www/private/views/rss.html b/src/webui/www/private/views/rss.html index 0e69af988..4e44ec534 100644 --- a/src/webui/www/private/views/rss.html +++ b/src/webui/www/private/views/rss.html @@ -417,13 +417,19 @@ }); }); - $("rssDetailsView").getChildren().each(c => c.destroy()); + clearDetails(); rssArticleTable.updateTable(false); }; + const clearDetails = () => { + for (const element of [...document.getElementById("rssDetailsView").children]) + element.destroy(); + }; + const showDetails = (feedUid, articleID) => { markArticleAsRead(pathByFeedId.get(feedUid), articleID); - $("rssDetailsView").getChildren().each(c => c.destroy()); + clearDetails(); + const article = feedData[feedUid].filter((article) => article.id === articleID)[0]; if (article) { $("rssDetailsView").append((() => {