File size: 721 Bytes
6436714
285910d
3599022
 
 
 
 
0b49c00
3599022
c6f596c
8574ad7
3599022
 
 
 
 
 
 
 
6436714
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
(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});
  }
})();