From 51df305f5a9750810e93b38a80c60831229b8275 Mon Sep 17 00:00:00 2001 From: Holly Date: Thu, 2 May 2024 16:33:50 +0100 Subject: [PATCH] fixes for 001b hub --- client/Terminal-00-Multiuser.user.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/client/Terminal-00-Multiuser.user.js b/client/Terminal-00-Multiuser.user.js index 2b24ee1..e4e66ba 100644 --- a/client/Terminal-00-Multiuser.user.js +++ b/client/Terminal-00-Multiuser.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name MultiProbe // @namespace https://*.angusnicneven.com/* -// @version 20240502.1 +// @version 20240502.2 // @description Probe with friends! // @author tgpholly // @match https://*.angusnicneven.com/* @@ -36,7 +36,7 @@ if (!window.TE_ACTIVE) { 'use strict'; // Make sure to change the userscript version too!!!!!!!!!! - const USERSCRIPT_VERSION_RAW = "20240502.1"; + const USERSCRIPT_VERSION_RAW = "20240502.2"; const USERSCRIPT_VERSION = parseInt(USERSCRIPT_VERSION_RAW.replace(".", "")); if (!continueRunningScript) { @@ -204,8 +204,9 @@ kbd { if (!localStorage["mpconnectonload"]) { localStorage["mpconnectonload"] = true; } - + const otherCursors = document.createElement("div"); + otherCursors.style.top = `-${window.scrollY + document.body.getBoundingClientRect().top}px`; otherCursors.id = "otherCursors"; document.body.appendChild(otherCursors); @@ -256,9 +257,9 @@ kbd { setInterval(() => { if (document.body.scrollHeight > window.innerHeight) { - otherCursors.style = `width:${clientWidth = document.body.getBoundingClientRect().width}px;height:${document.body.scrollHeight}px`; + otherCursors.style = `width:${clientWidth = document.body.getBoundingClientRect().width}px;height:${document.body.scrollHeight}px;top:-${window.scrollY + document.body.getBoundingClientRect().top}px`; } else { - otherCursors.style = `width:${clientWidth = document.body.getBoundingClientRect().width}px;height:${window.innerHeight}px`; + otherCursors.style = `width:${clientWidth = document.body.getBoundingClientRect().width}px;height:${window.innerHeight}px;top:-${window.scrollY + document.body.getBoundingClientRect().top}px`; } }, 1000); @@ -374,8 +375,8 @@ kbd { let rawMouseY = 0; window.onmousemove = (e) => { - currentMouseX = (rawMouseX = e.clientX) + document.body.scrollLeft; - currentMouseY = (rawMouseY = e.clientY) + document.body.scrollTop; + currentMouseX = (rawMouseX = e.clientX) + window.scrollX; + currentMouseY = (rawMouseY = e.clientY) + window.scrollY; if (selfCursor) { selfCursor.rawSetPosInit(currentMouseX / clientWidth, currentMouseY); selfCursor.updateCursor(); @@ -383,8 +384,8 @@ kbd { } window.onscroll = () => { - currentMouseX = rawMouseX + document.body.scrollLeft; - currentMouseY = rawMouseY + document.body.scrollTop; + currentMouseX = rawMouseX + window.scrollX; + currentMouseY = rawMouseY + window.scrollY; if (selfCursor) { selfCursor.rawSetPosInit(currentMouseX / clientWidth, currentMouseY); selfCursor.updateCursor(); @@ -397,7 +398,7 @@ kbd { if (ws && ready) { if (allowedPings > 0) { allowedPings--; - ws.send(createWriter(Endian.LE, 9).writeByte(MessageType.Ping).writeFloat((rawMouseX + document.body.scrollLeft - 32) / clientWidth).writeInt(rawMouseY + document.body.scrollTop - 32).toBuffer()); + ws.send(createWriter(Endian.LE, 9).writeByte(MessageType.Ping).writeFloat((rawMouseX + window.scrollX - 32) / clientWidth).writeInt(rawMouseY + window.scrollY - 32).toBuffer()); } } } else if (e.key === "n") {