SheridanCoriana6

ChatGPT Contiune button Tampermonkey

May 2nd, 2023
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 2.66 KB | Software | 0 0
  1. // ==UserScript==
  2. // @name         ChatGPT Continue button
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  try to take over the world!
  6. // @author       You
  7. // @match        https://chat.openai.com/
  8. // @icon         https://www.google.com/s2/favicons?sz=64&domain=openai.com
  9. // @grant        none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13.     'use strict';
  14.  
  15.     // Your code here...
  16.     // Create the button element
  17. const button = document.createElement("button");
  18. button.textContent = "Continue";
  19. button.id = "request-code-btn";
  20. button.style.padding = "2px";
  21. button.style.border = "none";
  22. button.style.borderRadius = "20px";
  23. button.style.color = "#fff";
  24. button.style.backgroundColor = "#6e6e80";
  25. button.style.fontSize = "10px";
  26. button.style.fontWeight = "150";
  27. button.style.marginBottom = "10px";
  28. button.style.width = "80px";
  29.  
  30. // Add an event listener to the button
  31. button.addEventListener("click", function() {
  32.   const textarea = document.querySelector('textarea[tabindex="0"]');
  33.   if (!textarea.value.trim()) {
  34.     textarea.value = "Continue";
  35.   }
  36.  
  37.   const clickElement = document.querySelector('.absolute.p-1.rounded-md.text-gray-500.bottom-1.5.md\\:bottom-2.5.hover\\:bg-gray-100.enabled\\:dark\\:hover\\:text-gray-400.dark\\:hover\\:bg-gray-900.disabled\\:hover\\:bg-transparent.dark\\:disabled\\:hover\\:bg-transparent.right-1.md\\:right-2.disabled\\:opacity-40');
  38.   clickElement.click();
  39.  
  40.   const textareaValue = textarea.value;
  41.   const textareaParent = textarea.parentNode.parentNode;
  42.   const nextTextarea = textareaParent.nextSibling.querySelector('textarea');
  43.   nextTextarea.value = textareaValue;
  44.  
  45.   const newOption = document.createElement('option');
  46.   newOption.value = textareaValue;
  47.   const select = document.querySelector('.form-control.py-1');
  48.   select.appendChild(newOption);
  49.  
  50.   textarea.value = '';
  51.   if (textareaValue) {
  52.     textarea.value = '';
  53.   }
  54.  
  55.   const insertBeforeElement = document.querySelector('.flex.flex-col.w-full.py-2.flex-grow.md\\:py-3.md\\:pl-4.relative.border.border-black\\/10.bg-white.dark\\:border-gray-900\\/50');
  56.   const container = insertBeforeElement.parentNode;
  57.   container.insertBefore(button, insertBeforeElement);
  58. });
  59.  
  60. // Insert the button before an element with the class ".flex.flex-col.w-full.py-2.flex-grow.md\:py-3.md\:pl-4.relative.border.border-black\/10.bg-white.dark\:border-gray-900\/50"
  61. const insertBeforeElement = document.querySelector('.flex.flex-col.w-full.py-2.flex-grow.md\\:py-3.md\\:pl-4.relative.border.border-black\\/10.bg-white.dark\\:border-gray-900\\/50');
  62. const container = insertBeforeElement.parentNode;
  63. container.insertBefore(button, insertBeforeElement);
  64.  
  65. })();
Tags: chatGPT
Advertisement
Add Comment
Please, Sign In to add comment