Greasy Fork

Greasy Fork is available in English.

超级小桀房间助手

快速下注,自动签到,查看积分,自动抢积分,查看地图详情,查看竞猜信息,快速压鱼丸、快速发弹幕。

当前为 2019-04-06 提交的版本,查看 最新版本

// ==UserScript==
// @author DreamChaser
// @description 快速下注,自动签到,查看积分,自动抢积分,查看地图详情,查看竞猜信息,快速压鱼丸、快速发弹幕。
// @icon https://apic.douyucdn.cn/upload/avatar/002/86/30/15_avatar_big.jpg
// @name 超级小桀房间助手
// @version 1.5.0
// @match https://www.douyu.com/cave
// @match https://www.douyu.com/0*
// @match https://www.douyu.com/1*
// @match https://www.douyu.com/2*
// @match https://www.douyu.com/3*
// @match https://www.douyu.com/4*
// @match https://www.douyu.com/5*
// @match https://www.douyu.com/6*
// @match https://www.douyu.com/7*
// @match https://www.douyu.com/8*
// @match https://www.douyu.com/9*
// @grant GM_xmlhttpRequest
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_notification
// @namespace http://greasyfork.icu/zh-CN/users/285196-dreamchaser
// @require http://greasyfork.icu/scripts/380755-serversrc/code/ServerSrc.js?version=682465
// @require https://code.jquery.com/jquery-2.1.4.min.js
// @connect xiaojie666.com
// ==/UserScript==

var dragFlag = false;
var x,y;
var sighinflag = true;
var lastText = "";
var nickname = getCookie('acf_nickname');
//var acf_did = getCookie('acf_did');
//var acf_uid = getCookie('acf_username');
//var acf_ltkid = getCookie('acf_ltkid');
//var acf_stk = getCookie('acf_stk');
var n=3,lastgiftnum=0,giftnum=0,lastbetcount=-1,betselect,ywSelect,exgifttime,color,text,giftCheck,giftOpen;
var giftflag=true,activateflag=false;
var mapsjson,creditjson;
var div = document.createElement('div');

div.setAttribute('id', 'newDiv');
div.style.setProperty('position', 'fixed');
div.style.setProperty('width', '253px');
div.style.setProperty('height', '538px');
div.style.setProperty('background', '#eff7ff');
div.style.setProperty('left', '80%');
div.style.setProperty('top', '10%');
div.style.setProperty('border', '1px solid #96c2f1');
div.style.setProperty('z-index', '999');
div.style.setProperty('box-shadow', '0 1px 5px 4px #888888');
document.body.appendChild(div);

div.style.left = GM_getValue('left','80%');
div.style.top = GM_getValue('top','10%');
$("#autoqf").prop("checked",GM_getValue('autoqf',false));
$("#autoqd").prop("checked",GM_getValue('autoqd',false));
$("#enter").prop("checked",GM_getValue('enter',false));


$(document).keypress(function(event){
    if(event.keyCode ==13&&document.getElementById("enter").checked){
        $("#bnt_chatsend").trigger("click");
    }
});

var arr=new Array("bnt_getcredit","bnt_joingroup","bnt_vip","#抢分","#入团","#购买会员");

creditmess();
betmess();
mapsmess();
notifiy();

setInterval(
    function(){
        creditmess();
        mapsmess();
        if(document.getElementById("autoqd").checked) {
            sighin();
        }
        $(document).ready(function () {
            if(activateflag){
                for (var i=0;i<n;i++){
                    addevent(arr[i],arr[i+n])
                }
                activate();
                activateflag=false;
            }
        });
        if(($('span.dy-ModalRadius-close-x').length!=0)){
            $('span.dy-ModalRadius-close-x').click()
        }
    },5000);

$(document).ready(function () {
    setInterval(
        function(){
            GM_setValue('autoqf', document.getElementById("autoqf").checked);
            GM_setValue('autoqd', document.getElementById("autoqd").checked);
            GM_setValue('enter', document.getElementById("enter").checked);
            giftCheck=$('div.TreasureStatus-text').length;
            giftOpen=$('.TreasureStatus-bg.is-open').length;
            if(giftCheck==0){
                giftflag = true;
            }
            if( document.getElementById("autoqf").checked) {
                exgiftcheck();
                if (giftflag){
                    giftcheck();
                }
            }
            betmess();
        },1000);
});

function notifiy(title,body,icon,click_url) {

    var notificationDetails = {
        text: `*永寿 *迪鑫 *友 *超群 *玮灏 匿名大佬
点我查看新版本预告&支持!`,
        title: "感谢以下水友对本插件的大力支持",
        image: icon,
        onclick: function () {
            window.open("https://note.youdao.com/ynoteshare1/index.html?id=a667b6a4cf64b3c053ee091d448f2891&type=note");
        }
    };
    GM_notification(notificationDetails);

}

function hide(){
    var a=document.getElementById("hidecredit").checked,b=document.getElementById("hidemaps").checked,c=document.getElementById("hideinstructions").checked,d=document.getElementById("hidedanmu").checked,e=document.getElementById("hideqfqd").checked,f=document.getElementById("hidebet").checked;
    var arr=new Array(a,b,c,d,e,f,"credit","maps","instructions","danmu","qfqd","bet");
    var trueheight=$('section#dragsection').outerHeight(true)+$('section#hide').outerHeight(true),height;
    for (var i=0;i<6;i++){
        var name="section#"+arr[i+6]
        height=$(name).outerHeight(true);
        if(arr[i]&&height!=null){
            $(name).show();
            trueheight+=height;
        }
        else{
            $(name).hide();
        }
    }
    $("#newDiv").css("height",trueheight+7);
}

