()
| 249 | } |
| 250 | |
| 251 | async function scrollToLoadImages() { |
| 252 | const article = document.querySelector("#js_content") |
| 253 | if (!article) return |
| 254 | |
| 255 | // 平滑滚动到底部 |
| 256 | return new Promise<void>((resolve) => { |
| 257 | const scrollHeight = document.documentElement.scrollHeight |
| 258 | const clientHeight = document.documentElement.clientHeight |
| 259 | const scrollStep = 300 // 每次滚动的距离 |
| 260 | let currentScroll = 0 |
| 261 | |
| 262 | const scrollInterval = setInterval(() => { |
| 263 | currentScroll += scrollStep |
| 264 | window.scrollTo(0, currentScroll) |
| 265 | |
| 266 | if (currentScroll >= scrollHeight - clientHeight) { |
| 267 | clearInterval(scrollInterval) |
| 268 | // 等待图片加载 |
| 269 | setTimeout(() => { |
| 270 | window.scrollTo(0, 0) // 滚回顶部 |
| 271 | resolve() |
| 272 | }, 500) |
| 273 | } |
| 274 | }, 100) |
| 275 | }) |
| 276 | } |
| 277 | |
| 278 | async function downloadMarkdown() { |
| 279 | await scrollToLoadImages() |
no outgoing calls
no test coverage detected