Greasy Fork

Greasy Fork is available in English.

鼠标点击动画

仅保留鼠标左右键点击动画(修复闪烁)

当前为 2025-03-15 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         鼠标点击动画
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  仅保留鼠标左右键点击动画(修复闪烁)
// @icon         https://i.miji.bid/2025/03/15/560664f99070e139e28703cf92975c73.jpeg
// @author       Grok
// @match        *://*/*
// @grant        GM_addStyle
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // 添加CSS样式
    GM_addStyle(`
        * {
            cursor: default !important;
        }

        .cursor-ripple {
            position: fixed;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            background: rgba(0, 0, 0, 0.3);
            pointer-events: none;
            z-index: 9998;
            animation: ripple 0.8s ease-out forwards;
            will-change: transform, opacity;
        }

        .cursor-right-click {
            position: fixed;
            width: 24px;
            height: 24px;
            border: 3px dashed rgba(0, 0, 0, 0.7);
            border-radius: 50%;
            pointer-events: none;
            z-index: 9998;
            animation: ripple 0.6s ease-out forwards;
            will-change: transform, opacity;
        }

        @keyframes ripple {
            0% { transform: scale(0); opacity: 1; }
            100% { transform: scale(2.5); opacity: 0; }
        }
    `);

    // 左键点击效果
    document.addEventListener('click', (e) => {
        const ripple = document.createElement('div');
        ripple.classList.add('cursor-ripple');
        ripple.style.left = e.clientX - 12 + 'px';
        ripple.style.top = e.clientY - 12 + 'px';
        document.body.appendChild(ripple);
        setTimeout(() => ripple.remove(), 800);
    });

    // 右键效果
    document.addEventListener('contextmenu', (e) => {
        const rightClick = document.createElement('div');
        rightClick.classList.add('cursor-right-click');
        rightClick.style.left = e.clientX - 12 + 'px';
        rightClick.style.top = e.clientY - 12 + 'px';
        document.body.appendChild(rightClick);
        setTimeout(() => rightClick.remove(), 600);
    });
})();