Greasy Fork 还支持 简体中文。

pakku advanced filter

弹幕屏蔽Pro+

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         pakku advanced filter
// @namespace    http://s.xmcp.ml/pakkujs/
// @version      0.3
// @description  弹幕屏蔽Pro+
// @author       xmcp
// @match        *://*.bilibili.com/*
// @grant        none
// ==/UserScript==

// 请先安装 [pakku](http://s.xmcp.ml/pakkujs/)

const NEED_UID = true; // 是否需要使用 cracked_uid 属性(慢)

// 屏蔽规则写在这个函数里
function do_filter(D) {
    var ret = [];
    D.forEach((d) => {
        ret.push(d.ir_obj);
    });
    return ret;
}

(function() {
    'use strict';

    function comp_ver(ver1, ver2) {
        ver1 = ver1.split('.').map( s => s.padStart(10) ).join('.');
        ver2 = ver2.split('.').map( s => s.padStart(10) ).join('.');
        return ver1 < ver2;
    }
    function check_ver(ver) {
        if(comp_ver(ver, '10.0'))
            alert('此版本的 pakku advanced filter 用户脚本依赖于 pakku 10.0 或更高版本');
    }

    let COMPLETED_TIME=-10000;

    addEventListener('message', function(e) {
        if(e.data.type==='pakku_event_danmaku_loaded') {
            if((+new Date())-COMPLETED_TIME<5000) return;
            check_ver(e.data.pakku_version||'0');
            if(NEED_UID) {
                postMessage({type: 'pakku_get_danmaku_with_uid'},'*');
            } else {
                postMessage({type: 'pakku_get_danmaku'},'*');
            }
        } else if(e.data.type==='pakku_got_danmaku') {
            const D=do_filter(e.data.resp);
            console.log('pakku advanced filter: '+D.length+' danmakus left');
            COMPLETED_TIME=(+new Date());
            window.postMessage({type: 'pakku_set_danmaku_bounce', danmakus: D},'*');
        }
    });
})();