WebUI: use native function for selecting elements

PR #22179.
This commit is contained in:
Chocobo1
2025-01-20 23:36:11 +08:00
committed by GitHub
parent 1ee84033ec
commit f8c48349a1
7 changed files with 30 additions and 55 deletions

View File

@@ -67,7 +67,9 @@ window.qBittorrent.ContextMenu ??= (() => {
// option diffs menu
this.menu = $(this.options.menu);
this.targets = $$(this.options.targets);
this.targets = (this.options.targets.length > 0)
? Array.from(document.querySelectorAll(this.options.targets))
: [];
// fx
this.fx = new Fx.Tween(this.menu, {
@@ -197,9 +199,8 @@ window.qBittorrent.ContextMenu ??= (() => {
// get things started
startListener() {
/* all elements */
this.targets.each((el) => {
for (const el of this.targets)
this.setupEventListeners(el);
}, this);
/* menu items */
this.menu.addEventListener("click", (e) => {