Hack for unsafeWindow

This commit is contained in:
FlamedDogo99 2024-06-09 20:00:32 -06:00
parent d1e5364bac
commit 3a21f56e26

View File

@ -6,12 +6,19 @@
// @downloadURL https://raw.githubusercontent.com/FlamedDogo99/EaglerMobile/main/eaglermobile.user.js // @downloadURL https://raw.githubusercontent.com/FlamedDogo99/EaglerMobile/main/eaglermobile.user.js
// @license Apache License 2.0 - http://www.apache.org/licenses/ // @license Apache License 2.0 - http://www.apache.org/licenses/
// @match https://eaglercraft.com/mc/* // @match https://eaglercraft.com/mc/*
// @version 3.0.3-alpha-3 // @version 3.0.3-alpha-4
// @updateURL https://raw.githubusercontent.com/FlamedDogo99/EaglerMobile/main/eaglermobile.user.js // @updateURL https://raw.githubusercontent.com/FlamedDogo99/EaglerMobile/main/eaglermobile.user.js
// @run-at document-start // @run-at document-start
// ==/UserScript== // ==/UserScript==
// THIS IS LAZY AND CAN EXPOSE INTERNALS
// IN THE FUTURE, JUST INJECT A SCRIPT TAG
try {
window = unsafeWindow ?? window
} catch {
}
function isMobile() { function isMobile() {
try { try {
document.createEvent("TouchEvent"); document.createEvent("TouchEvent");
@ -41,9 +48,9 @@ function logManager() {
self.logger = document.getElementById('log'); self.logger = document.getElementById('log');
console.log = function (message, options) { console.log = function (message, options) {
if (typeof message == 'object') { if (typeof message == 'object') {
self.logger.innerText = (JSON && JSON.stringify ? JSON.stringify(message) : message) + '<br />' + self.logger.innerHTML; self.logger.innerHTML = (JSON && JSON.stringify ? JSON.stringify(message) : message) + '<br />' + self.logger.innerHTML;
} else { } else {
self.logger.innerText = message + " " + self.logger.innerText; self.logger.innerHTML = message + '<br />' + self.logger.innerHTML;
} }
} }
} }
@ -524,7 +531,7 @@ function insertCanvasElements() {
}, false); }, false);
document.body.appendChild(coordinatesButton); document.body.appendChild(coordinatesButton);
//TEMP REMOVE //TEMP REMOVE
var temp = document.createElement("p"); var temp = document.createElement("div");
temp.id = "log"; temp.id = "log";
temp.classList.add("log"); temp.classList.add("log");
temp.style.cssText= "position: absolute; top: 8vh; margin: auto; left: 0vh; right: 0vh; height: auto; z-index:10; min-height:8vh; background:white"; temp.style.cssText= "position: absolute; top: 8vh; margin: auto; left: 0vh; right: 0vh; height: auto; z-index:10; min-height:8vh; background:white";