斗鱼掉宝
// ==UserScript==
// @name 斗鱼掉宝
// @namespace http://tampermonkey.net/
// @version 0.2
// @description try to take over the world!
// @author You
// @match https://www.douyu.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
setInterval(checkBox, 10000);
var mp3 = new Audio("https://img.tukuppt.com/newpreview_music/09/00/40/5c8921ff4c61461939.mp3");
//备用音频,当前不可用可切换至该音频
//var mp3 = new Audio("//downsc.chinaz.net/Files/DownLoad/sound1/202307/y1945.wav");
mp3.loop = true;
//检测掉宝窗口是否弹出
function checkBox(){
//var name = "GuessGuideList-box-playGuessBtn";
var name = "PELact-btn";
if(document.getElementsByClassName(name).length){
//如果要自动点击,去掉下面这一行的双斜杠 //
document.getElementsByClassName(name)[0].click();
showLog("领取掉宝成功");
//播放声音
mp3.play();
}else{
showLog("不存在掉宝");
mp3.pause();
}
}
//显示日志
function showLog(msg = ''){
var now = new Date();
var hours = now.getHours();
if(hours < 10){ hours = "0" + hours}
var minutes = now.getMinutes();
if(minutes < 10){ minutes = "0" + minutes}
console.log(hours + ":"+ minutes + " " + msg);
}
})();