mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 13:23:34 -07:00
WebUI: Use native css transition for context menu
Reduce MooTools usage. PR #23069.
This commit is contained in:
parent
a265ba7fd2
commit
f743ae2d08
2 changed files with 12 additions and 12 deletions
|
@ -323,7 +323,17 @@ a.propButton img {
|
||||||
background-color: var(--color-background-default);
|
background-color: var(--color-background-default);
|
||||||
border: 1px solid var(--color-border-default);
|
border: 1px solid var(--color-border-default);
|
||||||
display: none;
|
display: none;
|
||||||
|
opacity: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
transition:
|
||||||
|
opacity 0.2s ease-in-out,
|
||||||
|
visibility 0.2s ease-in-out;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contextMenu.visible {
|
||||||
|
opacity: 1;
|
||||||
|
visibility: visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
.contextMenu .separator {
|
.contextMenu .separator {
|
||||||
|
|
|
@ -60,7 +60,6 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||||
onShow: () => {},
|
onShow: () => {},
|
||||||
onHide: () => {},
|
onHide: () => {},
|
||||||
onClick: () => {},
|
onClick: () => {},
|
||||||
fadeSpeed: 200,
|
|
||||||
touchTimer: 600,
|
touchTimer: 600,
|
||||||
...options
|
...options
|
||||||
};
|
};
|
||||||
|
@ -68,15 +67,6 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||||
// option diffs menu
|
// option diffs menu
|
||||||
this.menu = document.getElementById(this.options.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
|
// hide and begin the listener
|
||||||
this.hide().startListener();
|
this.hide().startListener();
|
||||||
|
|
||||||
|
@ -231,7 +221,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||||
show(trigger) {
|
show(trigger) {
|
||||||
if (lastShownContextMenu && (lastShownContextMenu !== this))
|
if (lastShownContextMenu && (lastShownContextMenu !== this))
|
||||||
lastShownContextMenu.hide();
|
lastShownContextMenu.hide();
|
||||||
this.fx.start(1);
|
this.menu.classList.add("visible");
|
||||||
this.options.onShow.call(this);
|
this.options.onShow.call(this);
|
||||||
lastShownContextMenu = this;
|
lastShownContextMenu = this;
|
||||||
return this;
|
return this;
|
||||||
|
@ -240,7 +230,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||||
// hide the menu
|
// hide the menu
|
||||||
hide(trigger) {
|
hide(trigger) {
|
||||||
if (lastShownContextMenu && (lastShownContextMenu.menu.style.visibility !== "hidden")) {
|
if (lastShownContextMenu && (lastShownContextMenu.menu.style.visibility !== "hidden")) {
|
||||||
this.fx.start(0);
|
this.menu.classList.remove("visible");
|
||||||
this.options.onHide.call(this);
|
this.options.onHide.call(this);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue