From 72e61caa25cb85cbca1145725d820516b11cdffa Mon Sep 17 00:00:00 2001 From: Shin'ya UEOKA Date: Sun, 27 Dec 2020 23:35:28 +0000 Subject: npm run lint:fix --- src/content/presenters/ScrollPresenter.ts | 17 +++++++++++------ 1 file 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; } -- cgit v1.2.3