Greasy Fork is available in English.
Paste text into Grok textarea from main page
当前为
// ==UserScript==
// @name Paste to Grok Textarea
// @description Paste text into Grok textarea from main page
// @match *://grok.com/*
// @version 0.0.1.20250516072640
// @namespace http://greasyfork.icu/users/1435046
// ==/UserScript==
(function () {
'use strict';
// Listen for messages from parent
window.addEventListener("message", event => {
const data = event.data;
if (typeof data === "string" && data.trim()) {
// Try to find the Grok textarea
const textarea = document.querySelector('textarea[aria-label="Ask Grok anything"]');
if (textarea) {
textarea.focus();
textarea.value = data;
// Dispatch input event so React sees the change
textarea.dispatchEvent(new Event("input", { bubbles: true }));
}
}
});
})();