1
0
mirror of https://github.com/Lightcord/Lightcord.git synced 2025-04-12 00:55:40 +02:00

Fix scrollTop error in addon settings.

This commit is contained in:
Jean Ouina 2020-07-20 14:08:49 +02:00
parent 02cd8c4c30
commit cc7ff4a030
3 changed files with 249 additions and 240 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -59,6 +59,10 @@ export default class V2C_PluginCard extends BDV2.reactComponent {
if (!settingsCookie["fork-ps-3"]) return;
setImmediate(() => {
const isHidden = (container, element) => {
if(!container){
console.error(new Error(`Container is undefined.`))
return false
}
const cTop = container.scrollTop;
const cBottom = cTop + container.clientHeight;
const eTop = element.offsetTop;
@ -67,7 +71,7 @@ export default class V2C_PluginCard extends BDV2.reactComponent {
};
const thisNode = this.refs.cardNode;
const container = thisNode.closest("div[class*=\"scroller-\"]")
const container = thisNode.closest("div[class*=\"contentRegionScroller-\"]")
if (!isHidden(container, thisNode)) return;
const thisNodeOffset = DOM.offset(thisNode);
const containerOffset = DOM.offset(container);