diff options
author | Shin'ya UEOKA <ueokande@i-beam.org> | 2020-12-27 23:35:28 +0000 |
---|---|---|
committer | Shin'ya UEOKA <ueokande@i-beam.org> | 2020-12-27 23:35:28 +0000 |
commit | 72e61caa25cb85cbca1145725d820516b11cdffa (patch) | |
tree | 3ed2d3b7afa9bb798fccbda2af163c1e154a96b9 /src | |
parent | 1456574b92272da36cacbc2eadf7a4a6cdc815ca (diff) |
npm run lint:fix
Diffstat (limited to 'src')
-rw-r--r-- | src/content/presenters/ScrollPresenter.ts | 17 |
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; } |