flameddogo99-eaglermobile/eaglermobile-ef.js

1 line
111 KiB
JavaScript
Raw Permalink Normal View History

2024-06-16 15:26:33 -07:00
try{unsafeWindow.console.warn("DANGER: This userscript is using unsafeWindow. Unsafe websites could potentially use this to gain access to data and other content that the browser normally wouldn't allow!"),Object.defineProperty(window,"clientWindow",{value:unsafeWindow})}catch{Object.defineProperty(window,"clientWindow",{value:window})}(function(){try{return document.createEvent("TouchEvent"),!0}catch(A){return!1}})()||alert("WARNING: This script was created for mobile, and may break functionality in non-mobile browsers!"),clientWindow.crouchLock=!1,clientWindow.sprintLock=!1,clientWindow.keyboardFix=!1,clientWindow.inputFix=!1,clientWindow.blockNextInput=!1,clientWindow.hiddenInputFocused=!1;var A=null,I=null,g=null;String.prototype.toKeyCode=function(){return{0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,pause_break:19,caps_lock:20,escape:27," ":32,page_up:33,page_down:34,end:35,home:36,left_arrow:37,up_arrow:38,right_arrow:39,down_arrow:40,insert:45,delete:46,a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,left_window_key:91,right_window_key:92,select_key:93,numpad_0:96,numpad_1:97,numpad_2:98,numpad_3:99,numpad_4:100,numpad_5:101,numpad_6:102,numpad_7:103,numpad_8:104,numpad_9:105,"*":106,"+":107,"-":109,".":110,"/":111,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,num_lock:144,scroll_lock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,'"':222}[this]};const i=EventTarget.prototype.addEventListener;Object.defineProperty(EventTarget.prototype,"addEventListener",{value:function(A,I,...g){"keydown"==A?i.call(this,A,(function(...A){if(A[0].isValid||!clientWindow.keyboardFix)return I.apply(this,A)}),...g):i.call(this,A,I,...g)}});const e=Event.prototype.preventDefault;function C(A,I){const g=A.toKeyCode();let i=new KeyboardEvent(I,{key:A,keyCode:g,which:g});i.isValid=!0,clientWindow.dispatchEvent(i)}function t(A,I,g){g.dispatchEvent(new PointerEvent(I,{button:A}))}function G(A,I){A.dispatchEvent(new WheelEvent("wheel",{wheelDeltaY:I}))}function d(A){let I=document.getElementById("inGameStyle"),g=document.getElementById("inMenuStyle");I.disabled=A,g.disabled=!A}Event.prototype.preventDefault=function(A){("hiddenInput"!=document.activeElement.id||A)&&(this._preventDefault=e,this._preventDefault())},clientWindow.fakelock=null,Object.defineProperty(Element.prototype,"requestPointerLock",{value:function(){return clientWindow.fakelock=this,document.dispatchEvent(new Event("pointerlockchange")),d(!0),!0}}),Object.defineProperty(Document.prototype,"pointerLockElement",{get:function(){return clientWindow.fakelock}}),Object.defineProperty(Document.prototype,"exitPointerLock",{value:function(){return clientWindow.fakelock=null,document.dispatchEvent(new Event("pointerlockchange")),d(!1),!0}}),clientWindow.fakefull=null,Object.defineProperty(Element.prototype,"requestFullscreen",{value:function(){return clientWindow.fakefull=this,document.dispatchEvent(new Event("fullscreenchange")),!0}}),Object.defineProperty(document,"fullscreenElement",{get:function(){return clientWindow.fakefull}}),Object.defineProperty(Document.prototype,"exitFullscreen",{value:function(){return clientWindow.fakefull=null,document.dispatchEvent(new Event("fullscreenchange")),!0}});const c=document.createElement;document.createElement=function(A,I){this._createElement=c;var g=this._createElement(A);return"input"!=A||I||(document.querySelectorAll("#fileUpload").forEach((A=>A.parentNode.removeChild(A))),g.id="fileUpload",g.addEventListener("change",(function(A){g.hidden=!0,g.style.display="none"}),{passive:!1,once:!0}),clientWindow.addEventListener("focus",(function(A){setTimeout((()=>{g.hidden=!0,g.style.display="none"}),300)}),{once:!0}),document.body.appendChild(g)),g};let n=document.createElement("style");n.id="inGameStyle",n.textContent="\n.inGame {\ndisplay: none;\n}",document.documentElement.appendChild(n);let o=document.createElement("style");f