aboutsummaryrefslogtreecommitdiff
path: root/src/content
diff options
context:
space:
mode:
Diffstat (limited to 'src/content')
-rw-r--r--src/content/presenters/ScrollPresenter.ts17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/content/presenters/ScrollPresenter.ts b/src/content/presenters/ScrollPresenter.ts
index 508532c..78bec00 100644
--- a/src/content/presenters/ScrollPresenter.ts
+++ b/src/content/presenters/ScrollPresenter.ts
@@ -11,17 +11,22 @@ let lastTimeoutId: number | null = null;
// Only checks for vertical scrollability.
// Credit: https://github.com/philc/vimium/blob/bdf654aebe6f570f427c5f7bc9592cad86e642b5/content_scripts/scroller.js#L93
const canBeScrolled = (element: Element): boolean => {
- let scrollTopBefore = element.scrollTop;
+ const scrollTopBefore = element.scrollTop;
element.scrollBy(0, 1);
- let scrollTopAfter = element.scrollTop;
- element.scrollBy(0, -1)
- return scrollTopBefore + 1 === scrollTopAfter
-}
+ const scrollTopAfter = element.scrollTop;
+ element.scrollBy(0, -1);
+ return scrollTopBefore + 1 === scrollTopAfter;
+};
// Check if the element's overflow and visibility permit scrolling.
// Credit: https://github.com/philc/vimium/blob/bdf654aebe6f570f427c5f7bc9592cad86e642b5/content_scripts/scroller.js#L74
const isScrollableStyle = (element: Element): boolean => {
- const { overflowX, overflowY, overflow, visibility } = window.getComputedStyle(element);
+ const {
+ overflowX,
+ overflowY,
+ overflow,
+ visibility,
+ } = window.getComputedStyle(element);
if ([overflow, overflowX, overflowY].includes("hidden")) {
return false;
}