Greasy Fork

Greasy Fork is available in English.

斗鱼超级小桀房间工具

快速下注,签到,查积分,地图通过率

当前为 2017-07-23 提交的版本,查看 最新版本

// ==UserScript==
// @description 快速下注,签到,查积分,地图通过率
// @icon https://apic.douyucdn.cn/upload/avatar/002/86/30/15_avatar_big.jpg
// @name 斗鱼超级小桀房间工具
// @version 0.1
// @match https://www.douyu.com/74751
// @match https://www.douyu.com/cave
// @grant none
// @namespace http://greasyfork.icu/users/142968
// ==/UserScript==

var dragFlag = false;
var x,y;
var URL
var yiqian = true
 
  var div = document.createElement('div');
  div.setAttribute('id', 'newDiv');
  //div.addEventListener("click", Foo, false); 
  div.addEventListener('mousedown', down, false);
  div.addEventListener('mousemove', move, false);
  div.addEventListener('mouseup', up, false);
  div.innerHTML = "<input type=\'button\' id=\'bnt_qyl1\' style='width:90px;margin-top:10px;margin-left:7px' value=\'#1 全压了\'><input type=\'button\' id=\'bnt_qyl2\' style='width:90px;margin-left:7px' value=\'#2 全压了\'><input type=\'button\' id=\'bnt_yyb1\' style='width:90px;margin-left:7px' value=\'#1 压一半\'><input type=\'button\' id=\'bnt_yyb2\' style='width:90px;margin-left:7px' value=\'#2 压一半\'><input type=\'button\' id=\'bnt_xxlb\' style='width:90px;margin-left:7px' value=\'#谢谢老板\'><input type=\'button\' id=\'bnt_qd\' style='width:90px;margin-left:7px' value=\'#签到\'><input type='checkbox' checked='checked' id='autoqd' style='margin-top:7px;margin-left:107px' value='自动签到' />自动签到<textarea class='jifenxianshi' style='margin-top:7px;height:50px;width:177px;margin-left:7px;line-height:12pt;overflow:hidden' readonly='value'></textarea><textarea class='dituxianshi' style='margin-top:7px;height:82px;width:177px;margin-left:7px;line-height:12pt;overflow:hidden' readonly='value'></textarea>";
  div.style.setProperty('position', 'absolute');
  div.style.setProperty('width', '201px');
  div.style.setProperty('height', '275px');
  div.style.setProperty('background', '#f60');
  div.style.setProperty('left', '940px');
  div.style.setProperty('top', '10px');
  div.style.setProperty('border', '1px solid gray');
  div.style.setProperty('z-index', '999');
  document.body.appendChild(div);
  
  var arr=new Array("bnt_qyl1","bnt_qyl2","bnt_yyb1","bnt_yyb2","bnt_xxlb","bnt_qd","#1 老子全压了","#2 老子全压了","#1 老子压一半","#2 老子压一半","#谢谢老板","#签到"); 

for (var i=0;i<4;i++) 
  {
    addevent(arr[i],arr[i+6])
  }

  document.getElementById('bnt_xxlb').addEventListener('click', function (event) { kg("#谢谢老板"); }, false);
  document.getElementById('bnt_qd').addEventListener('click', function (event) { kg("#签到"); }, false);

var nickname = getCookie('acf_nickname');

 setInterval(
        function(){
        chajifen(nickname);
        chaditu();
        if(document.getElementById("autoqd").checked) {
              qd();
        }
    },6000);
  //alert(URL);
 
function addevent(id,str) {
   document.getElementById(id).addEventListener('click', function (event) { danmu(str); }, false);
}

function chajifen(name) {
    URL = 'http://api.xiaojie666.com/xiaojie/credit/query.do?nickName=' + name
  
    
    fetch(URL).then(function(response) {
        return response.json();
    }).then(function(json) {
       $(".jifenxianshi").val("昵称:" + json.nickName + "\n" + "积分:" + json.credit + "\n" + "历史积分:"+json.earnedCredit);
    });
}
 
function chaditu() {
  
    fetch('http://api.xiaojie666.com/xiaojie/levelrecord/list.do?page=0&rows=1').then(function(response) {
        return response.json();
    }).then(function(json) {
       $(".dituxianshi").val("ID:" + json.levelRecords[0].levelId  + "\n" + "国家:"+json.levelRecords[0].creator_ntd_origin_zh + "\n" + "尝试次数:"+json.levelRecords[0].attempts + "\n" + "通过率:"+(json.levelRecords[0].clearrate * 100).toFixed(2) + "%"+ "\n" + "地图名:" + json.levelRecords[0].name_zh);
    });
}



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

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

function kg(str){
  var time1 =  (new Date()).valueOf() + ""; 
   str = str + " " + time1.slice(-4);
   danmu(str);
}
  
function danmu(str){

  $(".cs-textarea").val(str);
  $("div.b-btn[data-type='send']").click();

}

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