diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2019-06-26 11:01:04 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2019-06-26 11:01:04 +0200 |
commit | 926b5ac98449764599ff80d99546f8d1f1c438fe (patch) | |
tree | 607f6ff0e38b7b6dc1a7631efd76f809532a64f3 /crocoite/data | |
parent | 2e3385203f89a2eda1798f9bc8e3ad573aec372c (diff) | |
download | crocoite-926b5ac98449764599ff80d99546f8d1f1c438fe.tar.gz crocoite-926b5ac98449764599ff80d99546f8d1f1c438fe.tar.bz2 crocoite-926b5ac98449764599ff80d99546f8d1f1c438fe.zip |
behavior: screenshot: Extend viewport for fixed elements
Fixes #14, but needs a test case.
Diffstat (limited to 'crocoite/data')
-rw-r--r-- | crocoite/data/screenshot.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/crocoite/data/screenshot.js b/crocoite/data/screenshot.js new file mode 100644 index 0000000..a9a41e1 --- /dev/null +++ b/crocoite/data/screenshot.js @@ -0,0 +1,20 @@ +/* Find and scrollable full-screen elements and return their actual size + */ +(function () { +/* limit the number of elements queried */ +let elem = document.querySelectorAll ('body > div'); +let ret = []; +for (let i = 0; i < elem.length; i++) { + let e = elem[i]; + let s = window.getComputedStyle (e); + if (s.getPropertyValue ('position') == 'fixed' && + s.getPropertyValue ('overflow') == 'auto' && + s.getPropertyValue ('left') == '0px' && + s.getPropertyValue ('right') == '0px' && + s.getPropertyValue ('top') == '0px' && + s.getPropertyValue ('bottom') == '0px') { + ret.push (e.scrollHeight); + } +} +return ret; /* immediately return results, for use with Runtime.evaluate() */ +})(); |