打开cursor 官网 How AI Models Work | Cursor Learn
打开油猴脚本 粘进去刷新页面 就可以用
脚本有点长啊 超出字符了
需要的单找我吧 ,或者谁教我一下 咋能发出来
打开cursor 官网 How AI Models Work | Cursor Learn
打开油猴脚本 粘进去刷新页面 就可以用
需要的单找我吧 ,或者谁教我一下 咋能发出来
// ==UserScript==
// @name Cursor学习页面优化 - 简洁版
// @namespace https://tampermonkey.net/
// @version 4.0.0
// @description 【全面优化版】隐藏教程内容和左侧栏,全屏显示聊天输入框,上传按钮与发送按钮并排
// @author haorwen
// @match https://cursor.com/cn/learn/*
// @run-at document-end
// @grant none
// ==/UserScript==
(function () {
'use strict';
const state = {
fileContent: null,
fileName: null,
fileType: null
};
// Fetch 拦截器 - 注入文件内容和预设指令
const originalFetch = window.fetch;
window.fetch = function (...args) {
const [url, options] = args;
if (typeof url === 'string' && url.includes('/api/chat') && options && options.method === 'POST' && typeof options.body === 'string') {
try {
let bodyData = JSON.parse(options.body);
if (bodyData.messages && Array.isArray(bodyData.messages) && bodyData.messages.length > 0) {
// 注入文件内容
if (state.fileContent && state.fileName) {
console.log(`[Cursor优化] 注入文件 "${state.fileName}" (${state.fileType || '未知类型'})`);
let fileMessageContent;
// 图片文件特殊处理
if (state.fileType && state.fileType.startsWith('image/')) {
fileMessageContent = `📷 图片文件: ${state.fileName}\n类型: ${state.fileType}\n\n[图片Base64数据]\n${state.fileContent}`;
} else {
// 文本文件
fileMessageContent = `📄 文件名: ${state.fileName}\n\n${state.fileContent}`;
}
const fileMessage = {
role: 'user',
parts: [{ type: 'text', text: fileMessageContent }]
};
bodyData.messages.splice(bodyData.messages.length - 1, 0, fileMessage);
clearFileState();
}
// 注入预设指令
const instruction = "后续回答不需要读取当前站点的知识\n";
const firstMessage = bodyData.messages[0];
if (firstMessage?.role === 'user' && firstMessage.parts?.[0]?.type === 'text') {
const firstPart = firstMessage.parts[0];
if (typeof firstPart.text === 'string' && !firstPart.text.startsWith(instruction)) {
firstPart.text = instruction + firstPart.text;
}
}
}
options.body = JSON.stringify(bodyData);
} catch (error) {
console.error('[Cursor优化] 请求修改错误:', error);
}
}
return originalFetch.apply(this, args);
};
// 创建与发送按钮并排的上传按钮
function createUploadButton() {
let attempts = 0;
const maxAttempts = 60;
const waitForSendButton = setInterval(() => {
attempts++;
// 查找发送按钮
const sendButton = document.querySelector('button[type="submit"]') ||
Array.from(document.querySelectorAll('button')).find(btn =>
btn.querySelector('svg') && btn.closest('form')
);
if (sendButton) {
clearInterval(waitForSendButton);
// 确保不重复添加
if (document.getElementById('tm-upload-container')) {
return;
}
console.log('[Cursor优化] 找到发送按钮,添加上传按钮');
// 找到发送按钮的父容器
let buttonContainer = sendButton.parentElement;
// 创建上传按钮容器
const container = document.createElement('div');
container.id = 'tm-upload-container';
container.style.cssText = `
display: inline-flex;
align-items: center;
margin-right: 8px;
font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
`;
const shadow = container.attachShadow({ mode: 'open' });
shadow.innerHTML = `
<style>
.upload-wrapper {
display: flex;
align-items: center;
gap: 8px;
}
/* 上传按钮 - 超酷炫设计 */
.upload-btn {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 42px;
height: 42px;
background: linear-gradient(135deg, rgba(14, 165, 233, 0.15) 0%, rgba(6, 182, 212, 0.15) 100%);
color: #0ea5e9;
border: 2px solid rgba(14, 165, 233, 0.3);
border-radius: 12px;
cursor: pointer;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 2px 8px rgba(14, 165, 233, 0.2);
overflow: hidden;
}
/* 按钮内部光效 */
.upload-btn::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
transform: rotate(45deg);
transition: all 0.6s;
}
.upload-btn:hover::before {
left: 100%;
}
.upload-btn:hover {
background: linear-gradient(135deg, rgba(14, 165, 233, 0.25) 0%, rgba(6, 182, 212, 0.25) 100%);
border-color: rgba(14, 165, 233, 0.5);
transform: translateY(-2px) scale(1.05);
box-shadow:
0 4px 16px rgba(14, 165, 233, 0.3),
0 0 20px rgba(14, 165, 233, 0.2);
}
.upload-btn:active {
transform: translateY(0) scale(0.98);
box-shadow: 0 2px 8px rgba(14, 165, 233, 0.2);
}
/* 已上传状态 */
.upload-btn.uploaded {
background: linear-gradient(135deg, #10a37f 0%, #0d8f6f 100%);
border-color: #10a37f;
color: white;
animation: upload-success 0.6s ease;
}
@keyframes upload-success {
0% { transform: scale(1); }
50% { transform: scale(1.15); }
100% { transform: scale(1); }
}
.upload-btn.uploaded:hover {
background: linear-gradient(135deg, #0d8f6f 0%, #0b7a5e 100%);
box-shadow:
0 4px 16px rgba(16, 163, 127, 0.4),
0 0 20px rgba(16, 163, 127, 0.3);
}
/* 图标样式 */
.icon {
font-size: 20px;
transition: transform 0.3s;
z-index: 1;
filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}
.upload-btn:hover .icon {
transform: rotate(12deg) scale(1.1);
}
.upload-btn.uploaded .icon {
animation: icon-bounce 0.6s ease;
}
@keyframes icon-bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-4px); }
}
/* 文件信息标签 - 升级设计 */
.file-info {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 14px;
background: linear-gradient(135deg, rgba(224, 242, 254, 0.95) 0%, rgba(186, 230, 253, 0.95) 100%);
border-radius: 20px;
font-size: 12px;
color: #0c4a6e;
max-width: 150px;
border: 2px solid rgba(14, 165, 233, 0.3);
box-shadow: 0 2px 8px rgba(14, 165, 233, 0.15);
animation: slide-in 0.3s ease;
font-weight: 500;
}
@keyframes slide-in {
from {
opacity: 0;
transform: translateX(-10px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
.file-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex: 1;
font-weight: 600;
}
/* 清除按钮 - 升级设计 */
.clear-btn {
width: 18px;
height: 18px;
border-radius: 50%;
background: linear-gradient(135deg, #ff6b6b 0%, #ff5252 100%);
color: white;
border: none;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
line-height: 1;
transition: all 0.2s;
flex-shrink: 0;
box-shadow: 0 2px 6px rgba(255, 107, 107, 0.3);
font-weight: bold;
}
.clear-btn:hover {
background: linear-gradient(135deg, #ff5252 0%, #ff3838 100%);
transform: rotate(90deg) scale(1.1);
box-shadow: 0 3px 10px rgba(255, 107, 107, 0.4);
}
.clear-btn:active {
transform: rotate(90deg) scale(0.95);
}
</style>
<div class="upload-wrapper">
<div class="file-info" id="file-info" style="display: none;">
<span class="file-name" id="file-name"></span>
<button class="clear-btn" id="clear-btn" title="清除文件">×</button>
</div>
<button class="upload-btn" id="upload-btn" title="上传文件/图片">
<span class="icon" id="upload-icon">📎</span>
</button>
<input type="file" id="file-input" style="display: none;" accept="text/*,.md,.py,.js,.ts,.html,.css,.json,.txt,.jsx,.tsx,.vue,.java,.cpp,.c,.h,.cs,.php,.rb,.go,.rs,.swift,.kt,image/*,.jpg,.jpeg,.png,.gif,.bmp,.webp,.svg,.ico">
</div>
`;
shadow.getElementById('upload-btn').addEventListener('click', () => {
shadow.getElementById('file-input').click();
});
shadow.getElementById('file-input').addEventListener('change', handleFileSelect);
shadow.getElementById('clear-btn').addEventListener('click', clearFileState);
// 将上传按钮插入到发送按钮之前
buttonContainer.insertBefore(container, sendButton);
shadowRoot = shadow;
console.log('[Cursor优化] 上传按钮已添加');
} else if (attempts >= maxAttempts) {
clearInterval(waitForSendButton);
console.warn('[Cursor优化] 未找到发送按钮');
}
}, 500);
}
let shadowRoot = null;
function handleFileSelect(event) {
const file = event.target.files[0];
if (!file) return;
const reader = new FileReader();
reader.onload = (e) => {
state.fileContent = e.target.result;
state.fileName = file.name;
state.fileType = file.type;
updateFileUI();
console.log(`[Cursor优化] 文件已加载: ${file.name} (${file.type})`);
};
reader.onerror = () => {
alert('❌ 读取文件失败!请重试');
clearFileState();
};
// 判断文件类型:图片用DataURL,文本用Text
if (file.type.startsWith('image/')) {
reader.readAsDataURL(file); // 图片读取为base64
} else {
reader.readAsText(file); // 文本文件
}
}
function clearFileState() {
state.fileContent = null;
state.fileName = null;
state.fileType = null;
if (shadowRoot) {
const fileInput = shadowRoot.getElementById('file-input');
if (fileInput) fileInput.value = '';
}
updateFileUI();
console.log('[Cursor优化] 文件已清除');
}
function updateFileUI() {
if (!shadowRoot) return;
const uploadBtn = shadowRoot.getElementById('upload-btn');
const uploadIcon = shadowRoot.getElementById('upload-icon');
const fileInfo = shadowRoot.getElementById('file-info');
const fileName = shadowRoot.getElementById('file-name');
if (state.fileName && state.fileContent !== null) {
uploadBtn.classList.add('uploaded');
// 根据文件类型设置不同的图标
if (state.fileType && state.fileType.startsWith('image/')) {
uploadIcon.textContent = '🖼️'; // 图片图标
} else {
uploadIcon.textContent = '✓'; // 文本文件图标
}
uploadBtn.title = `已加载: ${state.fileName}`;
fileName.textContent = state.fileName;
fileInfo.style.display = 'flex';
} else {
uploadBtn.classList.remove('uploaded');
uploadIcon.textContent = '📎';
uploadBtn.title = '上传文件/图片';
fileInfo.style.display = 'none';
}
}
// 立即注入Loading样式(脚本最开始执行)- 超酷炫版本
function injectLoadingStylesImmediately() {
const style = document.createElement('style');
style.id = 'tm-loading-style';
style.textContent = `
/* 立即隐藏body内容 */
body {
overflow: hidden !important;
}
body > *:not(#tm-loading-overlay) {
opacity: 0 !important;
}
/* Loading期间隐藏所有下拉框和弹窗 */
body:has(#tm-loading-overlay) [data-radix-portal],
body:has(#tm-loading-overlay) [role="listbox"],
body:has(#tm-loading-overlay) [role="menu"],
body:has(#tm-loading-overlay) [data-radix-select-content] {
display: none !important;
visibility: hidden !important;
opacity: 0 !important;
pointer-events: none !important;
z-index: -1 !important;
}
/* Loading遮罩层 - 动态渐变背景 */
#tm-loading-overlay {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: linear-gradient(135deg, #0c4a6e 0%, #0369a1 25%, #0284c7 50%, #0ea5e9 75%, #38bdf8 100%);
background-size: 400% 400%;
animation: tm-gradient-shift 8s ease infinite;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
z-index: 2147483647;
transition: opacity 0.5s ease-out;
overflow: hidden;
}
@keyframes tm-gradient-shift {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
/* 粒子背景效果 */
#tm-loading-overlay::before {
content: '';
position: absolute;
width: 200%;
height: 200%;
background-image:
radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, 0.4), transparent),
radial-gradient(2px 2px at 60% 70%, rgba(255, 255, 255, 0.3), transparent),
radial-gradient(1px 1px at 50% 50%, rgba(255, 255, 255, 0.5), transparent),
radial-gradient(2px 2px at 80% 10%, rgba(255, 255, 255, 0.4), transparent),
radial-gradient(1px 1px at 90% 60%, rgba(255, 255, 255, 0.3), transparent),
radial-gradient(2px 2px at 30% 80%, rgba(255, 255, 255, 0.4), transparent);
background-size: 200% 200%;
animation: tm-particles-float 20s linear infinite;
}
@keyframes tm-particles-float {
0% { transform: translate(0, 0); }
100% { transform: translate(-50%, -50%); }
}
/* 光晕效果 */
#tm-loading-overlay::after {
content: '';
position: absolute;
width: 300px;
height: 300px;
background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
animation: tm-glow-pulse 3s ease-in-out infinite;
}
@keyframes tm-glow-pulse {
0%, 100% { transform: scale(1); opacity: 0.5; }
50% { transform: scale(1.3); opacity: 0.8; }
}
#tm-loading-overlay.tm-fade-out {
opacity: 0;
pointer-events: none;
}
/* 加载动画容器 */
.tm-loader-container {
position: relative;
display: flex;
align-items: center;
justify-content: center;
z-index: 1;
}
/* 多圈波纹效果 */
.tm-loader {
position: relative;
width: 80px;
height: 80px;
}
.tm-loader::before,
.tm-loader::after {
content: '';
position: absolute;
border-radius: 50%;
border: 3px solid transparent;
border-top-color: #ffffff;
}
.tm-loader::before {
top: 0;
left: 0;
right: 0;
bottom: 0;
animation: tm-spin 1.2s linear infinite;
}
.tm-loader::after {
top: 10px;
left: 10px;
right: 10px;
bottom: 10px;
border-top-color: rgba(255, 255, 255, 0.6);
animation: tm-spin 0.8s linear infinite reverse;
}
/* 中心圆 */
.tm-loader-center {
position: absolute;
top: 50%;
left: 50%;
width: 50px;
height: 50px;
transform: translate(-50%, -50%);
background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1));
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
animation: tm-pulse-scale 2s ease-in-out infinite;
box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}
.tm-loader-icon {
font-size: 24px;
animation: tm-icon-rotate 3s ease-in-out infinite;
}
@keyframes tm-spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
@keyframes tm-pulse-scale {
0%, 100% { transform: translate(-50%, -50%) scale(1); }
50% { transform: translate(-50%, -50%) scale(1.1); }
}
@keyframes tm-icon-rotate {
0%, 100% { transform: rotate(0deg); }
50% { transform: rotate(180deg); }
}
/* Loading文字 - 打字效果 */
.tm-loading-text {
margin-top: 40px;
font-size: 20px;
color: #ffffff;
font-family: 'Monaco', 'Courier New', monospace;
font-weight: 600;
text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
letter-spacing: 2px;
z-index: 1;
overflow: hidden;
white-space: nowrap;
border-right: 2px solid #ffffff;
animation: tm-typing 2s steps(20, end) infinite, tm-blink-caret 0.75s step-end infinite;
}
@keyframes tm-typing {
0% { width: 0; }
50% { width: 100%; }
100% { width: 0; }
}
@keyframes tm-blink-caret {
0%, 100% { border-color: transparent; }
50% { border-color: #ffffff; }
}
/* 进度条 */
.tm-progress-container {
margin-top: 30px;
width: 280px;
height: 6px;
background: rgba(255, 255, 255, 0.2);
border-radius: 3px;
overflow: hidden;
z-index: 1;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
.tm-progress-bar {
height: 100%;
background: linear-gradient(90deg, #ffffff, #7dd3fc, #ffffff);
background-size: 200% 100%;
border-radius: 3px;
animation: tm-progress-flow 2s ease-in-out infinite;
box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}
@keyframes tm-progress-flow {
0% {
width: 20%;
background-position: 0% 50%;
}
50% {
width: 80%;
background-position: 100% 50%;
}
100% {
width: 20%;
background-position: 0% 50%;
}
}
/* 状态提示 */
.tm-loading-tip {
margin-top: 20px;
font-size: 14px;
color: rgba(255, 255, 255, 0.8);
font-family: system-ui, -apple-system, sans-serif;
z-index: 1;
animation: tm-fade-pulse 2s ease-in-out infinite;
}
@keyframes tm-fade-pulse {
0%, 100% { opacity: 0.6; }
50% { opacity: 1; }
}
`;
document.head.insertBefore(style, document.head.firstChild);
}
// 注入主样式 - 科技感完整设计
function injectMainStyles() {
const style = document.createElement('style');
style.id = 'tm-optimization-style';
style.textContent = `
/* 标记要隐藏的元素 - 彻底隐藏并阻止点击(但不影响下拉框和header) */
.tm-hidden:not([data-radix-portal]):not([role="listbox"]):not([role="menu"]):not([data-radix-select-content]):not(#tm-tech-header) {
display: none !important;
visibility: hidden !important;
position: absolute !important;
left: -9999px !important;
width: 0 !important;
height: 0 !important;
pointer-events: none !important;
z-index: -9999 !important;
opacity: 0 !important;
}
/* 确保header及其所有子元素永远不受tm-hidden影响 - 最高优先级 */
#tm-tech-header.tm-hidden {
display: block !important;
visibility: visible !important;
opacity: 1 !important;
}
#tm-tech-header *.tm-hidden,
#tm-tech-header .tm-hidden {
display: revert !important;
visibility: visible !important;
opacity: 1 !important;
pointer-events: auto !important;
position: relative !important;
left: auto !important;
width: auto !important;
height: auto !important;
z-index: auto !important;
}
/* 确保下拉框永远不受tm-hidden影响 */
[data-radix-portal].tm-hidden,
[role="listbox"].tm-hidden,
[role="menu"].tm-hidden,
[data-radix-select-content].tm-hidden {
display: block !important;
visibility: visible !important;
opacity: 1 !important;
pointer-events: auto !important;
position: static !important;
width: auto !important;
height: auto !important;
left: auto !important;
z-index: 99999 !important;
}
/* 阻止所有隐藏元素的点击事件(但不影响下拉框) */
.tm-hidden:not([data-radix-portal]):not([role="listbox"]):not([role="menu"]) * {
pointer-events: none !important;
}
/* 移除页面内的分隔线 */
div[class*="md:block"] hr {
display: none !important;
}
/* 隐藏拖动手柄和分隔符 */
div[data-panel-resize-handle],
[data-panel-resize-handle-id],
.cursor-col-resize,
[class*="cursor-col-resize"],
div[role="button"][class*="cursor-col-resize"] {
display: none !important;
height: 0px !important;
width: 0px !important;
min-height: 0px !important;
min-width: 0px !important;
opacity: 0 !important;
visibility: hidden !important;
pointer-events: none !important;
}
/* 强制data-panel-group高度为0 */
[data-panel-group]:not(:has([class*="md:block"])):not(:has(form)) {
height: 0px !important;
min-height: 0px !important;
max-height: 0px !important;
overflow: hidden !important;
}
/* 超级强力隐藏所有左侧Panel和侧边栏 - 使用多种选择器(排除下拉框和header) */
[data-panel-group] > [data-panel]:first-child:not(:has([class*="md:block"])):not(:has(form)):not([data-radix-portal]):not([role="listbox"]):not([role="menu"]):not(#tm-tech-header),
[data-panel-group] > div:first-child:not(:has([class*="md:block"])):not(:has(form)):not([data-radix-portal]):not([role="listbox"]):not([role="menu"]):not(#tm-tech-header),
[data-panel-group-direction="horizontal"] > [data-panel]:first-child:not(:has([class*="md:block"])):not([data-radix-portal]):not([role="listbox"]):not(#tm-tech-header),
[data-panel-group-direction="horizontal"] > div:first-child:not(:has(form)):not(:has(textarea)):not([data-radix-portal]):not([role="listbox"]):not(#tm-tech-header),
[data-panel-group] > [data-panel][style*="width"]:not([data-radix-portal]):not([role="listbox"]):not(#tm-tech-header),
[data-panel]:not(:has([class*="md:block"])):not(:has(form)):not(:has(textarea)):not([data-radix-portal]):not([role="listbox"]):not([role="menu"]):not(#tm-tech-header),
div[data-panel]:first-child:not([data-radix-portal]):not([role="listbox"]):not(#tm-tech-header),
body > div:not(#tm-tech-header) > div > div:first-child:not(:has([class*="md:block"])):not(:has(form)):not([data-radix-portal]):not([role="listbox"]),
body > div:not(#tm-tech-header) > div:first-child:not(:has([class*="md:block"])):not(:has(form)):not([data-radix-portal]):not([role="listbox"]),
div[style*="display: flex"] > div:first-child:not(:has([class*="md:block"])):not(:has(form)):not(:has(textarea)):not([data-radix-portal]):not([role="listbox"]):not(#tm-tech-header) {
display: none !important;
width: 0 !important;
min-width: 0 !important;
max-width: 0 !important;
height: 0 !important;
overflow: hidden !important;
opacity: 0 !important;
visibility: hidden !important;
pointer-events: none !important;
position: absolute !important;
left: -9999px !important;
top: -9999px !important;
z-index: -9999 !important;
flex: 0 0 0 !important;
flex-basis: 0 !important;
flex-grow: 0 !important;
flex-shrink: 0 !important;
}
/* 极端隐藏所有可能的侧边栏按钮和控制器(排除下拉框内按钮和代码块复制按钮) */
button[aria-label*="sidebar"]:not([data-radix-portal] *):not([role="listbox"] *):not([role="menu"] *):not(pre *):not([class*="code"] *),
button[aria-label*="Sidebar"]:not([data-radix-portal] *):not([role="listbox"] *):not([role="menu"] *):not(pre *):not([class*="code"] *),
button[aria-label*="panel"]:not([data-radix-portal] *):not([role="listbox"] *):not([role="menu"] *):not(pre *):not([class*="code"] *),
button[aria-label*="Panel"]:not([data-radix-portal] *):not([role="listbox"] *):not([role="menu"] *):not(pre *):not([class*="code"] *),
button[aria-label*="Toggle"]:not([data-radix-portal] *):not([role="listbox"] *):not([role="menu"] *):not(pre *):not([class*="code"] *),
button[aria-label*="toggle"]:not([data-radix-portal] *):not([role="listbox"] *):not([role="menu"] *):not(pre *):not([class*="code"] *),
button[class*="sidebar"]:not([data-radix-portal] *):not([role="listbox"] *):not([role="menu"] *):not(pre *):not([class*="code"] *),
button[class*="panel"]:not([data-radix-portal] *):not([role="listbox"] *):not([role="menu"] *):not(pre *):not([class*="code"] *),
button[style*="position: absolute"][style*="left"]:not([data-radix-portal] *):not([role="listbox"] *):not([role="menu"] *):not(pre *):not([class*="code"] *),
button[style*="position: fixed"][style*="left"]:not([data-radix-portal] *):not([role="listbox"] *):not([role="menu"] *):not(pre *):not([class*="code"] *),
div[style*="position: absolute"][style*="left: 0"]:not(:has([class*="md:block"])):not([data-radix-portal]):not([role="listbox"]):not(pre):not([class*="code"]),
div[style*="position: fixed"][style*="left: 0"]:not(:has([class*="md:block"])):not([data-radix-portal]):not([role="listbox"]):not(pre):not([class*="code"]),
/* 隐藏所有包含lucide图标的左侧按钮(排除表单、下拉框和代码块复制按钮) */
button:has(svg[class*="lucide"]):not([type="submit"]):not([data-radix-portal] *):not([role="listbox"] *):not([role="menu"] *):not(pre *):not([class*="code"] *),
/* 隐藏左上角的小按钮 */
body > div > button:first-child:not([data-radix-portal] *):not([role="listbox"] *):not(pre *):not([class*="code"] *),
body > div:first-child > button:first-child:not([data-radix-portal] *):not([role="listbox"] *):not(pre *):not([class*="code"] *) {
display: none !important;
visibility: hidden !important;
opacity: 0 !important;
pointer-events: none !important;
width: 0 !important;
height: 0 !important;
position: absolute !important;
left: -9999px !important;
z-index: -9999 !important;
}
/* 隐藏顶部导航栏 */
header,
nav[class*="border-b"],
div[class*="border-b"] > nav,
a[href="/cn/docs"],
a[href*="/docs"],
a[href*="命令行界面"],
a[href*="学习"] {
display: none !important;
}
/* 隐藏包含"文档、命令行界面、学习"的顶部栏 */
div[class*="flex"][class*="border-b"] {
display: none !important;
}
/* 隐藏侧边栏推拉按钮 */
button[aria-label*="sidebar"],
button[aria-label*="Toggle"],
button[class*="sidebar"] {
display: none !important;
}
/* 确保页面布局正确 */
html, body {
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
min-height: 100% !important;
overflow-x: hidden !important;
overflow-y: auto !important;
}
html {
overflow-y: visible !important;
}
/* 清爽天空蓝渐变背景 */
body {
display: flex !important;
flex-direction: column !important;
align-items: center !important;
background: linear-gradient(135deg,
#e0f2fe 0%,
#dbeafe 20%,
#bae6fd 40%,
#7dd3fc 60%,
#bfdbfe 80%,
#93c5fd 100%) !important;
padding-top: 70px !important;
min-height: 100vh !important;
position: relative !important;
}
/* 背景动态网格效果 - 蓝色调 */
body::before {
content: '';
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image:
linear-gradient(rgba(14, 165, 233, 0.08) 1px, transparent 1px),
linear-gradient(90deg, rgba(14, 165, 233, 0.08) 1px, transparent 1px);
background-size: 50px 50px;
pointer-events: none;
z-index: 0;
}
/* 背景光晕效果 - 蓝青色调 */
body::after {
content: '';
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: radial-gradient(circle at 30% 30%, rgba(14, 165, 233, 0.15) 0%, transparent 50%),
radial-gradient(circle at 70% 70%, rgba(6, 182, 212, 0.15) 0%, transparent 50%);
pointer-events: none;
z-index: 0;
opacity: 1;
}
body > div:not(#tm-tech-header):not(#tm-loading-overlay):not([data-radix-portal]) {
display: flex !important;
justify-content: center !important;
width: 100% !important;
max-width: 100% !important;
z-index: 1 !important;
flex: 1 !important;
overflow: visible !important;
}
/* 聊天区域 - 高端玻璃态设计 - 更宽的显示区域 */
div.hidden.md\\:block,
div[class*="md:block"] {
display: flex !important;
flex-direction: column !important;
width: 1100px !important;
min-width: 1100px !important;
max-width: 1100px !important;
margin: 30px auto !important;
background: rgba(255, 255, 255, 0.03) !important;
backdrop-filter: blur(30px) saturate(120%) !important;
box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6) !important;
border-radius: 28px !important;
overflow: hidden !important;
max-height: calc(100vh - 150px) !important;
}
/* 强制所有直接子元素占满宽度 */
div.hidden.md\\:block > *,
div[class*="md:block"] > * {
width: 100% !important;
max-width: 100% !important;
box-sizing: border-box !important;
}
/* 美化输入框区域 - 清新简洁 */
div.hidden.md\\:block form,
div[class*="md:block"] form {
width: 100% !important;
max-width: 100% !important;
box-sizing: border-box !important;
padding: 20px 24px !important;
background: rgba(255, 255, 255, 0.15) !important;
border: none !important;
flex-shrink: 0 !important;
border-radius: 0 0 28px 28px !important;
backdrop-filter: blur(20px) !important;
}
/* 输入框样式优化 - 清晰简洁 */
div.hidden.md\\:block textarea,
div[class*="md:block"] textarea {
width: 100% !important;
box-sizing: border-box !important;
background: rgba(255, 255, 255, 0.12) !important;
border: 1px solid rgba(255, 255, 255, 0.2) !important;
border-radius: 16px !important;
padding: 16px 20px !important;
font-size: 16px !important;
color: #1e293b !important;
resize: none !important;
backdrop-filter: blur(10px) !important;
}
div.hidden.md\\:block textarea:focus,
div[class*="md:block"] textarea:focus {
border-color: rgba(14, 165, 233, 0.4) !important;
box-shadow:
0 4px 16px rgba(14, 165, 233, 0.2),
0 0 0 3px rgba(14, 165, 233, 0.1),
inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
outline: none !important;
background: rgba(255, 255, 255, 0.15) !important;
color: #0f172a !important;
}
div.hidden.md\\:block textarea::placeholder,
div[class*="md:block"] textarea::placeholder {
color: rgba(30, 41, 59, 0.5) !important;
font-size: 16px !important;
}
/* 美化按钮 - 清爽蓝色渐变 */
button[type="submit"] {
background: linear-gradient(135deg, #0284c7 0%, #06b6d4 50%, #0ea5e9 100%) !important;
border: none !important;
border-radius: 14px !important;
color: white !important;
padding: 13px 26px !important;
font-weight: 600 !important;
font-size: 14px !important;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
box-shadow:
0 6px 20px rgba(2, 132, 199, 0.4),
0 0 40px rgba(6, 182, 212, 0.2) !important;
cursor: pointer !important;
position: relative !important;
overflow: hidden !important;
letter-spacing: 0.5px !important;
}
button[type="submit"]::before {
content: '' !important;
position: absolute !important;
top: 0 !important;
left: -100% !important;
width: 100% !important;
height: 100% !important;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent) !important;
transition: left 0.6s !important;
}
button[type="submit"]:hover {
transform: translateY(-2px) scale(1.02) !important;
box-shadow:
0 8px 30px rgba(2, 132, 199, 0.5),
0 0 60px rgba(6, 182, 212, 0.3) !important;
}
button[type="submit"]:hover::before {
left: 100% !important;
}
button[type="submit"]:active {
transform: translateY(0) scale(0.98) !important;
box-shadow:
0 3px 12px rgba(2, 132, 199, 0.3),
0 0 20px rgba(6, 182, 212, 0.2) !important;
}
/* 滚动区域样式 */
[data-radix-scroll-area-viewport] {
width: 100% !important;
max-width: 100% !important;
overflow-y: auto !important;
box-sizing: border-box !important;
}
/* 滚动容器样式 */
[data-radix-scroll-area-root] {
flex: 1 !important;
overflow: hidden !important;
width: 100% !important;
box-sizing: border-box !important;
}
/* 滚动区域内所有元素占满宽度 */
[data-radix-scroll-area-viewport] > * {
width: 100% !important;
max-width: 100% !important;
box-sizing: border-box !important;
}
/* 消息区域 - 带滚动条 + 清爽蓝色渐变背景 */
div[class*="md:block"] > div:nth-child(2) {
flex: 1 1 auto !important;
overflow-y: auto !important;
padding: 24px !important;
width: 100% !important;
box-sizing: border-box !important;
background: linear-gradient(180deg,
rgba(224, 242, 254, 0.95) 0%,
rgba(219, 234, 254, 0.98) 20%,
rgba(186, 230, 253, 1) 40%,
rgba(125, 211, 252, 1) 60%,
rgba(186, 230, 253, 1) 80%,
rgba(224, 242, 254, 0.95) 100%) !important;
position: relative !important;
}
/* 消息区域微妙的蓝青色渐变光效 */
div[class*="md:block"] > div:nth-child(2)::before {
content: '' !important;
position: absolute !important;
top: 0 !important;
left: 0 !important;
right: 0 !important;
bottom: 0 !important;
background: radial-gradient(ellipse at top,
rgba(14, 165, 233, 0.04) 0%,
rgba(6, 182, 212, 0.02) 50%,
transparent 70%) !important;
pointer-events: none !important;
}
/* 消息区域内的所有内容占满宽度并保持在光效上方 */
div[class*="md:block"] > div:nth-child(2) > *,
div[class*="md:block"] > div:nth-child(2) > * > * {
width: 100% !important;
max-width: 100% !important;
box-sizing: border-box !important;
position: relative !important;
z-index: 1 !important;
}
/* 头部区域样式 - 清新简洁 */
div[class*="md:block"] > div:first-child:not(form):not(form *) {
position: relative !important;
z-index: 100 !important;
overflow: visible !important;
padding: 20px 24px !important;
background: rgba(255, 255, 255, 0.2) !important;
border-bottom: none !important;
flex-shrink: 0 !important;
border-radius: 28px 28px 0 0 !important;
backdrop-filter: blur(10px) !important;
min-height: auto !important;
width: 100% !important;
box-sizing: border-box !important;
}
/* ========== 下拉框终极保护 - 最高优先级 ========== */
body > [data-radix-portal],
[data-radix-portal],
[role="listbox"],
[role="menu"],
[data-radix-select-content],
[data-radix-select-viewport],
body > [data-radix-portal] *,
[data-radix-portal] * {
display: revert !important;
visibility: visible !important;
opacity: 1 !important;
pointer-events: auto !important;
position: revert !important;
width: auto !important;
height: auto !important;
left: auto !important;
top: auto !important;
z-index: 99999 !important;
}
/* 确保 Radix Portal 容器正确定位 */
body > [data-radix-portal] {
position: fixed !important;
top: 0 !important;
left: 0 !important;
z-index: 99999 !important;
pointer-events: none !important;
}
body > [data-radix-portal] > * {
pointer-events: auto !important;
}
/* 下拉菜单样式 - 只美化视觉,不影响定位 */
div[role="listbox"],
[data-radix-select-content] {
display: block !important;
visibility: visible !important;
opacity: 1 !important;
background: white !important;
border-radius: 12px !important;
box-shadow: 0 8px 24px rgba(14, 165, 233, 0.25) !important;
border: 1px solid rgba(14, 165, 233, 0.15) !important;
padding: 6px !important;
min-width: 200px !important;
}
/* 下拉菜单项样式 */
div[role="option"],
div[role="menuitem"] {
padding: 12px 16px !important;
border-radius: 10px !important;
cursor: pointer !important;
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
font-size: 14px !important;
color: #2d3748 !important;
margin: 2px 0 !important;
font-weight: 400 !important;
position: relative !important;
overflow: hidden !important;
}
div[role="option"]:hover,
div[role="menuitem"]:hover {
background: linear-gradient(135deg, rgba(14, 165, 233, 0.12) 0%, rgba(6, 182, 212, 0.08) 100%) !important;
transform: translateX(4px) !important;
color: #0ea5e9 !important;
}
div[role="option"][data-state="checked"],
div[role="option"][aria-selected="true"] {
background: linear-gradient(135deg, rgba(14, 165, 233, 0.2) 0%, rgba(6, 182, 212, 0.15) 100%) !important;
color: #0ea5e9 !important;
font-weight: 600 !important;
box-shadow: 0 2px 8px rgba(14, 165, 233, 0.2) !important;
}
/* 对勾样式优化 - 美化原生对勾 */
div[role="option"] svg,
div[role="menuitem"] svg {
color: #0ea5e9 !important;
width: 18px !important;
height: 18px !important;
}
/* 消息列表容器 - 占满宽度 */
div[class*="md:block"] div[class*="space-y"] {
width: 100% !important;
box-sizing: border-box !important;
}
/* 确保所有消息内容可见 - 防止被意外隐藏 */
div[class*="md:block"] div[class*="space-y"] > *,
div[class*="md:block"] div[class*="space-y"] > * > * {
display: block !important;
visibility: visible !important;
opacity: 1 !important;
}
/* 确保消息区域内容不被隐藏 */
div[class*="md:block"] > div:nth-child(2) {
display: flex !important;
flex-direction: column !important;
}
div[class*="md:block"] > div:nth-child(2) * {
visibility: visible !important;
}
/* ========== 隐藏@ 按钮和how-ai-models-work标签(精确版本) ========== */
/* 只隐藏@按钮 - 使用更精确的选择器(保护代码块复制按钮) */
div[class*="md:block"] form button:has(svg):not([type="submit"]):not([role="combobox"]):not([aria-haspopup="listbox"]):not([aria-label*="Agent"]):not([aria-label*="claude"]):not([title*="复制"]):not([title*="Copy"]):not([aria-label*="复制"]):not([aria-label*="Copy"]) {
display: none !important;
visibility: hidden !important;
width: 0 !important;
height: 0 !important;
padding: 0 !important;
margin: 0 !important;
position: absolute !important;
left: -9999px !important;
opacity: 0 !important;
}
/* 只隐藏how-ai-models-work文档标签 - 不使用first-child */
div[class*="md:block"] form [class*="badge"]:not(:has(button[role="combobox"])),
div[class*="md:block"] form [class*="tag"]:not(:has(button[role="combobox"])),
div[class*="md:block"] form span:has(svg[class*="file"]):not(:has(button[role="combobox"])) {
display: none !important;
visibility: hidden !important;
width: 0 !important;
height: 0 !important;
opacity: 0 !important;
position: absolute !important;
left: -9999px !important;
}
/* ========== 代码块复制按钮美化 ========== */
/* 强制显示所有代码块的复制按钮 */
pre button,
pre > div > button,
[class*="code"] button[class*="copy"],
[class*="pre"] button[class*="copy"],
button[title*="复制"],
button[title*="Copy"],
button[aria-label*="复制"],
button[aria-label*="Copy"],
div[class*="md:block"] pre button,
div[class*="md:block"] [class*="code"] button {
display: flex !important;
visibility: visible !important;
opacity: 0.7 !important;
pointer-events: auto !important;
position: absolute !important;
top: 8px !important;
right: 8px !important;
z-index: 100 !important;
width: 28px !important;
height: 28px !important;
min-width: 28px !important;
min-height: 28px !important;
padding: 5px !important;
background: linear-gradient(135deg, rgba(56, 189, 248, 0.9) 0%, rgba(14, 165, 233, 0.9) 100%) !important;
backdrop-filter: blur(10px) !important;
border: 1.5px solid rgba(255, 255, 255, 0.8) !important;
border-radius: 8px !important;
cursor: pointer !important;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
align-items: center !important;
justify-content: center !important;
box-shadow:
0 2px 8px rgba(14, 165, 233, 0.3),
0 0 15px rgba(56, 189, 248, 0.2),
inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
transform-origin: center !important;
overflow: hidden !important;
}
/* 代码块悬停时显示按钮 */
pre:hover button,
[class*="code"]:hover button {
opacity: 1 !important;
background: linear-gradient(135deg, rgba(56, 189, 248, 1) 0%, rgba(14, 165, 233, 1) 100%) !important;
border-color: rgba(255, 255, 255, 1) !important;
box-shadow:
0 6px 16px rgba(14, 165, 233, 0.5),
0 0 30px rgba(56, 189, 248, 0.4),
inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}
/* 按钮自身悬停效果 */
pre button:hover,
[class*="code"] button:hover {
opacity: 1 !important;
background: linear-gradient(135deg, rgba(125, 211, 252, 1) 0%, rgba(56, 189, 248, 1) 100%) !important;
border-color: rgba(255, 255, 255, 1) !important;
transform: translateY(-2px) scale(1.05) !important;
box-shadow:
0 6px 16px rgba(14, 165, 233, 0.5),
0 0 30px rgba(56, 189, 248, 0.4),
inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}
/* 点击时的反馈效果 - 快速自然的按下效果 */
pre button:active,
[class*="code"] button:active {
transform: translateY(0) scale(0.98) !important;
background: linear-gradient(135deg, rgba(14, 165, 233, 1) 0%, rgba(6, 182, 212, 1) 100%) !important;
box-shadow:
0 2px 6px rgba(14, 165, 233, 0.3),
0 0 12px rgba(56, 189, 248, 0.2),
inset 0 2px 4px rgba(0, 0, 0, 0.15) !important;
transition: all 0.08s ease-out !important;
opacity: 0.95 !important;
}
/* 复制成功后的动画效果 - 更流畅的绿色确认 */
pre button.copied,
[class*="code"] button.copied {
background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
border-color: rgba(255, 255, 255, 1) !important;
transform: scale(1) !important;
animation: copy-success 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
box-shadow:
0 4px 16px rgba(16, 185, 129, 0.5),
0 0 24px rgba(16, 185, 129, 0.3),
inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}
@keyframes copy-success {
0% {
transform: scale(1);
opacity: 1;
}
30% {
transform: scale(1.12);
opacity: 1;
}
100% {
transform: scale(1);
opacity: 1;
}
}
/* 代码块容器样式优化 - 保持原始背景色 */
pre,
div[class*="md:block"] pre {
position: relative !important;
padding: 16px !important;
padding-right: 56px !important;
}
/* 不修改代码块的背景色、边框等,保持原样 */
/* 确保复制按钮图标可见且颜色正确 - 缩小尺寸 */
pre button svg,
[class*="code"] button svg {
width: 16px !important;
height: 16px !important;
max-width: 16px !important;
max-height: 16px !important;
min-width: 16px !important;
min-height: 16px !important;
flex-shrink: 0 !important;
display: block !important;
visibility: visible !important;
opacity: 1 !important;
filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3)) !important;
transition: opacity 0.15s, transform 0.15s !important;
}
/* SVG内部元素样式 */
pre button svg *,
[class*="code"] button svg * {
color: #ffffff !important;
fill: currentColor !important;
stroke: currentColor !important;
visibility: visible !important;
opacity: 1 !important;
}
/* 确保按钮内容居中且不重叠 */
pre button *,
[class*="code"] button * {
pointer-events: none !important;
user-select: none !important;
}
/* 当按钮内有多个SVG时(切换图标),使用绝对定位完全重叠 */
pre button svg,
[class*="code"] button svg {
position: absolute !important;
top: 50% !important;
left: 50% !important;
transform: translate(-50%, -50%) !important;
margin: 0 !important;
}
/* 隐藏被替换掉的图标(当复制成功后切换图标时) - 最高优先级 */
pre button svg[style*="display: none"],
pre button svg[style*="display:none"],
pre button svg[hidden],
[class*="code"] button svg[style*="display: none"],
[class*="code"] button svg[style*="display:none"],
[class*="code"] button svg[hidden] {
opacity: 0 !important;
visibility: hidden !important;
display: none !important;
pointer-events: none !important;
z-index: -1 !important;
}
/* 确保只有一个图标可见 - 如果有hidden类,强制隐藏 */
pre button svg.hidden,
[class*="code"] button svg.hidden {
opacity: 0 !important;
visibility: hidden !important;
pointer-events: none !important;
display: none !important;
z-index: -1 !important;
}
/* 当点击复制后,如果按钮内有多个SVG,确保只显示可见的那个 */
pre button:has(svg[hidden]) svg:not([hidden]),
pre button:has(svg.hidden) svg:not(.hidden),
[class*="code"] button:has(svg[hidden]) svg:not([hidden]),
[class*="code"] button:has(svg.hidden) svg:not(.hidden) {
display: block !important;
visibility: visible !important;
opacity: 1 !important;
z-index: 10 !important;
}
/* ========== 美化模型选择器和Agent标签 ========== */
/* 强制显示combobox及其容器 - 最高优先级 超级强力版本 */
button[role="combobox"],
button[aria-haspopup="listbox"],
form button[role="combobox"],
form button[aria-haspopup="listbox"] {
display: inline-flex !important;
visibility: visible !important;
opacity: 1 !important;
width: auto !important;
height: auto !important;
min-width: auto !important;
min-height: auto !important;
max-width: none !important;
max-height: none !important;
position: relative !important;
left: 0 !important;
right: 0 !important;
top: 0 !important;
bottom: 0 !important;
pointer-events: auto !important;
clip-path: none !important;
overflow: visible !important;
margin: 0 !important;
}
/* 强制显示combobox的所有父容器 */
div:has(> button[role="combobox"]),
div:has(> button[aria-haspopup="listbox"]),
form > div:has(button[role="combobox"]),
form div:has(button[role="combobox"]) {
display: flex !important;
visibility: visible !important;
opacity: 1 !important;
width: auto !important;
height: auto !important;
min-width: auto !important;
min-height: auto !important;
position: relative !important;
left: 0 !important;
pointer-events: auto !important;
overflow: visible !important;
}
/* 超级强力规则:移除所有可能隐藏combobox的类 */
button[role="combobox"].tm-hidden,
div:has(> button[role="combobox"]).tm-hidden {
display: flex !important;
visibility: visible !important;
opacity: 1 !important;
position: relative !important;
left: 0 !important;
}
/* Agent标签美化 */
div[class*="md:block"] form > div:has(button[role="combobox"]) {
display: flex !important;
align-items: center !important;
gap: 8px !important;
padding: 8px 12px !important;
background: linear-gradient(135deg, rgba(14, 165, 233, 0.08) 0%, rgba(6, 182, 212, 0.08) 100%) !important;
border-radius: 12px !important;
border: 1px solid rgba(14, 165, 233, 0.2) !important;
margin-bottom: 12px !important;
}
/* 选择器按钮美化 - 清爽蓝色风格 */
button[role="combobox"],
button[aria-haspopup="listbox"] {
background: rgba(255, 255, 255, 0.12) !important;
border: 1.5px solid rgba(14, 165, 233, 0.3) !important;
border-radius: 10px !important;
padding: 6px 14px !important;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
color: #0c4a6e !important;
font-weight: 600 !important;
font-size: 13px !important;
box-shadow: 0 2px 6px rgba(14, 165, 233, 0.15) !important;
backdrop-filter: blur(10px) !important;
text-shadow: none !important;
cursor: pointer !important;
}
button[role="combobox"]:hover,
button[aria-haspopup="listbox"]:hover {
background: rgba(255, 255, 255, 0.2) !important;
border-color: rgba(14, 165, 233, 0.5) !important;
box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25) !important;
transform: translateY(-1px) !important;
color: #0ea5e9 !important;
}
button[role="combobox"]:focus,
button[aria-haspopup="listbox"]:focus {
outline: none !important;
border-color: rgba(14, 165, 233, 0.6) !important;
box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15) !important;
color: #0ea5e9 !important;
}
/* Agent文字标签美化 */
div[class*="md:block"] form > div:has(button[role="combobox"]) > span,
div[class*="md:block"] form > div:has(button[role="combobox"]) > div:first-child {
color: #0c4a6e !important;
font-weight: 600 !important;
font-size: 13px !important;
letter-spacing: 0.5px !important;
}
/* 内容显示后的效果 */
body.tm-ready > * {
opacity: 1 !important;
transition: opacity 0.4s ease-in !important;
}
/* overflow-hidden 背景样式 - 清爽蓝色渐变 */
.overflow-hidden {
background: linear-gradient(135deg,
#e0f2fe 0%,
#dbeafe 20%,
#bae6fd 40%,
#7dd3fc 60%,
#bfdbfe 80%,
#93c5fd 100%) !important;
position: relative !important;
}
/* overflow-hidden 添加微妙网格效果 */
.overflow-hidden::before {
content: '' !important;
position: absolute !important;
top: 0 !important;
left: 0 !important;
width: 100% !important;
height: 100% !important;
background-image:
linear-gradient(rgba(14, 165, 233, 0.05) 1px, transparent 1px),
linear-gradient(90deg, rgba(14, 165, 233, 0.05) 1px, transparent 1px) !important;
background-size: 50px 50px !important;
pointer-events: none !important;
z-index: 0 !important;
}
/* overflow-hidden 内的子元素保持在上层 */
.overflow-hidden > * {
position: relative !important;
z-index: 1 !important;
}
/* 滚动条美化 - 清爽蓝色系 */
::-webkit-scrollbar {
width: 10px;
}
::-webkit-scrollbar-track {
background: linear-gradient(180deg, #e0f2fe 0%, #dbeafe 50%, #bae6fd 100%);
border-radius: 10px;
}
::-webkit-scrollbar-thumb {
background: linear-gradient(180deg, #7dd3fc 0%, #38bdf8 50%, #0ea5e9 100%);
border-radius: 10px;
border: 2px solid rgba(255, 255, 255, 0.3);
transition: all 0.3s ease;
}
::-webkit-scrollbar-thumb:hover {
background: linear-gradient(180deg, #38bdf8 0%, #0ea5e9 50%, #0284c7 100%);
border-color: rgba(255, 255, 255, 0.5);
box-shadow: 0 0 10px rgba(14, 165, 233, 0.5);
}
::-webkit-scrollbar-thumb:active {
background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%);
}
`;
document.head.appendChild(style);
console.log('[Cursor优化] 主样式已注入');
}
// 智能隐藏不需要的内容 - 仅在初始化时执行一次
function hideUnwantedContent() {
let hiddenCount = 0;
// 遍历所有div元素
document.querySelectorAll('div').forEach(el => {
// 已经隐藏的跳过
if (el.classList.contains('tm-hidden')) return;
const text = el.textContent || '';
// 保护关键区域:包含输入框、按钮、Agent、聊天内容、header的不隐藏
if (el.querySelector('textarea') ||
el.querySelector('button[type="submit"]') ||
el.querySelector('[class*="md:block"]') ||
el.id === 'tm-tech-header' ||
el.closest('#tm-tech-header') ||
text.includes('就文档提问') ||
text.includes('Agent') ||
text.includes('claude') ||
el.querySelector('button[role="combobox"]') ||
el.closest('[class*="md:block"]')) {
return;
}
// 判断是否是左侧导航栏(只在初始化时检查)
const isLeftNav = text.includes('AI 基础') &&
text.includes('幻觉与限制') &&
text.includes('即将推出');
// 判断是否是教程内容(需要满足多个条件)
const tutorialMarkers = [
'AI 模型如何工作',
'AI模型如何工作',
'确定性 vs 概率性',
'GPT-5',
'Ideal Model'
];
let markerCount = 0;
tutorialMarkers.forEach(marker => {
if (text.includes(marker)) markerCount++;
});
const isTutorial = markerCount >= 2;
// 判断是否包含视频
const hasVideo = el.querySelector('video') !== null;
// 如果是左侧导航或教程内容,则隐藏
if (isLeftNav || isTutorial || hasVideo) {
// 检查宽度,确保不是主内容区
const width = el.offsetWidth;
if (isLeftNav && width < 500) {
el.classList.add('tm-hidden');
hiddenCount++;
console.log('[Cursor优化] 已隐藏左侧导航栏');
} else if (isTutorial || hasVideo) {
// 向上查找合适的容器
let target = el;
let parent = el.parentElement;
let depth = 0;
while (parent && parent !== document.body && depth < 8) {
const parentText = parent.textContent || '';
// 如果父元素也包含教程内容,继续向上
if ((parentText.includes('AI 模型如何工作') || parentText.includes('确定性 vs 概率性')) &&
!parent.querySelector('textarea')) {
target = parent;
} else {
break;
}
parent = parent.parentElement;
depth++;
}
// 最终检查:确保不会隐藏输入框区域和聊天区域
if (!target.querySelector('textarea') &&
!target.querySelector('button[type="submit"]') &&
!target.querySelector('[class*="md:block"]') &&
!target.closest('[class*="md:block"]')) {
target.classList.add('tm-hidden');
hiddenCount++;
console.log('[Cursor优化] 已隐藏教程内容');
}
}
}
});
console.log(`[Cursor优化] 共隐藏 ${hiddenCount} 个区域`);
return hiddenCount;
}
// 超级强力隐藏左侧Panel和所有侧边栏 - 终极版本(保护下拉框)
function forceHideLeftPanels() {
let hiddenCount = 0;
// 1. 隐藏所有data-panel属性的元素(排除主聊天区和下拉框)
document.querySelectorAll('[data-panel]').forEach(panel => {
// 排除主聊天区域、下拉框、combobox、以及header相关元素
if (!panel.querySelector('[class*="md:block"]') &&
!panel.querySelector('form') &&
!panel.querySelector('textarea') &&
!panel.closest('[class*="md:block"]') &&
!panel.hasAttribute('data-radix-portal') &&
!panel.closest('[data-radix-portal]') &&
!panel.closest('#tm-tech-header') &&
panel.id !== 'tm-tech-header' &&
panel.getAttribute('role') !== 'listbox' &&
panel.getAttribute('role') !== 'menu' &&
panel.getAttribute('role') !== 'combobox' &&
!panel.querySelector('[role="listbox"]') &&
!panel.querySelector('[role="menu"]') &&
!panel.querySelector('[role="combobox"]') &&
!panel.querySelector('button[role="combobox"]') &&
!panel.querySelector('[data-radix-select-content]')) {
const rect = panel.getBoundingClientRect();
const windowWidth = window.innerWidth;
// 隐藏左侧的所有panel(x坐标 < 窗口中心-500)
if (rect.width > 0 && rect.left < (windowWidth / 2 - 500)) {
panel.style.cssText = `
display: none !important;
width: 0 !important;
min-width: 0 !important;
max-width: 0 !important;
height: 0 !important;
min-height: 0 !important;
max-height: 0 !important;
opacity: 0 !important;
visibility: hidden !important;
pointer-events: none !important;
position: absolute !important;
left: -9999px !important;
top: -9999px !important;
z-index: -9999 !important;
overflow: hidden !important;
padding: 0 !important;
margin: 0 !important;
border: none !important;
flex: 0 0 0 !important;
`;
panel.classList.add('tm-hidden');
hiddenCount++;
console.log('[Cursor优化] 隐藏左侧panel:', rect.left, rect.width);
}
}
});
// 2. 暴力隐藏所有左侧的div(检测位置,保护下拉框)
document.querySelectorAll('body > div > div > div:first-child').forEach(div => {
if (!div.querySelector('[class*="md:block"]') &&
!div.querySelector('form') &&
!div.querySelector('textarea') &&
!div.hasAttribute('data-radix-portal') &&
!div.closest('[data-radix-portal]') &&
!div.closest('#tm-tech-header') &&
div.id !== 'tm-tech-header' &&
div.getAttribute('role') !== 'listbox' &&
div.getAttribute('role') !== 'menu' &&
!div.querySelector('[role="listbox"]') &&
!div.querySelector('[role="menu"]') &&
!div.querySelector('[data-radix-select-content]')) {
const rect = div.getBoundingClientRect();
const windowWidth = window.innerWidth;
// 如果在左侧且不是主聊天区
if (rect.width > 0 && rect.width < 600 && rect.left < (windowWidth / 2 - 400)) {
div.style.cssText = `
display: none !important;
width: 0 !important;
height: 0 !important;
opacity: 0 !important;
visibility: hidden !important;
pointer-events: none !important;
position: absolute !important;
left: -9999px !important;
`;
div.classList.add('tm-hidden');
hiddenCount++;
console.log('[Cursor优化] 隐藏左侧div:', rect.left, rect.width);
}
}
});
// 3. 隐藏所有可能的侧边栏按钮(保护下拉框内的按钮)
const buttonSelectors = [
'button[aria-label*="sidebar"]',
'button[aria-label*="Sidebar"]',
'button[aria-label*="panel"]',
'button[aria-label*="Panel"]',
'button[aria-label*="Toggle"]',
'button[aria-label*="toggle"]',
'button:has(svg[class*="lucide"])',
];
buttonSelectors.forEach(selector => {
try {
document.querySelectorAll(selector).forEach(btn => {
// 不隐藏提交按钮、表单内按钮、下拉框内按钮、以及header内按钮
if (btn.type !== 'submit' &&
!btn.closest('form') &&
!btn.closest('[data-radix-portal]') &&
!btn.closest('#tm-tech-header') &&
!btn.closest('[role="listbox"]') &&
!btn.closest('[role="menu"]') &&
!btn.closest('[data-radix-select-content]')) {
const rect = btn.getBoundingClientRect();
// 只隐藏左侧的按钮(x < 200)
if (rect.left < 200) {
btn.style.cssText = 'display: none !important; visibility: hidden !important; opacity: 0 !important; pointer-events: none !important;';
btn.classList.add('tm-hidden');
hiddenCount++;
// console.log('[Cursor优化] 隐藏左侧按钮:', rect.left);
}
}
});
} catch (e) {
console.log('[Cursor优化] 隐藏按钮错误:', e.message);
}
});
// 4. 额外检查:隐藏所有宽度在30-400之间,且位于最左侧的div(保护下拉框)
document.querySelectorAll('div').forEach(div => {
const rect = div.getBoundingClientRect();
const computedStyle = window.getComputedStyle(div);
// 只处理可见元素,排除下拉框和header
if (computedStyle.display !== 'none' &&
computedStyle.visibility !== 'hidden' &&
rect.width > 30 && rect.width < 400 &&
rect.left < 100 &&
rect.height > 300 &&
!div.querySelector('[class*="md:block"]') &&
!div.querySelector('form') &&
!div.querySelector('textarea') &&
!div.classList.contains('tm-hidden') &&
!div.hasAttribute('data-radix-portal') &&
!div.closest('[data-radix-portal]') &&
!div.closest('#tm-tech-header') &&
div.id !== 'tm-tech-header' &&
div.getAttribute('role') !== 'listbox' &&
div.getAttribute('role') !== 'menu' &&
!div.querySelector('[role="listbox"]') &&
!div.querySelector('[role="menu"]') &&
!div.querySelector('[data-radix-select-content]')) {
div.style.cssText = 'display: none !important;';
div.classList.add('tm-hidden');
hiddenCount++;
// console.log('[Cursor优化] 额外隐藏左侧元素:', rect.left, rect.width, rect.height);
}
});
if (hiddenCount > 0) {
// console.log(`[Cursor优化] ✅ 强力隐藏了 ${hiddenCount} 个左侧元素`);
}
return hiddenCount;
}
// 禁用拖动手柄移除功能(暂时不使用,避免误删)
function removeResizeHandles() {
// 暂时禁用,避免误删重要元素
return;
}
// 创建高端科技感头部导航栏(带天气和日期)
function createTechHeader() {
const header = document.createElement('div');
header.id = 'tm-tech-header';
// 获取当前时间和日期
function updateDateTime() {
const now = new Date();
const time = now.toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' });
const date = now.toLocaleDateString('zh-CN', { month: 'long', day: 'numeric', weekday: 'short' });
document.getElementById('tm-time').textContent = time;
document.getElementById('tm-date').textContent = date;
}
header.innerHTML = `
<canvas id="tm-header-particles"></canvas>
<div class="tm-header-content">
<div class="tm-header-left">
<div class="tm-logo">
<div class="tm-logo-icon">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z"/>
</svg>
</div>
<div class="tm-logo-text">
<div class="tm-logo-title">Cursor AI</div>
<div class="tm-logo-subtitle">智能助手</div>
</div>
</div>
</div>
<div class="tm-header-center">
<div class="tm-datetime">
<div class="tm-time" id="tm-time">00:00</div>
<div class="tm-date" id="tm-date">Loading...</div>
</div>
</div>
<div class="tm-header-right">
<div class="tm-weather">
<div class="tm-weather-icon">🌤️</div>
<div class="tm-weather-info">
<div class="tm-weather-temp">22°C</div>
<div class="tm-weather-desc">晴朗</div>
</div>
</div>
<div class="tm-status-indicator">
<div class="tm-status-dot"></div>
<span class="tm-status-text">在线</span>
</div>
</div>
</div>
<div class="tm-header-glow"></div>
`;
// 定时更新时间
setTimeout(() => {
updateDateTime();
setInterval(updateDateTime, 1000);
}, 100);
// 添加粒子动画canvas
setTimeout(() => {
const canvas = document.getElementById('tm-header-particles');
if (!canvas) return;
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = 70;
const particles = [];
for (let i = 0; i < 50; i++) {
particles.push({
x: Math.random() * canvas.width,
y: Math.random() * canvas.height,
vx: (Math.random() - 0.5) * 0.5,
vy: (Math.random() - 0.5) * 0.5,
size: Math.random() * 2
});
}
function animate() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = 'rgba(255, 255, 255, 0.3)';
particles.forEach(p => {
p.x += p.vx;
p.y += p.vy;
if (p.x < 0 || p.x > canvas.width) p.vx *= -1;
if (p.y < 0 || p.y > canvas.height) p.vy *= -1;
ctx.beginPath();
ctx.arc(p.x, p.y, p.size, 0, Math.PI * 2);
ctx.fill();
});
requestAnimationFrame(animate);
}
animate();
}, 200);
// 添加样式
const style = document.createElement('style');
style.textContent = `
#tm-tech-header {
position: fixed !important;
top: 0 !important;
left: 0 !important;
width: 100% !important;
height: 70px !important;
background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 50%, #7dd3fc 100%) !important;
z-index: 2147483647 !important;
box-shadow: 0 8px 32px rgba(14, 165, 233, 0.3) !important;
animation: tm-header-slide-down 0.8s cubic-bezier(0.4, 0, 0.2, 1) !important;
overflow: hidden !important;
display: block !important;
visibility: visible !important;
opacity: 1 !important;
}
#tm-header-particles {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
opacity: 0.4;
}
@keyframes tm-header-slide-down {
from {
transform: translateY(-100%);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
.tm-header-content {
max-width: 1200px !important;
margin: 0 auto !important;
height: 100% !important;
display: flex !important;
align-items: center !important;
justify-content: space-between !important;
padding: 0 30px !important;
position: relative !important;
z-index: 2 !important;
visibility: visible !important;
opacity: 1 !important;
}
.tm-header-left,
.tm-header-center,
.tm-header-right {
display: flex !important;
align-items: center !important;
visibility: visible !important;
opacity: 1 !important;
}
.tm-logo {
display: flex !important;
align-items: center !important;
gap: 15px !important;
cursor: pointer !important;
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
visibility: visible !important;
opacity: 1 !important;
}
.tm-logo:hover {
transform: translateY(-2px) scale(1.03) !important;
filter: drop-shadow(0 4px 12px rgba(255, 255, 255, 0.3)) !important;
}
.tm-logo-icon {
width: 42px !important;
height: 42px !important;
background: linear-gradient(135deg, rgba(14, 165, 233, 0.5), rgba(6, 182, 212, 0.5)) !important;
border-radius: 12px !important;
display: flex !important;
align-items: center !important;
justify-content: center !important;
color: #fff !important;
backdrop-filter: blur(10px) !important;
border: 2px solid rgba(255, 255, 255, 0.4) !important;
animation: tm-logo-pulse 3s ease-in-out infinite !important;
position: relative !important;
overflow: hidden !important;
visibility: visible !important;
opacity: 1 !important;
}
.tm-logo-icon svg {
width: 24px !important;
height: 24px !important;
position: relative !important;
z-index: 1 !important;
display: block !important;
visibility: visible !important;
opacity: 1 !important;
}
.tm-logo-icon::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
transform: rotate(45deg);
animation: tm-shine 3s linear infinite;
}
@keyframes tm-logo-pulse {
0%, 100% {
box-shadow: 0 0 20px rgba(14, 165, 233, 0.5), 0 0 40px rgba(6, 182, 212, 0.3);
}
50% {
box-shadow: 0 0 30px rgba(14, 165, 233, 0.8), 0 0 60px rgba(6, 182, 212, 0.5);
}
}
@keyframes tm-shine {
0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}
.tm-logo-text {
display: flex !important;
flex-direction: column !important;
gap: 2px !important;
visibility: visible !important;
opacity: 1 !important;
}
.tm-logo-title {
font-size: 20px !important;
font-weight: 700 !important;
color: #ffffff !important;
letter-spacing: 1px !important;
text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
background: linear-gradient(135deg, #0c4a6e, #0369a1) !important;
-webkit-background-clip: text !important;
-webkit-text-fill-color: transparent !important;
background-clip: text !important;
display: block !important;
visibility: visible !important;
opacity: 1 !important;
}
.tm-logo-subtitle {
font-size: 11px !important;
font-weight: 500 !important;
color: rgba(12, 74, 110, 0.8) !important;
letter-spacing: 2px !important;
display: block !important;
visibility: visible !important;
opacity: 1 !important;
}
/* 最高优先级:强制显示header所有元素 */
#tm-tech-header,
#tm-tech-header *,
.tm-header-content,
.tm-header-left,
.tm-logo,
.tm-logo-icon,
.tm-logo-icon svg,
.tm-logo-text,
.tm-logo-title,
.tm-logo-subtitle {
visibility: visible !important;
opacity: 1 !important;
pointer-events: auto !important;
}
.tm-datetime {
display: flex;
flex-direction: column;
align-items: center;
gap: 2px;
}
.tm-time {
font-size: 28px;
font-weight: 700;
color: #0c4a6e;
letter-spacing: 2px;
text-shadow: 0 2px 8px rgba(255, 255, 255, 0.5);
font-family: 'Monaco', 'Courier New', monospace;
}
.tm-date {
font-size: 12px;
color: rgba(12, 74, 110, 0.8);
letter-spacing: 1px;
}
.tm-weather {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 16px;
background: rgba(255, 255, 255, 0.4);
border-radius: 16px;
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.5);
margin-right: 15px;
transition: all 0.3s ease;
}
.tm-weather:hover {
background: rgba(255, 255, 255, 0.5);
transform: translateY(-2px);
}
.tm-weather-icon {
font-size: 24px;
animation: tm-weather-bob 3s ease-in-out infinite;
}
@keyframes tm-weather-bob {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-3px); }
}
.tm-weather-info {
display: flex;
flex-direction: column;
gap: 1px;
}
.tm-weather-temp {
font-size: 16px;
font-weight: 600;
color: #0c4a6e;
}
.tm-weather-desc {
font-size: 11px;
color: rgba(12, 74, 110, 0.7);
}
.tm-status-indicator {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 16px;
background: rgba(255, 255, 255, 0.4);
border-radius: 20px;
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.5);
}
.tm-status-dot {
width: 8px;
height: 8px;
background: #10b981;
border-radius: 50%;
animation: tm-blink 2s ease-in-out infinite;
box-shadow: 0 0 10px #10b981;
}
@keyframes tm-blink {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}
.tm-status-text {
font-size: 13px;
color: #0c4a6e;
font-weight: 500;
}
.tm-stats {
display: flex;
gap: 20px;
}
.tm-stat-item {
display: flex;
align-items: center;
gap: 6px;
padding: 6px 12px;
background: rgba(255, 255, 255, 0.15);
border-radius: 12px;
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
transition: all 0.3s ease;
}
.tm-stat-item:hover {
background: rgba(255, 255, 255, 0.25);
transform: translateY(-2px);
}
.tm-stat-icon {
font-size: 16px;
}
.tm-stat-value {
font-size: 13px;
color: #ffffff;
font-weight: 500;
}
.tm-header-glow {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 2px;
background: linear-gradient(90deg,
transparent 0%,
rgba(255, 255, 255, 0.5) 50%,
transparent 100%);
animation: tm-glow-move 3s ease-in-out infinite;
}
@keyframes tm-glow-move {
0%, 100% {
transform: translateX(-100%);
}
50% {
transform: translateX(100%);
}
}
`;
document.head.appendChild(style);
document.body.insertBefore(header, document.body.firstChild);
console.log('[Cursor优化] 科技感头部已创建');
// 验证header是否真的插入成功
setTimeout(() => {
const insertedHeader = document.getElementById('tm-tech-header');
if (insertedHeader) {
console.log('[Cursor优化] ✅ Header已成功插入DOM');
console.log('[Cursor优化] Header display:', window.getComputedStyle(insertedHeader).display);
console.log('[Cursor优化] Header visibility:', window.getComputedStyle(insertedHeader).visibility);
console.log('[Cursor优化] Header opacity:', window.getComputedStyle(insertedHeader).opacity);
console.log('[Cursor优化] Header z-index:', window.getComputedStyle(insertedHeader).zIndex);
const logo = insertedHeader.querySelector('.tm-logo');
if (logo) {
console.log('[Cursor优化] ✅ Logo元素存在');
console.log('[Cursor优化] Logo display:', window.getComputedStyle(logo).display);
console.log('[Cursor优化] Logo visibility:', window.getComputedStyle(logo).visibility);
console.log('[Cursor优化] Logo opacity:', window.getComputedStyle(logo).opacity);
} else {
console.error('[Cursor优化] ❌ Logo元素不存在!');
}
} else {
console.error('[Cursor优化] ❌ Header未能插入到DOM!');
}
}, 100);
}
// 立即创建Loading遮罩层 - 超酷炫版本
function createLoadingOverlay() {
const overlay = document.createElement('div');
overlay.id = 'tm-loading-overlay';
overlay.innerHTML = `
<div class="tm-loader-container">
<div class="tm-loader">
<div class="tm-loader-center">
<div class="tm-loader-icon">⚡</div>
</div>
</div>
</div>
<div class="tm-loading-text">正在加载中...</div>
<div class="tm-progress-container">
<div class="tm-progress-bar"></div>
</div>
<div class="tm-loading-tip">Cursor AI 正在为您优化界面体验</div>
`;
document.body.appendChild(overlay);
console.log('[Cursor优化] Loading遮罩已显示');
return overlay;
}
// 移除Loading遮罩层
function removeLoadingOverlay() {
const overlay = document.getElementById('tm-loading-overlay');
if (overlay) {
overlay.classList.add('tm-fade-out');
setTimeout(() => {
overlay.remove();
document.body.classList.add('tm-ready');
// 移除loading样式
const loadingStyle = document.getElementById('tm-loading-style');
if (loadingStyle) {
loadingStyle.remove();
}
console.log('[Cursor优化] Loading遮罩已移除,页面已显示');
}, 500);
}
}
// 自动展开聊天侧边栏
async function autoExpandSidebar() {
return new Promise((resolve) => {
const checkInterval = setInterval(() => {
const expandBtn = document.querySelector('button[title="Expand Chat Sidebar"]');
if (expandBtn && !expandBtn.disabled) {
try {
expandBtn.click();
console.log('[Cursor优化] 聊天侧边栏已展开');
clearInterval(checkInterval);
resolve(true);
} catch (e) {
console.log('[Cursor优化] 展开失败:', e);
}
}
}, 500);
// 5秒超时
setTimeout(() => {
clearInterval(checkInterval);
resolve(false);
}, 5000);
});
}
// 强制显示combobox - 超级强力版本
function forceShowCombobox() {
// 查找所有combobox按钮
const comboboxButtons = document.querySelectorAll('button[role="combobox"], button[aria-haspopup="listbox"]');
if (comboboxButtons.length > 0) {
console.log(`[Cursor优化] 找到 ${comboboxButtons.length} 个combobox按钮`);
comboboxButtons.forEach((btn, index) => {
// 移除所有可能的隐藏类
btn.classList.remove('tm-hidden', 'hidden');
// 强制设置显示样式
btn.style.cssText = `
display: inline-flex !important;
visibility: visible !important;
opacity: 1 !important;
position: relative !important;
width: auto !important;
height: auto !important;
`;
// 强制显示所有父容器
let parent = btn.parentElement;
let level = 0;
while (parent && level < 5) {
parent.classList.remove('tm-hidden', 'hidden');
parent.style.cssText = `
display: flex !important;
visibility: visible !important;
opacity: 1 !important;
position: relative !important;
width: auto !important;
height: auto !important;
`;
parent = parent.parentElement;
level++;
}
console.log(`[Cursor优化] 已强制显示combobox #${index + 1}:`, btn.textContent);
});
} else {
// console.log('[Cursor优化] 未找到combobox按钮,将在1秒后重试');
setTimeout(forceShowCombobox, 1000);
}
}
// 强制显示代码块复制按钮 - 优化版
let copyButtonCheckTimer = null;
function forceShowCopyButtons(immediate = false) {
// 如果不是立即执行,使用防抖
if (!immediate && copyButtonCheckTimer) {
return;
}
if (!immediate) {
copyButtonCheckTimer = setTimeout(() => {
copyButtonCheckTimer = null;
}, 30);
}
// 查找所有代码块内的按钮
const copyButtons = document.querySelectorAll(
'pre button, pre > div > button, [class*="code"] button, button[title*="复制"], button[title*="Copy"], button[aria-label*="复制"], button[aria-label*="Copy"]'
);
if (copyButtons.length > 0) {
let shownCount = 0;
copyButtons.forEach((btn) => {
// 检查是否在代码块内
const inPre = btn.closest('pre') || btn.closest('[class*="code"]');
if (inPre) {
// 移除隐藏类
btn.classList.remove('tm-hidden', 'hidden');
// 确保按钮可见(不使用内联样式,让CSS样式生效)
if (btn.style.display === 'none' || btn.style.visibility === 'hidden') {
btn.style.cssText = '';
}
// 修复图标重叠问题:确保按钮内只显示一个图标
const svgs = btn.querySelectorAll('svg');
if (svgs.length > 0) {
let visibleSvg = null;
let hiddenSvgs = [];
// 找出哪个SVG应该显示 - 更精准的判断
svgs.forEach((svg) => {
const computedStyle = window.getComputedStyle(svg);
const hasHiddenAttr = svg.hasAttribute('hidden');
const hasHiddenClass = svg.classList.contains('hidden');
const styleDisplay = svg.style.display;
const computedDisplay = computedStyle.display;
const computedVisibility = computedStyle.visibility;
const computedOpacity = computedStyle.opacity;
// 判断是否被隐藏
const isHidden = hasHiddenAttr ||
hasHiddenClass ||
styleDisplay === 'none' ||
computedDisplay === 'none' ||
computedVisibility === 'hidden' ||
parseFloat(computedOpacity) < 0.1;
if (isHidden) {
hiddenSvgs.push(svg);
} else if (!visibleSvg) {
visibleSvg = svg;
} else {
// 如果有多个可见的SVG,后面的也要隐藏
hiddenSvgs.push(svg);
}
});
// 强制隐藏应该被隐藏的SVG
hiddenSvgs.forEach((svg) => {
if (!svg.style.cssText.includes('display: none')) {
svg.style.cssText = 'display: none !important; opacity: 0 !important; visibility: hidden !important; pointer-events: none !important; position: absolute !important;';
}
});
// 确保可见的SVG完全显示
if (visibleSvg && visibleSvg.style.display === 'none') {
visibleSvg.style.cssText = '';
}
}
shownCount++;
}
});
if (shownCount > 0) {
// console.log(`[Cursor优化] 已确保 ${shownCount} 个代码块复制按钮可见`);
}
}
}
// 主初始化函数
async function init() {
console.log('[Cursor优化] ========== 脚本启动 ==========');
// 1. 最优先:注入Loading样式和显示Loading
injectLoadingStylesImmediately();
createLoadingOverlay();
// 2. 注入主样式
injectMainStyles();
// 2.5 立即开始隐藏左侧Panel(在页面加载早期)
setTimeout(() => forceHideLeftPanels(), 50);
setTimeout(() => forceHideLeftPanels(), 200);
// 3. 等待页面基本加载
await new Promise(resolve => setTimeout(resolve, 1000));
// 4. 自动展开侧边栏
await autoExpandSidebar();
// 5. 隐藏不需要的内容(只执行一次,避免影响后续内容)
console.log('[Cursor优化] 开始清理页面...');
hideUnwantedContent();
// 5.5 强力隐藏左侧Panel(立即执行多次)
forceHideLeftPanels();
setTimeout(() => forceHideLeftPanels(), 100);
setTimeout(() => forceHideLeftPanels(), 300);
setTimeout(() => forceHideLeftPanels(), 500);
setTimeout(() => forceHideLeftPanels(), 800);
setTimeout(() => forceHideLeftPanels(), 1200);
setTimeout(() => forceHideLeftPanels(), 1500);
setTimeout(() => forceHideLeftPanels(), 2000);
setTimeout(() => forceHideLeftPanels(), 3000);
// 6. 创建上传按钮
await new Promise(resolve => setTimeout(resolve, 500));
createUploadButton();
// 7. 移除Loading遮罩,显示优化后的页面
await new Promise(resolve => setTimeout(resolve, 400));
removeLoadingOverlay();
// 7.5 强制显示combobox(立即执行多次)
setTimeout(() => forceShowCombobox(), 100);
setTimeout(() => forceShowCombobox(), 300);
setTimeout(() => forceShowCombobox(), 600);
setTimeout(() => forceShowCombobox(), 1000);
setTimeout(() => forceShowCombobox(), 1500);
setTimeout(() => forceShowCombobox(), 2000);
setTimeout(() => forceShowCombobox(), 3000);
// 7.6 强制显示代码块复制按钮(立即执行多次)
setTimeout(() => forceShowCopyButtons(), 100);
setTimeout(() => forceShowCopyButtons(), 500);
setTimeout(() => forceShowCopyButtons(), 1000);
setTimeout(() => forceShowCopyButtons(), 2000);
setTimeout(() => forceShowCopyButtons(), 3000);
// 8. 创建科技感头部导航栏
createTechHeader();
// 9. 持续监控并隐藏左侧Panel + 显示combobox + 显示复制按钮(高频监控)
let panelCheckCount = 0;
const panelCheckInterval = setInterval(() => {
const hidden = forceHideLeftPanels();
forceShowCombobox(); // 同时确保combobox显示
forceShowCopyButtons(); // 同时确保代码块复制按钮显示
panelCheckCount++;
// 前15秒每500ms检查一次(高频)
if (panelCheckCount <= 30) {
// 继续高频检查
}
// 之后每秒检查一次,持续到60秒
else if (panelCheckCount <= 90) {
// 继续检查
}
// 60秒后停止
else {
clearInterval(panelCheckInterval);
console.log('[Cursor优化] 停止左侧Panel和combobox检查');
}
}, 500); // 改为500ms检查一次
// 10. 使用MutationObserver实时监控DOM变化
const leftPanelObserver = new MutationObserver((mutations) => {
// 节流:最多每200ms处理一次
if (!window.lastPanelHideTime || Date.now() - window.lastPanelHideTime > 200) {
window.lastPanelHideTime = Date.now();
forceHideLeftPanels();
forceShowCombobox(); // 同时确保combobox显示
}
// 复制按钮需要更高频率检查(每50ms)
if (!window.lastCopyButtonCheckTime || Date.now() - window.lastCopyButtonCheckTime > 50) {
window.lastCopyButtonCheckTime = Date.now();
forceShowCopyButtons(); // 确保代码块复制按钮显示且图标不重叠
}
});
// 监控body的子树变化
leftPanelObserver.observe(document.body, {
childList: true,
subtree: true,
attributes: true,
attributeFilter: ['style', 'class', 'hidden']
});
// 11. 添加点击事件监听,实时处理复制按钮的图标切换
document.addEventListener('click', (e) => {
// 检查是否点击了代码块的复制按钮
const btn = e.target.closest('pre button, [class*="code"] button');
if (btn) {
// 立即处理一次(强制执行)
requestAnimationFrame(() => {
forceShowCopyButtons(true);
});
// 延迟处理,等待网站原生的图标切换完成(缩短延迟)
setTimeout(() => {
forceShowCopyButtons(true);
}, 25);
// 最后再确认一次
setTimeout(() => {
forceShowCopyButtons(true);
}, 120);
// 最终确认(确保稳定)
setTimeout(() => {
forceShowCopyButtons(true);
}, 300);
}
}, true); // 使用捕获阶段,更早拦截事件
console.log('[Cursor优化] 已添加复制按钮点击监听');
// 60秒后停止MutationObserver
setTimeout(() => {
leftPanelObserver.disconnect();
console.log('[Cursor优化] 停止MutationObserver监控');
}, 60000);
console.log('[Cursor优化] 初始化完成,实时监控左侧Panel中...');
console.log('[Cursor优化] ========== 初始化完成 ==========');
}
// 立即启动脚本(不等待任何事件)
// 这样可以确保Loading在最开始就显示
if (document.body) {
// body已经存在,立即执行
init();
} else {
// body还不存在,等待body创建
const observer = new MutationObserver(() => {
if (document.body) {
observer.disconnect();
init();
}
});
observer.observe(document.documentElement, { childList: true });
}
})();
复制到在线剪切板再发出来
好像很早就有这个了!
优化了页面啥的 还有上传
不完整吧
不能用啊
可以打压缩包发出来
把两个都复制到油猴里就能用了
这个资源消耗是不是太大了。打开之后就卡了
cursor.zip (19.2 KB)
无法切换模型
感谢大佬
佬,你这个脚本对话记录持久化用什么存储?也是localstorage吗?这个好像有5MB容量上限!
我最近已经触碰到这个限制了,一直在拷打AI去改,但是编程功底不太行,一直改不成功!
感谢佬友