|
@@ -22,6 +22,9 @@
|
|
|
|
|
|
|
|
(() => {
|
|
(() => {
|
|
|
|
|
|
|
|
|
|
+ const SCROLL_LENGTH = 100;
|
|
|
|
|
+ const SCROLL_DELAY = 50;
|
|
|
|
|
+
|
|
|
window._singleFile_getBoundingClientRect = Element.prototype.getBoundingClientRect;
|
|
window._singleFile_getBoundingClientRect = Element.prototype.getBoundingClientRect;
|
|
|
Element.prototype.getBoundingClientRect = function () {
|
|
Element.prototype.getBoundingClientRect = function () {
|
|
|
const boundingRect = window._singleFile_getBoundingClientRect.call(this);
|
|
const boundingRect = window._singleFile_getBoundingClientRect.call(this);
|
|
@@ -35,13 +38,13 @@
|
|
|
};
|
|
};
|
|
|
scrollBy(0, 1);
|
|
scrollBy(0, 1);
|
|
|
requestAnimationFrame(() => scrollBy(0, -1));
|
|
requestAnimationFrame(() => scrollBy(0, -1));
|
|
|
- scroll(0, document.documentElement.offsetHeight);
|
|
|
|
|
|
|
+ scroll(SCROLL_LENGTH, document.documentElement.offsetHeight);
|
|
|
|
|
|
|
|
function scroll(offsetY, maxOffsetY) {
|
|
function scroll(offsetY, maxOffsetY) {
|
|
|
document.documentElement.__defineGetter__("scrollTop", () => offsetY);
|
|
document.documentElement.__defineGetter__("scrollTop", () => offsetY);
|
|
|
dispatchEvent(new UIEvent("scroll"));
|
|
dispatchEvent(new UIEvent("scroll"));
|
|
|
if (offsetY < maxOffsetY) {
|
|
if (offsetY < maxOffsetY) {
|
|
|
- window._singleFile_timeoutScroll = setTimeout(() => scroll(offsetY + 100, maxOffsetY), 50);
|
|
|
|
|
|
|
+ window._singleFile_timeoutScroll = setTimeout(() => scroll(offsetY + SCROLL_LENGTH, maxOffsetY), SCROLL_DELAY);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|