Poe Force 0x0A

Inserts a newline instead of sending the message on poe.com

  1. // ==UserScript==
  2. // @name Poe Force 0x0A
  3. // @namespace http://tampermonkey.net/
  4. // @author TwilightAlicorn
  5. // @version 1.0
  6. // @license MIT
  7. // @description Inserts a newline instead of sending the message on poe.com
  8. // @match https://poe.com/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. document.addEventListener('keydown', function(e) {
  16. if (e.key === 'Enter' && !e.shiftKey) {
  17. e.preventDefault();
  18. e.stopPropagation();
  19.  
  20. // Get the active element (the textarea)
  21. const activeElement = document.activeElement;
  22.  
  23. if (activeElement && activeElement.tagName.toLowerCase() === 'textarea') {
  24. // Insert a newline at the cursor position
  25. const start = activeElement.selectionStart;
  26. const end = activeElement.selectionEnd;
  27. const value = activeElement.value;
  28. activeElement.value = value.slice(0, start) + '\n' + value.slice(end);
  29. // Move the cursor after the newline
  30. activeElement.selectionStart = activeElement.selectionEnd = start + 1;
  31.  
  32. // Trigger an input event to update the internal state
  33. const inputEvent = new Event('input', { bubbles: true });
  34. activeElement.dispatchEvent(inputEvent);
  35. }
  36. }
  37. }, true);
  38. })();

QingJ © 2025

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