WebUI: remove redundant events

The base class already handle them.
Also optimize the base implementation a bit.
This commit is contained in:
Chocobo1 2024-08-09 17:21:01 +08:00
parent 1179fc3de3
commit 0c580c3174
No known key found for this signature in database
GPG key ID: 210D9C873253A68C

View file

@ -95,8 +95,9 @@ window.qBittorrent.DynamicTable ??= (() => {
const tableDiv = $(this.dynamicTableDivId);
const tableFixedHeaderDiv = $(this.dynamicTableFixedHeaderDivId);
const tableElement = tableFixedHeaderDiv.querySelector("table");
tableDiv.addEventListener("scroll", () => {
tableFixedHeaderDiv.getElements("table")[0].style.left = `${-tableDiv.scrollLeft}px`;
tableElement.style.left = `${-tableDiv.scrollLeft}px`;
});
// if the table exists within a panel
@ -2764,13 +2765,6 @@ window.qBittorrent.DynamicTable ??= (() => {
this.hiddenTableHeader.appendChild(new Element("th"));
this.fixedTableHeader.appendChild(new Element("th"));
},
setupCommonEvents: function() {
const scrollFn = function() {
$(this.dynamicTableFixedHeaderDivId).getElements("table")[0].style.left = -$(this.dynamicTableDivId).scrollLeft + "px";
}.bind(this);
$(this.dynamicTableDivId).addEventListener("scroll", scrollFn);
}
});
@ -2859,13 +2853,6 @@ window.qBittorrent.DynamicTable ??= (() => {
this.hiddenTableHeader.appendChild(new Element("th"));
this.fixedTableHeader.appendChild(new Element("th"));
},
setupCommonEvents: function() {
const scrollFn = function() {
$(this.dynamicTableFixedHeaderDivId).getElements("table")[0].style.left = -$(this.dynamicTableDivId).scrollLeft + "px";
}.bind(this);
$(this.dynamicTableDivId).addEventListener("scroll", scrollFn);
}
});