// ==UserScript==
// @name acfun直播间自动刷弹幕
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 慎用!!!弹幕抽奖用,1秒10条刷起来,固定时长,避免电茶缸事件重演。
// @author oracle_cai
// @match https://live.acfun.cn/live/*
// @grant none
// @downloadURL none
// ==/UserScript==
window.onload =function() {
let ash='
';
let ib=document.querySelector(".live-feed-input");
ib.insertAdjacentHTML('beforeEnd',ash);
document.querySelector('#asbtn').onclick=function(){
autosend();
}
}
function autosend(){
let btn=document.querySelector("#asbtn");
if(btn.getAttribute('class').indexOf('enable')<0){
return;
}
let dmbox=document.querySelector(".danmaku-input-wrap textarea");
let txt=dmbox.value;
if(txt.trim().length<1){
alert("请先输入弹幕!");
}
btn.setAttribute('class','send-btn')
let sc=document.querySelector('#ssc').value;
let sendbtn=document.querySelector(".wrap-bottom-area .send-btn");
let si=setInterval(function(){
//console.log(1);
sendbtn.click();
dmbox.value=txt;
let event = new Event('input', { bubbles: true });
let tracker = dmbox._valueTracker;
if (tracker) {
tracker.setValue('');//
}
dmbox.dispatchEvent(event);
},100);
setTimeout(function(){
//console.log(2);
window.clearInterval(si);
btn.setAttribute('class','send-btn enable')
},parseInt(sc)*1000);
}