Created
August 14, 2021 11:02
-
-
Save fyhao/d99b1d36d4731ed2f2d2c47333ede8dd to your computer and use it in GitHub Desktop.
popcat click
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function send() { | |
var keyboardEvent = document.createEvent('KeyboardEvent'); | |
var initMethod = typeof keyboardEvent.initKeyboardEvent !== 'undefined' ? 'initKeyboardEvent' : 'initKeyEvent'; | |
keyboardEvent[initMethod]( | |
'keydown', // event type: keydown, keyup, keypress | |
true, // bubbles | |
true, // cancelable | |
window, // view: should be window | |
false, // ctrlKey | |
false, // altKey | |
false, // shiftKey | |
false, // metaKey | |
40, // keyCode: unsigned long - the virtual key code, else 0 | |
0, // charCode: unsigned long - the Unicode character associated with the depressed key, else 0 | |
); | |
document.dispatchEvent(keyboardEvent); | |
} | |
setInterval(send, 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment