From 1d3e17241abdf5ec166f3a05c7600ff92a5434f2 Mon Sep 17 00:00:00 2001 From: Holly Date: Thu, 2 May 2024 16:50:05 +0100 Subject: [PATCH] fix margins offsetting container + html cursor css override --- client/Terminal-00-Multiuser.user.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/client/Terminal-00-Multiuser.user.js b/client/Terminal-00-Multiuser.user.js index e4e66ba..0b880ac 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.2 +// @version 20240502.3 // @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.2"; + const USERSCRIPT_VERSION_RAW = "20240502.3"; const USERSCRIPT_VERSION = parseInt(USERSCRIPT_VERSION_RAW.replace(".", "")); if (!continueRunningScript) { @@ -57,8 +57,13 @@ if (!window.TE_ACTIVE) { GroupData: 7 }; + let cursorImageI = window.getComputedStyle(document.body).cursor; const styles = document.createElement("style"); styles.innerHTML = ` +html { + cursor: ${cursorImageI}; +} + #otherCursors { position: absolute; top:0px; @@ -199,14 +204,17 @@ kbd { } `.split("\n").join("").split("\r").join("").split("\t").join(""); + document.head.appendChild(styles); if (!localStorage["mpconnectonload"]) { localStorage["mpconnectonload"] = true; } + const bodyMargin = parseInt(window.getComputedStyle(document.body).marginTop.replace("px", "")); + const otherCursors = document.createElement("div"); - otherCursors.style.top = `-${window.scrollY + document.body.getBoundingClientRect().top}px`; + otherCursors.style.top = `-${((window.scrollY + document.body.getBoundingClientRect().top) - bodyMargin)}px`; otherCursors.id = "otherCursors"; document.body.appendChild(otherCursors); @@ -257,9 +265,9 @@ kbd { setInterval(() => { if (document.body.scrollHeight > window.innerHeight) { - otherCursors.style = `width:${clientWidth = document.body.getBoundingClientRect().width}px;height:${document.body.scrollHeight}px;top:-${window.scrollY + document.body.getBoundingClientRect().top}px`; + otherCursors.style = `width:${clientWidth = document.body.getBoundingClientRect().width}px;height:${document.body.scrollHeight}px;top:-${((window.scrollY + document.body.getBoundingClientRect().top) - bodyMargin)}px`; } else { - otherCursors.style = `width:${clientWidth = document.body.getBoundingClientRect().width}px;height:${window.innerHeight}px;top:-${window.scrollY + document.body.getBoundingClientRect().top}px`; + otherCursors.style = `width:${clientWidth = document.body.getBoundingClientRect().width}px;height:${window.innerHeight}px;top:-${((window.scrollY + document.body.getBoundingClientRect().top) - bodyMargin)}px`; } }, 1000);