Skip to content

Instantly share code, notes, and snippets.

@lackneets
Forked from mingtsay/facebook-like.js
Last active August 29, 2015 14:02
Show Gist options
  • Save lackneets/acd18238c804ce3e11ca to your computer and use it in GitHub Desktop.
Save lackneets/acd18238c804ce3e11ca to your computer and use it in GitHub Desktop.
setInterval(function () {
// 取得網頁上所有連結
var a = document.getElementsByTagName('a');
// 針對每個連結跑一次
for (var i in a) {
// 檢查是不是真的是連結
if (a.hasOwnProperty(i)) {
// 檢查是不是讚的連結
if (a[i].className == "UFILikeLink") {
// 檢查是不是還沒按過讚
if (a[i].title == "覺得這很讚") {
// 檢查能不能點下去
if (a[i].click) {
// 點下去
a[i].click();
// 在 console 顯示已讚字樣
console.log('已讚', i);
}
}
}
}
}
}, 200);
(function autoPoke() {
function clickAll(elements) {
for (var i in elements) {
if (elements.hasOwnProperty(i) && elements[i].click) {
elements[i].click();
}
}
}
var pokeTimer = setInterval(function () {
var a = $$("._42ft._4jy0._4jy3._4jy1.selected");
clickAll(a);
console.log('戳戳戳...')
if ($$("._42ft._4jy0._4jy3._4jy1.selected.layerCancel").length) {
clearInterval(pokeTimer);
console.log('戳爆了,下次再玩');
//因為 modal 顯示需要時間
setTimeout(function () {
clickAll($$("._42ft._4jy0._4jy3._4jy1.selected.layerCancel"));
}, 600);
return;
}
}, 800);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment