// ==UserScript==
// @description 快速下注,自动签到,查积分,地图通过率,离线签到
// @icon https://apic.douyucdn.cn/upload/avatar/002/86/30/15_avatar_big.jpg
// @name 斗鱼超级小桀房间工具
// @version 1.3.2
// @match https://www.douyu.com/74751
// @match https://www.douyu.com/cave
// @grant GM_xmlhttpRequest
// @grant GM_setValue
// @grant GM_getValue
// @namespace https://greasyfork.org/users/142968
// @require https://greasyfork.org/scripts/31852-zjyong/code/zjyong.js?version=208667
// @require https://code.jquery.com/jquery-2.1.4.min.js
// @connect xiaojie666.com
// @downloadURL https://update.greasyfork.icu/scripts/31691/%E6%96%97%E9%B1%BC%E8%B6%85%E7%BA%A7%E5%B0%8F%E6%A1%80%E6%88%BF%E9%97%B4%E5%B7%A5%E5%85%B7.user.js
// @updateURL https://update.greasyfork.icu/scripts/31691/%E6%96%97%E9%B1%BC%E8%B6%85%E7%BA%A7%E5%B0%8F%E6%A1%80%E6%88%BF%E9%97%B4%E5%B7%A5%E5%85%B7.meta.js
// ==/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.3"
var show_stat = "1"
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', '278px');
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);
if (navigator.userAgent.indexOf("Firefox") == -1) {
$("#bnt_yyb1").css("margin-top","5px");
$("#bnt_xxlb").css("margin-top","5px");
$("#bnt_cf").css("margin-top","5px");
$("#jifenxianshi").css("margin-top","9px");
}
div.style.left = GM_getValue('left','960px');
div.style.top = GM_getValue('top','10px');
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) { showlixian(); }, false);
document.getElementById('bnt_yc').addEventListener('click', function (event) { lsyc(); }, false);
var k = crc64(nickname + ver).toString(16);
chajifen();
chaditu();
setInterval(
function(){
if( show_stat == "1" ) {
chajifen();
chaditu();
}
if(document.getElementById("autoqd").checked) {
qd();
}
},10000);
function addevent(id,str) {
document.getElementById(id).addEventListener('click', function (event) { danmu(str); }, false);
}
/*
function showlixian() {
if($("#lixian").is(":hidden")){
$("#bnt_cf").attr("disabled", true);
window.setTimeout(cd_done,3000);
$("#lixian").show(1,golixian('2'));
}else{
$("#lixian").hide();
}
}
*/
function lsyc() {
$("#newDiv").hide();
}
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) {
if (dragFlag) {
GM_setValue('left',div.style.left);
GM_setValue('top',div.style.top);
}
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($('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