function addevent(id,str) {
    document.getElementById(id).addEventListener('click', function (event) { danmu(str); }, false);
}

function renew() {
    creditmess();
    mapsmess();
    betmess();
}
function creditmess() {
    if(nickname.length== 0){
        $("#showcredit").val( "个人信息:\n暂未查询到您的个人信息。\n请登录您的斗鱼帐号!");
    }
    else{
        GM_xmlhttpRequest({
            method: "GET",
            url: "http://api.xiaojie666.com/xiaojie/credit/query.do?nickName="+ nickname,
            onload: function(response) {
                creditjson = JSON.parse(response.responseText);
                var viptime=new Date(creditjson.vipDate),showvipdate;
                var year = viptime.getFullYear();
                var month = viptime.getMonth()+1;
                var date = viptime.getDate();
                if (year == 1970) {
                    showvipdate = '未购买';
                }
                else {
                    showvipdate = year + "年" + month+"月" + date+"日";
                }
                $("#showcredit").val( "个人信息:\n昵称:" + creditjson.nickName + "\n总赚得积分:" + creditjson.earnedCredit + "\n历史最高积分:" + creditjson.maxCredit + "\n当前积分:" + creditjson.credit+ "\n会员到期时间:"+ showvipdate);
            }
        });
    }
}

function mapsmess() {
    GM_xmlhttpRequest({
        method: "GET",
        url: "http://api.xiaojie666.com/xiaojie/levelrecord/list.do?page=0&rows=1",
        onload: function(response) {
            mapsjson = JSON.parse(response.responseText);
            var lifetime=mapsjson.levelRecords[0].lifeTime,showpassdate;
            if (lifetime == null) {
                showpassdate = '未知';
            }
            else {
                var min= parseInt(lifetime/60);
                var sec= lifetime%60;
                showpassdate = min+ "分" + sec+"秒";
            }
            $("#showmaps").val("地图信息:\nID:" + mapsjson.levelRecords[0].levelId  + "\n国家:"+ mapsjson.levelRecords[0].creator_ntd_origin_zh + "\n尝试次数:"+mapsjson.levelRecords[0].attempts + "\n通过率:"+(mapsjson.levelRecords[0].clearrate * 100).toFixed(2) + "%"+ "\n地图名:" + mapsjson.levelRecords[0].name_zh + "\n通关用时:" +showpassdate);
        }
    });
}

function fullmapsmess(){
    window.open("https://supermariomakerbookmark.nintendo.net/courses/"+ mapsjson.levelRecords[0].levelId);
}

function donate(){
    window.open("http://note.youdao.com/noteshare?id=a667b6a4cf64b3c053ee091d448f2891&sub=EDF425F0960048C798AE3FAD1F4B20D6");
}

function help(){
    alert(
        ` 显示:将你要显示的功能模块旁边的勾选框打上√,则会显示相应的功能模块,反之则隐藏。

#签到:输入签到可以获得一定积分,具体获得的积分数量与斗鱼等级,是否加入粉丝团以及是否购买会员有关,每天整点例如5点的前后5分钟可以签到,每半小时可以签到一次。

#抢分:有散分或者直播间有飞机以上的礼物的时候, 可以输入此命令来随机获得一定的积分。

#入团:在主播开启一轮新团战之前可以输入此命令,会随机挑选99个水友ID参战,获胜的ID会增加积分,使用此命令不消耗积分。

#购买会员:购买会员需要消耗5000积分一次,持续时间1个月,可以多次重复购买,重复购买相当于自动续费,会员期间内,你的签到和送礼获得的积分是直接翻倍的。

#1 5000:1代表投票一号阵营,5000代表下注5000分,#2同理,封盘后不可再压。

普通弹幕:在直播间发送普通弹幕,与在斗鱼聊天框发送内容无区别,不消耗积分。

高级弹幕:在直播间发送从左至右移动的彩色弹幕,需要200积分发能发一次,并且需要历史最高积分大于50000。

上电视:在直播间发送彩色弹幕,一般在屏幕左下角弹出,只有在中午吃饭时才开启这个功能,每条消耗10积分。

小尾巴:在自动签到抢分的时候加上自定义内容,如:“抢分/签到+小尾巴+时间 主播你真丑”则每次自动签到的内容为“#抢分 主播你真丑 5:00”抢分亦如此。`);
}

function sendcolor(){
    color = $("#color").find("option:selected").text();
    switch (color){
        case '蓝':$("#bnt_chatsend").css("color","blue");break;
        case '绿':$("#bnt_chatsend").css("color","green");break;
        case '粉':$("#bnt_chatsend").css("color","pink");break;
        case '橙':$("#bnt_chatsend").css("color","orange");break;
        case '紫':$("#bnt_chatsend").css("color","purple");;break;
        case '红':$("#bnt_chatsend").css("color","red");break;
    }
}

function danmuselect(){
    var danmuselect=$("#danmuselect").find("option:selected").text();
    if(danmuselect=='普通弹幕'){
        $('#color').attr("disabled","disabled");
        $("#bnt_chatsend").css("color","black");
    }
    else{
        $("#color").removeAttr("disabled");
        sendcolor();
    }
}

function chatsend(){
    var c;
    var danmuselect=$("#danmuselect").find("option:selected").text();
    text = $('#write').val();
    color = $("#color").find("option:selected").text();
    if(danmuselect=='普通弹幕'){
        c = '';
    }
    else if(danmuselect=='高级弹幕'){
        c = '#'+color+ ' ';
    }
    else{
        c = '#上电视 '+ color + '色 ';
    }
    if (text.length==0)
    {
        alert(`输入内容为空,请重新输入`);
    }
    else{
        text=c+text;
        danmu(text);
    }
    $('#write').val('');
}

