diff --git a/src/webui/www/private/index.html b/src/webui/www/private/index.html
index 1f11f3aa5..23001f92c 100644
--- a/src/webui/www/private/index.html
+++ b/src/webui/www/private/index.html
@@ -26,6 +26,7 @@
+
diff --git a/src/webui/www/private/scripts/client.js b/src/webui/www/private/scripts/client.js
index bbac67db7..7f95a74f5 100644
--- a/src/webui/www/private/scripts/client.js
+++ b/src/webui/www/private/scripts/client.js
@@ -499,7 +499,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 +620,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 +673,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/monkeypatch.js b/src/webui/www/private/scripts/monkeypatch.js
new file mode 100644
index 000000000..a2aafd69f
--- /dev/null
+++ b/src/webui/www/private/scripts/monkeypatch.js
@@ -0,0 +1,72 @@
+/*
+ * Bittorrent Client using Qt and libtorrent.
+ * Copyright (C) 2025 bolshoytoster
+ * Copyright (C) 2025 Mike Tzou (Chocobo1)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * In addition, as a special exception, the copyright holders give permission to
+ * link this program with the OpenSSL project's "OpenSSL" library (or with
+ * modified versions of it that use the same license as the "OpenSSL" library),
+ * and distribute the linked executables. You must obey the GNU General Public
+ * License in all respects for all of the code used other than "OpenSSL". If you
+ * modify file(s), you may extend this exception to your version of the file(s),
+ * but you are not obligated to do so. If you do not wish to do so, delete this
+ * exception statement from your version.
+ */
+
+"use strict";
+
+window.qBittorrent ??= {};
+window.qBittorrent.MonkeyPatch ??= (() => {
+ const exports = () => {
+ return {
+ patch: patch
+ };
+ };
+
+ const patch = () => {
+ patchMootoolsDocumentId();
+ };
+
+ const patchMootoolsDocumentId = () => {
+ // Override MooTools' `document.id` (used for `$(id)`), which prevents it
+ // from allocating a `uniqueNumber` for elements that don't need it.
+ // MooTools and MochaUI use it internally.
+
+ if (document.id === undefined)
+ return;
+
+ document.id = (el) => {
+ if ((el === null) || (el === undefined))
+ return null;
+
+ switch (typeof el) {
+ case "object":
+ return el;
+ case "string":
+ return document.getElementById(el);
+ }
+
+ return null;
+ };
+ };
+
+ return exports();
+})();
+Object.freeze(window.qBittorrent.MonkeyPatch);
+
+// execute now
+window.qBittorrent.MonkeyPatch.patch();
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) => {
diff --git a/src/webui/www/webui.qrc b/src/webui/www/webui.qrc
index bc637f56c..4a833b85a 100644
--- a/src/webui/www/webui.qrc
+++ b/src/webui/www/webui.qrc
@@ -408,6 +408,7 @@
private/scripts/localpreferences.js
private/scripts/misc.js
private/scripts/mocha-init.js
+ private/scripts/monkeypatch.js
private/scripts/pathAutofill.js
private/scripts/piecesbar.js
private/scripts/progressbar.js