screenshot.js 689 B

1234567891011121314151617181920
  1. /* Find and scrollable full-screen elements and return their actual size
  2. */
  3. (function () {
  4. /* limit the number of elements queried */
  5. let elem = document.querySelectorAll ('body > div');
  6. let ret = [];
  7. for (let i = 0; i < elem.length; i++) {
  8. let e = elem[i];
  9. let s = window.getComputedStyle (e);
  10. if (s.getPropertyValue ('position') == 'fixed' &&
  11. s.getPropertyValue ('overflow') == 'auto' &&
  12. s.getPropertyValue ('left') == '0px' &&
  13. s.getPropertyValue ('right') == '0px' &&
  14. s.getPropertyValue ('top') == '0px' &&
  15. s.getPropertyValue ('bottom') == '0px') {
  16. ret.push (e.scrollHeight);
  17. }
  18. }
  19. return ret; /* immediately return results, for use with Runtime.evaluate() */
  20. })();