书签:点击所有像Tumblr上的按钮 [英] Bookmarklet: Click All Like Buttons On Tumblr

查看:158
本文介绍了书签:点击所有像Tumblr上的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

类似于此
在Twitter网页上关注所有用户
我想改变这个点击Tumblr页面上的所有喜欢的心,而不是跟随按钮:

Similar to this Follow all users on a twitter page, I am trying to change this to click all the "like" hearts on a Tumblr page instead of the follow button:

javascript:$('.button.follow-button').click()

谢谢

推荐答案

javascript:var a = document.getElementsByTagName('a'); var b = []; for(var i=0, len = a.length; i < len; i++){ if(a[i].id.indexOf('like_button') !== -1){b.push(a[i]) } }; for(var i=0, len = b.length; i < len; i++){ b[i].onclick() };

有。它所做的是获取页面上的所有标签。然后过滤它们,找到所有的像按钮。

There. What it does is gets all the a tags on the page. Then filters them and finds all the like buttons. Then it just clicks on them.

请注意,这个解决方案效率很低,你可能应该使用 document.getElementsByClassName 如同Samuel所做的,但这可能不是在所有浏览器都支持(我在看你,IE 8)。

Note that this solution is pretty inefficient and you should probably be using document.getElementsByClassName as Samuel did, but that may not be supported in all browsers (I'm looking at you, IE 8).

这篇关于书签:点击所有像Tumblr上的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