虎牙自动弹幕以及页面精简、斗鱼页面精简 脚本[更多关注 纯净至上公众号]

去除虎牙和斗鱼多余的部分 破解虎牙关键字限制 虎牙自动发送弹幕 namespace主页是公众号教程地址

目前為 2019-08-30 提交的版本,檢視 最新版本

// ==UserScript==
// @name         虎牙自动弹幕以及页面精简、斗鱼页面精简 脚本[更多关注 纯净至上公众号]
// @namespace    https://mp.weixin.qq.com/s/H3twfD4wXZuxFjyNQMYepA
// @require			https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js
// @version      2.1
// @description  去除虎牙和斗鱼多余的部分 破解虎牙关键字限制 虎牙自动发送弹幕 namespace主页是公众号教程地址
// @author       Bitle
// @license           MIT
// @match        *://www.huya.com/*
//@match         *://www.douyu.com/*
// @run-at            document-idle
// @grant             unsafeWindow
// @grant             GM_xmlhttpRequest
// @grant             GM_download
// @grant             GM_setClipboard
// @grant             GM_setValue
// @grant             GM_getValue
// @grant             GM_openInTab
// ==/UserScript==

(function () {
    'use strict';
    var $_ = function (para) {
        let judgeSelect = para.toString().substring(0, 1);
        let valueSelect = para.toString().substring(1);
        var el;
        if (judgeSelect === ".") {
            el = document.getElementsByClassName(valueSelect)[0];
        } else if (judgeSelect === "#") {
            el = document.getElementById(valueSelect);
        }
        return el;
    }
    var s = setInterval(function () {
        var a_ = $_('.closeBg-998534');
        var b_ = $_('.layout-Aside');
        var c_ = $_('.layout-Player-toolbar');
        var d_ = $_('#js-player-toolbar');
        var e_ = $_('.layout-Player-barrage');
        var f_ = $_('.ChatTabContainer');
        var g_ = $_('.layout-Player-rank');
        var h_ = $_('.layout-Player-announce');
        var i_ = $_('.layout-Player-guessgame');
        var j_ = $_('#js-bottom');
        var k_ = $_('.UPlayerLotteryEnter');
        var l_ = $_('.LotteryContainer');
        let m_ = $_('.layout-Main');
        let n_ = $_('.layout-Player-main');
        let o_ = $_('.SignBaseComponent-sign-box');
        let p_ = $_('.AppFlow is-show');
        let q_ = $_('.ActSuperFansGroup');

        let a = $_('.mod-list');
        let b = $_('.mod-sidebar');
        let c = $_('.player-gift-wrap');
        let d = $_('.player-ctrl-wrap');
        let e = $_('.room-footer');
        let f = $_('.room-gg-chat');
        let g = $_('.room-sidebar-hd');
        let h = $_('.J_input');
        let h2 = document.getElementsByClassName("J_input")[1];
        let i = $_('.roomBlockWords-list');
        let i2 = document.getElementsByClassName("roomBlockWords-list")[1];
        let j = $_('.main-wrap');
        let k = $_(".main-room");
        let l = $_(".chat-room");
        let m = $_(".chat-room__bd");
        //
        if (a_) {
            a_.parentNode.removeChild(a_);
        }
        if (b_) {
            b_.parentNode.removeChild(b_);
        }
        if (c_) {
            c_.parentNode.removeChild(c_);
        }
        if (d_) {
            d_.parentNode.removeChild(d_);
        }
        if (e_) {
            e_.style.top = 0;
        }
        if (f_) {
            f_.parentNode.removeChild(f_);
        }
        if (g_) {
            g_.parentNode.removeChild(g_);
        }
        if (h_) {
            h_.parentNode.removeChild(h_);
        }
        if (i_) {
            i_.parentNode.removeChild(i_);
        }
        if (j_) {
            j_.parentNode.removeChild(j_);
        }
        if (k_) {
            k_.parentNode.removeChild(k_);
        }
        if (l_) {
            l_.parentNode.removeChild(l_);
        }
        if (m_) {
            m_.style.margin = "0px";
            m_.style.padding = "0px";
        }
        if (n_) {
            n_.style.height = "110%";
        }
        if (o_) {
            o_.parentNode.removeChild(o_);
        }
        if (p_) {
            p_.parentNode.removeChild(p_);
        }
        if(q_){
        q_.parentNode.removeChild(q_);
        }
        if (a) {
            a.style.padding = "0px";
        }
        if (b) {
            b.parentNode.removeChild(b);
        }
        if (c) {
            c.parentNode.removeChild(c);
        }
        if (d) {
            d.style.position = "unset";
            d.style.marginTop = "1px";
        }
        if (e) {
            e.parentNode.removeChild(e);
        }
        if (f) {
            f.parentNode.removeChild(f);
        }
        if (g) {
            g.parentNode.removeChild(g);
        }
        if (h || h2) {
            if (h.getAttribute("maxlength") == "10" || h.getAttribute("disabled") == "" || h2.getAttribute("maxlength") == "10" || h2.getAttribute("disabled") == "") {
                h.removeAttribute("disabled");
                h2.removeAttribute("disabled");
                h.setAttribute("maxlength", "n");
                h2.setAttribute("maxlength", "n");
            }
        }
        if (i || i2) {
            i.style.overflow = "scroll";
            i.style.height = "333px";
            i.style.zIndex = "999999999";
            i2.style.overflow = "scroll";
            i2.style.height = "336px";
            i2.style.zIndex = "999999999";
        }

        if (j) {
            if (j.style.paddingLeft != "0px") {
                j.style.padding = "55px 0 0 0";
            }
        }
        if (k) {
            k.style.paddingLeft = "10px";
        }
        if (l || m) {
            l.style.height = "520px";
            m.style.height = "100%";
        }
    }, 1000);
    var jq = jQuery.noConflict();
    var str_div_speed_countDown = (function () {/*
			<div id="open" style="cursor:pointer;width: 40px;height: 40px;border-radius:6px;background:#65c294;position: fixed;right: 100px;bottom:60px;color: #ffffff;text-align: center;line-height: 40px;font-weight: bolder;z-index: 999999999999;">开</div>
    <div id="barrage" style="display:none;position:fixed;top:0;background: #65c294;width: 200px;height: 230px;z-index: 999999999999;">
        <div id="close" style="color: #ffffff;font-size: 15px;height: 30px;line-height:30px;text-align: center;font-weight: bold;border-bottom: 1px solid #eeeeee;cursor: pointer;">自动弹幕</div>
        <div style="margin-top: 3px;height: 30px;">
            <span style="color: #ffffff;font-size: 15px;line-height: 30px;vertical-align:top;margin-left: 3px;">时间(s):</span>
            <textarea id="setTime" placeholder="默认10s" style="width: 80px;vertical-align:top;line-height: 8px;resize: none;color: #232323;padding-top: 9px;"></textarea>
        </div>
        <div style="height: 130px;">
            <span style="color: #ffffff;font-size: 15px;line-height: 30px;vertical-align:top;margin-left: 3px;">输入弹幕:</span>
            <textarea id="barrage_text" placeholder="多个弹幕请换行" style="width: 187px;height: 90px;resize: none;margin-left: 3px;"></textarea>
        </div>
        <div id="comfirm" style="color: #ffffff;font-size: 15px;height: 30px;line-height: 30px;text-align:center;background: green;margin-top: 0;cursor: pointer;">开始执行</div>
    </div>
		*/}).toString().split('/*')[1].split('*/')[0].replace(/[\n]/g, '');

    jq("body").append(str_div_speed_countDown);

    //if(window.APP_URL=="https://www.huya.com/"){
    jq('#barrage').mousedown(function (e) {
        var positionDiv = jq(this).offset();
        var distenceX = e.pageX - positionDiv.left;
        var distenceY = e.pageY - positionDiv.top;

        jq(document).mousemove(function (e) {
            var x = e.pageX - distenceX;
            var y = e.pageY - distenceY;
            if (x < 0) {
                x = 0;
            } else if (x > jq(document).width() - jq('#barrage').outerWidth(true)) {
                x = jq(document).width() - jq('#barrage').outerWidth(true);
            }
            if (y < 0) {
                y = 0;
            } else if (y > jq(document).height() - jq('#barrage').outerHeight(true)) {
                y = jq(document).height() - jq('#barrage').outerHeight(true);
            }
            let obj = { x: x, y: y };
            window.localStorage.setItem("coordinate", JSON.stringify(obj));

            jq('#barrage').css({
                'left': x + 'px',
                'top': y + 'px'
            });
        });
        jq(document).mouseup(function () {
            jq(document).off('mousemove');
        });
    });


    jq('#open').mousedown(function (e) {
        var positionDiv = jq(this).offset();
        var distenceX = e.pageX - positionDiv.left;
        var distenceY = e.pageY - positionDiv.top;

        jq(document).mousemove(function (e) {
            var x = e.pageX - distenceX;
            var y = e.pageY - distenceY;
            if (x < 0) {
                x = 0;
            } else if (x > jq(document).width() - jq('#open').outerWidth(true)) {
                x = jq(document).width() - jq('#open').outerWidth(true);
            }
            if (y < 0) {
                y = 0;
            } else if (y > jq(document).height() - jq('#open').outerHeight(true)) {
                y = jq(document).height() - jq('#open').outerHeight(true);
            }
            let obj = { x: x, y: y };
            window.localStorage.setItem("coordinate_two", JSON.stringify(obj));

            jq('#open').css({
                'left': x + 'px',
                'top': y + 'px'
            });
        });
        jq(document).mouseup(function () {
            jq(document).off('mousemove');
        });
    });
    jq("#open").click(function () {
        jq("#open").slideToggle();
        jq("#barrage").slideToggle();
        let x = JSON.parse(window.localStorage.getItem("coordinate")).x;
        let y = JSON.parse(window.localStorage.getItem("coordinate")).y;
        jq('#barrage').css({
            'left': x + 'px',
            'top': y + 'px'
        });
    });
    jq("#close").click(function () {
        jq("#barrage").slideToggle();
        jq("#open").slideToggle();
    });
    let defualtTime = 10;
    let defualtBarrage = [];
    var comfirmStatus = true;
    var stop;
    let countTime = function (time) {
        let time_ = time * 1000;
        let len = jq('#barrage_text').val().split("\n").length;
        defualtBarrage = jq('#barrage_text').val().split("\n");
        jq('#comfirm').text("停止执行");
        stop = setInterval(function () {

            jq(".chat-room__input>span").attr("class", "btn-sendMsg enable");
            jq('#pub_msg_input').val(defualtBarrage[random_(len)]);
            jq('.btn-sendMsg').click();
        }, time_);
    }
    let random_ = function (len) {
        let rand = Math.floor(Math.random() * len);
        return rand;
    }
    jq('#comfirm').click(function () {
        if (comfirmStatus == true) {
            comfirmStatus = false;
            var reg = new RegExp("^[0-9]*jq");
            let value = parseInt(jq('#setTime').val());
            window.localStorage.setItem("barrageText", JSON.stringify(jq('#barrage_text').val()));
            if (reg.test(value)) {
                window.localStorage.setItem("countTime", JSON.stringify(value));
                countTime(value);
            } else if (jq('#setTime').val() == "") {
                countTime(defualtTime);
            } else {
                alert("时间填写不是数字");
            }
        } else {
            comfirmStatus = true;
            jq('#comfirm').text("开始执行")
            clearInterval(stop);
        }

    });

    jq(function () {
        let x = JSON.parse(window.localStorage.getItem("coordinate_two")).x;
        let y = JSON.parse(window.localStorage.getItem("coordinate_two")).y;
        let countTime = JSON.parse(window.localStorage.getItem("countTime"));
        let barrageText = JSON.parse(window.localStorage.getItem("barrageText"));
        jq('#setTime').val(countTime);
        jq('#barrage_text').val(barrageText);
        jq('#open').css({
            'left': x + 'px',
            'top': y + 'px'
        });
    });

    //}

})();