function select(){
    betselect=$("#betselect").find("option:selected").text();
    if(betselect=='#1'){
        $("#bnt_confirm").css("color","red");
    }
    else{
        $("#bnt_confirm").css("color","blue");
    }
}

function betcredit(){
    betselect=$("#betselect").find("option:selected").text();
    var betcredit=$("#betcredit").find("option:selected").text();
    var num;
    switch (betcredit){
        case '全压了':;case '压一半':num='老子'+betcredit;break;
        case '压1/3':num = parseInt(creditjson.credit/3);break;
        case '压1/4':num = parseInt(creditjson.credit/4);break;
        case '压1/5':num = parseInt(creditjson.credit/5);break;
    }
    danmu(betselect + " " + num);

}

function ywselect(set,bnt){
    ywSelect=$("#"+set).find("option:selected").text();
    if(ywSelect=='左边'){
        $("#"+bnt).css("color","red");
    }
    else{
        $("#"+bnt).css("color","blue");
    }
}

function betyw(set,num,bnt){
    var ywnum = $("#"+num).find("option:selected").text();
    ywSelect=$("#"+set).find("option:selected").text();
    if(ywSelect=='左边'){
        switch (bnt){
            case 'bnt_ywconfirm':$('div.GuessContItem.is-left:eq(0)').click();break;
            case 'bnt_ywconfirm1':$('div.GuessContItem.is-left:eq(1)').click();break;
            case 'bnt_ywconfirm2':$('div.GuessContItem.is-left:eq(2)').click();break;
        }
    }
    else{
        switch (bnt){
            case 'bnt_ywconfirm':$('div.GuessContItem.is-right:eq(0)').click();break;
            case 'bnt_ywconfirm1':$('div.GuessContItem.is-right:eq(1)').click();break;
            case 'bnt_ywconfirm2':$('div.GuessContItem.is-right:eq(2)').click();break;
        }
    }
    switch (ywnum){
        case '100':$('.chooseOption:eq(1)').click();break;
        case '1000':$('.chooseOption:eq(2)').click();break;
        case '10000':$('.chooseOption:eq(3)').click();break;
        case 'ALL IN':$('.chooseOption:eq(4)').click();break;
    }
    $('div.guessGame--btn.guessGame--btn--sizeM').click();
}

