Skip to content

Commit aff3806

Browse files
Add special-case rule for GMail.
This selects the body of a message, if such is displayed.
1 parent f86e611 commit aff3806

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: content_scripts/scroller.coffee

+4-2
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ isScrollableElement = (element, direction = "y", amount = 1, factor = 1) ->
8989

9090
# From element and its parents, find the first which we should scroll and which does scroll.
9191
findScrollableElement = (element, direction, amount, factor) ->
92-
while element != getScrollingElement() and not isScrollableElement element, direction, amount, factor
92+
while not isScrollableElement element, direction, amount, factor
9393
element = DomUtils.getContainingElement(element) ? getScrollingElement()
94+
return element if element == getScrollingElement() # Prevent infinite loop.
9495
element
9596

9697
# On some pages, the scrolling element is not actually scrollable. Here, we search the document for the
@@ -102,7 +103,7 @@ firstScrollableElement = (element = null) ->
102103
if doesScroll(scrollingElement, "y", 1, 1) or doesScroll(scrollingElement, "y", -1, 1)
103104
return scrollingElement
104105
else
105-
element = document.body ? getScrollingElement()
106+
element = getScrollingElement() ? document.body
106107

107108
if doesScroll(element, "y", 1, 1) or doesScroll(element, "y", -1, 1)
108109
element
@@ -322,6 +323,7 @@ specialScrollingElementMap =
322323
'twitter.com': 'div.permalink-container div.permalink[role=main]'
323324
'reddit.com': '#overlayScrollContainer'
324325
'new.reddit.com': '#overlayScrollContainer'
326+
'mail.google.com': 'table[role="presentation"]'
325327

326328
root = exports ? (window.root ?= {})
327329
root.Scroller = Scroller

0 commit comments

Comments
 (0)