您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Monitor ChatGPT's response on chat.openai.com/chat and add "continue" if no period is detected
当前为
- // ==UserScript==
- // @name ChatGPT Monitor
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description Monitor ChatGPT's response on chat.openai.com/chat and add "continue" if no period is detected
- // @author Your Name
- // @match https://chat.openai.com/chat
- // @grant none
- // @license MIT
- // ==/UserScript==
- (function() {
- 'use strict';
- var targetNode = document.getElementById("__next");
- var config = { childList: true };
- var callback = function(mutationsList) {
- for(var mutation of mutationsList) {
- if (mutation.addedNodes.length > 0) {
- var lastNode = mutation.addedNodes[mutation.addedNodes.length - 1];
- if (lastNode.classList.contains("text-md") && lastNode.classList.contains("text-white") && lastNode.classList.contains("bg-blue-500") && lastNode.classList.contains("p-2")) {
- var text = lastNode.innerText;
- if (text.endsWith(".") || text.endsWith("。")) {
- console.log("Period detected, no need to add 'continue'");
- } else {
- console.log("No period detected, adding 'continue'");
- var inputNode = document.querySelector("#__next > div.overflow-hidden.w-full.h-full.relative > div.flex.h-full.flex-1.flex-col.md\\:pl-[260px] > main > div.flex-1.overflow-hidden > div > div > div > div:nth-child(4) > div > div.relative.flex.w-[calc(100%-50px)].flex-col.gap-1.md\\:gap-3.lg\\:w-[calc(100%-115px)] > div.flex.flex-grow.flex-col.gap-3 > div > div");
- inputNode.value = "continue";
- inputNode.dispatchEvent(new Event("input", { bubbles: true }));
- inputNode.form.dispatchEvent(new Event("submit", { bubbles: true }));
- }
- }
- }
- }
- };
- var observer = new MutationObserver(callback);
- observer.observe(targetNode, config);
- })();