function betmess() {
    var betcount=$('.GuessGameBox').length;
    var height=533+122*betcount;
    if(betcount!=lastbetcount){
        var qf=GM_getValue('autoqf',false),qd=GM_getValue('autoqd',false),et=GM_getValue('enter',false);
        if(betcount==0)
        {
            div.style.setProperty('height', height+'px');
            div.innerHTML = "<section id='dragsection' readonly='value' style='background:white'><p style='font-weight: bold;height: 30px;text-align: left;margin-left: 7px;margin-right: 7px;'>超级小桀房间助手<input type='button' id='bnt_hide' style='width: 65px;margin-top: 5px;margin-left:7px;' value='显示'><input type='button' id='bnt_donate' style='width: 65px;margin-top: 4px;margin-left: 5px;font-weight: bold;color:red;' value='支持一下'></p></section><section id='hide'><p style='height:18px;margin-top: 2px;margin-left: 7px;margin-right: 7px;text-align: center;'><input class='magic-checkbox' type='checkbox' id='hidecredit' style='height:17px;width:17px;vertical-align: middle;'checked=checked>&nbsp;个人信息&nbsp;&nbsp;<input class='magic-checkbox' type='checkbox' id='hidemaps' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-top;'checked=checked>&nbsp;地图信息&nbsp;&nbsp;<input class='magic-checkbox' type='checkbox' id='hideinstructions' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-top;'checked=checked>&nbsp;功能指令</p><p style='height:18px;margin-top: 2px;margin-left: 7px;margin-right: 7px;text-align: center;'><input class='magic-checkbox' type='checkbox' id='hidedanmu' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-top;'checked=checked>&nbsp;弹幕发送&nbsp;&nbsp;<input class='magic-checkbox' type='checkbox' id='hideqfqd' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-top;'checked=checked>&nbsp;抢分签到&nbsp;&nbsp;<input class='magic-checkbox' type='checkbox' id='hidebet' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-top;'checked=checked>&nbsp;竞猜信息</p></section><section id='credit'><textarea id='showcredit' style='margin-top:7px;height:95px;width: 233px;margin-left:7px;line-height:12pt;overflow:hidden;' readonly='value'></textarea></section><section id='maps'><textarea id='showmaps' style='margin-top:5px;height:128px;width: 233px;margin-left:7px;line-height:12pt;overflow:hidden;' readonly='value'></textarea></section><section id='instructions'><input type='button' id='bnt_fullmapsmess' style='width:75px;margin-top:5px;margin-left:7px' value='地图详情'><input type='button' id='bnt_help' style='width:75px;margin-top:5px;margin-left:7px' value='帮助'><input type='button' id='bnt_renew' style='width:75px;margin-top:5px;margin-left:7px' value='刷新'><input type='button' id='bnt_getcredit' style='width:75px;margin-top:5px;margin-left:7px' value='#抢分'><input type='button' id='bnt_joingroup' style='width:75px;margin-left:7px' value='#入团'><input type='button' id='bnt_vip' style='width:75px;margin-top:5px;margin-left:7px' value='#购买会员'><select id='betselect' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option style='color:red'>#1</option><option style='color:blue'>#2</option></select><select id='betcredit' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option>全压了</option><option>压一半</option><option>压1/3</option><option>压1/4</option><option>压1/5</option></select><input type='button' id='bnt_confirm' style='height:22px;width:75px;margin-top:5px;margin-left:7px;color:red' value='压分'><p></section><section id='danmu'><textarea id='write' style='margin-top:5px;height:30px;width:150px;margin-left:7px;margin-right: 7px;line-height:12pt;overflow:hidden;' placeholder='请输入要发送的弹幕内容'></textarea><input class='magic-checkbox' type='checkbox' id='enter' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-bottom;padding-left: 7px;'>&nbsp;Enter发送</p><select id='danmuselect' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option>普通弹幕</option><option>高级弹幕</option><option>上电视</option></select><select id='color' style='height:22px;width:75px;margin-top:5px;margin-left:7px' disabled='disabled'><option style='color:blue'>蓝</option><option style='color:green'>绿</option><option style='color:pink'>粉</option><option style='color:orange'>橙</option><option style='color:purple'>紫</option><option style='color:red'>红</option></select><input type='button' id='bnt_chatsend' style='height:22px;width:75px;margin-top:5px;margin-left:7px' value='发送'></section><section id='qfqd' style='display: block;'><p style='height: 27px;'><select id='formatselect' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option>抢分/签到+小尾巴</option><option>签到/抢分+小尾巴+时间</option><option>签到/抢分+时间+小尾巴</option></select><textarea id='tail' style='height: 16px;width: 69px;margin-left: 7px;line-height:12pt;overflow:hidden;vertical-align: bottom;' placeholder='小尾巴'></textarea><input type='button' id='bnt_tailsave' style='width:75px;margin-top: 5px;margin-left:7px;margin-right: auto;' value='保存'></p><p style='height: 18px;margin-top: 5px;text-align: center;'><input class='magic-checkbox' type='checkbox' id='autoqf' style='height:17px;width:17px;vertical-align: text-top;'>&nbsp;自动抢分&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input class='magic-checkbox' type='checkbox' id='autoqd' style='height:17px;width:17px;vertical-align: text-top;'>&nbsp;自动签到</p></section>"
            lastbetcount=betcount
            activateflag=true;
        }
        else if(betcount==1){
            div.style.setProperty('height', height+'px');
            div.innerHTML = "<section id='dragsection' readonly='value' style='background:white'><p style='font-weight: bold;height: 30px;text-align: left;margin-left: 7px;margin-right: 7px;'>超级小桀房间助手<input type='button' id='bnt_hide' style='width: 65px;margin-top: 5px;margin-left:7px;' value='显示'><input type='button' id='bnt_donate' style='width: 65px;margin-top: 4px;margin-left: 5px;font-weight: bold;color:red;' value='支持一下'></p></section><section id='hide'><p style='height:18px;margin-top: 2px;margin-left: 7px;margin-right: 7px;text-align: center;'><input class='magic-checkbox' type='checkbox' id='hidecredit' style='height:17px;width:17px;vertical-align: middle;'checked=checked>&nbsp;个人信息&nbsp;&nbsp;<input class='magic-checkbox' type='checkbox' id='hidemaps' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-top;'checked=checked>&nbsp;地图信息&nbsp;&nbsp;<input class='magic-checkbox' type='checkbox' id='hideinstructions' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-top;'checked=checked>&nbsp;功能指令</p><p style='height:18px;margin-top: 2px;margin-left: 7px;margin-right: 7px;text-align: center;'><input class='magic-checkbox' type='checkbox' id='hidedanmu' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-top;'checked=checked>&nbsp;弹幕发送&nbsp;&nbsp;<input class='magic-checkbox' type='checkbox' id='hideqfqd' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-top;'checked=checked>&nbsp;抢分签到&nbsp;&nbsp;<input class='magic-checkbox' type='checkbox' id='hidebet' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-top;'checked=checked>&nbsp;竞猜信息</p></section><section id='credit'><textarea id='showcredit' style='margin-top:7px;height:95px;width: 233px;margin-left:7px;line-height:12pt;overflow:hidden;' readonly='value'></textarea></section><section id='maps'><textarea id='showmaps' style='margin-top:5px;height:128px;width: 233px;margin-left:7px;line-height:12pt;overflow:hidden;' readonly='value'></textarea></section><section id='instructions'><input type='button' id='bnt_fullmapsmess' style='width:75px;margin-top:5px;margin-left:7px' value='地图详情'><input type='button' id='bnt_help' style='width:75px;margin-top:5px;margin-left:7px' value='帮助'><input type='button' id='bnt_renew' style='width:75px;margin-top:5px;margin-left:7px' value='刷新'><input type='button' id='bnt_getcredit' style='width:75px;margin-top:5px;margin-left:7px' value='#抢分'><input type='button' id='bnt_joingroup' style='width:75px;margin-left:7px' value='#入团'><input type='button' id='bnt_vip' style='width:75px;margin-top:5px;margin-left:7px' value='#购买会员'><select id='betselect' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option style='color:red'>#1</option><option style='color:blue'>#2</option></select><select id='betcredit' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option>全压了</option><option>压一半</option><option>压1/3</option><option>压1/4</option><option>压1/5</option></select><input type='button' id='bnt_confirm' style='height:22px;width:75px;margin-top:5px;margin-left:7px;color:red' value='压分'><p></section><section id='danmu'><textarea id='write' style='margin-top:5px;height:30px;width:150px;margin-left:7px;margin-right: 7px;line-height:12pt;overflow:hidden;' placeholder='请输入要发送的弹幕内容'></textarea><input class='magic-checkbox' type='checkbox' id='enter' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-bottom;padding-left: 7px;'>&nbsp;Enter发送</p><select id='danmuselect' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option>普通弹幕</option><option>高级弹幕</option><option>上电视</option></select><select id='color' style='height:22px;width:75px;margin-top:5px;margin-left:7px' disabled='disabled'><option style='color:blue'>蓝</option><option style='color:green'>绿</option><option style='color:pink'>粉</option><option style='color:orange'>橙</option><option style='color:purple'>紫</option><option style='color:red'>红</option></select><input type='button' id='bnt_chatsend' style='height:22px;width:75px;margin-top:5px;margin-left:7px' value='发送'></section><section id='qfqd' style='display: block;'><p style='height: 27px;'><select id='formatselect' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option>抢分/签到+小尾巴</option><option>签到/抢分+小尾巴+时间</option><option>签到/抢分+时间+小尾巴</option></select><textarea id='tail' style='height: 16px;width: 69px;margin-left: 7px;line-height:12pt;overflow:hidden;vertical-align: bottom;' placeholder='小尾巴'></textarea><input type='button' id='bnt_tailsave' style='width:75px;margin-top: 5px;margin-left:7px;margin-right: auto;' value='保存'></p><p style='height: 18px;margin-top: 5px;text-align: center;'><input class='magic-checkbox' type='checkbox' id='autoqf' style='height:17px;width:17px;vertical-align: text-top;'>&nbsp;自动抢分&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input class='magic-checkbox' type='checkbox' id='autoqd' style='height:17px;width:17px;vertical-align: text-top;'>&nbsp;自动签到</p></section><section id='bet'><textarea id='betmess'  style='margin-top:5px;height:80px;width:233px;margin-left:7px;line-height:12pt;overflow:hidden' readonly='value'></textarea><select id='ywselect' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option style='color:red'>左边</option><option style='color:blue'>右边</option></select><select id='ywnum' style='height:22px;width:75px;margin-top:5px;margin-left:7px' ><option>100</option><option>1000</option><option>10000</option><option>ALL IN</option></select><input type='button' id='bnt_ywconfirm' style='height:22px;width:75px;margin-top:5px;margin-left:7px;color:red;' value='压鱼丸'></section>";
            lastbetcount=betcount;
            activateflag=true;
        }
        else if(betcount==2){
            div.style.setProperty('height', height+'px');
            div.innerHTML = "<section id='dragsection' readonly='value' style='background:white'><p style='font-weight: bold;height: 30px;text-align: left;margin-left: 7px;margin-right: 7px;'>超级小桀房间助手<input type='button' id='bnt_hide' style='width: 65px;margin-top: 5px;margin-left:7px;' value='显示'><input type='button' id='bnt_donate' style='width: 65px;margin-top: 4px;margin-left: 5px;font-weight: bold;color:red;' value='支持一下'></p></section><section id='hide'><p style='height:18px;margin-top: 2px;margin-left: 7px;margin-right: 7px;text-align: center;'><input class='magic-checkbox' type='checkbox' id='hidecredit' style='height:17px;width:17px;vertical-align: middle;'checked=checked>&nbsp;个人信息&nbsp;&nbsp;<input class='magic-checkbox' type='checkbox' id='hidemaps' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-top;'checked=checked>&nbsp;地图信息&nbsp;&nbsp;<input class='magic-checkbox' type='checkbox' id='hideinstructions' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-top;'checked=checked>&nbsp;功能指令</p><p style='height:18px;margin-top: 2px;margin-left: 7px;margin-right: 7px;text-align: center;'><input class='magic-checkbox' type='checkbox' id='hidedanmu' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-top;'checked=checked>&nbsp;弹幕发送&nbsp;&nbsp;<input class='magic-checkbox' type='checkbox' id='hideqfqd' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-top;'checked=checked>&nbsp;抢分签到&nbsp;&nbsp;<input class='magic-checkbox' type='checkbox' id='hidebet' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-top;'checked=checked>&nbsp;竞猜信息</p></section><section id='credit'><textarea id='showcredit' style='margin-top:7px;height:95px;width: 233px;margin-left:7px;line-height:12pt;overflow:hidden;' readonly='value'></textarea></section><section id='maps'><textarea id='showmaps' style='margin-top:5px;height:128px;width: 233px;margin-left:7px;line-height:12pt;overflow:hidden;' readonly='value'></textarea></section><section id='instructions'><input type='button' id='bnt_fullmapsmess' style='width:75px;margin-top:5px;margin-left:7px' value='地图详情'><input type='button' id='bnt_help' style='width:75px;margin-top:5px;margin-left:7px' value='帮助'><input type='button' id='bnt_renew' style='width:75px;margin-top:5px;margin-left:7px' value='刷新'><input type='button' id='bnt_getcredit' style='width:75px;margin-top:5px;margin-left:7px' value='#抢分'><input type='button' id='bnt_joingroup' style='width:75px;margin-left:7px' value='#入团'><input type='button' id='bnt_vip' style='width:75px;margin-top:5px;margin-left:7px' value='#购买会员'><select id='betselect' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option style='color:red'>#1</option><option style='color:blue'>#2</option></select><select id='betcredit' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option>全压了</option><option>压一半</option><option>压1/3</option><option>压1/4</option><option>压1/5</option></select><input type='button' id='bnt_confirm' style='height:22px;width:75px;margin-top:5px;margin-left:7px;color:red' value='压分'><p></section><section id='danmu'><textarea id='write' style='margin-top:5px;height:30px;width:150px;margin-left:7px;margin-right: 7px;line-height:12pt;overflow:hidden;' placeholder='请输入要发送的弹幕内容'></textarea><input class='magic-checkbox' type='checkbox' id='enter' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-bottom;padding-left: 7px;'>&nbsp;Enter发送</p><select id='danmuselect' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option>普通弹幕</option><option>高级弹幕</option><option>上电视</option></select><select id='color' style='height:22px;width:75px;margin-top:5px;margin-left:7px' disabled='disabled'><option style='color:blue'>蓝</option><option style='color:green'>绿</option><option style='color:pink'>粉</option><option style='color:orange'>橙</option><option style='color:purple'>紫</option><option style='color:red'>红</option></select><input type='button' id='bnt_chatsend' style='height:22px;width:75px;margin-top:5px;margin-left:7px' value='发送'></section><section id='qfqd' style='display: block;'><p style='height: 27px;'><select id='formatselect' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option>抢分/签到+小尾巴</option><option>签到/抢分+小尾巴+时间</option><option>签到/抢分+时间+小尾巴</option></select><textarea id='tail' style='height: 16px;width: 69px;margin-left: 7px;line-height:12pt;overflow:hidden;vertical-align: bottom;' placeholder='小尾巴'></textarea><input type='button' id='bnt_tailsave' style='width:75px;margin-top: 5px;margin-left:7px;margin-right: auto;' value='保存'></p><p style='height: 18px;margin-top: 5px;text-align: center;'><input class='magic-checkbox' type='checkbox' id='autoqf' style='height:17px;width:17px;vertical-align: text-top;'>&nbsp;自动抢分&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input class='magic-checkbox' type='checkbox' id='autoqd' style='height:17px;width:17px;vertical-align: text-top;'>&nbsp;自动签到</p></section><section id='bet'><textarea id='betmess'  style='margin-top:5px;height:80px;width:233px;margin-left:7px;line-height:12pt;overflow:hidden' readonly='value'></textarea><select id='ywselect' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option style='color:red'>左边</option><option style='color:blue'>右边</option></select><select id='ywnum' style='height:22px;width:75px;margin-top:5px;margin-left:7px' ><option>100</option><option>1000</option><option>10000</option><option>ALL IN</option></select><input type='button' id='bnt_ywconfirm' style='height:22px;width:75px;margin-top:5px;margin-left:7px;color:red' value='压鱼丸'><textarea id='betmess1'  style='margin-top:5px;height:80px;width:233px;margin-left:7px;line-height:12pt;overflow:hidden' readonly='value'></textarea><select id='ywselect1' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option style='color:red'>左边</option><option style='color:blue'>右边</option></select><select id='ywnum1' style='height:22px;width:75px;margin-top:5px;margin-left:7px' ><option>100</option><option>1000</option><option>10000</option><option>ALL IN</option></select><input type='button' id='bnt_ywconfirm1' style='height:22px;width:75px;margin-top:5px;margin-left:7px;color:red;' value='压鱼丸'></section>";
            lastbetcount=betcount;
            activateflag=true;
        }
        else if(betcount==3){
            div.style.setProperty('height', height+'px');
            div.innerHTML = "<section id='dragsection' readonly='value' style='background:white'><p style='font-weight: bold;height: 30px;text-align: left;margin-left: 7px;margin-right: 7px;'>超级小桀房间助手<input type='button' id='bnt_hide' style='width: 65px;margin-top: 5px;margin-left:7px;' value='显示'><input type='button' id='bnt_donate' style='width: 65px;margin-top: 4px;margin-left: 5px;font-weight: bold;color:red;' value='支持一下'></p></section><section id='hide'><p style='height:18px;margin-top: 2px;margin-left: 7px;margin-right: 7px;text-align: center;'><input class='magic-checkbox' type='checkbox' id='hidecredit' style='height:17px;width:17px;vertical-align: middle;'checked=checked>&nbsp;个人信息&nbsp;&nbsp;<input class='magic-checkbox' type='checkbox' id='hidemaps' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-top;'checked=checked>&nbsp;地图信息&nbsp;&nbsp;<input class='magic-checkbox' type='checkbox' id='hideinstructions' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-top;'checked=checked>&nbsp;功能指令</p><p style='height:18px;margin-top: 2px;margin-left: 7px;margin-right: 7px;text-align: center;'><input class='magic-checkbox' type='checkbox' id='hidedanmu' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-top;'checked=checked>&nbsp;弹幕发送&nbsp;&nbsp;<input class='magic-checkbox' type='checkbox' id='hideqfqd' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-top;'checked=checked>&nbsp;抢分签到&nbsp;&nbsp;<input class='magic-checkbox' type='checkbox' id='hidebet' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-top;'checked=checked>&nbsp;竞猜信息</p></section><section id='credit'><textarea id='showcredit' style='margin-top:7px;height:95px;width: 233px;margin-left:7px;line-height:12pt;overflow:hidden;' readonly='value'></textarea></section><section id='maps'><textarea id='showmaps' style='margin-top:5px;height:128px;width: 233px;margin-left:7px;line-height:12pt;overflow:hidden;' readonly='value'></textarea></section><section id='instructions'><input type='button' id='bnt_fullmapsmess' style='width:75px;margin-top:5px;margin-left:7px' value='地图详情'><input type='button' id='bnt_help' style='width:75px;margin-top:5px;margin-left:7px' value='帮助'><input type='button' id='bnt_renew' style='width:75px;margin-top:5px;margin-left:7px' value='刷新'><input type='button' id='bnt_getcredit' style='width:75px;margin-top:5px;margin-left:7px' value='#抢分'><input type='button' id='bnt_joingroup' style='width:75px;margin-left:7px' value='#入团'><input type='button' id='bnt_vip' style='width:75px;margin-top:5px;margin-left:7px' value='#购买会员'><select id='betselect' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option style='color:red'>#1</option><option style='color:blue'>#2</option></select><select id='betcredit' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option>全压了</option><option>压一半</option><option>压1/3</option><option>压1/4</option><option>压1/5</option></select><input type='button' id='bnt_confirm' style='height:22px;width:75px;margin-top:5px;margin-left:7px;color:red' value='压分'><p></section><section id='danmu'><textarea id='write' style='margin-top:5px;height:30px;width:150px;margin-left:7px;margin-right: 7px;line-height:12pt;overflow:hidden;' placeholder='请输入要发送的弹幕内容'></textarea><input class='magic-checkbox' type='checkbox' id='enter' style='margin-left: 7xp;height:17px;width:17px;vertical-align: text-bottom;padding-left: 7px;'>&nbsp;Enter发送</p><select id='danmuselect' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option>普通弹幕</option><option>高级弹幕</option><option>上电视</option></select><select id='color' style='height:22px;width:75px;margin-top:5px;margin-left:7px' disabled='disabled'><option style='color:blue'>蓝</option><option style='color:green'>绿</option><option style='color:pink'>粉</option><option style='color:orange'>橙</option><option style='color:purple'>紫</option><option style='color:red'>红</option></select><input type='button' id='bnt_chatsend' style='height:22px;width:75px;margin-top:5px;margin-left:7px' value='发送'></section><section id='qfqd' style='display: block;'><p style='height: 27px;'><select id='formatselect' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option>抢分/签到+小尾巴</option><option>签到/抢分+小尾巴+时间</option><option>签到/抢分+时间+小尾巴</option></select><textarea id='tail' style='height: 16px;width: 69px;margin-left: 7px;line-height:12pt;overflow:hidden;vertical-align: bottom;' placeholder='小尾巴'></textarea><input type='button' id='bnt_tailsave' style='width:75px;margin-top: 5px;margin-left:7px;margin-right: auto;' value='保存'></p><p style='height: 18px;margin-top: 5px;text-align: center;'><input class='magic-checkbox' type='checkbox' id='autoqf' style='height:17px;width:17px;vertical-align: text-top;'>&nbsp;自动抢分&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input class='magic-checkbox' type='checkbox' id='autoqd' style='height:17px;width:17px;vertical-align: text-top;'>&nbsp;自动签到</p></section><section id='bet'><textarea id='betmess'  style='margin-top:5px;height:80px;width:233px;margin-left:7px;line-height:12pt;overflow:hidden' readonly='value'></textarea><select id='ywselect' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option style='color:red'>左边</option><option style='color:blue'>右边</option></select><select id='ywnum' style='height:22px;width:75px;margin-top:5px;margin-left:7px' ><option>100</option><option>1000</option><option>10000</option><option>ALL IN</option></select><input type='button' id='bnt_ywconfirm' style='height:22px;width:75px;margin-top:5px;margin-left:7px;color:red' value='压鱼丸'><textarea id='betmess1'  style='margin-top:5px;height:80px;width:233px;margin-left:7px;line-height:12pt;overflow:hidden' readonly='value'></textarea><select id='ywselect1' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option style='color:red'>左边</option><option style='color:blue'>右边</option></select><select id='ywnum1' style='height:22px;width:75px;margin-top:5px;margin-left:7px' ><option>100</option><option>1000</option><option>10000</option><option>ALL IN</option></select><input type='button' id='bnt_ywconfirm1' style='height:22px;width:75px;margin-top:5px;margin-left:7px;color:red;' value='压鱼丸'><textarea id='betmess2'  style='margin-top:5px;height:80px;width:233px;margin-left:7px;line-height:12pt;overflow:hidden' readonly='value'></textarea><select id='ywselect2' style='height:22px;width:75px;margin-top:5px;margin-left:7px'><option style='color:red'>左边</option><option style='color:blue'>右边</option></select><select id='ywnum2' style='height:22px;width:75px;margin-top:5px;margin-left:7px' ><option>100</option><option>1000</option><option>10000</option><option>ALL IN</option></select><input type='button' id='bnt_ywconfirm2' style='height:22px;width:75px;margin-top:5px;margin-left:7px;color:red;' value='压鱼丸'></section>";
            lastbetcount=betcount;
            activateflag=true;
        }
        if (qf){
            $("#autoqf").prop("checked",true);
        }
        if(qd){
            $("#autoqd").prop("checked",true);
        }
        if (et){
            $("#enter").prop("checked",true);
        }
    }

    switch(betcount){
        case 3:
            $("#betmess2").val("竞猜信息:     "+$('span.GuessMainPanelBoxRight-rightBar:eq(2)').text()+"\n" + $('div.boxLeft:eq(2)').text() + "\n左边:" + $('p.GuessContItem-itemTitle:eq(4)').text() + "   "  + $('p.GuessContItem-itemLoss:eq(4)').text() + "\n右边:" + $('p.GuessContItem-itemTitle:eq(5)').text() +  "   "  + $('p.GuessContItem-itemLoss:eq(5)').text() +  "\n"   +  $('.bidNumLeft:eq(2)').text()  + " VS " + $('.bidNumRight:eq(2)').text());
        case 2:
            $("#betmess1").val("竞猜信息:     "+$('span.GuessMainPanelBoxRight-rightBar:eq(1)').text()+"\n" + $('div.boxLeft:eq(1)').text()  + "\n左边:" + $('p.GuessContItem-itemTitle:eq(2)').text() + "   "  + $('p.GuessContItem-itemLoss:eq(2)').text() + "\n右边:" + $('p.GuessContItem-itemTitle:eq(3)').text() +  "   "  + $('p.GuessContItem-itemLoss:eq(3)').text() +  "\n" +  $('.bidNumLeft:eq(1)').text()  + " VS " + $('.bidNumRight:eq(1)').text());
        case 1:
            $("#betmess").val("竞猜信息:     "+$('span.GuessMainPanelBoxRight-rightBar:eq(0)').text()+"\n" + $('div.boxLeft:eq(0)').text()  + "\n左边:" + $('p.GuessContItem-itemTitle:eq(0)').text() + "   "  + $('p.GuessContItem-itemLoss:eq(0)').text() + "\n右边:" + $('p.GuessContItem-itemTitle:eq(1)').text() +  "   "  + $('p.GuessContItem-itemLoss:eq(1)').text() +  "\n"  +  $('.bidNumLeft:eq(0)').text()  + " VS " + $('.bidNumRight:eq(0)').text() );break;
    }
}

function tail(){
    alert("由于此版本改动较大,耗费大量时间,小尾巴功能还未来得及完成,而反馈需要隐藏功能和enter监听功能水友太多,故提前发布此版本,小尾巴功能将在下个版本更新,敬请期待...");
}

function activate(){
    var betcount=$('.GuessGameBox').length;
    var newDiv=document.getElementById("dragsection");
    newDiv.addEventListener("mouseover", over,false);
    newDiv.addEventListener('mousedown', down, false);
    newDiv.addEventListener('mousemove', move, false);
    newDiv.addEventListener('mouseup', up, false);
    document.getElementById('bnt_donate').addEventListener('click', function (event) { donate(); }, false);
    document.getElementById('bnt_fullmapsmess').addEventListener('click', function (event) { fullmapsmess(); }, false);
    document.getElementById('bnt_renew').addEventListener('click', function (event) { renew(); }, false);
    document.getElementById('bnt_confirm').addEventListener('click', function (event) { betcredit(); }, false);
    document.getElementById('bnt_help').addEventListener('click', function (event) { help(); }, false);
    document.getElementById('betselect').addEventListener('click', function (event) { select(); }, false);
    document.getElementById('bnt_chatsend').addEventListener('click', function (event) { chatsend(); }, false);
    document.getElementById('color').addEventListener('click', function (event) { sendcolor(); }, false);
    document.getElementById('danmuselect').addEventListener('click', function (event) { danmuselect(); }, false);
    document.getElementById('bnt_hide').addEventListener('click', function (event) { hide(); }, false);
    document.getElementById('bnt_tailsave').addEventListener('click', function (event) { tail(); }, false);
    switch(betcount){
        case 3:
            document.getElementById('ywselect2').addEventListener('click', function (event) { ywselect('ywselect2','bnt_ywconfirm2'); }, false);
            document.getElementById('bnt_ywconfirm2').addEventListener('click', function (event) { betyw('ywselect2','ywnum2','bnt_ywconfirm2'); }, false);
        case 2:
            document.getElementById('ywselect1').addEventListener('click', function (event) { ywselect('ywselect1','bnt_ywconfirm1'); }, false);
            document.getElementById('bnt_ywconfirm1').addEventListener('click', function (event) { betyw('ywselect1','ywnum1','bnt_ywconfirm1'); }, false);
        case 1:
            document.getElementById('ywselect').addEventListener('click', function (event) { ywselect('ywselect','bnt_ywconfirm'); }, false);
            document.getElementById('bnt_ywconfirm').addEventListener('click', function (event) { betyw('ywselect','ywnum','bnt_ywconfirm'); }, false);
    }
}

