mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-22 06:13:36 -07:00
Replace MooTools destroy
with browser native remove
and override MooTools' Document.id
This commit is contained in:
parent
d56b353c52
commit
0906d0d976
7 changed files with 21 additions and 12 deletions
|
@ -175,6 +175,15 @@ let setStatusFilter = () => {};
|
||||||
let toggleFilterDisplay = () => {};
|
let toggleFilterDisplay = () => {};
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", (event) => {
|
window.addEventListener("DOMContentLoaded", (event) => {
|
||||||
|
document.id = el => {
|
||||||
|
switch (typeOf(el)) {
|
||||||
|
case "string":
|
||||||
|
return document.getElementById(el);
|
||||||
|
case "element":
|
||||||
|
return el;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
window.qBittorrent.LocalPreferences.upgrade();
|
window.qBittorrent.LocalPreferences.upgrade();
|
||||||
|
|
||||||
let isSearchPanelLoaded = false;
|
let isSearchPanelLoaded = false;
|
||||||
|
@ -499,7 +508,7 @@ window.addEventListener("DOMContentLoaded", (event) => {
|
||||||
if (!categoryList)
|
if (!categoryList)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
[...categoryList.children].forEach((el) => { el.destroy(); });
|
[...categoryList.children].forEach((el) => { el.remove(); });
|
||||||
|
|
||||||
const categoryItemTemplate = document.getElementById("categoryFilterItem");
|
const categoryItemTemplate = document.getElementById("categoryFilterItem");
|
||||||
|
|
||||||
|
@ -620,7 +629,7 @@ window.addEventListener("DOMContentLoaded", (event) => {
|
||||||
if (tagFilterList === null)
|
if (tagFilterList === null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
[...tagFilterList.children].forEach((el) => { el.destroy(); });
|
[...tagFilterList.children].forEach((el) => { el.remove(); });
|
||||||
|
|
||||||
const tagItemTemplate = document.getElementById("tagFilterItem");
|
const tagItemTemplate = document.getElementById("tagFilterItem");
|
||||||
|
|
||||||
|
@ -673,7 +682,7 @@ window.addEventListener("DOMContentLoaded", (event) => {
|
||||||
if (trackerFilterList === null)
|
if (trackerFilterList === null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
[...trackerFilterList.children].forEach((el) => { el.destroy(); });
|
[...trackerFilterList.children].forEach((el) => { el.remove(); });
|
||||||
|
|
||||||
const trackerItemTemplate = document.getElementById("trackerFilterItem");
|
const trackerItemTemplate = document.getElementById("trackerFilterItem");
|
||||||
|
|
||||||
|
|
|
@ -478,7 +478,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||||
|
|
||||||
updateCategoriesSubMenu(categories) {
|
updateCategoriesSubMenu(categories) {
|
||||||
const contextCategoryList = document.getElementById("contextCategoryList");
|
const contextCategoryList = document.getElementById("contextCategoryList");
|
||||||
[...contextCategoryList.children].forEach((el) => { el.destroy(); });
|
[...contextCategoryList.children].forEach((el) => { el.remove(); });
|
||||||
|
|
||||||
const createMenuItem = (text, imgURL, clickFn) => {
|
const createMenuItem = (text, imgURL, clickFn) => {
|
||||||
const anchor = document.createElement("a");
|
const anchor = document.createElement("a");
|
||||||
|
|
|
@ -900,7 +900,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
const rowPos = rows.length;
|
const rowPos = rows.length;
|
||||||
|
|
||||||
while ((rowPos < trs.length) && (trs.length > 0))
|
while ((rowPos < trs.length) && (trs.length > 0))
|
||||||
trs.pop().destroy();
|
trs.pop().remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1022,7 +1022,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const tr = this.getTrByRowId(rowId);
|
const tr = this.getTrByRowId(rowId);
|
||||||
tr?.destroy();
|
tr?.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1034,7 +1034,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (const tr of this.getTrs())
|
for (const tr of this.getTrs())
|
||||||
tr.destroy();
|
tr.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -248,7 +248,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
if (state && state.running)
|
if (state && state.running)
|
||||||
stopSearch(searchId);
|
stopSearch(searchId);
|
||||||
|
|
||||||
tab.destroy();
|
tab.remove();
|
||||||
|
|
||||||
fetch("api/v2/search/delete", {
|
fetch("api/v2/search/delete", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteCookie = (element) => {
|
const deleteCookie = (element) => {
|
||||||
element.closest("tr").destroy();
|
element.closest("tr").remove();
|
||||||
};
|
};
|
||||||
|
|
||||||
const save = () => {
|
const save = () => {
|
||||||
|
|
|
@ -2132,7 +2132,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
|
|
||||||
// Advanced Tab
|
// Advanced Tab
|
||||||
const updateNetworkInterfaces = (default_iface, default_iface_name) => {
|
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", {
|
fetch("api/v2/app/networkInterfaceList", {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
@ -2161,7 +2161,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateInterfaceAddresses = (iface, default_addr) => {
|
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);
|
const url = new URL("api/v2/app/networkInterfaceAddressList", window.location);
|
||||||
url.search = new URLSearchParams({
|
url.search = new URLSearchParams({
|
||||||
|
|
|
@ -425,7 +425,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const clearDetails = () => {
|
const clearDetails = () => {
|
||||||
[...document.getElementById("rssDetailsView").children].forEach((el) => { el.destroy(); });
|
[...document.getElementById("rssDetailsView").children].forEach((el) => { el.remove(); });
|
||||||
};
|
};
|
||||||
|
|
||||||
const showDetails = (feedUid, articleID) => {
|
const showDetails = (feedUid, articleID) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue