This commit is contained in:
FlamedDogo 2024-10-02 00:20:27 +08:00 committed by GitHub
commit 26e1fb25b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,15 +6,22 @@
// @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.5b // @version 3.0.6
// @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
// @grant none // @grant none
// ==/UserScript== // ==/UserScript==
// Removed brainless unsafeWindow console.log("Eagler Mobile v3.0.6");
console.log("Eagler Mobile v3.0.5b") // Check for object defined by most userscript applications, and run the script in the page context if so
// TODO: remove the mobile check is implement the dynamic enabling and disabling of individual features
if (typeof GM_info !== "undefined") {
location.href = "javascript:(" + encodeURI(main) + ")();";
} else {
main();
}
// TODO: remove the mobile check and implement the dynamic enabling and disabling of individual features
function main() {
function isMobile() { function isMobile() {
try { try {
document.createEvent("TouchEvent"); document.createEvent("TouchEvent");
@ -474,6 +481,9 @@ function insertCanvasElements() {
hiddenInput.id = "hiddenInput" hiddenInput.id = "hiddenInput"
hiddenInput.classList.add("inMenu") hiddenInput.classList.add("inMenu")
hiddenInput.style.cssText = "position:absolute;top: 0vh; margin: auto; left: 8vh; right:0vh; width: 8vh; height: 8vh;font-size:20px;z-index: -10;color: transparent;text-shadow: 0 0 0 black;"; // We hide the input behind a key because display: none and opacity:0 causes issues hiddenInput.style.cssText = "position:absolute;top: 0vh; margin: auto; left: 8vh; right:0vh; width: 8vh; height: 8vh;font-size:20px;z-index: -10;color: transparent;text-shadow: 0 0 0 black;"; // We hide the input behind a key because display: none and opacity:0 causes issues
hiddenInput.setAttribute("autocorrect", "off");
hiddenInput.setAttribute("autocapitalize", "off");
hiddenInput.setAttribute("tabindex", "-1");
hiddenInput.addEventListener("beforeinput", function(e) { // For some reason beforeinput doesn't have the same deletion problems that input has on Android hiddenInput.addEventListener("beforeinput", function(e) { // For some reason beforeinput doesn't have the same deletion problems that input has on Android
e.stopImmediatePropagation(); // Android ignores this and the prevent default, so this will probably be removed in the future e.stopImmediatePropagation(); // Android ignores this and the prevent default, so this will probably be removed in the future
e.preventDefault(true); // We pass a value because we've hijacked the prevent default function to have a "should bypass" boolean value e.preventDefault(true); // We pass a value because we've hijacked the prevent default function to have a "should bypass" boolean value
@ -860,3 +870,4 @@ customStyle.textContent = `
} }
`; `;
document.documentElement.appendChild(customStyle); document.documentElement.appendChild(customStyle);
}