mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 22:18:05 -06:00
WebUI: Replace getElements & getChildren
This PR further reduces Mootools usage. PR #22220.
This commit is contained in:
@@ -478,7 +478,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
|
||||
updateCategoriesSubMenu(categories) {
|
||||
const contextCategoryList = $("contextCategoryList");
|
||||
contextCategoryList.getChildren().each(c => c.destroy());
|
||||
[...contextCategoryList.children].forEach((el) => { el.destroy(); });
|
||||
|
||||
const createMenuItem = (text, imgURL, clickFn) => {
|
||||
const anchor = document.createElement("a");
|
||||
@@ -633,15 +633,12 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
class SearchPluginsTableContextMenu extends ContextMenu {
|
||||
updateMenuItems() {
|
||||
const enabledColumnIndex = (text) => {
|
||||
const columns = $("searchPluginsTableFixedHeaderRow").getChildren("th");
|
||||
for (let i = 0; i < columns.length; ++i) {
|
||||
if (columns[i].textContent === "Enabled")
|
||||
return i;
|
||||
}
|
||||
const columns = document.querySelectorAll("#searchPluginsTableFixedHeaderRow th");
|
||||
return Array.prototype.findIndex.call(columns, (column => column.textContent === "Enabled"));
|
||||
};
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user