Update eaglermobile.user.js

This commit is contained in:
Colbster937 2024-05-27 09:46:54 -05:00 committed by GitHub
parent 400e7452a4
commit 0a58a80228
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,6 +13,15 @@
// ==/UserScript== // ==/UserScript==
function isMobile() {
try {
document.createEvent("TouchEvent");
return true;
} catch (e) {
return false;
}
}
if(!isMobile()){alert("WARNING: This script doesn't play well with non-mobile browsers. Proceed at your own risk!")};
// Hides inventory button // Hides inventory button
window.inInventory = false; window.inInventory = false;
// Used for changing touchmove events to mousemove events // Used for changing touchmove events to mousemove events
@ -210,7 +219,10 @@ function insertCanvasElements() {
} }
e.movementX = touch.pageX - previousX; e.movementX = touch.pageX - previousX;
e.movementY = touch.pageY - previousY; e.movementY = touch.pageY - previousY;
var evt = window.fakelock ? new MouseEvent("mousemove", {movementX: e.movementX, movementY: e.movementY}) : new WheelEvent("wheel", {"wheelDeltaY": e.movementY}); var evt = new MouseEvent("mousemove", {
movementX: e.movementX,
movementY: e.movementY
});
canvas.dispatchEvent(evt); canvas.dispatchEvent(evt);
previousX = touch.pageX; previousX = touch.pageX;
previousY = touch.pageY; previousY = touch.pageY;
@ -298,6 +310,18 @@ function insertCanvasElements() {
exitButton.addEventListener("touchend", function(e){keyEvent("À", "keyup")}, false); exitButton.addEventListener("touchend", function(e){keyEvent("À", "keyup")}, false);
exitButton.addEventListener("touchmove", function(e){e.preventDefault()}, false); exitButton.addEventListener("touchmove", function(e){e.preventDefault()}, false);
document.body.appendChild(exitButton); document.body.appendChild(exitButton);
var hiddenInput = document.createElement('input');
hiddenInput.id = "hiddenInput"
hiddenInput.style.cssText = "opacity:0;z-index:-99999";
document.body.appendChild(hiddenInput);
var keyboardButton = document.createElement('button');
keyboardButton.id = "keyboardButton"
keyboardButton.textContent = "⌨️";
keyboardButton.style.cssText = "left:10vh;top:0vh;"
keyboardButton.addEventListener("touchstart", function(e){e.preventDefault();hiddenInput.blur()}, false);
keyboardButton.addEventListener("touchend", function(e){hiddenInput.select()}, false);
keyboardButton.addEventListener("touchmove", function(e){e.preventDefault()}, false);
document.body.appendChild(keyboardButton);
var placeButton = document.createElement('button'); var placeButton = document.createElement('button');
placeButton.id = "hideButton" placeButton.id = "hideButton"
placeButton.textContent = "⊹"; placeButton.textContent = "⊹";