Band Aid fix for ChatGpt not having placeholder text and a caret in the question box.
当前为
// ==UserScript==
// @name Fix ChatGPT Placeholder / Caret
// @match https://chatgpt.com/*
// @grant none
// @license MIT
// @description Band Aid fix for ChatGpt not having placeholder text and a caret in the question box.
// @version 0.0.1.20250717132257
// @namespace https://greasyfork.org/users/1495774
// ==/UserScript==
(function() {
'use strict';
function applyStyles(pm) {
pm.style.all = 'unset';
pm.style.caretColor = 'white';
pm.style.padding = '0px 0px 0px 0px';
pm.style.margin = '0px 0px 0px 1px';
pm.style.fontSize = '16px';
pm.style.lineHeight = '1.2';
pm.style.minHeight = '2em';
pm.style.height = 'auto';
pm.style.boxSizing = 'border-box';
pm.style.overflow = 'hidden';
// Set the --text-secondary CSS variable to white with 60% opacity
pm.style.setProperty('--text-secondary', 'rgba(255, 255, 255, 0.6)');
pm.setAttribute('contenteditable', 'true');
pm.focus();
}
// Check if the element already exists on page load
const initialPm = document.querySelector('.ProseMirror');
if (initialPm) {
applyStyles(initialPm);
}
// Create a MutationObserver to watch for .ProseMirror element being added later
const observer = new MutationObserver((mutations, obs) => {
const pm = document.querySelector('.ProseMirror');
if (pm) {
applyStyles(pm);
obs.disconnect(); // stop observing once done
}
});
observer.observe(document.body, { childList: true, subtree: true });
})();