fix margins offsetting container + html cursor css override
This commit is contained in:
parent
51df305f5a
commit
1d3e17241a
1 changed files with 13 additions and 5 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue