// ==UserScript==
// @name Cursor Chat
// @namespace Cursor Chat
// @version 1.0.1
// @description Cursor Chat by cursor docs, supports models claude-sonnet-4.5, gpt-5-nano and gemini-2.5-flash. Notice: Does not remember last chat history! Refreshing the page will cause chat history to be lost!!! Please save your content promptly!!! IMPORTANT!!!
// @author Wilson
// @match *://*/*
// @icon https://cursor.com/favicon.ico
// @grant GM_addStyle
// @grant GM_registerMenuCommand
// ==/UserScript==
(function() {
'use strict';
if (window.top !== window.self) return;
GM_registerMenuCommand(
"打开 Cursor Chat",
function () {
window.open('https://cursor.com/cn/docs?chat');
},
"o"
);
if(!location.href.includes('https://cursor.com/cn/docs?chat')) return;
GM_addStyle(`
div[class~="md:block"]{
width: 100%!important;
}
div[class~="md:block"] > div {
width: auto!important;
}
div[class~="md:block"] > div > div:first-child,
mian,
div[class~="lg:block"],
div[data-silk]:has(header) {
display: none!important;
}
div[class~="md:block"]::before {
content: "AI Loading...";
padding-left: calc(50% - 44.24px);
font-size: 24px;
}
div[class~="md:block"].loaded::before {
content: none;
}
div:has(> button[data-slot="popover-trigger"][aria-haspopup="dialog"][aria-controls="radix-_r_1i_"]){
display: none;
}
form > textarea[placeholder],
form > textarea[placeholder].auto-h {
height: 40px!important;
background-color: '';
}
form > textarea[placeholder].auto-h:focus {
height: 150px!important;
background-color: white;
}
div[data-sender="user"] > div {
background-color: #e0e0e0;
font-weight:bold;
border-left: 3px solid blue;
}
div[data-sender="assistant"] > div {
background-color: white;
}
.ai-tips {
color: coral;
font-weight:bold;
font-size: 12px;
}
.ai-ads {
color: #333;
}
.ai-ads a {
color: blue;
}
.ai-ads a:hover {
text-decoration: underline;
}
`);
let loaded = false;
const showAI = () => {
document.title = 'Cursor Chat';
document.querySelector('div[class~="md:block"]')?.classList.add('loaded');
document.querySelector('div[class~="md:block"] > div > div:first-child > button')?.click();
//document.querySelector('[data-slot="popover-trigger"][aria-haspopup="dialog"][aria-controls="radix-_r_1i_"]')?.nextElementSibling?.click();
setTimeout(()=>{
const textarea = document.querySelector('form > textarea[placeholder]');
if(!textarea) return;
loaded = true;
textarea.placeholder = '请输入您的问题';
setTimeout(()=>{
textarea.classList.add('auto-h');
// 插入注意事项
const modelBtn = textarea.nextElementSibling?.firstElementChild?.firstElementChild;
if(modelBtn) modelBtn.insertAdjacentHTML('afterend', `注意:该AI对话不会记忆上次的聊天内容,刷新页面聊天记录丢失!!!请及时保存内容!!!`);
// ads
const ftBtn = document.querySelector('.flex-shrink-0:last-child.py-1')?.firstElementChild?.firstElementChild;
if(ftBtn) ftBtn.insertAdjacentHTML('afterend', `推荐免费模型:硅基 推荐国外模型:V-API 七牛大福利:如何获取上亿token?`);
}, 1500);
}, 100);
};
setTimeout(()=>{
document.title = 'Cursor Chat';
}, 800);
setTimeout(()=>{
if(!loaded) showAI();
}, 3000);
setTimeout(()=>{
if(!loaded) showAI();
}, 5000);
setTimeout(()=>{
if(!loaded) showAI();
}, 8000);
setTimeout(()=>{
if(!loaded) showAI();
}, 10000);
setTimeout(()=>{
if(!loaded) showAI();
}, 15000);
})();