| 27222 | } |
| 27223 | |
| 27224 | async function input(sel, v) { |
| 27225 | await new Promise((resolve) => { |
| 27226 | let checkInv = setInterval(() => { |
| 27227 | let input = document.querySelector(sel); |
| 27228 | if (input) { |
| 27229 | input.focus(); |
| 27230 | input.scrollIntoView(); |
| 27231 | let lastValue = input.value; |
| 27232 | if (input.nodeName == "INPUT") { |
| 27233 | var nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value").set; |
| 27234 | nativeInputValueSetter.call(input, v); |
| 27235 | } else { |
| 27236 | var nativeTextareaValueSetter = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, "value").set; |
| 27237 | nativeTextareaValueSetter.call(input, v); |
| 27238 | } |
| 27239 | let event = new Event('focus', { bubbles: true }); |
| 27240 | input.dispatchEvent(event); |
| 27241 | event = new Event('input', { bubbles: true }); |
| 27242 | let tracker = input._valueTracker; |
| 27243 | if (tracker) { |
| 27244 | tracker.setValue(lastValue); |
| 27245 | } |
| 27246 | input.dispatchEvent(event); |
| 27247 | event = new Event('change', { bubbles: true }); |
| 27248 | input.dispatchEvent(event); |
| 27249 | clearInterval(checkInv); |
| 27250 | resolve(); |
| 27251 | } |
| 27252 | }, 100); |
| 27253 | }); |
| 27254 | } |
| 27255 | |
| 27256 | function emuClick(btn){ |
| 27257 | if(!PointerEvent)return btn.click(); |