()
| 9476 | } |
| 9477 | |
| 9478 | function startAutoScroll() { |
| 9479 | clearInterval(autoScrollInterval); |
| 9480 | if (autoScroll <= 0) return; |
| 9481 | let scrollRange_o = 1; |
| 9482 | if (autoScroll > 1000) { |
| 9483 | scrollRange_o = parseInt(autoScroll / 1000); |
| 9484 | } |
| 9485 | let devicePixelRatio = window.devicePixelRatio; |
| 9486 | let scrollRange = Math.ceil(scrollRange_o / devicePixelRatio); |
| 9487 | |
| 9488 | let scrollTarget, body = getBody(document); |
| 9489 | let checkOverflow = ele => { |
| 9490 | return ele.scrollHeight !== ele.clientHeight && getComputedStyle(ele).overflowY !== "hidden"; |
| 9491 | }; |
| 9492 | if (document.documentElement.scrollTop || checkOverflow(document.documentElement)) { |
| 9493 | scrollTarget = document.documentElement; |
| 9494 | } else if (body.scrollTop || checkOverflow(body)) { |
| 9495 | scrollTarget = body; |
| 9496 | } else { |
| 9497 | let tempEle; |
| 9498 | let img = body.querySelector('img'); |
| 9499 | if (img) { |
| 9500 | tempEle = img; |
| 9501 | while (tempEle && !checkOverflow(tempEle)) { |
| 9502 | tempEle = tempEle.parentNode; |
| 9503 | } |
| 9504 | } |
| 9505 | if (!tempEle && document.activeElement) { |
| 9506 | let tempEle = document.activeElement; |
| 9507 | while (tempEle && !checkOverflow(tempEle)) { |
| 9508 | tempEle = tempEle.parentNode; |
| 9509 | } |
| 9510 | } |
| 9511 | if (tempEle) scrollTarget = tempEle; |
| 9512 | } |
| 9513 | scrollTarget = scrollTarget || document.documentElement; |
| 9514 | |
| 9515 | autoScrollInterval = setInterval(() => { |
| 9516 | if (isPause && !urlChanging) return; |
| 9517 | if (devicePixelRatio !== window.devicePixelRatio) { |
| 9518 | devicePixelRatio = window.devicePixelRatio; |
| 9519 | scrollRange = Math.ceil(scrollRange_o / devicePixelRatio); |
| 9520 | } |
| 9521 | scrollTarget.scrollTop += scrollRange; |
| 9522 | }, parseInt(1000 / autoScroll)); |
| 9523 | } |
| 9524 | |
| 9525 | var inUpdate = false; |
| 9526 | var importHandler, configCon; |
no test coverage detected