Greasy Fork

Greasy Fork is available in English.

超级小桀房间小助手

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

目前为 2019-04-10 提交的版本。查看 最新版本

// ==UserScript==
// @author DreamChaser
// @description 快速下注,自动签到,查看积分,自动抢积分,查看地图详情,查看竞猜信息,快速压鱼丸、快速发弹幕。
// @icon https://apic.douyucdn.cn/upload/avatar/002/86/30/15_avatar_big.jpg
// @name 超级小桀房间小助手
// @version 1.5.1
// @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 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,ywSelected,color,text,giftStatusCheck,giftOpen;
var giftFlag=true,activateFlag=false;
var mapsJSON,creditJSON;
var fullTailText=GM_getValue('fullTailText', ''),tailFlag=1;
var year,month,date,h,m,s,now;

var div = document.createElement('div');
var dragDiv=document.getElementById("drag");
div.setAttribute('id', 'newDiv');
div.style.setProperty('position', 'fixed');
div.style.setProperty('width', '253px');
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);
            giftStatusCheck=$('div.TreasureStatus-text').length;
            giftOpen=$('.TreasureStatus-bg.is-open').length;
            if(giftStatusCheck==0){
                giftFlag = true;
            }
            if( document.getElementById("autoqf").checked) {
                exGiftCheck();
                if (giftFlag){
                    giftCheck();
                }
            }
            betMess();
        },1000);
});

function getNow() {
    function fix (s){
        return s < 10 ? '0' + s: s;
    }
    var myDate = new Date();
    year=myDate.getFullYear();
    month=fix(myDate.getMonth()+1);
    date=fix(myDate.getDate());
    h=fix(myDate.getHours());
    m=fix(myDate.getMinutes());
    s=fix(myDate.getSeconds());
    now=year+'-'+month+"-"+date+" "+h+':'+m+":"+s;
}

