mirror of
https://github.com/FlamedDogo99/EaglerMobile.git
synced 2024-11-23 20:46:04 -08:00
Merge branch 'FlamedDogo99:main' into main
This commit is contained in:
commit
dd65423625
22
README.md
Normal file
22
README.md
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# Eagler Mobile
|
||||||
|
|
||||||
|
## A userscript that allows eaglercraft to run on iOS safari
|
||||||
|
To-do
|
||||||
|
- [ ] Strafe buttons when holding forward
|
||||||
|
- [ ] Crouch lock on hold
|
||||||
|
- [ ] Sprint button (sperate from double tapping forward)
|
||||||
|
- [ ] Gamepad support
|
||||||
|
- [ ] Cancel button for file upload
|
||||||
|
- [ ] Styling for file upload
|
||||||
|
- [ ] Pick block button
|
||||||
|
- [ ] Back button for Kiwi browser?
|
||||||
|
|
||||||
|
Implemented
|
||||||
|
|
||||||
|
- [x] Fake pointerlock API (tricks the client into loading)
|
||||||
|
- [x] Fake fullscreen API (so that selecting full screen doesn't crash the client)
|
||||||
|
- [x] Custom upload button for files (because safari is a pain with button clicks)
|
||||||
|
- [x] Fake mousemove events (Allows touch and drag to simulate mouse movement)
|
||||||
|
- [x] Fake cursor scroll events (Allows scrolling through hotbar and in menus)
|
||||||
|
- [x] On-screen controls (Movement, block placement/removal, inventory, item dropping, keyboard, and exiting keys)
|
||||||
|
- [x] Styling for html, body, and canvas (So that the canvas doesn't ignore the navigation bars for viewport sizing)
|
|
@ -7,12 +7,21 @@
|
||||||
// @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/*
|
||||||
// @grant none
|
// @grant none
|
||||||
// @version 1.2
|
// @version 1.3
|
||||||
// @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==
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
@ -298,6 +307,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 = "⊹";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user