chatgpt prompt input focus

shortcut to focus on input area on chatgpt page

当前为 2023-10-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name chatgpt prompt input focus
  3. // @namespace http://tampermonkey.net/
  4. // @license MIT
  5. // @version 0.1
  6. // @description shortcut to focus on input area on chatgpt page
  7. // @author You
  8. // @match https://chat.openai.com/c/d70c6371-0489-4d0a-8c95-68a4d4b32405
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=openai.com
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // make sure content is loaded
  17. window.addEventListener('load', function() {
  18. // custom the queryselector here
  19. const a=document.querySelector('#prompt-textarea');
  20.  
  21. let is_focused = false;
  22. a.onfocus = (e)=>{
  23. is_focused = true
  24. }
  25. a.onblur = (e)=>{
  26. is_focused = false
  27. }
  28.  
  29. // custom your key stroke here
  30. document.addEventListener("keypress",(e) => {
  31. if (e.key=='/' && !is_focused) {
  32. e.preventDefault();
  33. a.focus()
  34. }
  35. })
  36. })
  37. })();

QingJ © 2025

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