鼠标点击动画

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

// ==UserScript==
// @name          鼠标点击动画
// @namespace     http://tampermonkey.net/
// @version       0.21
// @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);
    });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址