Greasy Fork is available in English.

ChatGPT Continue Button

Add a Continue button to ChatGPT

  1. // ==UserScript==
  2. // @name ChatGPT Continue Button
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.3
  5. // @description Add a Continue button to ChatGPT
  6. // @author stucci
  7. // @license MIT
  8. // @match https://chat.openai.com/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. function createButton(text, handler) {
  16. const button = document.createElement('button');
  17. button.className = 'custombtn btn relative btn-neutral border-0 md:border';
  18. button.innerHTML = text;
  19. button.onclick = handler;
  20. return button;
  21. }
  22.  
  23. function addButtonIfNotExists() {
  24. if (document.querySelector('.custombtn')) {
  25. return;
  26. }
  27.  
  28. const textBox = document.querySelector('form');
  29. if (!textBox) {
  30. return;
  31. }
  32.  
  33. const buttonContainer = document.createElement('div');
  34. buttonContainer.style.display = 'flex';
  35. buttonContainer.style.justifyContent = 'center';
  36. buttonContainer.style.marginBottom = '10px';
  37.  
  38. buttonContainer.append(
  39. createButton('Continue⏎', function() {
  40. const textArea = document.querySelector('textarea');
  41. textArea.value = 'Continue';
  42. textArea.focus();
  43.  
  44. const disabledButtons = document.querySelectorAll("button[disabled]");
  45. const lastDisabledButton = disabledButtons[disabledButtons.length - 1];
  46. lastDisabledButton.removeAttribute("disabled");
  47.  
  48. if (lastDisabledButton) {
  49. lastDisabledButton.click();
  50. }
  51. })
  52. );
  53.  
  54. textBox.parentNode.insertBefore(buttonContainer, textBox);
  55. }
  56.  
  57. const targetNode = document.body;
  58. const config = { childList: true, subtree: true };
  59. const observer = new MutationObserver(addButtonIfNotExists);
  60.  
  61. observer.observe(targetNode, config);
  62. })();