From 714c13579b02466915a1367d1bb659c8781c25c5 Mon Sep 17 00:00:00 2001 From: "adamlui@protonmail.com" Date: Wed, 28 Aug 2024 23:41:54 -0700 Subject: [PATCH] Added `chatgpt.getChatBox()` for `textArea` init in `chatgpt.send()` for easier maintenance --- chatgpt.js | 2 +- starters/chrome/extension/lib/chatgpt.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chatgpt.js b/chatgpt.js index 4e2e8f21c..715b278a5 100644 --- a/chatgpt.js +++ b/chatgpt.js @@ -1482,7 +1482,7 @@ const chatgpt = { // eslint-disable-line no-redeclare send(msg, method='') { for (let i = 0; i < arguments.length; i++) if (typeof arguments[i] !== 'string') return console.error(`Argument ${ i + 1 } must be a string!`); - const textArea = document.querySelector('form textarea'); + const textArea = chatgpt.getChatBox(); if (!textArea) return console.error('Chatbar element not found!'); textArea.value = msg; textArea.dispatchEvent(new Event('input', { bubbles: true })); // enable send button diff --git a/starters/chrome/extension/lib/chatgpt.js b/starters/chrome/extension/lib/chatgpt.js index 9f2be61b3..319f427f3 100644 --- a/starters/chrome/extension/lib/chatgpt.js +++ b/starters/chrome/extension/lib/chatgpt.js @@ -1482,7 +1482,7 @@ const chatgpt = { // eslint-disable-line no-redeclare send(msg, method='') { for (let i = 0; i < arguments.length; i++) if (typeof arguments[i] !== 'string') return console.error(`Argument ${ i + 1 } must be a string!`); - const textArea = document.querySelector('form textarea'); + const textArea = chatgpt.getChatBox(); if (!textArea) return console.error('Chatbar element not found!'); textArea.value = msg; textArea.dispatchEvent(new Event('input', { bubbles: true })); // enable send button