mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 07:27:22 -06:00
WebUI: remove redundant events
The base class already handle them. Also optimize the base implementation a bit.
This commit is contained in:
@@ -95,8 +95,9 @@ window.qBittorrent.DynamicTable ??= (() => {
|
|||||||
const tableDiv = $(this.dynamicTableDivId);
|
const tableDiv = $(this.dynamicTableDivId);
|
||||||
const tableFixedHeaderDiv = $(this.dynamicTableFixedHeaderDivId);
|
const tableFixedHeaderDiv = $(this.dynamicTableFixedHeaderDivId);
|
||||||
|
|
||||||
|
const tableElement = tableFixedHeaderDiv.querySelector("table");
|
||||||
tableDiv.addEventListener("scroll", () => {
|
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
|
// if the table exists within a panel
|
||||||
@@ -2764,13 +2765,6 @@ window.qBittorrent.DynamicTable ??= (() => {
|
|||||||
|
|
||||||
this.hiddenTableHeader.appendChild(new Element("th"));
|
this.hiddenTableHeader.appendChild(new Element("th"));
|
||||||
this.fixedTableHeader.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.hiddenTableHeader.appendChild(new Element("th"));
|
||||||
this.fixedTableHeader.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);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user