Fix height of report window with JS disabled and archive report link added.

This commit is contained in:
ccd0 2015-05-04 20:28:31 -07:00
parent cf07089d00
commit 24a7311a7a

View File

@ -12,17 +12,17 @@ Report =
ready: -> ready: ->
$.addStyle Report.css $.addStyle Report.css
Report.archive() if Conf['Archive Report']
if $.hasClass doc, 'js-enabled' if $.hasClass doc, 'js-enabled'
new MutationObserver(-> Report.fit '.gc-bubbleDefault').observe d.body, new MutationObserver(-> Report.fit '.gc-bubbleDefault').observe d.body,
childList: true childList: true
attributes: true attributes: true
subtree: true subtree: true
else else
Report.fit '.rules' Report.fit 'body'
Report.archive() if Conf['Archive Report']
fit: (selector) -> fit: (selector) ->
return unless el = $ selector return unless el = $ selector, doc
dy = el.getBoundingClientRect().bottom - doc.clientHeight + 8 dy = el.getBoundingClientRect().bottom - doc.clientHeight + 8
window.resizeBy 0, dy if dy > 0 window.resizeBy 0, dy if dy > 0