diff --git a/src/webui/www/private/scripts/client.js b/src/webui/www/private/scripts/client.js index bbac67db7..f39457608 100644 --- a/src/webui/www/private/scripts/client.js +++ b/src/webui/www/private/scripts/client.js @@ -175,6 +175,15 @@ let setStatusFilter = () => {}; let toggleFilterDisplay = () => {}; window.addEventListener("DOMContentLoaded", (event) => { + document.id = el => { + switch (typeOf(el)) { + case "string": + return document.getElementById(el); + case "element": + return el; + } + }; + window.qBittorrent.LocalPreferences.upgrade(); let isSearchPanelLoaded = false; @@ -499,7 +508,7 @@ window.addEventListener("DOMContentLoaded", (event) => { if (!categoryList) return; - [...categoryList.children].forEach((el) => { el.destroy(); }); + [...categoryList.children].forEach((el) => { el.remove(); }); const categoryItemTemplate = document.getElementById("categoryFilterItem"); @@ -620,7 +629,7 @@ window.addEventListener("DOMContentLoaded", (event) => { if (tagFilterList === null) return; - [...tagFilterList.children].forEach((el) => { el.destroy(); }); + [...tagFilterList.children].forEach((el) => { el.remove(); }); const tagItemTemplate = document.getElementById("tagFilterItem"); @@ -673,7 +682,7 @@ window.addEventListener("DOMContentLoaded", (event) => { if (trackerFilterList === null) return; - [...trackerFilterList.children].forEach((el) => { el.destroy(); }); + [...trackerFilterList.children].forEach((el) => { el.remove(); }); const trackerItemTemplate = document.getElementById("trackerFilterItem"); diff --git a/src/webui/www/private/scripts/contextmenu.js b/src/webui/www/private/scripts/contextmenu.js index c34df88b4..a16424b07 100644 --- a/src/webui/www/private/scripts/contextmenu.js +++ b/src/webui/www/private/scripts/contextmenu.js @@ -478,7 +478,7 @@ window.qBittorrent.ContextMenu ??= (() => { updateCategoriesSubMenu(categories) { const contextCategoryList = document.getElementById("contextCategoryList"); - [...contextCategoryList.children].forEach((el) => { el.destroy(); }); + [...contextCategoryList.children].forEach((el) => { el.remove(); }); const createMenuItem = (text, imgURL, clickFn) => { const anchor = document.createElement("a"); diff --git a/src/webui/www/private/scripts/dynamicTable.js b/src/webui/www/private/scripts/dynamicTable.js index ac38ee42a..b9cf16667 100644 --- a/src/webui/www/private/scripts/dynamicTable.js +++ b/src/webui/www/private/scripts/dynamicTable.js @@ -900,7 +900,7 @@ window.qBittorrent.DynamicTable ??= (() => { const rowPos = rows.length; while ((rowPos < trs.length) && (trs.length > 0)) - trs.pop().destroy(); + trs.pop().remove(); } } @@ -1022,7 +1022,7 @@ window.qBittorrent.DynamicTable ??= (() => { } else { const tr = this.getTrByRowId(rowId); - tr?.destroy(); + tr?.remove(); } } @@ -1034,7 +1034,7 @@ window.qBittorrent.DynamicTable ??= (() => { } else { for (const tr of this.getTrs()) - tr.destroy(); + tr.remove(); } } diff --git a/src/webui/www/private/scripts/search.js b/src/webui/www/private/scripts/search.js index 0f5062df2..b4b7e23db 100644 --- a/src/webui/www/private/scripts/search.js +++ b/src/webui/www/private/scripts/search.js @@ -248,7 +248,7 @@ window.qBittorrent.Search ??= (() => { if (state && state.running) stopSearch(searchId); - tab.destroy(); + tab.remove(); fetch("api/v2/search/delete", { method: "POST", diff --git a/src/webui/www/private/views/cookies.html b/src/webui/www/private/views/cookies.html index e7e301057..f6ffe4000 100644 --- a/src/webui/www/private/views/cookies.html +++ b/src/webui/www/private/views/cookies.html @@ -104,7 +104,7 @@ }; const deleteCookie = (element) => { - element.closest("tr").destroy(); + element.closest("tr").remove(); }; const save = () => { diff --git a/src/webui/www/private/views/preferences.html b/src/webui/www/private/views/preferences.html index 15770a5e5..a4cf7e5ae 100644 --- a/src/webui/www/private/views/preferences.html +++ b/src/webui/www/private/views/preferences.html @@ -2132,7 +2132,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD // Advanced Tab const updateNetworkInterfaces = (default_iface, default_iface_name) => { - [...document.getElementById("networkInterface").children].forEach((el) => { el.destroy(); }); + [...document.getElementById("networkInterface").children].forEach((el) => { el.remove(); }); fetch("api/v2/app/networkInterfaceList", { method: "GET", @@ -2161,7 +2161,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD }; const updateInterfaceAddresses = (iface, default_addr) => { - [...document.getElementById("optionalIPAddressToBind").children].forEach((el) => { el.destroy(); }); + [...document.getElementById("optionalIPAddressToBind").children].forEach((el) => { el.remove(); }); const url = new URL("api/v2/app/networkInterfaceAddressList", window.location); url.search = new URLSearchParams({ diff --git a/src/webui/www/private/views/rss.html b/src/webui/www/private/views/rss.html index 66b1b7ff7..287e9741a 100644 --- a/src/webui/www/private/views/rss.html +++ b/src/webui/www/private/views/rss.html @@ -425,7 +425,7 @@ }; const clearDetails = () => { - [...document.getElementById("rssDetailsView").children].forEach((el) => { el.destroy(); }); + [...document.getElementById("rssDetailsView").children].forEach((el) => { el.remove(); }); }; const showDetails = (feedUid, articleID) => {