Qwen Chat Auto-Paste

Paste received string message into the chat.qwen.ai textarea

  1. // ==UserScript==
  2. // @name Qwen Chat Auto-Paste
  3. // @description Paste received string message into the chat.qwen.ai textarea
  4. // @match https://chat.qwen.ai/*
  5. // @version 0.0.1.20250516104227
  6. // @namespace https://gf.qytechs.cn/users/1435046
  7. // ==/UserScript==
  8.  
  9. (function () {
  10. window.addEventListener('message', event => {
  11.  
  12. if (event.data && event.data.type === 'searchButtonClicked') {
  13.  
  14. document.querySelector('i.icon-line-globe-01')?.closest('button')?.click();
  15.  
  16. return;
  17. }
  18.  
  19. if (event.data && event.data.type === 'reasonButtonClicked') {
  20.  
  21. document.querySelector('i.icon-line-deepthink-01')?.closest('button')?.click();
  22.  
  23. return;
  24. }
  25.  
  26. if (event.data?.type === 'newChatButtonClicked') {
  27. document.querySelector('i.icon-line-message-alert-plus')?.closest('button')?.click();
  28. return;
  29. }
  30.  
  31. if (event.data.type === 'prompt') {
  32. const textarea = document.getElementById('chat-input');
  33. if (textarea) {
  34.  
  35. const nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, 'value')?.set;
  36. nativeInputValueSetter?.call(textarea, event.data.content);
  37.  
  38. textarea.dispatchEvent(new Event('input', { bubbles: true }));
  39. document.getElementById('send-message-button').click();
  40. }
  41. }
  42. });
  43. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址