lazy-loader-before.js 906 B

12345678910111213141516
  1. /* global window, screen, dispatchEvent, Element, UIEvent */
  2. (() => {
  3. window._singleFile_getBoundingClientRect = Element.prototype.getBoundingClientRect;
  4. Element.prototype.getBoundingClientRect = function () {
  5. const boundingRect = window._singleFile_getBoundingClientRect.call(this);
  6. const top = (boundingRect.top > 0 && boundingRect.top < screen.height) ? boundingRect.top : 0;
  7. const left = (boundingRect.left > 0 && boundingRect.left < screen.width) ? boundingRect.left : 0;
  8. const bottom = (boundingRect.bottom > 0 && boundingRect.bottom < screen.height) ? boundingRect.bottom : screen.height;
  9. const right = (boundingRect.right > 0 && boundingRect.right < screen.width) ? boundingRect.bottom : screen.width;
  10. return { x: boundingRect.x, y: boundingRect.y, top, bottom, left, right, width: boundingRect.width, height: boundingRect.height };
  11. };
  12. dispatchEvent(new UIEvent("scroll"));
  13. })();