Tuesday, November 6, 2012

Tired of manually clicking all the check boxes?

Now that I have a bit of JS/jQuery under my belt, I've noticed I can do some pretty useful tricks on websites when the occasion arises.

Most recently, this entailed selecting all 800 or so of my friends on Facebook to share a Kickstarter I'm helping launch. I never promote anything on Facebook, so I decided I'd let myself do it just this once.

Anyway, here's how I did it in about 5 seconds:

1. Open the share pop-up and scroll to the bottom
2. Open developer tools and go to console
3. Paste jquery in
4. Type: 
$('li[role="option"]:not(.disabledCheckable)').each(function(e){$(this).click()})
Done!
(alternative way: 4. type: $('input[type="checkbox"]').attr('checked', 'true')
$('input[type="checkbox"]').remove('[disabled]').each(function(e){$(this).click()})
5. type: $('li.multiColumnCheckable').addClass('selectedCheckable') )

I was sharing a page I created for the electree+, an electric bonsai tree that charges electronics with solar power :)

No comments:

Post a Comment