Skip to content

Commit 939b89a

Browse files
committed
Update pagetual.user.js
1 parent ac6e9c9 commit 939b89a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Pagetual/pagetual.user.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4428,7 +4428,7 @@
44284428
}
44294429
appendCall(fragment);
44304430
if (elements.length) {
4431-
requestAnimationFrame(addBatch);
4431+
setTimeout(addBatch, 0);
44324432
} else resolve();
44334433
}
44344434
addBatch();
@@ -4440,12 +4440,13 @@
44404440
}
44414441

44424442
setPageTop(top) {
4443-
if (getBody(document).scrollTop) {
4444-
if (getBody(document).scrollTop != top) {
4443+
let bodyScroll = getBody(document).scrollTop;
4444+
if (bodyScroll) {
4445+
if (Math.abs(bodyScroll - top) > 50) {
44454446
getBody(document).scrollTop = top;
44464447
}
44474448
} else {
4448-
if (document.documentElement.scrollTop != top) {
4449+
if (Math.abs(document.documentElement.scrollTop - top) > 50) {
44494450
document.documentElement.scrollTop = top;
44504451
}
44514452
}
@@ -4484,7 +4485,6 @@
44844485
window.scrollTo({ top: targetY, behavior: 'instant'});
44854486
targetY = -1;
44864487
}
4487-
let lastScrollTop = getBody(document).scrollTop || document.documentElement.scrollTop;
44884488
this.getInsert();
44894489
await this.pageInit(doc, eles);
44904490
var self = this, newEles = [];
@@ -4560,7 +4560,6 @@
45604560
await self.insertElement(collection);
45614561
}
45624562
}
4563-
this.setPageTop(lastScrollTop);
45644563
this.pageAction(doc, newEles);
45654564
let enableHistory = this.curSiteRule.history;
45664565
let enableHistoryAfterInsert = false;

0 commit comments

Comments
 (0)