这是一个方便查看每个ChatGPT回复状态的油猴脚本,
助你成为"时间管理"大师
脚本功能:
通过查看每个ChatGPT网页的 favicon,直观了解当前回复的状态;
目前有5种状态:
…
适配:
官网 ChatGPT官网;
第三方镜像站:
oaifree,
sharedchat ,
…
点击查看 脚本
// ==UserScript==
// @name [Chat] State Favicons (20240801.0)
// @description States: 1. Response start: 🔄; 2. Response stop: ✔️; 3. Ready( to send): 👍; 4. Wait(other): original favicon; 5. Error: 🚫;
// @version 20240801.0
//
// @match https://chatgpt.com/*
// @match https://chat.rawchat.cc/*
// @match https://chat.sharedchat.*/*
// @match https://shared.oaifree.com/?*
//
// @icon https://upload.wikimedia.org/wikipedia/commons/0/04/ChatGPT_logo.svg
// @grant GM_getValue
// @grant GM_setValue
// ==/UserScript==
(function() {
'use strict';
let stopButtonDetected = false;
let responseEnded = false;
let originalFaviconHref = document.querySelector("link[rel~='icon']")?.href || 'https://upload.wikimedia.org/wikipedia/commons/0/04/ChatGPT_logo.svg';
let favicon = document.querySelector("link[rel~='icon']") || document.createElement('link');
favicon.rel = 'icon';
favicon.type = 'image/x-icon';
let rotationInterval;
function startFaviconRotation() {
let degree = 0;
rotationInterval = setInterval(() => {
degree = (degree + 10) % 360;
favicon.href = `data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🔄</text></svg>`;
document.head.appendChild(favicon);
}, 100);
}
function stopFaviconRotation() {
clearInterval(rotationInterval);
favicon.href = `data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>✔️</text></svg>`;
document.head.appendChild(favicon);
responseEnded = true;
}
function setReadyFavicon() {
favicon.href = `data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>👍</text></svg>`;
document.head.appendChild(favicon);
}
function setWaitFavicon() {
favicon.href = originalFaviconHref;
document.head.appendChild(favicon);
}
function setErrorFavicon() {
favicon.href = `data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🚫</text></svg>`;
document.head.appendChild(favicon);
}
function checkButtonState() {
const stopButton = document.querySelector('button[data-testid="stop-button"]');
const sendButton = document.querySelector('button[data-testid="send-button"]');
const errorIcon = document.querySelector('svg.icon-lg path[d="M13 12a1 1 0 1 0-2 0v4a1 1 0 1 0 2 0zM12 9.5A1.25 1.25 0 1 0 12 7a1.25 1.25 0 0 0 0 2.5"]');
if (stopButton) {
if (!stopButtonDetected) {
stopButtonDetected = true;
startFaviconRotation();
responseEnded = false;
}
} else if (stopButtonDetected) {
stopFaviconRotation();
stopButtonDetected = false;
}
if (responseEnded) {
if (errorIcon) {
setErrorFavicon();
} else if (sendButton) {
if (!sendButton.disabled) {
setReadyFavicon();
responseEnded = false;
}
}
} else {
if (sendButton) {
if (!sendButton.disabled) {
setReadyFavicon();
} else if (!stopButtonDetected) {
setWaitFavicon();
}
}
}
}
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.type === 'childList' || mutation.type === 'attributes') {
checkButtonState();
}
});
});
const config = { attributes: true, childList: true, subtree: true, attributeFilter: ['disabled', 'hidden'] };
observer.observe(document.body, config);
checkButtonState();
})();
点击查看 效果图
—分割线—
其他:
Claude现在回复的贼快,就没搞;
感兴趣的佬们,欢迎一起交流;
----20240801