function notifiy(title,body,icon,click_url) {
    var notificationDetails = {
        text: `*嘉嘉 @苹果DY 匿名大佬 *玮灏 *超群 *友 *迪鑫 *永寿
点我查看新版本预告&支持!`,
        title: "感谢以下水友对本插件的大力支持",
        image: icon,
        onclick: function () {
            window.open("https://note.youdao.com/ynoteshare1/index.html?id=a667b6a4cf64b3c053ee091d448f2891&type=note");
        }
    };
    var lastDate=GM_getValue('date', 0);
    getNow();
    GM_setValue('date', date);
    if(date != lastDate){
        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 arr1=new Array(a,b,c,d,e,f,"credit","maps","instructions","danmu","qfqd","bet");
    var arr2=new Array(a,b,c,d,e,f,"#hidecredit","#hidemaps","#hideinstructions","#hidedanmu","#hideqfqd","#hidebet");
    var trueheight=$('section#drag').outerHeight(true)+$('section#hide').outerHeight(true),height;
    for (var i=0;i<6;i++){
        GM_setValue(arr2[i+6], arr2[i]);
        var name="section#"+arr1[i+6]
        height=$(name).outerHeight(true);
        if(arr1[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积分。

小尾巴:在自动签到抢分的时候加上自定义内容,如:“抢分/签到+小尾巴+时间 主播你真丑”则每次自动签到的内容为:“#抢分 主播你真丑 2019-4-9 5:00: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){
    ywSelected=$("#"+set).find("option:selected").text();
    if(ywSelected=='左边'){
        $("#"+bnt).css("color","red");
    }
    else{
        $("#"+bnt).css("color","blue");
    }
}

function betYw(set,num,bnt){
    var ywnum = $("#"+num).find("option:selected").text();
    ywSelected=$("#"+set).find("option:selected").text();
    if(ywSelected=='左边'){
        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 recoverStatus() {
    var qf=GM_getValue('autoqf',false),qd=GM_getValue('autoqd',false),et=GM_getValue('enter',false);
    var a=GM_getValue('#hidecredit',false),b=GM_getValue('#hidemaps',false),c=GM_getValue('#hideinstructions',false),d=GM_getValue('#hidedanmu',false),e=GM_getValue('#hideqfqd',false),f=GM_getValue('#hidebet',false);
    var arr=new Array(a,b,c,d,e,f,qf,qd,et,"#hidecredit","#hidemaps","#hideinstructions","#hidedanmu","#hideqfqd","#hidebet",'#autoqf','#autoqd',"#enter");
    for (var i=0;i<9;i++){
        if(arr[i])
        {
            $(arr[i+9]).prop("checked",true);
        }
        else
        {
            $(arr[i+9]).prop("checked",false);
        }
    }
    hide();
}

function betMess() {
    var betcount=$('.GuessGameBox').length;
    var height;
    if(betcount!=lastBetCount){
        if(betcount==0)
        {
            div.style.setProperty('height', height+'px');
            div.innerHTML = "<section id='drag' 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:96px;width: 233px;margin-left:7px;line-height:12pt;overflow:hidden;resize:none;' readonly='value'></textarea></section><section id='maps'><textarea id='showmaps' style='margin-top:5px;height:127px;width: 233px;margin-left:7px;line-height:12pt;overflow:hidden;resize:none;' 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>压1/5</option><option>压1/4</option><option>压1/3</option><option>压一半</option><option>全压了</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:151px;margin-left:7px;margin-right: 7px;line-height:12pt;overflow:hidden;resize:none;' 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;resize:none;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='drag' 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:96px;width: 233px;margin-left:7px;line-height:12pt;overflow:hidden;resize:none;' readonly='value'></textarea></section><section id='maps'><textarea id='showmaps' style='margin-top:5px;height:127px;width: 233px;margin-left:7px;line-height:12pt;overflow:hidden;resize:none;' 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>压1/5</option><option>压1/4</option><option>压1/3</option><option>压一半</option><option>全压了</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:151px;margin-left:7px;margin-right: 7px;line-height:12pt;overflow:hidden;resize:none;' 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;resize:none;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='drag' 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:96px;width: 233px;margin-left:7px;line-height:12pt;overflow:hidden;resize:none;' readonly='value'></textarea></section><section id='maps'><textarea id='showmaps' style='margin-top:5px;height:127px;width: 233px;margin-left:7px;line-height:12pt;overflow:hidden;resize:none;' 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>压1/5</option><option>压1/4</option><option>压1/3</option><option>压一半</option><option>全压了</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:151px;margin-left:7px;margin-right: 7px;line-height:12pt;overflow:hidden;resize:none;' 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;resize:none;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='drag' 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:96px;width: 233px;margin-left:7px;line-height:12pt;overflow:hidden;resize:none;' readonly='value'></textarea></section><section id='maps'><textarea id='showmaps' style='margin-top:5px;height:127px;width: 233px;margin-left:7px;line-height:12pt;overflow:hidden;resize:none;' 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>压1/5</option><option>压1/4</option><option>压1/3</option><option>压一半</option><option>全压了</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:151px;margin-left:7px;margin-right: 7px;line-height:12pt;overflow:hidden;resize:none;' 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;resize:none;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;
        }
        recoverStatus();
    }

    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(){
    var tailText = $('#tail').val();
    var formatselect = $("#formatselect").find("option:selected").text();
    getNow();
    if(formatselect=='抢分/签到+小尾巴'){
        fullTailText=tailText;
        tailFlag=1;
    }
    else if (formatselect=='签到/抢分+小尾巴+时间'){
        if (tailText.length==0){
            fullTailText=now;
        }
        else {
            fullTailText=tailText+" "+now;
        }
        tailFlag=2;
    }
    else {
        if (tailText.length==0){
            fullTailText=now;
        }
        else{
            fullTailText=now+" "+tailText;
        }
        tailFlag=3;
    }
    GM_setValue('tailText',tailText);
    GM_setValue('tailFlag',tailFlag);
    $('#tail').val('');
    alert("保存成功,当前格式为:#抢分/签到 "+fullTailText);
}

function fulltail(danmu){
    var tailText = GM_getValue('tailText','');
    getNow();
    if (tailText.length==0){
        if(GM_getValue('tailFlag',tailFlag)==1){
            return (danmu);
        }
        else {
            return(danmu+" "+now);
        }
    }
    else{
        if(GM_getValue('tailFlag',tailFlag)==1){
            return (danmu+" "+tailText);
        }
        else if (GM_getValue('tailFlag',tailFlag)==2){
            return(danmu+" "+tailText+" "+now);
        }
        else {
            return(danmu+" "+now+" "+tailText);
        }
    }
}

function activate(){
    var betcount=$('.GuessGameBox').length;
    var dragDiv=document.getElementById("drag");
    dragDiv.addEventListener("mouseover", over,false);
    dragDiv.addEventListener('mousedown', down, false);
    dragDiv.addEventListener('mousemove', move, false);
    dragDiv.addEventListener('mouseup', up, false);
    dragDiv.addEventListener("mouseout", out,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 out(e) {
    div.style.cursor="auto"
}

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(fulltail("#签到"));
            sighInFlag = false
        }
    }
    else {
        sighInFlag = true;
    }
}

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

function exGiftCheck(){
    if ($('span.TreasureNum-val').length!=0){
        giftNum=$('span.TreasureNum-val').text();
        if (giftNum>lastGiftNum){
            lastGiftNum=giftNum;
            giftFlag = false;
            setTimeout(
                function(){
                    danmu(fulltail("#抢分"));
                },1000);
        }
        else{
            lastGiftNum=giftNum;
        }
    }
    else{
        lastGiftNum=1;
    }
}

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;
        getNow();
        console.log(now+" 发送:"+lastText);
    }
}

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 "";
}