A Jetpack: Tweet This!

I wrote my first entry for the Jetpack 50-line Code Challenge a few weeks ago and I would like to share it with you now. The Jetpack is called Tweet This!, and it is meant to help you quickly tweet about a page you are viewing in Firefox with the document's published short url, if it is defined (otherwise tr.im is used).

Tweet This!

Details

The Tweet This! Jetpack adds a 'Tweet This!' menu item to Firefox's 'Bookmarks' menu and context menu, which when used, will allow the user to Tweet about the page they are on. A user can select some text on the page, or else the page's title will be used for some text in the tweet, and then the Jetpack will first check if the text + long url is less than 140 characters long, and just use the long url if so, but otherwise it will use my Get Short URL service (hosted by Google App Engine) to find the shortest url for the page, which is published by the page, and if one has not been published which is smaller than a length you can change in settings, but is by default 35. If the shortest url found is not shorter than the setting length specified then the tr.im service is used to create a short url for the page.

After the Jetpack has a short url for the page, and some text to tweet about it, it will finally trim the text so that the tweet is equal to 140 chars if necessary, then send the tweet, and notify you with the tweet if it has been sent (also the username that it was sent from is displayed).

Notes

  • If you do not see a notification, then an error occurred, and no tweet was sent, so it will be safe to try again, just make sure you wait about a minute before trying again (don't be too hasty). An error would only occur if the Tr.im or Twitter servers return an error.
  • The jetpack settings are pretty basic, and while they provide a range type they do not show the range to the user, or the value the user has selected in the range. Hopefully this will be changed in short time, but until then I'll just let you know here the Max URL Length range is from 20 to 100.

Trivia

  • Only 49 lines of code.
  • Uses both APIs added to the arsenal in Jetpack 0.6
  • Uses 3 future Jetpack APIs.
  • Uses the following 6 Jetpack APIs:
    • jetpack.lib.twitter
    • jetpack.menu (future api, added in 0.6)
    • jetpack.notifications
    • jetpack.selection (future api)
    • jetpack.storage.settings (future api, added in 0.6)
    • jetpack.tabs
  • Uses the following 3 External APIs:
    • getshorturl.appsport.com
    • tr.im
    • twitter

Screen Shot

Screen shot of 'Tweet This!' in the 'Bookmarks' Firefox menu

How To Install

  1. Get Firefox here.
  2. Get Jetpack here
  3. Get the Tweet This! Jetpack here

Links

© Erik Vold 2007-2012. Contact Erik Vold. Top ^