Greasy Fork

来自缓存

Greasy Fork is available in English.

DeepSeek清空历史记录

在历史记录页面右上角“清空历史记录”,点击后清空所有历史记录

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         DeepSeek清空历史记录
// @version      0.7
// @description  在历史记录页面右上角“清空历史记录”,点击后清空所有历史记录
// @author       Yu1978
// @match        https://chat.deepseek.com/*
// @grant        none
// @namespace http://greasyfork.icu/users/1440235
// ==/UserScript==
(function() {
    'use strict';
 
    const startButton = document.createElement('button');
    startButton.textContent = '清空历史记录';
    
    // 设置按钮样式
    startButton.style.position = 'fixed';
    startButton.style.top = '15px'; // 距离顶部15px
    startButton.style.right = '15px'; // 距离右侧15px
    startButton.style.zIndex = 999999;

    // 按钮外观样式
    startButton.style.backgroundColor = '#4D6BFE'; // 黑色背景
    startButton.style.color = 'white'; // 白色文字
    startButton.style.fontSize = '16px'; // 文字大小
    startButton.style.fontWeight = 'bold'; // 文字加粗
    startButton.style.padding = '10px 10px'; // 内边距,左右更宽
    startButton.style.border = 'none'; // 去掉默认边框
    startButton.style.borderRadius = '30px'; // 两端圆形
    startButton.style.cursor = 'pointer'; // 鼠标悬浮时显示指针
    startButton.style.transition = 'background-color 0.3s ease'; // 添加平滑的颜色变化效果

    // 设置文本竖排
    startButton.style.writingMode = 'vertical-rl'; // 使文字竖排,rtl表示从右到左
    // startButton.style.textAlign = 'center'; // 设置文字居中
    startButton.style.letterSpacing = '5px'; // 设置字间距
    startButton.style.height = 'auto'; // 高度自适应内容
    startButton.style.width = '30px'; // 设置按钮宽度,防止太宽
    startButton.style.display = 'flex'; // 使用flex布局
    startButton.style.alignItems = 'center'; // 垂直居中
    startButton.style.justifyContent = 'center'; // 水平居中
    startButton.style.paddingLeft = '7px'; // 手动增加填充使文字水平居中
 
    // 鼠标悬浮时的效果
    startButton.onmouseover = function() {
        startButton.style.backgroundColor = '#3A50BF'; // 鼠标悬浮时变暗
    };
 
    startButton.onmouseout = function() {
        startButton.style.backgroundColor = '#4D6BFE'; // 鼠标移出时恢复原色
    };
 
    document.body.appendChild(startButton);
 
    // 开始按钮点击事件处理函数
    startButton.addEventListener('click', async function() {
        var moreBtn = document.querySelectorAll('.aa7b7ebb');
        var delayTime = 1000;

        function waitFor(ms) {
            return new Promise(resolve => setTimeout(resolve, ms));
        }

        async function performClicks() {
            for (var i = 0; i < moreBtn.length; i++) {
                var elementA = moreBtn[i];

                elementA.click();
                await waitFor(delayTime);

                var deleteBtn = document.querySelector('.ds-dropdown-menu-option--error');

                if (deleteBtn) {
                    deleteBtn.click();

                    await waitFor(delayTime);
                    var sureBtn = document.querySelector('.ds-button--error');

                    if (sureBtn) {
                        sureBtn.click();
                    }
                }
            }
        }

        performClicks();

    });
})();