WebUI: Use native css transition for context menu

Reduce MooTools usage.

PR #23069.
This commit is contained in:
tehcneko
2025-08-11 16:28:47 +08:00
committed by GitHub
parent a265ba7fd2
commit f743ae2d08
2 changed files with 12 additions and 12 deletions

View File

@@ -60,7 +60,6 @@ window.qBittorrent.ContextMenu ??= (() => {
onShow: () => {},
onHide: () => {},
onClick: () => {},
fadeSpeed: 200,
touchTimer: 600,
...options
};
@@ -68,15 +67,6 @@ window.qBittorrent.ContextMenu ??= (() => {
// option diffs menu
this.menu = document.getElementById(this.options.menu);
// fx
this.fx = new Fx.Tween(this.menu, {
property: "opacity",
duration: this.options.fadeSpeed,
onComplete: () => {
this.menu.style.visibility = (getComputedStyle(this.menu).opacity > 0) ? "visible" : "hidden";
}
});
// hide and begin the listener
this.hide().startListener();
@@ -231,7 +221,7 @@ window.qBittorrent.ContextMenu ??= (() => {
show(trigger) {
if (lastShownContextMenu && (lastShownContextMenu !== this))
lastShownContextMenu.hide();
this.fx.start(1);
this.menu.classList.add("visible");
this.options.onShow.call(this);
lastShownContextMenu = this;
return this;
@@ -240,7 +230,7 @@ window.qBittorrent.ContextMenu ??= (() => {
// hide the menu
hide(trigger) {
if (lastShownContextMenu && (lastShownContextMenu.menu.style.visibility !== "hidden")) {
this.fx.start(0);
this.menu.classList.remove("visible");
this.options.onHide.call(this);
}
return this;