chatgpt 验证码

这个脚本旨在改善在 chatgpt.com 网站上的免费用户体验,包括自动移除可能出现的验证码,输入框回车时自动绕过烦人的验证码。

  1. // ==UserScript==
  2. // @name chatgpt 验证码
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1.1
  5. // @description 这个脚本旨在改善在 chatgpt.com 网站上的免费用户体验,包括自动移除可能出现的验证码,输入框回车时自动绕过烦人的验证码。
  6. // @match https://chatgpt.com/*
  7. // @icon https://www.freelogovectors.net/wp-content/uploads/2023/01/chatgpt-logo-freelogovectors.net_.png
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. let intervalId = ''
  15. let textarea = document.getElementById('prompt-textarea');
  16.  
  17.  
  18.  
  19. // Function to remove the element if it exists
  20. function removeElement() {
  21. const element = document.getElementById('enforcement-containerchatgpt-freeaccount');
  22. if (element) {
  23. console.log('删除验证码元素');
  24. element.remove();
  25. } else {
  26. console.log('未找到验证码元素');
  27. }
  28. }
  29.  
  30. // Function to simulate Enter key press
  31. function simulateEnterKeyPress() {
  32. const event = new KeyboardEvent('keydown', {
  33. key: 'Enter',
  34. keyCode: 13,
  35. which: 13,
  36. bubbles: true
  37. });
  38. textarea.dispatchEvent(event);
  39. }
  40.  
  41. // Function to check for the button and simulate Enter key if not present
  42. function checkButton() {
  43. const button = document.querySelector('button[data-testid="stop-button"]');
  44. if (button) {
  45. clearInterval(intervalId); // Stop the interval when the button is found
  46. intervalId = ''
  47. } else {
  48. simulateEnterKeyPress(); // Simulate Enter key press
  49. }
  50. }
  51.  
  52. // Add an event listener to the textarea for 'keydown' events
  53.  
  54.  
  55. function bindEnterKeyEvent() {
  56. textarea = document.getElementById('prompt-textarea');
  57. console.log('textarea',textarea);
  58. if (textarea) {
  59. textarea.addEventListener('keydown', function(event) {
  60. if (event.key === 'Enter' && !event.shiftKey) {
  61. removeElement();
  62. // Check for the button every 500 milliseconds
  63. if (!intervalId) {
  64. intervalId = setInterval(checkButton, 1000);
  65. }
  66. }
  67. });
  68. } else {
  69. console.log('Textarea not found.');
  70. }
  71. }
  72.  
  73. // Function to handle navigation clicks
  74. function handleNavigationClick() {
  75. const navElement = document.querySelector('nav[aria-label="历史聊天记录"]');
  76. console.log(navElement);
  77. if (navElement) {
  78. navElement.addEventListener('click', function() {
  79. console.log('Navigated to history section, re-binding Enter key event.');
  80. setTimeout(function() {
  81. bindEnterKeyEvent(); // Re-bind Enter key event after page is loaded
  82. }, 1000);
  83. });
  84. }
  85. }
  86.  
  87. // Initial binding of Enter key event
  88. bindEnterKeyEvent();
  89.  
  90. // Handle navigation clicks to re-bind Enter key event
  91. window.onload = function() {
  92. handleNavigationClick();
  93. };
  94.  
  95. })();

QingJ © 2025

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