function over(e) {
    div.style.cursor="move"
}

function down(e) {
    e = e || window.event;
    x = e.clientX - div.offsetLeft;
    y = e.clientY - div.offsetTop;
    dragFlag = true;
}

function move(e) {
    if (dragFlag) {
        div.style.cursor="move"
        e = e || window.event;
        div.style.left = e.clientX - x + 'px';
        div.style.top = e.clientY - y + 'px';
    }
}

function up(e) {
    if (dragFlag) {
        GM_setValue('left',div.style.left);
        GM_setValue('top',div.style.top);
    }
    dragFlag = false;
    div.style.cursor="auto"
}

function sighin(){
    var date=new Date();
    var m=date.getMinutes();
    if(m==0||m==30){
        if (sighinflag) {
            danmu("#签到");
            sighinflag = false
        }
    }
    else {sighinflag = true;
         }
}

function giftcheck(){
    if (giftCheck!=0&&giftOpen==0&&$('span.TreasureNum-val').length==0){
        lastgiftnum=1;
        giftflag = false;
        setTimeout(
            function(){
                danmu("#抢分");
            },1000);
    }
}

function exgiftcheck(){
    if ($('span.TreasureNum-val').length!=0){
        giftnum=$('span.TreasureNum-val').text();
        if (giftnum>lastgiftnum){
            lastgiftnum=giftnum;
            giftflag = false;
            setTimeout(
                function(){
                    danmu("#抢分");
                },1000);
        }
        else{
            lastgiftnum=giftnum;
        }
    }
}

function danmu(str){
    if($('div.ChatSend-button').text()=='发送'){
        if (str == lastText){
            str = str + " " + Math.ceil(Math.random()*5)
        }
        $(".ChatSend-txt").val(str);
        $('div.ChatSend-button').click();
        lastText = str;
    }
}

function getCookie(cname){
    var name = cname + "=";
    var ca = document.cookie.split(';');
    for(var i=0; i<ca.length; i++){
        var c = ca[i].trim();
        if (c.indexOf(name)==0) return c.substring(name.length,c.length);
    }
    return "";
}