Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mefengl/chatgpt-utils

getSubmitButton, getTextarea, getRegenerateButton, getNewChatButton...
https://github.com/mefengl/chatgpt-utils

Last synced: 10 days ago
JSON representation

getSubmitButton, getTextarea, getRegenerateButton, getNewChatButton...

Awesome Lists containing this project

README

        

# ChatGPT Utils

[![AI Friendly](https://img.shields.io/badge/AI-Friendly-pink?style=for-the-badge)](https://github.com/mefengl/made-by-ai)
[![AI Assisted Maybe](https://img.shields.io/badge/AI%20Assisted-Maybe-yellow?style=for-the-badge)](https://github.com/mefengl/made-by-ai)
[![Commit Messages by AI](https://img.shields.io/badge/Commit%20Messages%20by-AI-green?style=for-the-badge)](https://github.com/mefengl/made-by-ai)

## Notice

this repo has been put into `chatkit`, you can find more about it in [chat-play/packages/chatkit/chatgpt](https://github.com/mefengl/chat-play)

## Description

getSubmitButton, getTextarea, getRegenerateButton, getNewChatButton...

## Usage

just copy and paste the code below

```js
function getSubmitButton() {
const form = document.querySelector('form');
const buttons = form.querySelectorAll('button');
const result = buttons[buttons.length - 1];
return result;
};
```

```js
function getTextarea() {
const form = document.querySelector('form');
const textareas = form.querySelectorAll('textarea');
const result = textareas[0];
return result;
};
```

```js
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;
};
```

```js
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'));
}
```

```js
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](/LICENSE).