Skip to content

Commit d688315

Browse files
author
joe
committed
修正 Grok 輸入框問題
1 parent eef5221 commit d688315

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,4 +919,11 @@ ChatGPT 雖然很厲害,但也有它的極限,所以我們要加強自己的
919919
送審日期:2025/10/06
920920
通過日期:2025/10/10
921921

922-
- 加入 prompt packs 連結
922+
- 加入 prompt packs 連結
923+
924+
### 1.6.3 版
925+
926+
送審日期:2025/11/29
927+
通過日期:2025/12/05
928+
929+
- 修正 Grok 輸入框問題

js/content.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4095,7 +4095,7 @@ setTimeout(()=>{
40954095
chatInput = document.querySelector('div[contenteditable="true"]');
40964096
}
40974097
if(supportGrok){
4098-
chatInput = document.querySelector('form').querySelector('textarea');
4098+
chatInput = document.querySelector('form').querySelector('textarea') || document.querySelector('div[contenteditable="true"]');
40994099
}
41004100
if(supportFelo){
41014101
chatInput = document.querySelector('form').querySelector('textarea');
@@ -4173,8 +4173,17 @@ setTimeout(()=>{
41734173
chatInput().children[0].textContent = message;
41744174
chatInput().children[0].focus();
41754175
}else if(supportGrok){
4176-
chatInput().value = message;
4177-
chatInput().dispatchEvent(new Event('input', { bubbles: true }));
4176+
if(chatInput() instanceof HTMLTextAreaElement){
4177+
chatInput().value = message;
4178+
chatInput().dispatchEvent(new Event('input', { bubbles: true }));
4179+
}else{
4180+
const messageArray = message.split("\n");
4181+
messageArray?.forEach((msg) => {
4182+
const paragraph = document.createElement('p');
4183+
paragraph.textContent = msg;
4184+
chatInput().appendChild(paragraph);
4185+
});
4186+
}
41784187
}else if(supportFelo){
41794188
chatInput().value = message;
41804189
chatInput().dispatchEvent(new Event('input', { bubbles: true }));

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "__MSG_extension_name__",
44
"description": "__MSG_extension_description__",
55
"author": "Joe",
6-
"version": "1.6.2",
6+
"version": "1.6.3",
77
"default_locale": "en",
88
"icons": {
99
"16": "images/icon/16.png",

0 commit comments

Comments
 (0)