Greasy Fork

Greasy Fork is available in English.

BiliBili直播间解除字数限制

直播间解除字数限制,自动分条发送

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         BiliBili直播间解除字数限制
// @namespace    mscststs
// @version      0.41
// @description  直播间解除字数限制,自动分条发送
// @author       mscststs
// @include        /https?:\/\/live\.bilibili\.com\/\d/
// @match        https://live.bilibili.com/*
// @require http://greasyfork.icu/scripts/38220-mscststs-tools/code/MSCSTSTS-TOOLS.js?version=1026406
// @license      ISC
// @grant        none
// ==/UserScript==


(async function() {
    'use strict';

    const chatControlPanel = (await mscststs.wait("#control-panel-ctnr-box")).__vue__;
    const fullscreenControlPanel = (await mscststs.wait(".fullscreen-danmaku")).__vue__;

    while(!chatControlPanel.isLogin){
        await mscststs.sleep(1000);
    }

    await mscststs.sleep(1000);
    const userLimit = chatControlPanel.inputLengthLimit; // 用户的弹幕长度


    hackDanmakuControl(chatControlPanel)
    hackDanmakuControl(fullscreenControlPanel)


    async function hackDanmakuControl(inputControlPanel){

        // 等待完成登录流程
        while(!inputControlPanel.isLogin){
            await mscststs.sleep(1000);
        }

        inputControlPanel.baseInfoUser.danmakuLengthLimit = 10000; // 直接设置上限长度,你总不可能有两万字的小作文要发吧
        const rawSendFunc = inputControlPanel.sendDanmaku.bind(inputControlPanel);
        async function curSendDanmaku(a,b,c,d,e){
            let text = this.chatInput;
            while(text){
                this.chatInput = text.slice(0, userLimit);
                console.log("分段发送: ",this.chatInput);
                text = text.slice(userLimit);
                rawSendFunc(a,b,c,d,e);
                await mscststs.sleep(1400);
            }
        };
        const curSendFunc = curSendDanmaku.bind(inputControlPanel)

        inputControlPanel.sendDanmaku = curSendFunc;
    }

})();