fix issues caused by the old container correction code
This commit is contained in:
parent
4fc8ee0cb9
commit
71d8824bb3
1 changed files with 12 additions and 18 deletions
|
@ -1,7 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name MultiProbe
|
// @name MultiProbe
|
||||||
// @namespace https://*.angusnicneven.com/*
|
// @namespace https://*.angusnicneven.com/*
|
||||||
// @version 20241008.3
|
// @version 20241009.0
|
||||||
// @description Probe with friends!
|
// @description Probe with friends!
|
||||||
// @author tgpholly
|
// @author tgpholly
|
||||||
// @match https://*.angusnicneven.com/*
|
// @match https://*.angusnicneven.com/*
|
||||||
|
@ -55,7 +55,7 @@ console.log("[MP] MultiProbe init");
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Make sure to change the userscript version too!!!!!!!!!!
|
// Make sure to change the userscript version too!!!!!!!!!!
|
||||||
const USERSCRIPT_VERSION_RAW = "20241008.3";
|
const USERSCRIPT_VERSION_RAW = "20241009.0";
|
||||||
const USERSCRIPT_VERSION = parseInt(USERSCRIPT_VERSION_RAW.replace(".", ""));
|
const USERSCRIPT_VERSION = parseInt(USERSCRIPT_VERSION_RAW.replace(".", ""));
|
||||||
|
|
||||||
if (!continueRunningScript) {
|
if (!continueRunningScript) {
|
||||||
|
@ -434,13 +434,7 @@ mp_button {
|
||||||
localStorage["mpconnectonload"] = true;
|
localStorage["mpconnectonload"] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
let marginComputedStyle = window.getComputedStyle(document.body);
|
|
||||||
const bodyMarginTop = parseInt(marginComputedStyle.marginTop.replace("px", ""));
|
|
||||||
const bodyMarginLeft = parseInt(marginComputedStyle.marginLeft.replace("px", ""));
|
|
||||||
const bodyMarginRight = parseInt(marginComputedStyle.marginRight.replace("px", ""));
|
|
||||||
|
|
||||||
const otherCursors = document.createElement("mp_cursors");
|
const otherCursors = document.createElement("mp_cursors");
|
||||||
otherCursors.style.top = `-${((window.scrollY + document.body.getBoundingClientRect().top) - bodyMarginTop)}px`;
|
|
||||||
otherCursors.id = "otherCursors";
|
otherCursors.id = "otherCursors";
|
||||||
document.documentElement.appendChild(otherCursors);
|
document.documentElement.appendChild(otherCursors);
|
||||||
|
|
||||||
|
@ -497,15 +491,15 @@ mp_button {
|
||||||
groupUsers.appendChild(user);
|
groupUsers.appendChild(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
let clientWidth = document.body.getBoundingClientRect().width;
|
let clientWidth = document.documentElement.getBoundingClientRect().width;
|
||||||
let bodyBoundingRect = document.body.getBoundingClientRect();
|
let bodyBoundingRect = document.documentElement.getBoundingClientRect();
|
||||||
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
bodyBoundingRect = document.body.getBoundingClientRect();
|
bodyBoundingRect = document.documentElement.getBoundingClientRect();
|
||||||
if (document.body.scrollHeight > window.innerHeight) {
|
if (document.documentElement.scrollHeight > window.innerHeight) {
|
||||||
otherCursors.style = `width:${clientWidth = (bodyBoundingRect.width + bodyMarginRight + bodyMarginLeft)}px;height:${document.body.scrollHeight}px;top:-${((window.scrollY + bodyBoundingRect.top) - bodyMarginTop)}px;cursor: ${cssCursor};`;
|
otherCursors.style = `width:${clientWidth = bodyBoundingRect.width}px;height:${document.documentElement.scrollHeight}px;cursor: ${cssCursor};`;
|
||||||
} else {
|
} else {
|
||||||
otherCursors.style = `width:${clientWidth = (bodyBoundingRect.width + bodyMarginRight + bodyMarginLeft)}px;height:${window.innerHeight}px;top:-${((window.scrollY + bodyBoundingRect.top) - bodyMarginTop)}px;cursor: ${cssCursor};`;
|
otherCursors.style = `width:${clientWidth = bodyBoundingRect.width}px;height:${window.innerHeight}px;cursor: ${cssCursor};`;
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
|
@ -678,7 +672,7 @@ mp_button {
|
||||||
|
|
||||||
window.onmousemove = (e) => {
|
window.onmousemove = (e) => {
|
||||||
currentMouseX = (rawMouseX = e.clientX) + window.scrollX;
|
currentMouseX = (rawMouseX = e.clientX) + window.scrollX;
|
||||||
currentMouseY = (rawMouseY = e.clientY) + window.scrollY + ((window.scrollY + bodyBoundingRect.top) - bodyMarginTop);
|
currentMouseY = (rawMouseY = e.clientY) + window.scrollY;
|
||||||
if (selfCursor) {
|
if (selfCursor) {
|
||||||
selfCursor.rawSetPosInit(currentMouseX / clientWidth, currentMouseY);
|
selfCursor.rawSetPosInit(currentMouseX / clientWidth, currentMouseY);
|
||||||
selfCursor.updateCursor();
|
selfCursor.updateCursor();
|
||||||
|
@ -686,9 +680,9 @@ mp_button {
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onscroll = () => {
|
window.onscroll = () => {
|
||||||
bodyBoundingRect = document.body.getBoundingClientRect();
|
bodyBoundingRect = document.documentElement.getBoundingClientRect();
|
||||||
currentMouseX = rawMouseX + window.scrollX;
|
currentMouseX = rawMouseX + window.scrollX;
|
||||||
currentMouseY = rawMouseY + window.scrollY + ((window.scrollY + bodyBoundingRect.top) - bodyMarginTop);
|
currentMouseY = rawMouseY + window.scrollY;
|
||||||
if (selfCursor) {
|
if (selfCursor) {
|
||||||
selfCursor.rawSetPosInit(currentMouseX / clientWidth, currentMouseY);
|
selfCursor.rawSetPosInit(currentMouseX / clientWidth, currentMouseY);
|
||||||
selfCursor.updateCursor();
|
selfCursor.updateCursor();
|
||||||
|
@ -706,7 +700,7 @@ mp_button {
|
||||||
if (ws && ready) {
|
if (ws && ready) {
|
||||||
if (allowedPings > 0) {
|
if (allowedPings > 0) {
|
||||||
allowedPings--;
|
allowedPings--;
|
||||||
ws.send(createWriter(Endian.LE, 9).writeUByte(MessageType.Ping).writeFloat((rawMouseX + window.scrollX - 32) / clientWidth).writeInt(rawMouseY + window.scrollY - 32 + ((window.scrollY + bodyBoundingRect.top) - bodyMarginTop)).toBuffer());
|
ws.send(createWriter(Endian.LE, 9).writeUByte(MessageType.Ping).writeFloat((rawMouseX + window.scrollX - 32) / clientWidth).writeInt(rawMouseY + window.scrollY - 32).toBuffer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (e.key === "n") {
|
} else if (e.key === "n") {
|
||||||
|
|
Loading…
Reference in a new issue