()
| 78 | const seen = new WeakSet<Element>(); |
| 79 | let scan = 0; |
| 80 | const watchPosts = () => { |
| 81 | scan = 0; |
| 82 | document |
| 83 | .querySelectorAll<HTMLAnchorElement>('main a[href^="/posts/"]') |
| 84 | .forEach((anchor) => { |
| 85 | if (!seen.has(anchor)) { |
| 86 | seen.add(anchor); |
| 87 | near.observe(anchor); |
| 88 | } |
| 89 | }); |
| 90 | }; |
| 91 | const added = new MutationObserver(() => { |
| 92 | if (!scan) { |
| 93 | scan = requestAnimationFrame(watchPosts); |