improve support for heavenonline
This commit is contained in:
parent
014ce4743c
commit
25c459e71c
1 changed files with 43 additions and 16 deletions
|
@ -77,25 +77,31 @@ console.log("[MP] MultiProbe init");
|
|||
BadgeUnlock: 9
|
||||
};
|
||||
|
||||
let cursorImageI = window.getComputedStyle(document.body).cursor;
|
||||
let cssCursor = `${cursorImageI === "auto" || !cursorImageI.includes("url") ? `url(${SITE_DEFAULT_CURSOR[window.location.href.split("//")[1].split("/")[0].split(":")[0]]}) 11 11, auto` : cursorImageI}`;
|
||||
if (cssCursor.includes("undefined")) {
|
||||
cssCursor = "auto";
|
||||
}
|
||||
let hoverChangeElement = document.querySelector("a");
|
||||
if (!hoverChangeElement) {
|
||||
hoverChangeElement = document.querySelector(".probedata");
|
||||
}
|
||||
let cursorHoverImageI = window.getComputedStyle(hoverChangeElement).cursor;
|
||||
let cssHoverCursor = `${cursorHoverImageI === "auto" || !cursorHoverImageI.includes("url") ? `url(${SITE_DEFAULT_HOVER_CURSOR[window.location.href.split("//")[1].split("/")[0].split(":")[0]]}) 11 11, auto` : cursorHoverImageI}`;
|
||||
if (cssHoverCursor.includes("undefined")) {
|
||||
cssHoverCursor = "auto";
|
||||
}
|
||||
let cssCursor = "";
|
||||
let cssHoverCursor = "";
|
||||
let pageLoadCompleted = true;
|
||||
|
||||
console.log("[MP] Injecting custom styles...");
|
||||
const styles = document.createElement("style");
|
||||
styles.innerHTML = `
|
||||
function updateStyles() {
|
||||
let cursorImageI = window.getComputedStyle(document.body).cursor;
|
||||
cssCursor = `${cursorImageI === "auto" || !cursorImageI.includes("url") ? `url(${SITE_DEFAULT_CURSOR[window.location.href.split("//")[1].split("/")[0].split(":")[0]]}) 11 11, auto` : cursorImageI}`;
|
||||
if (cssCursor.includes("undefined")) {
|
||||
cssCursor = "auto";
|
||||
}
|
||||
let hoverChangeElement = document.querySelector("a");
|
||||
if (!hoverChangeElement) {
|
||||
hoverChangeElement = document.querySelector(".probedata");
|
||||
}
|
||||
let cursorHoverImageI = window.getComputedStyle(hoverChangeElement).cursor;
|
||||
cssHoverCursor = `${cursorHoverImageI === "auto" || !cursorHoverImageI.includes("url") ? `url(${SITE_DEFAULT_HOVER_CURSOR[window.location.href.split("//")[1].split("/")[0].split(":")[0]]}) 11 11, auto` : cursorHoverImageI}`;
|
||||
if (cssHoverCursor.includes("undefined")) {
|
||||
cssHoverCursor = "auto";
|
||||
}
|
||||
|
||||
styles.innerHTML = `
|
||||
html {
|
||||
cursor: ${cssCursor};
|
||||
${pageLoadCompleted ? `cursor: ${cssCursor};` : ""}
|
||||
}
|
||||
|
||||
#otherCursors {
|
||||
|
@ -391,6 +397,27 @@ mp_button {
|
|||
opacity: 1;
|
||||
}
|
||||
`.split("\n").join("").split("\r").join("").split("\t").join("");
|
||||
}
|
||||
|
||||
// Cursed way of detecting heavenonline load
|
||||
if (window.location.href.split("://")[1].split("/")[0] === "heavenonline.xyz") {
|
||||
pageLoadCompleted = false;
|
||||
const oldConsoleLog = console.log;
|
||||
console.log = function(...args) {
|
||||
if (args.length >= 1) {
|
||||
if (args[0].trim() === `Page is ready at ${finished}.`) {
|
||||
console.log = oldConsoleLog;
|
||||
console.log("[MP] Reverted console.log override.");
|
||||
pageLoadCompleted = true;
|
||||
updateStyles();
|
||||
}
|
||||
}
|
||||
|
||||
oldConsoleLog(...args);
|
||||
}
|
||||
} else {
|
||||
updateStyles();
|
||||
}
|
||||
|
||||
document.head.appendChild(styles);
|
||||
|
||||
|
|
Loading…
Reference in a new issue