Spaces:
Running
Running
| (function () { | |
| const params = new URLSearchParams(location.search); | |
| if (params.has('q')) { | |
| new MutationObserver((mut, obs) => { | |
| for (const m of mut) { | |
| for (const node of m.addedNodes) { | |
| if (node instanceof HTMLElement) { | |
| const input = node.querySelector('#chat-input'); | |
| if (input) { | |
| Object.getOwnPropertyDescriptor(Object.getPrototypeOf(input), 'value').set.call(input, params.get('q')); | |
| input.dispatchEvent(new Event('input', {bubbles: true})); | |
| obs.disconnect(); | |
| return; | |
| } | |
| } | |
| } | |
| } | |
| }).observe(document.getElementById('root'), {childList: true, subtree: true}); | |
| } | |
| })(); | |