Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add blog post: Twitter bookmarklets

  • Loading branch information...
commit a00ca1b2ca5963be25d0e0ad4030163fd0afcc0e 1 parent dfd1d4e
Simon Whitaker authored
48 source/_posts/2012-04-25-twitter-bookmarklets.markdown
View
@@ -0,0 +1,48 @@
+---
+layout: post
+title: "Twitter bookmarklets for hiding replies and RTs"
+date: 2012-04-25 10:14
+comments: true
+categories:
+---
+
+When I visit someone's profile on [Twitter.com](http://twitter.com/) it's generally because I want to see what they've written to me, the arbitrary reader. However, I often can't see the wood for the trees; in a timeline with lots of replies and/or retweets it's often hard to weedle out just that user's original tweets.
+
+For example, here's the current selection of above-the-fold tweets from the ever-readable [Glenn Fleishman](https://twitter.com/#!/glennf):
+
+![@GlennF timeline including replies](/images/glennf-timeline-with-replies.png)
+
+It's all replies! That's not to criticise Glenn. Quite the reverse; it's great to see people having a two-way conversation on Twitter, it's just that I'm not interested in this one - I don't know the person he's talking to and I only see half the conversation anyway.
+
+I'd love it if Twitter had a toggle at the top of that page to turn display of replies and retweets on and off, but they don't - so I wrote some myself. Below are two bookmarklets - drag them to your bookmark bar and they'll toggle replies and/or retweets on and off accordingly, giving you something like this:
+
+![@GlennF timeline without replies](/images/glennf-timeline-without-replies.png)
+
+Much better!
+
+## Toggle replies bookmarklet
+
+This bookmarklet toggles replies on and off when viewing someone's timeline at twitter.com.
+
+<!-- Toggle replies -->
+<a href="javascript:(function(){var%20t=$('div.tweet[data-is-reply-to=true]').parents('div.stream-item');var%20s=t.filter(':visible').size()==0;t.toggle(s);})();">Toggle @s</a>
+
+*Instructions: drag the link to your bookmarks bar, click to invoke.*
+
+## Toggle retweets bookmarklet
+
+This bookmarklet toggles retweets on and off when viewing someone's timeline at twitter.com.
+
+
+<!-- Toggle retweets -->
+<a href="javascript:(function(){var%20t=$('div.tweet[data-retweet-id]').parents('div.stream-item');var%20s=t.filter(':visible').size()==0;t.toggle(s);})();">Toggle RTs</a>
+
+*Instructions: drag the link to your bookmarks bar, click to invoke.*
+
+## Source code
+
+The bookmarklets aren't perfect. You may need to re-invoke them on scrolling down the page as Twitter loads more tweets on demand. But they're simple to install and use and suit the purpose I wanted them for.
+
+Here's an expanded version of the source for each bookmarklet, featuring self-documenting variable names, nice formatting and comments. Feel free to hack accordingly and improve the bookmarklets. [Let me know](http://twitter.com/s1mn/) if you've got improvements you'd like to share.
+
+{% gist 2488632 %}
BIN  source/images/glennf-timeline-with-replies.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  source/images/glennf-timeline-without-replies.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.