()
| 294 | } |
| 295 | |
| 296 | function initHoverEvent() { |
| 297 | document.documentElement.addEventListener('mouseover', (evt) => { |
| 298 | const target = evt.target as HTMLElement |
| 299 | const link = target.closest('a[href]') as HTMLAnchorElement |
| 300 | if (!link) return |
| 301 | if (hoveredUrls.has(link.href)) return // Otherwise this is a flood of events |
| 302 | const sameSite = link.origin === location.origin |
| 303 | hoveredUrls.add(link.href) |
| 304 | sendEvent({ |
| 305 | type: EventType.hover, |
| 306 | hover_url: link.href, |
| 307 | hover_samesite: sameSite, |
| 308 | }) |
| 309 | }) |
| 310 | } |
| 311 | |
| 312 | function initPrintEvent() { |
| 313 | window.addEventListener('beforeprint', () => { |
no test coverage detected