您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Listens for postMessage events on playground.allenai.org and enters into chat input and sends
当前为
- // ==UserScript==
- // @name AllenAI Message Listener
- // @description Listens for postMessage events on playground.allenai.org and enters into chat input and sends
- // @match https://playground.allenai.org/*
- // @grant none
- // @version 0.0.1.20250511172442
- // @namespace https://greasyfork.org/users/1435046
- // ==/UserScript==
- (function() {
- 'use strict';
- window.addEventListener('message', event => {
- // 1. Read the incoming message
- const message = event.data;
- // 2. Locate the chat input (by name or aria-label)
- const textarea = document.querySelector(
- 'textarea[name="content"], textarea[aria-label="Message OLMo"]'
- );
- if (!textarea) return; // not on screen yet
- // 3. Insert the text and notify any framework listeners
- textarea.value = message;
- textarea.dispatchEvent(new Event('input', { bubbles: true }));
- // 4. Click the send button
- const sendBtn = document.querySelector('button[type="submit"][aria-label="Submit prompt"]');
- if (sendBtn) sendBtn.click();
- });
- })();