mirror of
https://github.com/FlamedDogo99/EaglerMobile.git
synced 2024-11-21 11:36:05 -08:00
Fixed keyboard override
Only injects code on keypress event listeners
This commit is contained in:
parent
0badfd6f8c
commit
5f9ebad404
|
@ -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.7
|
// @version 2.8
|
||||||
// @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==
|
||||||
|
@ -31,16 +31,21 @@ var previousTouchX = null;
|
||||||
var previousTouchY = null;
|
var previousTouchY = null;
|
||||||
var startTouchX = null;
|
var startTouchX = null;
|
||||||
// Ignores keydown events that don't have the isValid parameter set to true
|
// Ignores keydown events that don't have the isValid parameter set to true
|
||||||
var _addEventListener = EventTarget.prototype.addEventListener;
|
const _addEventListener = EventTarget.prototype.addEventListener;
|
||||||
EventTarget.prototype.addEventListener = function(type, fn, capture) {
|
Object.defineProperty(EventTarget.prototype, "addEventListener", {
|
||||||
this._addEventListener = _addEventListener;
|
value: function (type, fn, ...rest) {
|
||||||
this._addEventListener(type, function(...args) {
|
if(type == 'keydown') {
|
||||||
if(type === 'keydown' && (!args[0].isValid)) {
|
_addEventListener.call(this, type, function(...args) {
|
||||||
return;
|
if(!args[0].isValid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return fn.apply(this, args);
|
||||||
|
}, ...rest);
|
||||||
|
} else {
|
||||||
|
_addEventListener.call(this, type, fn, ...rest);
|
||||||
}
|
}
|
||||||
return fn(...args);
|
}
|
||||||
}, capture);
|
});
|
||||||
}
|
|
||||||
// Allows typing in #hiddenInput
|
// Allows typing in #hiddenInput
|
||||||
const _preventDefault = Event.prototype.preventDefault;
|
const _preventDefault = Event.prototype.preventDefault;
|
||||||
Event.prototype.preventDefault = function() {
|
Event.prototype.preventDefault = function() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user