fixes for 001b hub

This commit is contained in:
Holly Stubbs 2024-05-02 16:33:50 +01:00
parent 418f52ab45
commit 51df305f5a
Signed by: tgpholly
GPG key ID: B8583C4B7D18119E

View file

@ -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) {
@ -206,6 +206,7 @@ kbd {
}
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") {