Created
December 1, 2013 09:50
-
-
Save patwonder/7730560 to your computer and use it in GitHub Desktop.
贴吧自动点奖励
============
自动点在线时间奖励、随机T豆奖励和贴条奖励等。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @id tieba.baidu.com-3fca9dd7-d351-48ce-8da7-6daa71bab5f9@[email protected] | |
// @name 贴吧自动点奖励 | |
// @version 1.0 | |
// @namespace [email protected] | |
// @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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment