Skip to content

getSubmitButton, getTextarea, getRegenerateButton, getNewChatButton...

License

Notifications You must be signed in to change notification settings

mefengl/chatgpt-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

ChatGPT Utils

AI Friendly AI Assisted Maybe Commit Messages by AI

Notice

this repo has been put into chatkit, you can find more about it in chat-play/packages/chatkit/chatgpt

Description

getSubmitButton, getTextarea, getRegenerateButton, getNewChatButton...

Usage

just copy and paste the code below

function getSubmitButton() {
  const form = document.querySelector('form');
  const buttons = form.querySelectorAll('button');
  const result = buttons[buttons.length - 1];
  return result;
};
function getTextarea() {
  const form = document.querySelector('form');
  const textareas = form.querySelectorAll('textarea');
  const result = textareas[0];
  return result;
};
function getRegenerateButton() {
  const form = document.querySelector('form');
  const buttons = form.querySelectorAll('button');
  const result = Array.from(buttons).find(button => button.textContent.trim().toLowerCase().includes('regenerate'));
  return result;
};
function getStopGeneratingButton() {
    const form = document.querySelector('form');
    const buttons = form.querySelectorAll('button');
    return Array.from(buttons).find(button => button.textContent.trim().toLowerCase().includes('stop generating'));
}
function getNewChatButton() {
  const aElements = document.getElementsByTagName('a');
  const result = Array.from(aElements).find(a => a.textContent === 'New chat');
  return result;
};

Contributing

Contributions, issues and feature requests are welcome!

License

This project is licensed under the terms of the MIT license.

About

getSubmitButton, getTextarea, getRegenerateButton, getNewChatButton...

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published