阻止bilibili鼠标hover弹出弹幕点赞举报框

隐藏bilibili播放器中鼠标移到弹幕上自动显示的弹幕点赞举报框。

// ==UserScript==
// @name         阻止bilibili鼠标hover弹出弹幕点赞举报框
// @description  隐藏bilibili播放器中鼠标移到弹幕上自动显示的弹幕点赞举报框。
// @namespace    http://tampermonkey.net/
// @version      2024-10-14.1
// @author       heroboy
// @match        https://www.bilibili.com/*
// @icon         http://bilibili.com/favicon.ico
// @grant        none
// @run-at       document-start
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    let oldfunc = HTMLElement.prototype.addEventListener;
    HTMLElement.prototype.addEventListener = addEventListener;
    function addEventListener(n)
    {
        if (n === 'mousemove')
        {
            if (isForbidden(arguments,this))
            {
                console.log('阻止了弹幕tip监听mousemove')
                return;
            }
        }
        oldfunc.apply(this,arguments);
    }
    function isForbidden(args,node)
    {
        try
        {
            if (args[0] === 'mousemove' && args[1] && node.className.indexOf('video-area') !== -1)
            {
                let code = args[1].toString();
                if (code.indexOf('dmhover') !== -1)
                    return true;
            }
            return false;
        }
        catch(e)
        {
            return false;
        }
    }
})();