|
// ==UserScript==
// @id tieba.baidu.com-3fca9dd7-d351-48ce-8da7-6daa71bab5f9@patwonder@163.com
// @name 贴吧自动点奖励
// @version 1.0
// @namespace patwonder@163.com
// @author patwonder
// @description 自动点在线时间奖励、随机T豆奖励和贴条奖励等。
// @include http://tieba.baidu.com/f?kw=*
// @include http://tieba.baidu.com/f?*&kw=*
// @include http://tieba.baidu.com/f?kz=*
// @include http://tieba.baidu.com/p/*
// @include http://tieba.baidu.com/f?*ct=*z=*
// @run-at document-end
// ==/UserScript==
(function(d, w) {
// Poll interval
var INTERVAL = 5000;
// Things to auto-click
var SELECTOR = ".time_gift.unopen_gift, .rand_gift, .tb_paper_beg_btn_open";
function clickButton(button) {
var evt = d.createEvent("MouseEvent");
evt.initMouseEvent("click", true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
button.dispatchEvent(evt);
console.log("Clicked " + button.tagName + [].map.call(button.classList, function(cls) {
return "." + cls;
}).join(""));
}
function check() {
var buttons = d.querySelectorAll(SELECTOR);
if (buttons.length) {
[].forEach.call(buttons, clickButton)
}
}
check();
setTimeout(check, 100);
setTimeout(check, 200);
setTimeout(check, 500);
setTimeout(check, 1000);
setTimeout(check, 2000);
setInterval(check, INTERVAL);
})(document, window); |
|