mirror of
https://github.com/FlamedDogo99/EaglerMobile.git
synced 2024-11-24 13:06:04 -08:00
Last ditch-effort
If this doesn’t work on android, I don’t know what will
This commit is contained in:
parent
9ae89de928
commit
0badfd6f8c
|
@ -6,7 +6,7 @@
|
||||||
// @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 2.6
|
// @version 2.7
|
||||||
// @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==
|
||||||
|
@ -30,47 +30,25 @@ window.sprintLock = false;
|
||||||
var previousTouchX = null;
|
var previousTouchX = null;
|
||||||
var previousTouchY = null;
|
var previousTouchY = null;
|
||||||
var startTouchX = null;
|
var startTouchX = null;
|
||||||
// Polyfill for apply
|
// Ignores keydown events that don't have the isValid parameter set to true
|
||||||
Function.prototype.polyfillApply = function(currentContext = {}, arg = []) {
|
var _addEventListener = EventTarget.prototype.addEventListener;
|
||||||
if (typeof this !== 'function') {
|
EventTarget.prototype.addEventListener = function(type, fn, capture) {
|
||||||
throw new Error(this + "it's not callable");
|
this._addEventListener = _addEventListener;
|
||||||
}
|
this._addEventListener(type, function(...args) {
|
||||||
if (!Array.isArray(arg)) {
|
|
||||||
throw new TypeError('CreateListFromArrayLike called on non-object')
|
|
||||||
}
|
|
||||||
currentContext.fn = this;
|
|
||||||
currentContext.fn(...arg);
|
|
||||||
}
|
|
||||||
// Polyfill for call
|
|
||||||
Function.prototype.polyfillCall = function(currentContext = {}, ...arg) {
|
|
||||||
if (typeof this !== 'function') {
|
|
||||||
throw new Error(this + "it's not callable");
|
|
||||||
}
|
|
||||||
currentContext.fn = this;
|
|
||||||
currentContext.fn(...arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ignores any keydown event that doesn't have the isValid parameter.
|
|
||||||
const _addEventListener = EventTarget.prototype.addEventListener;
|
|
||||||
Object.defineProperty(EventTarget.prototype, "addEventListener", {
|
|
||||||
value: function (type, fn, ...rest) {
|
|
||||||
_addEventListener.call(this, type, function(...args) {
|
|
||||||
if(type === 'keydown' && (!args[0].isValid)) {
|
if(type === 'keydown' && (!args[0].isValid)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return fn.polyfillApply(this, args);
|
return fn(...args);
|
||||||
}, ...rest);
|
}, capture);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
// Allows typing in #hiddenInput
|
// Allows typing in #hiddenInput
|
||||||
const _preventDefault = Event.prototype.preventDefault;
|
const _preventDefault = Event.prototype.preventDefault;
|
||||||
Object.defineProperty(Event.prototype, "preventDefault", {
|
Event.prototype.preventDefault = function() {
|
||||||
value: function () {
|
|
||||||
if(document.activeElement.id != "hiddenInput") {
|
if(document.activeElement.id != "hiddenInput") {
|
||||||
_preventDefault.polyfillCall(this);
|
this._preventDefault = _preventDefault;
|
||||||
|
this._preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
// Key and mouse events
|
// Key and mouse events
|
||||||
function keyEvent(name, state) {
|
function keyEvent(name, state) {
|
||||||
const keyName = name.toUpperCase().charCodeAt(0);
|
const keyName = name.toUpperCase().charCodeAt(0);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user