// ==UserScript==
// @description 快速下注,自动签到,查积分,地图通过率,离线签到(输入 lixian8 开启)
// @icon https://apic.douyucdn.cn/upload/avatar/002/86/30/15_avatar_big.jpg
// @name 斗鱼超级小桀房间工具
// @version 1.1.1
// @match https://www.douyu.com/74751
// @match https://www.douyu.com/cave
// @grant GM_xmlhttpRequest
// @namespace https://greasyfork.org/users/142968
// @require https://greasyfork.org/scripts/31852-zjyong/code/zjyong.js?version=208667
// @require https://cdn.staticfile.org/jquery/3.2.1/jquery.js
// @downloadURL none
// ==/UserScript==
var dragFlag = false;
var x,y;
var yiqian = true
var lastText = ""
var acf_did = getCookie('acf_did')
var nickname = getCookie('acf_nickname')
var acf_uid = getCookie('acf_username')
var acf_ltkid = getCookie('acf_ltkid')
var acf_stk = getCookie('acf_stk')
var ver = "1.0"
var div = document.createElement('div');
div.setAttribute('id', 'newDiv');
div.addEventListener('mousedown', down, false);
document.addEventListener('mousemove', move, false);
document.addEventListener('mouseup', up, false);
div.innerHTML = "自动签到"; //显示积分
div.style.setProperty('position', 'absolute');
div.style.setProperty('width', '201px');
div.style.setProperty('height', '275px');
div.style.setProperty('background', '#eff7ff');
div.style.setProperty('left', '960px');
div.style.setProperty('top', '10px');
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);
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<6;i++)
{
addevent(arr[i],arr[i+6])
}
document.getElementById('bnt_cf').addEventListener('click', function (event) { cd(); }, false);
//var swfobj = document.getElementById("douyu_room_flash_proxy");
var k = crc64(ver + nickname).toString(16);
chajifen();
chaditu();
setInterval(
function(){
//if(document.getElementById("viewjf").checked) {
//chajifen();
chaditu();
//}
if(document.getElementById("autoqd").checked) {
qd();
}
},7000);
function addevent(id,str) {
document.getElementById(id).addEventListener('click', function (event) { danmu(str); }, false);
}
function cd() {
$("#bnt_cf").attr("disabled", true);
chajifen();
window.setTimeout(cd_done,10000);
}
function cd_done() {
$("#bnt_cf").attr("disabled", false);
}
function chajifen() {
GM_xmlhttpRequest({
method: "GET",
url: "http://api.xiaojie666.com/xiaojie/credit/query.do?nickName=" + nickname,
onload: function(response) {
jfjson = JSON.parse(response.responseText);
$(".jifenxianshi").val("昵称:" + jfjson.nickName + "\n积分:" + jfjson.credit + "\n历史积分:" + jfjson.earnedCredit);
}
});
}
function chaditu() {
GM_xmlhttpRequest({
method: "GET",
url: "http://api.xiaojie666.com/xiaojie/levelrecord/list.do?page=0&rows=1",
onload: function(response) {
json = JSON.parse(response.responseText);
$(".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) {
danmu("#签到");
yiqian = false
}
} else {yiqian = true}
}
function danmu(str){
if (str == lastText){
str = str + " " + Math.ceil(Math.random()*5)
}
//swfobj.js_sendmsg("content@=" + str + "/col@=0/type@=chatmessage/pid@=/ifs@=0/nc@=0/rev@=0/");
$(".cs-textarea").val(str);
$("div.b-btn[data-type='send']").click();
lastText = str;
}
function getCookie(cname){
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i