From aff380669445594e7566a835d4b27f11da26ea6a Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Tue, 4 Sep 2018 11:52:58 +0100 Subject: Add special-case rule for GMail. This selects the body of a message, if such is displayed. --- content_scripts/scroller.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/scroller.coffee b/content_scripts/scroller.coffee index 94a0d4f1..cb56b4bf 100644 --- a/content_scripts/scroller.coffee +++ b/content_scripts/scroller.coffee @@ -89,8 +89,9 @@ isScrollableElement = (element, direction = "y", amount = 1, factor = 1) -> # From element and its parents, find the first which we should scroll and which does scroll. findScrollableElement = (element, direction, amount, factor) -> - while element != getScrollingElement() and not isScrollableElement element, direction, amount, factor + while not isScrollableElement element, direction, amount, factor element = DomUtils.getContainingElement(element) ? getScrollingElement() + return element if element == getScrollingElement() # Prevent infinite loop. element # On some pages, the scrolling element is not actually scrollable. Here, we search the document for the @@ -102,7 +103,7 @@ firstScrollableElement = (element = null) -> if doesScroll(scrollingElement, "y", 1, 1) or doesScroll(scrollingElement, "y", -1, 1) return scrollingElement else - element = document.body ? getScrollingElement() + element = getScrollingElement() ? document.body if doesScroll(element, "y", 1, 1) or doesScroll(element, "y", -1, 1) element @@ -322,6 +323,7 @@ specialScrollingElementMap = 'twitter.com': 'div.permalink-container div.permalink[role=main]' 'reddit.com': '#overlayScrollContainer' 'new.reddit.com': '#overlayScrollContainer' + 'mail.google.com': 'table[role="presentation"]' root = exports ? (window.root ?= {}) root.Scroller = Scroller -- cgit v1.2.3