fix cursor container sizing on large heavenonline pages

This commit is contained in:
Holly Stubbs 2024-10-30 15:13:43 +00:00
parent 5ecb6e7a5c
commit 2b65f26fb2

View file

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name MultiProbe // @name MultiProbe
// @namespace https://*.angusnicneven.com/* // @namespace https://*.angusnicneven.com/*
// @version 20241013.2 // @version 20241030.0
// @description Probe with friends! // @description Probe with friends!
// @author tgpholly // @author tgpholly
// @match https://*.angusnicneven.com/* // @match https://*.angusnicneven.com/*
@ -64,7 +64,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 = "20241013.2"; const USERSCRIPT_VERSION_RAW = "20241030.0";
const USERSCRIPT_VERSION = parseInt(USERSCRIPT_VERSION_RAW.replace(".", "")); const USERSCRIPT_VERSION = parseInt(USERSCRIPT_VERSION_RAW.replace(".", ""));
if (!continueRunningScript) { if (!continueRunningScript) {
@ -529,16 +529,21 @@ mp_button {
} }
let clientWidth = document.documentElement.getBoundingClientRect().width; let clientWidth = document.documentElement.getBoundingClientRect().width;
let bodyBoundingRect = document.documentElement.getBoundingClientRect(); let htmlBoundingRect = document.documentElement.getBoundingClientRect();
let bodyBoundingRect = document.body.getBoundingClientRect();
setInterval(() => { const resizeCursorContainer = () => {
bodyBoundingRect = document.documentElement.getBoundingClientRect(); htmlBoundingRect = document.documentElement.getBoundingClientRect();
bodyBoundingRect = document.body.getBoundingClientRect();
if (document.documentElement.scrollHeight > window.innerHeight) { if (document.documentElement.scrollHeight > window.innerHeight) {
otherCursors.style = `width:${clientWidth = bodyBoundingRect.width}px;height:${document.documentElement.scrollHeight}px;cursor: ${cssCursor};`; otherCursors.style = `width:${clientWidth = bodyBoundingRect.width > htmlBoundingRect.width ? bodyBoundingRect.width : htmlBoundingRect.width}px;height:${document.documentElement.scrollHeight}px;cursor: ${cssCursor};`;
} else { } else {
otherCursors.style = `width:${clientWidth = bodyBoundingRect.width}px;height:${window.innerHeight}px;cursor: ${cssCursor};`; otherCursors.style = `width:${clientWidth = bodyBoundingRect.width > htmlBoundingRect.width ? bodyBoundingRect.width : htmlBoundingRect.width}px;height:${window.innerHeight}px;cursor: ${cssCursor};`;
} }
}, 1000); }
setInterval(resizeCursorContainer, 1000);
document.addEventListener("resize", resizeCursorContainer);
const debugMessageContainer = document.createElement("mp_container"); const debugMessageContainer = document.createElement("mp_container");
debugMessageContainer.style = "position:fixed;top:0;left:0;padding:8px;margin:4px;pointer-events:none;text-shadow: 0px 0px 4px black;z-index:999999999999;background-color:rgba(0,0,0,0.5);outline:1px solid white;backdrop-filter:blur(6px)"; debugMessageContainer.style = "position:fixed;top:0;left:0;padding:8px;margin:4px;pointer-events:none;text-shadow: 0px 0px 4px black;z-index:999999999999;background-color:rgba(0,0,0,0.5);outline:1px solid white;backdrop-filter:blur(6px)";