mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-06 13:11:25 -07:00
WebUI: Don't keep references to context menu targets
PR https://github.com/qbittorrent/qBittorrent/pull/22234.
This commit is contained in:
parent
069cd029eb
commit
730bf957a4
1 changed files with 6 additions and 4 deletions
|
@ -74,7 +74,6 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
|
|
||||||
// option diffs menu
|
// option diffs menu
|
||||||
this.menu = $(this.options.menu);
|
this.menu = $(this.options.menu);
|
||||||
this.targets = $$(this.options.targets);
|
|
||||||
|
|
||||||
// fx
|
// fx
|
||||||
this.fx = new Fx.Tween(this.menu, {
|
this.fx = new Fx.Tween(this.menu, {
|
||||||
|
@ -185,11 +184,14 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
addTarget: function(t) {
|
addTarget: function(t) {
|
||||||
|
if (t.hasEventListeners)
|
||||||
|
return;
|
||||||
|
|
||||||
// prevent long press from selecting this text
|
// prevent long press from selecting this text
|
||||||
t.style.setProperty("user-select", "none");
|
t.style.setProperty("user-select", "none");
|
||||||
t.style.setProperty("-webkit-user-select", "none");
|
t.style.setProperty("-webkit-user-select", "none");
|
||||||
|
t.hasEventListeners = true;
|
||||||
|
|
||||||
this.targets[this.targets.length] = t;
|
|
||||||
this.setupEventListeners(t);
|
this.setupEventListeners(t);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -210,8 +212,8 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
// get things started
|
// get things started
|
||||||
startListener: function() {
|
startListener: function() {
|
||||||
/* all elements */
|
/* all elements */
|
||||||
this.targets.each((el) => {
|
$$(this.options.targets).each((el) => {
|
||||||
this.setupEventListeners(el);
|
this.addTarget(el);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
/* menu items */
|
/* menu items */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue