diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-03-29 19:53:34 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-03-29 19:53:34 -0300 |
commit | f4f1c80ed54738ef06007df30b2c45d922870b90 (patch) | |
tree | 3cc8f6020c7221d991ea3806d45d2102ab946a79 | |
parent | a4b5be9407b326487e39eea4cbcde8dd45f07a35 (diff) |
client: always watch mouse position
This will definitely not have any consequences.
-rw-r--r-- | src/static/client3.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/static/client3.js b/src/static/client3.js index 485ae3c3..764bdaa8 100644 --- a/src/static/client3.js +++ b/src/static/client3.js @@ -689,6 +689,29 @@ function mutateCSSCompatibilityContent() { clientSteps.getPageReferences.push(getCSSCompatibilityAssistantInfoReferences); clientSteps.mutatePageContent.push(mutateCSSCompatibilityContent); +// Ever-updating mouse position helper -------------------- + +const liveMousePositionInfo = initInfo('liveMousePositionInfo', { + state: { + clientX: null, + clientY: null, + }, +}); + +function addLiveMousePositionPageListeners() { + const info = liveMousePositionInfo; + const {state} = info; + + document.body.addEventListener('mousemove', domEvent => { + Object.assign(state, { + clientX: domEvent.clientX, + clientY: domEvent.clientY, + }); + }); +} + +clientSteps.addPageListeners.push(addLiveMousePositionPageListeners); + // JS-based links ----------------------------------------- const scriptedLinkInfo = initInfo('scriptedLinkInfo', { |